diff --git a/maarch_entreprise/trunk/actions/close_mail.php b/maarch_entreprise/trunk/actions/close_mail.php new file mode 100644 index 0000000000000000000000000000000000000000..9e5d8921b942fb44191dd886cdb55f1e33b514f0 --- /dev/null +++ b/maarch_entreprise/trunk/actions/close_mail.php @@ -0,0 +1,100 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Action : simple confirm +* +* Open a modal box to confirm a status modification. Used by the core (manage_action.php page). +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup apps +*/ + +/** +* $confirm bool true +*/ + $confirm = true; + +/** +* $etapes array Contains only one etap, the status modification +*/ + $etapes = array('status','close'); + +require_once($_SESSION['pathtocoreclass']."class_history.php"); + +/** +* Manages a status (All params must be declared, even if not used, to corresponds to the action management of the core) +* +* @param $arr_id array Contains the res_id to be modified +* @param $history string Not Used here +* @param $id_action string Action identifier +* @param $label_action string Action label +* @param $status string New status +* @return bool false in sql error case, true otherwise +*/ +function manage_status($arr_id, $history, $id_action, $label_action, $status) +{ + $db = new dbquery(); + $db->connect(); + $result = ''; + for($i=0; $i<count($arr_id );$i++) + { + $result .= $arr_id[$i].'#'; + $req = $db->query("update ".$_POST['table']. " set status = '".$status."' where res_id = ".$arr_id[$i], true); + if(!$req) + { + $_SESSION['error'] = _SQL_ERROR; + return false; + } + } + return array('result' => $result, 'history_msg' => ''); + //return true; + } + +function manage_close($arr_id, $history, $id_action, $label_action, $status) +{ + $db = new dbquery(); + $db->connect(); + $result = ''; + require_once($_SESSION['pathtocoreclass'].'class_security.php'); + require_once($_SESSION['pathtocoreclass'].'class_request.php'); + $sec = new security(); + $req = new request(); + $ind_coll = $sec->get_ind_collection($_POST['coll_id']); + $ext_table = $_SESSION['collections'][$ind_coll]['extensions'][0]; + $current_date = $req->current_datetime(); + for($i=0; $i<count($arr_id );$i++) + { + $result .= $arr_id[$i].'#'; + $req = $db->query("update ".$ext_table. " set closing_date = ".$current_date." where res_id = ".$arr_id[$i], true); + + if(!$req) + { + $_SESSION['error'] = _SQL_ERROR; + return false; + } + + } + return array('result' => $result, 'history_msg' => ''); + } +?> diff --git a/maarch_entreprise/trunk/actions/confirm_status.php b/maarch_entreprise/trunk/actions/confirm_status.php new file mode 100644 index 0000000000000000000000000000000000000000..fbf16605d7675038e78aa3f18300ea73049099a7 --- /dev/null +++ b/maarch_entreprise/trunk/actions/confirm_status.php @@ -0,0 +1,73 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Action : simple confirm +* +* Open a modal box to confirm a status modification. Used by the core (manage_action.php page). +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup apps +*/ + +/** +* $confirm bool true +*/ + $confirm = true; + +/** +* $etapes array Contains only one etap, the status modification +*/ + $etapes = array('status'); + +require_once($_SESSION['pathtocoreclass']."class_history.php"); + +/** +* Manages a status (All params must be declared, even if not used, to corresponds to the action management of the core) +* +* @param $arr_id array Contains the res_id to be modified +* @param $history string Not Used here +* @param $id_action string Action identifier +* @param $label_action string Action label +* @param $status string New status +* @return bool false in sql error case, true otherwise +*/ +function manage_status($arr_id, $history, $id_action, $label_action, $status) +{ + $db = new dbquery(); + $db->connect(); + $result = ''; + for($i=0; $i<count($arr_id );$i++) + { + $result .= $arr_id[$i].'#'; + $req = $db->query("update ".$_POST['table']. " set status = '".$status."' where res_id = ".$arr_id[$i], true); + if(!$req) + { + $_SESSION['error'] = _SQL_ERROR; + return false; + } + } + return array('result' => $result, 'history_msg' => ''); + //return true; + } +?> diff --git a/maarch_entreprise/trunk/actions/index_mlb.php b/maarch_entreprise/trunk/actions/index_mlb.php new file mode 100644 index 0000000000000000000000000000000000000000..1e9546ff6effe373dd0bc8190799d851d318fad7 --- /dev/null +++ b/maarch_entreprise/trunk/actions/index_mlb.php @@ -0,0 +1,1358 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Action : indexing a file +* +* Open a modal box to displays the indexing form, make the form checks and loads the result in database. Used by the core (manage_action.php page). +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup apps +*/ +/** +* $confirm bool false +*/ +$confirm = false; +/** +* $etapes array Contains only one etap : form +*/ +$etapes = array('form'); +/** +* $frm_width Width of the modal (empty) +*/ +$frm_width=''; +/** +* $frm_height Height of the modal (empty) +*/ +$frm_height = ''; +/** +* $mode_form Mode of the modal : fullscreen +*/ +$mode_form = 'fullscreen'; +$_SESSION['validStep'] = "ko"; +include($_SESSION['config']['businessapppath'].'definition_mail_categories.php'); + +/** + * Returns the indexing form text + * + * @param $values Array Not used here + * @param $path_manage_action String Path to the PHP file called in Ajax + * @param $id_action String Action identifier + * @param $table String Table + * @param $module String Origin of the action + * @param $coll_id String Collection identifier + * @param $mode String Action mode 'mass' or 'page' + * @return String The form content text + **/ +function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode ) +{ + if (preg_match("/MSIE 6.0/", $_SERVER["HTTP_USER_AGENT"])) + { + $browser_ie = true; + $display_value = 'block'; + } + elseif(preg_match('/msie/i', $_SERVER["HTTP_USER_AGENT"]) && !preg_match('/opera/i', $HTTP_USER_AGENT) ) + { + $browser_ie = true; + $display_value = 'block'; + } + else + { + $browser_ie = false; + $display_value = 'table-row'; + } + $_SESSION['req'] = "action"; + $res_id = $values[0]; + $frm_str = ''; + require_once($_SESSION['pathtocoreclass']."class_security.php"); + require_once($_SESSION['pathtomodules']."basket".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_business_app_tools.php"); + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_types.php"); + $type = new types(); + $sec =new security(); + $b = new basket(); + $core_tools =new core_tools(); + $business = new business_app_tools(); + $doctypes = $type-> getArrayStructTypes($coll_id); + $today = date('d-m-Y'); + $tmp = $business->get_titles(); + $titles = $tmp['titles']; + $default_title = $tmp['default_title']; + if($core_tools->is_module_loaded('entities')) + { + $services = array(); + $db = new dbquery(); + $db->connect(); + if(!empty($_SESSION['user']['redirect_groupbasket'][$_SESSION['current_basket']['id']][$id_action]['entities'])) + { + $db->query("select entity_id, entity_label from ".$_SESSION['tablename']['ent_entities']." where entity_id in (".$_SESSION['user']['redirect_groupbasket'][$_SESSION['current_basket']['id']][$id_action]['entities'].") and enabled= 'Y' order by entity_label"); + while($res = $db->fetch_object()) + { + array_push($services, array( 'ID' => $res->entity_id, 'LABEL' => $db->show_string($res->entity_label))); + } + } + } + + if($core_tools->is_module_loaded('physical_archive')) + { + $boxes = array(); + $db = new dbquery(); + $db->connect(); + + $db->query("select arbox_id, title from ".$_SESSION['tablename']['ar_boxes']." where status = 'NEW' order by title"); + while($res = $db->fetch_object()) + { + array_push($boxes, array( 'ID' => $res->arbox_id, 'LABEL' => $db->show_string($res->title))); + } + + } + + $frm_str .= '<div id="validleft">'; + $frm_str .= '<div id="index_div" style="display:none;";>'; + $frm_str .= '<h1 class="tit" id="action_title"><img src="'.$_SESSION['config']['img'].'/file_index_b.gif" align="middle" alt="" />'._INDEXATION_TITLE; + $frm_str .= '</h1>'; + $frm_str .= '<div id="frm_error_'.$id_action.'" class="indexing_error"></div>'; + $frm_str .= '<form name="index_file" method="post" id="index_file" action="#" class="forms indexingform" style="text-align:left;">'; + + $frm_str .= '<input type="hidden" name="values" id="values" value="'.$res_id.'" />'; + $frm_str .= '<input type="hidden" name="action_id" id="action_id" value="'.$id_action.'" />'; + $frm_str .= '<input type="hidden" name="mode" id="mode" value="'.$mode.'" />'; + $frm_str .= '<input type="hidden" name="table" id="table" value="'.$table.'" />'; + $frm_str .= '<input type="hidden" name="coll_id" id="coll_id" value="'.$coll_id.'" />'; + $frm_str .= '<input type="hidden" name="module" id="module" value="'.$module.'" />'; + $frm_str .= '<input type="hidden" name="req" id="req" value="second_request" />'; + + $frm_str .= '<div style="display:block">'; + if($_SESSION['FILE']['extension'] == "") + { + $frm_str .= '<div style="display:block" id="choose_file_div">'; + $frm_str .= '<iframe src="'.$_SESSION['config']['businessappurl'].'indexing_searching/choose_file.php" name="choose_file" id="choose_file" frameborder="0" scrolling="no" width="100%" height="40"></iframe>'; + $frm_str .= '</div>'; + } + $frm_str .= '<table width="100%" align="center" border="0">'; + + /*** Category ***/ + $frm_str .= '<tr id="category_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="category_id" class="form_title" >'._CATEGORY.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="category_id" id="category_id" onchange="clear_error(\'frm_error_'.$id_action.'\');change_category(this.options[this.selectedIndex].value, \''.$display_value.'\', \''.$_SESSION['config']['businessappurl'].'indexing_searching/change_category.php\', \''.$_SESSION['config']['businessappurl'].'get_content_js.php\');">'; + $frm_str .='<option value="">'._CHOOSE_CATEGORY.'</option>'; + foreach(array_keys($_SESSION['mail_categories']) as $cat_id) + { + $frm_str .='<option value="'.$cat_id.'"'; + if($_SESSION['default_category'] == $cat_id || $_SESSION['indexing']['category_id'] == $cat_id) + { + $frm_str .='selected="selected"'; + } + + $frm_str .='>'.$_SESSION['mail_categories'][$cat_id].'</option>'; + + } + $frm_str.='</select></td>'; + $frm_str.='<td><span class="red_asterisk" id="category_id_mandatory" style="display:inline;">*</span></td>'; + $frm_str .= '</tr>'; + /*** Doctype ***/ + $frm_str .= '<tr id="type_id_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><span class="form_title" id="doctype_res" style="display:none;">'._DOCTYPE.'</span><span class="form_title" id="doctype_mail" style="display:inline;">'._DOCTYPE_MAIL.'</span></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="type_id" id="type_id" onchange="clear_error(\'frm_error_'.$id_action.'\');change_doctype(this.options[this.selectedIndex].value, \''.$_SESSION['config']['businessappurl'].'indexing_searching/change_doctype.php\', \''._ERROR_DOCTYPE.'\', \''.$id_action.'\', \''.$_SESSION['config']['businessappurl'].'get_content_js.php\');">'; + $frm_str .='<option value="">'._CHOOSE_TYPE.'</option>'; + for($i=0; $i<count($doctypes);$i++) + { + $frm_str .='<option value="" class="doctype_level1">'. $doctypes[$i]['label'].'</option>'; + for($j=0; $j<count($doctypes[$i]['level2']);$j++) + { + $frm_str .='<option value="" class="doctype_level2"> '.$doctypes[$i]['level2'][$j]['label'].'</option>'; + for($k=0; $k<count($doctypes[$i]['level2'][$j]['types']);$k++) + { + $frm_str .='<option value="'.$doctypes[$i]['level2'][$j]['types'][$k]['id'].'" > '.$doctypes[$i]['level2'][$j]['types'][$k]['label'].'</option>'; + } + } + } + $frm_str .='</select></td>'; + $frm_str .='<td><span class="red_asterisk" id="type_id_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Priority ***/ + $frm_str .= '<tr id="priority_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="priority" class="form_title" >'._PRIORITY.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="priority" id="priority" onchange="clear_error(\'frm_error_'.$id_action.'\');">'; + $frm_str .='<option value="">'._CHOOSE_PRIORITY.'</option>'; + for($i=0; $i<count($_SESSION['mail_priorities']);$i++) + { + $frm_str .='<option value="'.$i.'" '; + if($_SESSION['default_mail_priority'] == $i) + { + $frm_str .='selected="selected"'; + } + $frm_str .='>'.$_SESSION['mail_priorities'][$i].'</option>'; + } + $frm_str .='</select></td>'; + $frm_str .='<td><span class="red_asterisk" id="priority_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Doc date ***/ + $frm_str .= '<tr id="doc_date_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="doc_date" class="form_title" id="mail_date_label" style="display:inline;" >'._MAIL_DATE.'</label><label for="doc_date" class="form_title" id="doc_date_label" style="display:none;" >'._DOC_DATE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input name="doc_date" type="text" id="doc_date" value="'.$today.'" onclick="clear_error(\'frm_error_'.$id_action.'\');showCalender(this);" /></td>'; + $frm_str .='<td><span class="red_asterisk" id="doc_date_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr >'; + /*** Author ***/ + $frm_str .= '<tr id="author_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="author" class="form_title" >'._AUTHOR.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input name="author" type="text" id="author" onchange="clear_error(\'frm_error_'.$id_action.'\');"/></td>'; + $frm_str .='<td><span class="red_asterisk" id="author_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Admission date ***/ + $frm_str .= '<tr id="admission_date_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="admission_date" class="form_title" >'._RECEIVING_DATE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input name="admission_date" type="text" id="admission_date" value="'.$today.'" onclick="clear_error(\'frm_error_'.$id_action.'\');showCalender(this);"/></td>'; + $frm_str .='<td><span class="red_asterisk" id="admission_date_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Contact ***/ + $frm_str .= '<tr id="contact_choose_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="type_contact" class="form_title" ><span id="exp_contact_choose_label">'._SHIPPER_TYPE.'</span><span id="dest_contact_choose_label">'._DEST_TYPE.'</span></label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="radio" class="check" name="type_contact" id="type_contact_internal" value="internal" onclick="clear_error(\'frm_error_'.$id_action.'\');change_contact_type(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\', true);" />'._INTERNAL2.'<input type="radio" name="type_contact" id="type_contact_external" value="external" onclick="clear_error(\'frm_error_'.$id_action.'\');change_contact_type(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\', true);" class="check"/>'._EXTERNAL.'</td>'; + $frm_str .='<td><span class="red_asterisk" id="type_contact_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="contact_id_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="contact" class="form_title" ><span id="exp_contact">'._SHIPPER.'</span><span id="dest_contact">'._DEST.'</span>'; + if($_SESSION['features']['personal_contact'] == "true" && $core_tools->test_service('my_contacts','apps', false)) + { + $frm_str .=' <a href="#" id="create_contact" title="'._CREATE_CONTACT.'" onclick="new Effect.toggle(\'create_contact_div\', \'blind\', {delay:0.2});return false;" style="display:inline;" ><img src="'.$_SESSION['config']['businessappurl'].'img/modif_liste.png" alt="'._CREATE_CONTACT.'"/></a>'; + } + $frm_str .= '</label></td>'; + $frm_str .= '<td><a href="#" id="contact_card" title="'._CONTACT_CARD.'" onclick="open_contact_card(\''.$_SESSION ['config']['businessappurl'].'contact_info.php\', \''.$_SESSION ['config']['businessappurl'].'user_info.php\');" style="visibility:hidden;" ><img src="'.$_SESSION['config']['businessappurl'].'img/my_contacts_off.gif" alt="'._CONTACT_CARD.'" /></a> </td>'; + $frm_str .='<td class="indexing_field"><input type="text" name="contact" id="contact" onblur="clear_error(\'frm_error_'.$id_action.'\');display_contact_card(\'visible\');" /><div id="show_contacts" class="autocomplete"></div></td>'; + $frm_str .='<td><span class="red_asterisk" id="contact_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Nature ***/ + $frm_str .= '<tr id="nature_id_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="nature_id" class="form_title" >'._NATURE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="nature_id" id="nature_id" onchange="clear_error(\'frm_error_'.$id_action.'\');">'; + $frm_str .='<option value="">'. _CHOOSE_NATURE.'</option>'; + foreach(array_keys($_SESSION['mail_natures']) as $nature) + { + $frm_str .='<option value="'.$nature.'"'; + if($_SESSION['default_mail_nature'] == $nature) + { + $frm_str .='selected="selected"'; + } + $frm_str .='>'.$_SESSION['mail_natures'][$nature].'</option>'; + } + $frm_str .= '</select></td>'; + $frm_str .='<td><span class="red_asterisk" id="nature_id_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Subject ***/ + $frm_str .= '<tr id="subject_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="subject" class="form_title" >'._SUBJECT.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><textarea name="subject" id="subject" rows="4" onchange="clear_error(\'frm_error_'.$id_action.'\');" ></textarea></td>'; + $frm_str .='<td><span class="red_asterisk" id="subject_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Entities : department + diffusion list ***/ + if($core_tools->is_module_loaded('entities')) + { + $frm_str .= '<tr id="department_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="department" class="form_title" id="label_dep_dest" style="display:inline;" >'._DEPARTMENT_DEST.'</label><label for="department" class="form_title" id="label_dep_exp" style="display:none;" >'._DEPARTMENT_EXP.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="destination" id="destination" onchange="clear_error(\'frm_error_'.$id_action.'\');change_entity(this.options[this.selectedIndex].value, \''.$_SESSION['urltomodules'].'entities/load_listinstance.php'.'\',\'diff_list_div\', \'indexing\', \''.$display_value.'\');">'; + $frm_str .='<option value="">'._CHOOSE_DEPARTMENT.'</option>'; + for($i=0; $i < count($services); $i++) + { + $frm_str .='<option value="'.$services[$i]['ID'].'" >'.$db->show_string($services[$i]['LABEL']).'</option>'; + } + $frm_str .='</select></td>'; + $frm_str .='<td><span class="red_asterisk" id="destination_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="diff_list_tr" style="display:none;">'; + $frm_str .= '<td colspan="3">'; + $frm_str .= '<div id="diff_list_div" class="scroll_div" style="height:150px;"></div>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + } + /*** Physical_archive : Arbox ***/ + if($core_tools->is_module_loaded('physical_archive')) + { + $frm_str .= '<tr id="box_id_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="arbox_id" class="form_title" id="label_box" style="display:inline;" >'._BOX_ID.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="arbox_id" id="arbox_id" onchange="clear_error(\'frm_error_'.$id_action.'\');" >'; + $frm_str .='<option value="">'._CHOOSE_BOX.'</option>'; + for($i=0; $i < count($boxes); $i++) + { + $frm_str .='<option value="'.$boxes[$i]['ID'].'" >'.$db->show_string($boxes[$i]['LABEL']).'</option>'; + } + $frm_str .='</select></td>'; + $frm_str .='<td><span class="red_asterisk" id="arbox_id_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + } + /*** Process limit date ***/ + $frm_str .= '<tr id="process_limit_date_use_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="process_limit_date_use" class="form_title" >'._PROCESS_LIMIT_DATE_USE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="radio" name="process_limit_date_use" id="process_limit_date_use_yes" class="check" value="yes" checked="checked" onclick="clear_error(\'frm_error_'.$id_action.'\');activate_process_date(true,\''.$display_value.'\' );" />'._YES.'<input type="radio" name="process_limit_date_use" id="process_limit_date_use_no" value="no" class="check" onclick="clear_error(\'frm_error_'.$id_action.'\');activate_process_date(false, \''.$display_value.'\');"/>'._NO.'</td>'; + $frm_str .='<td><span class="red_asterisk" id="process_limit_date_use_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="process_limit_date_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="process_limit_date" class="form_title" >'._PROCESS_LIMIT_DATE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input name="process_limit_date" type="text" id="process_limit_date" value="" onclick="showCalender(this);" onchange="clear_error(\'frm_error_'.$id_action.'\');"/></td>'; + $frm_str .='<td><span class="red_asterisk" id="process_limit_date_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + + /*** Chrono number ***/ + $frm_str .= '<tr id="chrono_number_tr" style="display:'.$display_value.';">'; + $frm_str .='<td><label for="chrono_number" class="form_title" >'._CHRONO_NUMBER.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="text" name="chrono_number" id="chrono_number" onchange="clear_error(\'frm_error_'.$id_action.'\');"/></td>'; + $frm_str .='<td><span class="red_asterisk" id="chrono_number_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + + + /*** Folder : Market & Project ***/ + if($core_tools->is_module_loaded('folder')) + { + $frm_str .= '<tr id="project_tr" style="display:'.$display_value.';">'; + $frm_str .= '<td><label for="project" class="form_title" >'._PROJECT.'</label></td>'; + $frm_str .= '<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="text" name="project" id="project" onblur="clear_error(\'frm_error_'.$id_action.'\');return false;" /><div id="show_project" class="autocomplete"></div></td>'; // $(\'market\').value=\'\'; + $frm_str .='<td><span class="red_asterisk" id="project_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="market_tr" style="display:'.$display_value.';">'; + $frm_str .= '<td><label for="market" class="form_title" >'._MARKET.'</label></td>'; + $frm_str .= '<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="text" name="market" id="market" onblur="clear_error(\'frm_error_'.$id_action.'\');fill_project(\''.$_SESSION['urltomodules'].'folder/ajax_get_project.php\');return false;" /><div id="show_market" class="autocomplete"></div></td>'; + $frm_str .='<td><span class="red_asterisk" id="market_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + } + $frm_str .= '</table>'; + $frm_str .= '</div>'; + /*** Actions ***/ + $frm_str .= '<hr width="90%"/>'; + $frm_str .= '<p align="center">'; + $frm_str .= '<b>'._ACTIONS.' : </b>'; + + $actions = $b->get_actions_from_current_basket($res_id, $coll_id, 'PAGE_USE', false); + if(count($actions) > 0) + { + $frm_str .='<select name="chosen_action" id="chosen_action">'; + $frm_str .='<option value="">'._CHOOSE_ACTION.'</option>'; + for($ind_act = 0; $ind_act < count($actions);$ind_act++) + { + $frm_str .='<option value="'.$actions[$ind_act]['VALUE'].'"'; + if($ind_act==0) + { + $frm_str .= 'selected="selected"'; + } + $frm_str .= '>'.$actions[$ind_act]['LABEL'].'</option>'; + } + $frm_str .='</select> '; + $frm_str .= '<input type="button" name="send" id="send" value="'._VALIDATE.'" class="button" onclick="valid_action_form( \'index_file\', \''.$path_manage_action.'\', \''. $id_action.'\', \''.$res_id.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');"/> '; + } + $frm_str .= '<input name="close" id="close" type="button" value="'._CANCEL.'" class="button" onClick="javascript:$(\'baskets\').style.visibility=\'visible\';destroyModal(\'modal_'.$id_action.'\');reinit();"/>'; + $frm_str .= '</p>'; + $frm_str .= '</form>'; + $frm_str .= '</div>'; + $frm_str .= '</div>'; + $frm_str .= '</div>'; + + /*** Frame to display the doc ***/ + $frm_str .= '<div id="validright">'; + $frm_str .= '<div id="create_contact_div" style="display:none">'; + $frm_str .= '<div>'; + $frm_str .= '<form name="indexingfrmcontact" id="indexingfrmcontact" method="post" action="'.$_SESSION['config']['businessappurl'].'contact_info.php" >'; + + $frm_str .= '<table>'; + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .= '<label for="is_corporate">'._IS_CORPORATE_PERSON.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input type="radio" class="check" name="is_corporate" id="is_corporate_Y" value="Y" '; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .=' checked="checked"'; + }elseif(empty($contact['IS_CORPORATE_PERSON'])) + { + $frm_str .=' checked="checked"'; + } + $frm_str .= 'onclick="javascript:show_admin_contacts(true, \''.$display_value.'\');">'._YES; + $frm_str .='<input type="radio" id="is_corporate_N" class="check" name="is_corporate" value="N"'; + if($contact_info['IS_CORPORATE_PERSON'] == 'N') + { + $frm_str .=' checked="checked"'; + } + $frm_str .=' onclick="javascript:show_admin_contacts( false, \''.$display_value.'\');"/>'._NO; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="title_p" style="display:'; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .= 'none'; + } + else + { + $frm_str .= $display_value; + } + $frm_str .='">'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="title">'._TITLE2.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2" >'; + $frm_str .='<select name="title" id="title" >'; + $frm_str .='<option value="">'._CHOOSE_TITLE.'</option>'; + foreach(array_keys($titles) as $key) + { + $frm_str .='<option value="'.$key.'" '; + if($key == $default_title) + { + $frm_str .= 'selected="selected"'; + } + $frm_str .='>'.$titles[$key].'</option>'; + } + $frm_str .='</select>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="lastname_p" style="display:'; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .= 'none'; + } + else + { + $frm_str .= $display_value; + } + $frm_str .='">'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="lastname">'._LASTNAME.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="lastname" type="text" id="lastname" value="'.$core_tools->show($contact_info['LASTNAME']).'" /> '; + $frm_str .='<span class="red_asterisk" id="lastname_mandatory" style="display:none;">*</span>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="firstname_p" style="display:'; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .= 'none'; + } + else + { + $frm_str .= $display_value; + } + $frm_str .='">'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="firstname">'._FIRSTNAME.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="firstname" type="text" id="firstname" value="'.$core_tools->show($contact_info['FIRSTNAME']).'"/>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="society">'._SOCIETY.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="society" type="text" id="society" value="'.$core_tools->show($contact_info['SOCIETY']).'" />'; + $frm_str .='<span class="red_asterisk" id="society_mandatory" style="display:inline;">*</span>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + + $frm_str .= '<tr id="function_p" style="display:'; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .= 'none'; + } + else + { + $frm_str .= 'block'; + } + $frm_str .='">'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="function">'._FUNCTION.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="function" type="text" id="function" value="'.$core_tools->show($contact_info['FUNCTION']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="phone">'._PHONE.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="phone" type="text" id="phone" value="'.$core_tools->show($contact_info['PHONE']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="mail">'._MAIL.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="mail" type="text" id="mail" value="'.$core_tools->show($contact_info['MAIL']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; +/* + $frm_str .='<p >'; + $frm_str .='<label><b>'._ADDRESS.' </b></label>'; + $frm_str .='</p>'; +*/ + //$frm_str .='<br/>'; + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .='<label for="num">'._NUM.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="num" type="text" class="small" id="num" value="'.$core_tools->show($contact_info['ADD_NUM']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<label for="street">'._STREET.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="street" type="text" class="medium" id="street" value="'.$core_tools->show($contact_info['ADD_STREET']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + +/* + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .='<label for="label">'._STREET.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="street" type="text" id="street" value="'.$core_tools->show($contact_info['ADD_STREET']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; +*/ + + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="add_comp">'._COMPLEMENT.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="add_comp" type="text" id="add_comp" value="'.$core_tools->show($contact_info['ADD_COMP']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + +/* + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .='<label for="label">'._TOWN.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="town" type="text" id="town" value="'.$core_tools->show($contact_info['ADD_TOWN']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; +*/ + + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .='<label for="cp">'._POSTAL_CODE.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="cp" type="text" id="cp" value="'.$core_tools->show($contact_info['ADD_CP']).'" class="small" />'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<label for="town">'._TOWN.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="town" type="text" id="town" value="'.$core_tools->show($contact_info['ADD_TOWN']).'" class="medium" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="country">'._COUNTRY.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="country" type="text" id="country" value="'.$core_tools->show($contact_info['ADD_COUNTRY']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; +/* + $frm_str .='</p>'; + $frm_str .='<p><label><b>'._COMP.' </b></label></p>'; + $frm_str .='<br/>'; +*/ + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="comp_data">'._COMP_DATA.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<textarea name="comp_data" id="comp_data" >'.$core_tools->show($contact_info['OTHER_DATA']).'</textarea>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '</table>'; + $frm_str .='<div align="center">'; + if(!$readonly) + { + $frm_str .='<input name="submit" type="button" value="'._VALIDATE.'" class="button" onclick="create_contact(\''.$_SESSION['config']['businessappurl'].'create_contact.php\', \''.$id_action.'\');" />'; + } + $frm_str .=' <input name="cancel" type="button" value="'._CANCEL.'" onclick="new Effect.toggle(\'create_contact_div\', \'blind\', {delay:0.2});clear_form(\'indexingfrmcontact\');return false;" class="button" />'; + $frm_str .='</div>'; + $frm_str .='</form >'; + $frm_str .= '</div><br/>'; + $frm_str .= '</div>'; + $frm_str .= '<script type="text/javascript">show_admin_contacts( true);</script>'; + $frm_str .= '<iframe src="'.$_SESSION['config']['businessappurl'].'indexing_searching/file_iframe.php" name="file_iframe" id="file_iframe" scrolling="auto" frameborder="0" ></iframe>'; + $frm_str .= '</div>'; + + /*** Extra javascript ***/ + $frm_str .= '<script type="text/javascript">resize_frame_process(\'modal_'.$id_action.'\', \'file_iframe\', true, true);window.scrollTo(0,0);change_category(\''.$_SESSION['default_category'].'\', \''.$display_value.'\', \''.$_SESSION['config']['businessappurl'].'indexing_searching/change_category.php\', \''.$_SESSION['config']['businessappurl'].'get_content_js.php\');launch_autocompleter_contacts(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\');'; + if($core_tools->is_module_loaded('folder')) + { + $frm_str .= 'launch_autocompleter_folders(\''.$_SESSION['urltomodules'].'folder/autocomplete_folders.php?mode=project\', \'project\');launch_autocompleter_folders(\''.$_SESSION['urltomodules'].'folder/autocomplete_folders.php?mode=market\', \'market\');'; + } + $frm_str .='$(\'baskets\').style.visibility=\'hidden\';var item = $(\'index_div\'); if(item){item.style.display=\'block\';}</script>'; + + return addslashes($frm_str); +} + +/** + * Checks the action form + * + * @param $form_id String Identifier of the form to check + * @param $values Array Values of the form + * @return Bool true if no error, false otherwise + **/ +function check_form($form_id,$values) +{ + if(count($values) < 1 || empty($form_id)) + { + $_SESSION['error'] = _FORM_ERROR; + return false; + } + else + { + $cat_id = ''; + for($i=0; $i<count($values); $i++) + { + if($values[$i]['ID'] == "category_id" ) + { + $cat_id = $values[$i]['VALUE']; + break; + } + } + if(empty($cat_id)) + { + $_SESSION['error'] = _CATEGORY.' '._IS_EMPTY; + return false; + } + $no_error = process_category_check($cat_id, $values); + + if($no_error == false) + { + //$_SESSION['error'] .= _ERROR_CATEGORY; + return false; + } + + $coll_id = ''; + for($i=0; $i<count($values); $i++) + { + if($values[$i]['ID'] == "coll_id" ) + { + $coll_id = $values[$i]['VALUE']; + break; + } + } + + if($_SESSION['upfile']['format'] <> 'maarch') + { + require_once($_SESSION['config']['businessapppath'].'class'.DIRECTORY_SEPARATOR.'class_indexing_searching_app.php'); + $is = new indexing_searching_app(); + $state = $is->is_filetype_allowed($_SESSION['upfile']['format']); + if(!$state) + { + $_SESSION['error'].= '<br/>'.$_SESSION['upfile']['format']._FILETYPE.' '._NOT_ALLOWED; + return false; + } + } + return check_docserver($coll_id); + } +} + +/** + * Makes all the checks on the docserver + * + * @param $cat_id String Collection identifier + * @return Bool true if no error, false otherwise + **/ +function check_docserver($coll_id) +{ + require_once($_SESSION['pathtocoreclass']."class_docserver.php"); + $core_tools =new core_tools(); + + // Gets the available docserver for the collection + $docserver = new docserver($_SESSION['tablename']['docservers'], $coll_id,$_SESSION["config"]["lang"]); + $error = $docserver->get_error(); + if(!empty($error)) + { + $_SESSION['error'] = _DOCSERVER_ERROR.' : '.$error; + return false; + } + + if($core_tools->is_module_loaded('templates') && $_SESSION['upfile']['format'] == "maarch") + { + if(!isset($_SESSION['template_content']) || empty($_SESSION['template_content'])) + { + $_SESSION['error'] = _TEMPLATE.' '._IS_EMPTY; + return false; + } + $path_tmp = $_SESSION['config']['tmppath'].DIRECTORY_SEPARATOR."tmp_file_".$_SESSION['user']['UserId'].".maarch"; + + $myfile = fopen($path_tmp, "w"); + + if(!$myfile) + { + $_SESSION['error'] .= _FILE_OPEN_ERROR.'.<br/>'; + return false; + } + + fwrite($myfile, $_SESSION['template_content']); + fclose($myfile); + $_SESSION['upfile']['size'] = filesize($path_tmp); + } + + // Checks the size of the docserver + $new_size = $docserver->check_size($_SESSION['upfile']['size'], $_SESSION["config"]["lang"]); + if($new_size == 0) + { + $_SESSION['error'] = _DOCSERVER_ERROR.' : '.$docserver->get_error(); + return false; + } + + if($_SESSION['origin'] == "scan") + { + $tmp = $_SESSION['pathtomodules'].'indexing_searching'.DIRECTORY_SEPARATOR.'tmp/'; + } + else + { + $tmp = $_SESSION['config']['tmppath']; + } + $d = dir($tmp); + $path_tmp = $d->path; + if($_SESSION['origin'] == "scan") + { + $new_file_name = "tmp_file_".$_SESSION['upfile']['md5'].'.'.strtolower($_SESSION['upfile']['format']); + } + else + { + $new_file_name = "tmp_file_".$_SESSION['user']['UserId'].'.'.strtolower($_SESSION['upfile']['format']); + } + + //tmp directory browsing + while($entry = $d->read()) + { + if ($entry == $new_file_name ) + { + $tmp_source_copy = $path_tmp.$entry; + $the_file = $entry; + break; + } + } + //Directory closing + $d->close(); + // Get the new filename + $docinfo = $docserver->filename(); + if($docserver->get_error() == "txt_error_when_sending_file") + { + $_SESSION['error'] = _FILE_SEND_ERROR; + return false; + } + $destination_rept = $docinfo['destination_rept']; + $file_destination_name = $docinfo['file_destination_name']; + $docserver_id = $docserver->get_id(); + $file_path = $destination_rept.$file_destination_name.".".$_SESSION['upfile']['format']; + $tmp_source_copy = str_replace("\\\\","\\",$tmp_source_copy); + + // Tests the existence of the file + if(file_exists( $destination_rept.$file_destination_name.".".$_SESSION['upfile']['format'])) + { + $_SESSION['error'].= _FILE_ALREADY_EXISTS.". "._MORE_INFOS." : <a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>."; + return false; + } + + // Copy the file in the docserver + $cp = copy($tmp_source_copy , $destination_rept.$file_destination_name.".".$_SESSION['upfile']['format']); + + $file_name = $entry; + if($cp == false) + { + $_SESSION['error'] .= _DOCSERVER_COPY_ERROR; + return false; + } + else + { + //Delete tmp file on the tmp directory + $delete = unlink($tmp_source_copy); + if ($delete == false) + { + $_SESSION['error'] .= _TMP_FILE_DEL_ERROR; + return false; + } + } + $_SESSION['indexing']['path_template'] = $docserver->get_path(); + $destination_rept = substr($destination_rept,strlen($_SESSION['indexing']['path_template']),4); + $_SESSION['indexing']['destination_dir'] = str_replace(DIRECTORY_SEPARATOR,'#',$destination_rept); + $docserver->set_size($new_size, $_SESSION['tablename']['docservers']); + $_SESSION['indexing']['docserver_id'] = $docserver_id; + $_SESSION['indexing']['file_destination_name'] = $file_destination_name; + + $_SESSION['error'] = _CHECK_FORM_OK; + return true; +} + +/** + * Checks the values of the action form for a given category + * + * @param $cat_id String Category identifier + * @param $values Array Values of the form to check + * @return Bool true if no error, false otherwise + **/ +function process_category_check($cat_id, $values) +{ + $core = new core_tools(); + // If No category : Error + if(!isset($_ENV['categories'][$cat_id])) + { + $_SESSION['error'] = _CATEGORY.' '._UNKNOWN.': '.$cat_id; + return false; + } +//print_r($values); + // Simple cases + for($i=0; $i<count($values); $i++) + { + if($_ENV['categories'][$cat_id][$values[$i]['ID']]['mandatory'] == true && (empty($values[$i]['VALUE']) && ($values[$i]['VALUE'] == 0 && $_ENV['categories'][$cat_id][$values[$i]['ID']]['type_form'] <> 'integer'))) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id][$values[$i]['ID']]['label'].' '._IS_EMPTY; + return false; + } + if($_ENV['categories'][$cat_id][$values[$i]['ID']]['type_form'] == 'date' && !empty($values[$i]['VALUE']) && preg_match($_ENV['date_pattern'],$values[$i]['VALUE'])== 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id][$values[$i]['ID']]['label']." "._WRONG_FORMAT.""; + return false; + } + if($_ENV['categories'][$cat_id][$values[$i]['ID']]['type_form'] == 'integer' && !empty($values[$i]['VALUE']) && preg_match("/^[0-9]*$/",$values[$i]['VALUE'])== 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id][$values[$i]['ID']]['label']." "._WRONG_FORMAT.""; + return false; + } + if($_ENV['categories'][$cat_id][$values[$i]['ID']]['type_form'] == 'radio' && !empty($values[$i]['VALUE']) && !in_array($values[$i]['VALUE'], $_ENV['categories'][$cat_id][$values[$i]['ID']]['values'])) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id][$values[$i]['ID']]['label']." "._WRONG_FORMAT.""; + return false; + } + } + //print_r($values); + ///////////////////////// Other cases + // Process limit Date + $_SESSION['store_process_limit_date'] = ""; + if(isset($_ENV['categories'][$cat_id]['other_cases']['process_limit_date'])) + { + $process_limit_date_use_yes = get_value_fields($values, 'process_limit_date_use_yes'); + $process_limit_date_use_no = get_value_fields($values, 'process_limit_date_use_no'); + if($process_limit_date_use_yes == 'yes') + { + $_SESSION['store_process_limit_date'] = "ok"; + $process_limit_date = get_value_fields($values, 'process_limit_date'); + if(trim($process_limit_date) == "" || preg_match($_ENV['date_pattern'], $process_limit_date)== 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['label']." "._WRONG_FORMAT.""; + return false; + } + } + elseif($process_limit_date_use_no == 'no') + { + $_SESSION['store_process_limit_date'] = "ko"; + } + } + + // Contact + if(isset($_ENV['categories'][$cat_id]['other_cases']['contact'])) + { + $contact_type = get_value_fields($values, 'type_contact_external'); + if(!$contact_type) + { + $contact_type = get_value_fields($values, 'type_contact_internal'); + } + if(!$contact_type) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['type_contact']['label']." "._MANDATORY.""; + return false; + } + $contact = get_value_fields($values, 'contact'); + if($_ENV['categories'][$cat_id]['other_cases']['contact']['mandatory'] == true) + { + if(empty($contact)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['contact']['label'].' '._IS_EMPTY; + return false; + } + } + if(!empty($contact) ) + { + if($contact_type == 'external' && preg_match('/\([0-9]+\)$/', $contact) == 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['contact']['label']." "._WRONG_FORMAT.".<br/>"._USE_AUTOCOMPLETION; + return false; + } + elseif($contact_type == 'internal' && preg_match('/\((\s|\d|\h|\w)+\)$/i', $contact) == 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['contact']['label']." "._WRONG_FORMAT.".<br/>"._USE_AUTOCOMPLETION; + return false; + } + } + } + + if($core->is_module_loaded('entities')) + { + // Diffusion list + if(isset($_ENV['categories'][$cat_id]['other_cases']['diff_list']) && $_ENV['categories'][$cat_id]['other_cases']['diff_list']['mandatory'] == true) + { + if(empty($_SESSION['indexing']['diff_list']['dest']['user_id']) || !isset($_SESSION['indexing']['diff_list']['dest']['user_id'])) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['diff_list']['label']." "._MANDATORY.""; + return false; + } + } + } + if($core->is_module_loaded('folder')) + { + $db = new dbquery(); + $db->connect(); + $market = get_value_fields($values, 'market'); + $project_id = ''; + $market_id = ''; + if(isset($_ENV['categories'][$cat_id]['other_cases']['market']) && $_ENV['categories'][$cat_id]['other_cases']['market']['mandatory'] == true) + { + if(empty($market)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['market']['label'].' '._IS_EMPTY; + return false; + } + } + if(!empty($market) ) + { + if(!preg_match('/\([0-9]+\)$/', $market)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['market']['label']." "._WRONG_FORMAT.""; + return false; + } + $market_id = str_replace(')', '', substr($market, strrpos($market,'(')+1)); + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$market_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _MARKET.' '.$market_id.' '._UNKNOWN; + return false; + } + } + $project = get_value_fields($values, 'project'); + if(isset($_ENV['categories'][$cat_id]['other_cases']['project']) && $_ENV['categories'][$cat_id]['other_cases']['project']['mandatory'] == true) + { + if(empty($project)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['project']['label'].' '._IS_EMPTY; + return false; + } + } + if(!empty($project) ) + { + if(!preg_match('/\([0-9]+\)$/', $project)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['project']['label']." "._WRONG_FORMAT.""; + return false; + } + $project_id = str_replace(')', '', substr($project, strrpos($project,'(')+1)); + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$project_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _MARKET.' '.$project_id.' '._UNKNOWN; + return false; + } + } + if(!empty($project_id) && !empty($market_id)) + { + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$market_id." and parent_id = ".$project_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _INCOMPATIBILITY_MARKET_PROJECT; + return false; + } + } + } + + if($core->is_module_loaded('physical_archive')) + { + // Arbox id + $box_id = get_value_fields($values, 'arbox_id'); + if(isset($_ENV['categories'][$cat_id]['other_cases']['arbox_id']) && $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['mandatory'] == true) + { + if($box_id == false) + { + $_SESSION['error'] = _NO_BOX_SELECTED.' '; + return false; + } + } + if($box_id != false && preg_match('/^[0-9]+$/', $box_id)) + { + require_once($_SESSION['pathtomodules'].'physical_archive'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'); + $physical_archive = new physical_archive(); + $pa_return_value = $physical_archive->load_box_db($box_id, $cat_id, $_SESSION['user']['UserId']); + if ($pa_return_value == false) + { + $_SESSION['error'] = _ERROR_TO_INDEX_NEW_BATCH_WITH_PHYSICAL_ARCHIVE; + return false; + } + } + } + + //For specific case => chrono number + $chrono_out = get_value_fields($values, 'chrono_number'); + if(isset($_ENV['categories'][$cat_id]['other_cases']['chrono_number']) && $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['mandatory'] == true) + { + if($chrono_out == false) + { + $_SESSION['error'] = _NO_CHRONO_NUMBER_DEFINED.' '; + return false; + } + } + if($chrono_out != false && preg_match('/^[0-9]+$/', $chrono_out)) + { + require_once($_SESSION['pathtomodules'].'physical_archive'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'); + $physical_archive = new physical_archive(); + $pa_return_value = $physical_archive->load_box_db($box_id, $cat_id, $_SESSION['user']['UserId']); + if ($pa_return_value == false) + { + $_SESSION['error'] = _ERROR_TO_INDEX_NEW_BATCH_WITH_PHYSICAL_ARCHIVE; + return false; + } + } + + return true; +} + +/** + * Get the value of a given field in the values returned by the form + * + * @param $values Array Values of the form to check + * @param $field String the field + * @return String the value, false if the field is not found + **/ +function get_value_fields($values, $field) +{ + for($i=0; $i<count($values);$i++) + { + if($values[$i]['ID'] == $field) + { + return $values[$i]['VALUE']; + } + } + return false; +} + +/** + * Action of the form : loads the index in the db + * + * @param $arr_id Array Not used here + * @param $history String Log the action in history table or not + * @param $id_action String Action identifier + * @param $label_action String Action label + * @param $status String Not used here + * @param $coll_id String Collection identifier + * @param $table String Table + * @param $values_form String Values of the form to load + * @return false or an array + * $data['result'] : res_id of the new file followed by # + * $data['history_msg'] : Log complement (empty by default) + * $data['page_result'] : Page to load when action is done and modal closed + **/ +function manage_form($arr_id, $history, $id_action, $label_action, $status, $coll_id, $table, $values_form ) +{ + + if(empty($values_form) || count($arr_id) < 1 || empty($coll_id)) + { + $_SESSION['error'] = _ERROR_MANAGE_FORM_ARGS; + return false; + } + + require_once($_SESSION['pathtocoreclass']."class_db.php"); + require_once($_SESSION['pathtocoreclass']."class_security.php"); + require_once($_SESSION['pathtocoreclass']."class_request.php"); + require_once($_SESSION['pathtocoreclass']."class_resource.php"); + $db = new dbquery(); + $sec = new security(); + $core = new core_tools(); + $table = $sec->retrieve_table_from_coll($coll_id); + $ind_coll = $sec->get_ind_collection($coll_id); + $table_ext = $_SESSION['collections'][$ind_coll]['extensions'][0]; + $query_ext_fields = '('; + $query_ext_values = '('; + $resource = new resource(); + $_SESSION['data'] = array(); + + $cat_id = ''; + for($i=0; $i<count($values_form); $i++) + { + if($values_form[$i]['ID'] == "category_id" ) + { + $cat_id = $values_form[$i]['VALUE']; + break; + } + } + + $query_ext_fields .= 'category_id,' ; + $query_ext_values .= "'".$cat_id."'," ; + + // Load in the $_SESSION['data'] minimal indexes + array_push($_SESSION['data'], array('column' => "typist", 'value' => $_SESSION['user']['UserId'], 'type' => "string")); + array_push($_SESSION['data'], array('column' => "docserver_id", 'value' => $_SESSION['indexing']['docserver_id'], 'type' => "string")); + if($_SESSION['origin']<> 'store_file' && !$_SESSION['is_store']) + { + array_push($_SESSION['data'], array('column' => "status", 'value' => 'NEW', 'type' => "string")); + } + else + { + array_push($_SESSION['data'], array('column' => "status", 'value' => 'ATT', 'type' => "string")); + } + array_push($_SESSION['data'], array('column' => "offset_doc", 'value' => ' ', 'type' => "string")); + array_push($_SESSION['data'], array('column' => "logical_adr", 'value' => ' ', 'type' => "string")); + + if($_SESSION['origin'] == "scan") + { + array_push($_SESSION['data'], array('column' => "scan_user", 'value' => $_SESSION['user']['UserId'], 'type' => "string")); + if($_SESSION['config']['databasetype'] == "SQLSERVER") + { + $func_date = 'getdate()'; + } + else //MYSQL & POSTGRESQL + { + $func_date = 'now()'; + } + array_push($_SESSION['data'], array('column' => "scan_date", 'value' => $func_date, 'type' => "function")); + } + //if($_SESSION['origin'] == "files" || $_SESSION['origin'] == "scan") + //{ + array_push($_SESSION['data'], array('column' => "format", 'value' => $_SESSION['upfile']['format'], 'type' => "string")); + //} + $_SESSION['origin'] = ""; + // Specific indexes : values from the form + // Simple cases + for($i=0; $i<count($values_form); $i++) + { + if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['type_field'] == 'integer' && $_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] <> 'none') + { + if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'res') + { + array_push($_SESSION['data'], array('column' => $values_form[$i]['ID'], 'value' => $values_form[$i]['VALUE'], 'type' => "integer")); + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'coll_ext') + { + $query_ext_fields .= $values_form[$i]['ID'].','; + $query_ext_values .= $values_form[$i]['VALUE'].','; + } + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['type_field'] == 'string' && $_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] <> 'none') + { + if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'res') + { + array_push($_SESSION['data'], array('column' => $values_form[$i]['ID'], 'value' => $db->protect_string_db($values_form[$i]['VALUE']), 'type' => "string")); + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'coll_ext') + { + $query_ext_fields .= $values_form[$i]['ID'].','; + $query_ext_values .= "'".$db->protect_string_db($values_form[$i]['VALUE'])."',"; + } + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['type_field'] == 'date' && $_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] <> 'none') + { + if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'res') + { + array_push($_SESSION['data'], array('column' => $values_form[$i]['ID'], 'value' => $db->format_date_db($values_form[$i]['VALUE']), 'type' => "date")); + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'coll_ext') + { + $query_ext_fields .= $values_form[$i]['ID'].','; + $query_ext_values .= "'".$db->format_date_db($values_form[$i]['VALUE'])."',"; + } + } + } + + ///////////////////////// Other cases + // Process limit Date + if(isset($_ENV['categories'][$cat_id]['other_cases']['process_limit_date'])) + { + $process_limit_date = get_value_fields($values_form, 'process_limit_date'); + if($_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['table'] == 'res') + { + array_push($_SESSION['data'], array('column' => 'process_limit_date', 'value' => $db->format_date_db($process_limit_date), 'type' => "date")); + } + else if($_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['table'] == 'coll_ext') + { + if($_SESSION['store_process_limit_date'] == "ok") + { + $query_ext_fields .= 'process_limit_date,'; + $query_ext_values .= "'".$db->format_date_db($process_limit_date)."',"; + } + $_SESSION['store_process_limit_date'] = ""; + } + } + + // Contact + if(isset($_ENV['categories'][$cat_id]['other_cases']['contact'])) + { + $contact = get_value_fields($values_form, 'contact'); + $contact_type = get_value_fields($values_form, 'type_contact_external'); + if(!$contact_type) + { + $contact_type = get_value_fields($values_form, 'type_contact_internal'); + } + //echo 'contact '.$contact.', type '.$contact_type; + $contact_id = str_replace(')', '', substr($contact, strrpos($contact,'(')+1)); + if($contact_type == 'internal') + { + if($cat_id == 'incoming') + { + $query_ext_fields .= 'exp_user_id,'; + $query_ext_values .= "'".$db->protect_string_db($contact_id)."',"; + } + else if($cat_id == 'outgoing' || $cat_id == 'internal') + { + $query_ext_fields .= 'dest_user_id,'; + $query_ext_values .= "'".$db->protect_string_db($contact_id)."',"; + } + } + elseif($contact_type == 'external') + { + if($cat_id == 'incoming') + { + $query_ext_fields .= 'exp_contact_id,'; + $query_ext_values .= $contact_id.","; + } + else if($cat_id == 'outgoing' || $cat_id == 'internal') + { + $query_ext_fields .= 'dest_contact_id,'; + $query_ext_values .= $contact_id.","; + } + } + } + if($core->is_module_loaded('folder')) + { + $market = get_value_fields($values_form, 'market'); + $folder_id = ''; + if(!empty($market)) + { + $folder_id = str_replace(')', '', substr($market, strrpos($market,'(')+1)); + } + else + { + $project = get_value_fields($values_form, 'project'); + $folder_id = str_replace(')', '', substr($project, strrpos($project,'(')+1)); + } + if(!empty($folder_id)) + { + array_push($_SESSION['data'], array('column' => 'folders_system_id', 'value' => $folder_id, 'type' => "integer")); + } + } + + if($core->is_module_loaded('entities')) + { + // Diffusion list + $load_list_diff = false; + if(isset($_ENV['categories'][$cat_id]['other_cases']['diff_list']) ) + { + if(!empty($_SESSION['indexing']['diff_list']['dest']['user_id']) && isset($_SESSION['indexing']['diff_list']['dest']['user_id'])) + { + array_push($_SESSION['data'], array('column' => 'dest_user', 'value' => $db->protect_string_db($_SESSION['indexing']['diff_list']['dest']['user_id']), 'type' => "string")); + } + $load_list_diff = true; + } + } + + if($core->is_module_loaded('physical_archive')) + { + // Arbox_id + Arbatch_id + $box_id = get_value_fields($values_form, 'arbox_id'); + array_push($_SESSION['data'], array('column' => 'arbox_id', 'value' => $box_id, 'type' => "integer")); + require_once($_SESSION['pathtomodules'].'physical_archive'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'); + $physical_archive = new physical_archive(); + $pa_return_value = $physical_archive->load_box_db($box_id, $cat_id, $_SESSION['user']['UserId']); + array_push($_SESSION['data'], array('column' => 'arbatch_id', 'value' => $pa_return_value, 'type' => "integer")); + } + //print_r($_SESSION['data']); + $res_id = $resource->load_into_db($table ,$_SESSION['indexing']['destination_dir'], $_SESSION['indexing']['file_destination_name'].".".$_SESSION['upfile']['format'], $_SESSION['indexing']['path_template'], $_SESSION['indexing']['docserver_id'], $_SESSION['data'], $_SESSION['config']['databasetype']); + + if($res_id <> false) + { + //Create chrono number + //###### + $c_box_id = get_value_fields($values_form, 'arbox_id'); + $c_type_id = get_value_fields($values_form, 'type_id'); + $c_entity = get_value_fields($values_form, 'destination'); + + $c_chrono_out = get_value_fields($values_form, 'chrono_number'); + + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_chrono.php"); + $chrono_x = new chrono(); + $my_vars = array("entity_id"=>$c_entity, "arbox_id"=>$c_box_id, "type_id"=>$c_type_id, "category_id"=>$cat_id); + $my_form = array("chrono_out" => $c_chrono_out); + $my_chrono = $chrono_x->generate_chrono($cat_id, $my_vars, $my_form); + + $query_ext_fields .= 'alt_identifier,'; + $query_ext_values .= "'".$db->protect_string_db($my_chrono)."',"; + //###### + + $query_ext_fields = preg_replace('/,$/', ',res_id)', $query_ext_fields); + $query_ext_values = preg_replace('/,$/', ','.$res_id.')', $query_ext_values); + $query_ext = " insert into ".$table_ext." ".$query_ext_fields.' values '.$query_ext_values ; + + $db->connect(); + $db->query($query_ext); + //$db->show(); + if($core->is_module_loaded('entities')) + { + if($load_list_diff) + { + require_once($_SESSION['pathtomodules'].'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_listdiff.php'); + $diff_list = new diffusion_list(); + $params = array('mode'=> 'listinstance', 'table' => $_SESSION['tablename']['ent_listinstance'], 'coll_id' => $coll_id, 'res_id' => $res_id, 'user_id' => $_SESSION['user']['UserId']); + $diff_list->load_list_db($_SESSION['indexing']['diff_list'], $params); + } + } + } + else + { + $_SESSION['error'] = _ERROR_RES_ID; + return false; + } + //$_SESSION['indexing'] = array(); + unset($_SESSION['upfile']); + unset($_SESSION['data']); + $_SESSION['error'] = _NEW_DOC_ADDED; + $_SESSION['indexation'] = true; + return array('result' => $res_id.'#', 'history_msg' => '', 'page_result' =>$_SESSION['config']['businessappurl'].'index.php?page=details&dir=indexing_searching&coll_id='.$coll_id.'&id='.$res_id); +} +?> diff --git a/maarch_entreprise/trunk/actions/process.php b/maarch_entreprise/trunk/actions/process.php new file mode 100755 index 0000000000000000000000000000000000000000..84d28ee6a9629fd85da8b4ee063283aba35bc979 --- /dev/null +++ b/maarch_entreprise/trunk/actions/process.php @@ -0,0 +1,769 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Action : Process a document +* +* Open a modal box to displays the process form, make the form checks and loads the result in database. Used by the core (manage_action.php page). +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup apps +*/ + +/** +* $confirm bool false +*/ +$confirm = false; +/** +* $etapes array Contains 2 etaps : form and status (order matters) +*/ +$etapes = array('form', 'status'); +/** +* $frm_width Width of the modal (empty) +*/ +$frm_width=''; +/** +* $frm_height Height of the modal (empty) +*/ +$frm_height = ''; +/** +* $mode_form Mode of the modal : fullscreen +*/ +$mode_form = 'fullscreen'; + +include($_SESSION['config']['businessapppath'].'definition_mail_categories.php'); + +/** + * Gets the folder data for a given document + * + * @param $coll_id string Collection identifier + * @param $res_id string Resource identifier + * @return Array Folder data (market + project) + **/ +function get_folder_data($coll_id, $res_id) +{ + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec =new security(); + $view = $sec->retrieve_view_from_coll_id($coll_id); + if(empty($view)) + { + $view = $table; + } + $db = new dbquery(); + $db->connect(); + $market = ''; + $project = ''; + $db->query("select folders_system_id, folder_name, fold_parent_id, fold_subject, folder_level from ".$view." where res_id = ".$res_id); + $res = $db->fetch_object(); + if($res->folder_level == 2) + { + $market = $res->folder_name.', '.$res->fold_subject.' ('.$res->folders_system_id.')'; + $parent_id = $res->fold_parent_id; + $db->query("select folder_name, parent_id, subject from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$parent_id); + if($db->nb_result() == 1) + { + $res = $db->fetch_object(); + $project = $res->folder_name.', '.$res->fold_subject.' ('.$parent_id.')'; + } + } + else if($res->folder_level == 1) + { + $project = $res->folder_name.', '.$res->fold_subject.' ('.$res->folders_system_id.')'; + } + return array('project' => $project, 'market' => $market); +} + +/** + * Returns the indexing form text + * + * @param $values Array Contains the res_id of the document to process + * @param $path_manage_action String Path to the PHP file called in Ajax + * @param $id_action String Action identifier + * @param $table String Table + * @param $module String Origin of the action + * @param $coll_id String Collection identifier + * @param $mode String Action mode 'mass' or 'page' + * @return String The form content text + **/ +function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode ) +{ + if (preg_match("/MSIE 6.0/", $_SERVER["HTTP_USER_AGENT"])) + { + $browser_ie = true; + $display_value = 'block'; + } + elseif(preg_match('/msie/i', $_SERVER["HTTP_USER_AGENT"]) && !preg_match('/opera/i', $HTTP_USER_AGENT) ) + { + $browser_ie = true; + $display_value = 'block'; + } + else + { + $browser_ie = false; + $display_value = 'table-row'; + } + $_SESSION['req'] = "action"; + $res_id = $values[0]; + $frm_str = ''; + require_once($_SESSION['pathtocoreclass']."class_security.php"); + require_once($_SESSION['pathtomodules']."basket".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); + require_once($_SESSION['pathtocoreclass']."class_request.php"); + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_types.php"); + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_indexing_searching_app.php"); + $type = new types(); + $sec =new security(); + $core_tools =new core_tools(); + $doctypes = $type->getArrayTypes($coll_id); + $b = new basket(); + $is = new indexing_searching_app(); + $data = array(); + $params_data = array('show_market' => false, 'show_project' => false); + $data = get_general_data($coll_id, $res_id, 'full', $params_data); + $process_data = $is->get_process_data($coll_id, $res_id); + $_SESSION['doc_id'] = $res_id; + // to activate locking decomment these lines + /*if($b->reserve_doc( $_SESSION['user']['UserId'], $res_id, $coll_id) == false ) + { + $frm_str = '<div>'; + $frm_str .= '<h1 class="tit" id="action_title"><img src="'.$_SESSION['config']['img'].'/file_index_b.gif" align="middle" alt="" />'._DOC_NUM." ".$res_id ; + $frm_str .= '</h1>'; + $frm_str .= '<div>'._DOC_ALREADY_RSV.'</div>'; + $frm_str .= '<div><input type="button" name="close" id="close" value="'._CLOSE_WINDOW.'" class="button" onClick="javascript:destroyModal(\'modal_'.$id_action.'\');reinit();"/></div>'; + $frm_str .= '</div>'; + + } + else + {*/ + $frm_str = '<div id="validleftprocess">'; + $frm_str .= '<h1 class="tit" id="action_title"><img src="'.$_SESSION['config']['img'].'/file_index_b.gif" align="middle" alt="" />'._PROCESS._DOC_NUM." ".$res_id ; + $frm_str .= '</h1>'; + $frm_str .= '<div id="frm_error_'.$id_action.'" class="error"></div>'; + $frm_str .= '<form name="process" method="post" id="process" action="#" class="forms addforms2" style="text-align:left;">'; + + $frm_str .= '<input type="hidden" name="values" id="values" value="'.$res_id.'" />'; + $frm_str .= '<input type="hidden" name="action_id" id="action_id" value="'.$id_action.'" />'; + $frm_str .= '<input type="hidden" name="mode" id="mode" value="'.$mode.'" />'; + $frm_str .= '<input type="hidden" name="table" id="table" value="'.$table.'" />'; + $frm_str .= '<input type="hidden" name="coll_id" id="coll_id" value="'.$coll_id.'" />'; + $frm_str .= '<input type="hidden" name="module" id="module" value="'.$module.'" />'; + $frm_str .= '<input type="hidden" name="req" id="req" value="second_request" />'; + + $frm_str .= '<h2 onclick="new Effect.toggle(\'general_datas_div\', \'blind\', {delay:0.2});return false;" class="categorie" style="width:90%;">'; + $frm_str .= '<img src="'.$_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/plus.png" alt="" id="img_general_data" /> <b>'._GENERAL_INFO.' :</b>'; + $frm_str .= '<span class="lb1-details"> </span>'; + $frm_str .= '</h2>'; + $frm_str .= '<div id="general_datas_div" style="display:block">'; + $frm_str .= '<div>'; + $frm_str .= '<table width="90%" align="center" border="0">'; + // Displays the document indexes + foreach(array_keys($data) as $key) + { + $frm_str .= '<tr>'; + $frm_str .= '<td width="33%" align="left"><span class="form_title" >'.$data[$key]['label'].' :</span></td>'; + $frm_str .= '<td >'; + if($data[$key]['display'] == 'textinput') + { + $frm_str .= '<input type="text" name="'.$key.'" id="'.$key.'" value="'.$data[$key]['show_value'].'" readonly="readonly" class="readonly" style="border:none;" />'; + if(isset($data[$key]['addon'])) + { + $frm_str .= $data[$key]['addon']; + } + } + elseif($data[$key]['display'] == 'textarea') + { + $frm_str .= '<teaxtarea name="'.$key.'" id="'.$key.'" readonly="readonly" class="readonly" style="border:none;display:block;width:204px;" >'.$data[$key]['show_value'].'</teaxtarea>'; + } + $frm_str .= '</td >'; + $frm_str .= '</tr>'; + } + $frm_str .= '</table>'; + $frm_str .= '</div>'; + $frm_str .= '</div><br/>'; + + if($core_tools->is_module_loaded('entities')) + { + // Displays the diffusion list (only copies) + require_once($_SESSION['pathtomodules']."entities".DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_listdiff.php'); + $diff_list = new diffusion_list(); + $_SESSION['process']['diff_list'] = $diff_list->get_listinstance($res_id, true); + $frm_str .= '<h2 onclick="new Effect.toggle(\'diff_list_div\', \'blind\', {delay:0.2});return false;" class="categorie" style="width:90%;">'; + $frm_str .= '<img src="'.$_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/plus.png" alt="" id="img_diff_list" /> <b>'._DIFF_LIST_COPY.' :</b>'; + $frm_str .= '<span class="lb1-details"> </span>'; + $frm_str .= '</h2>'; + $frm_str .= '<div id="diff_list_div" style="display:none">'; + $frm_str .= '<div>'; + if(count($_SESSION['process']['diff_list']['copy']['users']) == 0 && count($_SESSION['process']['diff_list']['copy']['entities']) == 0) + { + $frm_str .= _NO_COPY; + } + else + { + $frm_str .= '<table cellpadding="0" cellspacing="0" border="0" class="listing3">'; + $color = ' class="col"'; + for($i=0;$i<count($_SESSION['process']['diff_list']['copy']['entities']);$i++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + $frm_str .= '<tr '.$color.' >'; + $frm_str .= '<td><img src="'.$_SESSION['urltomodules'].'entities/img/manage_entities_b_small.gif" alt="'._ENTITY.'" title="'._ENTITY.'" /></td>'; + $frm_str .= '<td >'.$_SESSION['process']['diff_list']['copy']['entities'][$i]['entity_id'].'</td>'; + $frm_str .= '<td colspan="2">'.$_SESSION['process']['diff_list']['copy']['entities'][$i]['entity_label'].'</td>'; + $frm_str .= '</tr>'; + } + for($i=0;$i<count($_SESSION['process']['diff_list']['copy']['users']);$i++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + $frm_str .= '<tr '.$color.' >'; + $frm_str .= '<td><img src="'.$_SESSION['urltomodules'].'entities/img/manage_users_entities_b_small.gif" alt="'._USER.'" title="'._USER.'" /></td>'; + $frm_str .= '<td >'.$_SESSION['process']['diff_list']['copy']['users'][$i]['firstname'].'</td>'; + $frm_str .= '<td >'.$_SESSION['process']['diff_list']['copy']['users'][$i]['lastname'].'</td>'; + $frm_str .= '<td>'.$_SESSION['process']['diff_list']['copy']['users'][$i]['entity_label'].'</td>'; + $frm_str .= '</tr>'; + } + $frm_str .= '</table>'; + } + if($core_tools->test_service('add_copy_in_process', 'entities', false)) + { + $frm_str .= '<a href="#" onclick="window.open(\''.$_SESSION['urltomodules'].'entities/manage_listinstance.php?origin=process&only_cc\', \'\', \'scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1024,height=650,location=no\');" title="'._ADD_COPIES.'"><img src="'.$_SESSION['config']['businessappurl'].'img/modif_liste.png" alt="'._ADD_COPIES.'" />'._ADD_COPIES.'</a>'; + } + $frm_str .= '</div>'; + $frm_str .= '</div>'; + } + if($core_tools->is_module_loaded('folder')) + { + // Displays the folder data + $arr_tmp = get_folder_data($coll_id, $res_id); + $project = $arr_tmp['project']; + $market = $arr_tmp['market']; + $frm_str .= '<h2 onclick="new Effect.toggle(\'folder_div\', \'blind\', {delay:0.2});return false;" class="categorie" style="width:90%;">'; + $frm_str .= '<img src="'.$_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/plus.png" alt="" id="img_folder" /> <b>'._FOLDER_ATTACH.' :</b>'; + $frm_str .= '<span class="lb1-details"> </span>'; + $frm_str .= '</h2>'; + $frm_str .= '<div id="folder_div" style="display:none">'; + $frm_str .= '<div>'; + $frm_str .= '<table width="98%" align="center" border="0">'; + $frm_str .= '<tr id="project_tr" style="display:'.$display_value.';">'; + $frm_str .= '<td><label for="project" class="form_title" >'._PROJECT.'</label></td>'; + $frm_str .= '<td> </td>'; + $frm_str .='<td><input type="text" name="project" id="project" value="'.$project.'" onblur=""/><div id="show_project" class="autocomplete"></div>'; //$(\'market\').value=\'\'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="market_tr" style="display:'.$display_value.';">'; + $frm_str .= '<td><label for="market" class="form_title" >'._MARKET.'</label></td>'; + $frm_str .= '<td> </td>'; + $frm_str .='<td><input type="text" name="market" id="market" onblur="fill_project(\''.$_SESSION['urltomodules'].'folder/ajax_get_project.php\');" value="'.$market.'" /><div id="show_market" class="autocomplete"></div>'; + $frm_str .= '</tr>'; + $frm_str .= '</table>'; + $frm_str .= '</div>'; + $frm_str .= '</div>'; + } + $frm_str .= '<h2 onclick="new Effect.toggle(\'history_div\', \'blind\', {delay:0.2});return false;" class="categorie" style="width:90%;">'; + $frm_str .= '<img src="'.$_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/plus.png" alt="" /> <b>'. _DOC_HISTORY.' :</b>'; + $frm_str .= '<span class="lb1-details"> </span>'; + $frm_str .= '</h2>'; + $frm_str .= '<div class="desc" id="history_div" style="display:none">'; + $frm_str .= '<div class="ref-unit">'; + $frm_str .= '<iframe src="'.$_SESSION['urltomodules'].'indexing_searching/hist_doc.php?id='.$res_id.'" name="hist_doc_process" width="400" height="180" align="left" scrolling="auto" frameborder="0" id="hist_doc_process"></iframe>'; + $frm_str .= '</div>'; + $frm_str .= '</div>'; + if($core_tools->is_module_loaded('notes')) + { + // Displays the notes + $select_notes[$_SESSION['tablename']['users']] = array(); + array_push($select_notes[$_SESSION['tablename']['users']],"user_id","lastname","firstname"); + $select_notes[$_SESSION['tablename']['not_notes']] = array(); + array_push($select_notes[$_SESSION['tablename']['not_notes']],"id", "date", "note_text", "user_id"); + $where_notes = " identifier = ".$res_id." "; + $request_notes = new request; + $tab_notes=$request_notes->select($select_notes,$where_notes,"order by ".$_SESSION['tablename']['not_notes'].".date desc",$_SESSION['config']['databasetype'], "500", true,$_SESSION['tablename']['not_notes'], $_SESSION['tablename']['users'], "user_id" ); + $frm_str .= '<h2 onclick="new Effect.toggle(\'notes_div\', \'blind\', {delay:0.2});return false;" class="categorie" style="width:90%;">'; + $frm_str .= '<img src="'.$_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/plus.png" alt="" /> <b>'._NOTES." (".count($tab_notes).")".' :</b>'; + $frm_str .= '<span class="lb1-details"> </span>'; + $frm_str .= '</h2>'; + $frm_str .= '<div class="desc" id="notes_div" style="display:none;">'; + $frm_str .= '<div class="ref-unit">'; + $frm_str .= '<div style="text-align:center;">'; + $frm_str .= '<img src="'.$_SESSION['urltomodules'].'notes/img/modif_note.png" border="0" alt="" />'; + $frm_str .= '<a href="javascript://" onclick="ouvreFenetre(\''.$_SESSION['urltomodules'].'notes/note_add.php?identifier='.$_SESSION['doc_id'].'&coll_id='.$_SESSION['collection_id_choice'].'\', 450, 300)" >'; + $frm_str .= _ADD_NOTE; + $frm_str .= '</a>'; + $frm_str .= '</div>'; + $frm_str .= '<iframe name="list_notes_doc" id="list_notes_doc" src="'.$_SESSION['urltomodules'].'notes/frame_notes_doc.php" frameborder="0" width="430px" height="150px"></iframe>'; + $frm_str .= '</div>'; + $frm_str .= '</div>'; + } + // Displays the process data + $nb_attach = 0; + if($core_tools->is_module_loaded('attachments')) + { + $req = new request; + $req->connect(); + $req->query("select res_id from ".$_SESSION['tablename']['attach_res_attachments']." where res_id_master = ".$res_id); + if($req->nb_result() > 0) + { + $nb_attach = $req->nb_result(); + } + } + $frm_str .= '<h2 onclick="new Effect.toggle(\'done_answers_div\', \'blind\', {delay:0.2});return false;" class="categorie" style="width:90%;">'; + $frm_str .= '<img src="'.$_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/plus.png" alt="" /> <b>'._DONE_ANSWERS.' ('.$nb_attach .'):</b>'; + $frm_str .= '<span class="lb1-details"> </span>'; + $frm_str .= '</h2>'; + $frm_str .= '<div class="desc" id="done_answers_div" style="display:none;width:90%;">'; + $frm_str .= '<div class="ref-unit" style="width:95%;">'; + $frm_str .= '<table width="95%">'; + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .= '<input type="checkbox" class="check" name="direct_contact" id="direct_contact" value="true"'; + if($process_data['direct_contact']) + { + $frm_str .= 'checked="checked"'; + } + $frm_str .= ' />'._DIRECT_CONTACT.'<br/>'; + $frm_str .= '<input type="checkbox" class="check" name="fax" id="fax" value="true"'; + if($process_data['fax']) + { + $frm_str .= 'checked="checked"'; + } + $frm_str .=' />'._FAX.'<br/>'; + $frm_str .= '<input type="checkbox" class="check" name="email" id="email" value="true"'; + if($process_data['email']) + { + $frm_str .= 'checked="checked"'; + } + $frm_str .=' />'._EMAIL.'<br/>'; + $frm_str .= '<input type="checkbox" class="check" name="simple_mail" id="simple_mail" value="true" '; + if($process_data['simple_mail']) + { + $frm_str .= 'checked="checked"'; + } + $frm_str .= ' />'._SIMPLE_MAIL.'<br/>'; + $frm_str .= '<input type="checkbox" class="check" name="registered_mail" id="registered_mail" value="true" '; + if($process_data['registered_mail']) + { + $frm_str .= 'checked="checked"'; + } + $frm_str .='/>'._REGISTERED_MAIL.'<br/>'; + $frm_str .= '<input type="checkbox" class="check" name="no_answer" id="no_answer" value="true"'; + if($process_data['no_answer']) + { + $frm_str .= 'checked="checked"'; + } + $frm_str .=' />'._NO_ANSWER.'<br/>'; + $frm_str .= '<input type="checkbox" class="check" name="other" id="other" value="true"'; + if($process_data['other']) + { + $frm_str .= 'checked="checked"'; + } + $frm_str .=' />'._OTHER.' : <input type="text" name="other_answer" id="other_answer" value="'; + if(!empty($process_data['other_answer_desc'])) + { + $frm_str .= $process_data['other_answer_desc']; + } + else + { + $frm_str .='['._DEFINE.']'; + } + $frm_str .='"'; + if(empty($process_data['other_answer_desc'])) + { + $frm_str .= ' onfocus="if(this.value==\'['._DEFINE.']\'){this.value=\'\';}" '; + } + $frm_str .=' /><br/>'; + $frm_str .= '</td>'; + $frm_str .= '<td> </td>'; + //$frm_str .= '<td><label for="process_notes">'._PROCESS_NOTES.' : </label><br/><textarea name="process_notes" id="process_notes" style="display:block;" rows="8" cols="5">'.$process_data['process_notes'].'</textarea></td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr>'; + $frm_str .= '<td><label for="process_notes">'._PROCESS_NOTES.' : </label><br/><textarea name="process_notes" id="process_notes" style="display:block;" rows="8" cols="5">'.$process_data['process_notes'].'</textarea></td>'; + $frm_str .= '</tr>'; + $frm_str .= '</table>'; + if($core_tools->is_module_loaded('attachments')) + { + $req = new request; + $req->connect(); + $req->query("select res_id from ".$_SESSION['tablename']['attach_res_attachments']." where status = 'NEW' and res_id_master = ".$res_id); + //$req->show(); + $nb_attach = 0; + if($req->nb_result() > 0) + { + $nb_attach = $req->nb_result(); + } + $frm_str .= '<div class="ref-unit">'; + $frm_str .= '<input type="button" name="attach" id="attach" class="button" value="'._ATTACH.'" onclick="javascript:window.open(\''.$_SESSION['urltomodules'].'attachments/join_file.php\',\'\', \'scrollbars=yes,menubar=no,toolbar=no,resizable=yes,status=no,width=550,height=200\');" /> '; + if($core_tools->is_module_loaded("templates")) + { + $frm_str .= '<input type="button" name="template" id="template" class="button" value="'._GENERATE.'" onclick="javascript:window.open(\''.$_SESSION['urltomodules'].'templates/choose_template.php?entity='.$data['destination']['value'].'&res_id='.$res_id.'&coll_id='.$coll_id.'\',\'\', \'scrollbars=yes,menubar=no,toolbar=no,resizable=yes,status=no,width=355,height=210\');" />'; + } + $frm_str .= '<iframe name="list_attach" align="left" id="list_attach" src="'.$_SESSION['urltomodules'].'attachments/frame_list_attachments.php" frameborder="0" width="430px" height="300px"></iframe>'; + $frm_str .= '</div>'; + } + $frm_str .= '</div>'; + $frm_str .= '</div><br/>'; + + $frm_str .= '<hr class="hr_process"/>'; + $frm_str .= '<p align="center" style="width:90%;">'; + $frm_str .= '<b>'._ACTIONS.' : </b>'; + + $actions = $b->get_actions_from_current_basket($res_id, $coll_id, 'PAGE_USE'); + if(count($actions) > 0) + { + $frm_str .='<select name="chosen_action" id="chosen_action">'; + $frm_str .='<option value="">'._CHOOSE_ACTION.'</option>'; + for($ind_act = 0; $ind_act < count($actions);$ind_act++) + { + $frm_str .='<option value="'.$actions[$ind_act]['VALUE'].'"'; + if($ind_act==0) + { + $frm_str .= 'selected="selected"'; + } + $frm_str .= '>'.$actions[$ind_act]['LABEL'].'</option>'; + } + $frm_str .='</select> '; + $frm_str .= '<input type="button" name="send" id="send" value="'._VALIDATE.'" class="button" onclick="valid_action_form( \'process\', \''.$path_manage_action.'\', \''. $id_action.'\', \''.$res_id.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');"/> '; + } + $frm_str .= '<input name="close" id="close" type="button" value="'._CANCEL.'" class="button" onClick="javascript:$(\'baskets\').style.visibility=\'visible\';destroyModal(\'modal_'.$id_action.'\');reinit();"/>'; + $frm_str .= '</p>'; + $frm_str .= '</form>'; + $frm_str .= '</div>'; + $frm_str .= '</div>'; + + $frm_str .= '<div id="validright">'; + $frm_str .= '<iframe src="'.$_SESSION['config']['businesappurl'].'indexing_searching/view.php?id='.$res_id.'" name="viewframe" id="viewframe" scrolling="auto" frameborder="0" ></iframe>'; + $frm_str .= '</div>'; + $frm_str .= '<script type="text/javascript">resize_frame_process("modal_'.$id_action.'", "viewframe", true, true);resize_frame_process("modal_'.$id_action.'", "hist_doc", true, false);window.scrollTo(0,0);'; + if($core_tools->is_module_loaded('folder')) + { + $frm_str .= 'launch_autocompleter_folders(\''.$_SESSION['urltomodules'].'folder/autocomplete_folders.php?mode=project\', \'project\');launch_autocompleter_folders(\''.$_SESSION['urltomodules'].'folder/autocomplete_folders.php?mode=market\', \'market\');'; + } + $frm_str .='$(\'baskets\').style.visibility=\'hidden\';</script>'; + //} + return addslashes($frm_str); +} + +/** + * Checks the action form + * + * @param $form_id String Identifier of the form to check + * @param $values Array Values of the form + * @return Bool true if no error, false otherwise + **/ +function check_form($form_id,$values) +{ + $check = false; + $other_checked = false; + $other_txt = ''; + $market = ''; + $project = ''; + $core = new core_tools(); + for($i=0; $i<count($values); $i++) + { + if($values[$i]['ID'] == "direct_contact" && $values[$i]['VALUE'] == "true" ) + { + $check = true; + } + if($values[$i]['ID'] == "fax" && $values[$i]['VALUE'] == "true" ) + { + $check = true; + } + if($values[$i]['ID'] == "email" && $values[$i]['VALUE'] == "true" ) + { + $check = true; + } + if($values[$i]['ID'] == "simple_mail" && $values[$i]['VALUE'] == "true" ) + { + $check = true; + } + if($values[$i]['ID'] == "registered_mail" && $values[$i]['VALUE'] == "true" ) + { + $check = true; + } + if($values[$i]['ID'] == "no_answer" && $values[$i]['VALUE'] == "true" ) + { + $check = true; + } + if($values[$i]['ID'] == "other" && $values[$i]['VALUE'] == "true" ) + { + $check = true; + $other_checked = true; + } + if($values[$i]['ID'] == "other_answer" && trim($values[$i]['VALUE']) <> html_entity_decode( '['._DEFINE.']', ENT_NOQUOTES, 'UTF-8')) + { + $other_txt = $values[$i]['VALUE']; + } + if($values[$i]['ID'] == "market" ) + { + $market = $values[$i]['VALUE']; + } + if($values[$i]['ID'] == "project" ) + { + $project = $values[$i]['VALUE']; + } + } + if($core->is_module_loaded('folder')) + { + $db = new dbquery(); + $db->connect(); + $project_id = ''; + $market_id = ''; + + /*if(empty($market)) + { + $_SESSION['error'] = _MARKET.' '._IS_EMPTY; + return false; + }*/ + if(!empty($market)) + { + if(!preg_match('/\([0-9]+\)$/', $market)) + { + $_SESSION['error'] = _MARKET." "._WRONG_FORMAT.""; + return false; + } + $market_id = str_replace(')', '', substr($market, strrpos($market,'(')+1)); + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$market_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _MARKET.' '.$market_id.' '._UNKNOWN; + return false; + } + } + if(empty($project)) + { + $_SESSION['error'] = _PROJECT.' '._IS_EMPTY; + return false; + } + if(!preg_match('/\([0-9]+\)$/', $project)) + { + $_SESSION['error'] = _PROJECT." "._WRONG_FORMAT.""; + return false; + } + $project_id = str_replace(')', '', substr($project, strrpos($project,'(')+1)); + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$project_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _PROJECT.' '.$project_id.' '._UNKNOWN; + return false; + } + + if(!empty($folder_id) && !empty($market_id)) + { + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$market_id." and parent_id = ".$folder_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _INCOMPATIBILITY_MARKET_PROJECT; + return false; + } + } + } + + if($other_checked && $other_txt == '') + { + $_SESSION['error'] = _MUST_DEFINE_ANSWER_TYPE; + return false; + } + if($check == false) + { + $_SESSION['error'] = _MUST_CHECK_ONE_BOX; + } + return $check; +} + +/** + * Action of the form : loads the index in the db + * + * @param $arr_id Array Not used here + * @param $history String Log the action in history table or not + * @param $id_action String Action identifier + * @param $label_action String Action label + * @param $status String Not used here + * @param $coll_id String Collection identifier + * @param $table String Table + * @param $values_form String Values of the form to load + * @return false or an array + * $data['result'] : res_id of the new file followed by # + * $data['history_msg'] : Log complement (empty by default) + **/ +function manage_form($arr_id, $history, $id_action, $label_action, $status, $coll_id, $table, $values_form ) +{ + if(empty($values_form) || count($arr_id) < 1 || empty($coll_id)) + { + return false; + } + require_once($_SESSION['pathtocoreclass']."class_db.php"); + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec =new security(); + $db = new dbquery(); + $core = new core_tools(); + $db->connect(); + $res_table = $sec->retrieve_table_from_coll($coll_id); + $ind = $sec->get_ind_collection($coll_id); + $table = $_SESSION['collections'][$ind]['extensions'][0]; + $simple_mail = '0'; + $AR_mail = '0'; + $contact = '0'; + $email = '0'; + $fax = '0'; + $other = '0'; + $no_answer = '0'; + $other_txt = ''; + $process_notes = ''; + $project = ''; + $market = ''; + + for($j=0; $j<count($values_form); $j++) + { + if($values_form[$j]['ID'] == "simple_mail" && $values_form[$j]['VALUE'] == "true") + { + $simple_mail = '1'; + } + if($values_form[$j]['ID'] == "registered_mail" && $values_form[$j]['VALUE'] == "true") + { + $AR_mail = '1'; + } + if($values_form[$j]['ID'] == "direct_contact" && $values_form[$j]['VALUE'] == "true") + { + $contact = '1'; + } + if($values_form[$j]['ID'] == "email" && $values_form[$j]['VALUE'] == "true") + { + $email = '1'; + } + if($values_form[$j]['ID'] == "fax" && $values_form[$j]['VALUE'] == "true") + { + $fax = '1'; + } + if($values_form[$j]['ID'] == "other" && $values_form[$j]['VALUE'] == "true") + { + $other = '1'; + } + if($values_form[$j]['ID'] == "no_answer" && $values_form[$j]['VALUE'] == "true") + { + $no_answer = '1'; + } + if($values_form[$j]['ID'] == "other_answer" && !empty($values_form[$j]['ID']) && trim($values_form[$j]['ID']) <> html_entity_decode( '['._DEFINE.']', ENT_NOQUOTES, 'UTF-8')) + { + $other_txt = $values_form[$j]['VALUE']; + } + if($values_form[$j]['ID'] == "process_notes" ) + { + $process_notes = $values_form[$j]['VALUE']; + } + if($values_form[$j]['ID'] == "market" ) + { + $market = $values_form[$j]['VALUE']; + } + if($values_form[$j]['ID'] == "project" ) + { + $project = $values_form[$j]['VALUE']; + } + } + + if($no_answer == '1') + { + $bitmask = '000000'; + } + else + { + $bitmask = $other.$fax.$email.$contact.$AR_mail.$simple_mail; + } + + if($core->is_module_loaded('folder')) + { + if(!empty($market)) + { + $folder_id = str_replace(')', '', substr($market, strrpos($market,'(')+1)); + } + else + { + $folder_id = str_replace(')', '', substr($project, strrpos($project,'(')+1)); + } + $db->query("update ".$res_table." set folders_system_id =".$folder_id." where res_id =".$arr_id[0]); + } + +//$db->show_array($_SESSION['process']['diff_list']); + if($core->is_module_loaded('entities') ) + { + require_once($_SESSION['pathtomodules'].'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_listdiff.php'); + $list = new diffusion_list(); + $params = array('mode'=> 'listinstance', 'table' => $_SESSION['tablename']['ent_listinstance'], 'coll_id' => $coll_id, 'res_id' => $arr_id[0], 'user_id' => $_SESSION['user']['UserId'], 'concat_list' => true, 'only_cc' => true); + $list->load_list_db($_SESSION['process']['diff_list'], $params); //pb enchainement avec action redirect + } + unset($_SESSION['redirection']); + $db->query("update ".$table." set answer_type_bitmask = '".$bitmask."', process_notes = '".$db->protect_string_db($process_notes)."', other_answer_desc ='".$db->protect_string_db($other_txt)."' + WHERE res_id=".$arr_id[0]); + + return array('result' => $arr_id[0].'#', 'history_msg' => ''); +} + +function manage_unlock($arr_id, $history, $id_action, $label_action, $status, $coll_id, $table) +{ + $db = new dbquery(); + $db->connect(); + $result = ''; + for($i=0; $i<count($arr_id );$i++) + { + $result .= $arr_id[$i].'#'; + $req = $db->query("update ".$table. " set video_user = '', video_time = 0 where res_id = ".$arr_id[$i], true); + if(!$req) + { + $_SESSION['error'] = _SQL_ERROR; + return false; + } + } + return array('result' => $result, 'history_msg' => ''); + } + +function manage_status($arr_id, $history, $id_action, $label_action, $status) +{ + $result = ''; + $db = new dbquery(); + $db->connect(); + for($i=0; $i<count($arr_id );$i++) + { + $result .= $arr_id[$i].'#'; + $db->query("select status from ".$_POST['table']." where res_id = ".$arr_id[$i]); + $res = $db->fetch_object(); + if($res->status == 'NEW') + { + $req = $db->query("update ".$_POST['table']. " set status = '".$status."' where res_id = ".$arr_id[$i], true); + if(!$req) + { + $_SESSION['error'] = _SQL_ERROR; + return false; + } + } + } + return array('result' => $result, 'history_msg' => ''); + } +?> diff --git a/maarch_entreprise/trunk/actions/validate_mail.php b/maarch_entreprise/trunk/actions/validate_mail.php new file mode 100644 index 0000000000000000000000000000000000000000..98d1aa1e6b0be35dbd9b47d68dcad61e981590f1 --- /dev/null +++ b/maarch_entreprise/trunk/actions/validate_mail.php @@ -0,0 +1,1354 @@ +<? +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Action : Document validation +* +* Open a modal box to displays the validation form, make the form checks and loads the result in database. Used by the core (manage_action.php page). +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup apps +*/ +/** +* $confirm bool false +*/ +$confirm = false; +/** +* $etapes array Contains only one etap : form +*/ +$etapes = array('form'); +/** +* $frm_width Width of the modal (empty) +*/ +$frm_width=''; +/** +* $frm_height Height of the modal (empty) +*/ +$frm_height = ''; +/** +* $mode_form Mode of the modal : fullscreen +*/ +$mode_form = 'fullscreen'; + +include($_SESSION['config']['businessapppath'].'definition_mail_categories.php'); + +///////////////////// Pattern to check dates +if($_SESSION['config']['databasetype'] == "SQLSERVER") +{ + $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; +} +else // MYSQL & POSTGRESQL +{ + $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; +} + +/** + * Gets the path of the file to displays + * + * @param $res_id String Resource identifier + * @param $coll_id String Collection identifier + * @return String File path + **/ +function get_file_path($res_id, $coll_id) +{ + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec =new security(); + $view = $sec->retrieve_view_from_coll_id($coll_id); + if(empty($view)) + { + $view = $table; + } + $db = new dbquery(); + $db->connect(); + $db->query("select docserver_id, path, filename from ".$view." where res_id = ".$res_id); + $res = $db->fetch_object(); + $path = preg_replace('/#/', DIRECTORY_SEPARATOR, $res->path); + $docserver_id = $res->docserver_id; + $filename = $res->filename; + $db->query("select path_template from ".$_SESSION['tablename']['docservers']." where docserver_id = '".$docserver_id."'"); + $res = $db->fetch_object(); + $docserver_path = $res->path_template; + + return $docserver_path.$path.$filename; +} + +/** + * Returns the validation form text + * + * @param $values Array Contains the res_id of the document to validate + * @param $path_manage_action String Path to the PHP file called in Ajax + * @param $id_action String Action identifier + * @param $table String Table + * @param $module String Origin of the action + * @param $coll_id String Collection identifier + * @param $mode String Action mode 'mass' or 'page' + * @return String The form content text + **/ +function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode ) +{ + if (preg_match("/MSIE 6.0/", $_SERVER["HTTP_USER_AGENT"])) + { + $browser_ie = true; + $display_value = 'block'; + } + elseif(preg_match('/msie/i', $_SERVER["HTTP_USER_AGENT"]) && !preg_match('/opera/i', $HTTP_USER_AGENT) ) + { + $browser_ie = true; + $display_value = 'block'; + } + else + { + $browser_ie = false; + $display_value = 'table-row'; + } + $_SESSION['req'] = "action"; + $res_id = $values[0]; + $frm_str = ''; + require_once($_SESSION['pathtocoreclass']."class_security.php"); + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_business_app_tools.php"); + require_once($_SESSION['pathtomodules']."basket".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_types.php"); + + $sec =new security(); + $core_tools =new core_tools(); + $b = new basket(); + $type = new types(); + $business = new business_app_tools(); + + $doctypes = $type-> getArrayStructTypes($coll_id); + $db = new dbquery(); + $db->connect(); + $hidden_doctypes = array(); + $tmp = $business->get_titles(); + $titles = $tmp['titles']; + $default_title = $tmp['default_title']; + if($core_tools->is_module_loaded('templates')) + { + $db->query("select type_id from ".$_SESSION['tablename']['temp_templates_doctype_ext']." where is_generated = 'Y'"); + while($res = $db->fetch_object()) + { + array_push($hidden_doctypes, $res->type_id); + } + } + $today = date('d-m-Y'); + + if($core_tools->is_module_loaded('entities')) + { + $services = array(); + if(!empty($_SESSION['user']['redirect_groupbasket'][$_SESSION['current_basket']['id']][$id_action]['entities'])) + { + $db->query("select entity_id, entity_label from ".$_SESSION['tablename']['ent_entities']." where entity_id in (".$_SESSION['user']['redirect_groupbasket'][$_SESSION['current_basket']['id']][$id_action]['entities'].") and enabled= 'Y' order by entity_label"); + while($res = $db->fetch_object()) + { + array_push($services, array( 'ID' => $res->entity_id, 'LABEL' => $db->show_string($res->entity_label))); + } + } + } + + if($core_tools->is_module_loaded('physical_archive')) + { + $boxes = array(); + $db->query("select arbox_id, title from ".$_SESSION['tablename']['ar_boxes']." where status = 'NEW' order by title"); + while($res = $db->fetch_object()) + { + array_push($boxes, array( 'ID' => $res->arbox_id, 'LABEL' => $db->show_string($res->title))); + } + } + + $data = get_general_data($coll_id, $res_id, 'minimal'); + //print_r($data); + $frm_str .= '<div id="validleft">'; + $frm_str .= '<div id="valid_div" style="display:none;";>'; + $frm_str .= '<h1 class="tit" id="action_title"><img src="'.$_SESSION['config']['img'].'/file_index_b.gif" align="middle" alt="" />'._VALIDATE_MAIL.' '._NUM.$res_id; + $frm_str .= '</h1>'; + $frm_str .= '<div id="frm_error_'.$id_action.'" class="indexing_error"></div>'; + $frm_str .= '<form name="index_file" method="post" id="index_file" action="#" class="forms indexingform" style="text-align:left;">'; + + $frm_str .= '<input type="hidden" name="values" id="values" value="'.$res_id.'" />'; + $frm_str .= '<input type="hidden" name="action_id" id="action_id" value="'.$id_action.'" />'; + $frm_str .= '<input type="hidden" name="mode" id="mode" value="'.$mode.'" />'; + $frm_str .= '<input type="hidden" name="table" id="table" value="'.$table.'" />'; + $frm_str .= '<input type="hidden" name="coll_id" id="coll_id" value="'.$coll_id.'" />'; + $frm_str .= '<input type="hidden" name="module" id="module" value="'.$module.'" />'; + $frm_str .= '<input type="hidden" name="req" id="req" value="second_request" />'; + + $frm_str .= '<div style="display:block">'; + + $frm_str .= '<table width="100%" align="center" border="0">'; + + /*** Category ***/ + $frm_str .= '<tr id="category_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="category_id" class="form_title" >'._CATEGORY.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="category_id" id="category_id" onchange="clear_error(\'frm_error_'.$id_action.'\');change_category(this.options[this.selectedIndex].value, \''.$display_value.'\', \''.$_SESSION['config']['businessappurl'].'indexing_searching/change_category.php\', \''.$_SESSION['config']['businessappurl'].'get_content_js.php\');">'; + $frm_str .='<option value="">'._CHOOSE_CATEGORY.'</option>'; + foreach(array_keys($_SESSION['mail_categories']) as $cat_id) + { + $frm_str .='<option value="'.$cat_id.'"'; + if($_SESSION['default_category'] == $cat_id || $_SESSION['indexing']['category_id'] == $cat_id || (isset($data['category_id']) && $data['category_id'] == $cat_id) ) + { + $frm_str .='selected="selected"'; + } + + $frm_str .='>'.$_SESSION['mail_categories'][$cat_id].'</option>'; + + } + $frm_str.='</select></td>'; + $frm_str .= '<td><span class="red_asterisk" id="category_id_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Doctype ***/ + $frm_str .= '<tr id="type_id_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><span class="form_title" id="doctype_res" style="display:none;">'._DOCTYPE.'</span><span class="form_title" id="doctype_mail" style="display:inline;" >'._DOCTYPE_MAIL.'</span></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="type_id" id="type_id" onchange="clear_error(\'frm_error_'.$id_action.'\');change_doctype(this.options[this.selectedIndex].value, \''.$_SESSION['config']['businessappurl'].'indexing_searching/change_doctype.php\', \''._ERROR_DOCTYPE.'\', \''.$id_action.'\', \''.$_SESSION['config']['businessappurl'].'get_content_js.php\');">'; + $frm_str .='<option value="">'._CHOOSE_TYPE.'</option>'; + for($i=0; $i<count($doctypes);$i++) + { + $frm_str .='<option value="" class="doctype_level1">'. $doctypes[$i]['label'].'</option>'; + for($j=0; $j<count($doctypes[$i]['level2']);$j++) + { + $frm_str .='<option value="" class="doctype_level2"> '.$doctypes[$i]['level2'][$j]['label'].'</option>'; + for($k=0; $k<count($doctypes[$i]['level2'][$j]['types']);$k++) + { + if(!in_array($doctypes[$i]['level2'][$j]['types'][$k]['id'],$hidden_doctypes)) + { + $frm_str .='<option value="'.$doctypes[$i]['level2'][$j]['types'][$k]['id'].'" '; + if(isset($data['type_id']) && !empty($data['type_id'])) + { + $frm_str .= ' selected="selected" '; + } + $frm_str .=' > '.$doctypes[$i]['level2'][$j]['types'][$k]['label'].'</option>'; + } + } + } + } + $frm_str .='</select>'; + $frm_str .= '<td><span class="red_asterisk" id="type_id_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Priority ***/ + $frm_str .= '<tr id="priority_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="priority" class="form_title" >'._PRIORITY.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="priority" id="priority" onchange="clear_error(\'frm_error_'.$id_action.'\');">'; + $frm_str .='<option value="">'._CHOOSE_PRIORITY.'</option>'; + for($i=0; $i<count($_SESSION['mail_priorities']);$i++) + { + $frm_str .='<option value="'.$i.'" '; + if($_SESSION['default_mail_priority'] == $i || (isset($data['type_id'])&& $data['priority'] == $i)) + { + $frm_str .='selected="selected"'; + } + $frm_str .='>'.$_SESSION['mail_priorities'][$i].'</option>'; + } + $frm_str .='</select></td>'; + $frm_str .= '<td><span class="red_asterisk" id="priority_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Doc date ***/ + $frm_str .= '<tr id="doc_date_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="doc_date" class="form_title" id="mail_date_label" style="display:inline;" >'._MAIL_DATE.'</label><label for="doc_date" class="form_title" id="doc_date_label" style="display:none;" >'._DOC_DATE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input name="doc_date" type="text" id="doc_date" value="'; + if(isset($data['doc_date'])&& !empty($data['doc_date'])) + { + $frm_str .= $data['doc_date']; + } + else + { + $frm_str .= $today; + } + $frm_str .= '" onclick="clear_error(\'frm_error_'.$id_action.'\');showCalender(this);"/></td>'; + $frm_str .= '<td><span class="red_asterisk" id="doc_date_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr >'; + /*** Author ***/ + $frm_str .= '<tr id="author_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="author" class="form_title" >'._AUTHOR.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input name="author" type="text" id="author" onchange="clear_error(\'frm_error_'.$id_action.'\');"'; + if(isset($data['author'])&& !empty($data['author'])) + { + $frm_str .= ' value="'.$data['author'].'" '; + } + '/></td>'; + $frm_str .= '<td><span class="red_asterisk" id="author_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Admission date ***/ + $frm_str .= '<tr id="admission_date_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="admission_date" class="form_title" >'._RECEIVING_DATE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input name="admission_date" type="text" id="admission_date" value="'; + if(isset($data['admission_date'])&& !empty($data['admission_date'])) + { + $frm_str .= $data['admission_date']; + } + else + { + $frm_str .= $today; + } + $frm_str .= '" onclick="clear_error(\'frm_error_'.$id_action.'\');showCalender(this);"/></td>'; + $frm_str .= '<td><span class="red_asterisk" id="admission_date_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Contact ***/ + $frm_str .= '<tr id="contact_choose_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="type_contact" class="form_title" ><span id="exp_contact_choose_label">'._SHIPPER_TYPE.'</span><span id="dest_contact_choose_label">'._DEST_TYPE.'</span></label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="radio" name="type_contact" id="type_contact_internal" value="internal" class="check" onclick="clear_error(\'frm_error_'.$id_action.'\');change_contact_type(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\');"'; + + if($data['type_contact'] == 'internal') + { + $frm_str .= ' checked="checked" '; + } + $frm_str .= ' />'._INTERNAL.'<input type="radio" name="type_contact" class="check" id="type_contact_external" value="external" onclick="clear_error(\'frm_error_'.$id_action.'\');change_contact_type(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\');"'; + if($data['type_contact'] == 'external') + { + $frm_str .= ' checked="checked" '; + } + $frm_str .= '/>'._EXTERNAL.'</td>'; + $frm_str .= '<td><span class="red_asterisk" id="type_contact_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="contact_id_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="contact" class="form_title" ><span id="exp_contact">'._SHIPPER.'</span><span id="dest_contact">'._DEST.'</span>'; + if($_SESSION['features']['personal_contact'] == "true" && $core_tools->test_service('my_contacts','apps', false)) + { + //$frm_str .=' <a href="#" id="create_contact" title="'._CREATE_CONTACT.'" onclick="create_contact(\''.$_SESSION ['config']['businessappurl'].'contact_info.php\');" style="display:inline;" ><img src="'.$_SESSION['config']['businessappurl'].'img/modif_liste.png" alt="'._CREATE_CONTACT.'"/></a>'; + $frm_str .=' <a href="#" id="create_contact" title="'._CREATE_CONTACT.'" onclick="new Effect.toggle(\'create_contact_div\', \'blind\', {delay:0.2});return false;" style="display:inline;" ><img src="'.$_SESSION['config']['businessappurl'].'img/modif_liste.png" alt="'._CREATE_CONTACT.'"/></a>'; + } + $frm_str .= '</label></td>'; + $frm_str .='<td><a href="#" id="contact_card" title="'._CONTACT_CARD.'" onclick="open_contact_card(\''.$_SESSION ['config']['businessappurl'].'contact_info.php\', \''.$_SESSION ['config']['businessappurl'].'user_info.php\');" style="visibility:hidden;" ><img src="'.$_SESSION['config']['businessappurl'].'img/my_contacts_off.gif" alt="'._CONTACT_CARD.'" /></a> </td>'; + $frm_str .='<td class="indexing_field"><input type="text" name="contact" id="contact" onchange="clear_error(\'frm_error_'.$id_action.'\');display_contact_card(\'visible\');"'; + if(isset($data['contact']) && !empty($data['contact'])) + { + $frm_str .= ' value="'.$data['contact'].'" '; + } + $frm_str .= ' /><div id="show_contacts" class="autocomplete"></div></td>'; + $frm_str .= '<td><span class="red_asterisk" id="contact_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Nature ***/ + $frm_str .= '<tr id="nature_id_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="nature_id" class="form_title" >'._NATURE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="nature_id" id="nature_id" onchange="clear_error(\'frm_error_'.$id_action.'\');">'; + $frm_str .='<option value="">'. _CHOOSE_NATURE.'</option>'; + foreach(array_keys($_SESSION['mail_natures']) as $nature) + { + $frm_str .='<option value="'.$nature.'"'; + if($_SESSION['default_mail_nature'] == $nature || (isset($data['nature_id'])&& $data['nature_id'] == $nature)) + { + $frm_str .='selected="selected"'; + } + $frm_str .='>'.$_SESSION['mail_natures'][$nature].'</option>'; + } + $frm_str .= '</select></td>'; + $frm_str .= '<td><span class="red_asterisk" id="nature_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Subject ***/ + $frm_str .= '<tr id="subject_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="subject" class="form_title" >'._SUBJECT.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><textarea name="subject" id="subject" rows="4" onchange="clear_error(\'frm_error_'.$id_action.'\');" >'; + if(isset($data['subject']) && !empty($data['subject'])) + { + $frm_str .= $data['subject']; + } + $frm_str .= '</textarea></td>'; + $frm_str .= '<td><span class="red_asterisk" id="subject_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + /*** Entities : department + diffusion list ***/ + if($core_tools->is_module_loaded('entities')) + { + $_SESSION['validStep'] = "ok"; + $frm_str .= '<tr id="department_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="department" class="form_title" id="label_dep_dest" style="display:inline;" >'._DEPARTMENT_DEST.'</label><label for="department" class="form_title" id="label_dep_exp" style="display:none;" >'._DEPARTMENT_EXP.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="destination" id="destination" onchange="clear_error(\'frm_error_'.$id_action.'\');change_entity(this.options[this.selectedIndex].value, \''.$_SESSION['urltomodules'].'entities/load_listinstance.php'.'\',\'diff_list_div\', \'indexing\', \''.$display_value.'\');">'; + $frm_str .='<option value="">'._CHOOSE_DEPARTMENT.'</option>'; + for($i=0; $i < count($services); $i++) + { + $frm_str .='<option value="'.$services[$i]['ID'].'" '; + if(isset($data['destination'])&& $data['destination'] == $services[$i]['ID']) + { + $frm_str .='selected="selected"'; + } + $frm_str .= '>'.$db->show_string($services[$i]['LABEL']).'</option>'; + } + $frm_str .='</select></td>'; + $frm_str .= '<td><span class="red_asterisk" id="destination_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="diff_list_tr" style="display:none;">'; + $frm_str .= '<td colspan="3">'; + $frm_str .= '<h2 onclick="new Effect.toggle(\'diff_list_div\', \'blind\', {delay:0.2});return false;" class="categorie" style="width:90%;">'; + $frm_str .= '<img src="'.$_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/plus.png" alt="" id="img_diff_list" /> <b><small>'._DIFF_LIST_COPY.' :</small></b>'; + $frm_str .= '<span class="lb1-details"> </span>'; + $frm_str .= '</h2>'; + $frm_str .= '<div id="diff_list_div" style="display:none">'; + $frm_str .= '<div>ici</div>'; + //$frm_str .= '<div id="diff_list_div" class="scroll_div" style="height:150px;"></div>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + } + /*if($core_tools->is_module_loaded('entities')) + { + // Displays the diffusion list (only copies) + require_once($_SESSION['pathtomodules']."entities".DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_listdiff.php'); + $diff_list = new diffusion_list(); + $_SESSION['process']['diff_list'] = $diff_list->get_listinstance($res_id); + $frm_str .= '<h2 onclick="new Effect.toggle(\'diff_list_div\', \'blind\', {delay:0.2});return false;" class="categorie" style="width:90%;">'; + $frm_str .= '<img src="'.$_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/plus.png" alt="" id="img_diff_list" /> <b>'._DIFF_LIST_COPY.' :</b>'; + $frm_str .= '<span class="lb1-details"> </span>'; + $frm_str .= '</h2>'; + $frm_str .= '<div id="diff_list_div" style="display:none">'; + $frm_str .= '<div>'; + if(count($_SESSION['process']['diff_list']['copy']['users']) == 0 && count($_SESSION['process']['diff_list']['copy']['entities']) == 0) + { + $frm_str .= _NO_COPY; + } + else + { + $frm_str .= '<table cellpadding="0" cellspacing="0" border="0" class="listing3">'; + $color = ' class="col"'; + for($i=0;$i<count($_SESSION['process']['diff_list']['copy']['entities']);$i++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + $frm_str .= '<tr '.$color.' >'; + $frm_str .= '<td><img src="'.$_SESSION['urltomodules'].'entities/img/manage_entities_b_small.gif" alt="'._ENTITY.'" title="'._ENTITY.'" /></td>'; + $frm_str .= '<td >'.$_SESSION['process']['diff_list']['copy']['entities'][$i]['entity_id'].'</td>'; + $frm_str .= '<td colspan="2">'.$_SESSION['process']['diff_list']['copy']['entities'][$i]['entity_label'].'</td>'; + $frm_str .= '</tr>'; + } + for($i=0;$i<count($_SESSION['process']['diff_list']['copy']['users']);$i++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + $frm_str .= '<tr '.$color.' >'; + $frm_str .= '<td><img src="'.$_SESSION['urltomodules'].'entities/img/manage_users_entities_b_small.gif" alt="'._USER.'" title="'._USER.'" /></td>'; + $frm_str .= '<td >'.$_SESSION['process']['diff_list']['copy']['users'][$i]['firstname'].'</td>'; + $frm_str .= '<td >'.$_SESSION['process']['diff_list']['copy']['users'][$i]['lastname'].'</td>'; + $frm_str .= '<td>'.$_SESSION['process']['diff_list']['copy']['users'][$i]['entity_label'].'</td>'; + $frm_str .= '</tr>'; + } + $frm_str .= '</table>'; + } + if($core_tools->test_service('add_copy_in_process', 'entities', false)) + { + $frm_str .= '<a href="#" onclick="window.open(\''.$_SESSION['urltomodules'].'entities/manage_listinstance.php?origin=process&only_cc\', \'\', \'scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1024,height=650,location=no\');" title="'._ADD_COPIES.'"><img src="'.$_SESSION['config']['businessappurl'].'img/modif_liste.png" alt="'._ADD_COPIES.'" />'._ADD_COPIES.'</a>'; + } + $frm_str .= '</div>'; + $frm_str .= '</div>'; + }*/ + /*** Physical_archive : Arbox ***/ + if($core_tools->is_module_loaded('physical_archive')) + { + $frm_str .= '<tr id="box_id_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="arbox_id" class="form_title" id="label_box" style="display:inline;" >'._BOX_ID.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><select name="arbox_id" id="arbox_id" onchange="clear_error(\'frm_error_'.$id_action.'\');" >'; + $frm_str .='<option value="">'._CHOOSE_BOX.'</option>'; + for($i=0; $i < count($boxes); $i++) + { + $frm_str .='<option value="'.$boxes[$i]['ID'].'"'; + if(isset($data['arbox_id'])&& $data['arbox_id'] == $boxes[$i]['ID']) + { + $frm_str .='selected="selected"'; + } + $frm_str .= ' >'.$db->show_string($boxes[$i]['LABEL']).'</option>'; + } + $frm_str .='</select></td>'; + $frm_str .= '<td><span class="red_asterisk" id="arbox_id_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + } + /*** Process limit date ***/ + $frm_str .= '<tr id="process_limit_date_use_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="process_limit_date_use" class="form_title" >'._PROCESS_LIMIT_DATE_USE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="radio" class="check" name="process_limit_date_use" id="process_limit_date_use_yes" value="yes" '; + if($data['process_limit_date_use'] == true || !isset($data['process_limit_date_use'])) + { + $frm_str .=' checked="checked"'; + } + $frm_str .=' onclick="clear_error(\'frm_error_'.$id_action.'\');activate_process_date(true, \''.$display_value.'\');" />'._YES.'<input type="radio" name="process_limit_date_use" class="check" id="process_limit_date_use_no" value="no" onclick="clear_error(\'frm_error_'.$id_action.'\');activate_process_date(false, \''.$display_value.'\');" '; + if(isset($data['process_limit_date_use']) && $data['process_limit_date_use'] == false) + { + $frm_str .=' checked="checked"'; + } + $frm_str .='/>'._NO.'</td>'; + $frm_str .= '<td><span class="red_asterisk" id="process_limit_date_use_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="process_limit_date_tr" style="display:'.$display_value.';">'; + $frm_str .='<td class="indexing_label"><label for="process_limit_date" class="form_title" >'._PROCESS_LIMIT_DATE.'</label></td>'; + $frm_str .='<td> </td>'; + $frm_str .='<td class="indexing_field"><input name="process_limit_date" type="text" id="process_limit_date" onclick="clear_error(\'frm_error_'.$id_action.'\');showCalender(this);" value="'; + if(isset($data['process_limit_date'])&& !empty($data['process_limit_date'])) + { + $frm_str .= $data['process_limit_date']; + } + $frm_str .='"/></td>'; + $frm_str .= '<td><span class="red_asterisk" id="process_limit_date_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + + /*** Folder : Market & Project ***/ + if($core_tools->is_module_loaded('folder')) + { + $frm_str .= '<tr id="project_tr" style="display:'.$display_value.';">'; + $frm_str .= '<td class="indexing_label"><label for="project" class="form_title" >'._PROJECT.'</label></td>'; + $frm_str .= '<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="text" name="project" id="project" value="'; + if(isset($data['project'])&& !empty($data['project'])) + { + $frm_str .= $data['project']; + } + $frm_str .='" onblur="clear_error(\'frm_error_'.$id_action.'\');return false;"/><div id="show_project" class="autocomplete"></div></td>'; // $(\'market\').value=\'\'; + $frm_str .= '<td><span class="red_asterisk" id="project_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="market_tr" style="display:'.$display_value.';">'; + $frm_str .= '<td class="indexing_label"><label for="market" class="form_title" >'._MARKET.'</label></td>'; + $frm_str .= '<td> </td>'; + $frm_str .='<td class="indexing_field"><input type="text" name="market" id="market" onblur="clear_error(\'frm_error_'.$id_action.'\');fill_project(\''.$_SESSION['urltomodules'].'folder/ajax_get_project.php\');" value=\''; + if(isset($data['market'])&& !empty($data['market'])) + { + $frm_str .= $data['market']; + } + $frm_str .= '\' /><div id="show_market" class="autocomplete"></div></td>'; + $frm_str .= '<td><span class="red_asterisk" id="market_mandatory" style="display:inline;">*</span> </td>'; + $frm_str .= '</tr>'; + } + $frm_str .= '</table>'; + $frm_str .= '</div>'; + /*** Actions ***/ + $frm_str .= '<hr width="90%" align="center"/>'; + $frm_str .= '<p align="center">'; + $frm_str .= '<b>'._ACTIONS.' : </b>'; + + $actions = $b->get_actions_from_current_basket($res_id, $coll_id, 'PAGE_USE', false); + if(count($actions) > 0) + { + $frm_str .='<select name="chosen_action" id="chosen_action">'; + $frm_str .='<option value="">'._CHOOSE_ACTION.'</option>'; + for($ind_act = 0; $ind_act < count($actions);$ind_act++) + { + $frm_str .='<option value="'.$actions[$ind_act]['VALUE'].'"'; + if($ind_act==0) + { + $frm_str .= 'selected="selected"'; + } + $frm_str .= '>'.$actions[$ind_act]['LABEL'].'</option>'; + } + $frm_str .='</select> '; + $frm_str .= '<input type="button" name="send" id="send" value="'._VALIDATE.'" class="button" onclick="valid_action_form( \'index_file\', \''.$path_manage_action.'\', \''. $id_action.'\', \''.$res_id.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');"/> '; + } + $frm_str .= '<input name="close" id="close" type="button" value="'._CANCEL.'" class="button" onClick="javascript:$(\'baskets\').style.visibility=\'visible\';destroyModal(\'modal_'.$id_action.'\');reinit();"/>'; + $frm_str .= '</p>'; + $frm_str .= '</form>'; + $frm_str .= '</div>'; + $frm_str .= '</div>'; + $frm_str .= '</div>'; + + /*** Frame to display the doc ***/ + $frm_str .= '<div id="validright">'; + $frm_str .= '<div id="create_contact_div" style="display:none">'; + $frm_str .= '<div>'; + $frm_str .= '<form name="indexingfrmcontact" id="indexingfrmcontact" method="post" action="'.$_SESSION['config']['businessappurl'].'contact_info.php" >'; + + $frm_str .= '<table>'; + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .= '<label for="is_corporate">'._IS_CORPORATE_PERSON.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input type="radio" class="check" name="is_corporate" id="is_corporate_Y" value="Y" '; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .=' checked="checked"'; + }elseif(empty($contact['IS_CORPORATE_PERSON'])) + { + $frm_str .=' checked="checked"'; + } + $frm_str .= 'onclick="javascript:show_admin_contacts(true, \''.$display_value.'\');">'._YES; + $frm_str .='<input type="radio" id="is_corporate_N" class="check" name="is_corporate" value="N"'; + if($contact_info['IS_CORPORATE_PERSON'] == 'N') + { + $frm_str .=' checked="checked"'; + } + $frm_str .=' onclick="javascript:show_admin_contacts( false, \''.$display_value.'\');"/>'._NO; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="title_p" style="display:'; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .= 'none'; + } + else + { + $frm_str .= $display_value; + } + $frm_str .='">'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="title">'._TITLE2.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2" >'; + $frm_str .='<select name="title" id="title" >'; + $frm_str .='<option value="">'._CHOOSE_TITLE.'</option>'; + foreach(array_keys($titles) as $key) + { + $frm_str .='<option value="'.$key.'" '; + if($key == $default_title) + { + $frm_str .= 'selected="selected"'; + } + $frm_str .='>'.$titles[$key].'</option>'; + } + $frm_str .='</select>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="lastname_p" style="display:'; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .= 'none'; + } + else + { + $frm_str .= $display_value; + } + $frm_str .='">'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="lastname">'._LASTNAME.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="lastname" type="text" id="lastname" value="'.$core_tools->show($contact_info['LASTNAME']).'" /> '; + $frm_str .='<span class="red_asterisk" id="lastname_mandatory" style="display:none;">*</span>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr id="firstname_p" style="display:'; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .= 'none'; + } + else + { + $frm_str .= $display_value; + } + $frm_str .='">'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="firstname">'._FIRSTNAME.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="firstname" type="text" id="firstname" value="'.$core_tools->show($contact_info['FIRSTNAME']).'"/>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="society">'._SOCIETY.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="society" type="text" id="society" value="'.$core_tools->show($contact_info['SOCIETY']).'" />'; + $frm_str .='<span class="red_asterisk" id="society_mandatory" style="display:inline;">*</span>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + + $frm_str .= '<tr id="function_p" style="display:'; + if($contact_info['IS_CORPORATE_PERSON'] == 'Y') + { + $frm_str .= 'none'; + } + else + { + $frm_str .= 'block'; + } + $frm_str .='">'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="function">'._FUNCTION.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="function" type="text" id="function" value="'.$core_tools->show($contact_info['FUNCTION']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="phone">'._PHONE.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="phone" type="text" id="phone" value="'.$core_tools->show($contact_info['PHONE']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="mail">'._MAIL.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="mail" type="text" id="mail" value="'.$core_tools->show($contact_info['MAIL']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; +/* + $frm_str .='<p >'; + $frm_str .='<label><b>'._ADDRESS.' </b></label>'; + $frm_str .='</p>'; +*/ + //$frm_str .='<br/>'; + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .='<label for="num">'._NUM.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="num" type="text" class="small" id="num" value="'.$core_tools->show($contact_info['ADD_NUM']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<label for="street">'._STREET.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="street" type="text" class="medium" id="street" value="'.$core_tools->show($contact_info['ADD_STREET']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + +/* + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .='<label for="label">'._STREET.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="street" type="text" id="street" value="'.$core_tools->show($contact_info['ADD_STREET']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; +*/ + + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="add_comp">'._COMPLEMENT.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="add_comp" type="text" id="add_comp" value="'.$core_tools->show($contact_info['ADD_COMP']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + +/* + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .='<label for="label">'._TOWN.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="town" type="text" id="town" value="'.$core_tools->show($contact_info['ADD_TOWN']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; +*/ + + $frm_str .= '<tr>'; + $frm_str .= '<td>'; + $frm_str .='<label for="cp">'._POSTAL_CODE.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="cp" type="text" id="cp" value="'.$core_tools->show($contact_info['ADD_CP']).'" class="small" />'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<label for="town">'._TOWN.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td>'; + $frm_str .='<input name="town" type="text" id="town" value="'.$core_tools->show($contact_info['ADD_TOWN']).'" class="medium" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="country">'._COUNTRY.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<input name="country" type="text" id="country" value="'.$core_tools->show($contact_info['ADD_COUNTRY']).'" />'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; +/* + $frm_str .='</p>'; + $frm_str .='<p><label><b>'._COMP.' </b></label></p>'; + $frm_str .='<br/>'; +*/ + $frm_str .= '<tr>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<label for="comp_data">'._COMP_DATA.' : </label>'; + $frm_str .= '</td>'; + $frm_str .= '<td colspan="2">'; + $frm_str .='<textarea name="comp_data" id="comp_data" >'.$core_tools->show($contact_info['OTHER_DATA']).'</textarea>'; + $frm_str .= '</td>'; + $frm_str .= '</tr>'; + $frm_str .= '</table>'; + $frm_str .='<div align="center">'; + if(!$readonly) + { + $frm_str .='<input name="submit" type="button" value="'._VALIDATE.'" class="button" onclick="create_contact(\''.$_SESSION['config']['businessappurl'].'create_contact.php\', \''.$id_action.'\');" />'; + } + $frm_str .=' <input name="cancel" type="button" value="'._CANCEL.'" onclick="new Effect.toggle(\'create_contact_div\', \'blind\', {delay:0.2});clear_form(\'indexingfrmcontact\');return false;" class="button" />'; + $frm_str .='</div>'; + $frm_str .='</form >'; + $frm_str .= '</div><br/>'; + $frm_str .= '</div>'; + $frm_str .= '<script type="text/javascript">show_admin_contacts( true);</script>'; + + $path_file = get_file_path($res_id, $coll_id); + $frm_str .= '<iframe src="'.$_SESSION['config']['businesappurl'].'indexing_searching/view.php?id='.$res_id.'&coll_id='.$coll_id.'" name="viewframevalid" id="viewframevalid" scrolling="auto" frameborder="0" ></iframe>'; + $frm_str .= '</div>'; + + /*** Extra javascript ***/ + $frm_str .= '<script type="text/javascript">resize_frame_process("modal_'.$id_action.'", "viewframevalid", true, true);resize_frame_process("modal_'.$id_action.'", "hist_doc", true, false);window.scrollTo(0,0);launch_autocompleter_contacts(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\');'; + if($core_tools->is_module_loaded('folder')) + { + $frm_str .= 'launch_autocompleter_folders(\''.$_SESSION['urltomodules'].'folder/autocomplete_folders.php?mode=project\', \'project\');launch_autocompleter_folders(\''.$_SESSION['urltomodules'].'folder/autocomplete_folders.php?mode=market\', \'market\');'; + } + $frm_str .='init_validation(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\', \''.$display_value.'\', \''.$_SESSION['config']['businessappurl'].'indexing_searching/change_category.php\', \''.$_SESSION['config']['businessappurl'].'get_content_js.php\');$(\'baskets\').style.visibility=\'hidden\';var item = $(\'valid_div\'); if(item){item.style.display=\'block\';}</script>'; + + return addslashes($frm_str); +} + +/** + * Checks the action form + * + * @param $form_id String Identifier of the form to check + * @param $values Array Values of the form + * @return Bool true if no error, false otherwise + **/ +function check_form($form_id,$values) +{ + if(count($values) < 1 || empty($form_id)) + { + $_SESSION['error'] = _FORM_ERROR; + return false; + } + else + { + $cat_id = ''; + for($i=0; $i<count($values); $i++) + { + if($values[$i]['ID'] == "category_id" ) + { + $cat_id = $values[$i]['VALUE']; + break; + } + } + if(empty($cat_id)) + { + $_SESSION['error'] = _CATEGORY.' '._IS_EMPTY; + return false; + } + $no_error = process_category_check($cat_id, $values); + + return $no_error; + } +} + + +/** + * Checks the values of the action form for a given category + * + * @param $cat_id String Category identifier + * @param $values Array Values of the form to check + * @return Bool true if no error, false otherwise + **/ +function process_category_check($cat_id, $values) +{ + $core = new core_tools(); + // If No category : Error + if(!isset($_ENV['categories'][$cat_id])) + { + $_SESSION['error'] = _CATEGORY.' '._UNKNOWN.': '.$cat_id; + return false; + } + + // Simple cases + for($i=0; $i<count($values); $i++) + { + if($_ENV['categories'][$cat_id][$values[$i]['ID']]['mandatory'] == true && (empty($values[$i]['VALUE']) && ($values[$i]['VALUE'] == 0 && $_ENV['categories'][$cat_id][$values[$i]['ID']]['type_form'] <> 'integer'))) + { + + $_SESSION['error'] = $_ENV['categories'][$cat_id][$values[$i]['ID']]['label'].' '._IS_EMPTY; + return false; + } + if($_ENV['categories'][$cat_id][$values[$i]['ID']]['type_form'] == 'date' && !empty($values[$i]['VALUE']) && preg_match($_ENV['date_pattern'],$values[$i]['VALUE'])== 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id][$values[$i]['ID']]['label']." "._WRONG_FORMAT.""; + return false; + } + if($_ENV['categories'][$cat_id][$values[$i]['ID']]['type_form'] == 'integer' && (!empty($values[$i]['VALUE']) || $values[$i]['VALUE'] == 0) && preg_match("/^[0-9]*$/",$values[$i]['VALUE'])== 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id][$values[$i]['ID']]['label']." "._WRONG_FORMAT.""; + return false; + } + if($_ENV['categories'][$cat_id][$values[$i]['ID']]['type_form'] == 'radio' && !empty($values[$i]['VALUE']) && !in_array($values[$i]['VALUE'], $_ENV['categories'][$cat_id][$values[$i]['ID']]['values'])) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id][$values[$i]['ID']]['label']." "._WRONG_FORMAT.""; + return false; + } + } + + ///////////////////////// Other cases + // Process limit Date + /*if(isset($_ENV['categories'][$cat_id]['other_cases']['process_limit_date']) ) + { + $process_limit_date_use = get_value_fields($values, 'process_limit_date_use'); + if($process_limit_date_use == 'Y') + { + $process_limit_date = get_value_fields($values, 'process_limit_date'); + if( empty($process_limit_date) || preg_match($_ENV['date_pattern'],$process_limit_date)== 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['label']." "._WRONG_FORMAT.""; + return false; + } + } + }*/ + + $_SESSION['store_process_limit_date'] = ""; + if(isset($_ENV['categories'][$cat_id]['other_cases']['process_limit_date'])) + { + $process_limit_date_use_yes = get_value_fields($values, 'process_limit_date_use_yes'); + $process_limit_date_use_no = get_value_fields($values, 'process_limit_date_use_no'); + if($process_limit_date_use_yes == 'yes') + { + $_SESSION['store_process_limit_date'] = "ok"; + $process_limit_date = get_value_fields($values, 'process_limit_date'); + if(trim($process_limit_date) == "" || preg_match($_ENV['date_pattern'], $process_limit_date)== 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['label']." "._WRONG_FORMAT.""; + return false; + } + } + elseif($process_limit_date_use_no == 'no') + { + $_SESSION['store_process_limit_date'] = "ko"; + } + } + + + // Contact + if(isset($_ENV['categories'][$cat_id]['other_cases']['contact'])) + { + $contact_type = get_value_fields($values, 'type_contact_external'); + if(!$contact_type) + { + $contact_type = get_value_fields($values, 'type_contact_internal'); + } + if(!$contact_type) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['type_contact']['label']." "._MANDATORY.""; + return false; + } + $contact = get_value_fields($values, 'contact'); + if($_ENV['categories'][$cat_id]['other_cases']['contact']['mandatory'] == true) + { + if(empty($contact)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['contact']['label'].' '._IS_EMPTY; + return false; + } + } + if(!empty($contact) ) + { + if($contact_type == 'external' && preg_match('/\([0-9]+\)$/', $contact) == 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['contact']['label']." "._WRONG_FORMAT.".<br/>"._USE_AUTOCOMPLETION; + return false; + } + elseif($contact_type == 'internal' && preg_match('/\([A-Za-Z0-9-_ ]+\)$/', $contact) == 0) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['contact']['label']." "._WRONG_FORMAT.".<br/>"._USE_AUTOCOMPLETION; + return false; + } + } + } + + if($core->is_module_loaded('entities')) + { + // Diffusion list + if(isset($_ENV['categories'][$cat_id]['other_cases']['diff_list']) && $_ENV['categories'][$cat_id]['other_cases']['diff_list']['mandatory'] == true) + { + if(empty($_SESSION['indexing']['diff_list']['dest']['user_id']) || !isset($_SESSION['indexing']['diff_list']['dest']['user_id'])) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['diff_list']['label']." "._MANDATORY.""; + return false; + } + } + } + if($core->is_module_loaded('folder')) + { + $db = new dbquery(); + $db->connect(); + $market = get_value_fields($values, 'market'); + $project_id = ''; + $market_id = ''; + if(isset($_ENV['categories'][$cat_id]['other_cases']['market']) && $_ENV['categories'][$cat_id]['other_cases']['market']['mandatory'] == true) + { + if(empty($market)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['market']['label'].' '._IS_EMPTY; + return false; + } + } + if(!empty($market) ) + { + if(!preg_match('/\([0-9]+\)$/', $market)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['market']['label']." "._WRONG_FORMAT.""; + return false; + } + $market_id = str_replace(')', '', substr($market, strrpos($market,'(')+1)); + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$market_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _MARKET.' '.$market_id.' '._UNKNOWN; + return false; + } + } + $project = get_value_fields($values, 'project'); + if(isset($_ENV['categories'][$cat_id]['other_cases']['project']) && $_ENV['categories'][$cat_id]['other_cases']['project']['mandatory'] == true) + { + if(empty($project)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['project']['label'].' '._IS_EMPTY; + return false; + } + } + if(!empty($project) ) + { + if(!preg_match('/\([0-9]+\)$/', $project)) + { + $_SESSION['error'] = $_ENV['categories'][$cat_id]['other_cases']['project']['label']." "._WRONG_FORMAT.""; + return false; + } + $project_id = str_replace(')', '', substr($project, strrpos($project,'(')+1)); + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$project_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _MARKET.' '.$project_id.' '._UNKNOWN; + return false; + } + } + if(!empty($project_id) && !empty($market_id)) + { + $db->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$market_id." and parent_id = ".$project_id); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _INCOMPATIBILITY_MARKET_PROJECT; + return false; + } + } + } + + if($core->is_module_loaded('physical_archive')) + { + // Arbox id + $box_id = get_value_fields($values, 'arbox_id'); + if(isset($_ENV['categories'][$cat_id]['other_cases']['arbox_id']) && $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['mandatory'] == true) + { + if($box_id == false) + { + $_SESSION['error'] = _NO_BOX_SELECTED.' '; + return false; + } + } + if($box_id != false && preg_match('/^[0-9]+$/', $box_id)) + { + require_once($_SESSION['pathtomodules'].'physical_archive'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'); + $physical_archive = new physical_archive(); + $pa_return_value = $physical_archive->load_box_db($box_id, $categorie, $user_id); + if ($pa_return_value == false) + { + $_SESSION['error'] = _ERROR_TO_INDEX_NEW_BATCH_WITH_PHYSICAL_ARCHIVE; + return false; + } + else + { + return true; + } + } + } + return true; +} + +/** + * Get the value of a given field in the values returned by the form + * + * @param $values Array Values of the form to check + * @param $field String the field + * @return String the value, false if the field is not found + **/ +function get_value_fields($values, $field) +{ + for($i=0; $i<count($values);$i++) + { + if($values[$i]['ID'] == $field) + { + return $values[$i]['VALUE']; + } + } + return false; +} + +/** + * Action of the form : update the database + * + * @param $arr_id Array Contains the res_id of the document to validate + * @param $history String Log the action in history table or not + * @param $id_action String Action identifier + * @param $label_action String Action label + * @param $status String Not used here + * @param $coll_id String Collection identifier + * @param $table String Table + * @param $values_form String Values of the form to load + **/ +function manage_form($arr_id, $history, $id_action, $label_action, $status, $coll_id, $table, $values_form ) +{ + + if(empty($values_form) || count($arr_id) < 1 || empty($coll_id)) + { + $_SESSION['error'] = _ERROR_MANAGE_FORM_ARGS; + return false; + } + + require_once($_SESSION['pathtocoreclass']."class_db.php"); + require_once($_SESSION['pathtocoreclass']."class_security.php"); + require_once($_SESSION['pathtocoreclass']."class_request.php"); + require_once($_SESSION['pathtocoreclass']."class_resource.php"); + $db = new dbquery(); + $sec = new security(); + $core = new core_tools(); + $table = $sec->retrieve_table_from_coll($coll_id); + $ind_coll = $sec->get_ind_collection($coll_id); + $table_ext = $_SESSION['collections'][$ind_coll]['extensions'][0]; + $res_id = $arr_id[0]; + $query_ext = "update ".$table_ext." set "; + $query_res = "update ".$table." set "; + + $cat_id = ''; + for($i=0; $i<count($values_form); $i++) + { + if($values_form[$i]['ID'] == "category_id" ) + { + $cat_id = $values_form[$i]['VALUE']; + break; + } + } + + $query_ext .= " category_id = '".$cat_id."' " ; + $query_res .= " status = 'NEW' " ; + + + // Specific indexes : values from the form + // Simple cases + for($i=0; $i<count($values_form); $i++) + { + if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['type_field'] == 'integer' && $_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] <> 'none') + { + if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'res') + { + $query_res .= ", ".$values_form[$i]['ID']." = ".$values_form[$i]['VALUE']; + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'coll_ext') + { + $query_ext .= ", ".$values_form[$i]['ID']." = ".$values_form[$i]['VALUE']; + } + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['type_field'] == 'string' && $_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] <> 'none') + { + if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'res') + { + $query_res .= ", ".$values_form[$i]['ID']." = '".$db->protect_string_db($values_form[$i]['VALUE'])."'"; + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'coll_ext') + { + $query_ext .= ", ".$values_form[$i]['ID']." = '".$db->protect_string_db($values_form[$i]['VALUE'])."'"; + } + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['type_field'] == 'date' && $_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] <> 'none') + { + if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'res') + { + $query_res .= ", ".$values_form[$i]['ID']." = '".$db->format_date_db($values_form[$i]['VALUE'])."'"; + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'coll_ext') + { + $query_ext .= ", ".$values_form[$i]['ID']." = '".$db->format_date_db($values_form[$i]['VALUE'])."'"; + } + } + } + + ///////////////////////// Other cases + // Process limit Date + /*if(isset($_ENV['categories'][$cat_id]['other_cases']['process_limit_date'])) + { + $process_limit_date = get_value_fields($values_form, 'process_limit_date'); + if($_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['table'] == 'res') + { + $query_res .= ", process_limit_date = '".$db->format_date_db($process_limit_date)."'"; + } + else if($_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['table'] == 'coll_ext') + { + $query_ext .= ", process_limit_date = '".$db->format_date_db($process_limit_date)."'"; + } + }*/ + + if(isset($_ENV['categories'][$cat_id]['other_cases']['process_limit_date'])) + { + $process_limit_date = get_value_fields($values_form, 'process_limit_date'); + if($_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['table'] == 'res') + { + array_push($_SESSION['data'], array('column' => 'process_limit_date', 'value' => $db->format_date_db($process_limit_date), 'type' => "date")); + } + else if($_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['table'] == 'coll_ext') + { + if($_SESSION['store_process_limit_date'] == "ok") + { + $query_ext_fields .= 'process_limit_date,'; + $query_ext_values .= "'".$db->format_date_db($process_limit_date)."',"; + } + $_SESSION['store_process_limit_date'] = ""; + } + } + + // Contact + if(isset($_ENV['categories'][$cat_id]['other_cases']['contact'])) + { + $contact = get_value_fields($values_form, 'contact'); + $contact_type = get_value_fields($values_form, 'type_contact_external'); + if(!$contact_type) + { + $contact_type = get_value_fields($values_form, 'type_contact_internal'); + } + //echo 'contact '.$contact.', type '.$contact_type; + $contact_id = str_replace(')', '', substr($contact, strrpos($contact,'(')+1)); + if($contact_type == 'internal') + { + if($cat_id == 'incoming') + { + $query_ext .= ", exp_user_id = '".$db->protect_string_db($contact_id)."'"; + } + else if($cat_id == 'outgoing' || $cat_id == 'internal') + { + $query_ext .= ", dest_user_id = '".$db->protect_string_db($contact_id)."'"; + } + } + elseif($contact_type == 'external') + { + if($cat_id == 'incoming') + { + $query_ext .= ", exp_contact_id = ".$contact_id.""; + } + else if($cat_id == 'outgoing' || $cat_id == 'internal') + { + $query_ext .= ", dest_contact_id = ".$contact_id.""; + } + } + } + if($core->is_module_loaded('folder')) + { + $folder_id = ''; + $market = get_value_fields($values_form, 'market'); + if(!empty($market)) + { + $folder_id = str_replace(')', '', substr($market, strrpos($market,'(')+1)); + } + else + { + $project = get_value_fields($values_form, 'project'); + $folder_id = str_replace(')', '', substr($project, strrpos($project,'(')+1)); + } + if(!empty($folder_id)) + { + $query_res .= ", folders_system_id = ".$folder_id.""; + } + } + + if($core->is_module_loaded('entities')) + { + // Diffusion list + $load_list_diff = false; + if(isset($_ENV['categories'][$cat_id]['other_cases']['diff_list']) ) + { + if(!empty($_SESSION['indexing']['diff_list']['dest']['user_id']) && isset($_SESSION['indexing']['diff_list']['dest']['user_id'])) + { + $query_res .= ", dest_user = '".$db->protect_string_db($_SESSION['indexing']['diff_list']['dest']['user_id'])."'"; + } + $load_list_diff = true; + } + } + + if($core->is_module_loaded('physical_archive')) + { + // Arbox_id + Arbatch_id + $box_id = get_value_fields($values_form, 'arbox_id'); + $query_res .= ", arbox_id = ".$box_id.""; + require_once($_SESSION['pathtomodules'].'physical_archive'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'); + $physical_archive = new physical_archive(); + $pa_return_value = $physical_archive->load_box_db($box_id, $cat_id, $_SESSION['user']['UserId']); + $query_res .= ", arbatch_id = ".$box_id.""; + } + + $db->connect(); + $db->query($query_res." where res_id =".$res_id); + $db->query($query_ext." where res_id =".$res_id); + //$db->show(); + if($core->is_module_loaded('entities')) + { + if($load_list_diff) + { + require_once($_SESSION['pathtomodules'].'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_listdiff.php'); + $diff_list = new diffusion_list(); + $params = array('mode'=> 'listinstance', 'table' => $_SESSION['tablename']['ent_listinstance'], 'coll_id' => $coll_id, 'res_id' => $res_id, 'user_id' => $_SESSION['user']['UserId']); + $diff_list->load_list_db($_SESSION['indexing']['diff_list'], $params); + } + } + //$_SESSION['indexing'] = array(); + unset($_SESSION['upfile']); + + //$_SESSION['indexation'] = true; + return array('result' => $res_id.'#', 'history_msg' => ''); +} + +function manage_status($arr_id, $history, $id_action, $label_action, $status) +{ + $result = ''; + $db = new dbquery(); + $db->connect(); + for($i=0; $i<count($arr_id );$i++) + { + $result .= $arr_id[$i].'#'; + $db->query("select status from ".$_POST['table']." where res_id = ".$arr_id[$i]); + $res = $db->fetch_object(); + if($res->status == 'NEW') + { + $req = $db->query("update ".$_POST['table']. " set status = '".$status."' where res_id = ".$arr_id[$i], true); + if(!$req) + { + $_SESSION['error'] = _SQL_ERROR; + return false; + } + } + } + return array('result' => $result, 'history_msg' => ''); + } +?> diff --git a/maarch_entreprise/trunk/actions/view.php b/maarch_entreprise/trunk/actions/view.php new file mode 100644 index 0000000000000000000000000000000000000000..46b0a7823cef343356b069da6f9b7345c393c3e7 --- /dev/null +++ b/maarch_entreprise/trunk/actions/view.php @@ -0,0 +1,73 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief View a document +* +* @file view.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ + + +/** +* $etapes array Contains 2 etaps : form and status (order matters) +*/ +$etapes = array('form', 'status'); +/** +* $frm_width Width of the modal (empty) +*/ +$frm_width=''; +/** +* $frm_height Height of the modal (empty) +*/ +$frm_height = ''; +/** +* $mode_form Mode of the modal : fullscreen +*/ +$mode_form = 'fullscreen'; + +/** + * Returns the indexing form text + * + * @param $values Array Contains the res_id of the document to process + * @param $path_manage_action String Path to the PHP file called in Ajax + * @param $id_action String Action identifier + * @param $table String Table + * @param $module String Origin of the action + * @param $coll_id String Collection identifier + * @param $mode String Action mode 'mass' or 'page' + * @return String The form content text + **/ +function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode ) +{ + $res_id = $values[0]; + $frm_str = ''; + $_SESSION['doc_id'] = $res_id; + $frm_str .= '<div>'; + $frm_str .= ' <center><input name="close" id="close" type="button" value="'._CLOSE.'" class="button" onClick="javascript:$(\'baskets\').style.visibility=\'visible\';destroyModal(\'modal_'.$id_action.'\');reinit();"/></center>'; + $frm_str .= ' <iframe src="'.$_SESSION['config']['businesappurl'].'indexing_searching/view.php?id='.$res_id.'" name="viewframe" id="viewframe" scrolling="auto" frameborder="0" ></iframe>'; + $frm_str .= '</div>'; + $frm_str .= '<script type="text/javascript">resize_frame_process("modal_'.$id_action.'", "viewframe", true, true);resize_frame_process("modal_'.$id_action.'", "hist_doc", true, false);window.scrollTo(0,0);</script>'; + return addslashes($frm_str); +} +?> diff --git a/maarch_entreprise/trunk/admin.php b/maarch_entreprise/trunk/admin.php new file mode 100644 index 0000000000000000000000000000000000000000..b11c7ed0844e40c77a947bd476dc123ca64e3888 --- /dev/null +++ b/maarch_entreprise/trunk/admin.php @@ -0,0 +1,53 @@ +<?php +/** +* File : admin.php +* +* Administration summary Page +* {@internal this page calls an admin object (class admin)}} +* +* @package Maarch Framework v3 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ + +/** +* include the test admin page +* +* this page tests the user access level, and if the user is an admin or not +*/ +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_admin.php"); +$admin = new admin(); + +$core_tools2 = new core_tools(); +$core_tools2->test_admin('admin', 'apps'); + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=admin'; +$page_label = _ADMIN; +$page_id = "admin"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +unset($_SESSION['m_admin']); +?> +<h1><img src="<?php echo $_SESSION['config']['img'];?>/picto_admin_b.gif" alt="" /> <?php echo _ADMIN;?></h1> +<div id="inner_content" class="clearfix"> +<?php +$admin->retrieve_app_admin_services($_SESSION['app_services']); +?> +<!--<hr />--> +<?php +$admin->retrieve_modules_admin_services($_SESSION['modules_services']); +?> +</div> diff --git a/maarch_entreprise/trunk/admin/action/action.php b/maarch_entreprise/trunk/admin/action/action.php new file mode 100644 index 0000000000000000000000000000000000000000..73d02b121f6a63527de7ff01a0125eeac04a964a --- /dev/null +++ b/maarch_entreprise/trunk/admin/action/action.php @@ -0,0 +1,169 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Displays actions in a list +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_actions', 'apps'); +$func = new functions(); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=action&admin=action'; +$page_label = _ACTION_LIST; +$page_id = "action"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$select[$_SESSION['tablename']['actions']] = array(); +array_push($select[$_SESSION['tablename']['actions']],"id", "label_action", 'is_system'); +$what = ""; +$where =" enabled = 'Y' "; +if(isset($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where .= " and (label_action ilike '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' or id ilike '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' ) "; + } + else + { + $where .= " and (label_action like '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' or id like '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' ) "; + } +} +$list = new list_show(); +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'label_action'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request= new request; +$tab=$request->select($select,$where,$orderstr,$_SESSION['config']['databasetype']); +//$request->show(); +$del = array(); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="id") + { + $load = $admin->is_action_defined($tab[$i][$j]['value']); + + $tab[$i][$j]["id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="18"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='id'; + if(!$load) + { + array_push($del, $i); + //unset($tab[$i]); + } + } + if($tab[$i][$j][$value]=="label_action") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["label_action"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_DESC; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='label_action'; + } + if($tab[$i][$j][$value]=="is_system") + { + if($tab[$i][$j]['value'] == 'Y') + { + $tab[$i][$j]['value'] = _YES; + array_push($tab[$i], array('column' => 'can_delete', 'value' => 'false', 'can_delete' => 'false', + 'label' => _DESC,'show' => false)); + } + else + { + $tab[$i][$j]['value'] = _NO; + array_push($tab[$i], array('column' => 'can_delete', 'value' => 'true', 'can_delete' => 'true', + 'label' => _DESC,'show' => false)); + } + $tab[$i][$j]["is_system"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_IS_SYSTEM; + $tab[$i][$j]["size"]="5"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='is_system'; + } + } + } +} +for($i=0; $i<count($del);$i++) +{ + array_splice($tab, $del[$i], 1); +} +//$request->show_array($tab); +$page_name = "action"; +$page_name_up = "action_up"; +$page_name_del = "action_del"; +$page_name_val= ""; +$page_name_ban = ""; +$page_name_add = "action_add"; +$label_add = _ADD_ACTION; +$_SESSION['m_admin']['init'] = true; +$title = _ACTION_LIST." : ".count($tab)." "._ACTIONS; + +$autoCompletionArray = array(); +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."admin/action/action_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; + +$list->admin_list($tab, count($tab), $title, 'id','action','action','id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, FALSE, FALSE, _ALL_ACTIONS, _ACTION, $_SESSION['config']['img'].'/manage_actions_b.gif', false, true, false, true, $what, true, $autoCompletionArray); +$_SESSION['m_admin']['action'] = array(); +?> diff --git a/maarch_entreprise/trunk/admin/action/action_add.php b/maarch_entreprise/trunk/admin/action/action_add.php new file mode 100644 index 0000000000000000000000000000000000000000..58313dc34f5f61fbb3d6274cfa7fb031f812c9bb --- /dev/null +++ b/maarch_entreprise/trunk/admin/action/action_add.php @@ -0,0 +1,60 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to add an action +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +$core_tools2 = new core_tools(); +//here we loading the lang vars +$core_tools2->load_lang(); +$core_tools2->test_admin('admin_actions', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=action_add&admin=action'; +$page_label = _ADDITION; +$page_id = "action_add"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_admin_actions.php"); + +$action = new AdminActions(); + +$action->formaction("add"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/action/action_del.php b/maarch_entreprise/trunk/admin/action/action_del.php new file mode 100644 index 0000000000000000000000000000000000000000..6be332f03de5cc051dbcdaf42729c80d53cb947e --- /dev/null +++ b/maarch_entreprise/trunk/admin/action/action_del.php @@ -0,0 +1,57 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Delete an action +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_actions', 'apps'); +require_once($_SESSION['pathtocoreclass']."class_db.php"); + +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_admin_actions.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "alphanum", _THE_ACTION)); +} +else +{ + $s_id = ""; +} + +$action= new AdminActions(); +$action->delaction($s_id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/action/action_list_by_name.php b/maarch_entreprise/trunk/admin/action/action_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..b0505c76e9d67926e851ae9c4596eb3e227d99cd --- /dev/null +++ b/maarch_entreprise/trunk/admin/action/action_list_by_name.php @@ -0,0 +1,71 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Script used by an ajax autocompleter object to get actions list +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select label_action as tag from ".$_SESSION['tablename']['actions']." where label_action ilike '".$_REQUEST['what']."%' order by label_action"); +} +else +{ + $db->query("select label_action as tag from ".$_SESSION['tablename']['actions']." where label_action like '".$_REQUEST['what']."%' order by label_action"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; + +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/action/action_up.php b/maarch_entreprise/trunk/admin/action/action_up.php new file mode 100644 index 0000000000000000000000000000000000000000..6d6278ac24b5f9e5c41ad13d6b63ca13d0e1a480 --- /dev/null +++ b/maarch_entreprise/trunk/admin/action/action_up.php @@ -0,0 +1,68 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to modify an action +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +$core_tools2 = new core_tools(); +//here we loading the lang vars +$core_tools2->load_lang(); +$core_tools2->test_admin('admin_actions', 'apps'); +$func = new functions(); +if(isset($_GET['id'])) +{ + $id = addslashes($func->wash($_GET['id'], "alphanum", _THE_ACTION)); +} +else +{ + $id = ""; +} +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=action_add&admin=action'; +$page_label = _ADDITION; +$page_id = "action_up"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_admin_actions.php"); + +$action = new AdminActions(); + +$action->formaction("up", $id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/action/action_up_db.php b/maarch_entreprise/trunk/admin/action/action_up_db.php new file mode 100644 index 0000000000000000000000000000000000000000..44af3bbc3ea3519c9cf36ad77253953e358c4644 --- /dev/null +++ b/maarch_entreprise/trunk/admin/action/action_up_db.php @@ -0,0 +1,47 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Creates or modifies an action in the database +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_actions', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_admin_actions.php"); + +$satus = new AdminActions(); +$satus->addupaction($_REQUEST['mode']); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/admin_archi.php b/maarch_entreprise/trunk/admin/architecture/admin_archi.php new file mode 100644 index 0000000000000000000000000000000000000000..9abe099dfcdacd7e0dda055a147a0b80f86959cc --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/admin_archi.php @@ -0,0 +1,84 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Architecture Administration summary Page +* +* Architecture Administration summary Page +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_architecture', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=admin_archi&admin=architecture'; +$page_label = _ARCHITECTURE; +$page_id = "admin_archi"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +unset($_SESSION['m_admin']); +?> +<h1><img src="<?php echo $_SESSION['config']['img'];?>/manage_architecture_b.gif" alt="" /> <?php echo _ADMIN_ARCHI;?></h1> +<div id="inner_content" class="clearfix"> + <h2 class="admin_subtitle block" ><?php echo _ARCHITECTURE;?></h2> + <div class="admin_item" id="admin_structures" title="<?php echo _MANAGE_STRUCTURE_DESC;?>" onclick="window.top.location='index.php?page=structures';"> + <div class="sum_margin"> + <strong><?php echo _MANAGE_STRUCTURE;?></strong><!--<br/> + <em><?php echo _MANAGE_STRUCTURE_DESC;?></em>--> + </div> + </div> + + <div class="admin_item" id="admin_subfolders" title="<?php echo _MANAGE_SUBFOLDER_DESC;?>" onclick="window.top.location='index.php?page=subfolders';"> + <div class="sum_margin"> + <strong><?php echo _MANAGE_SUBFOLDER;?></strong><!--<br/> + <em><?php echo _MANAGE_SUBFOLDER_DESC;?></em>--> + </div> + </div> + + <div class="admin_item" id="admin_types" title="<?php echo _MANAGE_DOCTYPES_DESC;?>" onclick="window.top.location='index.php?page=types';"> + <div class="sum_margin"> + <strong><?php echo _MANAGE_DOCTYPES;?></strong><!--<br/> + <em><?php echo _MANAGE_DOCTYPES_DESC;?></em>--> + </div> + </div> + + <div class="admin_item" id="view_tree_types" title="<?php echo _VIEW_TREE_DOCTYPES_DESC;?>" onclick="window.top.location='index.php?page=view_tree_types&admin=architecture';"> + <div class="sum_margin"> + <strong><?php echo _VIEW_TREE_DOCTYPES;?></strong><!--<br/> + <em><?php echo _VIEW_TREE_DOCTYPES_DESC;?></em>--> + </div> + </div> + +</div> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/choose_tree.php b/maarch_entreprise/trunk/admin/architecture/choose_tree.php new file mode 100644 index 0000000000000000000000000000000000000000..15552a06eee3c8b3c600868dfe946502091872e0 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/choose_tree.php @@ -0,0 +1,72 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Frame to choose a foldertype +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$func = new functions(); +$core_tools->load_html(); +$core_tools->load_header(); + +if(isset($_REQUEST['tree_id']) && !empty($_REQUEST['tree_id'])) +{ + $_SESSION['doctypes_chosen_tree'] = $_REQUEST['tree_id']; + ?> + <script language="javascript" type="text/javascript">window.top.frames['show_trees'].location.href='<?php echo "show_trees.php";?>';</script> + <?php +} +else +{ + $_SESSION['doctypes_chosen_tree'] = ""; +} +?> +<body> + <form name="frm_choose_tree" id="frm_choose_tree" method="get" action="<?php echo "choose_tree.php";?>"> + <p align="left"> + <label><?php echo _FOLDERTYPE;?> :</label> + <select name="tree_id" id="tree_id" onchange="this.form.submit();"> + <option value=""><?php echo _CHOOSE_FOLDERTYPE;?></option> + <?php + for($i=0;$i<count($_SESSION['tree_foldertypes']);$i++) + { + ?> + <option value="<?php echo $_SESSION['tree_foldertypes'][$i]['ID'];?>" <?php if($_SESSION['doctypes_chosen_tree'] == $_SESSION['tree_foldertypes'][$i]['ID'] ){ echo 'selected="selected"';}?>><?php echo $_SESSION['tree_foldertypes'][$i]['LABEL'];?></option> + <?php + } + ?> + </select> + </p> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/architecture/get_tree_children.php b/maarch_entreprise/trunk/admin/architecture/get_tree_children.php new file mode 100644 index 0000000000000000000000000000000000000000..c9d0fc4d1c51e661faee7ea34371d2226f5446db --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/get_tree_children.php @@ -0,0 +1,102 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Script used to populate tree branches +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +if(isset($_REQUEST['branch_id']) && !empty($_REQUEST['branch_id']) && isset($_REQUEST['IdTree']) && !empty($_REQUEST['IdTree'])) +{ + $string = $_REQUEST['branch']; + $search="'branch_level_id'"; + $search="#branch_level_id\":(.*)\,#U"; + preg_match($search,$string,$out); + $count=count($out[0]); + if($count == 1) + { + $find = true; + } + $branch_level_id = str_replace("branch_level_id\":", "", $out[0]); + $branch_level_id = str_replace(",", "", $branch_level_id); + $branch_level_id = str_replace("\"", "", $branch_level_id); + + require_once($_SESSION['pathtocoreclass']."class_functions.php"); + require_once($_SESSION['pathtocoreclass']."class_db.php"); + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + $core_tools = new core_tools(); + $core_tools->load_lang(); + $func = new functions(); + $tree_id = $_REQUEST['IdTree']; + $db = new dbquery(); + $db->connect(); + $where = ""; + if($branch_level_id == "1") + { + $db->query("select * from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_first_level_id = '".$_REQUEST['branch_id']."' and enabled ='Y' order by doctypes_second_level_label asc"); + $children = array(); + while($res = $db->fetch_object()) + { + array_push($children, array('id' => $res->doctypes_second_level_id, 'tree' => $_SESSION['doctypes_chosen_tree'], 'key_value' => $res->doctypes_second_level_id, 'label_value' => $db->show_string($res->doctypes_second_level_label), 'script' => "show_doctypes")); + } + if(count($children) > 0) + { + echo "["; + for($cpt_level2=0; $cpt_level2< count($children); $cpt_level2++) + { + echo "{'id':'".$children[$cpt_level2]['id']."', 'txt':'".trim(addslashes($children[$cpt_level2]['label_value']))."', 'canhavechildren' : true, '".$children[$cpt_level2]['script']."' : 'other', 'key_value' : '".trim(addslashes($children[$cpt_level2]['key_value']))."', 'onbeforeopen' : MyBeforeOpen}"; + if(isset($children[$cpt_level2+1]['id']) && !empty($children[$cpt_level2+1]['id'])) + { + echo ','; + } + } + echo "]"; + } + } + if($branch_level_id == "2") + { + $db->query("select * from ".$_SESSION['tablename']['doctypes']." where doctypes_second_level_id = '".$_REQUEST['branch_id']."' and enabled ='Y' order by description"); + $children = array(); + while($res = $db->fetch_object()) + { + array_push($children, array('id' => $res->type_id, 'tree' => $_SESSION['doctypes_chosen_tree'], 'key_value' => $res->type_id, 'label_value' => $db->show_string($res->description), 'script' => "other")); + } + if(count($children) > 0) + { + echo "["; + for($cpt_level3=0; $cpt_level3< count($children); $cpt_level3++) + { + echo "{'id':'".$children[$cpt_level3]['id']."', 'txt':'".trim(addslashes($children[$cpt_level3]['label_value']))."', 'canhavechildren' : false, '".$children[$cpt_level3]['script']."' : 'default', 'key_value' : '".trim(addslashes($children[$cpt_level3]['key_value']))."', 'img' : 'page.gif'}"; + if(isset($children[$cpt_level3+1]['id']) && !empty($children[$cpt_level3+1]['id'])) + { + echo ','; + } + } + echo "]"; + } + } +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/show_trees.php b/maarch_entreprise/trunk/admin/architecture/show_trees.php new file mode 100644 index 0000000000000000000000000000000000000000..14a469a8a6f2fc417922ba8078fb04ac8cb2589f --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/show_trees.php @@ -0,0 +1,263 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Show the tree +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$func = new functions(); +$db = new dbquery(); +$db->connect(); +$db1 = new dbquery(); +$db1->connect(); +$db2 = new dbquery(); +$db2->connect(); +$db3 = new dbquery(); +$db3->connect(); +$db4 = new dbquery(); +$db4->connect(); +$nb_trees = count($_SESSION['doctypes_chosen_tree']); +$core_tools->load_html(); +$core_tools->load_header(); +$f_level = array(); +?> +<body> +<?php +if($nb_trees < 1) +{ + echo _NO_DEFINED_TREES; +} +else +{ + if(isset($_SESSION['doctypes_chosen_tree']) && !empty($_SESSION['doctypes_chosen_tree'])) + { + ?> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>js/prototype.js"></script> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>js/scriptaculous.js"></script> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>Tree.js"></script> + <?php + $search_customer_results = array(); + $f_level = array(); + $db1->query("select d.doctypes_first_level_id, d.doctypes_first_level_label from ".$_SESSION['tablename']['fold_foldertypes_doctypes_level1']." g, ".$_SESSION['tablename']['doctypes_first_level']." d where g.foldertype_id = '".$_SESSION['doctypes_chosen_tree']."' and g.doctypes_first_level_id = d.doctypes_first_level_id and d.enabled = 'Y' order by d.doctypes_first_level_label"); + while($res1 = $db1->fetch_object()) + { + $s_level = array(); + $db2->query("select doctypes_second_level_id, doctypes_second_level_label from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_first_level_id = ".$res1->doctypes_first_level_id." and enabled = 'Y'"); + while($res2 = $db2->fetch_object()) + { + $doctypes = array(); + $db3->query("select type_id, description from ".$_SESSION['tablename']['doctypes']." where doctypes_first_level_id = ".$res1->doctypes_first_level_id." and doctypes_second_level_id = ".$res2->doctypes_second_level_id." and enabled = 'Y' "); + while($res3 = $db3->fetch_object()) + { + $results = array(); + array_push($doctypes, array('type_id' => $res3->type_id, 'description' => $func->show_string($res3->description), "results" => $results)); + } + array_push($s_level, array('doctypes_second_level_id' => $res2->doctypes_second_level_id, 'doctypes_second_level_label' => $func->show_string($res2->doctypes_second_level_label), 'doctypes' => $doctypes)); + } + array_push($f_level, array('doctypes_first_level_id' => $res1->doctypes_first_level_id, 'doctypes_first_level_label' => $func->show_string($res1->doctypes_first_level_label), 'second_level' => $s_level)); + } + for($i=0;$i<count($_SESSION['tree_foldertypes']);$i++) + { + if($_SESSION['tree_foldertypes'][$i]['ID'] == $_SESSION['doctypes_chosen_tree']) + $fLabel = $_SESSION['tree_foldertypes'][$i]['LABEL']; + } + array_push($search_customer_results, array('folder_id' => $fLabel, 'content' => $f_level)); + ?> + <script type="text/javascript"> + function funcOpen(branch, response) { + // Ici tu peux traiter le retour et retourner true si + // tu veux insérer les enfants, false si tu veux pas + //MyClick(branch); + return true; + } + + function myClick(branch) { + //window.top.frames['view'].location.href='<?php echo $_SESSION['urltomodules']."indexing_searching/view_type_folder.php?id="; ?>'+branch.getId());; + //window.top.frames['view'].location.href='<?php echo $_SESSION['urltomodules']."indexing_searching/view_type_folder.php?id="; ?>'+branch.getId()); + //window.top.frames['view'].location.href='<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/little_details_invoices.php?id='+branch.getId(); + //alert(branch.getId()); + //branch.setText('<b>'+branch.getText()+'</b>'); + } + + function MyOpen(branch) + { + if(branch.struct.script != '' && branch.struct.script != 'default') + { + var parents = []; + parents = branch.getParents(); + var str = ''; + for(var i=0; i < (parents.length -1) ;i++) + { + str = str + '&parent_id[]=' + parents[i].getId(); + } + var str_children = ''; + var children = branch.getChildren(); + for(var i=0; i < (children.length -1) ;i++) + { + str_children = str_children + '&children_id[]=' + children[i].getId(); + } + } + return true; + } + + function MyClose(branch) + { + var parents = branch.getParents(); + var branch_id = branch.getId(); + if(current_branch_id != null) + { + var branch2 = tree.getBranchById(current_branch_id); + if(current_branch_id == branch_id ) + { + current_branch_id = branch.getNextOpenedBranch; + } + else if(branch2 && branch2.isChild(branch_id)) + { + current_branch_id = branch.getNextOpenedBranch; + } + } + branch.collapse(); + branch.openIt(false); + } + + function MyBeforeOpen(branch, opened) + { + if(opened == true) + { + MyClose(branch); + } + else + { + current_branch_id = branch.getId(); + MyOpen(branch); + return true; + } + } + + function myMouseOver (branch) + { + document.body.style.cursor='pointer'; + } + + function myMouseOut (branch) + { + document.body.style.cursor='auto'; + } + + var tree = null; + var current_branch_id = null; + + function TafelTreeInit () + { + var struct = [ + <?php + for($i=0;$i<count($search_customer_results);$i++) + { + ?> + { + 'id':'<?php echo $search_customer_results[$i]['folder_id'];?>', + 'txt':'<b><?php echo $search_customer_results[$i]['folder_id'];?></b>', + 'items':[ + <?php + for($j=0;$j<count($search_customer_results[$i]['content']);$j++) + { + ?> + { + 'id':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['doctypes_first_level_id']);?>', + 'txt':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['doctypes_first_level_label']);?>', + 'items':[ + <?php + for($k=0;$k<count($search_customer_results[$i]['content'][$j]['second_level']);$k++) + { + ?> + { + 'id':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes_second_level_id']);?>', + 'txt':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes_second_level_label']);?>', + 'items':[ + <?php + for($l=0;$l<count($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes']);$l++) + { + ?> + { + <?php + ?> + 'txt':'<span style="font-style:italic;"><small><small><?php echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['description']);?></small></small></span>', + 'img':'empty.gif' + } + <?php + if($l <> count($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes']) - 1) + echo ','; + } ?> + ] + } + <?php + if($k <> count($search_customer_results[$i]['content'][$j]['second_level']) - 1) + echo ','; + } + ?> + ] + } + <?php + if($j <> count($search_customer_results[$i]['content']) - 1) + echo ','; + } + ?> + ] + } + <?php + if ($i <> count($search_customer_results) - 1) + echo ','; + } + ?> + ]; + tree = new TafelTree('trees_div', struct, { + 'generate' : true, + 'imgBase' : '<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>imgs/', + 'defaultImg' : 'folder.gif', + //'defaultImg' : 'page.gif', + 'defaultImgOpen' : 'folderopen.gif', + 'defaultImgClose' : 'folder.gif', + 'onOpenPopulate' : [funcOpen, 'get_tree_children.php?IdTree=<?php echo $_SESSION['chosen_tree'];?>'] + }); + + //open all branches + tree.expend(); + }; + </script> + <div id="trees_div"></div> + <?php + } +} +?> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/architecture/show_trees_bak.php b/maarch_entreprise/trunk/admin/architecture/show_trees_bak.php new file mode 100644 index 0000000000000000000000000000000000000000..01ed563def4e9c366daa9f1e78e473574d675594 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/show_trees_bak.php @@ -0,0 +1,198 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Show the tree +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$func = new functions(); +$db = new dbquery(); +$db->connect(); +$nb_trees = count($_SESSION['doctypes_chosen_tree']); +$core_tools->load_html(); +$core_tools->load_header(); +?> +<body> +<?php +if($nb_trees < 1) +{ + echo _NO_DEFINED_TREES; +} +else +{ + if(isset($_SESSION['doctypes_chosen_tree']) && !empty($_SESSION['doctypes_chosen_tree'])) + { + ?> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>js/prototype.js"></script> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>js/scriptaculous.js"></script> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>Tree.js"></script> + <?php + $where = ""; + $db->query("select d.doctypes_first_level_id, d.doctypes_first_level_label from ".$_SESSION['tablename']['fold_foldertypes_doctypes_level1']." g, ".$_SESSION['tablename']['doctypes_first_level']." d where g.foldertype_id = '".$_SESSION['doctypes_chosen_tree']."' and g.doctypes_first_level_id = d.doctypes_first_level_id order by d.doctypes_first_level_label"); + $level1 = array(); + while($res = $db->fetch_object()) + { + array_push($level1, array('id' => $res->doctypes_first_level_id, 'tree' => $_SESSION['doctypes_chosen_tree'], 'key_value' => $res->doctypes_first_level_id, 'label_value' => $db->show_string($res->doctypes_first_level_label), 'script' => "")); + } + for($i=0;$i<count($_SESSION['tree_foldertypes']);$i++) + { + if($_SESSION['tree_foldertypes'][$i]['ID'] == $_SESSION['doctypes_chosen_tree']) + { + $label = "<b>".$_SESSION['tree_foldertypes'][$i]['LABEL']."</b>"; + } + } + ?> + <script type="text/javascript"> + function funcOpen (branch, response) + { + return true; + } + function MyOpen(branch) + { + if(branch.struct.script != '' && branch.struct.script != 'default') + { + var parents = []; + parents = branch.getParents(); + var str = ''; + for(var i=0; i < (parents.length -1) ;i++) + { + str = str + '&parent_id[]=' + parents[i].getId(); + } + var str_children = ''; + var children = branch.getChildren(); + for(var i=0; i < (children.length -1) ;i++) + { + str_children = str_children + '&children_id[]=' + children[i].getId(); + } + } + branch.struct.branch_level_id = GetBranchLevelId(branch); + return true; + } + + function GetBranchLevelId(branch) + { + var branchlevel = tree.getBranchById(branch); + return branchlevel.getLevel(); + } + + function MyClose(branch) + { + var parents = branch.getParents(); + var branch_id = branch.getId(); + if(current_branch_id != null) + { + var branch2 = tree.getBranchById(current_branch_id); + if(current_branch_id == branch_id ) + { + current_branch_id = branch.getNextOpenedBranch; + } + else if(branch2.isChild(branch_id)) + { + current_branch_id = branch.getNextOpenedBranch; + } + } + branch.collapse(); + branch.openIt(false); + } + + function MyBeforeOpen(branch, opened) + { + if(opened == true) + { + MyClose(branch); + } + else + { + current_branch_id = branch.getId(); + MyOpen(branch); + return true; + } + } + + var tree = null; + var current_branch_id = null; + function TafelTreeInit () { + var struct = [ + { + 'id':'<?php echo $_SESSION['doctypes_chosen_tree'];?>', + 'txt':'<?php echo $label;?>', + 'items':[ + <?php + for($cpt_level1=0; $cpt_level1 < count($level1);$cpt_level1++) + { + ?> + { + 'id':'<?php echo $level1[$cpt_level1]['id'];?>', + 'txt':'<?php echo addslashes($level1[$cpt_level1]['label_value']);?>', + 'canhavechildren' : true, + 'onbeforeopen' : MyBeforeOpen, + <?php if(isset($level1[$cpt_level1]['script']) && !empty($level1[$cpt_level1]['script'])) + {?> + 'script' : '<?php echo $level1[$cpt_level1]['script'];?>', + <?php } ?> + 'key_value' : '<?php echo addslashes($level1[$cpt_level1]['key_value']);?>', + 'branch_level_id' : '1' + } + <?php + if(isset($level1[$cpt_level1+1]['id']) && !empty($level1[$cpt_level1+1]['id'])) + { + echo ","; + } + } + ?> + ] + + } + ]; + tree = new TafelTree('trees_div', struct, { + 'generate' : true, + 'imgBase' : '<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>imgs/', + //'defaultImg' : 'page.gif', + 'defaultImg' : 'folder.gif', + 'defaultImgOpen' : 'folderopen.gif', + 'defaultImgClose' : 'folder.gif', + 'onOpenPopulate' : [funcOpen, 'get_tree_children.php?IdTree=<?php echo $_SESSION['doctypes_chosen_tree'];?>'] + }); + } + </script> + <div id="trees_div"></div> + <?php + } + else + { + //echo "<div align='left'> "._CHOOSE_FOLDERTYPE."</div>"; + } +} +?> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/architecture/structures/choose_foldertypes.php b/maarch_entreprise/trunk/admin/architecture/structures/choose_foldertypes.php new file mode 100644 index 0000000000000000000000000000000000000000..477a6d41f264aac86db49eda554b3ff84fe1f1ad --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/structures/choose_foldertypes.php @@ -0,0 +1,158 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); + $core_tools->load_html(); +//here we building the header +$core_tools->load_header( ); + +if($_SESSION['m_admin']['mode'] == "up" && $_SESSION['m_admin']['init'] == true) +{ + $_SESSION['m_admin']['chosen_foldertypes'] = array(); + $_SESSION['m_admin']['chosen_foldertypes'] = $_SESSION['m_admin']['loaded_foldertypes']; + $_SESSION['m_admin']['init'] = false; +} +elseif($_SESSION['m_admin']['mode'] == "add") +{ + + $_SESSION['m_admin']['chosen_foldertypes'] = array(); + +} + +if(isset($_REQUEST['foldertypes']) && count($_REQUEST['foldertypes']) > 0) +{ + for($i=0; $i < count($_REQUEST['foldertypes']); $i++) + { + if(!in_array(trim($_REQUEST['foldertypes'][$i]), $_SESSION['m_admin']['chosen_foldertypes'])) + { + array_push($_SESSION['m_admin']['chosen_foldertypes'], trim($_REQUEST['foldertypes'][$i])); + } + } + $_SESSION['m_admin']['loaded_foldertypes'] = $_SESSION['m_admin']['chosen_foldertypes']; +} +else if(isset($_REQUEST['foldertypeslist']) && count($_REQUEST['foldertypeslist']) > 0) +{ + + for($i=0; $i < count($_SESSION['m_admin']['chosen_foldertypes']); $i++) + { + + for($j=0; $j < count($_REQUEST['foldertypeslist']); $j++) + { + if(trim($_REQUEST['foldertypeslist'][$j]) == trim($_SESSION['m_admin']['chosen_foldertypes'][$i])) + { + unset($_SESSION['m_admin']['chosen_foldertypes'][$i]); + } + } + } + $_SESSION['m_admin']['chosen_foldertypes'] = array_values($_SESSION['m_admin']['chosen_foldertypes']); + $_SESSION['m_admin']['loaded_foldertypes'] = $_SESSION['m_admin']['chosen_foldertypes']; +} +elseif(isset($_REQUEST['foldertypes']) && count($_REQUEST['foldertypes']) <= 0) +{ + + $_SESSION['m_admin']['chosen_foldertypes'] = array(); + $_SESSION['m_admin']['loaded_foldertypes'] = $_SESSION['m_admin']['chosen_foldertypes']; +} +?> +<body> +<form name="choose_foldertypes" id="choose_foldertypes" method="post" action="choose_foldertypes.php"> + <table align="left" border="0" width="100%"> + <tr> + <td valign="top" width="48%"><b class="tit"><?php echo _FOLDERTYPES_LIST;?></b></td> + <td width="5%" > </td> + <td valign="top" width="47%"><b class="tit"><?php echo _SELECTED_FOLDERTYPES;?></b></td> + </tr> + + <tr> + <td width="45%" align="center" valign="top"> + <select name="foldertypeslist[]" class="multiple_list" ondblclick='moveclick(document.choose_foldertypes.elements["foldertypeslist[]"],document.choose_foldertypes.elements["foldertypes[]"]);this.form.submit();' multiple="multiple"> + <?php + for($i=0;$i<count($_SESSION['m_admin']['foldertypes']);$i++) + { + $state_foldertypes = false; + + for($j=0;$j<count($_SESSION['m_admin']['chosen_foldertypes']);$j++) + { + if(trim($_SESSION['m_admin']['foldertypes'][$i]['id']) == trim($_SESSION['m_admin']['chosen_foldertypes'][$j])) + { + $state_foldertypes = true; + } + } + + if($state_foldertypes == false) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['foldertypes'][$i]['id']; ?>" alt="<?php echo $_SESSION['m_admin']['foldertypes'][$i]['label']; ?>" title="<?php echo $_SESSION['m_admin']['foldertypes'][$i]['label']; ?>"><?php echo $_SESSION['m_admin']['foldertypes'][$i]['label']; ?></option> + <?php + } + } + ?> + </select> + <br/><br/> + <a href='javascript:selectall(document.forms["choose_foldertypes"].elements["foldertypeslist[]"]);' class="choice"><?php echo _SELECT_ALL; ?></a></td> + <td width="10%" align="center"> + <input type="button" class="button" value="<?php echo _ADD; ?>" onclick='Move(document.choose_foldertypes.elements["foldertypeslist[]"],document.choose_foldertypes.elements["foldertypes[]"]);this.form.submit();' align="middle"/> + <br /> + <br /> + <input type="button" class="button" value="<?php echo _REMOVE; ?>" onclick='Move(document.choose_foldertypes.elements["foldertypes[]"],document.choose_foldertypes.elements["foldertypeslist[]"]);this.form.submit();' align="middle"/> + </td> + <td width="45%" align="center" valign="top"> + <select name="foldertypes[]" class="multiple_list" ondblclick='moveclick(document.choose_foldertypes.elements["foldertypes[]"],document.choose_foldertypes.elements["foldertypeslist"])this.form.submit();' multiple="multiple" > + <?php + for($i=0;$i<count($_SESSION['m_admin']['foldertypes']);$i++) + { + $state_foldertypes = false; + + for($j=0;$j<count($_SESSION['m_admin']['chosen_foldertypes']);$j++) + { + if(trim($_SESSION['m_admin']['foldertypes'][$i]['id']) == trim($_SESSION['m_admin']['chosen_foldertypes'][$j])) + { + $state_foldertypes = true; + } + } + + + if($state_foldertypes == true) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['foldertypes'][$i]['id']; ?>" ><?php echo $_SESSION['m_admin']['foldertypes'][$i]['label']; ?></option> + <?php + } + } + ?> + </select> + <br/><br/> + <a href='javascript:selectall(document.forms["choose_foldertypes"].elements["foldertypes[]"]);' class="choice"> + <?php echo _SELECT_ALL; ?></a></td> + </tr> + <tr> <td height="10"> </td></tr> + </table> + </form> + +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/architecture/structures/structure_del.php b/maarch_entreprise/trunk/admin/architecture/structures/structure_del.php new file mode 100644 index 0000000000000000000000000000000000000000..85f27aeef39fd6d68e93f73b1fce11ac84264cf0 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/structures/structure_del.php @@ -0,0 +1,101 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Delete a structure +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + require_once($_SESSION['pathtocoreclass']."class_functions.php"); + +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools('admin_architecture'); +$core_tools->test_admin('admin_architecture', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); + + +$db = new dbquery(); + +if(isset($_GET['id'])) +{ + $id = addslashes($db->wash($_GET['id'], "no", _THE_STRUCTURE)); +} +else +{ + $id = ""; +} + +$db->connect(); + +$db->query("select doctypes_first_level_label from ".$_SESSION['tablename']['doctypes_first_level']." where doctypes_first_level_id = ".$id.""); + +if($db->nb_result() == 0) +{ + $_SESSION['error'] = _STRUCTURE.' '._UNKNOWN."."; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=structures"); + exit(); +} +else +{ + $info = $db->fetch_object(); + + // delete structure + $db->query("update ".$_SESSION['tablename']['doctypes_first_level']." set enabled = 'N' where doctypes_first_level_id = ".$id); + + //delete subfolders depending on that structure + $db->query("update ".$_SESSION['tablename']['doctypes_second_level']." set enabled = 'N' where doctypes_first_level_id = ".$id); + + $db->query("delete from ".$_SESSION['tablename']['fold_foldertypes_doctypes_level1']." where doctypes_first_level_id = ".$id); + + $db->query("select type_id from ".$_SESSION['tablename']['doctypes']." where doctypes_first_level_id = ".$id); + + $db2 = new dbquery(); + $db2->connect(); + while($res = $db->fetch_object()) + { + //delete the doctypes from the foldertypes_doctypes table + $db2->query("delete from ".$_SESSION['tablename']['fold_foldertypes_doctypes']." where doctype_id = ".$res->type_id); + } + // delete the doctypes + $db2->query("update ".$_SESSION['tablename']['doctypes']." set enabled = 'N' where doctypes_first_level_id = ".$id); + + if($_SESSION['history']['structuredel'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['doctypes_first_level'], $id,"DEL",_STRUCTURE_DEL." ".strtolower(_NUM).$id."", $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _DELETED_STRUCTURE."."; + unset($_SESSION['m_admin']); + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=structures"); + exit(); +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/structures/structure_up.php b/maarch_entreprise/trunk/admin/architecture/structures/structure_up.php new file mode 100644 index 0000000000000000000000000000000000000000..ad63712a37cc5204d53349dc5d6b758c86b6a9e5 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/structures/structure_up.php @@ -0,0 +1,296 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Modify a structure +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_admin('admin_architecture', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); + +$db = new dbquery(); +$db->connect(); +$desc = ""; +$id = ""; +$arr_ft = array(); +if(isset($_GET['id']) && !empty($_GET['id'])) +{ + $id = $_GET['id']; + $db->query("select doctypes_first_level_label from ".$_SESSION['tablename']['doctypes_first_level']." where doctypes_first_level_id = ".$id); + + $res = $db->fetch_object(); + $desc = $db->show_string($res->doctypes_first_level_label); + + $db->query('select ffdl.foldertype_id, f.foldertype_label from '.$_SESSION['tablename']['fold_foldertypes_doctypes_level1']." ffdl, ".$_SESSION['tablename']['fold_foldertypes']." f where ffdl.doctypes_first_level_id = ".$id." and ffdl.foldertype_id = f.foldertype_id"); + + //$_SESSION['m_admin']['loaded_foldertypes']= array(); + while($res = $db->fetch_object()) + { + //array_push($_SESSION['m_admin']['loaded_foldertypes'], $res->foldertype_id); + array_push($arr_ft , $res->foldertype_id); + } +} + + +$mode = ""; +if(isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) +{ + $mode = $_REQUEST['mode']; + $_SESSION['m_admin']['mode'] = $mode; + + +} + + +$erreur = ""; +if( isset($_REQUEST['valid'])) +{ + + if(isset($_REQUEST['desc_structure']) && !empty($_REQUEST['desc_structure'])) + { + $desc = $db->protect_string_db($_REQUEST['desc_structure']); + + } + else + { + $erreur .= _DESC_STRUCTURE_MISSING.".<br/>"; + } +/* if(isset($_REQUEST['foldertype']) && !empty($_REQUEST['foldertype'])) + { + $foldertype_id = $_REQUEST['foldertype']; + + }*/ + if(!isset($_REQUEST['foldertypes']) || count($_REQUEST['foldertypes']) == 0) + //if(!isset($_SESSION['m_admin']['chosen_foldertypes']) && count($_SESSION['m_admin']['chosen_foldertypes']) < 1) + { + $erreur .= _FOLDERTYPE_MISSING.".<br/>"; + } + + if(empty($erreur)) + { + $db->query("select * from ".$_SESSION['tablename']['doctypes_first_level']." where doctypes_first_level_label = '".$desc."' and enabled = 'Y'"); + + if($db->nb_result() > 0 && $mode <> 'up') + { + $erreur .= _THE_STRUCTURE.' '._ALREADY_EXISTS."."; + } + else + { + if($mode == "up") + { + + if( isset($_REQUEST['ID_structure']) && !empty($_REQUEST['ID_structure'])) + { + $id = $_REQUEST['ID_structure']; + $db->query("UPDATE ".$_SESSION['tablename']['doctypes_first_level']." set doctypes_first_level_label = '".$desc."' WHERE doctypes_first_level_id = ".$id.""); + + $db->query("delete from ".$_SESSION['tablename']['fold_foldertypes_doctypes_level1']." where doctypes_first_level_id = ".$id.""); + + for($i=0; $i < count($_REQUEST['foldertypes']);$i++) + { + $db->query("insert into ".$_SESSION['tablename']['fold_foldertypes_doctypes_level1']." values (".$_REQUEST['foldertypes'][$i].", ".$id.")"); + } + if($_SESSION['history']['structureup'] == "true") + { + require($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($_SESSION['tablename']['doctypes_first_level'], $id,"UP",_STRUCTURE_MODIF." ".strtolower(_NUM).$id." (".$info.")", $_SESSION['config']['databasetype']); + } + $_SESSION['error'] .= _STRUCTURE_MODIF." : ".$id."<br/>"; + } + else + { + $erreur .= _ID_STRUCTURE_PB."."; + } + } + + else + { + $desc = $_REQUEST['desc_structure']; + $db->query("INSERT INTO ".$_SESSION['tablename']['doctypes_first_level']." ( doctypes_first_level_label) VALUES ( '".$desc."')"); + $db->query("select doctypes_first_level_id from ".$_SESSION['tablename']['doctypes_first_level']." where doctypes_first_level_label = '".$desc."'"); + $res = $db->fetch_object(); + $id = $res->doctypes_first_level_id; + + for($i=0; $i < count($_REQUEST['foldertypes']);$i++) + { + $db->query("insert into ".$_SESSION['tablename']['fold_foldertypes_doctypes_level1']." values (".$_REQUEST['foldertypes'][$i].", ".$id.")"); + } + if($_SESSION['history']['structureadd'] == "true") + { + require($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($_SESSION['tablename']['doctypes_first_level'], $id,"ADD",_NEW_STRUCTURE_ADDED." (".$desc.")", $_SESSION['config']['databasetype']); + + } + $_SESSION['error'] .= _NEW_STRUCTURE." : ".$desc."<br/>"; + } + } + } + if(empty($erreur)) + { + unset($_SESSION['m_admin']); + ?> + <script language="javascript">window.opener.location.reload();self.close();</script> + <?php + } +} + +$core_tools->load_html(); + +if($mode == "up") +{ + $title = _STRUCTURE_MODIF; +} + else +{ + $title = _NEW_STRUCTURE_ADDED; +} +$core_tools->load_header($title); +$time = $core_tools->get_session_time_expire(); +?> +<body onLoad="setTimeout(window.close, <?php echo $time;?>*60*1000);window.resizeTo(600, 700);"> +<br/> + +<div class="error"> +<?php echo $erreur; + $erreur = ""; +?> +</div> +<h2 class="tit"> + <img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/manage_structures_b.gif" alt="" valign="center"/> <?php if($mode == "up"){ echo _STRUCTURE_MODIF;} else{ echo _NEW_STRUCTURE_ADDED;}?></h2> +<div class="block"> +<br/> + +<br/> +<form method="post" name="frmstructure" id="frmstructure" class="forms"> + + <?php if ($mode == "up") + { ?> + <p> + <label><?php echo _ID.' '._STRUCTURE;?> :</label> + <input type="text" class="readonly" name="ID_structure" value="<?php echo $id; ?>" readonly="readonly" /> + </p> + <p> </p> + <?php } ?> + + <p> + <label><?php echo _DESC.' '._STRUCTURE;?></label> + <input type="text" name="desc_structure" value="<?php echo $desc; ?>" /> + </p> + + <p> + <!--<iframe name="choose_foldertypes" id="choose_foldertypes" src="choose_foldertypes.php" frameborder="0" width="100%" scrolling="auto" height="360"></iframe>--> + <table align="left" border="0" width="100%"> + <tr> + <td valign="top" width="48%"><b class="tit"><?php echo _FOLDERTYPES_LIST;?></b></td> + <td width="5%" > </td> + <td valign="top" width="47%"><b class="tit"><?php echo _SELECTED_FOLDERTYPES;?></b></td> + </tr> + + <tr> + <td width="45%" align="center" valign="top"> + <select name="foldertypeslist[]" id="foldertypeslist" class="multiple_list" ondblclick="moveclick($('foldertypeslist'),$('foldertypes'));" multiple="multiple"> + <?php + for($i=0;$i<count($_SESSION['m_admin']['foldertypes']);$i++) + { + $state_foldertypes = false; + + for($j=0;$j<count($arr_ft);$j++) + { + if(trim($_SESSION['m_admin']['foldertypes'][$i]['id']) == trim($arr_ft[$j])) + { + $state_foldertypes = true; + } + } + + if($state_foldertypes == false) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['foldertypes'][$i]['id']; ?>" alt="<?php echo $_SESSION['m_admin']['foldertypes'][$i]['label']; ?>" title="<?php echo $_SESSION['m_admin']['foldertypes'][$i]['label']; ?>"><?php echo $_SESSION['m_admin']['foldertypes'][$i]['label']; ?></option> + <?php + } + } + ?> + </select> + <br/><br/> + <a href="javascript:selectall($('foldertypeslist'));" class="choice"><?php echo _SELECT_ALL; ?></a></td> + <td width="10%" align="center"> + <input type="button" class="button" value="<?php echo _ADD; ?>" onclick="Move($('foldertypeslist'),$('foldertypes'));" align="middle"/> + <br /> + <br /> + <input type="button" class="button" value="<?php echo _REMOVE; ?>" onclick="Move($('foldertypes'),$('foldertypeslist'));" align="middle"/> + </td> + <td width="45%" align="center" valign="top"> + <select name="foldertypes[]" id="foldertypes" class="multiple_list" ondblclick="moveclick($('foldertypes'),$('foldertypeslist'));" multiple="multiple" > + <?php + for($i=0;$i<count($_SESSION['m_admin']['foldertypes']);$i++) + { + $state_foldertypes = false; + + for($j=0;$j<count($arr_ft);$j++) + { + if(trim($_SESSION['m_admin']['foldertypes'][$i]['id']) == trim($arr_ft[$j])) + { + $state_foldertypes = true; + } + } + + if($state_foldertypes == true) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['foldertypes'][$i]['id']; ?>" ><?php echo $_SESSION['m_admin']['foldertypes'][$i]['label']; ?></option> + <?php + } + } + ?> + </select> + <br/><br/> + <a href="javascript:selectall($('foldertypes'));" class="choice"> + <?php echo _SELECT_ALL; ?></a></td> + </tr> + <tr> <td height="10"> </td></tr> + </table> + </p> +<p class="buttons"> + <input type="submit" name="valid" class="button" value="<?php echo _VALIDATE;?>" onclick="selectall($('foldertypes'));"/> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL;?>" onClick="self.close();" /> +<br/><br/> +<input type="hidden" name="mode" value="<?php echo $mode;?>"/> +</form> +</div> +<div class="block_end"> </div> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/architecture/structures/structures.php b/maarch_entreprise/trunk/admin/architecture/structures/structures.php new file mode 100644 index 0000000000000000000000000000000000000000..0c3114040d5cdd7985d0f8434c53a77ac7633b09 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/structures/structures.php @@ -0,0 +1,150 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Structures list +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_architecture', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=structures'; +$page_label = _STRUCTURE_LIST; +$page_id = "structures"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +unset($_SESSION['m_admin']); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$func = new functions(); +$select[$_SESSION['tablename']['doctypes_first_level']] = array(); +array_push($select[$_SESSION['tablename']['doctypes_first_level']],"doctypes_first_level_id","doctypes_first_level_label"); +$what = ""; +$where= " enabled = 'Y' "; +if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where .= " and (doctypes_first_level_label ilike '".strtolower($what)."%' or doctypes_first_level_label ilike '".strtoupper($what)."%') "; + } + else + { + $where .= " and (doctypes_first_level_label like '".strtolower($what)."%' or doctypes_first_level_label like '".strtoupper($what)."%') "; + + } +} + +$list = new list_show(); +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'doctypes_first_level_label'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request= new request; +$tab=$request->select($select,$where,$orderstr,$_SESSION['config']['databasetype']); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="doctypes_first_level_id") + { + $tab[$i][$j]["doctypes_first_level_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='doctypes_first_level_id'; + } + if($tab[$i][$j][$value]=="doctypes_first_level_label") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["doctypes_first_level_label"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_DESC; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='doctypes_first_level_label'; + } + } + } +} +$page_name = "structures"; +$page_name_up = "structure_up"; +$page_name_add = "structure_up"; +$page_name_del = "structure_del"; +$page_name_val = ""; +$table_name = $_SESSION['tablename']['doctypes_first_level']; +$page_name_ban = ""; +$label_add = _NEW_STRUCTURE_ADDED; +$_SESSION['m_admin']['init'] = true; +$_SESSION['m_admin']['sous_dossiers'] = array(); + +$request->query("select * from ".$_SESSION['tablename']['doctypes_second_level']." where enabled = 'Y'"); +while($res = $request->fetch_object()) +{ + array_push($_SESSION['m_admin']['sous_dossiers'], array("ID" => $res->doctypes_second_level_id, "LABEL" => $request->show_string($res->doctypes_second_level_label))); +} +$db = new dbquery(); +$db->connect(); + +$_SESSION['m_admin']['foldertypes'] = array(); +$db->query("select foldertype_id, foldertype_label from ".$_SESSION['tablename']['fold_foldertypes']); +while($res = $db->fetch_object()) +{ + array_push($_SESSION['m_admin']['foldertypes'], array('id' => $res->foldertype_id, 'label' => $db->show_string($res->foldertype_label))); +} + +$autoCompletionArray = array(); +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."admin/architecture/structures/structures_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; +$list->admin_list($tab, $i, _STRUCTURE_LIST.' : '.$i." "._STRUCTURES, 'doctypes_first_level_id"','structures','structures','doctypes_first_level_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, FALSE, TRUE,_ALL_STRUCTURES, _STRUCTURE, $_SESSION['config']['img'].'/manage_structures_b.gif',false, true, true, true, "", true, $autoCompletionArray); +?> diff --git a/maarch_entreprise/trunk/admin/architecture/structures/structures_list_by_name.php b/maarch_entreprise/trunk/admin/architecture/structures/structures_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..ed583580e157d2a7d1b7ddf7da68ad85bb820d94 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/structures/structures_list_by_name.php @@ -0,0 +1,72 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of structures for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select doctypes_first_level_label as tag from ".$_SESSION['tablename']['doctypes_first_level']." where doctypes_first_level_label ilike '".$_REQUEST['what']."%' order by doctypes_first_level_label"); +} +else +{ + $db->query("select doctypes_first_level_label as tag from ".$_SESSION['tablename']['doctypes_first_level']." where doctypes_first_level_label like '".$_REQUEST['what']."%' order by doctypes_first_level_label"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; + +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/subfolders/subfolder_del.php b/maarch_entreprise/trunk/admin/architecture/subfolders/subfolder_del.php new file mode 100644 index 0000000000000000000000000000000000000000..1ab8b6c092a0ab38a51b88a76afab86225f09690 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/subfolders/subfolder_del.php @@ -0,0 +1,75 @@ +<?php +/** +* File : sous_dossier_del.php +* +* Delete a subfolder +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 06/2006x +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); + +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_admin('admin_architecture', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); + +$db = new dbquery(); + +if(isset($_GET['id'])) +{ + $id = addslashes($db->wash($_GET['id'], "no", _THE_SUBFOLDER)); +} +else +{ + $id = ""; +} + +$db->connect(); + +$db->query("select doctypes_second_level_label from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_second_level_id = ".$id.""); + +if($db->nb_result() == 0) +{ + $_SESSION['error'] = _SUBFOLDER.' '._UNKNOWN."."; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=subfolders"); + exit(); +} +else +{ + $info = $db->fetch_object(); + + $db->query("update ".$_SESSION['tablename']['doctypes_second_level']." set enabled = 'N' where doctypes_second_level_id = ".$id); + + $db->query("select type_id from ".$_SESSION['tablename']['doctypes']." where doctypes_second_level_id = ".$id); + $db2 = new dbquery(); + $db2->connect(); + while($res = $db->fetch_object()) + { + //delete the doctypes from the foldertypes_doctypes table + $db2->query("delete from ".$_SESSION['tablename']['fold_foldertypes_doctypes']." where doctype_id = ".$res->type_id); + } + // delete the doctypes + $db2->query("update ".$_SESSION['tablename']['doctypes']." set enabled = 'N' where doctypes_second_level_id = ".$id); + + if($_SESSION['history']['subfolderdel'] == "true") + { + require($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['doctypes_second_level'], $id,"DEL",_DEL_SUBFOLDER." ".strtolower(_NUM).$id."", $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _SUBFOLDER_DELETED."."; + unset($_SESSION['m_admin']); + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=subfolders"); + exit(); +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/subfolders/subfolder_up.php b/maarch_entreprise/trunk/admin/architecture/subfolders/subfolder_up.php new file mode 100644 index 0000000000000000000000000000000000000000..38829a2cd9b4825a189fb75957e03555f36e70fb --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/subfolders/subfolder_up.php @@ -0,0 +1,202 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Modify a subfolder +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_admin('admin_architecture', 'apps'); +$core_tools->load_lang(); + +$db = new dbquery(); +$db->connect(); +$desc = ""; +$id = ""; +$id_structure = ""; + +if(isset($_GET['id']) && !empty($_GET['id'])) +{ + $id = $_GET['id']; + $db->query("select doctypes_second_level_label, doctypes_first_level_id from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_second_level_id = ".$id); + + $res = $db->fetch_object(); + $desc = $db->show_string($res->doctypes_second_level_label); + $id_structure = $res->doctypes_first_level_id; +} + +$mode = ""; +if(isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) +{ + $mode = $_REQUEST['mode']; +} +$erreur = ""; +if( isset($_REQUEST['valid'])) +{ + + if(isset($_REQUEST['desc_sd']) && !empty($_REQUEST['desc_sd'])) + { + + $desc = $db->protect_string_db($_REQUEST['desc_sd']); + + $db->query("select * from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_second_level_label = '".$desc."' and enabled = 'Y'"); + //$db->show(); + if($db->nb_result() > 1) + { + $erreur .= _THE_SUBFOLDER." "._ALREADY_EXISTS."."; + } + else + { + if(isset($_REQUEST['structure']) && !empty($_REQUEST['structure'])) + { + $structure = $_REQUEST['structure']; + if($mode == "up") + { + + if( isset($_REQUEST['ID_sd']) && !empty($_REQUEST['ID_sd'])) + { + $id = $db->protect_string_db($_REQUEST['ID_sd']); + $db->query("UPDATE ".$_SESSION['tablename']['doctypes_second_level']." set doctypes_second_level_label = '".$desc."', doctypes_first_level_id = ".$structure." where doctypes_second_level_id = ".$id.""); + if($_SESSION['history']['subfolderup'] == "true") + { + + require($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($_SESSION['tablename']['doctypes_second_level'], $id,"UP",_SUBFOLDER_MODIF." ".strtolower(_NUM).$id." (".$info.")", $_SESSION['config']['databasetype']); + } + $_SESSION['error'] .= _SUBFOLDER_MODIF." : ".$id."<br/>"; + } + else + { + $erreur .= _SUBFOLDER_ID_PB."."; + } + } + + else + { + $desc = $db->protect_string_db($_REQUEST['desc_sd']); + $db->query("INSERT INTO ".$_SESSION['tablename']['doctypes_second_level']." ( doctypes_second_level_label, doctypes_first_level_id) VALUES ( '".$desc."', ".$structure.")"); + $db->query("select doctypes_first_level_id from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_second_level_label = '".$desc."' and doctypes_first_level_id= ".$structure); + $res = $db->fetch_object(); + if($_SESSION['history']['subfolderadd'] == "true") + { + require($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($_SESSION['tablename']['doctypes_second_level'], $res->doctypes_first_level_id,"ADD",_SUBFOLDER_ADDED." (".$desc.")", $_SESSION['config']['databasetype']); + } + + $_SESSION['error'] .= _NEW_SUBFOLDER." : ".$desc."<br/>"; + } + + if(empty($erreur)) + { + unset($_SESSION['m_admin']); + ?> + <script language="javascript">window.opener.location.reload();self.close();</script> + <?php + } + } + else + { + $erreur .= _STRUCTURE_MANDATORY.'.<br/>'; + } + } + } + else + { + $erreur .= _SUBFOLDER_DESC_MISSING.".<br/>"; + } +} + +$core_tools->load_html(); + +if($mode == "up") +{ + $title = _SUBFOLDER_MODIF; +} + else +{ + $title = _SUBFOLDER_CREATION; +} +$core_tools->load_header($title); +$time = $core_tools->get_session_time_expire(); +?> +<body onLoad="setTimeout(window.close, <?php echo $time;?>*60*1000);"> + +<div class="error"> +<?php echo $erreur; + $erreur = ""; +?> +</div> +<h2 class="tit"> <img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/manage_structures_b.gif" alt="" valign="center"/> <?php if($mode == "up"){ echo _SUBFOLDER_MODIF;} else{ echo _SUBFOLDER_CREATION;}?></h2> +<div class="block"> +<br/> +<form method="post" name="modif" id="modif" class="forms"> + + <?php if ($mode == "up") + { ?> + <p> + <label><?php echo _ID.' '._SUBFOLDER;?> </label> + <input type="text" name="ID_sd" value="<?php echo $id; ?>" readonly="readonly" class="readonly" /> + </p> + <p> </p> + <?php } ?> + <p> + <label><?php echo _DESC.' '._SUBFOLDER;?></label> + <input type="text" name="desc_sd" value="<?php echo $desc; ?>" /> </td> + </p> + <p> </p> + <p> + <label><?php echo _ATTACH_STRUCTURE;?> :</label> + + <select name="structure" > + <option value=""><?php echo _CHOOSE_STRUCTURE;?></option> + <?php for($i=0; $i < count($_SESSION['m_admin']['structures']); $i++) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['structures'][$i]['ID'];?>" <?php if ($id_structure == $_SESSION['m_admin']['structures'][$i]['ID']){ echo 'selected="selected"'; }?>><?php echo $_SESSION['m_admin']['structures'][$i]['LABEL'];?></option> + <?php + } + ?> + </select> + </p> + <p class="buttons"> + <input type="submit" class="button" name="valid" value="<?php echo _VALIDATE;?>" /> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL;?>" onClick="self.close();" /> + </p> +<input type="hidden" name="mode" value="<?php echo $mode;?>"/> +</form> +</div> +<div class="block_end"> </div> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/architecture/subfolders/subfolders.php b/maarch_entreprise/trunk/admin/architecture/subfolders/subfolders.php new file mode 100644 index 0000000000000000000000000000000000000000..76c96e8a3726b26cf8e65a94e6b849a9ec0172a4 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/subfolders/subfolders.php @@ -0,0 +1,121 @@ +<?php +/** +* File : sous_dossiers.php +* +* Subfolders list +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 06/2006x +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +$admin = new core_tools(); +$admin->test_admin('admin_architecture', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=subfolders'; +$page_label = _SUBFOLDER_LIST; +$page_id = "subfolders"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$func = new functions(); +$select[$_SESSION['tablename']['doctypes_second_level']] = array(); +array_push($select[$_SESSION['tablename']['doctypes_second_level']],"doctypes_second_level_id","doctypes_second_level_label"); +$what = ""; +$where= " enabled = 'Y' "; +if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where .= " and (doctypes_second_level_label ilike '".strtolower($what)."%' or doctypes_second_level_label ilike '".strtoupper($what)."%') "; + } + else + { + $where .= " and (doctypes_second_level_label like '".strtolower($what)."%' or doctypes_second_level_label like '".strtoupper($what)."%') "; + } +} +$list = new list_show(); +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'doctypes_second_level_label'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request= new request; +$tab=$request->select($select,$where,$orderstr ,$_SESSION['config']['databasetype']); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + + if($tab[$i][$j][$value]=="doctypes_second_level_id") + { + $tab[$i][$j]["doctypes_second_level_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_ID; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='doctypes_second_level_id'; + } + if($tab[$i][$j][$value]=="doctypes_second_level_label") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["doctypes_second_level_label"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_DESC; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='doctypes_second_level_label'; + } + } + } +} +$page_name = "subfolders"; +$page_name_up = "subfolder_up"; +$page_name_add = "subfolder_up"; +$page_name_del = "subfolder_del"; +$page_name_val = ""; +$table_name = $_SESSION['tablename']['doctypes_second_level']; +$page_name_ban = ""; +$label_add = _ADD_SUBFOLDER; +$_SESSION['m_admin']['structures'] = array(); +$request->query("select * from ".$_SESSION['tablename']['doctypes_first_level']." where enabled = 'Y'"); +while($res = $request->fetch_object()) +{ + array_push($_SESSION['m_admin']['structures'], array('ID' => $res->doctypes_first_level_id, 'LABEL'=> $request->show_string($res->doctypes_first_level_label))); +} +$autoCompletionArray = array(); +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."admin/architecture/subfolders/subfolders_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; + +//$list->listletters('sous_dossiers','Tous les sous-dossiers',$_SESSION['lang']['txt_searching']." sous-dossier ",$_SESSION['lang']['txt_alphabetical_list']); +$list->admin_list($tab, $i, _SUBFOLDER_LIST.' : '.$i." ".strtolower(_SUBFOLDERS), 'doctypes_second_level_id','subfolders','subfolders','doctypes_second_level_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, FALSE, TRUE, _ALL_SUBFOLDERS, _SUBFOLDER, $_SESSION['config']['img'].'/gerer_sous-dossiers_b.gif', false, true, true, true, "", true, $autoCompletionArray); +?> diff --git a/maarch_entreprise/trunk/admin/architecture/subfolders/subfolders_list_by_name.php b/maarch_entreprise/trunk/admin/architecture/subfolders/subfolders_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..3ba16a80b0deb90097893f6344c435b5680ffd7a --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/subfolders/subfolders_list_by_name.php @@ -0,0 +1,55 @@ +<?php +/** +* File : subfolders_list_by_name.php +* +* List of subfolders for autocompletion +* +* @package Maarch Framework 3.0 +* @version 3 +* @since 10/2005 +* @license GPL +* @author Laurent Giovannoni <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +//$_REQUEST['what'] = "P"; +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select doctypes_second_level_label as tag from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_second_level_label ilike '".$_REQUEST['what']."%' order by doctypes_second_level_label"); +} +else +{ + $db->query("select doctypes_second_level_label as tag from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_second_level_label like '".$_REQUEST['what']."%' order by doctypes_second_level_label"); +} +//$db->show(); +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; +//echo "<li>test</li>\n"; +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/types/choose_coll.php b/maarch_entreprise/trunk/admin/architecture/types/choose_coll.php new file mode 100644 index 0000000000000000000000000000000000000000..171cec36120a9db4dad27564805a71d90b2dd3b2 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/choose_coll.php @@ -0,0 +1,80 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to choose a collection (used in doctypes administration) +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); + +$core_tools->load_html(); +$core_tools->load_header(); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +$sec = new security(); +$array_coll = $sec->retrieve_insert_collections(); + +if(isset($_REQUEST['collection']) && !empty($_REQUEST['collection']) ) +{ + for($i=0; $i<count($_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']]);$i++) + { + $_SESSION['m_admin']['doctypes'][$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] = '0000000000'; + } + + + $_SESSION['m_admin']['doctypes']['COLL_ID'] = $_REQUEST['collection']; + ?> + <script language="javascript" type="text/javascript">window.top.frames['choose_index'].location.href='<?php echo $_SESSION['config']['businessappurl'].'admin/architecture/types/choose_index.php';?>';</script> + <?php +} +?> +<body id="iframe"> +<form name="choose_coll" method="get" action="choose_coll.php" class="forms" > + <p> + <label for="coll_id"><?php echo _COLLECTION;?> : </label> + <select name="collection" onChange="this.form.submit();"> + <option value="" ><?php echo _CHOOSE_COLLECTION;?></option> + <?php for($i=0; $i<count($array_coll);$i++) + { + ?> + <option value="<?php echo $array_coll[$i]['id'];?>" <?php if($_SESSION['m_admin']['doctypes']['COLL_ID'] == $array_coll[$i]['id']){ echo 'selected="selected"';}?> ><?php echo $array_coll[$i]['label'];?></option> + <?php + } + ?> + </select> + </p> +</form> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/types/choose_index.php b/maarch_entreprise/trunk/admin/architecture/types/choose_index.php new file mode 100644 index 0000000000000000000000000000000000000000..1d2288b698fc1853ffdfe0b3caee0d2619743110 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/choose_index.php @@ -0,0 +1,183 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to choose the index for a doctype (used in doctypes administration) +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); + +$core_tools->load_html(); +$core_tools->load_header(); + +if(isset($_REQUEST['valid']) && isset($_SESSION['m_admin']['doctypes']['COLL_ID']) && !empty($_SESSION['m_admin']['doctypes']['COLL_ID'])) +{ + //$coll_id = $_SESSION['m_admin']['doctypes']['COLL_ID']; + for($i=0;$i<count($_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']]);$i++) + { + + if($_REQUEST["field_".$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] == "Y") + { + if($_REQUEST["mandatory_".$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] == "Y") + { + $_SESSION['m_admin']['doctypes'][$_SESSION['index'][$i]['COLUMN']] = "1100000000"; + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN'].", "; + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] .= "'1100000000', "; + $_SESSION['m_admin']['doctypes']['custom_query_update'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']." = "."'1100000000', "; + } + else + { + $_SESSION['m_admin']['doctypes'][$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] = "1000000000"; + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN'].", "; + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] .= "'1000000000', "; + $_SESSION['m_admin']['doctypes']['custom_query_update'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']." = "."'1000000000', "; + } + } + elseif($_REQUEST["field_".$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] == "") + { + $_SESSION['m_admin']['doctypes'][$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] = "0000000000"; + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN'].", "; + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] .= "'0000000000', "; + $_SESSION['m_admin']['doctypes']['custom_query_update'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']." = '0000000000', "; + } + } + + if(trim($_SESSION['m_admin']['doctypes']['custom_query_insert_colums']) <> "") + { + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] = ", ".$_SESSION['m_admin']['doctypes']['custom_query_insert_colums']; + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] = substr($_SESSION['m_admin']['doctypes']['custom_query_insert_colums'],0,strlen($_SESSION['m_admin']['doctypes']['custom_query_insert_colums'])-2); + } + if($_SESSION['m_admin']['doctypes']['custom_query_insert_values'] <> "") + { + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] = ", ".$_SESSION['m_admin']['doctypes']['custom_query_insert_values']; + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] = substr($_SESSION['m_admin']['doctypes']['custom_query_insert_values'],0,strlen($_SESSION['m_admin']['doctypes']['custom_query_insert_values'])-2); + } + if($_SESSION['m_admin']['doctypes']['custom_query_update'] <> "") + { + $_SESSION['m_admin']['doctypes']['custom_query_update'] = ", ".$_SESSION['m_admin']['doctypes']['custom_query_update']; + $_SESSION['m_admin']['doctypes']['custom_query_update'] = substr($_SESSION['m_admin']['doctypes']['custom_query_update'],0,strlen($_SESSION['m_admin']['doctypes']['custom_query_update'])-2); + } + + ?> + <script language="javascript" type="text/javascript">window.parent.document.forms['frmtype'].submit();</script> + <?php + exit(); +} + ?> +<body> + <div align="center"> + <?php if(!isset($_SESSION['m_admin']['doctypes']['COLL_ID']) || empty($_SESSION['m_admin']['doctypes']['COLL_ID'])) + { + echo _MUST_CHOOSE_COLLECTION_FIRST; + } + else + {?> + <form name="frm_choose_index" action="choose_index.php" method="get" id="frm_choose_index"> + <input type="hidden" name="valid" id="valid" value="true"/> + <?php if(count($_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']]) > 0) + {?> + <table> + <tr> + <th width='150'> + <?php echo _FIELD;?> + </th> + <th align="center" width='100'> + <?php echo _USED;?> + </th> + <th align="center" width='100'> + <?php echo _MANDATORY;?> + </th> + <!-- <td align="center" width='100'> + <?php // echo _ITERATIVE;?> + </td>--> + </tr> + <?php + for($i=0;$i<count($_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']]);$i++) + { + echo "<tr>"; + echo "<td width='150'>"; + echo " ".$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['LABEL']; + echo "</td>"; + echo "<td align='center'>"; + ?> + <input name="field_<?php echo $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN'];?>" type="checkbox" class="check" value="Y" + <?php + if ($_SESSION['m_admin']['doctypes'][$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] == '1100000000' || $_SESSION['m_admin']['doctypes'][$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] == '1000000000') + { + echo "checked=\"checked\""; + } + ?> + /> + </td> + <td align="center" width='100'> + <input name="mandatory_<?php echo $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN'];?>" type="checkbox" class="check" value="Y" + <?php + if ($_SESSION['m_admin']['doctypes'][$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] == '1100000000') + { + echo "checked=\"checked\""; + } + ?> + /> + </td> + <?php + /* if($_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['ITERATIVE'] == "no") + { + ?> + <td align="center" width='100'> + <input name="iterative" class="check" type="checkbox" disabled="disabled" /> + </td> + <?php + } + else + { + ?> + <td align="center" width='100'> + <input name="iterative" class="check" type="checkbox" checked="checked" disabled="disabled" /> + </td> + <?php + }*/ + echo "</tr>"; + } + ?> + </table> + <?php + + } ?> + </form> +<?php } ?> + </div> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/architecture/types/types.php b/maarch_entreprise/trunk/admin/architecture/types/types.php new file mode 100644 index 0000000000000000000000000000000000000000..2cb7bc8289f2586b1d27d72e3e284efca07b11cb --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/types.php @@ -0,0 +1,146 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List the documents types +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_architecture', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=types'; +$page_label = _DOCTYPES_LIST2; +$page_id = "types"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$func = new functions(); +$select[$_SESSION['tablename']['doctypes']] = array(); +array_push($select[$_SESSION['tablename']['doctypes']],"type_id","description"); +$what = ""; +$where = " enabled = 'Y' "; +if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where .= " and (description ilike '".strtolower($what)."%' or description ilike '".strtoupper($what)."%') "; + } + else + { + $where .= " and (description like '".strtolower($what)."%' or description like '".strtoupper($what)."%') "; + } +} +$list = new list_show(); +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'description'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request= new request; +$tab=$request->select($select,$where,$orderstr ,$_SESSION['config']['databasetype']); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="type_id") + { + $tab[$i][$j]["type_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='type_id'; + } + if($tab[$i][$j][$value]=="description") + { + $tab[$i][$j]['value'] = $func->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["description"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_DESC; + $tab[$i][$j]["size"]="50"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='description'; + } + } + } +} +$page_name = "types"; +$page_name_up = "types_up"; +$page_name_add = "types_add"; +$page_name_del = "types_del"; +$page_name_val = ""; +$table_name = $_SESSION['tablename']['doctypes']; +$page_name_ban = ""; +$label_add = _ADD_DOCTYPE; +$_SESSION['m_admin']['load_security'] = true; +$_SESSION['m_admin']['init'] = true; +$_SESSION['m_admin']['doctypes'] = array(); +$_SESSION['sous_dossiers'] = array(); +$request->query("select * from ".$_SESSION['tablename']['doctypes_second_level']." where enabled = 'Y'"); +while($res = $request->fetch_object()) +{ + array_push($_SESSION['sous_dossiers'], array('ID' => $res->doctypes_second_level_id, 'LABEL'=> $res->doctypes_second_level_label)); +} +function cmp($a, $b) +{ + return strcmp($a["LABEL"], $b["LABEL"]); +} +usort($_SESSION['sous_dossiers'], "cmp"); + +$title = _DOCTYPES_LIST." : ".$i." "._TYPES; +$autoCompletionArray = array(); +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."admin/architecture/types/types_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; + +$list->admin_list($tab, $i, $title, 'type_id','types','architecture/types','type_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false,_ALL_DOCTYPES, _TYPE, $_SESSION['config']['img'].'/manage_doctypes_b.gif',false, true, true, true, "", true, $autoCompletionArray); +?> diff --git a/maarch_entreprise/trunk/admin/architecture/types/types_add.php b/maarch_entreprise/trunk/admin/architecture/types/types_add.php new file mode 100644 index 0000000000000000000000000000000000000000..d2c07e04500fa6e8c9b89c42f27dcc013700c43d --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/types_add.php @@ -0,0 +1,62 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to add a new document type +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass'].'class_functions.php'); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->test_admin('admin_architecture', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=types_add'; +$page_label = _ADDITION.' '._TYPE; +$page_id = "types_add"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +//here we loading the lang vars +$core_tools->load_lang(); +$time = $core_tools->get_session_time_expire(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_types.php"); + +$users = new types(); +$users->formtype("add"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/types/types_archi.php b/maarch_entreprise/trunk/admin/architecture/types/types_archi.php new file mode 100644 index 0000000000000000000000000000000000000000..2a9ab1cc0eb176e897f1f98a45aba597dcbbaeb0 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/types_archi.php @@ -0,0 +1,49 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List the documents types +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_architecture', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); + +$func = new functions(); + +$what = ""; +if(isset($_GET['what'])) +{ + $what = addslashes($func->wash($_GET['what'], "no", "", "no")); + $where = "where DESCRIPTION like '".strtolower($what)."%' or DESCRIPTION like '".strtoupper($what)."%'"; +} + +$users = new types(); +$users->typeslist($where,$what); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/types/types_del.php b/maarch_entreprise/trunk/admin/architecture/types/types_del.php new file mode 100644 index 0000000000000000000000000000000000000000..e5e2fb5efc3fc656c3c17d50b1800fa5f0fe446e --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/types_del.php @@ -0,0 +1,85 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Delete a document type +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->test_admin('admin_architecture', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_types.php"); +$func = new functions(); +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "no", _THE_DOCTYPE)); +} +else +{ + $s_id = ""; +} + +// delete a doc type +$db = new dbquery(); +$db->connect(); +$db->query("select description from ".$_SESSION['tablename']['doctypes']." where type_id = '".$s_id."'"); +if($db->nb_result() == 0) +{ + $_SESSION['error'] = _DOCTYPE.' '._UNKNOWN; + ?> + <script>window.location.href="<?php echo $_SESSION['config']['businessappurl'] ?>index.php?page=types";</script> + <?php + exit(); +} +else +{ + $info = $db->fetch_object(); + $db->query("delete from ".$_SESSION['tablename']['doctypes']." where type_id = ".$s_id.""); + + $_SESSION['service_tag'] = "doctype_delete"; + $_SESSION['m_admin']['doctypes']['TYPE_ID'] = $s_id; + $core_tools->execute_modules_services($_SESSION['modules_services'], 'doctype_del', "include"); + $core_tools->execute_app_services($_SESSION['app_services'], 'doctype_del', 'include'); + $_SESSION['service_tag'] = ''; + unset($_SESSION['m_admin']['doctypes']['TYPE_ID']); + require($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['doctypes'], $id,"DEL",_DOCTYPE_DELETION." : ".$info->DESCRIPTION, $_SESSION['config']['databasetype']); + $_SESSION['error'] = _DELETED_DOCTYPE; + ?> + <script>window.location.href="<?php echo $_SESSION['config']['businessappurl'] ?>index.php?page=types";</script> + <?php + exit(); +} + +?> diff --git a/maarch_entreprise/trunk/admin/architecture/types/types_list_by_name.php b/maarch_entreprise/trunk/admin/architecture/types/types_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..b5198dc0b05ef0e1a1251d6c4b3adccc9c9856a0 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/types_list_by_name.php @@ -0,0 +1,72 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of types for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select description as tag from ".$_SESSION['tablename']['doctypes']." where description ilike '".$_REQUEST['what']."%' order by description"); +} +else +{ + $db->query("select description as tag from ".$_SESSION['tablename']['doctypes']." where description like '".$_REQUEST['what']."%' order by description"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; + +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/types/types_up.php b/maarch_entreprise/trunk/admin/architecture/types/types_up.php new file mode 100644 index 0000000000000000000000000000000000000000..a8546eba1f7770f1f3efdd16e9cdfc4e229caf9b --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/types_up.php @@ -0,0 +1,70 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to modify a document type +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +$core_tools = new core_tools(); +$core_tools->load_lang(); +$core_tools->test_admin('admin_architecture', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=types_up'; +$page_label = _MODIFICATION.' '._TYPE; +$page_id = "types_up"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_types.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "no", _THE_DOCTYPE)); +} +else +{ + $s_id = ""; +} + +$users = new types(); +$users->formtype("up",$s_id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/types/types_up_db.php b/maarch_entreprise/trunk/admin/architecture/types/types_up_db.php new file mode 100644 index 0000000000000000000000000000000000000000..ed1baabffd8dcf95ee6369b0deece0b002fc15d4 --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/types/types_up_db.php @@ -0,0 +1,42 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Modify the document type in the database after the form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); + +$core_tools = new core_tools(); +$core_tools->load_lang(); +$core_tools->test_admin('admin_architecture', 'apps'); + +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_types.php"); + +$users = new types(); +$users->uptypes(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/architecture/view_tree_types.php b/maarch_entreprise/trunk/admin/architecture/view_tree_types.php new file mode 100644 index 0000000000000000000000000000000000000000..a4d49937e0dc85a894d6d71edcfe868405b32a3b --- /dev/null +++ b/maarch_entreprise/trunk/admin/architecture/view_tree_types.php @@ -0,0 +1,78 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Architecture Administration view tree +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$admin = new core_tools(); +$admin->test_admin('admin_architecture', 'apps'); +$db = new dbquery(); +$db->connect(); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=view_tree_types&admin=architecture'; +$page_label = _VIEW_TREE_DOCTYPES; +$page_id = "view_tree_types"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +unset($_SESSION['m_admin']); +$_SESSION['tree_foldertypes'] = array(); +$db->query("select distinct foldertype_id, foldertype_label from ".$_SESSION['tablename']['fold_foldertypes']." order by foldertype_label"); + + +while($res = $db->fetch_object()) +{ + array_push($_SESSION['tree_foldertypes'], array("ID" => $res->foldertype_id, "LABEL" => $res->foldertype_label)); +} +?> +<h1><img src="<?php echo $_SESSION['config']['img'];?>/manage_architecture_b.gif" alt="" /> <?php echo _VIEW_TREE_DOCTYPES;?></h1> +<div id="inner_content" class="clearfix"> + <table width="100%" border="0"> + <tr> + <td> + <iframe name="choose_tree" id="choose_tree" width="900px" height="40px" frameborder="0" scrolling="no" src="<?php echo $_SESSION['businessappurl']."admin/architecture/choose_tree.php";?>"></iframe> + </td> + </tr> + <tr> + <td> + <iframe name="show_trees" id="show_trees" width="900px" height="600px" frameborder="0" scrolling="auto" src="<?php echo $_SESSION['businessappurl']."admin/architecture/show_trees.php";?>"></iframe> + </td> + </tr> + </table> +</div> diff --git a/maarch_entreprise/trunk/admin/contacts/contact_add.php b/maarch_entreprise/trunk/admin/contacts/contact_add.php new file mode 100644 index 0000000000000000000000000000000000000000..a1ad153e358d668f175c2826f08df7344e950a55 --- /dev/null +++ b/maarch_entreprise/trunk/admin/contacts/contact_add.php @@ -0,0 +1,60 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Add contact form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +$core_tools2 = new core_tools(); +//here we loading the lang vars +$core_tools2->load_lang(); +$core_tools2->test_admin('admin_contacts', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=contact_add&admin=contacts'; +$page_label = _ADDITION; +$page_id = "contact_add"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_contacts.php"); + +$contact = new contacts(); +$contact->formcontact("add"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/contacts/contact_del.php b/maarch_entreprise/trunk/admin/contacts/contact_del.php new file mode 100644 index 0000000000000000000000000000000000000000..584f5f0961a29e956f0ba58bbfe5656766c9b00a --- /dev/null +++ b/maarch_entreprise/trunk/admin/contacts/contact_del.php @@ -0,0 +1,57 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Delete contact +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_contacts', 'apps'); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_contacts.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "alphanum", _THE_CONTACT)); +} +else +{ + $s_id = ""; +} + +$contact = new contacts(); +$contact->delcontact($s_id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/contacts/contact_list_by_name.php b/maarch_entreprise/trunk/admin/contacts/contact_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..836cb162a722c469a199f4e3b80ada17713b3572 --- /dev/null +++ b/maarch_entreprise/trunk/admin/contacts/contact_list_by_name.php @@ -0,0 +1,70 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of users for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select lastname as tag from ".$_SESSION['tablename']['contacts']." where lastname ilike '".$_REQUEST['what']."%' and (user_id = '' or user_id = null or user_id is null) order by lastname"); +} +else +{ + $db->query("select lastname as tag from ".$_SESSION['tablename']['contacts']." where lastname like '".$_REQUEST['what']."%' and (user_id = '' or user_id = null or user_id is null) order by lastname"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/contacts/contact_up.php b/maarch_entreprise/trunk/admin/contacts/contact_up.php new file mode 100644 index 0000000000000000000000000000000000000000..99e527f0add3c63d72eeb97ffd5714be0d59bd06 --- /dev/null +++ b/maarch_entreprise/trunk/admin/contacts/contact_up.php @@ -0,0 +1,74 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to modify a contact +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_contacts', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_contacts.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $id = addslashes($func->wash($_GET['id'], "alphanum", _THE_CONTACT)); +} +else +{ + $id = ""; +} + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=contact_up&admin=contacts'; +$page_label = _MODIFICATION; +$page_id = "contact_up"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + + +$contact = new contacts(); +$contact->formcontact("up",$id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/contacts/contact_up_db.php b/maarch_entreprise/trunk/admin/contacts/contact_up_db.php new file mode 100644 index 0000000000000000000000000000000000000000..fbb09a426dbd21ead240cda9a00a7e907cbf226b --- /dev/null +++ b/maarch_entreprise/trunk/admin/contacts/contact_up_db.php @@ -0,0 +1,47 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Modify the contact in the database after the form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_contacts', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_contacts.php"); + +$contact = new contacts(); +$contact->addupcontact($_POST['mode']); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/contacts/contacts.php b/maarch_entreprise/trunk/admin/contacts/contacts.php new file mode 100644 index 0000000000000000000000000000000000000000..7789550b6eb6949636625ae36ea3f5aa1d7d75e2 --- /dev/null +++ b/maarch_entreprise/trunk/admin/contacts/contacts.php @@ -0,0 +1,184 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief contacts list +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +$admin = new core_tools(); +$admin->test_admin('admin_contacts', 'apps'); +$func = new functions(); +$_SESSION['m_admin']['contact'] = array(); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=contacts&admin=contacts'; +$page_label = _CONTACTS_LIST; +$page_id = "contacts"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$select[$_SESSION['tablename']['contacts']] = array(); +array_push($select[$_SESSION['tablename']['contacts']],"contact_id", "society","lastname","firstname", 'user_id'); +$what = ""; +//$where =" (user_id is null or user_id = '') and enabled = 'Y' "; +$where =" enabled = 'Y' "; +if(isset($_REQUEST['what'])) +{ + $what = $func->protect_string_db($func->wash($_REQUEST['what'], "alphanum", "", "no")); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where .= " and (lastname ilike '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' or society ilike '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' ) "; + } + else + { + $where .= " and (lastname like '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' or society like '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' ) "; + } +} +$list = new list_show(); +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'lastname, society'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request= new request; +$tab=$request->select($select,$where,$orderstr,$_SESSION['config']['databasetype']); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="contact_id") + { + $tab[$i][$j]["contact_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="18"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "contact_id"; + } + if($tab[$i][$j][$value]=="society") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["society"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_SOCIETY; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "society"; + } + if($tab[$i][$j][$value]=="lastname") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["lastname"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_LASTNAME; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "lastname"; + } + if($tab[$i][$j][$value]=="firstname") + { + $tab[$i][$j]["firstname"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_FIRSTNAME; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="center"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "firstname"; + } + if($tab[$i][$j][$value]=="user_id") + { + $tab[$i][$j]["user_id"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_OWNER; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="center"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "user_id"; + } + + } + } +} +$page_name = "contacts"; +$page_name_up = "contact_up"; +$page_name_del = "contact_del"; +$page_name_val= ""; +$page_name_ban = ""; +$page_name_add = "contact_add"; +$label_add = _CONTACT_ADDITION; +$_SESSION['m_admin']['init'] = true; +$title = _CONTACTS_LIST." : ".$i." "._CONTACTS; +$autoCompletionArray = array(); +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."admin/contacts/contact_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; + +$list->admin_list($tab, $i, $title, 'contact_id','contacts','contacts','contact_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, FALSE, FALSE, _ALL_CONTACTS, _CONTACT, $_SESSION['config']['img'].'/manage_contact_b.gif', false, true, false, true, $what, true, $autoCompletionArray); +$_SESSION['m_admin']['contacts'] = array(); +$_SESSION['m_admin']['contacts']['id'] = ""; +$_SESSION['m_admin']['contacts']['title'] = ""; +$_SESSION['m_admin']['contacts']['lastname'] = ""; +$_SESSION['m_admin']['contacts']['firtsname'] = ""; +$_SESSION['m_admin']['contacts']['society'] = ""; +$_SESSION['m_admin']['contacts']['function'] = ""; +$_SESSION['m_admin']['contacts']['address_num'] = ""; +$_SESSION['m_admin']['contacts']['address_street'] = ""; +$_SESSION['m_admin']['contacts']['address_complement'] = ""; +$_SESSION['m_admin']['contacts']['address_town'] = ""; +$_SESSION['m_admin']['contacts']['address_postal_code'] = ""; +$_SESSION['m_admin']['contacts']['address_country'] = ""; +$_SESSION['m_admin']['contacts']['email'] = ""; +$_SESSION['m_admin']['contacts']['phone'] = ""; +$_SESSION['m_admin']['contacts']['other_data'] = ""; +$_SESSION['m_admin']['contacts']['is_corporate_person'] = ""; +?> diff --git a/maarch_entreprise/trunk/admin/groups/add_grant.php b/maarch_entreprise/trunk/admin/groups/add_grant.php new file mode 100644 index 0000000000000000000000000000000000000000..f6acb0a9ba3e540dcdbf9f593427c2bc0c1c8c39 --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/add_grant.php @@ -0,0 +1,286 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to add a grant to a group, pop up page +* +* @file view.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); +$func = new functions(); +$coll = ''; +$coll_label = ''; +$clause = ''; +$comment = ''; +$insert = ''; +$update = ''; +$delete = ''; +$tabdiff=array(); +$mode = "add"; +$sec = new security(); +$show_checkbox = true; + +if(isset($_REQUEST['collection']) && !empty($_REQUEST['collection'])) +{ + $mode = "up"; + for($i=0;$i< count($_SESSION['m_admin']['groups']['security']);$i++) + { + if($_SESSION['m_admin']['groups']['security'][$i]['COLL_ID'] == trim($_REQUEST['collection'])) + { + $_SESSION['m_admin']['group']['coll_id'] = trim($_REQUEST['collection']); + $ind = $sec->get_ind_collection($_SESSION['m_admin']['group']['coll_id']); + $coll_label = $_SESSION['collections'][$ind]['label']; + $clause = $func->show_string($_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE']); + $comment = $_SESSION['m_admin']['groups']['security'][$i]['COMMENT']; + if(!isset($_SESSION['collections'][$ind]['table']) || empty($_SESSION['collections'][$ind]['table'])) + { + $show_checkbox = false; + } + else + { + $insert = $_SESSION['m_admin']['groups']['security'][$i]['CAN_INSERT']; + $update = $_SESSION['m_admin']['groups']['security'][$i]['CAN_UPDATE']; + $delete = $_SESSION['m_admin']['groups']['security'][$i]['CAN_DELETE']; + } + } + } + if($coll_label == "") + { + $ind = $sec->get_ind_collection($_SESSION['m_admin']['group']['coll_id']); + $coll_label = $_SESSION['collections'][$ind]['label']; + $mode = "add"; + } +} +else +{ + $show_checkbox = $_SESSION['m_admin']['group']['show_check']; +} +if($core_tools->is_module_loaded("basket")) +{ + $_SESSION['entities_choosen'] = array(); +} +$_SESSION['doctypes_choosen'] = array(); +if($_SESSION['m_admin']['mode'] == "up" && $_SESSION['m_admin']['init'] == true) +{ + $where = ""; + for($i=0;$i<count($_SESSION['m_admin']['groups']['security']);$i++) + { + if($_SESSION['m_admin']['groups']['security'][$i]['COLL_ID'] == $_SESSION['m_admin']['group']['coll_id']) + { + $_SESSION['m_admin']['groups']['coll_id'] = $_SESSION['m_admin']['groups']['security'][$i]['COLL_ID']; + $_SESSION['m_admin']['groups']['where_clause'] = $func->show_string($_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE']); + } + } + $where = $func->show_string(trim($_SESSION['m_admin']['groups']['where_clause'])); + if($core_tools->is_module_loaded("basket")) + { + $where = str_replace("DESTINATION IN (", "", $where); + } + $where = str_replace("TYPE_ID IN (", "", $where); + $where = str_replace(")", "", $where); + $where = str_replace("'", "", $where); + if(preg_match("/,/", $where)) + { + if($core_tools->is_module_loaded("basket")) + { + $where_init = explode(" AND ", $func->show_string($where)); + $_SESSION['entities_choosen'] = explode(",", $where_init[0]); + $_SESSION['doctypes_choosen'] = explode(",", $where_init[1]); + for($i=0; $i<count($_SESSION['entities_choosen']);$i++) + { + $_SESSION['entities_choosen'][$i] = trim($_SESSION['entities_choosen'][$i]); + } + for($j=0; $j<count($_SESSION['doctypes_choosen']);$j++) + { + $_SESSION['doctypes_choosen'][$j] = trim($_SESSION['doctypes_choosen'][$j]); + } + } + else + { + $_SESSION['doctypes_choosen'] = explode(",", $where); + for($j=0; $j<count($_SESSION['doctypes_choosen']);$j++) + { + $_SESSION['doctypes_choosen'][$j] = trim($_SESSION['doctypes_choosen'][$j]); + } + } + } + else + { + if($core_tools->is_module_loaded("basket")) + { + array_push($_SESSION['entities_choosen'], trim($where)); + } + } + + $_SESSION['m_admin']['init'] = false; +} +if($core_tools->is_module_loaded("basket")) +{ + if($_SESSION['entities_choosen_where_clause'] == " DESTINATION IN ('')") + { + $_SESSION['entities_choosen_where_clause'] = ""; + } +} +if($_SESSION['doctypes_choosen_where_clause'] == " TYPE_ID IN ('')") +{ + $_SESSION['doctypes_choosen_where_clause'] = ""; +} +if($_REQUEST['expertmode'] <> "true") +{ + $_SESSION['choosen_where_clause'] = $clause; +} +else +{ + if($core_tools->is_module_loaded("basket")) + { + if(trim($_SESSION['entities_choosen_where_clause']) <> "" and trim($_SESSION['doctypes_choosen_where_clause']) <> "") + { + $_SESSION['choosen_where_clause'] = stripslashes($_SESSION['entities_choosen_where_clause'])." AND ".stripslashes($_SESSION['doctypes_choosen_where_clause']); + } + elseif(trim($_SESSION['entities_choosen_where_clause']) <> "" and trim($_SESSION['doctypes_choosen_where_clause']) == "") + { + $_SESSION['choosen_where_clause'] = stripslashes($_SESSION['entities_choosen_where_clause']); + } + elseif(trim($_SESSION['entities_choosen_where_clause']) == "" and trim($_SESSION['doctypes_choosen_where_clause']) <> "") + { + $_SESSION['choosen_where_clause'] = stripslashes($_SESSION['doctypes_choosen_where_clause']); + } + elseif(trim($_SESSION['entities_choosen_where_clause']) == "" and trim($_SESSION['doctypes_choosen_where_clause']) == "") + { + $_SESSION['choosen_where_clause'] = ""; + } + } + else + { + if(trim($_SESSION['doctypes_choosen_where_clause']) <> "") + { + $_SESSION['choosen_where_clause'] = stripslashes($_SESSION['doctypes_choosen_where_clause']); + } + elseif(trim($_SESSION['doctypes_choosen_where_clause']) == "") + { + $_SESSION['choosen_where_clause'] = ""; + } + } +} + +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(); +$time = $core_tools->get_session_time_expire(); +?> +<body onload="setTimeout(window.close, <?php echo $time;?>*60*1000);"> + +<h2 class="tit"><?php echo _ADD_GRANT;?></h2> +<table width="100%"> +<tr> +<td> +<div class="popup_content"> +<form name="addGrant" method="post" action="<?php echo $_SESSION['config']['businessappurl']."/admin/groups/add_grant_table.php";?>" class="forms"> + <input type="hidden" name="mode" value="<?php echo $mode;?>" /> + <?php + if(isset($_REQUEST['collection']) && !empty($_REQUEST['collection'])) + { + ?> + <p> + <label><?php echo _COLLECTION;?> : </label> + <input type="text" readonly="readonly" name="coll" class="readonly" value="<?php echo $coll_label;?>" /> + <input type="hidden" readonly="readonly" name="collselect" class="readonly" value="<?php echo $_SESSION['m_admin']['group']['coll_id'];?>" /> + </p> + <?php + } + else + { + ?> + <div align="center"> + <iframe name="choose_coll" id="choose_coll" scrolling="auto" width="100%" height="25" frameborder="0" src="choose_coll.php"></iframe></div> + <?php + } + ?> + <br/> + <p> + <label><?php echo _WHERE_CLAUSE;?> : </label> + <!-- <div id="label_expert_hide"> + <h5><a href="#" onclick="javascript:expertmodehide();"><i><?php echo _EDIT_WITH_ASSISTANT;?></i></a></h5> + </div>--> + </p> + <p> + <label> </label> + <textarea rows="6" cols="100" name="where" id="where" /><?php echo stripslashes($_SESSION['choosen_where_clause']);?></textarea> + </p> + <p> + <iframe name="frm_expert_mode" id="frm_expert_mode" src="<?php echo $_SESSION['config']['businessappurl'].'admin/groups/frame_expert_mode.php';?>" width="1" height="1" frameborder="0" scrolling="auto"></iframe> + <div id="label_expert_show" class="input_expert_hide"> + <a href="#" onclick="javascript:expertmodeview('<?php echo $_SESSION['m_admin']['group']['coll_id'];?>');"><h5><i><b><?php echo _VALID_THE_WHERE_CLAUSE;?>!!!</b></i></h5></a> + </div> + </p> + <br> + <p> + <label><?php echo _COMMENTS;?>: </label> + <input type="text" name="comment" value="<?php echo $comment;?>" /> + </p> + <br/> + <p> + <label><?php echo _INSERT;?> :</label> + <input type="checkbox" class="check" name="insert[]" class="check" value="Y" <?php if($insert == "Y"){ echo 'checked="checked"'; } ?> <?php if(!$show_checkbox){ echo 'disabled="disabled"';}?> /> + </p> + <p> + <label><?php echo _UPDATE;?> :</label> + <input type="checkbox" class="check" name="update[]" class="check" value="Y" <?php if($update == "Y"){ echo 'checked="checked"'; }?> <?php if(!$show_checkbox){ echo 'disabled="disabled"';}?>/> + </p> + <p> + <label><?php echo _DELETE_SHORT;?> :</label> + <input type="checkbox" class="check" name="delete[]" class="check" value="Y" <?php if($delete == "Y"){ echo 'checked="checked"'; }?> <?php if(!$show_checkbox){ echo 'disabled="disabled"';}?>/> + </p> + <br/> + + <br/> + <p class="buttons"> + <input type="submit" name="Submit" value="<?php echo _VALIDATE;?>" class="button" /> + <input type="button" name="cancel" value="<?php echo _CANCEL;?>" class="button" onclick="window.close()"/> + </p> + +</form> +</div> +</td> + +<td width='400px'> + <?php + $incl = $_SESSION['config']['businessapppath']."keywords_help.php"; + include ($incl); ?> +</td> +</tr> + +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/groups/add_grant_table.php b/maarch_entreprise/trunk/admin/groups/add_grant_table.php new file mode 100644 index 0000000000000000000000000000000000000000..2e2578939f78525beff9285461c1c8f64ae77dfb --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/add_grant_table.php @@ -0,0 +1,74 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Process the add_grant.php form, update the session variables with the new grant data +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); + +$_SESSION['error'] = ""; +if(!empty($_SESSION['m_admin']['group']['coll_id']) && isset($_SESSION['m_admin']['group']['coll_id'])) +{ + $insert = 'N'; + if(isset($_REQUEST['insert']) && count($_REQUEST['insert']) > 0) + { + $insert = 'Y'; + } + $update = 'N'; + if (isset($_REQUEST['update']) && count($_REQUEST['update']) > 0) + { + $update = 'Y'; + } + $delete = 'N'; + if(isset($_REQUEST['delete']) && count($_REQUEST['delete']) > 0) + { + $delete = 'Y'; + } + $comment = ""; + if(isset($_REQUEST['comment'])) + { + $comment = $_REQUEST['comment']; + } + $mode = ''; + if (isset($_REQUEST['mode'])) + { + $mode = $_REQUEST['mode']; + } + $sec = new security(); + $sec->add_grouptmp_session($_SESSION['m_admin']['group']['coll_id'], $_REQUEST['where'], $comment, $insert, $update, $delete, $mode); +} +else +{ +} +?> +<script language="javascript"> +window.opener.top.frames['group_form'].location.href='groups_form.php';self.close(); +</script> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/choose_coll.php b/maarch_entreprise/trunk/admin/groups/choose_coll.php new file mode 100644 index 0000000000000000000000000000000000000000..2a1f9432dea9cc052ea72a64132e575dc6739c34 --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/choose_coll.php @@ -0,0 +1,122 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Choose a collection +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); + +$_SESSION['m_admin']['group']['show_check'] = false; +$sec = new security(); +$tabdiff = array(); +$tab1 = array(); +for($cpt_0=0; $cpt_0 < count($_SESSION['collections']); $cpt_0++) +{ + array_push($tab1, $_SESSION['collections'][$cpt_0]['id']); +} + +$tab2 = array(); +for($cpt_1=0; $cpt_1 < count($_SESSION['m_admin']['groups']['security'][$cpt_1]); $cpt_1++) +{ + array_push($tab2, $_SESSION['m_admin']['groups']['security'][$cpt_1]['COLL_ID']); +} + +for($cpt_2=0; $cpt_2 < count($tab1); $cpt_2++) +{ + if(!in_array($tab1[$cpt_2], $tab2)) + { + array_push($tabdiff, $tab1[$cpt_2]); + } +} + +$tmp = array(); + +for($cpt_3=0; $cpt_3 < count($tabdiff); $cpt_3++) +{ + $j = $sec->get_ind_collection($tabdiff[$cpt_3]); + + if(!isset($_SESSION['collections'][$j]['table'])|| empty($_SESSION['collections'][$j]['table'])) + { + $show_checkbox = false; + } + array_push($tmp, array('id' => $tabdiff[$cpt_3], 'label' => $_SESSION['collections'][$j]['label'])); + +} +$tabdiff = $tmp; +if(count($tab_diff) == 1) +{ + $_SESSION['m_admin']['group']['coll_id'] = $tabdiff[0]; + $_SESSION['m_admin']['group']['show_check'] = true; +} + +if(isset($_REQUEST['collselect']) && !empty($_REQUEST['collselect'])) +{ + $_SESSION['m_admin']['group']['coll_id'] = $_REQUEST['collselect']; + $ind = $sec->get_ind_collection($_SESSION['m_admin']['group']['coll_id']); + + if(isset($_SESSION['collections'][$ind]['table']) && !empty($_SESSION['collections'][$ind]['table'])) + { + $_SESSION['m_admin']['group']['show_check'] = true; + } + + ?> + <script language="javascript" type="text/javascript">window.top.location.href = "add_grant.php";</script> + <?php +} + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(); +?> +<body> +<form name="choose_coll" action="choose_coll.php" method="get" class="forms"> + <p> + <label><?php echo _COLLECTION;?> :</label> + <select name="collselect" id="collselect" onchange="this.form.submit();return false;"> + <option value=""><?php echo _CHOOSE_COLLECTION;?></option> + <?php + for($cpt_4=0; $cpt_4 < count($tabdiff); $cpt_4++) + { + ?> + <option value="<?php echo $tabdiff[$cpt_4]['id']; ?>" <?php if ($_SESSION['m_admin']['group']['coll_id'] == $tabdiff[$cpt_4]['id']) {echo 'selected="selected"'; $_SESSION['m_admin']['group']['show_check'] = true;}?>><?php echo $tabdiff[$cpt_4]['label']; ?></option> + <?php + } + ?> + </select> + </p> +</form> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/frame_expert_mode.php b/maarch_entreprise/trunk/admin/groups/frame_expert_mode.php new file mode 100755 index 0000000000000000000000000000000000000000..2ace62f2744712a03d515d54d0249d1893602879 --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/frame_expert_mode.php @@ -0,0 +1,298 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Frame to edit the where clause in expert mode +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); +require($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +$core_tools = new core_tools(); +$db = new dbquery(); +$func = new functions(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); +$_SESSION['m_admin']['doctypes'] = array(); +$db->connect(); +$db->query("select * from ".$_SESSION['tablename']['doctypes']." where enabled = 'Y' and coll_id = '".$_SESSION['m_admin']['group']['coll_id']."' order by description"); +while($line = $db->fetch_object()) +{ + array_push($_SESSION['m_admin']['doctypes'], array( "ID" => $line->type_id, "COMMENT" => $func->show_string($line->description))); +} +$func = new functions(); +$sec= new security(); +if($core_tools->is_module_loaded("basket")) +{ + if(isset($_REQUEST['services']) && count($_REQUEST['services']) > 0) + { + if(isset($_SESSION['entities_choosen'])) + { + for($i=0; $i < count($_REQUEST['services']); $i++) + { + if(!in_array(trim($_REQUEST['services'][$i]), $_SESSION['entities_choosen'])) + { + array_push($_SESSION['entities_choosen'], trim($_REQUEST['services'][$i])); + } + } + } + } + else if(isset($_REQUEST['serviceslist']) && count($_REQUEST['serviceslist']) > 0) + { + for($i=0; $i < count($_SESSION['entities_choosen']); $i++) + { + for($j=0; $j < count($_REQUEST['serviceslist']); $j++) + { + if(trim($_REQUEST['serviceslist'][$j]) == trim($_SESSION['entities_choosen'][$i])) + { + unset($_SESSION['entities_choosen'][$i]); + } + } + } + $_SESSION['entities_choosen'] = array_values($_SESSION['entities_choosen']); + } + elseif(isset($_REQUEST['services']) && count($_REQUEST['services']) <= 0) + { + $_SESSION['entities_choosen'] = array(); + } +} + +if(isset($_REQUEST['doctypes']) && count($_REQUEST['doctypes']) > 0) +{ + //$_SESSION['doctypes_choosen'] = array(); + if(isset($_SESSION['doctypes_choosen'])) + { + for($i=0; $i < count($_REQUEST['doctypes']); $i++) + { + if(!in_array(trim($_REQUEST['doctypes'][$i]), $_SESSION['doctypes_choosen'])) + { + array_push($_SESSION['doctypes_choosen'], trim($_REQUEST['doctypes'][$i])); + } + } + } +} +elseif(isset($_REQUEST['doctypeslist']) && count($_REQUEST['doctypeslist']) > 0) +{ + for($i=0; $i < count($_SESSION['doctypes_choosen']); $i++) + { + for($j=0; $j < count($_REQUEST['doctypeslist']); $j++) + { + if(trim($_REQUEST['doctypeslist'][$j]) == trim($_SESSION['doctypes_choosen'][$i])) + { + unset($_SESSION['doctypes_choosen'][$i]); + } + } + } + $_SESSION['doctypes_choosen'] = array_values($_SESSION['doctypes_choosen']); +} +elseif(isset($_REQUEST['doctypes']) && count($_REQUEST['doctypes']) <= 0) +{ + +} +if($core_tools->is_module_loaded("basket")) +{ + if(isset($_SESSION['entities_choosen'])) + { + $_SESSION['entities_choosen_where_clause'] = implode($_SESSION['entities_choosen'],'\',\''); + $_SESSION['entities_choosen_where_clause'] = " DESTINATION IN ('".$_SESSION['entities_choosen_where_clause']."')"; + $_SESSION['entities_choosen_where_clause'] = str_replace("'',", "", $_SESSION['entities_choosen_where_clause']); + } +} +if(isset($_SESSION['doctypes_choosen'])) +{ + $_SESSION['doctypes_choosen_where_clause'] = implode($_SESSION['doctypes_choosen'],'\',\''); + $_SESSION['doctypes_choosen_where_clause'] = " TYPE_ID IN ('".$_SESSION['doctypes_choosen_where_clause']."')"; + $_SESSION['doctypes_choosen_where_clause'] = str_replace("'',", "", $_SESSION['doctypes_choosen_where_clause']); +} + +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(_MANAGE_RIGHTS); +?> +<body id="iframe"> +<br/> +<center><?php echo _ASSISTANT_MODE; ?></center> +<form name="choose_services" id="choose_services" method="post" action="frame_expert_mode.php"> + <table> + <tr> + <?php + if($core_tools->is_module_loaded("basket")) + { + ?> + <td> + <table align="left" border="0" width="100%"> + <tr> + <td valign="top" width="48%"><center><?php echo _ENTITIES_LIST;?></center></td> + <td width="5%"> </td> + <td valign="top" width="47%"><center><?php echo _SELECTED_ENTITIES;?></center></td> + </tr> + <tr> + <td width="45%" align="center" valign="top"> + <select name="serviceslist[]" class="multiple_list_entities" ondblclick='moveclick(document.choose_services.elements["serviceslist[]"],document.choose_services.elements["services[]"]);this.form.submit();' multiple="multiple"> + <?php + for($i=0;$i<count($_SESSION['m_admin']['entities']);$i++) + { + $state_services = false; + for($j=0;$j<count($_SESSION['entities_choosen']);$j++) + { + if(trim($_SESSION['m_admin']['entities'][$i]['ID']) == trim($_SESSION['entities_choosen'][$j])) + { + $state_services = true; + } + } + if($state_services == false) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['entities'][$i]['ID']; ?>"><?php echo $_SESSION['m_admin']['entities'][$i]['COMMENT']; ?></option> + <?php + } + } + ?> + </select> + <br/><br/> + <a href='javascript:selectall(document.forms["choose_services"].elements["serviceslist[]"]);' class="choice"><?php echo _SELECT_ALL; ?></a> + </td> + <td width="10%" align="center"> + <input type="button" class="button" value="<?php echo _ADD; ?>" onclick='Move(document.choose_services.elements["serviceslist[]"],document.choose_services.elements["services[]"]);this.form.submit();' align="middle"/> + <br /> + <br /> + <input type="button" class="button" value="<?php echo _REMOVE; ?>" onclick='Move(document.choose_services.elements["services[]"],document.choose_services.elements["serviceslist[]"]);this.form.submit();' align="middle"/> + </td> + <td width="45%" align="center" valign="top"> + <select name="services[]" class="multiple_list_entities" width="100" ondblclick='moveclick(document.choose_services.elements["services[]"],document.choose_services.elements["serviceslist"]);this.form.submit();' multiple="multiple" > + <?php + for($i=0;$i<count($_SESSION['m_admin']['entities']);$i++) + { + $state_services = false; + for($j=0;$j<count($_SESSION['entities_choosen']);$j++) + { + if(trim($_SESSION['m_admin']['entities'][$i]['ID']) == trim($_SESSION['entities_choosen'][$j])) + { + $state_services = true; + } + } + if($state_services == true) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['entities'][$i]['ID']; ?>" ><?php echo $_SESSION['m_admin']['entities'][$i]['COMMENT']; ?></option> + <?php + } + } + ?> + </select> + <br/><br/> + <a href='javascript:selectall(document.forms["choose_services"].elements["services[]"]);' class="choice"> + <?php echo _SELECT_ALL; ?></a></td> + </tr> + <tr> + <td height="10"> </td> + </tr> + </table> + </td> + <?php + } + ?> + <td> + <table align="left" border="0" width="100%"> + <tr> + <td valign="top" width="48%"><center><?php echo _DOCTYPES_LIST_SHORT;?></center></td> + <td width="5%"> </td> + <td valign="top" width="47%"><center><?php echo _SELECTED_DOCTYPES;?></center></td> + </tr> + <tr> + <td width="45%" align="center" valign="top"> + <select name="doctypeslist[]" class="multiple_list_doctypes" ondblclick='moveclick(document.choose_services.elements["doctypeslist[]"],document.choose_services.elements["doctypes[]"]);this.form.submit();' multiple="multiple"> + <?php + for($i=0;$i<count($_SESSION['m_admin']['doctypes']);$i++) + { + $state_doctypes = false; + for($j=0;$j<count($_SESSION['doctypes_choosen']);$j++) + { + if(trim($_SESSION['m_admin']['doctypes'][$i]['ID']) == trim($_SESSION['doctypes_choosen'][$j])) + { + $state_doctypes = true; + } + } + if($state_doctypes == false) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['doctypes'][$i]['ID']; ?>"><?php echo $_SESSION['m_admin']['doctypes'][$i]['COMMENT']; ?></option> + <?php + } + } + ?> + </select> + <br/><br/> + <a href='javascript:selectall(document.forms["choose_services"].elements["doctypeslist[]"]);' class="choice"><?php echo _SELECT_ALL; ?></a> + </td> + <td width="10%" align="center"> + <input type="button" class="button" value="<?php echo _ADD; ?>" onclick='Move(document.choose_services.elements["doctypeslist[]"],document.choose_services.elements["doctypes[]"]);this.form.submit();' align="middle"/> + <br /> + <br /> + <input type="button" class="button" value="<?php echo _REMOVE; ?>" onclick='Move(document.choose_services.elements["doctypes[]"],document.choose_services.elements["doctypeslist[]"]);this.form.submit();' align="middle"/> + </td> + <td width="45%" align="center" valign="top"> + <select name="doctypes[]" class="multiple_list_doctypes" ondblclick='moveclick(document.choose_services.elements["doctypes[]"],document.choose_services.elements["doctypeslist"]);this.form.submit();' multiple="multiple" > + <?php + for($i=0;$i<count($_SESSION['m_admin']['doctypes']);$i++) + { + $state_doctypes = false; + for($j=0;$j<count($_SESSION['doctypes_choosen']);$j++) + { + if(trim($_SESSION['m_admin']['doctypes'][$i]['ID']) == trim($_SESSION['doctypes_choosen'][$j])) + { + $state_doctypes = true; + } + } + if($state_doctypes == true) + { + ?> + <option value="<?php echo $_SESSION['m_admin']['doctypes'][$i]['ID']; ?>" ><?php echo $_SESSION['m_admin']['doctypes'][$i]['COMMENT']; ?></option> + <?php + } + } + ?> + </select> + <br/><br/> + <a href='javascript:selectall(document.forms["choose_services"].elements["doctypes[]"]);' class="choice"> + <?php echo _SELECT_ALL; ?></a></td> + </tr> + <tr> + <td height="10"> </td> + </tr> + </table> + </td> + </tr> + </table> +</form> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/group_add.php b/maarch_entreprise/trunk/admin/groups/group_add.php new file mode 100644 index 0000000000000000000000000000000000000000..6b59dfd61db424ae91bb2fea63d77510d357200c --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/group_add.php @@ -0,0 +1,62 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Add group form +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +$core_tools2 = new core_tools(); +//here we loading the lang vars +$core_tools2->load_lang(); +$core_tools2->test_admin('admin_groups', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=group_add&admin=groups'; +$page_label = _ADDITION; +$page_id = "group_add"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroups.php"); + +$func = new functions(); + +$ug = new usergroups(); + +$ug->formgroups("add"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/group_add_db.php b/maarch_entreprise/trunk/admin/groups/group_add_db.php new file mode 100644 index 0000000000000000000000000000000000000000..f591bb4f6dca9d2960037a72546c42990a3c7d82 --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/group_add_db.php @@ -0,0 +1,47 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Add group in database after form +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroups.php"); + +$users = new usergroups(); + +$users->addupgroups("add"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/group_allow.php b/maarch_entreprise/trunk/admin/groups/group_allow.php new file mode 100644 index 0000000000000000000000000000000000000000..feff07b90257caba3ab26576b84e6e1310d4b82c --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/group_allow.php @@ -0,0 +1,58 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Authorize a group +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); + +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroups.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "alphanum", _THE_GROUP)); +} +else +{ + $s_id = ""; +} + +$group = new usergroups(); +$group->admingroup($s_id,"allow"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/group_ban.php b/maarch_entreprise/trunk/admin/groups/group_ban.php new file mode 100644 index 0000000000000000000000000000000000000000..a3d84da39687322e792a57f3e7af735d0691780b --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/group_ban.php @@ -0,0 +1,57 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief To suspend a group +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroups.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "alphanum", _THE_GROUP)); +} +else +{ + $s_id = ""; +} + +$group = new usergroups(); +$group->admingroup($s_id,"ban"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/group_del.php b/maarch_entreprise/trunk/admin/groups/group_del.php new file mode 100644 index 0000000000000000000000000000000000000000..cc910be79d436ec0b32535e86d9a398af8ecf073 --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/group_del.php @@ -0,0 +1,56 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Delete a group +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroups.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "alphanum", _THE_GROUP)); +} +else +{ + $s_id = ""; +} + +$group = new usergroups(); +$group->admingroup($s_id,"del"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/group_up.php b/maarch_entreprise/trunk/admin/groups/group_up.php new file mode 100644 index 0000000000000000000000000000000000000000..8604ec147daeda6727ce44ca8160a02e6dcf4e99 --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/group_up.php @@ -0,0 +1,75 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to modify a group +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require( $_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroups.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $id = addslashes($func->wash($_GET['id'], "alphanum", _THE_GROUP)); +} +else +{ + $id = ""; +} + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=group_up&admin=groups'; +$page_label = _MODIFICATION; +$page_id = "group_up"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +$ug = new usergroups(); + +$ug->formgroups("up",$id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/group_up_db.php b/maarch_entreprise/trunk/admin/groups/group_up_db.php new file mode 100644 index 0000000000000000000000000000000000000000..418da67cc8a33b0a1faaebd3353eb2eb8038f365 --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/group_up_db.php @@ -0,0 +1,49 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Modify the group in the database after the form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); + +$path = $_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroups.php"; +require_once($path); + +$users = new usergroups(); +$users->addupgroups("up"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/groups.php b/maarch_entreprise/trunk/admin/groups/groups.php new file mode 100644 index 0000000000000000000000000000000000000000..a90dbc9302d9bacf3172958fa0d0a4a6d3788bdb --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/groups.php @@ -0,0 +1,147 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Group list +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$core_tools2 = new core_tools(); +$core_tools2->test_admin('admin_groups', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=groups&admin=groups'; +$page_label = _GROUPS_LIST; +$page_id = "list_groups"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$func = new functions(); +$select[$_SESSION['tablename']['usergroups']] = array(); +array_push($select[$_SESSION['tablename']['usergroups']],"group_id","group_desc","enabled"); +$what = ""; +$where =""; +if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where = "group_desc ilike '".strtolower($what)."%' or group_id ilike '".strtoupper($what)."%' "; + } + else + { + $where = "group_desc like '".strtolower($what)."%' or group_id like '".strtoupper($what)."%' "; + } +} +$list = new list_show(); +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'group_id'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request = new request; +$tab=$request->select($select,$where,$orderstr,$_SESSION['config']['databasetype']); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="group_id") + { + $tab[$i][$j]["group_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="18"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='group_id'; + } + if($tab[$i][$j][$value]=="group_desc") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["group_desc"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_DESC; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='group_desc'; + } + if($tab[$i][$j][$value]=="enabled") + { + $tab[$i][$j]["enabled"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_STATUS; + $tab[$i][$j]["size"]="6"; + $tab[$i][$j]["label_align"]="center"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='enabled'; + } + } + } +} +$page_name = "groups"; +$page_name_up = "group_up"; +$page_name_del = "group_del"; +$page_name_val= "group_allow"; +$page_name_ban = "group_ban"; +$page_name_add = "group_add"; +$label_add = _GROUP_ADDITION; +$_SESSION['m_admin']['load_security'] = true; +$_SESSION['m_admin']['load_services'] = true; +$_SESSION['m_admin']['init'] = true; +$title = _GROUPS_LIST." : ".$i." "._GROUPS; +$autoCompletionArray = array(); +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."admin/groups/groups_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; +$list->admin_list($tab, $i, $title, 'group_id','groups','groups', 'group_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_GROUPS, _GROUP, $_SESSION['config']['img'].'/manage_groupe_b.gif', false, true, false, true, "", true, $autoCompletionArray); +$_SESSION['m_admin']['groups'] = array(); +$_SESSION['m_admin']['groups']['GroupId'] = ""; +$_SESSION['m_admin']['groups']['desc'] = ""; +$_SESSION['m_admin']['groups']['admin'] = ""; +?> diff --git a/maarch_entreprise/trunk/admin/groups/groups_form.php b/maarch_entreprise/trunk/admin/groups/groups_form.php new file mode 100644 index 0000000000000000000000000000000000000000..f2879b9a66cccdce07a3f8d4c1ae8249e8d1366d --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/groups_form.php @@ -0,0 +1,191 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to manage the group security (iframe included in group management form) +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); + +$func = new functions(); +$sec= new security(); +$_SESSION['doctypes_choosen'] = array(); + +$_SESSION['m_admin']['collection_choice'] = "coll_1"; + + +if(isset($_REQUEST['setRights'])) +{ + $sec->init_rights_session(); + if(count($_REQUEST['rights_insert'])>0 ) + { + $tab = array(); + for ($i=0; $i<count($_REQUEST['rights_insert']); $i++) + { + array_push($tab,$_REQUEST['rights_insert'][$i]); + } + $sec->set_rights_session($tab, 'CAN_INSERT'); + } + if (count($_REQUEST['rights_update']) > 0) + { + $tab2 = array(); + for ($j=0; $j<count($_REQUEST['rights_update']); $j++) + { + array_push($tab2,$_REQUEST['rights_update'][$j]); + } + $sec->set_rights_session($tab2, 'CAN_UPDATE'); + } + if ( count($_REQUEST['rights_delete']) > 0 ) + { + $tab2 = array(); + for ($j=0; $j<count($_REQUEST['rights_delete']); $j++) + { + array_push($tab2,$_REQUEST['rights_delete'][$j]); + } + $sec->set_rights_session($tab2, 'CAN_DELETE'); + } + $_SESSION['m_admin']['load_security'] = false; +} +if(isset($_REQUEST['modifyAccess'])) +{ + $_SESSION['m_admin']['init'] = true; + if(count($_REQUEST['security'])>0) + { + ?> + <script type="text/javascript" language="javascript">window.open('<?php echo $_SESSION['config']['businessappurl'];?>admin/groups/add_grant.php?collection=<?php echo $_REQUEST['security'][0];?>','modify','toolbar=no,status=no,width=800,height=450,left=150,top=300,scrollbars=auto,location=no,menubar=no,resizable=yes');</script> + <?php + } +} +if(isset($_REQUEST['removeAccess'])) +{ + $tab = array(); + if(count($_REQUEST['security'])>0) + { + for($i=0; $i<count($_REQUEST['security']); $i++) + { + array_push($tab,$_REQUEST['security'][$i]); + } + $sec->remove_security($tab); + } + else + { + + } + $_SESSION['m_admin']['load_security'] = false; +} +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(_MANAGE_RIGHTS); +?> +<body id="iframe"> +<div class="block" > +<?php //$func->show_array($_SESSION['m_admin']['groups']['security']); +?> +<h2 class="tit"><?php echo _MANAGE_RIGHTS;?> : </h2> +<form name="security_form" method="get"> + <?php + if(count($_SESSION['m_admin']['groups']['security']) < 1 ) + { + echo _THE_GROUP." "._HAS_NO_SECURITY.".<br/>"; + echo _DEFINE_A_GRANT."<br/>"; + } + else + { + ?> + <table width="100%" border = "0"> + <tr > + <td width="20"> </td> + <td width="90" class="column"><?php echo _COLLECTION;?></td> + <td width="250" class="column"><?php echo _WHERE_CLAUSE;?></td> + <td width="60" class="column"><?php echo _INSERT; ?></td> + <td width="90" class="column"><?php echo _UPDATE; ?></td> + <td width="90" class="column"><?php echo _DELETE_SHORT; ?></td> + </tr> + <?php + for($i=0; $i < count($_SESSION['m_admin']['groups']['security']); $i++) + { + if($_SESSION['m_admin']['groups']['security'][$i] <> "") + { + ?> + <tr> + <td width="20"><input type="checkbox" class="check" name="security[]" value="<?php echo $_SESSION['m_admin']['groups']['security'][$i]['COLL_ID']; ?>" /></td> + <td width="90"><?php echo $_SESSION['collections'][$_SESSION['m_admin']['groups']['security'][$i]['IND_COLL_SESSION']]['label']; ?></td> + <td width="250"><?php echo $func->cut_string(stripslashes($func->show_string($_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE'])),50); ?></td> + <td width="60"><input type="checkbox" class="check" name="rights_insert[]" value="<?php echo $_SESSION['m_admin']['groups']['security'][$i]['COLL_ID']; ?>" <?php if($_SESSION['m_admin']['groups']['security'][$i]['CAN_INSERT'] == 'Y') { echo 'checked="checked"';} ?> disabled="disabled" /></td> + <td width="90"><input type="checkbox" class="check" name="rights_update[]" value="<?php echo $_SESSION['m_admin']['groups']['security'][$i]['COLL_ID']; ?>" <?php if($_SESSION['m_admin']['groups']['security'][$i]['CAN_UPDATE'] == 'Y') { echo 'checked="checked"';} ?>disabled="disabled" /></td> + <td width="90"><input type="checkbox" class="check" name="rights_delete[]" value="<?php echo $_SESSION['m_admin']['groups']['security'][$i]['COLL_ID']; ?>" <?php if($_SESSION['m_admin']['groups']['security'][$i]['CAN_DELETE'] == 'Y') { echo 'checked="checked"';} ?> disabled="disabled"/></td> + </tr> + <?php + } + } + ?> + <tr><td height="20"> </td></tr> + </table> + <?php + } + if (count($_SESSION['m_admin']['groups']['security']) > 0) + { + ?> + <input type="submit" name="modifyAccess" value="<?php echo _MODIFY_ACCESS; ?>" class="button"/> + <input type="submit" name="removeAccess" value="<?php echo _REMOVE_ACCESS; ?>" class="button"/> + <?php + } + if (count($_SESSION['collections']) > count($_SESSION['m_admin']['groups']['security'])) + { + ?> + <input type="button" name="addGrant" class="button" onClick="window.open('<?php echo $_SESSION['config']['businessappurl'];?>admin/groups/add_grant.php','add','toolbar=no,status=no,width=800,height=450,left=150,top=300,scrollbars=auto,location=no,menubar=no,resizable=yes');" value="<?php echo _ADD_GRANT; ?>" /> + <?php + } + /* + if (count($_SESSION['m_admin']['groups']['security']) > 0) + { + ?> + <input type="submit" name="setRights" class="button" value="<?php echo _UPDATE_RIGHTS; ?>" /> + <?php + } + */ + ?> + <br/><br/> +</form> +</div> + +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/groups/groups_list_by_id.php b/maarch_entreprise/trunk/admin/groups/groups_list_by_id.php new file mode 100644 index 0000000000000000000000000000000000000000..543e9c6b197bdd2fa314b6699d62f763a8b7fc2c --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/groups_list_by_id.php @@ -0,0 +1,72 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of groups for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select group_id as tag from ".$_SESSION['tablename']['usergroups']." where group_id ilike '".$_REQUEST['what']."%' order by group_id"); +} +else +{ + $db->query("select group_id as tag from ".$_SESSION['tablename']['usergroups']." where group_id like '".$_REQUEST['what']."%' order by group_id"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; + +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/groups_list_by_name.php b/maarch_entreprise/trunk/admin/groups/groups_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..0fff3701b17807caf2d1e39622ba3ccf9f12f67d --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/groups_list_by_name.php @@ -0,0 +1,72 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of groups for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select group_desc as tag from ".$_SESSION['tablename']['usergroups']." where group_desc ilike '".$_REQUEST['what']."%' order by group_desc"); +} +else +{ + $db->query("select group_desc as tag from ".$_SESSION['tablename']['usergroups']." where group_desc like '".$_REQUEST['what']."%' order by group_desc"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; + +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/groups/liste_users.php b/maarch_entreprise/trunk/admin/groups/liste_users.php new file mode 100644 index 0000000000000000000000000000000000000000..e6e79100c1d66a7a5f43c5940900868f89953e4d --- /dev/null +++ b/maarch_entreprise/trunk/admin/groups/liste_users.php @@ -0,0 +1,110 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Pop up : show the users list of a given group +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); + session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_groups', 'apps'); +require_once($_SESSION['pathtocoreclass']."class_db.php"); + +$group = ""; + +if(isset($_GET['id']) && !empty($_GET['id'])) +{ + $group = $_GET['id']; +} + +$db = new dbquery(); +$db->connect(); +$db->query("select u.department, u.lastname as nom, u.firstname as prenom , u.user_id as id + from ".$_SESSION['tablename']['usergroup_content']." uc, ".$_SESSION['tablename']['users']." u where uc.user_id = u.user_id AND u.enabled = 'Y' AND uc.group_id = '".$group."' order by u.lastname asc"); + +$users = array(); + +while($res = $db->fetch_object()) +{ + array_push($users, array( 'ID' => $res->id, 'NOM' => $res->nom, 'PRENOM' => $res->prenom, 'SERVICE' => $res->department)); +} + +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(_USERS_LIST_IN_GROUP.' '.$group); +$time = $core_tools->get_session_time_expire(); +?> +<body onload="setTimeout(window.close, <?php echo $time;?>*60*1000);"> +<h2 class="tit"><?php echo _USERS_LIST_IN_GROUP.' '.$group;?></h2> + +<table cellpadding="0" cellspacing="0" border="0" class="listing spec"> + <thead> + <tr> + <th><?php echo _LASTNAME;?></th> + <th ><?php echo _FIRSTNAME;?></th> + <th ><?php echo _DEPARTMENT;?></th> + </tr> + </thead> + +<tbody> + <?php +$color = ' class="col"'; + for($i=0;$i<count($users);$i++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + ?> + <tr <?php echo $color; ?> > + <td width="30%"><?php echo $users[$i]['NOM'];?></td> + <td width="30%"><?php echo $users[$i]['PRENOM'];?></td> + <td><?php echo $users[$i]['SERVICE']; ?></td> + </tr> + <?php + } +?> +</tbody> +</table> +<br/> +<br/> +<div align="center"> +<input type="button" class="button" onclick="self.close()" value="<?php echo _CLOSE_WINDOW;?>" align="middle"> +</div> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/history/history.php b/maarch_entreprise/trunk/admin/history/history.php new file mode 100644 index 0000000000000000000000000000000000000000..3e0a6fef2e7712eb5ea129c39762bb745bf3678f --- /dev/null +++ b/maarch_entreprise/trunk/admin/history/history.php @@ -0,0 +1,396 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Displays application logs +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); + +$core_tools2 = new core_tools(); +$core_tools2->test_admin('view_history', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=history&admin=history'; +$page_label = _VIEW_HISTORY2; +$page_id = "history"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +$db = new dbquery(); +$db->connect(); +$where = ''; +$label = ''; +$tab = array(); + +$modules = array(); +$db->query("select DISTINCT id_module from ".$_SESSION['tablename']['history']); + +while($res = $db->fetch_object()) +{ + if($res->id_module == 'admin') + { + array_push($modules, array('id' => 'admin', 'label' => _ADMIN)); + } + elseif(isset($_SESSION['modules_loaded'][$res->id_module]['comment']) && !empty($_SESSION['modules_loaded'][$res->id_module]['comment'])) + { + array_push($modules, array('id' => $res->id_module, 'label' => $_SESSION['modules_loaded'][$res->id_module]['comment'])); + } + else + { + array_push($modules, array('id' => $res->id_module, 'label' => $res->id_module)); + } +} + +function cmp($a, $b) +{ + return strcmp(strtolower($a["label"]), strtolower($b["label"])); +} +usort($modules, "cmp"); +usort($_SESSION['history_keywords'], "cmp"); + +$history_action= ''; +$history_user = ''; +$history_module= ''; +$history_datefin = ''; +$history_datestart = ''; + +if($_REQUEST['search'] || +(isset($_SESSION['m_admin']['history']['action']) && !empty($_SESSION['m_admin']['history']['action'])) || +(isset($_SESSION['m_admin']['history']['user']) && !empty($_SESSION['m_admin']['history']['user'])) || +(isset($_SESSION['m_admin']['history']['module']) && !empty($_SESSION['m_admin']['history']['module'])) || +(isset($_SESSION['m_admin']['history']['datefin']) && !empty($_SESSION['m_admin']['history']['datefin'])) || +(isset($_SESSION['m_admin']['history']['datestart']) && !empty($_SESSION['m_admin']['history']['datestart'])) +) +{ + $pattern = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; + $_SESSION['chosen_user'] = ''; + if((isset($_REQUEST['action']) ) || (isset($_SESSION['m_admin']['history']['action']) && !empty($_SESSION['m_admin']['history']['action']) )) + { + if(isset($_REQUEST['action'])) + { + $history_action= $_REQUEST['action']; + $_SESSION['m_admin']['history']['action'] = $history_action; + } + else + { + $history_action=$_SESSION['m_admin']['history']['action']; + } + if(!empty($history_action)) + { + $where .= " ".$_SESSION['tablename']['history'].".event_type = '".$history_action."' and "; + } + } + + if(isset($_REQUEST['user']) || (isset($_SESSION['m_admin']['history']['user']) && !empty($_SESSION['m_admin']['history']['user']))) + { + if(isset($_REQUEST['user'])) + { + $history_user = $_REQUEST['user']; + $_SESSION['m_admin']['history']['user'] = $history_user; + } + else + { + $history_user=$_SESSION['m_admin']['history']['user']; + } + if(!empty($history_user)) + { + $tmp = str_replace(')', '', substr($history_user, strrpos($history_user,'(')+1)); + $where .= " ".$_SESSION['tablename']['history'].".user_id = '".$tmp."' and"; + } + } + if(isset($_REQUEST['module']) || (isset($_SESSION['m_admin']['history']['module']) && !empty($_SESSION['m_admin']['history']['module']))) + { + if(isset($_REQUEST['module'])) + { + $history_module= $_REQUEST['module']; + $_SESSION['m_admin']['history']['module'] = $history_module; + } + else + { + $history_module=$_SESSION['m_admin']['history']['module']; + } + if(!empty($history_module)) + { + $where .= " ".$_SESSION['tablename']['history'].".id_module = '".$history_module."' and"; + } + } + + if(isset($_REQUEST['datestart']) ) + { + if(empty($_REQUEST['datestart'])) + { + $_SESSION['m_admin']['history']['datestart'] = ''; + } + else + { + if( preg_match($pattern,$_REQUEST['datestart'])==false ) + { + $_SESSION['error'] = _DATE.' '._WRONG_FORMAT; + } + else + { + $_SESSION['m_admin']['history']['datestart'] = $_REQUEST['datestart']; + if($_SESSION['config']['databasetype'] == "POSTGRESQL" && (isset($_REQUEST['datestart']) && !empty($_REQUEST['datestart']))) + { + $history_datestart = $_REQUEST['datestart']; + } + else if(isset($_REQUEST['datestart']) && !empty($_REQUEST['datestart'])) + { + $history_datestart = str_replace('-','',$_REQUEST['datestart']); + } + $where .= " (".$_SESSION['tablename']['history'].".event_date >= '".$history_datestart."') and "; + } + } + } + + if(isset($_REQUEST['datefin']) ) + { + if(empty($_REQUEST['datefin'])) + { + $_SESSION['m_admin']['history']['datefin'] = ''; + } + else + { + + if( preg_match($pattern,$_REQUEST['datefin'])==false ) + { + $_SESSION['error'] = _DATE.' '._WRONG_FORMAT; + } + else + { + $_SESSION['m_admin']['history']['datefin'] = $_REQUEST['datefin']; + if($_SESSION['config']['databasetype'] == "POSTGRESQL" && (isset($_REQUEST['datefin']) && !empty($_REQUEST['datefin']))) + { + $history_datefin = $_REQUEST['datefin']; + } + else if(isset($_REQUEST['datefin']) && !empty($_REQUEST['datefin'])) + { + $history_datefin = str_replace('-','',$_REQUEST['datefin']); + } + + $where .= " ( ".$_SESSION['tablename']['history'].".event_date <= '".$history_datefin."') and "; + } + } + } + $where = trim($where); + $where = preg_replace('/and$/', '', $where); +} + $select[$_SESSION['tablename']['history']] = array(); + array_push($select[$_SESSION['tablename']['history']],"id","event_date","user_id", "table_name", 'event_type', "info" ); + + $select[$_SESSION['tablename']['users']] = array(); + array_push($select[$_SESSION['tablename']['users']],"lastname","firstname" ); + + $list = new list_show(); + $order = 'desc'; + if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) + { + $order = trim($_REQUEST['order']); + } + $field = 'event_date'; + if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) + { + $field = trim($_REQUEST['order_field']); + } + + $orderstr = $list->define_order($order, $field); + $req = new request(); + + $tab = $req->select($select, $where,$orderstr, $_SESSION['config']['databasetype'], $limit="500",true,$_SESSION['tablename']['history'],$_SESSION['tablename']['users'],"user_id"); + +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="id") + { + $tab[$i][$j]["id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["show"]=false; + } + if($tab[$i][$j][$value]=="event_date") + { + $tab[$i][$j]["value"]=$req->dateformat($tab[$i][$j]['value'], '-'); + $tab[$i][$j]["label"]=_DATE; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='event_date'; + } + if($tab[$i][$j][$value]== "user_id" ) + { + $tab[$i][$j]["user_id"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _USERS; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='user_id'; + } + if($tab[$i][$j][$value]=="table_name") + { + $tab[$i][$j]["table_name"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_TABLE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='table_name'; + } + if($tab[$i][$j][$value]=='event_type') + { + $tab[$i][$j]['value']= $this->show_string($tab[$i][$j]['value']); + $tab[$i][$j]['event_type']= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_ACTION; + $tab[$i][$j]["size"]="8"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='event_type'; + } + if($tab[$i][$j][$value]=="info") + { + $tab[$i][$j]['value']= $this->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["info"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_COMMENTS; + $tab[$i][$j]["size"]="40"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='info'; + } + } + } +} + +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($value == 'column' and $tab[$i][$j][$value]=='event_type') + { + $val = $core_tools2->is_var_in_history_keywords_tab($tab[$i][$j]['event_type']); + $tab[$i][$j]['value'] = $val; + } + } + } +} + + +$nb =count($tab); +?> +<h1><img src="<?php echo $_SESSION['config']['img'].'/view_history_b.gif' ;?>" alt="" /> <?php echo _HISTORY_TITLE.' : '. $nb.' '._RESULTS; ?></h1> +<div id="inner_content"> +<?php + +$list->admin_list($tab, $nb, '', 'id','history','history','id', true, '', '', '', '', '', '', TRUE, FALSE, '', '', '', false, false); + +?> +<br/> +<div id="search_hist" class="block" > +<form name="frm_search_hist" id ="frm_search_hist" action="<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=history&admin=history" method="post" class="form"> +<input type="hidden" name="page" value="history"/> +<input type="hidden" name="admin" value="history" /> +<table border="0" width="99%" class="forms"> + <tr > + <td width="33%"> + <p><label><?php echo _ACTIONS;?> :</label> + <select name="action" id="action"> + <option value=""><?php echo _CHOOSE_ACTION;?></option> + <?php for($i=0; $i<count($_SESSION['history_keywords']);$i++) + {?> + <option value="<?php echo $_SESSION['history_keywords'][$i]['id'];?>" <?php if($history_action== $_SESSION['history_keywords'][$i]['id']) {echo 'selected="selected"';}?>><?php echo $_SESSION['history_keywords'][$i]['label'];?></option> + <?php } ?> + </select></p> + </td> + <td width="33%"> + <p><label><?php echo _MODULES;?> :</label> + <select name="module" id="module"> + <option value=""><?php echo _CHOOSE_MODULE;?></option> + <?php for($i=0; $i<count($modules);$i++) + {?> + <option value="<?php echo $modules[$i]['id'];?>" <?php if($history_module== $modules[$i]['id']) {echo 'selected="selected"';}?>><?php echo $modules[$i]['label'];?></option> + <?php } ?> + </select></p> + </td> + <td width="33%"> + <p> <label><?php echo _USER;?> :</label> + <input type="text" name="user" id="user" value="<?php if(isset($history_user)){ echo $history_user;}?>" /><div id="show_user" class="autocomplete"></div> + </p> + </td> + </tr> +</table> +<table border="0" width="99%" class="forms"> +<tr> +<td > + <p><span ><?php echo _SINCE;?> :</span> <input name="datestart" type="text" id="datestart" onclick='showCalender(this);' value="<?php if(isset($history_datestart)){echo $history_datestart;}?>" /> + </p> +</td> +<td colspan="2"> + <p> + <span ><?php echo _FOR;?> :</span> <input name="datefin" type="text" id="datefin" onclick="showCalender(this);" value="<?php if(isset($history_datefin)){echo $history_datefin;}?>" /> +</p> +</td> +</tr> +<tr> + <td colspan="2" align="left"> + <p > + <input type="submit" name="search" value="<?php echo _SEARCH;?>" class="button" /> + <!--<input class="button" name="clear" type="button" value="<?php echo _CLEAR_FORM;?>" onclick="clear_form('frm_search_hist');this.form.submit();" />--> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=admin';"/> + </p> + </td> + <td align="right"><a href="#" onclick="clear_form('frm_search_hist');$('frm_search_hist').submit();"><img src="<?php echo $_SESSION['config']['businessappurl']."img/reset.gif";?>" alt="<?php echo _CLEAR_FORM;?>" /> <?php echo _CLEAR_FORM; ?></a></td> +</tr> +</table> +</form> +</div> +<div class="block_end"> </div> +<br/> +</div> +<script type="text/javascript">launch_autocompleter('<?php echo $_SESSION['config']['businessappurl'];?>users_autocomplete_list.php', 'user', 'show_user');</script> diff --git a/maarch_entreprise/trunk/admin/history/select_user.php b/maarch_entreprise/trunk/admin/history/select_user.php new file mode 100644 index 0000000000000000000000000000000000000000..988fb865436d869c721b89e989e0f0c88b601c9a --- /dev/null +++ b/maarch_entreprise/trunk/admin/history/select_user.php @@ -0,0 +1,145 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Pop up to select a user (used in history.php) +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); + +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$func = new functions(); + +$what = "all"; +$where = ""; +$_SESSION['chosen_user'] = ''; +if(isset($_GET['what']) && !empty($_GET['what'])) +{ + if($_GET['what'] == "all") + { + $what = "all"; + + } + else + { + $what = addslashes($func->wash($_GET['what'], "no", "", "no")); + $where = "(".$_SESSION['tablename']['users'].".lastname like '".strtolower($what)."%' or ".$_SESSION['tablename']['users'].".lastname like '".strtoupper($what)."%') "; + } +} + $db = new dbquery(); + $db->connect(); + + $select[$_SESSION['tablename']['users']] = array(); + array_push($select[$_SESSION['tablename']['users']],"user_id","lastname","firstname" ); + + $req = new request(); + + $tab = $req->select($select, $where, " order by ".$_SESSION['tablename']['users'].".lastname desc", $_SESSION['config']['databasetype'], $limit="500",false); + +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + + + if($tab[$i][$j][$value]== "user_id" ) + { + $tab[$i][$j]["user_id"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + } + + if($tab[$i][$j][$value]=='lastname') + { + $tab[$i][$j]['value']= $req->show_string($tab[$i][$j]['value']); + $tab[$i][$j]['lastname']= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_LASTNAME; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + } + if($tab[$i][$j][$value]=="firstname") + { + $tab[$i][$j]['value']= $req->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["info"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_FIRSTNAME; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + } + } + } + } + if(isset($_REQUEST['field']) && !empty($_REQUEST['field'])) + { + $_SESSION['chosen_user'] = $_REQUEST['field']; + + ?> + <script language="javascript"> + var tmp = window.opener.$('user'); + tmp.value = '<?php echo $_SESSION['chosen_user'];?>'; + self.close(); + </script> + <?php + exit(); + } + +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(_CHOOSE_USER2); +$time = $core_tools->get_session_time_expire(); +?> +<body onLoad="javascript:setTimeout(window.close, <?php echo $time;?>*60*1000);"> +<div class="popup_content"> +<?php +$nb = count($tab); + +$list=new list_show(); +$list->list_doc($tab, $nb, _USERS_LIST,'user_id', "select_user",'user_id','',false,true,'get',$_SESSION['config']['businessappurl'].'admin/history/select_user.php',_CHOOSE_USER2, false, false, false,false, true, true, true, false, '', '', true, _ALL_USERS,_USER); + ?> +</div> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/history_batch/history_batch.php b/maarch_entreprise/trunk/admin/history_batch/history_batch.php new file mode 100644 index 0000000000000000000000000000000000000000..aa5d1acdc66c8a9199fee6ebf00d62cc03cca100 --- /dev/null +++ b/maarch_entreprise/trunk/admin/history_batch/history_batch.php @@ -0,0 +1,262 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$core_tools2 = new core_tools(); +$core_tools2->test_admin('view_history_batch', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=history_batch&admin=history_batch'; +$page_label = _VIEW_HISTORY_BATCH2; +$page_id = "history_batch"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +$db = new dbquery(); +$db->connect(); +$where = ''; +$label = ''; +$tab = array(); +$modules = array(); +$db->query("select DISTINCT module_name from ".$_SESSION['tablename']['history_batch']); +while($res = $db->fetch_object()) +{ + if($res->module_name == 'admin') + { + array_push($modules, array('id' => 'admin', 'label' => _ADMIN)); + } + elseif(isset($_SESSION['modules_loaded'][$res->module_name]['comment']) && !empty($_SESSION['modules_loaded'][$res->module_name]['comment'])) + { + array_push($modules, array('id' => $res->module_name, 'label' => $_SESSION['modules_loaded'][$res->module_name]['comment'])); + } + else + { + array_push($modules, array('id' => $res->module_name, 'label' => $res->module_name)); + } +} +if($_REQUEST['search'] || + (!empty($_SESSION['m_admin']['history_batch_action'])&& isset($_SESSION['m_admin']['history_batch_action'])) + || (!empty($_SESSION['m_admin']['history_batch_module'])&& isset($_SESSION['m_admin']['history_batch_module'])) + || (!empty($_SESSION['m_admin']['onlyerrors'])&& isset($_SESSION['m_admin']['onlyerrors'])) + || (isset($_REQUEST['datestart']) && !empty($_REQUEST['datestart'])) + || (isset($_REQUEST['dateend']) && !empty($_REQUEST['dateend'])) + ) +{ + $pattern = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; + if((isset($_REQUEST['module']) && !empty($_REQUEST['module'])) || (!empty($_SESSION['m_admin']['history_batch_module'])&& isset($_SESSION['m_admin']['history_batch_module']))) + { + if(isset($_REQUEST['module']) && !empty($_REQUEST['module'])) + { + $_SESSION['m_admin']['history_batch_module'] = $_REQUEST['module']; + } + $where .= " ".$_SESSION['tablename']['history_batch'].".module_name = '".$_SESSION['m_admin']['history_batch_module']."' and"; + $_SESSION['m_admin']['history_batch_module'] = ""; + } + if((isset($_REQUEST['onlyerrors']) && !empty($_REQUEST['onlyerrors'])) || (!empty($_SESSION['m_admin']['onlyerrors'])&& isset($_SESSION['m_admin']['onlyerrors']))) + { + if(isset($_REQUEST['onlyerrors']) && !empty($_REQUEST['onlyerrors'])) + { + $_SESSION['m_admin']['onlyerrors'] = $_REQUEST['onlyerrors']; + } + if($_REQUEST['onlyerrors'] == "yes") + { + $where .= " ".$_SESSION['tablename']['history_batch'].".total_errors > 0 and"; + } + $_SESSION['m_admin']['onlyerrors'] = ""; + } + if((isset($_REQUEST['datestart']) && !empty($_REQUEST['datestart']))|| (!empty($_SESSION['m_admin']['history_batch_datestart'])&& isset($_SESSION['m_admin']['history_batch_datestart'])) ) + { + if( preg_match($pattern,$_REQUEST['datestart'])==false && (!isset($_SESSION['m_admin']['history_batch_datestart']) || empty($_SESSION['m_admin']['history_batch_datestart']))) + { + $_SESSION['error'] = _DATE.' '._WRONG_FORMAT; + } + else + { + if(isset($_REQUEST['datestart']) && !empty($_REQUEST['datestart'])) + { + $_SESSION['m_admin']['history_batch_datestart'] = $core_tools2->format_date_db($_REQUEST['datestart']); + } + $where .= " (".$_SESSION['tablename']['history_batch'].".event_date >= '".$_SESSION['m_admin']['history_batch_datestart']."') and "; + $_SESSION['m_admin']['history_batch_datestart'] = ""; + } + } + if((isset($_REQUEST['dateend']) && !empty($_REQUEST['dateend']))|| (!empty($_SESSION['m_admin']['history_batch_dateend'])&& isset($_SESSION['m_admin']['history_batch_dateend'])) ) + { + if( preg_match($pattern,$_REQUEST['dateend'])==false && (!isset($_SESSION['m_admin']['history_batch_dateend']) || empty($_SESSION['m_admin']['history_batch_dateend'])) ) + { + $_SESSION['error'] = _DATE.' '._WRONG_FORMAT; + } + else + { + if(isset($_REQUEST['dateend']) && !empty($_REQUEST['dateend'])) + { + $_SESSION['m_admin']['history_batch_dateend'] = $core_tools2->format_date_db($_REQUEST['dateend']); + } + $where .= " ( ".$_SESSION['tablename']['history_batch'].".event_date <= '".$_SESSION['m_admin']['history_batch_dateend']."') and "; + $_SESSION['m_admin']['history_batch_dateend'] = ""; + } + } + $where = trim($where); + $where = preg_replace('/and$/', '', $where); +} +$select[$_SESSION['tablename']['history_batch']] = array(); +array_push($select[$_SESSION['tablename']['history_batch']],"id", "event_date", "batch_id", "module_name", "total_processed", "total_errors", "info" ); + +$list = new list_show(); +$order = 'desc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'event_date'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$req = new request(); +$tab = $req->select($select, $where, $orderstr, $_SESSION['config']['databasetype'], $limit="500",false,$_SESSION['tablename']['history_batch']); +//$req->show(); +for($i=0;$i<count($tab);$i++) +{ + for($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="id") + { + $tab[$i][$j]["id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["show"]=false; + } + if($tab[$i][$j][$value]=="event_date") + { + $tab[$i][$j]["event_date"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_DATE; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='event_date'; + } + if($tab[$i][$j][$value]=="module_name") + { + $tab[$i][$j]["batch_id"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_BATCH_NAME; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='module_name'; + } + if($tab[$i][$j][$value]=="batch_id") + { + $tab[$i][$j]["batch_id"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_BATCH_ID; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='batch_id'; + } + if($tab[$i][$j][$value]=='total_processed') + { + $tab[$i][$j]['value']= $tab[$i][$j]['value']; + $tab[$i][$j]['total_processed']= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_TOTAL_PROCESSED; + $tab[$i][$j]["size"]="8"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='total_processed'; + } + if($tab[$i][$j][$value]=='total_errors') + { + $tab[$i][$j]['value']= $tab[$i][$j]['value']; + $tab[$i][$j]['total_processed']= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_TOTAL_ERRORS; + $tab[$i][$j]["size"]="8"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='total_errors'; + } + if($tab[$i][$j][$value]=="info") + { + $tab[$i][$j]['value']= $this->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["info"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_INFOS; + $tab[$i][$j]["size"]="40"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='info'; + } + } + } +} +$list = new list_show(); +$nb =count($tab); +?> +<h1><img src="<?php echo $_SESSION['config']['img'].'/view_history_b.gif' ;?>" alt="" /> <?php echo _HISTORY_BATCH_TITLE.' : '. $nb.' '._RESULTS; ?></h1> +<div id="inner_content"> +<?php +$list->admin_list($tab, $nb, '', 'id','history_batch','history_batch','id', true, '', '', '', '', '', '', TRUE, FALSE, '', '', '', false, false); +?> +<br/> +<div id="search_hist" class="block"> + <form name="search_hist" action="<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=history_batch&admin=history_batch" method="post" class="forms"> + <input type="hidden" name="page" value="history_batch"/> + <input type="hidden" name="admin" value="history_batch" /> + <p> + <label for="module"><?php echo _BATCH_NAME;?> :</label> + <select name="module"> + <option value=""><?php echo _CHOOSE_BATCH;?></option> + <?php + for($i=0;$i<count($modules);$i++) + { + ?> + <option value="<?php echo $modules[$i]['id'];?>"><?php echo $modules[$i]['label'];?></option> + <?php + } + ?> + </select> + </p> + <p> + <label for="datestart"><?php echo _SINCE;?> :</label> + <input name="datestart" type="text" id="datestart" onclick='showCalender(this);'/> + </p> + <p> + <label for="dateend"><?php echo _FOR;?> :</label> + <input name="dateend" type="text" id="dateend" onclick="showCalender(this);"/> + </p> + <p> + <label for="onlyerrors"><?php echo _ONLY_ERRORS;?> :</label> + <?php echo _YES;?><input name="onlyerrors" class="check" type="radio" id="onlyerrors" value="yes" checked="checked"/> + <?php echo _NO;?><input name="onlyerrors" class="check" type="radio" id="onlyerrors" value="no"/> + </p> + <p class="button"> + <input type="submit" name="search" value="<?php echo _SEARCH;?>" class="button"/> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=admin';"/> + </p> + </form> +</div> +<div class="block_end"> </div> + <br/> +</div> diff --git a/maarch_entreprise/trunk/admin/maarch_config_tool/generate_map.bat b/maarch_entreprise/trunk/admin/maarch_config_tool/generate_map.bat new file mode 100644 index 0000000000000000000000000000000000000000..1b1a5ad7670656919682c3a4a14a57aad939cc06 --- /dev/null +++ b/maarch_entreprise/trunk/admin/maarch_config_tool/generate_map.bat @@ -0,0 +1,4 @@ +cls +cd "C:\xampp\php" +php C:\xampp\htdocs\letterbox_v3\apps\maarch_letterbox\admin\maarch_config_tool\generate_map_of_maarch_config.php C:\xampp\htdocs\letterbox_v3\apps\maarch_letterbox\xml\config.xml C:\xampp\htdocs\letterbox_v3\ +C: \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/maarch_config_tool/generate_map_of_maarch_config.php b/maarch_entreprise/trunk/admin/maarch_config_tool/generate_map_of_maarch_config.php new file mode 100644 index 0000000000000000000000000000000000000000..f9ab0c075ee63b95c94a0a16972bd7c21dc559a5 --- /dev/null +++ b/maarch_entreprise/trunk/admin/maarch_config_tool/generate_map_of_maarch_config.php @@ -0,0 +1,436 @@ +<?php +/** +* File : generate_map_of_maarch_config.php +* +* +* @package Maarch v3 +* @version 3.0 +* @since 06/2006 +* @license GPL +* @author Laurent Giovannoni <dev@maarch.org> +*/ +session_name('maarch_v3'); +session_start(); +$_SESSION['modules_calling_scripts'] = array(); +$_SESSION['apps_calling_scripts'] = array(); +function create_reports_file_php($report_text) +{ + $modules_services = $_SESSION['config']['businessapppath'].$_SESSION['slash_env']."admin".$_SESSION['slash_env']."maarch_config_tool".$_SESSION['slash_env']."modules_services_config.php"; + echo $modules_services; + if(file_exists($modules_services)) + { + if(file_exists($modules_services.'_old')) + { + unlink ($modules_services."_old"); + } + rename($modules_services, $modules_services.'_old'); + } + $modules_services_opened = fopen($modules_services, "a"); + fwrite($modules_services_opened, $report_text); + fclose($modules_services_opened); +} + +function create_reports_file_html($report_text) +{ + $modules_services = $_SESSION['config']['businessapppath'].$_SESSION['slash_env']."admin".$_SESSION['slash_env']."maarch_config_tool".$_SESSION['slash_env']."modules_services_config.html"; + echo $modules_services; + if(file_exists($modules_services)) + { + if(file_exists($modules_services.'_old')) + { + unlink ($modules_services."_old"); + } + rename($modules_services, $modules_services.'_old'); + } + $modules_services_opened = fopen($modules_services, "a"); + fwrite($modules_services_opened, $report_text); + fclose($modules_services_opened); +} + +function load_calling_scripts_of_apps_services($app_services) +{ + $count_calling_script = 0; + for($i=0;$i<count($app_services);$i++) + { + for($k=0;$k<count($app_services[$i]['whereamiused']);$k++) + { + $_SESSION['apps_calling_scripts'][$count_calling_script] = str_replace("index.php?page=", "", $app_services[$i]['whereamiused'][$k]['page']); + $count_calling_script++; + } + for($k=0;$k<count($app_services[$i]['processinbackground']);$k++) + { + $_SESSION['apps_calling_scripts'][$count_calling_script] = str_replace("index.php?page=", "", $app_services[$i]['processinbackground'][$k]['page']); + $count_calling_script++; + } + } + $_SESSION['apps_calling_scripts'] = array_unique($_SESSION['apps_calling_scripts']); + sort($_SESSION['apps_calling_scripts']); +} + +function load_calling_scripts_of_modules_services($modules_services) +{ + $count_calling_script = 0; + foreach(array_keys($modules_services) as $value) + { + for($i=0;$i<count($modules_services[$value]);$i++) + { + for($k=0;$k<count($modules_services[$value][$i]['whereamiused']);$k++) + { + $_SESSION['modules_calling_scripts'][$count_calling_script] = str_replace("index.php?page=", "", $modules_services[$value][$i]['whereamiused'][$k]['page']); + $count_calling_script++; + } + for($k=0;$k<count($modules_services[$value][$i]['processinbackground']);$k++) + { + $_SESSION['modules_calling_scripts'][$count_calling_script] = str_replace("index.php?page=", "", $modules_services[$value][$i]['processinbackground'][$k]['page']); + $count_calling_script++; + } + } + } + $_SESSION['modules_calling_scripts'] = array_unique($_SESSION['modules_calling_scripts']); + sort($_SESSION['modules_calling_scripts']); +} + +function load_service_config_of_calling_scripts_modules($modules_services, $whereami, $report_modules_text) +{ + echo "\n\n**************************".$whereami."****************************\n\n"; + $report_modules_text .= "<table border='1' width='800px' style='background-color:#a9dbd8;'>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td align='center' style='color:#007583;'><b>".$whereami."</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + foreach(array_keys($modules_services) as $value) + { + for($i=0;$i<count($modules_services[$value]);$i++) + { + for($k=0;$k<count($modules_services[$value][$i]['whereamiused']);$k++) + { + if($modules_services[$value][$i]['whereamiused'][$k]['page'] == $whereami || $modules_services[$value][$i]['whereamiused'][$k]['page'] == "index.php?page=".$whereami) + { + $report_modules_text .= "<table border='1' width='800px'>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160' style='color:blue;'><b>service id</b></td>"; + $report_modules_text .= "<td width='160' style='color:blue;'><b>type</b></td>"; + $report_modules_text .= "<td width='160' style='color:blue;'><b>nature</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td>".$modules_services[$value][$i]['id']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['servicetype']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['nature']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "\nservice id : ".$modules_services[$value][$i]['id']."\n"; + echo "type : ".$modules_services[$value][$i]['servicetype']."\n"; + echo "nature : ".$modules_services[$value][$i]['whereamiused'][$k]['nature']."\n"; + if($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "frame") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame width</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame height</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame border</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame scrolling</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame src</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['width']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['height']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['border']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['scrolling']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['servicepage']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "frame width : ".$modules_services[$value][$i]['whereamiused'][$k]['width']."\n"; + echo "frame height : ".$modules_services[$value][$i]['whereamiused'][$k]['height']."\n"; + echo "frame border : ".$modules_services[$value][$i]['whereamiused'][$k]['border']."\n"; + echo "frame scrolling : ".$modules_services[$value][$i]['whereamiused'][$k]['scrolling']."\n"; + echo "frame src : ".$value."/".$modules_services[$value][$i]['servicepage']."\n"; + } + if($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "tab") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>tab order</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>tab label</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>tab src</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['tab_order']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['tab_label']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['servicepage']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "tab order : ".$modules_services[$value][$i]['whereamiused'][$k]['tab_order']."\n"; + echo "tab label : ".$modules_services[$value][$i]['whereamiused'][$k]['tab_label']."\n"; + echo "tab src : ".$value."/".$modules_services[$value][$i]['servicepage']."\n"; + } + if($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "popup") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160'><b>popup link</b></td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['servicepage']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "popup link : ".$value."/".$modules_services[$value][$i]['servicepage']."\n"; + } + if($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "button") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>button link</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>page width</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>page height</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['servicepage']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['width']."</td>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['whereamiused'][$k]['height']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "button link : ".$value."/".$modules_services[$value][$i]['servicepage']."\n"; + echo "page width : ".$modules_services[$value][$i]['whereamiused'][$k]['width']."\n"; + echo "page height : ".$modules_services[$value][$i]['whereamiused'][$k]['height']."\n"; + } + if($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "include") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>include link</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160'>".$modules_services[$value][$i]['servicepage']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "include link : ".$value."/".$modules_services[$value][$i]['servicepage']."\n"; + } + if($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "listelement") + { + // + } + } + } + for($k=0;$k<count($modules_services[$value][$i]['processinbackground']);$k++) + { + if($modules_services[$value][$i]['processinbackground'][$k]['page'] == $whereami || $modules_services[$value][$i]['processinbackground'][$k]['page'] == "index.php?page=".$whereami) + { + $report_modules_text .= "<table border='1' width='800px'>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='50' style='color:brown;'><b>processorder</b></td>"; + $report_modules_text .= "<td width='300' style='color:brown;'><b>preprocess</b></td>"; + $report_modules_text .= "<td width='300' style='color:brown;'><b>postprocess</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='50'>".$modules_services[$value][$i]['processinbackground'][$k]['processorder']."</td>"; + $report_modules_text .= "<td width='300'>".$modules_services[$value][$i]['processinbackground'][$k]['preprocess']."</td>"; + $report_modules_text .= "<td width='300'>".$modules_services[$value][$i]['processinbackground'][$k]['postprocess']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "\nprocessorder : ".$modules_services[$value][$i]['processinbackground'][$k]['processorder']."\n"; + echo "preprocess : ".$modules_services[$value][$i]['processinbackground'][$k]['preprocess']."\n"; + echo "postprocess : ".$modules_services[$value][$i]['processinbackground'][$k]['postprocess']."\n"; + } + } + } + } + $report_modules_text .= "</table><br><br><br>"; + return $report_modules_text; +} + +function load_service_config_of_calling_scripts_apps($apps_services, $whereami, $report_modules_text) +{ + echo "\n\n**************************".$whereami."****************************\n\n"; + $report_modules_text .= "<table border='1' width='800px' style='background-color:#a9dbd8;'>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td align='center' style='color:#007583;'><b>".$whereami."</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + for($i=0;$i<count($apps_services);$i++) + { + for($k=0;$k<count($apps_services[$i]['whereamiused']);$k++) + { + if($apps_services[$i]['whereamiused'][$k]['page'] == $whereami || $apps_services[$i]['whereamiused'][$k]['page'] == "index.php?page=".$whereami) + { + $report_modules_text .= "<table border='1' width='800px'>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160' style='color:blue;'><b>service id</b></td>"; + $report_modules_text .= "<td width='160' style='color:blue;'><b>type</b></td>"; + $report_modules_text .= "<td width='160' style='color:blue;'><b>nature</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td>".$apps_services[$i]['id']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['servicetype']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['nature']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "\nservice id : ".$apps_services[$i]['id']."\n"; + echo "type : ".$apps_services[$i]['servicetype']."\n"; + echo "nature : ".$apps_services[$i]['whereamiused'][$k]['nature']."\n"; + if($apps_services[$i]['whereamiused'][$k]['nature'] == "frame") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame width</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame height</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame border</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame scrolling</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>frame src</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['width']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['height']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['border']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['scrolling']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['servicepage']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "frame width : ".$apps_services[$i]['whereamiused'][$k]['width']."\n"; + echo "frame height : ".$apps_services[$i]['whereamiused'][$k]['height']."\n"; + echo "frame border : ".$apps_services[$i]['whereamiused'][$k]['border']."\n"; + echo "frame scrolling : ".$apps_services[$i]['whereamiused'][$k]['scrolling']."\n"; + echo "frame src : ".$value."/".$apps_services[$i]['servicepage']."\n"; + } + if($apps_services[$i]['whereamiused'][$k]['nature'] == "tab") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>tab order</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>tab label</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>tab src</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['tab_order']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['tab_label']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['servicepage']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "tab order : ".$apps_services[$i]['whereamiused'][$k]['tab_order']."\n"; + echo "tab label : ".$apps_services[$i]['whereamiused'][$k]['tab_label']."\n"; + echo "tab src : ".$value."/".$apps_services[$i]['servicepage']."\n"; + } + if($apps_services[$i]['whereamiused'][$k]['nature'] == "popup") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160'><b>popup link</b></td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['servicepage']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "popup link : ".$value."/".$apps_services[$i]['servicepage']."\n"; + } + if($apps_services[$i]['whereamiused'][$k]['nature'] == "button") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>button link</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>page width</b></td>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>page height</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['servicepage']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['width']."</td>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['whereamiused'][$k]['height']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "button link : ".$value."/".$apps_services[$i]['servicepage']."\n"; + echo "page width : ".$apps_services[$i]['whereamiused'][$k]['width']."\n"; + echo "page height : ".$apps_services[$i]['whereamiused'][$k]['height']."\n"; + } + if($apps_services[$i]['whereamiused'][$k]['nature'] == "include") + { + $report_modules_text .= "<table border='1' width='800px'><tr>"; + $report_modules_text .= "<td width='160' style='color:green;'><b>include link</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='160'>".$apps_services[$i]['servicepage']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "include link : ".$value."/".$apps_services[$i]['servicepage']."\n"; + } + if($apps_services[$i]['whereamiused'][$k]['nature'] == "listelement") + { + // + } + } + } + for($k=0;$k<count($apps_services[$i]['processinbackground']);$k++) + { + if($apps_services[$i]['processinbackground'][$k]['page'] == $whereami || $apps_services[$i]['processinbackground'][$k]['page'] == "index.php?page=".$whereami) + { + $report_modules_text .= "<table border='1' width='800px'>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='50' style='color:brown;'><b>processorder</b></td>"; + $report_modules_text .= "<td width='300' style='color:brown;'><b>preprocess</b></td>"; + $report_modules_text .= "<td width='300' style='color:brown;'><b>postprocess</b></td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "<tr>"; + $report_modules_text .= "<td width='50'>".$apps_services[$i]['processinbackground'][$k]['processorder']."</td>"; + $report_modules_text .= "<td width='300'>".$apps_services[$i]['processinbackground'][$k]['preprocess']."</td>"; + $report_modules_text .= "<td width='300'>".$apps_services[$i]['processinbackground'][$k]['postprocess']."</td>"; + $report_modules_text .= "</tr>"; + $report_modules_text .= "</table>"; + echo "\nprocessorder : ".$apps_services[$i]['processinbackground'][$k]['processorder']."\n"; + echo "preprocess : ".$apps_services[$i]['processinbackground'][$k]['preprocess']."\n"; + echo "postprocess : ".$apps_services[$i]['processinbackground'][$k]['postprocess']."\n"; + } + } + } + $report_modules_text .= "</table><br><br><br>"; + return $report_modules_text; +} + +$conf = $argv[1]; +$path_server = $argv[2]; +$xmlconfig = simplexml_load_file($conf); +$CONFIG = $xmlconfig->CONFIG; +$_SESSION['config']['businessapppath'] = (string) $CONFIG->businessapppath; +$_SESSION['config']['businessappurl'] = (string) $CONFIG->businessappurl; +$_SESSION['config']['img'] = (string) $CONFIG->img; +$_SESSION['config']['lang'] = (string) $CONFIG->lang; +$i=0; +foreach($xmlconfig->MODULES as $MODULES) +{ + $_SESSION['modules'][$i] = array("moduleid" => (string) $MODULES->moduleid); + $i++; +} +if(strtoupper(substr(PHP_OS, 0, 3)) != "WIN" && strtoupper(substr(PHP_OS, 0, 3)) != "WINNT") +{ + $_SESSION['slash_env'] = "/"; +} +else +{ + $_SESSION['slash_env'] = "\\"; +} +if(!preg_match("/[/\\]$/",$path_server)) +{ + $path_server = $path_server.$_SESSION['slash_env']; +} +$_SESSION['history_keywords'] = array(); +$_SESSION['pathtocore'] = $path_server.$_SESSION['slash_env']."core".$_SESSION['slash_env']; +$_SESSION['pathtocoreclass'] = $path_server.$_SESSION['slash_env']."core".$_SESSION['slash_env']."class".$_SESSION['slash_env']; +$_SESSION['pathtomodules'] = $path_server.$_SESSION['slash_env']."modules".$_SESSION['slash_env']; +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$core_tools = new core_tools(); +$core_tools->load_app_services(); +$core_tools->load_modules_config($_SESSION['modules'], true); +$core_tools->load_modules_services($_SESSION['modules']); +$core_tools->load_lang(); +//$core_tools->show_array($_SESSION['config']); +//$core_tools->show_array($_SESSION['modules']); +//$core_tools->show_array($_SESSION['app_services']); +//$core_tools->show_array($_SESSION['modules_services']); +load_calling_scripts_of_modules_services($_SESSION['modules_services']); +//$core_tools->show_array($_SESSION['modules_calling_scripts']); +$report_modules_text = "<h1><img src='".$_SESSION['config']['businessappurl'].$_SESSION['config']['img']."/picto_admin_b.gif' alt='' />"._XML_PARAM_SERVICE."</h1><div id='inner_content' class='clearfix'>"; +$report_modules_text .= "<center><h3>"._MODULES_SERVICES."</h3></center><br>"; +for($i=0;$i<count($_SESSION['modules_calling_scripts']);$i++) +{ + $report_modules_text = load_service_config_of_calling_scripts_modules($_SESSION['modules_services'], $_SESSION['modules_calling_scripts'][$i], $report_modules_text); +} +$report_modules_text .= "<center><h3>"._APPS_SERVICES."</h3></center><br>"; +load_calling_scripts_of_apps_services($_SESSION['app_services']); +$core_tools->show_array($_SESSION['apps_calling_scripts']); +for($i=0;$i<count($_SESSION['apps_calling_scripts']);$i++) +{ + $report_modules_text = load_service_config_of_calling_scripts_apps($_SESSION['app_services'], $_SESSION['apps_calling_scripts'][$i], $report_modules_text); +} +$report_modules_text .= "</div>"; +create_reports_file_php($report_modules_text); +create_reports_file_html($report_modules_text); +exit; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.html b/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.html new file mode 100644 index 0000000000000000000000000000000000000000..c77a0927d05a4d65d4524c431b6f98ff6c74b80f --- /dev/null +++ b/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.html @@ -0,0 +1 @@ +<h1><img src='img/picto_admin_b.gif' alt='' />Visualisation configuration XML des services</h1><div id='inner_content' class='clearfix'><center><h3>Services définis par les modules</h3></center><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>add_batch.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>1</td><td width='160'>Dossier</td><td width='160'>select_folder.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>_print_sep</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>3</td><td width='160'>Impression du séparateur</td><td width='160'>print_sep.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_apa</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_baskets</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_entities</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_foldertypes</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_templates</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin_templates</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>basket_add.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>load_entities_session</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>load_entities_session.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>basket_up.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>load_entities_session</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>load_entities_session.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>batchs</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_batch_read</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>400</td><td width='160'>0</td><td width='160'>no</td><td width='160'>frame_batch_read.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_batch_manage</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>400</td><td width='160'>210</td><td width='160'>1</td><td width='160'>no</td><td width='160'>manage_batchs.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>boxes</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_box_read</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>400</td><td width='160'>0</td><td width='160'>no</td><td width='160'>frame_boxes_read.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_box_manage</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>210</td><td width='160'>1</td><td width='160'>no</td><td width='160'>manage_boxes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>change_doctype.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>doctype_template_use</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>doctype_template_use.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>class_admin_apa.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>choose_site</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>30</td><td width='160'>0</td><td width='160'></td><td width='160'>choose_site.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>class_admin_natures.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>choose_entity</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>20</td><td width='160'>0</td><td width='160'></td><td width='160'>choose_entity.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>class_admin_sites.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>choose_entity</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>20</td><td width='160'>0</td><td width='160'></td><td width='160'>choose_entity.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details_documents.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>use_alerts_on_doc</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>use_alerts_on_doc.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_attachments</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>view_attachments.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details_invoices.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>use_alerts_on_doc</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>use_alerts_on_doc.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_attachments</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>view_attachments.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_notes_doc</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>notes_doc.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_del</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_info</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_load_db</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_up</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>file_index.php</b></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>1</td><td width='300'>select_folder_result_preprocess.php</td><td width='300'>select_folder_result_postprocess.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>formuser</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>groupbasket_popup.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_redirect_action</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_redirect_entities.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_index_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_index_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>index_documents.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>1</td><td width='160'>Dossier</td><td width='160'>select_folder.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_missing_doc_in_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>4</td><td width='160'>Pièces manquantes</td><td width='160'>missing_res.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_history_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>5</td><td width='160'>Historique dossier</td><td width='160'>folder_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>index_file.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>attach_doc_indexing</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>attach_doc_indexing.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>load_groupbasket</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_redirect_action</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_redirect_entities.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_index_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_index_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>load_groupbasket_db</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_redirect_action</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_redirect_entities.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_index_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_index_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>manage_group_basket.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_redirect_action</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_redirect_entities.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_index_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_index_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>modify_user.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>myprofile_abs</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>include_user_abs_myprofile.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>process_frame.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_attachments</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>manage_attachments.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_folder</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>use_alerts_on_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>use_alerts_on_folder.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>show_folder</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_missing_doc_in_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>missing_res.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_history_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>folder_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>template_info</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>template_up.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>templates.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>load_entities_session</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>load_entities_session.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>uptemplate</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>user_check</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>user_up_init</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>users_add_db.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>users_list_init</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>users_up.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>user_admin_abs</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>include_user_abs_adminuser.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>users_up_db.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>view_folder</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_folder</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>welcome</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>display_basket_list</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>display_basket_list.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>welcome.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_notes_list</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>show_notes_list.php</td></tr></table></table><br><br><br><center><h3>Services définis par l’application</h3></center><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_users</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_groups</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_architecture</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_history</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_history_batch</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>xml_param_services</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_actions</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin/admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_status</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_del</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_mlb_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_mlb_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_info</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_mlb_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_mlb_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_load_db</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_mlb_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_mlb_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_up</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_mlb_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_mlb_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_contract_history</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>400</td><td width='160'>100</td><td width='160'>0</td><td width='160'>auto</td><td width='160'>contract_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>welcome.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>quicklaunch</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>quicklaunch.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>welcome_text_load</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>welcome_text_load.php</td></tr></table></table><br><br><br></div> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.html_old b/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.html_old new file mode 100644 index 0000000000000000000000000000000000000000..2e08f5b497fa5c37a77669ab440d0746b8036723 --- /dev/null +++ b/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.html_old @@ -0,0 +1 @@ +<h1><img src='http://127.0.0.1/maarch_v3/apps/maarch_sample/img/picto_admin_b.gif' alt='' />Visualisation configuration XML des services</h1><div id='inner_content' class='clearfix'><center><h3>Services définis par les modules</h3></center><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>add_batch.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_doctype_for_pa</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>2</td><td width='160'>Type de document</td><td width='160'>select_types_for_pa.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>1</td><td width='160'>Dossier</td><td width='160'>select_folder.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>_print_sep</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>3</td><td width='160'>Impression du séparateur</td><td width='160'>print_sep.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_foldertypes</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_workflow</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_baskets</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_tree_autofoldering</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>batchs</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_batch_read</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>400</td><td width='160'>0</td><td width='160'>no</td><td width='160'>frame_batch_read.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_batch_manage</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>400</td><td width='160'>210</td><td width='160'>1</td><td width='160'>no</td><td width='160'>manage_batchs.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>boxes</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_box_read</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>400</td><td width='160'>0</td><td width='160'>no</td><td width='160'>frame_boxes_read.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_box_manage</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>210</td><td width='160'>1</td><td width='160'>no</td><td width='160'>manage_boxes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_res</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_file_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details_documents.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_attached_files</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>managing_answers.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details_invoices.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_attached_files</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>managing_answers.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_notes_doc</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>notes_doc.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>file_index.php</b></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>2</td><td width='300'>res_type_result_preprocess.php</td><td width='300'></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>1</td><td width='300'>select_folder_result_preprocess.php</td><td width='300'>select_folder_result_postprocess.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>file_index2.php</b></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>1</td><td width='300'>res_type2_result_preprocess.php</td><td width='300'></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>2</td><td width='300'></td><td width='300'>launch_workflow_postprocess.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>index_documents.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_doctype</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>2</td><td width='160'>Type de document</td><td width='160'>select_type.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>index_file</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>3</td><td width='160'>Index</td><td width='160'>res_type.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>1</td><td width='160'>Dossier</td><td width='160'>select_folder.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_missing_doc_in_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>4</td><td width='160'>Pièces manquantes</td><td width='160'>missing_res.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_history_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>5</td><td width='160'>Historique dossier</td><td width='160'>folder_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>index_invoices.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_doctype2</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>50</td><td width='160'>0</td><td width='160'>no</td><td width='160'>select_type2.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>index_file2</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>430</td><td width='160'>0</td><td width='160'>auto</td><td width='160'>res_type2.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>res_type2.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>launch_workflow</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>20</td><td width='160'>0</td><td width='160'></td><td width='160'>launch_workflow.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_folder</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>show_folder</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_missing_doc_in_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>missing_res.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_history_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>folder_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>view_folder</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_res</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_file_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_folder</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><center><h3>Services définis par l’application</h3></center><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_users</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_groups</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_architecture</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_history</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>xml_param_services</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_actions</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin/admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_status</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_contract_history</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>400</td><td width='160'>100</td><td width='160'>0</td><td width='160'>auto</td><td width='160'>contract_history.php</td></tr></table></table><br><br><br></div> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.php b/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.php new file mode 100644 index 0000000000000000000000000000000000000000..4161f0c8a4f63b6e8c0f431db7410698d3ea86e8 --- /dev/null +++ b/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.php @@ -0,0 +1 @@ +<h1><img src='img/manage_structures2_b.gif' alt='' /> Visualisation configuration XML des services</h1><div id='inner_content' class='clearfix'><center><h3>Services définis par les modules</h3></center><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>add_batch.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>1</td><td width='160'>Dossier</td><td width='160'>select_folder.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>_print_sep</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>3</td><td width='160'>Impression du séparateur</td><td width='160'>print_sep.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_apa</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_baskets</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_entities</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_foldertypes</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_templates</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin_templates</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>basket_add.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>load_entities_session</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>load_entities_session.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>basket_up.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>load_entities_session</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>load_entities_session.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>batchs</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_batch_read</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>400</td><td width='160'>0</td><td width='160'>no</td><td width='160'>frame_batch_read.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_batch_manage</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>400</td><td width='160'>210</td><td width='160'>1</td><td width='160'>no</td><td width='160'>manage_batchs.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>boxes</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_box_read</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>400</td><td width='160'>0</td><td width='160'>no</td><td width='160'>frame_boxes_read.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_box_manage</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>210</td><td width='160'>1</td><td width='160'>no</td><td width='160'>manage_boxes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>change_doctype.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>doctype_template_use</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>doctype_template_use.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>class_admin_apa.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>choose_site</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>30</td><td width='160'>0</td><td width='160'></td><td width='160'>choose_site.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>class_admin_natures.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>choose_entity</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>20</td><td width='160'>0</td><td width='160'></td><td width='160'>choose_entity.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>class_admin_sites.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>choose_entity</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>20</td><td width='160'>0</td><td width='160'></td><td width='160'>choose_entity.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details_documents.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>use_alerts_on_doc</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>use_alerts_on_doc.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_attachments</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>view_attachments.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details_invoices.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>use_alerts_on_doc</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>use_alerts_on_doc.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_attachments</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>view_attachments.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_notes_doc</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>notes_doc.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_del</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_info</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_load_db</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_up</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>file_index.php</b></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>1</td><td width='300'>select_folder_result_preprocess.php</td><td width='300'>select_folder_result_postprocess.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>formuser</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>groupbasket_popup.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_redirect_action</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_redirect_entities.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_index_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_index_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>index_documents.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>1</td><td width='160'>Dossier</td><td width='160'>select_folder.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_missing_doc_in_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>4</td><td width='160'>Pièces manquantes</td><td width='160'>missing_res.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_history_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>5</td><td width='160'>Historique dossier</td><td width='160'>folder_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>index_file.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>attach_doc_indexing</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>attach_doc_indexing.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>load_groupbasket</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_redirect_action</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_redirect_entities.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_index_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_index_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>load_groupbasket_db</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_redirect_action</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_redirect_entities.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_index_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_index_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>manage_group_basket.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_redirect_action</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_redirect_entities.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_index_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_index_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>modify_user.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>myprofile_abs</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>include_user_abs_myprofile.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>process_frame.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_attachments</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>manage_attachments.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_folder</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>use_alerts_on_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>use_alerts_on_folder.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>show_folder</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_missing_doc_in_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>missing_res.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_history_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>folder_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>template_info</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>template_up.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>templates.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>load_entities_session</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>load_entities_session.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>uptemplate</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_templates_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_templates_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>user_check</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>user_up_init</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>users_add_db.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>users_list_init</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>users_up.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>user_admin_abs</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>include_user_abs_adminuser.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>users_up_db.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_users_entities</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>service_user_entities.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>view_folder</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_folder</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>welcome</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>display_basket_list</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>display_basket_list.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>welcome.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_notes_list</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>show_notes_list.php</td></tr></table></table><br><br><br><center><h3>Services définis par l’application</h3></center><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_users</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_groups</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_architecture</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_history</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_history_batch</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>xml_param_services</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_actions</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin/admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_status</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_del</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_mlb_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_mlb_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_info</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_mlb_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_mlb_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_load_db</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_mlb_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_mlb_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>doctype_up</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>param_mlb_doctypes</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>param_mlb_doctypes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_contract_history</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>400</td><td width='160'>100</td><td width='160'>0</td><td width='160'>auto</td><td width='160'>contract_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>welcome.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>quicklaunch</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>quicklaunch.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>welcome_text_load</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>welcome_text_load.php</td></tr></table></table><br><br><br></div> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.php_old b/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.php_old new file mode 100644 index 0000000000000000000000000000000000000000..abb0caf54bafa91dd87936bdfd1df2d6594d5931 --- /dev/null +++ b/maarch_entreprise/trunk/admin/maarch_config_tool/modules_services_config.php_old @@ -0,0 +1 @@ +<h1><img src='http://127.0.0.1/maarch_v3/apps/maarch_sample/img/manage_structures2_b.gif' alt='' />Visualisation configuration XML des services</h1><div id='inner_content' class='clearfix'><center><h3>Services définis par les modules</h3></center><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>add_batch.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_doctype_for_pa</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>2</td><td width='160'>Type de document</td><td width='160'>select_types_for_pa.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>1</td><td width='160'>Dossier</td><td width='160'>select_folder.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>_print_sep</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>3</td><td width='160'>Impression du séparateur</td><td width='160'>print_sep.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_foldertypes</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_workflow</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_baskets</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_tree_autofoldering</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>batchs</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_batch_read</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>400</td><td width='160'>0</td><td width='160'>no</td><td width='160'>frame_batch_read.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_batch_manage</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>400</td><td width='160'>210</td><td width='160'>1</td><td width='160'>no</td><td width='160'>manage_batchs.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>boxes</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_box_read</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>400</td><td width='160'>0</td><td width='160'>no</td><td width='160'>frame_boxes_read.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>physical_archive_box_manage</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>1000</td><td width='160'>210</td><td width='160'>1</td><td width='160'>no</td><td width='160'>manage_boxes.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_res</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_file_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details_documents.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_attached_files</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>managing_answers.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>details_invoices.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_attached_files</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>managing_answers.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>manage_notes_doc</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>notes_doc.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>file_index.php</b></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>2</td><td width='300'>res_type_result_preprocess.php</td><td width='300'></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>1</td><td width='300'>select_folder_result_preprocess.php</td><td width='300'>select_folder_result_postprocess.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>file_index2.php</b></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>1</td><td width='300'>res_type2_result_preprocess.php</td><td width='300'></td></tr></table><table border='1' width='800px'><tr><tr><td width='50' style='color:brown;'><b>processorder</b></td><td width='300' style='color:brown;'><b>preprocess</b></td><td width='300' style='color:brown;'><b>postprocess</b></td></tr><tr><td width='50'>2</td><td width='300'></td><td width='300'>launch_workflow_postprocess.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>index_documents.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_doctype</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>2</td><td width='160'>Type de document</td><td width='160'>select_type.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>index_file</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>3</td><td width='160'>Index</td><td width='160'>res_type.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>1</td><td width='160'>Dossier</td><td width='160'>select_folder.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_missing_doc_in_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>4</td><td width='160'>Pièces manquantes</td><td width='160'>missing_res.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_history_folder</td><td width='160'>use</td><td width='160'>tab</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>tab order</b></td><td width='160' style='color:green;'><b>tab label</b></td><td width='160' style='color:green;'><b>tab src</b></td></tr><tr><td width='160'>5</td><td width='160'>Historique dossier</td><td width='160'>folder_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>index_invoices.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>select_doctype2</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>50</td><td width='160'>0</td><td width='160'>no</td><td width='160'>select_type2.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>index_file2</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>430</td><td width='160'>0</td><td width='160'>auto</td><td width='160'>res_type2.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>res_type2.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>launch_workflow</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>100%</td><td width='160'>20</td><td width='160'>0</td><td width='160'></td><td width='160'>launch_workflow.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_folder</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>show_folder</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_missing_doc_in_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>missing_res.php</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_history_folder</td><td width='160'>use</td><td width='160'>include</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>include link</b></td></tr><tr><td width='160'>folder_history.php</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>view_folder</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_res</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_file_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>delete_folder</td><td width='160'>use</td><td width='160'>button</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>button link</b></td><td width='160' style='color:green;'><b>page width</b></td><td width='160' style='color:green;'><b>page height</b></td></tr><tr><td width='160'>delete_popup.php</td><td width='160'>550</td><td width='160'>200</td></tr></table></table><br><br><br><center><h3>Services définis par l’application</h3></center><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_users</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_groups</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_architecture</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>view_history</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>xml_param_services</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_actions</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>admin/admin.php</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>admin_status</td><td width='160'>admin</td><td width='160'>listelement</td></tr></table></table><br><br><br><table border='1' width='800px' style='background-color:#a9dbd8;'><tr><td align='center' style='color:#007583;'><b>salary_sheet</b></td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:blue;'><b>service id</b></td><td width='160' style='color:blue;'><b>type</b></td><td width='160' style='color:blue;'><b>nature</b></td></tr><tr><td>show_contract_history</td><td width='160'>use</td><td width='160'>frame</td></tr></table><table border='1' width='800px'><tr><td width='160' style='color:green;'><b>frame width</b></td><td width='160' style='color:green;'><b>frame height</b></td><td width='160' style='color:green;'><b>frame border</b></td><td width='160' style='color:green;'><b>frame scrolling</b></td><td width='160' style='color:green;'><b>frame src</b></td></tr><tr><td width='160'>400</td><td width='160'>100</td><td width='160'>0</td><td width='160'>auto</td><td width='160'>contract_history.php</td></tr></table></table><br><br><br></div> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/maarch_config_tool/xml_param_services.php b/maarch_entreprise/trunk/admin/maarch_config_tool/xml_param_services.php new file mode 100644 index 0000000000000000000000000000000000000000..0a9250481204b9177a08ae5b5c9803d53f8544f1 --- /dev/null +++ b/maarch_entreprise/trunk/admin/maarch_config_tool/xml_param_services.php @@ -0,0 +1,21 @@ +<?php +$core_tools2 = new core_tools(); +$core_tools2->test_admin('xml_param_services', 'apps'); + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=modules_services_config&admin=maarch_config_tool'; +$page_label = _XML_PARAM_SERVICE; +$page_id = "modules_services_config"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +include('modules_services_config.php'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/reopen_mail/reopen_mail.php b/maarch_entreprise/trunk/admin/reopen_mail/reopen_mail.php new file mode 100644 index 0000000000000000000000000000000000000000..ccb884677f46a58700c039e86e47ddec6d4e93c2 --- /dev/null +++ b/maarch_entreprise/trunk/admin/reopen_mail/reopen_mail.php @@ -0,0 +1,28 @@ +<?php +session_name('PeopleBox'); +session_start(); + +$core_tools2 = new core_tools(); +//here we loading the lang vars +$core_tools2->load_lang(); +$core_tools2->test_admin('reopen_mail', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=reopen_mail&admin=reopen_mail'; +$page_label = _REOPEN_MAIL; +$page_id = "reopen_mail"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_reopen_mail.php"); + +$reopen = new ReopenMail(); +$reopen->formreopenmail(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/reopen_mail/reopen_mail_db.php b/maarch_entreprise/trunk/admin/reopen_mail/reopen_mail_db.php new file mode 100644 index 0000000000000000000000000000000000000000..818963141353976a20de833fda99828fea33aa19 --- /dev/null +++ b/maarch_entreprise/trunk/admin/reopen_mail/reopen_mail_db.php @@ -0,0 +1,37 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('reopen_mail', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_reopen_mail.php"); + +$reopen = new ReopenMail(); +$reopen->update_db(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/status/status.php b/maarch_entreprise/trunk/admin/status/status.php new file mode 100644 index 0000000000000000000000000000000000000000..28af91762809b83ea3c1b265dddae35f7a1eb648 --- /dev/null +++ b/maarch_entreprise/trunk/admin/status/status.php @@ -0,0 +1,175 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Existing status list +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_status', 'apps'); +$func = new functions(); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=status&admin=status'; +$page_label = _STATUS_LIST; +$page_id = "status"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$select[$_SESSION['tablename']['status']] = array(); +array_push($select[$_SESSION['tablename']['status']],"id", "label_status","is_system","can_be_searched"); +$what = ""; +$where =""; +if(isset($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where .= " (label_status ilike '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' or id ilike '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' ) "; + } + else + { + $where .= " (label_status like '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' or id like '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' ) "; + } +} +$list = new list_show(); +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'label_status'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request= new request; +$tab=$request->select($select,$where,$orderstr,$_SESSION['config']['databasetype']); +//$request->show(); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="id") + { + $tab[$i][$j]["id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="18"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='id'; + } + if($tab[$i][$j][$value]=="label_status") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["label_status"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_DESC; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='label_status'; + } + if($tab[$i][$j][$value]=="is_system") + { + if($tab[$i][$j]['value'] == 'Y') + { + $tab[$i][$j]['value'] = _YES; + array_push($tab[$i], array('column' => 'can_delete', 'value' => 'false', 'can_delete' => 'false', + 'label' => _DESC,'show' => false)); + } + else + { + $tab[$i][$j]['value'] = _NO; + array_push($tab[$i], array('column' => 'can_delete', 'value' => 'true', 'can_delete' => 'true', + 'label' => _DESC,'show' => false)); + } + $tab[$i][$j]["is_system"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_IS_SYSTEM; + $tab[$i][$j]["size"]="5"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='is_system'; + } + if($tab[$i][$j][$value]=="can_be_searched") + { + if($tab[$i][$j]['value'] == 'Y') + { + $tab[$i][$j]['value'] = _YES; + } + else + { + $tab[$i][$j]['value'] = _NO; + } + $tab[$i][$j]["can_be_searched"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_CAN_BE_SEARCHED; + $tab[$i][$j]["size"]="5"; + $tab[$i][$j]["label_align"]="center"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='can_be_searched'; + } + } + } +} +//$request->show_array($tab); +$page_name = "status"; +$page_name_up = "status_up"; +$page_name_del = "status_del"; +$page_name_val= ""; +$page_name_ban = ""; +$page_name_add = "status_add"; +$label_add = _ADD_STATUS; +$_SESSION['m_admin']['init'] = true; +$title = _STATUS_LIST." : ".$i." "._STATUS_PLUR; + +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."admin/status/status_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; +$list->admin_list($tab, $i, $title, 'id','status','status','id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, FALSE, FALSE, _ALL_STATUS, _STATUS_SING, $_SESSION['config']['img'].'/manage_status_b.gif', false, true, false, true, $what, true, $autoCompletionArray); +$_SESSION['m_admin']['status'] = array(); +?> diff --git a/maarch_entreprise/trunk/admin/status/status_add.php b/maarch_entreprise/trunk/admin/status/status_add.php new file mode 100644 index 0000000000000000000000000000000000000000..af5f416e64cde12477487936ac4db7402e6bce3d --- /dev/null +++ b/maarch_entreprise/trunk/admin/status/status_add.php @@ -0,0 +1,60 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Add status form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +$core_tools2 = new core_tools(); +//here we loading the lang vars +$core_tools2->load_lang(); +$core_tools2->test_admin('admin_status', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=status_add&admin=status'; +$page_label = _ADDITION; +$page_id = "status_add"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_admin_status.php"); + +$status = new AdminStatus(); +$status->formstatus("add"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/status/status_del.php b/maarch_entreprise/trunk/admin/status/status_del.php new file mode 100644 index 0000000000000000000000000000000000000000..98c40a5f5a27e1d24b4e1a32f44d1ba154d67890 --- /dev/null +++ b/maarch_entreprise/trunk/admin/status/status_del.php @@ -0,0 +1,57 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Delete status +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_status', 'apps'); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_admin_status.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "alphanum", _THE_STATUS)); +} +else +{ + $s_id = ""; +} + +$status= new AdminStatus(); +$status->delstatus($s_id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/status/status_list_by_name.php b/maarch_entreprise/trunk/admin/status/status_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..c100c8a811f58a6c2ca3c32854197d64ff272498 --- /dev/null +++ b/maarch_entreprise/trunk/admin/status/status_list_by_name.php @@ -0,0 +1,71 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of status for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select label_status as tag from ".$_SESSION['tablename']['status']." where label_status ilike '".$_REQUEST['what']."%' order by label_status"); +} +else +{ + $db->query("select label_status as tag from ".$_SESSION['tablename']['status']." where label_status like '".$_REQUEST['what']."%' order by label_status"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; + +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/status/status_up.php b/maarch_entreprise/trunk/admin/status/status_up.php new file mode 100644 index 0000000000000000000000000000000000000000..85ea8f37d14b6ed4654dec660524303eec8704a7 --- /dev/null +++ b/maarch_entreprise/trunk/admin/status/status_up.php @@ -0,0 +1,72 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to modify a status +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_status', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_admin_status.php"); +$func = new functions(); + +if(isset($_GET['id'])) +{ + $id = addslashes($func->wash($_GET['id'], "alphanum", _THE_STATUS)); +} +else +{ + $id = ""; +} + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=status_up&admin=status'; +$page_label = _MODIFICATION; +$page_id = "status_up"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +$status = new AdminStatus(); +$status->formstatus("up",$id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/status/status_up_db.php b/maarch_entreprise/trunk/admin/status/status_up_db.php new file mode 100644 index 0000000000000000000000000000000000000000..9adc2687325bc8485fc119e16ad23e14cb72b9bd --- /dev/null +++ b/maarch_entreprise/trunk/admin/status/status_up_db.php @@ -0,0 +1,48 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Modify the status in the database after the form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_status', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_admin_status.php"); + +$satus = new AdminStatus(); +$satus->addupstatus($_REQUEST['mode']); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/add_usergroup_content.php b/maarch_entreprise/trunk/admin/users/add_usergroup_content.php new file mode 100644 index 0000000000000000000000000000000000000000..3be5f1b6c7c334225bb6cc475f130d80b0c1315c --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/add_usergroup_content.php @@ -0,0 +1,126 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to add a grant to a user, pop up page (User administration) +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_admin('admin_users', 'apps'); +require_once($_SESSION['pathtocoreclass']."class_db.php"); + +$ugc = new dbquery(); +//loading all the enabled groups in an array +$ugc->connect(); +$ugc->query("select group_id, group_desc from ".$_SESSION['tablename']['usergroups']." where enabled = 'Y' order by group_desc asc"); + +$tab=array(); +$i=0; +while($value = $ugc->fetch_array()) +{ + $tab[$i]['ID'] = $value[0] ; + $tab[$i]['LABEL'] = $ugc->show_string($value[1]); + $i++; +} + +$tab2 = array(); +if ( count($_SESSION['m_admin']['users']['groups']) > 0 ) +{ + + //$tabtmp = array(); + for($i=0; $i < count($_SESSION['m_admin']['users']['groups']); $i++) + { + array_push($tab2, array('ID'=> $_SESSION['m_admin']['users']['groups'][$i]['GROUP_ID'], 'LABEL' => $_SESSION['m_admin']['users']['groups'][$i]['LABEL'])); + } +} + +$res = $tab; +for($j=0; $j < count($tab); $j++) +{ + for($k=0; $k < count($tab2); $k++) + { + if($tab[$j]['ID'] == $tab2[$k]['ID']) + { + unset($res[$j]); + break; + } + } +} +$res = array_values($res); + + +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(); +$time = $core_tools->get_session_time_expire(); +?> +<body onLoad="setTimeout(window.close, <?php echo $time;?>*60*1000);"> +<div class="popup_content"> +<h2 class="tit"><?php echo _ADD_GROUP;?></h2> +<form name="chooseGroup" method="get" action="choose_group.php" class="forms"> + +<p> + <label for="groupe"> <?php echo _CHOOSE_GROUP;?> : </label> + <select name="groupe" id="groupe" > +<?php + +for($j=0; $j<count($res); $j++) +{ + if(!empty($res[$j]['LABEL'])) + { +?> + <option value="<?php echo $res[$j]['ID'] ?>"><?php echo $res[$j]['LABEL']; ?></option> +<?php + } +} +?> +</select> +</p> +<br/> +<p> + <label for="role"><?php echo _ROLE;?> : </label> + <input type="text" name="role" id="role" /> +</p> +<br/> +<p class="buttons"> + <input type="submit" class="button" name="Submit" value="<?php echo _VALIDATE;?>" /> + <input type="button" name="cancel" class="button" value="<?php echo _CANCEL;?>" onClick="window.close()"/> + <input type="hidden" name="Submit" value="Validate" /> +</p> + +</form> +</div> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/users/choose_group.php b/maarch_entreprise/trunk/admin/users/choose_group.php new file mode 100644 index 0000000000000000000000000000000000000000..9a162226aacfa4e0d6e7d40fdc523ce9511090b8 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/choose_group.php @@ -0,0 +1,61 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Process the add_usergroup_content.php form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); + session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); + +if(!empty($_REQUEST['groupe']) && isset($_REQUEST['groupe'])) +{ + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroup_content.php"); + $ugc = new usergroup_content(); + $ugc->connect(); + + $ugc->query("select group_desc from ".$_SESSION['tablename']['usergroups']." where group_id = '".$_REQUEST['groupe']."'"); + $res = $ugc->fetch_object(); + $ugc->add_usertmp_to_group_session( $_REQUEST['groupe'], $_REQUEST['role'], $res->group_desc); +} +else +{ + $_SESSION['error'] = _NO_GROUP_SELECTED."!"; + exit; +} + ?> +<script language="javascript"> +window.parent.opener.location.href='ugc_form.php';self.close(); +</script> + diff --git a/maarch_entreprise/trunk/admin/users/modify_user.php b/maarch_entreprise/trunk/admin/users/modify_user.php new file mode 100644 index 0000000000000000000000000000000000000000..876dc6121ce6825e8fb054edf5ab6ca449adb857 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/modify_user.php @@ -0,0 +1,56 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to modify user data +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +$core_tools2 = new core_tools(); +//here we loading the lang vars +$core_tools2->load_lang(); + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=modify_user&admin=users'; +$page_label = _MY_INFO; +$page_id = "modify_users"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); +$users = new users(); +$users->change_info_user(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/psw_changed.php b/maarch_entreprise/trunk/admin/users/psw_changed.php new file mode 100644 index 0000000000000000000000000000000000000000..b849f4b17309e6665f4673aea9bbd4e896f95950 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/psw_changed.php @@ -0,0 +1,73 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to modify user password at the first connexion +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); + +$db = new dbquery(); +$db->connect(); +$db->query("UPDATE ".$_SESSION['tablename']['users']." set password = '".md5("maarch")."' , change_password ='Y' where user_id = '".$_SESSION['m_admin']['users']['UserId']."'"); +if($_SESSION['history']['usersadd'] == "true") +{ + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($_SESSION['tablename']['users'], $_SESSION['m_admin']['users']['UserId'],"UP",_NEW_PASSWORD_USER." : ".$_SESSION['m_admin']['users']['LastName']." ".$_SESSION['m_admin']['users']['FirstName'], $_SESSION['config']['databasetype']); +} + +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(_PASSWORD_MODIFICATION); +$time = $core_tools->get_session_time_expire(); +?> + +<body id="pop_up" onLoad="setTimeout(window.close, <?php echo $time;?>*60*1000);"> +<h2 class="tit"><?php echo _PASSWORD_MODIFICATION;?></h2> + + +<p ><?php echo _PASSWORD_FOR_USER;?> <b><?php echo $_SESSION['m_admin']['users']['UserId'] ; ?></b> <?php echo _HAS_BEEN_RESET;?>. +</p> +<p > +<?php echo _NEW_PASW_IS;?> 'maarch'. </p> +<p > +<?php echo _DURING_NEXT_CONNEXION;?>, <?php echo $_SESSION['m_admin']['users']['UserId'] ; ?> <?php echo _MUST_CHANGE_PSW;?>. +</p> +<br/> +<p class="buttons" ><input type="button" class="button" onclick="window.close()" name="close" value="<?php echo _CLOSE_WINDOW;?>" /></p> + +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/users/ugc_form.php b/maarch_entreprise/trunk/admin/users/ugc_form.php new file mode 100644 index 0000000000000000000000000000000000000000..cd3ad555c67b0a2da6a73f24c14b900bfe899a28 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/ugc_form.php @@ -0,0 +1,129 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Form to choose a group in the user management (iframe included in the user management) +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); + +require_once( $_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroup_content.php"); +$func = new functions(); + +if(isset($_REQUEST['removeGroup']) && !empty($_REQUEST['removeGroup'])) +{ + if(count($_REQUEST['groups'])>0) + { + $tab = array(); + for ($i=0; $i<count($_REQUEST['groups']); $i++) + { + array_push($tab,$_REQUEST['groups'][$i]); + } + $ugc = new usergroup_content(); + $ugc->remove_session($tab); + } + $_SESSION['m_admin']['load_group'] = false; + +} + +if(isset($_REQUEST['setPrimary'])) +{ + if(count($_REQUEST['groups'])>0) + { + $ugc = new usergroup_content(); + $ugc->erase_primary_group_session(); + $ugc->set_primary_group_session($_REQUEST['groups'][0]); + } + + $_SESSION['m_admin']['load_group'] = false; + +} + +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(_USER_GROUPS_TITLE); +?> +<body id="iframe"> +<div class="block"> +<form name="usergroup_content" method="get" action="ugc_form.php" > + <h2 class="tit"> <?php echo _USER_GROUPS_TITLE; ?> :</h2> +<?php + + if(empty($_SESSION['m_admin']['users']['groups']) ) + { + echo _USER_BELONGS_NO_GROUP.".<br/>"; + echo _CHOOSE_ONE_GROUP.".<br/>"; + } + else + { + for($theline = 0; $theline < count($_SESSION['m_admin']['users']['groups']) ; $theline++) + { + if( $_SESSION['m_admin']['users']['groups'][$theline]['PRIMARY'] == 'Y') + { + ?><img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/arrow_primary.gif" alt="<?php echo _PRIMARY_GROUP;?>" title="<?php echo _PRIMARY_GROUP;?>" /> <?php + } + else + { + echo " "; + } + ?> + <input type="checkbox" class="check" name="groups[]" value="<?php echo $_SESSION['m_admin']['users']['groups'][$theline]['GROUP_ID']; ?>" ><?php echo $_SESSION['m_admin']['users']['groups'][$theline]['LABEL'] ; ?><br/> <i><?php echo $_SESSION['m_admin']['users']['groups'][$theline]['ROLE']; ?></i><br/></input> + <?php + } + ?> <br/><input class="button" type="submit" name="removeGroup" value="<?php echo _DELETE_GROUPS; ?>" /><br/><br/> +<?php } + + if (count($_SESSION['m_admin']['users']['groups']) < $_SESSION['m_admin']['nbgroups'] || empty($_SESSION['m_admin']['users']['groups'])) + { + ?> + <input class="button" type="button" name="addGroup" onClick="window.open('<?php echo $_SESSION['config']['businessappurl'];?>admin/users/add_usergroup_content.php','add','toolbar=no,status=no,width=400,height=150,left=500,top=300,scrollbars=no,top=no,location=no,resizable=yes,menubar=no')" value="<?php echo _ADD_TO_GROUP; ?>" /> + <?php + } + + ?> + <br/><br/> + <?php if (count($_SESSION['m_admin']['users']['groups']) > 0) + { + ?> + <input type="submit" class="button" name="setPrimary" value="<?php echo _CHOOSE_PRIMARY_GROUP; ?>" /> + <?php + } + ?> + </form> + </div> +</body> +</html> diff --git a/maarch_entreprise/trunk/admin/users/user_modif.php b/maarch_entreprise/trunk/admin/users/user_modif.php new file mode 100644 index 0000000000000000000000000000000000000000..abb81a4093db3b81e0aec617c8113e03b2a7269d --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/user_modif.php @@ -0,0 +1,48 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Process the user modification +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); + +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); + +$users = new users(); +$users->user_modif(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/users.php b/maarch_entreprise/trunk/admin/users/users.php new file mode 100644 index 0000000000000000000000000000000000000000..b59e3b7ec3c8d48df0a6e4cae0bdd237aa1eb5b6 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users.php @@ -0,0 +1,189 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Users list +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$core_tools2 = new core_tools(); +$core_tools2->test_admin('admin_users', 'apps'); + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=users&admin=users'; +$page_label = _USERS_LIST; +$page_id = "list_users"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$func = new functions(); +$select[$_SESSION['tablename']['users']] = array(); +array_push($select[$_SESSION['tablename']['users']],"user_id","lastname","firstname","enabled",'status',"mail" ); +$what = ""; +$where = " status <> 'DEL'"; +if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where .= "and( lastname ilike '".strtolower($what)."%' or lastname ilike '".strtoupper($what)."%' )"; + } + else + { + $where .= "and( lastname like '".strtolower($what)."%' or lastname like '".strtoupper($what)."%' )"; + } +} +$list = new list_show(); +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'lastname'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request= new request; +$tab=$request->select($select,$where,$orderstr,$_SESSION['config']['databasetype']); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="user_id") + { + $tab[$i][$j]["user_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='user_id'; + } + if($tab[$i][$j][$value]=="lastname") + { + $tab[$i][$j]['value']= $request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["lastname"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_LASTNAME; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='lastname'; + } + if($tab[$i][$j][$value]=="firstname") + { + $tab[$i][$j]['value']= $request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["firstname"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_FIRSTNAME; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='firstname'; + } + if($tab[$i][$j][$value]=="enabled") + { + $tab[$i][$j]["enabled"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_STATUS; + $tab[$i][$j]["size"]="3"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='enabled'; + } + if($tab[$i][$j][$value]=="mail") + { + $tab[$i][$j]["mail"] = $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_MAIL; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='mail'; + } + if($tab[$i][$j][$value]=="status") + { + if($tab[$i][$j]['value'] == "ABS") + { + $tab[$i][$j]['value'] = "<em>("._MISSING.")</em>"; + } + else + { + $tab[$i][$j]['value'] = ''; + } + $tab[$i][$j]["status"] = $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=''; + $tab[$i][$j]["size"]="5"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]=''; + } + } + } +} + +$_SESSION['m_admin']['load_group'] = true; +$_SESSION['m_admin']['init'] = true; +$_SESSION['service_tag'] = 'users_list_init'; +echo $core_tools2->execute_modules_services($_SESSION['modules_services'], 'users_list_init', "include"); +$page_name = "users"; +$page_name_up = "users_up"; +$page_name_ban = "users_ban"; +$page_name_del = "users_del"; +$page_name_val = "users_allow"; +$page_name_add = "users_add"; +$label_add = _ADD_USER; +$title = _USERS_LIST." : ".$i." "._USERS; + +$autoCompletionArray = array(); +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."admin/users/users_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; +$list->admin_list($tab, $i, $title,'user_id','users', 'users','user_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_USERS, _USER, $_SESSION['config']['img'].'/manage_users_b.gif', false, true, false, true, "", true, $autoCompletionArray); + +?> diff --git a/maarch_entreprise/trunk/admin/users/users_add.php b/maarch_entreprise/trunk/admin/users/users_add.php new file mode 100644 index 0000000000000000000000000000000000000000..50e6dcd8daacdcd65d3deaa4fd00d17c7fcb5d71 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users_add.php @@ -0,0 +1,61 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Add user form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +session_name('PeopleBox'); +session_start(); + +$admin = new core_tools(); +$admin->test_admin('admin_users', 'apps'); + +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=users_add&admin=users'; +$page_label = _ADDITION; +$page_id = "user_add"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); + +$func = new functions(); + +$users = new users(); +$users->formuser("add"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/users_add_db.php b/maarch_entreprise/trunk/admin/users/users_add_db.php new file mode 100644 index 0000000000000000000000000000000000000000..7138618466971233fe4b79cf37c9f27cbc6525d0 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users_add_db.php @@ -0,0 +1,45 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Add user in database after form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_admin('admin_users', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); + +$users = new users(); +$users->addupusers("add"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/users_allow.php b/maarch_entreprise/trunk/admin/users/users_allow.php new file mode 100644 index 0000000000000000000000000000000000000000..2e91723f0cdd341c216664455e86fcbd7350594f --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users_allow.php @@ -0,0 +1,57 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Authorize a user +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_admin('admin_users', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "no", _THE_USER)); +} +else +{ + $s_id = ""; +} + +$users = new users(); +$users->adminuser($s_id,"allow"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/users_ban.php b/maarch_entreprise/trunk/admin/users/users_ban.php new file mode 100644 index 0000000000000000000000000000000000000000..23277a28bd541060fcf3c51e64b408590a5cae96 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users_ban.php @@ -0,0 +1,56 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief To ban a user +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_admin('admin_users', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "no", _THE_USER)); +} +else +{ + $s_id = ""; +} + +$users = new users(); +$users->adminuser($s_id,"ban"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/users_del.php b/maarch_entreprise/trunk/admin/users/users_del.php new file mode 100644 index 0000000000000000000000000000000000000000..06f4a89724f82f4650cc8ffef5e66fdbc32a4dc8 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users_del.php @@ -0,0 +1,56 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Delete a user +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_admin('admin_users', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "no", _THE_USER)); +} +else +{ + $s_id = ""; +} + +$users = new users(); +$users->adminuser($s_id,"del"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/users_list_by_name.php b/maarch_entreprise/trunk/admin/users/users_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..3e355aa7192a962856b009531c7a53314e9fd7f5 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users_list_by_name.php @@ -0,0 +1,70 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of users for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select lastname as tag from ".$_SESSION['tablename']['users']." where lastname ilike '".$_REQUEST['what']."%' order by lastname"); +} +else +{ + $db->query("select lastname as tag from ".$_SESSION['tablename']['users']." where lastname like '".$_REQUEST['what']."%' order by lastname"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/users_up.php b/maarch_entreprise/trunk/admin/users/users_up.php new file mode 100644 index 0000000000000000000000000000000000000000..93dce6c9e4f9160c79f798850712a2eaa47d4da2 --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users_up.php @@ -0,0 +1,68 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief User modify form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); + +$admin = new core_tools(); +$admin->test_admin('admin_users', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); + +$func = new functions(); +if(isset($_GET['id'])) +{ + $id = addslashes($func->wash($_GET['id'], "no", _THE_USER)); +} +else +{ + $id = ""; +} + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=users_up&admin=users'; +$page_label = _MODIFICATION; +$page_id = "user_up"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +$users = new users(); +$users->formuser("up",$id); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/admin/users/users_up_db.php b/maarch_entreprise/trunk/admin/users/users_up_db.php new file mode 100644 index 0000000000000000000000000000000000000000..7e739684dd6f0b78cc1ec65f54e1bf103511d23b --- /dev/null +++ b/maarch_entreprise/trunk/admin/users/users_up_db.php @@ -0,0 +1,46 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Modify the user in the database after the form +* +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_admin('admin_users', 'apps'); +//here we loading the lang vars +$core_tools->load_lang(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_users.php"); + +$users = new users(); +$users->addupusers("up"); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/change_pass.php b/maarch_entreprise/trunk/change_pass.php new file mode 100644 index 0000000000000000000000000000000000000000..f77f22d205233e4d32bb621448feaf802d60f5bb --- /dev/null +++ b/maarch_entreprise/trunk/change_pass.php @@ -0,0 +1,91 @@ +<?php +/** +* File : change_pass.php +* +* Change password and personnal data form (first connexion) +* +* @package Maarch Framework v3 +* @version 2.1 +* @since 06/2006 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->load_lang(); +$core_tools->load_html(); +//here we building the header +$core_tools->load_header( _MODIFICATION_PSW); +$time = $core_tools->get_session_time_expire(); +?> + +<body onload="setTimeout(window.close, <?php echo $time;?>*60*1000);"> +<div id="container"> +<div id="content" > +<div class="error"><?php echo $_SESSION['error']; $_SESSION['error'] = "";?></div> + +<div id="inner_content" class="clearfix"> + +<h2 class="tit" ><img src="<?php echo $_SESSION['config']['img']."/maarch_box.gif"; ?>"><?php echo _FIRST_CONN;?></h2> +<div class="block"> + +<h3> <?php echo _YOUR_FIRST_CONNEXION.", "._PLEASE_CHANGE_PSW.".<br/>"._ASKED_ONLY_ONCE.".";?> </h3> +<div class="blank_space"> </div> +<form name="frmuser" method="post" action="verif_pass.php" class="forms" > + <p> + <label><?php echo _ID; ?> : </label> + <input type="text" readonly="readonly" class="readonly" value="<?php echo $_SESSION['user']['UserId']; ?>"/> + </p> + <p> + <label><?php echo _PASSWORD; ?> : </label> + <input name="pass1" type="password" id="pass1" value="" /><span class="red_asterisk">*</span> + </p> + <p> + <label><?php echo _REENTER_PSW; ?> : </label> + <input name="pass2" type="password" id="pass2" value="" /><span class="red_asterisk">*</span> + </p> + <p> + <label><?php echo _LASTNAME; ?> : </label> + <input name="LastName" type="text" id="LastName" value="<?php echo $_SESSION['user']['LastName']; ?>" /><span class="red_asterisk">*</span> + </p> + <p> + <label><?php echo _FIRSTNAME; ?> : </label> + <input name="FirstName" type="text" id="FirstName" value="<?php echo $_SESSION['user']['FirstName']; ?>" /><span class="red_asterisk">*</span> + </p> + <p> + <label ><?php echo _DEPARTMENT;?> : </label> + <!--<input name="department" type="text" id="department" readonly="readonly" class="readonly" value="<?php echo $service; ?>" />--> + <input name="Department" type="text" id="Department" value="<?php echo $_SESSION['user']['department']; ?>" /> + </p> + <p> + <label><?php echo _PHONE_NUMBER; ?> : </label> + <input name="Phone" type="text" id="Phone" value="<?php echo $_SESSION['user']['Phone']; ?>" /> + </p> + <p> + <label ><?php echo _MAIL;?> : </label> + <input name="Mail" type="text" id="Mail" value="<?php echo $_SESSION['user']['Mail']; ?>" /><span class="red_asterisk">*</span> + </p> + <p class="buttons"> + + <input type="submit" name="Submit" value="<?php echo _VALIDATE;?>" class="button" /> + <input type="button" name="cancel" value="<?php echo _CANCEL;?>" class="button" onclick="window.location.href='login.php?coreurl=<?php echo $_SESSION['config']['coreurl'];?>';" /> + </p> + +</form> +</div> +<div class="block_end"> </div> +</div> + + +</div> +<div id="footer"> </div> +</div> +</body> +</html> diff --git a/maarch_entreprise/trunk/class/class_admin.php b/maarch_entreprise/trunk/class/class_admin.php new file mode 100644 index 0000000000000000000000000000000000000000..43d62bfd348151c64b8f670fd84afa76209bbc4d --- /dev/null +++ b/maarch_entreprise/trunk/class/class_admin.php @@ -0,0 +1,87 @@ +<?php +/** +* Admin Class +* +* Contains all the administration functions and content +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* +*/ + +/** +* Class admin : contains all the administration functions and the administration menu management +* +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @package Maarch PeopleBox 1.0 +* @version 2.1 +*/ +class admin extends functions +{ + /** + * Retrieve the board of the admin app + */ + public function retrieve_app_admin_services($app_services) + { + echo '<h2 class="admin_subtitle block" >Application</h2>'; + echo '<div id="admin_apps">'; + for($i=0;$i<count($app_services);$i++) + { + if($app_services[$i]['servicetype'] == "admin" && $_SESSION['user']['services'][$app_services[$i]['id']]) + { + ?> + <div class="admin_item" id="<?php echo $app_services[$i]['style'];?>" title="<?php echo $app_services[$i]['comment'];?>" onclick="window.top.location='<?php echo $app_services[$i]['servicepage'];?>';"> + <div class="sum_margin" > + + <strong><?php echo $app_services[$i]['name'];?></strong> + <!-- <em><br/><?php echo $app_services[$i]['comment'];?></em>--> + + </div> + </div> + <?php + } + } + echo '</div>'; + } + + /** + * Retrieve the board of the admin app + */ + public function retrieve_modules_admin_services($modules_services) + { + echo '<h2 class="admin_subtitle block">Modules</h2>'; + echo '<div id="admin_modules">'; + foreach(array_keys($modules_services) as $value) + { + $nb = 0; + for($i=0;$i<count($modules_services[$value]);$i++) + { + if($modules_services[$value][$i]['servicetype'] == "admin" && $_SESSION['user']['services'][$modules_services[$value][$i]['id']]) + { + if($nb == 0) + { + //echo '<h2 class="admin_subtitle">Module : '.$value.'</h2>'; + } + $nb ++; + ?> + <div class="admin_item" id="<?php echo $modules_services[$value][$i]['style'];?>" title="<?php echo 'Module '.$value.' : '.$modules_services[$value][$i]['comment'];?>" onclick="window.top.location='<?php echo $modules_services[$value][$i]['servicepage'];?>';"> + <div class="sum_margin"> + + <strong><?php echo $modules_services[$value][$i]['name'];?></strong><!--<br/> + <em><?php echo $modules_services[$value][$i]['comment'];?></em>--> + + </div> + </div> + <!-- <hr /> --> + <?php + } + } + } + echo '</div>'; + } +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/class/class_admin_actions.php b/maarch_entreprise/trunk/class/class_admin_actions.php new file mode 100644 index 0000000000000000000000000000000000000000..2b447964dcc6d6a89eb81edefd3ecb1d6f33beeb --- /dev/null +++ b/maarch_entreprise/trunk/class/class_admin_actions.php @@ -0,0 +1,363 @@ +<?php +/** +* Admin action Class +* +* Contains all the specific functions of action admin +* +* @package Maarch LetterBox 2.0 +* @version 2.0 +* @since 06/2007 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* +*/ + +/** +* Class AdminActions : Contains all the specific functions of action admin +* +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @package Maarch LetterBox 2.0 +* @version 2.0 +*/ + +class AdminActions extends dbquery +{ + /** + * + * @access private + * @var integer + */ + private $the_start; + + /** + * Redefinition of the LetterBox object constructor + */ + function __construct() + { + parent::__construct(); + // configure the sql argument order by + if(isset($_GET['start'])) + { + $this->the_start = strip_tags($_GET['start']); + } + else + { + $this->the_start = 0; + } + } + + /** + * Return the action data in sessions vars + * + * @param string $mode add or up + */ + public function actioninfo($mode) + { + + // return the user information in sessions vars + $func = new functions(); + if($_REQUEST['mode'] == "up") + { + $_SESSION['m_admin']['action']['ID'] = $func->wash($_REQUEST['id'], "no", _ID." "); + } + $_SESSION['m_admin']['action']['LABEL'] = $func->wash($_REQUEST['label'], "no", _DESC." ", 'yes', 0, 255); + if(empty($_REQUEST['action_page'])) + { + $_SESSION['m_admin']['action']['ID_STATUS'] = $func->wash($_REQUEST['status'], "no", _STATUS." ", 'yes', 0, 10); + } + else + { + $_SESSION['m_admin']['action']['ID_STATUS'] = trim($_REQUEST['status']); + } + if(empty($_REQUEST['status'])) + { + $_SESSION['m_admin']['action']['ACTION_PAGE'] = $func->wash($_REQUEST['action_page'], "no", _ACTION_PAGE." ", 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['action']['ACTION_PAGE'] = trim($_REQUEST['action_page']); + } + $_SESSION['m_admin']['action']['HISTORY'] = $func->wash($_REQUEST['history'], "no", _HISTORY." "); + } + + /** + * Add ou modify action in the database + * + * @param string $mode up or add + */ + public function addupaction($mode) + { + // add ou modify users in the database + $this->actioninfo($mode); + + if(!empty($_SESSION['error'])) + { + if($mode == "up") + { + if(!empty($_SESSION['m_admin']['action']['ID'])) + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=action_up&id=".$_SESSION['m_admin']['action']['ID']."&admin=action"); + exit; + } + else + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=action&admin=action"); + exit; + } + } + if($mode == "add") + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=action_add&admin=action"); + exit; + } + } + else + { + $this->connect(); + + if($mode == "add") + { + $this->query("INSERT INTO ".$_SESSION['tablename']['actions']." ( label_action, id_status, action_page, history) + VALUES ( '".$this->protect_string_db($_SESSION['m_admin']['action']['LABEL'])."', + '".$this->protect_string_db($_SESSION['m_admin']['action']['ID_STATUS'])."', '".$this->protect_string_db($_SESSION['m_admin']['action']['ACTION_PAGE'])."', + '".$this->protect_string_db($_SESSION['m_admin']['action']['HISTORY'])."' )"); + + if($_SESSION['history']['actionadd']) + { + $this->query("select id from ".$_SESSION['tablename']['actions']." where label_action = '".$this->protect_string_db($_SESSION['m_admin']['action']['LABEL'])."' and id_status = '".$this->protect_string_db($_SESSION['m_admin']['action']['ID_STATUS'])."' and action_page = '".$this->protect_string_db($_SESSION['m_admin']['action']['ACTION_PAGE'])."' and history = '".$this->protect_string_db($_SESSION['m_admin']['action']['HISTORY'])."'"); + $res = $this->fetch_object(); + $id = $res->id; + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['actions'], $id,"ADD",_ACTION_ADDED.' : '.$this->protect_string_db($_SESSION['m_admin']['action']['LABEL']), $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _ACTION_ADDED.' : '.$_SESSION['m_admin']['action']['LABEL']; + $this->clearactioninfos(); + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=action&admin=action"); + exit(); + + } + elseif($mode == "up") + { + $this->query("update ".$_SESSION['tablename']['actions']." set label_action = '".$this->protect_string_db($_SESSION['m_admin']['action']['LABEL'])."', id_status = '".$this->protect_string_db($_SESSION['m_admin']['action']['ID_STATUS'])."', action_page = '".$this->protect_string_db($_SESSION['m_admin']['action']['ACTION_PAGE'])."', history = '".$this->protect_string_db($_SESSION['m_admin']['action']['HISTORY'])."' where id = ".$_SESSION['m_admin']['action']['ID'].""); + + if($_SESSION['history']['actionup']) + { + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['actions'], $_SESSION['m_admin']['action']['ID'],"UP",_ACTION_MODIFIED.' : '.$this->protect_string_db($_SESSION['m_admin']['action']['LABEL']), $_SESSION['config']['databasetype']); + } + + $_SESSION['error'] = _ACTION_MODIFIED.' : '.$_SESSION['m_admin']['action']['LABEL']; + $this->clearactioninfos(); + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=action&admin=action"); + exit(); + } + } + } + + + /** + * Form to modify a action + * + * @param $string $mode up or add + * @param int $id $id of the action to change + */ + public function formaction($mode,$id = "") + { + $func = new functions(); + + $state = true; + + if(!isset($_SESSION['m_admin']['action'])) + { + $this->clearactioninfos(); + } + + if( $mode <> "add") + { + $this->connect(); + $this->query("select * from ".$_SESSION['tablename']['actions']." where id = '".$id."'"); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _THE_ACTION.' '._ALREADY_EXISTS; + $state = false; + } + else + { + $_SESSION['m_admin']['action'] = array(); + $line = $this->fetch_object(); + + $_SESSION['m_admin']['action']['ID'] = $line->id; + $_SESSION['m_admin']['action']['LABEL'] = $this->show_string($line->label_action); + $_SESSION['m_admin']['action']['ID_STATUS'] = $this->show_string($line->id_status); + $_SESSION['m_admin']['action']['IS_SYSTEM'] = $this->show_string($line->is_system); + $_SESSION['m_admin']['action']['ACTION_PAGE'] = $this->show_string($line->action_page); + $_SESSION['m_admin']['action']['HISTORY'] = $this->show_string($line->history); + } + } + else if($mode == 'add') + { + $_SESSION['m_admin']['action']['IS_SYSTEM'] = 'N'; + $_SESSION['m_admin']['action']['HISTORY'] = 'Y'; + } + ?> + <h1><img src="<? echo $_SESSION['config']['img'];?>/manage_actions_b.gif" alt="" /> + <?php + if($mode == "up") + { + echo _MODIFY_ACTION; + } + elseif($mode == "add") + { + echo _ADD_ACTION; + } + ?> + </h1> + + + <div id="inner_content" class="clearfix" align="center"> + <br /><br /> + + <?php + if($state == false) + { + echo "<br /><br />"._THE_ACTION." "._UNKOWN."<br /><br /><br /><br />"; + } + else + { + + ?> + <form name="frmaction" id="frmaction" method="post" action="<? echo $_SESSION['config']['businessappurl']."admin/action/action_up_db.php";?>" class="forms addforms"> + <input type="hidden" name="mode" id="mode" value="<? echo $mode;?>" /> + <input type="hidden" name="id" id="id" value="<? echo $_SESSION['m_admin']['action']['ID'];?>" /> + <p> + <label for="label"><?php echo _DESC; ?> : </label> + <input name="label" type="text" id="label" value="<?php echo $func->show($_SESSION['m_admin']['action']['LABEL']); ?>"/> + </p> + <? if($_SESSION['m_admin']['action']['IS_SYSTEM'] == 'Y') + { + + echo '<div class="error">'._DO_NOT_MODIFY_UNLESS_EXPERT.'</div><br/>'; + } + ?> + <p> + <label ><?php echo _ASSOCIATED_STATUS; ?> : </label> + + <select name="status" id="status"> + <option value=""><? echo _CHOOSE_STATUS;?></option> + <? + for($i=0; $i<count($_SESSION['status']);$i++) + { + ?><option value="<? echo $_SESSION['status'][$i]['id'];?>" <? if($_SESSION['m_admin']['action']['ID_STATUS'] == $_SESSION['status'][$i]['id']) { echo 'selected="selected"';}?>><? echo $_SESSION['status'][$i]['label'];?></option><? + } + ?> + </select> + + </p> + <p> + <label><? echo _ACTION_PAGE;?> : </label> + <select name="action_page" id="action_page"> + <option value=""><? echo _CHOOSE;?></option> + <? for($i=0; $i< count($_SESSION['actions_pages']); $i++) + { + ?><option value="<? echo $_SESSION['actions_pages'][$i]['ID'];?>" <? if($_SESSION['actions_pages'][$i]['ID'] == $_SESSION['m_admin']['action']['ACTION_PAGE']){ echo 'selected="selected"';}?> ><? echo $_SESSION['actions_pages'][$i]['LABEL'];?></option><? + }?> + </select> + </p> + <p> + <label for="history"><?php echo _ACTION_HISTORY; ?> : </label> + <input type="radio" class="check" name="history" value="Y" <? if($_SESSION['m_admin']['action']['HISTORY'] == 'Y'){ echo 'checked="checked"';}?> /><? echo _YES;?> + <input type="radio" class="check" name="history" value="N" <? if($_SESSION['m_admin']['action']['HISTORY'] == 'N'){ echo 'checked="checked"';}?>/><? echo _NO;?> + </p> + <p class="buttons"> + <?php + + if($mode == "up") + { + ?> + <input class="button" type="submit" name="Submit" value="<?php echo _MODIFY_ACTION; ?>" /> + <?php + } + + elseif($mode == "add") + { + ?> + <input type="submit" class="button" name="Submit" value="<?php echo _ADD_ACTION; ?>" /> + <? + } + ?> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<? echo $_SESSION['config']['businessappurl'];?>index.php?page=action&admin=action';"/> + </p> + </form > + + <div class="infos"><? echo _INFOS_ACTIONS;?></div> + <?php + } + ?> + + </div> + <?php + } + + /** + * Clear the session variables of the edmit 's administration + * + */ + private function clearactioninfos() + { + // clear the session variable + $_SESSION['m_admin']['action'] = array(); + $_SESSION['m_admin']['action']['ID'] = ''; + $_SESSION['m_admin']['action']['LABEL'] = ''; + $_SESSION['m_admin']['action']['ID_STATUS'] = ''; + $_SESSION['m_admin']['action']['ACTION_PAGE'] = ''; + $_SESSION['m_admin']['action']['HISTORY'] = 'Y'; + } + + /** + * delete an action in the database + * + * @param string $id model identifier + */ + public function delaction($id) + { + if(!empty($_SESSION['error'])) + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=action&admin=action"); + exit; + } + else + { + $this->connect(); + + $this->query("select id from ".$_SESSION['tablename']['actions']." where id = '".$id."'"); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _THE_ACTION.' '._UNKNOWN; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=action&admin=action"); + exit; + } + else + { + $res = $this->fetch_object(); + $label = $res->LABEL; + $this->query("delete from ".$_SESSION['tablename']['actions']." where id = '".$id."'"); + + if($_SESSION['history']['actiondel']) + { + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['actions'], $id,"DEL",_ACTION_DELETED.' : '.$id, $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _ACTION_DELETED; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=action&admin=action"); + exit; + } + } + } +} +?> diff --git a/maarch_entreprise/trunk/class/class_admin_status.php b/maarch_entreprise/trunk/class/class_admin_status.php new file mode 100644 index 0000000000000000000000000000000000000000..2473bcb78b6e47c85acf83d0cf5af9a77ee35316 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_admin_status.php @@ -0,0 +1,332 @@ +<? +/** +* Admin status Class +* +* Contains all the specific functions of status admin +* +* @package Maarch LetterBox 2.0 +* @version 2.0 +* @since 06/2007 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* +*/ + +/** +* Class AdminStatus : Contains all the specific functions of status admin +* +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @package Maarch LetterBox 2.0 +* @version 2.0 +*/ + +class AdminStatus extends dbquery +{ + /** + * + * @access private + * @var integer + */ + private $the_start; + + /** + * Redefinition of the LetterBox object constructor + */ + function __construct() + { + parent::__construct(); + // configure the sql argument order by + if(isset($_GET['start'])) + { + $this->the_start = strip_tags($_GET['start']); + } + else + { + $this->the_start = 0; + } + } + + /** + * Return the status data in sessions vars + * + * @param string $mode add or up + */ + public function statusinfo($mode) + { + + // return the user information in sessions vars + $func = new functions(); + $_SESSION['m_admin']['status']['ID'] = $func->wash($_REQUEST['id'], "no", _ID." "); + + $_SESSION['m_admin']['status']['LABEL'] = $func->wash($_REQUEST['label'], "no", _DESC." ", 'yes', 0, 50); + + $_SESSION['m_admin']['status']['IS_SYSTEM'] = $func->wash($_REQUEST['is_system'], "no", _IS_SYSTEM." "); + + $_SESSION['m_admin']['status']['IMG_FILENAME'] = ''; + $_SESSION['m_admin']['status']['MODULE'] = 'apps'; + + $_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] = $func->wash($_REQUEST['can_be_searched'], "no", CAN_BE_SEARCHED." "); + $_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] = $func->wash($_REQUEST['can_be_modified'], "no", _CAN_BE_MODIFIED." "); + } + + /** + * Add ou modify status in the database + * + * @param string $mode up or add + */ + public function addupstatus($mode) + { + // add ou modify users in the database + $this->statusinfo($mode); + + if(!empty($_SESSION['error'])) + { + if($mode == "up") + { + if(!empty($_SESSION['m_admin']['status']['ID'])) + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status_up&id=".$_SESSION['m_admin']['status']['ID']."&admin=status"); + exit; + } + else + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status"); + exit; + } + } + if($mode == "add") + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status_add&admin=status"); + exit; + } + } + else + { + $this->connect(); + + if($mode == "add") + { + $this->query("INSERT INTO ".$_SESSION['tablename']['status']." ( id, label_status, img_filename, is_system, maarch_module, can_be_searched, can_be_modified) + VALUES ( '".$this->protect_string_db($_SESSION['m_admin']['status']['ID'])."', '".$this->protect_string_db($_SESSION['m_admin']['status']['LABEL'])."', + '".$this->protect_string_db($_SESSION['m_admin']['status']['IMG_FILENAME'])."','".$this->protect_string_db($_SESSION['m_admin']['status']['IS_SYSTEM'])."', + '".$this->protect_string_db($_SESSION['m_admin']['status']['MODULE'])."', '".$this->protect_string_db($_SESSION['m_admin']['status']['CAN_BE_SEARCHED'])."', '".$this->protect_string_db($_SESSION['m_admin']['status']['CAN_BE_MODIFIED'])."' )"); + + if($_SESSION['history']['statusadd']) + { + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['status'], $this->protect_string_db($_SESSION['m_admin']['status']['ID']),"ADD",_STATUS_ADDED.' : '.$this->protect_string_db($_SESSION['m_admin']['status']['LABEL']), $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _STATUS_ADDED.' '.$_SESSION['m_admin']['status']['LABEL']; + $this->clearstatusinfos(); + + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status"); + exit(); + + } + elseif($mode == "up") + { + $this->query("update ".$_SESSION['tablename']['status']." set label_status = '".$this->protect_string_db($_SESSION['m_admin']['status']['LABEL'])."', img_filename = '".$this->protect_string_db($_SESSION['m_admin']['status']['IMG_FILENAME'])."',maarch_module = '".$this->protect_string_db($_SESSION['m_admin']['status']['MODULE'])."', can_be_searched = '".$this->protect_string_db($_SESSION['m_admin']['status']['CAN_BE_SEARCHED'])."' , can_be_modified = '".$this->protect_string_db($_SESSION['m_admin']['status']['CAN_BE_MODIFIED'])."' where id = '".$_SESSION['m_admin']['status']['ID']."'"); + + if($_SESSION['history']['statusup']) + { + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['status'], $this->protect_string_db($_SESSION['m_admin']['status']['ID']),"UP",_STATUS_MODIFIED.' : '.$this->protect_string_db($_SESSION['m_admin']['status']['LABEL']), $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _STATUS_MODIFIED.' : '.$_SESSION['m_admin']['status']['LABEL']; + $this->clearstatusinfos(); + + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status"); + exit(); + } + } + } + + + /** + * Form to modify a status + * + * @param $string $mode up or add + * @param int $id $id of the status to change + */ + public function formstatus($mode,$id = "") + { + $func = new functions(); + + $state = true; + + if(!isset($_SESSION['m_admin']['status'])) + { + $this->clearstatusinfos(); + } + + if( $mode <> "add") + { + $this->connect(); + $this->query("select * from ".$_SESSION['tablename']['status']." where id = '".$id."'"); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _THE_STATUS.' '._ALREADY_EXISTS; + $state = false; + } + else + { + $_SESSION['m_admin']['status'] = array(); + $line = $this->fetch_object(); + + $_SESSION['m_admin']['status']['ID'] = $line->id; + $_SESSION['m_admin']['status']['LABEL'] = $this->show_string($line->label_status); + $_SESSION['m_admin']['status']['IS_SYSTEM'] = $this->show_string($line->is_system); + $_SESSION['m_admin']['status']['IMG_FILENAME'] = $this->show_string($line->img_filename); + $_SESSION['m_admin']['status']['MODULE'] = $this->show_string($line->maarch_module); + $_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] = $this->show_string($line->can_be_searched); + $_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] = $this->show_string($line->can_be_modified); + } + } + else if($mode == 'add') + { + $_SESSION['m_admin']['status']['IS_SYSTEM'] = 'N'; + $_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] = 'Y'; + $_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] = 'Y'; + } + ?> + <h1><img src="<? echo $_SESSION['config']['img'];?>/manage_status_b.gif" alt="" /> + <?php + if($mode == "up") + { + echo _MODIFY_STATUS; + } + elseif($mode == "add") + { + echo _ADD_STATUS; + } + ?> + </h1> + + + <div id="inner_content" class="clearfix" align="center"> + <br /><br /> + + <?php + if($state == false) + { + echo "<br /><br />"._THE_STATUS." "._UNKOWN."<br /><br /><br /><br />"; + } + else + { + ?> + <form name="frmstatus" id="frmstatus" method="post" action="<? echo $_SESSION['config']['businessappurl']."admin/status/status_up_db.php";?>" class="forms addforms"> + <input type="hidden" name="is_system" id="is_system" value="<? echo $_SESSION['m_admin']['status']['IS_SYSTEM'];?>" /> + <input type="hidden" name="mode" id="mode" value="<? echo $mode;?>" /> + <p> + <label for="id"><?php echo _ID; ?> : </label> + <input name="id" type="text" id="id" value="<?php echo $func->show($_SESSION['m_admin']['status']['ID']); ?>" <? if($mode == "up"){ echo 'readonly="readonly" class="readonly"';}?>/> + </p> + <p> + <label for="label"><?php echo _DESC; ?> : </label> + <input name="label" type="text" id="label" value="<?php echo $func->show($_SESSION['m_admin']['status']['LABEL']); ?>"/> + </p> + <p> + <label ><?php echo _CAN_BE_SEARCHED; ?> : </label> + <input type="radio" class="check" name="can_be_searched" value="Y" <? if($_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] == 'Y'){?> checked="checked"<? } ?> /><? echo _YES;?> + <input type="radio" name="can_be_searched" class="check" value="N" <? if($_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] == 'N'){?> checked="checked"<? } ?> /><? echo _NO;?> + </p> + <p> + <label ><?php echo _CAN_BE_MODIFIED; ?> : </label> + <input type="radio" class="check" name="can_be_modified" value="Y" <? if($_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] == 'Y'){?> checked="checked"<? } ?> /><? echo _YES;?> + <input type="radio" name="can_be_modified" class="check" value="N" <? if($_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] == 'N'){?> checked="checked"<? } ?> /><? echo _NO;?> + </p> + + <p class="buttons"> + <?php + + if($mode == "up") + { + ?> + <input class="button" type="submit" name="Submit" value="<?php echo _MODIFY_STATUS; ?>" /> + <?php + } + + elseif($mode == "add") + { + ?> + <input type="submit" class="button" name="Submit" value="<?php echo _ADD_STATUS; ?>" /> + <? + } + ?> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<? echo $_SESSION['config']['businessappurl'];?>index.php?page=status&admin=status';"/> + </p> + </form > + + <?php + } + ?> + + </div> + <?php + } + + /** + * Clear the session variables of the edmit 's administration + * + */ + private function clearstatusinfos() + { + // clear the session variable + $_SESSION['m_admin']['status'] = array(); + $_SESSION['m_admin']['status']['ID'] = ''; + $_SESSION['m_admin']['status']['LABEL'] = ''; + $_SESSION['m_admin']['status']['IS_SYTEM'] = ''; + $_SESSION['m_admin']['status']['IMG_FILENAME'] = ''; + $_SESSION['m_admin']['status']['MODULE'] = ''; + $_SESSION['m_admin']['status']['CAN_BE_SEARCHED'] = ''; + $_SESSION['m_admin']['status']['CAN_BE_MODIFIED'] = ''; + } + + /** + * delete a status in the database + * + * @param string $id model identifier + */ + public function delstatus($id) + { + if(!empty($_SESSION['error'])) + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status"); + exit; + } + else + { + $this->connect(); + + $this->query("select id from ".$_SESSION['tablename']['status']." where id = '".$id."'"); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _THE_STATUS.' '._UNKNOWN; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status"); + exit; + } + else + { + $res = $this->fetch_object(); + $label = $res->LABEL; + $this->query("delete from ".$_SESSION['tablename']['status']." where id = '".$id."'"); + + if($_SESSION['history']['statusdel']) + { + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['status'], $this->protect_string_db($id),"DEL",_STATUS_DELETED.' : '.$this->protect_string_db($id), $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _STATUS_DELETED." ".$id; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=status&admin=status"); + exit; + } + } + } +} +?> diff --git a/maarch_entreprise/trunk/class/class_business_app_tools.php b/maarch_entreprise/trunk/class/class_business_app_tools.php new file mode 100644 index 0000000000000000000000000000000000000000..0cf2ba89defc6337fdf07ae33d615499ca59e774 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_business_app_tools.php @@ -0,0 +1,470 @@ +<?php +/** +* core tools Class +* +* Contains all the functions to load core and others +* +* @package maarch +* @version 3.0 +* @since 10/2005 +* @license GPL v3 +* @author Laurent Giovannoni <dev@maarch.org> +* +*/ + +class business_app_tools extends dbquery +{ + function __construct() + { + parent::__construct(); + } + + /** + * Build Maarch business app configuration into sessions vars with a xml configuration file + */ + public function build_business_app_config() + { + // build Maarch business app configuration into sessions vars + $_SESSION['showmenu']='oui'; + + $xmlconfig = simplexml_load_file('xml/config.xml'); + + $CONFIG = $xmlconfig->CONFIG; + $_SESSION['config']['businessappname'] = (string) $CONFIG->businessappname; + $_SESSION['config']['businessapppath'] = (string) $CONFIG->businessapppath; + //############## + if($_SERVER['SERVER_PORT'] <> 80) + $server_port = ":".$_SERVER['SERVER_PORT']; + else + $server_port = ""; + //############## + $_SESSION['config']['businessappurl'] = "http://".$_SERVER['SERVER_NAME'].$server_port.str_replace('login.php','',$_SERVER['SCRIPT_NAME']); + $_SESSION['config']['databaseserver'] = (string) $CONFIG->databaseserver; + $_SESSION['config']['databaseserverport'] = (string) $CONFIG->databaseserverport; + $_SESSION['config']['databasetype'] = (string) $CONFIG->databasetype; + $_SESSION['config']['databasename'] = (string) $CONFIG->databasename; + $_SESSION['config']['databaseschema'] = (string) $CONFIG->databaseschema; + $_SESSION['config']['databaseuser'] = (string) $CONFIG->databaseuser; + $_SESSION['config']['databasepassword'] = (string) $CONFIG->databasepassword; + $_SESSION['config']['databasesearchlimit'] = (string) $CONFIG->databasesearchlimit; + $_SESSION['config']['nblinetoshow'] = (string) $CONFIG->nblinetoshow; + $_SESSION['config']['limitcharsearch'] = (string) $CONFIG->limitcharsearch; + $_SESSION['config']['lang'] = (string) $CONFIG->lang; + $_SESSION['config']['adminmail'] = (string) $CONFIG->adminmail; + $_SESSION['config']['adminname'] = (string) $CONFIG->adminname; + $_SESSION['config']['debug'] = (string) $CONFIG->debug; + $_SESSION['config']['applicationname'] = (string) $CONFIG->applicationname; + + $_SESSION['config']['css'] = $_SESSION['config']['businessappurl'].((string) $CONFIG->css); + $_SESSION['config']['css_IE'] = $_SESSION['config']['businessappurl'].((string) $CONFIG->css_ie); + $_SESSION['config']['css_IE7'] = $_SESSION['config']['businessappurl'].((string) $CONFIG->css_ie7); + + $_SESSION['config']['img'] = (string) $CONFIG->img; + + $_SESSION['config']['defaultPage'] = (string) $CONFIG->defaultPage; + $_SESSION['config']['exportdirectory'] = (string) $CONFIG->exportdirectory; + $_SESSION['config']['tmppath'] = (string) $CONFIG->tmppath; + $_SESSION['config']['cookietime'] = (string) $CONFIG->CookieTime; + $_SESSION['config']['ldap'] = (string) $CONFIG->ldap; + //$_SESSION['config']['databaseworkspace'] = (string) $CONFIG->databaseworkspace; + + $TABLENAME = $xmlconfig->TABLENAME ; + $_SESSION['tablename']['doctypes_first_level'] = (string) $TABLENAME->doctypes_first_level; + $_SESSION['tablename']['doctypes_second_level'] = (string) $TABLENAME->doctypes_second_level; + $_SESSION['tablename']['mlb_doctype_ext'] = (string) $TABLENAME->mlb_doctype_ext; + $_SESSION['tablename']['saved_queries'] = (string) $TABLENAME->saved_queries; + $_SESSION['tablename']['contacts'] = (string) $TABLENAME->contacts; + $i=0; + + $_SESSION['collections'] = array(); + foreach($xmlconfig->COLLECTION as $col) + { + $tmp = (string) $col->label; + $tmp2 = $this->retrieve_constant_lang($tmp, $_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php"); + if($tmp2 <> false) + { + $tmp = $tmp2; + } + $extensions = $col->extensions; + $tab = array(); + foreach($extensions->table as $table) + { + array_push($tab,(string)$table); + } + if(isset($col->table) && !empty($col->table)) + { + $_SESSION['collections'][$i] = array("id" => (string) $col->id, "label" => (string) $tmp, "table" => (string) $col->table,"view" => (string) $col->view, "index_file" => (string) $col->index_file, "script_add" => (string) $col->script_add, "script_search" => (string) $col->script_search, "script_search_result" => (string) $col->script_search_result, "script_details"=> (string) $col->script_details, "path_to_lucene_index"=> (string) $col->path_to_lucene_index, "extensions" => $tab); + $i++; + } + else + { + $_SESSION['collections'][$i] = array("id" => (string) $col->id, "label" => (string) $tmp, "view" => (string) $col->view, "index_file" => (string) $col->index_file, "script_add" => (string) $col->script_add, "script_search" => (string) $col->script_search, "script_search_result" => (string) $col->script_search_result, "script_details"=> (string) $col->script_details, "path_to_lucene_index"=> (string) $col->path_to_lucene_index, "extensions" => $tab); + } + } + $HISTORY = $xmlconfig->HISTORY; + $_SESSION['history']['usersdel'] = (string) $HISTORY->usersdel; + $_SESSION['history']['usersban'] = (string) $HISTORY->usersban; + $_SESSION['history']['usersadd'] = (string) $HISTORY->usersadd; + $_SESSION['history']['usersup'] = (string) $HISTORY->usersup; + $_SESSION['history']['usersval'] = (string) $HISTORY->usersval; + $_SESSION['history']['doctypesdel'] = (string) $HISTORY->doctypesdel; + $_SESSION['history']['doctypesadd'] = (string) $HISTORY->doctypesadd; + $_SESSION['history']['doctypesup'] = (string) $HISTORY->doctypesup; + $_SESSION['history']['doctypesval'] = (string) $HISTORY->doctypesval; + $_SESSION['history']['doctypesprop'] = (string) $HISTORY->doctypesprop; + $_SESSION['history']['usergroupsdel'] = (string) $HISTORY->usergroupsdel; + $_SESSION['history']['usergroupsban'] = (string) $HISTORY->usergroupsban; + $_SESSION['history']['usergroupsadd'] = (string) $HISTORY->usergroupsadd; + $_SESSION['history']['usergroupsup'] = (string) $HISTORY->usergroupsup; + $_SESSION['history']['usergroupsval'] = (string) $HISTORY->usergroupsval; + $_SESSION['history']['structuredel'] = (string) $HISTORY->structuredel; + $_SESSION['history']['structureadd'] = (string) $HISTORY->structureadd; + $_SESSION['history']['structureup'] = (string) $HISTORY->structureup; + $_SESSION['history']['subfolderdel'] = (string) $HISTORY->subfolderdel; + $_SESSION['history']['subfolderadd'] = (string) $HISTORY->subfolderadd; + $_SESSION['history']['subfolderup'] = (string) $HISTORY->subfolderup; + $_SESSION['history']['resadd'] = (string) $HISTORY->resadd; + $_SESSION['history']['resup'] = (string) $HISTORY->resup; + $_SESSION['history']['resdel'] = (string) $HISTORY->resdel; + $_SESSION['history']['resview'] = (string) $HISTORY->resview; + $_SESSION['history']['userlogin'] = (string) $HISTORY->userlogin; + $_SESSION['history']['userlogout'] = (string) $HISTORY->userlogout; + $_SESSION['history']['actionadd'] = (string) $HISTORY->actionadd; + $_SESSION['history']['actionup'] = (string) $HISTORY->actionup; + $_SESSION['history']['actiondel'] = (string) $HISTORY->actiondel; + $_SESSION['history']['contactadd'] = (string) $HISTORY->contactadd; + $_SESSION['history']['contactup'] = (string) $HISTORY->contactup; + $_SESSION['history']['contactdel'] = (string) $HISTORY->contactdel; + $_SESSION['history']['statusadd'] = (string) $HISTORY->statusadd; + $_SESSION['history']['statusup'] = (string) $HISTORY->statusup; + $_SESSION['history']['statusdel'] = (string) $HISTORY->statusdel; + $_SESSION['history_keywords'] = array(); + foreach($xmlconfig->KEYWORDS as $keyword) + { + $tmp = (string) $keyword->label; + $tmp2 = $this->retrieve_constant_lang($tmp, $_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php"); + if($tmp2 <> false) + { + $tmp = $tmp2; + } + array_push($_SESSION['history_keywords'], array('id' =>(string) $keyword->id,'label' =>$tmp)); + } + + + $i=0; + foreach($xmlconfig->MODULES as $MODULES) + { + + $_SESSION['modules'][$i] = array("moduleid" => (string) $MODULES->moduleid + //,"comment" => (string) $MODULES->comment + ); + $i++; + } + + $this->load_actions_pages(); + } + + /** + * Load actions in session + */ + private function load_actions_pages() + { + $core = new core_tools(); + $xmlfile = simplexml_load_file($_SESSION['pathtocore']."xml".DIRECTORY_SEPARATOR."actions_pages.xml"); + $path_lang = $_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'; + + $i =0; + foreach($xmlfile->ACTIONPAGE as $ACTIONPAGE) + { + $tmp = (string) $ACTIONPAGE->LABEL; + $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); + if($tmp2 <> false) + { + $label = $tmp2; + } + else + { + $label = $tmp; + } + $_SESSION['actions_pages'][$i] = array("ID" => (string) $ACTIONPAGE->ID, "LABEL" => $label,"NAME" => (string) $ACTIONPAGE->NAME, "ORIGIN" => (string) $ACTIONPAGE->ORIGIN,"MODULE" => (string) $ACTIONPAGE->MODULE); + $i++; + + } + } + + private function load_letterbox_var() + { + $core = new core_tools(); + $xmlfile = simplexml_load_file($_SESSION['config']['businessapppath']."xml".DIRECTORY_SEPARATOR."letterbox.xml"); + $path_lang = $_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'; + + $categories = $xmlfile->categories; + $_SESSION['mail_categories'] = array(); + foreach($categories->category as $cat ) + { + $tmp = (string) $cat->label; + $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); + if($tmp2 <> false) + { + $label = $tmp2; + } + else + { + $label = $tmp; + } + $_SESSION['mail_categories'][(string)$cat->id] = $label; + } + $_SESSION['default_category'] = (string) $categories->default_category; + + $_SESSION['mail_natures'] = array(); + $mail_natures = $xmlfile->mail_natures; + foreach($mail_natures->nature as $nature ) + { + $tmp = (string) $nature->label; + $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); + if($tmp2 <> false) + { + $label = $tmp2; + } + else + { + $label = $tmp; + } + $_SESSION['mail_natures'][(string)$nature->id] = $label; + } + $_SESSION['default_mail_nature'] = (string) $mail_natures->default_nature; + + $_SESSION['mail_priorities'] = array(); + $mail_priorities = $xmlfile->priorities; + $i=0; + foreach($mail_priorities->priority as $priority ) + { + $tmp = (string) $priority; + $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); + if($tmp2 <> false) + { + $label = $tmp2; + } + else + { + $label = $tmp; + } + $_SESSION['mail_priorities'][$i] = $label; + $i++; + } + $_SESSION['default_mail_priority'] = (string) $mail_priorities->default_priority; + } + + public function load_features($xml_features) + { + $_SESSION['features'] = array(); + //Defines all features by default at 'false' + $_SESSION['features']['add_copy_in_process'] = "false"; + $_SESSION['features']['personal_contact'] = "false"; + $_SESSION['features']['search_notes'] = "false"; + $_SESSION['features']['dest_to_copy_during_redirection'] = "false"; + + $xmlfeatures = simplexml_load_file($xml_features); + if ($xmlfeatures) + { + foreach($xmlfeatures->FEATURES as $FEATURES) + { + $_SESSION['features']['add_copy_in_process'] = (string) $FEATURES->add_copy_in_process; + $_SESSION['features']['personal_contact'] = (string) $FEATURES->personal_contact; + $_SESSION['features']['search_notes'] = (string) $FEATURES->search_notes; + $_SESSION['features']['dest_to_copy_during_redirection'] = (string) $FEATURES->dest_to_copy_during_redirection; + } + } + } + + /** + * Loads current folder identifier in session + * + */ + private function load_current_folder() + { + $this->connect(); + + $this->query("select custom_t1 from ".$_SESSION['tablename']['users']." where user_id = '".$_SESSION['user']['UserId']."'"); + + $res = $this->fetch_object(); + + $_SESSION['current_folder_id'] = $res->custom_t1; + + } + + /** + * Loads app specific vars in session + * + */ + public function load_app_var_session() + { + $this->load_current_folder(); + $this->load_status(); + $this->load_letterbox_var(); + $this->load_features($_SESSION['config']['businessapppath'].'xml'.DIRECTORY_SEPARATOR.'features.xml'); + //$this->load_index(); + } + + + /* TO DO : refaire la gestion des index dynamiques */ + public function load_index() + { + $func = new functions(); + $_SESSION['index'] = array(); + + for($j=0; $j < count($_SESSION['collections']); $j++) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']] = array(); + $xmlfile = simplexml_load_file($_SESSION['pathtomodules']."indexing_searching".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR.$_SESSION['collections'][$j]['index_file']); + $path_lang = $_SESSION['pathtomodules']."indexing_searching".DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'; + $i = 0; + + foreach($xmlfile->INDEX as $INDEX) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['COLUMN'] = (string) $INDEX->COLUMN; + $tmp = (string) $INDEX->LABEL; + $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); + if($tmp2 <> false) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['LABEL'] = $tmp2; + } + else + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['LABEL']= $tmp; + } + if(isset($INDEX->FOREIGN_KEY) && !empty($INDEX->FOREIGN_KEY)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['FOREIGN_KEY']= (string) $INDEX->FOREIGN_KEY; + } + if(isset($INDEX->FOREIGN_LABEL) && !empty($INDEX->FOREIGN_LABEL)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['FOREIGN_LABEL']= (string) $INDEX->FOREIGN_LABEL; + } + if(isset($INDEX->TABLENAME) && !empty($INDEX->TABLENAME)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['TABLENAME']= (string) $INDEX->TABLENAME; + } + if(isset($INDEX->ORDER) && !empty($INDEX->ORDER)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['ORDER']= (string) $INDEX->ORDER; + } + if(isset($INDEX->WHERE) && !empty($INDEX->WHERE)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['WHERE']= (string) $INDEX->WHERE; + } + + if(count($INDEX->VALUES) > 0) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['VALUES'] = array(); + $k=0; + foreach($INDEX->VALUES as $value) + { + //$_SESSION['index'][$i]['VALUES'][$k]['id'] = (string) $value->ID; + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['VALUES'][$k]['label'] = (string) $value->LABEL; + $k++; + } + } + $i++; + } + } + } + + private function load_status() + { + $this->connect(); + $this->query("select * from ".$_SESSION['tablename']['status']." order by label_status"); + + $_SESSION['status'] = array(); + + while($res = $this->fetch_object()) + { + array_push($_SESSION['status'], array('id' => $res->id, 'label' => $res->label_status, 'is_system' => $res->is_system, 'img_filename' => $res->img_filename, + 'module' => $res->module, 'can_be_searched' => $res->can_be_searched)); + } + } + /** + * Return a specific path or false + * + */ + public function insert_app_page($name) + { + if($name == "structures") + { + $path = $_SESSION['config']['businessapppath']."admin".DIRECTORY_SEPARATOR."architecture".DIRECTORY_SEPARATOR."structures".DIRECTORY_SEPARATOR.'structures.php'; + return $path; + } + elseif($name == "subfolders") + { + $path = $_SESSION['config']['businessapppath']."admin".DIRECTORY_SEPARATOR."architecture".DIRECTORY_SEPARATOR."subfolders".DIRECTORY_SEPARATOR.'subfolders.php'; + return $path; + } + elseif($name == "types" || $name == "types_up" || $name == "types_up_db" || $name == "types_add" || $name == "types_del") + { + $path = $_SESSION['config']['businessapppath']."admin".DIRECTORY_SEPARATOR."architecture".DIRECTORY_SEPARATOR."types".DIRECTORY_SEPARATOR.$name.'.php'; + return $path; + } + else + { + return false; + } + } + + public function get_titles() + { + $core = new core_tools(); + $xmlfile = simplexml_load_file($_SESSION['config']['businessapppath']."xml".DIRECTORY_SEPARATOR."letterbox.xml"); + $path_lang = $_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'; + + $res_titles = array(); + $titles = $xmlfile->titles; + foreach($titles->title as $title ) + { + $tmp = (string) $title->label; + $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); + if($tmp2 <> false) + { + $label = $tmp2; + } + else + { + $label = $tmp; + } + + $res_titles[(string)$title->id] = $label; + } + + asort($res_titles, SORT_LOCALE_STRING); + $default_title = (string) $titles->default_title; + return array('titles' => $res_titles, 'default_title' => $default_title); + } + + + public function get_label_title($id_title) + { + $core = new core_tools(); + $xmlfile = simplexml_load_file($_SESSION['config']['businessapppath']."xml".DIRECTORY_SEPARATOR."letterbox.xml"); + $path_lang = $_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'; + $titles = $xmlfile->titles; + foreach($titles->title as $title ) + { + if($id_title == (string)$title->id) + { + $tmp = (string) $title->label; + $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); + if($tmp2 <> false) + { + $label = $tmp2; + } + else + { + $label = $tmp; + } + return $label; + } + } + return ''; + } + +} +?> diff --git a/maarch_entreprise/trunk/class/class_chrono.php b/maarch_entreprise/trunk/class/class_chrono.php new file mode 100644 index 0000000000000000000000000000000000000000..709f96dc8180874894beec1e2ccdc8e161a9a333 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_chrono.php @@ -0,0 +1,339 @@ +<?php +/** +* Chrono number Class +* +* Contains all the specific functions of chrono number +* +* @package Maarch LetterBox 3.0 +* @version 3.0 +* @since 06/2007 +* @license GPL +* @author Loïc Vinet <dev@maarch.org> +* +*/ + +//class AdminActions extends dbquery +class chrono +{ + /** + * Return an array with all structure readed in chorno.xml + * + * @param string $xml_file add or up (a supprimer) + */ + function get_structure($id_chrono) + { + $globality = array(); + $parameters_tab = array(); + $chrono_tab = array(); + + + $chrono_config = simplexml_load_file($_SESSION['config']['businessapppath']."xml".$_SESSION['slash_env']."chrono.xml"); + if($chrono_config) + { + foreach($chrono_config ->CHRONO as $CHRONO) + { + if($CHRONO->id == $id_chrono) + { + $chrono_id = (string) $CHRONO->id; + $separator = (string) $CHRONO->separator; + array_push($parameters_tab, array("ID"=> $chrono_id , "SEPARATOR"=>$separator)); + + foreach($CHRONO->ELEMENT as $ELEMENT) + { + $type = $ELEMENT->type; + $value = (string) $ELEMENT->value; + array_push($chrono_tab, array("TYPE"=> $type , "VALUE"=>$value)); + } + } + } + array_push($globality, array("PARAMETERS"=>$parameters_tab, "ELEMENTS"=>$chrono_tab)); + + return $globality; + } + else + { + echo "chrono::get_structure error"; + } + + } + + function convert_date_field($chrono_array) + { + //$new_chrono_array = array(); + + for($i = 0;$i <= count($chrono_array); $i++) + { + if ($chrono_array[$i]['TYPE'] == "date") + { + if ($chrono_array[$i]['VALUE'] == "year") + { + $chrono_array[$i]['VALUE'] = date('Y'); + } + elseif ($chrono_array[$i]['VALUE'] == "month") + { + $chrono_array[$i]['VALUE'] = date('m'); + } + elseif ($chrono_array[$i]['VALUE'] == "day") + { + $chrono_array[$i]['VALUE'] = date('d'); + } + elseif ($chrono_array[$i]['VALUE'] == "full_date") + { + $chrono_array[$i]['VALUE'] = date('dmY'); + } + } + } + return $chrono_array; + + } + + + + function convert_maarch_var($chrono_array, $php_var) + { + + for($i = 0;$i <= count($chrono_array); $i++) + { + if ($chrono_array[$i]['TYPE'] == "maarch_var") + { + if ($chrono_array[$i]['VALUE'] == "arbox_id") + { + $chrono_array[$i]['VALUE'] = $php_var['arbox_id']; + } + elseif ($chrono_array[$i]['VALUE'] == "entity_id") + { + $chrono_array[$i]['VALUE'] = $php_var['entity_id'];; + } + elseif ($chrono_array[$i]['VALUE'] == "type_id") + { + $chrono_array[$i]['VALUE'] = $php_var['type_id'];; + } + } + } + return $chrono_array; + + } + + + function convert_maarch_forms($chrono_array, $forms) + { + + + for($i = 0;$i <= count($chrono_array); $i++) + { + if($chrono_array[$i]['TYPE'] == "maarch_form") + { + foreach ($forms as $key => $value) + { + if ($chrono_array[$i]['VALUE'] == $key) + { + $chrono_array[$i]['VALUE'] = $value; + } + } + + } + } + return $chrono_array; + } + + + function convert_maarch_functions($chrono_array, $php_var = 'false') + { + for($i = 0;$i <= count($chrono_array); $i++) + { + + if ($chrono_array[$i]['TYPE'] == "maarch_functions") + { + if ($chrono_array[$i]['VALUE'] == "chr_global") + { + $chrono_array[$i]['VALUE'] = $this->execute_chrono_for_this_year(); + } + elseif ($chrono_array[$i]['VALUE'] == "chr_by_entity") + { + $chrono_array[$i]['VALUE'] = $this->execute_chrono_by_entity($php_var['entity_id']); + } + elseif ($chrono_array[$i]['VALUE'] == "chr_by_category") + { + $chrono_array[$i]['VALUE'] = $this->execute_chrono_by_category($php_var['category_id']); + } + elseif ($chrono_array[$i]['VALUE'] == "category_char") + { + $chrono_array[$i]['VALUE'] = $this->execute_category_char($php_var); + } + + } + } + return $chrono_array; + + } + + + function execute_chrono_for_this_year() + { + require_once($_SESSION['pathtocoreclass']."class_db.php"); + $db = new dbquery(); + $db->connect(); + + //Get the crono key for this year + $db->query("SELECT param_value_int from ".$_SESSION['tablename']['param']." where id = 'chrono_global_".date('Y')."' "); + if ($db->nb_result() == 0) + { + $chrono = $this->create_new_chrono_global($db); + } + else + { + $fetch = $db->fetch_object(); + $chrono = $fetch->param_value_int; + } + $this->update_chrono_for_this_year($chrono, $db); + return $chrono; + } + + + function execute_chrono_by_entity($entity) + { + require_once($_SESSION['pathtocoreclass']."class_db.php"); + $db = new dbquery(); + $db->connect(); + + //Get the crono key for this year + $db->query("SELECT param_value_int from ".$_SESSION['tablename']['param']." where id = 'chrono_".$entity."_".date('Y')."' "); + if ($db->nb_result() == 0) + { + $chrono = $this->create_new_chrono_for_entity($db, $entity); + } + else + { + $fetch = $db->fetch_object(); + $chrono = $fetch->param_value_int; + } + $this->update_chrono_for_entity($chrono, $db, $entity); + return $chrono; + } + + function execute_chrono_by_category($category) + { + require_once($_SESSION['pathtocoreclass']."class_db.php"); + $db = new dbquery(); + $db->connect(); + + //Get the crono key for this year + $db->query("SELECT param_value_int from ".$_SESSION['tablename']['param']." where id = 'chrono_".$category."_".date('Y')."' "); + if ($db->nb_result() == 0) + { + $chrono = $this->create_new_chrono_for_category($db, $category); + } + else + { + $fetch = $db->fetch_object(); + $chrono = $fetch->param_value_int; + } + $this->update_chrono_for_category($chrono, $db, $category); + return $chrono; + } + + private function execute_category_char($php_var) + { + if (!$php_var['category_id']) + { + return "category::php_var error"; + } + else + { + if($php_var['category_id'] == "incoming") + { + return "E"; + } + elseif($php_var['category_id'] == "outcoming") + { + return "S"; + } + else + { + return ''; + } + } + } + + //For global chrono + private function update_chrono_for_this_year($actual_chrono, $db) + { + $actual_chrono++; + $db->query("UPDATE ".$_SESSION['tablename']['param']." SET param_value_int = '".$actual_chrono."' WHERE id = 'chrono_global_".date('Y')."' " ); + } + + private function create_new_chrono_global($db) + { + $db->query("INSERT INTO ".$_SESSION['tablename']['param']." (id, param_value_int) VALUES ('chrono_global_".date('Y')."', '1')" ); + return 1; + } + + + + //For specific chrono =>category + private function update_chrono_for_category($actual_chrono, $db, $category) + { + $actual_chrono++; + $db->query("UPDATE ".$_SESSION['tablename']['param']." SET param_value_int = '".$actual_chrono."' WHERE id = 'chrono_".$category."_".date('Y')."' " ); + } + private function create_new_chrono_for_category($db, $category) + { + $db->query("INSERT INTO ".$_SESSION['tablename']['param']." (id, param_value_int) VALUES ('chrono_".$category."_".date('Y')."', '1')" ); + return 1; + } + + + //For specific chrono =>entity + private function update_chrono_for_entity($actual_chrono, $db, $entity) + { + $actual_chrono++; + $db->query("UPDATE ".$_SESSION['tablename']['param']." SET param_value_int = '".$actual_chrono."' WHERE id = 'chrono_".$entity."_".date('Y')."' " ); + } + private function create_new_chrono_for_entity($db, $entity) + { + $db->query("INSERT INTO ".$_SESSION['tablename']['param']." (id, param_value_int) VALUES ('chrono_".$entity."_".date('Y')."', '1')" ); + return 1; + } + + function generate_chrono($chrono_id, $php_var = 'false', $form= 'false') + { + + $tmp = $this->get_structure($chrono_id); + $elements = $tmp[0]['ELEMENTS']; + $parameters = $tmp[0]['PARAMETERS']; + + + //Launch any conversion needed for value in the chrono array + $elements = $this->convert_date_field($elements); //For type date + $elements = $this->convert_maarch_var($elements, $php_var); //For php var in maarch + $elements = $this->convert_maarch_functions($elements, $php_var); + $elements = $this->convert_maarch_forms($elements, $form); //For values used in forms + + + + //Generate chrono string + $string = $this->convert_in_string($elements, $parameters); + return $string; + } + + + function convert_in_string($elements, $parameters) + { + + $separator = $parameters[0]['SEPARATOR']; + + $this_string = ''; + //Explode each elements of this array + foreach($elements as $array) + { + $this_string .= $separator; + $this_string .= $array['VALUE']; + } + + //$this_string = substr($this_string, 1); + return $this_string; + + } + + +} diff --git a/maarch_entreprise/trunk/class/class_contacts.php b/maarch_entreprise/trunk/class/class_contacts.php new file mode 100644 index 0000000000000000000000000000000000000000..3d6d8f10e4dc5db4f929aa5fb06ad2fee7aad050 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_contacts.php @@ -0,0 +1,741 @@ +<? +/** +* Contacts Class +* +* Contains all the specific functions to manage Contacts +* +* @version 2.0 +* @since 06/2007 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* @author Loïc Vinet <dev@maarch.org> +* +*/ + +/** +* Class Contacts : Contains all the specific functions to manage Contacts +* +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @version 2.0 +*/ + +class contacts extends dbquery +{ + /** + * Return the contacts data in sessions vars + * + * @param string $mode add or up + */ + public function contactinfo($mode) + { + // return the user information in sessions vars + $func = new functions(); + $_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] = $_REQUEST['is_corporate']; + if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'Y') + { + $_SESSION['m_admin']['contact']['SOCIETY'] = $func->wash($_REQUEST['society'], "no", _SOCIETY." ", 'yes', 0, 255); + $_SESSION['m_admin']['contact']['LASTNAME'] = ''; + } + else + { + $_SESSION['m_admin']['contact']['LASTNAME'] = $func->wash($_REQUEST['lastname'], "no", _LASTNAME, 'yes', 0, 255); + if ($_REQUEST['society'] <> '') + { + $_SESSION['m_admin']['contact']['SOCIETY'] = $func->wash($_REQUEST['society'], "no", _SOCIETY." ", 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['SOCIETY'] = ''; + } + } + if ($_REQUEST['title'] <> '') + { + $_SESSION['m_admin']['contact']['TITLE'] = $func->wash($_REQUEST['title'], "no", _TITLE2." ", 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['TITLE'] = ''; + } + + if ($_REQUEST['firstname'] <> '') + { + $_SESSION['m_admin']['contact']['FIRSTNAME'] = $func->wash($_REQUEST['firstname'], "no", _FIRSTNAME." ", 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['FIRSTNAME'] = ''; + } + + if ($_REQUEST['function'] <> '') + { + $_SESSION['m_admin']['contact']['FUNCTION'] = $func->wash($_REQUEST['function'], "no", _FUNCTION." ", 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['FUNCTION'] = ''; + } + + if ($_REQUEST['num'] <> '') + { + $_SESSION['m_admin']['contact']['ADD_NUM'] = $func->wash($_REQUEST['num'], "no", _NUM." ", 'yes', 0, 32); + } + else + { + $_SESSION['m_admin']['contact']['ADD_NUM'] = ''; + } + + if ($_REQUEST['street'] <> '') + { + $_SESSION['m_admin']['contact']['ADD_STREET'] = $func->wash($_REQUEST['street'], "no", _STREET." ", 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['ADD_STREET'] = ''; + } + + if ($_REQUEST['add_comp'] <> '') + { + $_SESSION['m_admin']['contact']['ADD_COMP'] = $func->wash($_REQUEST['add_comp'], "no", ADD_COMP." ", 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['ADD_COMP'] = ''; + } + + if ($_REQUEST['town'] <> '') + { + $_SESSION['m_admin']['contact']['ADD_TOWN'] = $func->wash($_REQUEST['town'], "no", _TOWN." ", 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['ADD_TOWN'] = ''; + } + if ($_REQUEST['cp'] <> '') + { + $_SESSION['m_admin']['contact']['ADD_CP'] = $func->wash($_REQUEST['cp'], "no", _POSTAL_CODE, 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['ADD_CP'] = ''; + } + if ($_REQUEST['country'] <> '') + { + $_SESSION['m_admin']['contact']['ADD_COUNTRY'] = $func->wash($_REQUEST['country'], "no", _COUNTRY, 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['ADD_COUNTRY'] = ''; + } + if ($_REQUEST['phone'] <> '') + { + $_SESSION['m_admin']['contact']['PHONE'] = $func->wash($_REQUEST['phone'], "num", _PHONE, 'yes', 0, 20); + } + else + { + $_SESSION['m_admin']['contact']['PHONE'] = ''; + } + if ($_REQUEST['mail'] <> '') + { + $_SESSION['m_admin']['contact']['MAIL'] = $func->wash($_REQUEST['mail'], "mail", _MAIL, 'yes', 0, 255); + } + else + { + $_SESSION['m_admin']['contact']['MAIL'] = ''; + } + if ($_REQUEST['comp_data'] <> '') + { + $_SESSION['m_admin']['contact']['OTHER_DATA'] = $func->wash($_REQUEST['comp_data'], "no", _COMP_DATA); + } + else + { + $_SESSION['m_admin']['contact']['OTHER_DATA'] = ''; + } + + if ($_REQUEST['owner'] <> '') + { + if(preg_match('/\((\s|\d|\h|\w)+\)$/i', $_REQUEST['owner']) == 0) + { + $_SESSION['error'] = _OWNER." "._WRONG_FORMAT.".<br/>"._USE_AUTOCOMPLETION; + } + else + { + $_SESSION['m_admin']['contact']['OWNER'] = str_replace(')', '', substr($_REQUEST['owner'], strrpos($_REQUEST['owner'],'(')+1)); + $_SESSION['m_admin']['contact']['OWNER'] = $func->wash($_SESSION['m_admin']['contact']['OWNER'], "no", _OWNER." ", 'yes', 0, 32); + } + } + else + { + $_SESSION['m_admin']['contact']['OWNER'] = ''; + } + } + + /** + * Add ou modify contact in the database + * + * @param string $mode up or add + */ + public function addupcontact($mode, $admin = true) + { + // add ou modify users in the database + $this->contactinfo($mode); + $path_contacts = $_SESSION['config']['businessappurl']."index.php?page=contacts&admin=contacts"; + $path_contacts_add_errors = $_SESSION['config']['businessappurl']."index.php?page=contact_add&admin=contacts"; + $path_contacts_up_errors = $_SESSION['config']['businessappurl']."index.php?page=contact_up&admin=contacts"; + if(!$admin) + { + $path_contacts = $_SESSION['config']['businessappurl']."index.php?page=my_contacts&dir=my_contacts"; + $path_contacts_add_errors = $_SESSION['config']['businessappurl']."index.php?page=my_contact_add&dir=my_contacts"; + $path_contacts_up_errors = $_SESSION['config']['businessappurl']."index.php?page=my_contact_up&dir=my_contacts"; + } + if(!empty($_SESSION['error'])) + { + if($mode == "up") + { + if(!empty($_SESSION['m_admin']['contact']['ID'])) + { + header("location: ".$path_contacts_up_errors."&id=".$_SESSION['m_admin']['contact']['ID']); + exit; + } + else + { + header("location: ".$path_contacts); + exit; + } + } + if($mode == "add") + { + header("location: ".$path_contacts_add_errors); + exit; + } + } + else + { + $this->connect(); + if($mode == "add") + { + if($admin) + { + $query = "INSERT INTO ".$_SESSION['tablename']['contacts']." ( lastname , firstname , society , function , phone , email , address_num, address_street, address_complement, address_town, address_postal_code, address_country, other_data, title, is_corporate_person) VALUES ( '".$this->protect_string_db($_SESSION['m_admin']['contact']['LASTNAME'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['FIRSTNAME'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['SOCIETY'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['FUNCTION'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['PHONE'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['MAIL'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_NUM'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_STREET'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_COMP'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_TOWN'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_CP'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_COUNTRY'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['OTHER_DATA'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['TITLE'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'])."' )"; + } + else + { + $query = "INSERT INTO ".$_SESSION['tablename']['contacts']." ( lastname , firstname , society , function , phone , email , address_num, address_street, address_complement, address_town, address_postal_code, address_country, other_data, title, is_corporate_person, user_id) VALUES ( '".$this->protect_string_db($_SESSION['m_admin']['contact']['LASTNAME'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['FIRSTNAME'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['SOCIETY'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['FUNCTION'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['PHONE'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['MAIL'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_NUM'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_STREET'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_COMP'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_TOWN'])."', '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_CP'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_COUNTRY'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['OTHER_DATA'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['TITLE'])."','".$this->protect_string_db($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'])."', '".$this->protect_string_db($_SESSION['user']['UserId'])."')"; + } + $this->query($query); + if($_SESSION['history']['contactadd']) + { + $this->query("select contact_id from ".$_SESSION['tablename']['contacts']." where lastname = '".$this->protect_string_db($_SESSION['m_admin']['contact']['LASTNAME'])."' and firstname = '".$this->protect_string_db($_SESSION['m_admin']['contact']['FIRSTNAME'])."' and society = '".$this->protect_string_db($_SESSION['m_admin']['contact']['SOCIETY'])."' and function = '".$this->protect_string_db($_SESSION['m_admin']['contact']['FUNCTION'])."' and phone = '".$this->protect_string_db($_SESSION['m_admin']['contact']['PHONE'])."' and email = '".$this->protect_string_db($_SESSION['m_admin']['contact']['MAIL'])."' and address_num = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_NUM'])."' and address_street = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_STREET'])."' and address_complement = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_COMP'])."' and address_town = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_TOWN'])."' and address_postal_code = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_CP'])."' and address_country = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_COUNTRY'])."' and other_data = '".$this->protect_string_db($_SESSION['m_admin']['contact']['OTHER_DATA'])."' and title = '".$this->protect_string_db($_SESSION['m_admin']['contact']['TITLE'])."' and is_corporate_person = '".$this->protect_string_db($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'])."'"); + $res = $this->fetch_object(); + $id = $res->contact_id; + if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'Y') + { + $msg = _CONTACT_ADDED.' : '.$this->protect_string_db($_SESSION['m_admin']['contact']['SOCIETY']); + } + else + { + $msg = _CONTACT_ADDED.' : '.$this->protect_string_db($_SESSION['m_admin']['contact']['LASTNAME'].' '.$_SESSION['m_admin']['contact']['FIRSTNAME']); + } + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['contacts'], $id,"ADD",$msg, $_SESSION['config']['databasetype']); + } + $this->clearcontactinfos(); + $_SESSION['error'] = _CONTACT_ADDED; + header("location: ".$path_contacts); + exit; + } + elseif($mode == "up") + { + $query = "update ".$_SESSION['tablename']['contacts']." set lastname = '".$this->protect_string_db($_SESSION['m_admin']['contact']['LASTNAME'])."', firstname = '".$this->protect_string_db($_SESSION['m_admin']['contact']['FIRSTNAME'])."',society = '".$this->protect_string_db($_SESSION['m_admin']['contact']['SOCIETY'])."',function = '".$this->protect_string_db($_SESSION['m_admin']['contact']['FUNCTION'])."',phone = '".$this->protect_string_db($_SESSION['m_admin']['contact']['PHONE'])."', email = '".$this->protect_string_db($_SESSION['m_admin']['contact']['MAIL'])."', address_num = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_NUM'])."', address_street = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_STREET'])."', address_complement = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_COMP'])."', address_town = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_TOWN'])."', address_postal_code = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_CP'])."', address_country = '".$this->protect_string_db($_SESSION['m_admin']['contact']['ADD_COUNTRY'])."', other_data = '".$this->protect_string_db($_SESSION['m_admin']['contact']['OTHER_DATA'])."', title = '".$this->protect_string_db($_SESSION['m_admin']['contact']['TITLE'])."', is_corporate_person = '".$this->protect_string_db($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'])."'"; + if($admin) + { + $query .= ", user_id = '".$this->protect_string_db($_SESSION['m_admin']['contact']['OWNER'])."'"; + } + $query .=" where contact_id = '".$_SESSION['m_admin']['contact']['ID']."' and enabled = 'Y'"; + if(!$admin) + { + $query .= " and user_id = '".$this->protect_string_db($_SESSION['user']['UserId'])."'"; + } + $this->query($query); + if($_SESSION['history']['contactup']) + { + if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'Y') + { + $msg = _CONTACT_MODIFIED.' : '.$this->protect_string_db($_SESSION['m_admin']['contact']['SOCIETY']); + } + else + { + $msg = _CONTACT_MODIFIED.' : '.$this->protect_string_db($_SESSION['m_admin']['contact']['LASTNAME'].' '.$_SESSION['m_admin']['contact']['FIRSTNAME']); + } + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['contacts'], $_SESSION['m_admin']['contact']['ID'],"UP",$msg, $_SESSION['config']['databasetype']); + } + $this->clearcontactinfos(); + $_SESSION['error'] = _CONTACT_MODIFIED; + header("location: ".$path_contacts); + exit(); + } + } + } + + /** + * Form to modify a contact + * + * @param $string $mode up or add + * @param int $id $id of the contact to change + */ + public function formcontact($mode,$id = "", $admin = true) + { + if (preg_match("/MSIE 6.0/", $_SERVER["HTTP_USER_AGENT"])) + { + $browser_ie = true; + $display_value = 'block'; + } + elseif(preg_match('/msie/i', $_SERVER["HTTP_USER_AGENT"]) && !preg_match('/opera/i', $HTTP_USER_AGENT) ) + { + $browser_ie = true; + $display_value = 'block'; + } + else + { + $browser_ie = false; + $display_value = 'table-row'; + } + $func = new functions(); + $state = true; + if(!isset($_SESSION['m_admin']['contact'])) + { + $this->clearcontactinfos(); + } + if( $mode <> "add") + { + $this->connect(); + $query = "select * from ".$_SESSION['tablename']['contacts']." where contact_id = ".$id." and enabled = 'Y'"; + if(!$admin) + { + $query .= " and user_id = '".$this->protect_string_db($_SESSION['user']['UserId'])."'"; + } + $this->query($query); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _THE_CONTACT.' '._ALREADY_EXISTS; + $state = false; + } + else + { + $_SESSION['m_admin']['contact'] = array(); + $line = $this->fetch_object(); + $_SESSION['m_admin']['contact']['ID'] = $line->contact_id; + $_SESSION['m_admin']['contact']['TITLE'] = $this->show_string($line->title); + $_SESSION['m_admin']['contact']['LASTNAME'] = $this->show_string($line->lastname); + $_SESSION['m_admin']['contact']['FIRSTNAME'] = $this->show_string($line->firstname); + $_SESSION['m_admin']['contact']['SOCIETY'] = $this->show_string($line->society); + $_SESSION['m_admin']['contact']['FUNCTION'] = $this->show_string($line->function); + $_SESSION['m_admin']['contact']['ADD_NUM'] = $this->show_string($line->address_num); + $_SESSION['m_admin']['contact']['ADD_STREET'] = $this->show_string($line->address_street); + $_SESSION['m_admin']['contact']['ADD_COMP'] = $this->show_string($line->address_complement); + $_SESSION['m_admin']['contact']['ADD_TOWN'] = $this->show_string($line->address_town); + $_SESSION['m_admin']['contact']['ADD_CP'] = $this->show_string($line->address_postal_code); + $_SESSION['m_admin']['contact']['ADD_COUNTRY'] = $this->show_string($line->address_country); + $_SESSION['m_admin']['contact']['PHONE'] = $this->show_string($line->phone); + $_SESSION['m_admin']['contact']['MAIL'] = $this->show_string($line->email); + $_SESSION['m_admin']['contact']['OTHER_DATA'] = $this->show_string($line->other_data); + $_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] = $this->show_string($line->is_corporate_person); + $_SESSION['m_admin']['contact']['OWNER'] = $line->user_id; + if(admin && !empty($_SESSION['m_admin']['contact']['OWNER'])) + { + $this->query("select lastname, firstname from ".$_SESSION['tablename']['users']." where user_id = '".$_SESSION['m_admin']['contact']['OWNER']."'"); + $res = $this->fetch_object(); + $_SESSION['m_admin']['contact']['OWNER'] = $res->lastname.', '.$res->firstname.' ('.$_SESSION['m_admin']['contact']['OWNER'].')'; + } + } + } + else if($mode == 'add') + { + $_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] = 'Y'; + } + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_business_app_tools.php"); + $business = new business_app_tools(); + $tmp = $business->get_titles(); + $titles = $tmp['titles']; + ?> + <h1><img src="<? echo $_SESSION['config']['img'];?>/picto_add_b.gif" alt="" /> + <?php + if($mode == "up") + { + echo _MODIFY_CONTACT; + } + elseif($mode == "add") + { + echo _ADD_CONTACT; + } + ?> + </h1> + <div id="inner_content" class="clearfix" align="center"> + <?php + if($state == false) + { + echo "<br /><br /><br /><br />"._THE_CONTACT." "._UNKOWN."<br /><br /><br /><br />"; + } + else + { + $action = $_SESSION['config']['businessappurl']."admin/contacts/contact_up_db.php"; + if(!$admin) + { + $action = $_SESSION['config']['businessappurl']."my_contacts/my_contact_up_db.php"; + } + ?> + <form name="frmcontact" id="frmcontact" method="post" action="<? echo $action;?>" class="forms"> + <table width="75%" > + <?php if($admin && $mode == "up") + { + ?> + <tr> + <td> + <label for="owner"><?php echo _OWNER; ?> : </label> + </td> + <td> </td> + <td class="indexing_field"><input name="owner" type="text" id="owner" value="<?php echo $func->show($_SESSION['m_admin']['contact']['OWNER']); ?>"/><div id="show_user" class="autocomplete"></div> + </td> + <td> </td> + </tr> + <?php + }?> + <tr> + <td><label for="is_corporate"><?php echo _IS_CORPORATE_PERSON; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input type="radio" class="check" name="is_corporate" value="Y" <? if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'Y'){?> checked="checked"<? } ?>/ onClick="javascript:show_admin_contacts( true, '<?echo $display_value;?>');"><? echo _YES;?> + <input type="radio" class="check" name="is_corporate" value="N" <? if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'N'){?> checked="checked"<? } ?> onClick="javascript:show_admin_contacts( false, '<?echo $display_value;?>');"/><? echo _NO;?> + </td> + <td> </td> + </tr> + <tr id="title_p" style="display:<? if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'Y'){ echo 'none';}else{ echo $display_value;}?>"> + <td><label for="title"><?php echo _TITLE2; ?> : </label></td> + <td> </td> + <td class="indexing_field"><select name="title" id="title" > + <option value=""><?php echo _CHOOSE_TITLE;?></option> + <?php + foreach(array_keys($titles) as $key) + { + ?><option value="<?php echo $key;?>" <?php + if(((!isset($_SESSION['m_admin']['contact']['TITLE']) || empty($_SESSION['m_admin']['contact']['TITLE']) ) && $key == $default_title) || ($key == $_SESSION['m_admin']['contact']['TITLE'] )) + { + echo 'selected="selected"'; + } + ?>><?php echo $titles[$key];?></option><?php + }?> + </select></td> + <td> </td> + </tr> + <tr id="lastname_p" style="display:<? if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'Y'){ echo 'none';}else{ echo $display_value;}?>"> + <td><label for="lastname"><?php echo _LASTNAME; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="lastname" type="text" id="lastname" value="<?php echo $func->show($_SESSION['m_admin']['contact']['LASTNAME']); ?>"/></td> + <td><span id="lastname_mandatory" class="red_asterisk" style="visibility:hidden;">*</span></td> + </tr> + <tr id="firstname_p" style="display:<? if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'Y'){ echo 'none';}else{ echo $display_value;}?>"> + <td><label for="firstname"><?php echo _FIRSTNAME; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="firstname" type="text" id="firstname" value="<?php echo $func->show($_SESSION['m_admin']['contact']['FIRSTNAME']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td><label for="society"><?php echo _SOCIETY; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="society" type="text" id="society" value="<?php echo $func->show($_SESSION['m_admin']['contact']['SOCIETY']); ?>"/></td> + <td class="indexing_field"><span class="red_asterisk" style="visibility:visible;" id="society_mandatory">*</span></td> + </tr> + <tr id="function_p" style="display:<? if($_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] == 'Y'){ echo 'none';}else{ echo $display_value;}?>"> + <td><label for="function"><?php echo _FUNCTION; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="function" type="text" id="function" value="<?php echo $func->show($_SESSION['m_admin']['contact']['FUNCTION']); ?>"/></td> + <td> </td> + </tr> + <tr > + <td><label for="phone"><?php echo _PHONE; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="phone" type="text" id="phone" value="<?php echo $func->show($_SESSION['m_admin']['contact']['PHONE']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td><label for="mail"><?php echo _MAIL; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="mail" type="text" id="mail" value="<?php echo $func->show($_SESSION['m_admin']['contact']['MAIL']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td colspan="4"><label><b><? echo _ADDRESS;?> </b></label></td> + </tr> + <tr> + <td><label for="num"><?php echo _NUM; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="num" type="text" id="num" value="<?php echo $func->show($_SESSION['m_admin']['contact']['ADD_NUM']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td><label for="street"><?php echo _STREET; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="street" type="text" id="street" value="<?php echo $func->show($_SESSION['m_admin']['contact']['ADD_STREET']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td><label for="add_comp"><?php echo _COMPLEMENT; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="add_comp" type="text" id="add_comp" value="<?php echo $func->show($_SESSION['m_admin']['contact']['ADD_COMP']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td><label for="town"><?php echo _TOWN; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="town" type="text" id="town" value="<?php echo $func->show($_SESSION['m_admin']['contact']['ADD_TOWN']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td><label for="cp"><?php echo _POSTAL_CODE; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="cp" type="text" id="cp" value="<?php echo $func->show($_SESSION['m_admin']['contact']['ADD_CP']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td><label for="country"><?php echo _COUNTRY; ?> : </label></td> + <td> </td> + <td class="indexing_field"><input name="country" type="text" id="country" value="<?php echo $func->show($_SESSION['m_admin']['contact']['ADD_COUNTRY']); ?>"/></td> + <td> </td> + </tr> + <tr> + <td colspan="4"><label><b><? echo _COMP;?> </b></label></td> + </tr> + <tr> + <td><label for="comp_data"><?php echo _COMP_DATA; ?> : </label></td> + <td> </td> + <td class="indexing_field"><textarea name="comp_data" id="comp_data"><?php echo $func->show($_SESSION['m_admin']['contact']['OTHER_DATA']); ?></textarea></td> + <td> </td> + </tr> + </table> + <input name="mode" type="hidden" value="<? echo $mode; ?>" /> + <p class="buttons"> + <?php + + if($mode == "up") + { + ?> + <input class="button" type="submit" name="Submit" value="<?php echo _MODIFY_CONTACT; ?>" /> + <?php + } + elseif($mode == "add") + { + ?> + <input type="submit" class="button" name="Submit" value="<?php echo _ADD_CONTACT; ?>" /> + <? + } + $cancel_target = $_SESSION['config']['businessappurl'].'index.php?page=contacts&admin=contacts'; + if(!$admin) + { + $cancel_target = $_SESSION['config']['businessappurl'].'index.php?page=my_contacts&dir=my_contacts'; + } + ?> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $cancel_target;?>';" /> + </p> + </form> + <?php + if($mode=="up" && $admin) + { + ?><script type="text/javascript">launch_autocompleter('<?php echo $_SESSION['config']['businessappurl'];?>users_autocomplete_list.php', 'owner', 'show_user');</script><?php + } + } + ?> + </div> + <?php + } + + /** + * Clear the session variables of the edmit 's administration + * + */ + private function clearcontactinfos() + { + // clear the session variable + $_SESSION['m_admin']['contact'] = array(); + $_SESSION['m_admin']['contact']['ID'] = ''; + $_SESSION['m_admin']['contact']['TITLE'] = ''; + $_SESSION['m_admin']['contact']['LASTNAME'] = ''; + $_SESSION['m_admin']['contact']['FIRSTNAME'] = ''; + $_SESSION['m_admin']['contact']['SOCIETY'] = ''; + $_SESSION['m_admin']['contact']['FUNCTION'] = ''; + $_SESSION['m_admin']['contact']['ADD_NUM'] = ''; + $_SESSION['m_admin']['contact']['ADD_STREET'] = ''; + $_SESSION['m_admin']['contact']['ADD_COMP'] = ''; + $_SESSION['m_admin']['contact']['ADD_TOWN'] = ''; + $_SESSION['m_admin']['contact']['ADD_CP'] = ''; + $_SESSION['m_admin']['contact']['ADD_COUNTRY'] = ''; + $_SESSION['m_admin']['contact']['PHONE'] = ''; + $_SESSION['m_admin']['contact']['MAIL'] = ''; + $_SESSION['m_admin']['contact']['OTHER_DATA'] = ''; + $_SESSION['m_admin']['contact']['IS_CORPORATE_PERSON'] = ''; + $_SESSION['m_admin']['contact']['OWNER'] = ''; + + } + + /** + * delete a model in the database + * + * @param string $id model identifier + */ + public function delcontact($id, $admin = true) + { + $path_contacts = $_SESSION['config']['businessappurl']."index.php?page=contacts&admin=contacts"; + if(!$admin) + { + $path_contacts = $_SESSION['config']['businessappurl']."index.php?page=my_contacts&dir=my_contacts"; + } + if(!empty($_SESSION['error'])) + { + header("location: ".$path_contacts); + exit; + } + else + { + $this->connect(); + $query = "select contact_id from ".$_SESSION['tablename']['contacts']." where enabled ='Y' and contact_id = ".$id; + if(!$admin) + { + $query .= " and user_id = '".$this->protect_string_db($_SESSION['user']['UserId'])."'"; + } + $this->query($query); + if($this->nb_result() == 0) + { + $_SESSION['error'] = _THE_CONTACT.' '._UNKNOWN; + header("location: ".$path_contacts); + exit; + } + else + { + $res = $this->fetch_object(); + $label = $res->LABEL; + $this->query("update ".$_SESSION['tablename']['contacts']." set enabled = 'N' where contact_id = ".$id); + if($_SESSION['history']['contactdel']) + { + require_once($_SESSION['pathtocoreclass'].'class_history.php'); + $hist = new history(); + $hist->add($_SESSION['tablename']['contacts'], $id,"DEL",_CONTACT_DELETED.' : '.$id, $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _CONTACT_DELETED; + header("location: ".$path_contacts); + exit; + } + } + } + function get_contact_information($res_id, $category_id,$view ) + //Get contact full information for each case: incoming document or outgoing document + { + $stopthis=false; + $column_title = false; + $column_value = false; + $column_join = false; + + + $this->connect(); + //For this 3 cases, we need to create a different string + + if ($category_id == 'incoming') + { + + $prefix = _TO_CONTACT_C; + $this->query("SELECT exp_user_id, exp_contact_id from ".$view." WHERE res_id = ".$res_id); + + $compar = $this->fetch_object(); + + + if ($compar->exp_user_id <> '') + { + + $column_title = "user_id"; + $column_value = $compar->exp_user_id; + $column_join = $_SESSION['tablename']['users']; + } + elseif ($compar->exp_contact_id <> '') + { + + $column_title = "contact_id"; + $column_value = $compar->exp_contact_id; + $column_join = $_SESSION['tablename']['contacts']; + } + else + { + $stopthis = true; + } + } + elseif ($category_id == 'outgoing' || $category_id == 'internal') + { + $prefix = _FOR_CONTACT_C; + + $this->query("SELECT dest_user_id, dest_contact_id from ".$view." WHERE res_id = ".$res_id); + + $compar = $this->fetch_object(); + if ($compar->dest_user_id <> '') + { + + $column_title = "user_id"; + $column_value = $compar->dest_user_id; + $column_join = $_SESSION['tablename']['users']; + } + elseif ($compar->dest_contact_id <> '') + { + + $column_title = "contact_id"; + $column_value = $compar->dest_contact_id; + $column_join = $_SESSION['tablename']['contacts']; + } + else + { + $stopthis = true; + } + } + else + { + $stopthis = true; + } + if($stopthis == true) + { + return false; + } + + //If we need to find a contact, get the society first + if ($column_join == $_SESSION['tablename']['contacts']) + $fields = 'c.firstname, c.lastname, c.society '; + elseif ($column_join == $_SESSION['tablename']['users']) + $fields = 'c.firstname, c.lastname'; + else + $fields = ''; + + //Launching request to restore full contact string + $this->query("SELECT ".$fields." from ".$column_join." c where ".$column_title." = '".$column_value."'"); + + $final = $this->fetch_object(); + + $firstname = $final->firstname; + $lastname = $final->lastname; + if ($final->society <> '') + { + if ($firstname =='' && $lastname == '') + { + $society = $final->society; + } + else + { + $society = " (".$final->society.") "; + } + } + else + $society = ""; + + $the_contact =$prefix." ".$firstname." ".$lastname." ".$society; + return $the_contact; + + } + +} +?> diff --git a/maarch_entreprise/trunk/class/class_indexing_searching_app.php b/maarch_entreprise/trunk/class/class_indexing_searching_app.php new file mode 100644 index 0000000000000000000000000000000000000000..2efd0ef4764fae59edeefc9da1313846d31457e6 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_indexing_searching_app.php @@ -0,0 +1,1094 @@ +<?php +/** +* modules tools Class for workflow +* +* Contains all the functions to load modules tables for workflow +* +* @package maarch +* @version 3.0 +* @since 10/2005 +* @license GPL v3 +* @author Laurent Giovannoni <dev@maarch.org> +* +*/ + +class indexing_searching_app extends dbquery +{ + function __construct() + { + parent::__construct(); + } + + +/* public function load_module_var_session() + { + $func = new functions(); + $_SESSION['index'] = array(); + + for($j=0; $j < count($_SESSION['collections']); $j++) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']] = array(); + $xmlfile = simplexml_load_file($_SESSION['pathtomodules']."indexing_searching".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR.$_SESSION['collections'][$j]['index_file']); + $path_lang = $_SESSION['pathtomodules']."indexing_searching".DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'; + $i = 0; + + foreach($xmlfile->INDEX as $INDEX) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['COLUMN'] = (string) $INDEX->COLUMN; + $tmp = (string) $INDEX->LABEL; + $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); + if($tmp2 <> false) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['LABEL'] = $tmp2; + } + else + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['LABEL']= $tmp; + } + if(isset($INDEX->FOREIGN_KEY) && !empty($INDEX->FOREIGN_KEY)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['FOREIGN_KEY']= (string) $INDEX->FOREIGN_KEY; + } + if(isset($INDEX->FOREIGN_LABEL) && !empty($INDEX->FOREIGN_LABEL)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['FOREIGN_LABEL']= (string) $INDEX->FOREIGN_LABEL; + } + if(isset($INDEX->TABLENAME) && !empty($INDEX->TABLENAME)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['TABLENAME']= (string) $INDEX->TABLENAME; + } + if(isset($INDEX->ORDER) && !empty($INDEX->ORDER)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['ORDER']= (string) $INDEX->ORDER; + } + if(isset($INDEX->WHERE) && !empty($INDEX->WHERE)) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['WHERE']= (string) $INDEX->WHERE; + } + + if(count($INDEX->VALUES) > 0) + { + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['VALUES'] = array(); + $k=0; + foreach($INDEX->VALUES as $value) + { + //$_SESSION['index'][$i]['VALUES'][$k]['id'] = (string) $value->ID; + $_SESSION['index'][$_SESSION['collections'][$j]['id']][$i]['VALUES'][$k]['label'] = (string) $value->LABEL; + $k++; + } + } + $i++; + } + } + } + */ + public function is_filetype_allowed($ext) + { + $xmlconfig = simplexml_load_file($_SESSION['config']['businessapppath'].'xml'.DIRECTORY_SEPARATOR.'extensions.xml'); + + $ext_list = array(); + $i = 0; + foreach($xmlconfig->FORMAT as $FORMAT) + { + $ext_list[$i] = array("name" => (string) $FORMAT->name, "mime" => (string) $FORMAT->mime); + $i++; + } + + $type_state = false; + for($i=0;$i<count($ext_list);$i++) + { + if($ext_list[$i]['name'] == strtoupper($ext)) + { + $mime_type = $ext_list[$i]['mime']; + $type_state = true; + // $i = count($ext_list); + break; + } + } + return $type_state; + } + + public function show_index_frame($ext) + { + if(empty($ext)) + { + return false; + } + $xmlconfig = simplexml_load_file($_SESSION['config']['businessapppath'].'xml'.DIRECTORY_SEPARATOR.'extensions.xml'); + + foreach($xmlconfig->FORMAT as $FORMAT) + { + if(strtoupper($ext) == (string) $FORMAT->name) + { + if( $FORMAT->index_frame_show == "true") + { + return true; + } + else + { + return false; + } + } + } + return false; + } + public function filetypes_showed_indexation() + { + + $xmlconfig = simplexml_load_file($_SESSION['config']['businessapppath'].'xml'.DIRECTORY_SEPARATOR.'extensions.xml'); + + $ext_list = array(); + foreach($xmlconfig->FORMAT as $FORMAT) + { + if((string) $FORMAT->index_frame_show == "true") + { + array_push($ext_list,(string) $FORMAT->name); + } + } + + return $ext_list; + } + + public function get_mime_type($ext) + { + $xmlconfig = simplexml_load_file($_SESSION['config']['businessapppath'].'xml'.DIRECTORY_SEPARATOR.'extensions.xml'); + $ext_list = array(); + $i = 0; + foreach($xmlconfig->FORMAT as $FORMAT) + { + $ext_list[$i] = array("name" => (string) $FORMAT->name, "mime" => (string) $FORMAT->mime); + $i++; + } + for($i=0;$i<count($ext_list);$i++) + { + if($ext_list[$i]['name'] == strtoupper($ext)) + { + $mime_type = $ext_list[$i]['mime']; + //echo "ici ".$mime_type; + $type_state = true; + $i = count($ext_list); + return $mime_type; + break; + } + } + return false; + } + + /*public function retrieve_index($array, $coll_id) + { + + unset($_SESSION['index_to_use']); + $z = 0; + + for($i=0;$i<count($_SESSION['index'][$coll_id]);$i++) + { + foreach(array_keys($array) as $value) + { + + if($value <> "res_table" && $value <> "type_id" && $value <> "description" && $value <> "enabled" && $value <> "doctypes_first_level_id" && $value <> "doctypes_second_level_id" && $value <> "retention" && !is_numeric($value)) + { + if($array[$value] == '1000000000' || $array[$value] == '1100000000') + { + + if($_SESSION['index'][$coll_id][$i]['COLUMN'] == $value) + { + $_SESSION['index_to_use'][$z]['column'] = $_SESSION['index'][$coll_id][$i]['COLUMN']; + $_SESSION['index_to_use'][$z]['label'] = $this->show_string($_SESSION['index'][$coll_id][$i]['LABEL']); + $_SESSION['index_to_use'][$z]['date'] = $this->is_date_column($_SESSION['index'][$coll_id][$i]['COLUMN']); + if($array[$value] == '1100000000') + { + $_SESSION['index_to_use'][$z]['mandatory'] = true; + } + if(isset($_SESSION['index'][$coll_id][$i]['FOREIGN_KEY']) && !empty($_SESSION['index'][$coll_id][$i]['FOREIGN_KEY'])) + { + $_SESSION['index_to_use'][$z]['foreign_key'] = $_SESSION['index'][$coll_id][$i]['FOREIGN_KEY']; + } + if(isset($_SESSION['index'][$coll_id][$i]['FOREIGN_LABEL']) && !empty($_SESSION['index'][$coll_id][$i]['FOREIGN_LABEL'])) + { + $_SESSION['index_to_use'][$z]['foreign_label'] = $_SESSION['index'][$coll_id][$i]['FOREIGN_LABEL']; + } + if(isset($_SESSION['index'][$coll_id][$i]['TABLENAME']) && !empty($_SESSION['index'][$coll_id][$i]['TABLENAME'])) + { + $_SESSION['index_to_use'][$z]['tablename'] = $_SESSION['index'][$coll_id][$i]['TABLENAME']; + } + if(isset($_SESSION['index'][$coll_id][$i]['WHERE']) && !empty($_SESSION['index'][$coll_id][$i]['WHERE'])) + { + $_SESSION['index_to_use'][$z]['where'] = $_SESSION['index'][$coll_id][$i]['WHERE']; + } + if(isset($_SESSION['index'][$coll_id][$i]['ORDER']) && !empty($_SESSION['index'][$coll_id][$i]['ORDER'])) + { + $_SESSION['index_to_use'][$z]['order'] = $_SESSION['index'][$coll_id][$i]['ORDER']; + } + + if(isset($_SESSION['index'][$coll_id][$i]['VALUES']) && count($_SESSION['index'][$coll_id][$i]['VALUES']) > 0) + { + $_SESSION['index_to_use'][$z]['values'] = $_SESSION['index'][$coll_id][$i]['VALUES']; + } + $z++; + } + } + } + } + } + + } + + public function retrieve_index_label($column, $coll_id) + { + for($i=0;$i<count($_SESSION['index'][$coll_id]);$i++) + { + if($_SESSION['index'][$coll_id][$i]['COLUMN'] == $column) + { + return $_SESSION['index'][$coll_id][$i]['LABEL']; + } + elseif($_SESSION['index'][$coll_id][$i]['COLUMN'] == 'doc_'.$column) + { + return $_SESSION['index'][$coll_id][$i]['LABEL']; + } + } + } + + public function user_exit($coll_id,$value, $data, $data_is_array = true, $is_view=false) + { + require_once($_SESSION['pathtocoreclass']."class_functions.php"); + $func = new functions(); + + if(!$is_view) + { + $tmp = preg_replace('/^doc_/', '', $value); + } + else + { + $tmp = $value; + } + if($this->is_date_column($tmp)) + { + if(preg_match($_SESSION['date_pattern'],$_REQUEST[$value])== false) + { + $_SESSION['error'] .= $this->retrieve_index_label($tmp, $coll_id)." "._WRONG_FORMAT.".<br/>"; + $_SESSION['field_error'][$value] = true; + } + else + { + $_SESSION['field_error'][$value] = false; + } + require_once($_SESSION['pathtocoreclass']."class_functions.php"); + $func = new functions(); + if($data_is_array) + { + array_push($data, array('column' => $tmp, 'value' => $func->format_date_db($_REQUEST[$value]), 'type' => 'date')); + } + else + { + $data .= $tmp." >='".$func->format_date_db($_REQUEST[$value])."' and "; + } + + } + if($this->is_text_column($tmp)) + { + $field_value = $func->wash($_REQUEST[$value],"no",$this->retrieve_index_label($tmp, $coll_id)); + if($data_is_array) + { + array_push($data, array('column' => $tmp, 'value' => $func->protect_string_db($_REQUEST[$value]), 'type' => 'string')); + if($field_value == "") + { + $_SESSION['field_error'][$value] = true; + } + else + { + $_SESSION['field_error'][$value] = false; + } + } + else + { + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $data .= $tmp." ilike '".$this->protect_string_db($field_value)."%' and "; + } + else + { + $data .= $tmp." like '".$this->protect_string_db($field_value)."%' and "; + } + } + } + if($this->is_numeric_column($value)) + { + $field_value = $func->wash($_REQUEST[$value],"num",$this->retrieve_index_label($tmp, $coll_id)); + if($data_is_array) + { + array_push($data, array('column' => $tmp, 'value' => $_REQUEST[$value], 'type' => 'int')); + if($field_value == "") + { + $_SESSION['field_error'][$value] = true; + } + else + { + $_SESSION['field_error'][$value] = false; + } + } + else + { + $data .= $tmp.' ='.$field_value." and "; + } + } + if($this->is_float_column($value)) + { + $field_value = $func->wash($_REQUEST[$value],"float",$this->retrieve_index_label($tmp, $coll_id)); + if($data_is_array) + { + array_push($data, array('column' => $tmp, 'value' => $_REQUEST[$value], 'type' => 'float')); + if($field_value == "") + { + $_SESSION['field_error'][$value] = true; + } + else + { + $_SESSION['field_error'][$value] = false; + } + } + else + { + $data .= $tmp.' ='.$field_value." and "; + } + } + + return $data; + } + + public function is_date_column($column) + { + $string = $column; + $search="'custom_d'"; + preg_match($search,$string,$out); + $count=count($out[0]); + if($count == 1) + { + $find = true; + } + return $find; + } + + public function is_text_column($column) + { + $string = $column; + $search="'custom_t'"; + preg_match($search,$string,$out); + $count=count($out[0]); + if($count == 1) + { + $find = true; + } + return $find; + } + + public function is_numeric_column($column) + { + $string = $column; + $search="'custom_n'"; + preg_match($search,$string,$out); + $count=count($out[0]); + if($count == 1) + { + $find = true; + } + return $find; + } + + public function is_float_column($column) + { + $string = $column; + $search="'custom_f'"; + preg_match($search,$string,$out); + $count=count($out[0]); + if($count == 1) + { + $find = true; + } + return $find; + } + + public function is_mandatory_field($column) + { + $string = $column; + $search="'mandatory_'"; + preg_match($search,$string,$out); + $count=count($out[0]); + if($count == 1) + { + $find = true; + } + return $find; + } + + public function is_mandatory($column, $typeform = "GET") + { + if($typeform == "GET") + { + if($_REQUEST['mandatory_'.$column] == "true") + { + $find = true; + } + } + else + { + if($_REQUEST['mandatory_'.$column] == "true") + { + $find = true; + } + } + return $find; + } + + public function is_doctype_field($column) + { + $string = $column; + $search="'doctype_'"; + preg_match($search,$string,$out); + $count=count($out[0]); + if($count == 1) + { + $find = true; + } + return $find; + } +*/ + public function update_mail($post, $typeform, $id_to_update, $coll_id) + { + require_once($_SESSION['pathtocoreclass']."class_functions.php"); + require_once($_SESSION['pathtocoreclass']."class_request.php"); + require_once($_SESSION['pathtocoreclass']."class_history.php"); + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $hist = new history(); + $func = new functions(); + $sec = new security(); + $data_res = array(); + $data_ext = array(); + $request = new request(); + $core = new core_tools(); + + if($_SESSION['config']['databasetype'] == "SQLSERVER") + { + $_SESSION['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; + } + else // MYSQL & POSTGRESQL + { + $_SESSION['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; + } + /* foreach(array_keys($post) as $value) + { + $tmp = preg_replace('/^doc_/', '', $value); + if($value <> "submit" && $value <> "submit_index_doc" && value <> "delete_doc" && !$this->is_mandatory_field($value) && !$this->is_doctype_field($value)) + { + //echo $value." ".$post[$value]."<br/>"; + if($this->is_mandatory($value, $typeform)) + { + if(empty($post[$value])) + { + $_SESSION['error'] .= $this->retrieve_index_label($tmp, $coll_id)." "._MANDATORY.".<br/>"; + $_SESSION['field_error'][$value] = true; + //echo $_SESSION['error']; + } + } + + if(!empty($post[$value])) + { + $data = $this->user_exit($coll_id, $value, $data, $typeform); + } + $_SESSION['indexing'][$tmp] = $post[$value]; + } + }*/ + + $table = $sec->retrieve_table_from_coll($coll_id); + $view = $sec->retrieve_view_from_coll_id($coll_id); + $ind_coll = $sec->get_ind_collection($coll_id); + $table_ext = $_SESSION['collections'][$ind_coll]['extensions'][0]; + if(!$table) + { + $_SESSION['error'] .= _COLL_HAS_NO_TABLE; + } + if(!empty($_SESSION['error'])) + { + $_SESSION['error_page'] = $_SESSION['error']; + $_SESSION['error']= ''; + ?> + <script language="javascript" type="text/javascript"> + // window.opener.reload(); + var error_div = $('main_error'); + if(error_div) + { + error_div.innerHTML = '<?php echo $_SESSION['error_page'];?>'; + } + </script> + <?php + exit(); + } + $where = "res_id = ".$id_to_update; + $request->connect(); + $request->query("select category_id from ".$view." where ".$where); + $res = $request->fetch_object(); + $cat_id = $res->category_id; + + // Simple cases + foreach(array_keys($post) as $key) + { + if($_ENV['categories'][$cat_id][$key]['mandatory'] == true && $post[$key] == '' ) + { + $_SESSION['error'] .= $_ENV['categories'][$cat_id][$key]['label'].' '._IS_EMPTY.'<br/>'; + } + if($_ENV['categories'][$cat_id][$key]['type_form'] == 'date' && !empty($post[$key]) && preg_match($_ENV['date_pattern'],$post[$key])== 0) + { + $_SESSION['error'] .= $_ENV['categories'][$cat_id][$key]['label']." "._WRONG_FORMAT." <br/>"; + } + else if($_ENV['categories'][$cat_id][$key]['type_field'] == 'date' && $_ENV['categories'][$cat_id][$key]['table'] <> 'none' && !empty($post[$key])) + { + if($_ENV['categories'][$cat_id][$key]['table'] == 'res') + { + array_push($data_res, array('column' => $key, 'value' => $func->format_date_db($post[$key]), 'type' => "date")); + } + else if($_ENV['categories'][$cat_id][$key]['table'] == 'coll_ext') + { + array_push($data_ext, array('column' => $key, 'value' => $func->format_date_db($post[$key]), 'type' => "date")); + } + } + if($_ENV['categories'][$cat_id][$key]['type_form'] == 'integer' && !empty($post[$key]) && preg_match("/^[0-9]*$/",$post[$key])== 0) + { + $_SESSION['error'] .= $_ENV['categories'][$cat_id][$key]['label']." "._WRONG_FORMAT." <br/>"; + } + else if($_ENV['categories'][$cat_id][$key]['type_field'] == 'integer' && $_ENV['categories'][$cat_id][$key]['table'] <> 'none' && $post[$key] != '') + { + if($_ENV['categories'][$cat_id][$key]['table'] == 'res') + { + array_push($data_res, array('column' => $key, 'value' => $post[$key], 'type' => "integer")); + } + else if($_ENV['categories'][$cat_id][$values_form[$i]['ID']]['table'] == 'coll_ext') + { + array_push($data_ext, array('column' => $key, 'value' => $post[$key], 'type' => "integer")); + } + } + if($_ENV['categories'][$cat_id][$key]['type_form'] == 'radio' && !empty($post[$key]) && !in_array($post[$key], $_ENV['categories'][$cat_id][$key]['values'])) + { + $_SESSION['error'] .= $_ENV['categories'][$cat_id][$key]['label']." "._WRONG_FORMAT." <br/>"; + } + if($_ENV['categories'][$cat_id][$key]['type_field'] == 'string' && $_ENV['categories'][$cat_id][$key]['table'] <> 'none' && !empty($post[$key])) + { + if($_ENV['categories'][$cat_id][$key]['table'] == 'res') + { + array_push($data_res, array('column' => $key, 'value' => $func->protect_string_db($post[$key]), 'type' => "string")); + } + else if($_ENV['categories'][$cat_id][$key]['table'] == 'coll_ext') + { + array_push($data_ext, array('column' => $key, 'value' => $func->protect_string_db($post[$key]), 'type' => "string")); + } + } + } + + ///////////////////////// Other cases + if($core->is_module_loaded('folder')) + { + $market = ''; + if(isset($post['market'])) + { + $market = $post['market']; + } + $project_id = ''; + $market_id = ''; + if(isset($_ENV['categories'][$cat_id]['other_cases']['market']) && $_ENV['categories'][$cat_id]['other_cases']['market']['mandatory'] == true ) + { + if(empty($market) ) + { + $_SESSION['error'] .= $_ENV['categories'][$cat_id]['other_cases']['market']['label'].' '._IS_EMPTY.'<br/>'; + } + } + if(!empty($market) ) + { + if(!preg_match('/\([0-9]+\)$/', $market)) + { + $_SESSION['error'] .= $_ENV['categories'][$cat_id]['other_cases']['market']['label']." "._WRONG_FORMAT." <br/>"; + } + $market_id = str_replace(')', '', substr($market, strrpos($market,'(')+1)); + $request->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$market_id); + if($request->nb_result() == 0) + { + $_SESSION['error'] .= _MARKET.' '.$market_id.' '._UNKNOWN.'<br/>'; + } + } + $project = ''; + if(isset($post['project'])) + { + $project = $post['project']; + } + if(isset($_ENV['categories'][$cat_id]['other_cases']['project']) && $_ENV['categories'][$cat_id]['other_cases']['project']['mandatory'] == true) + { + if(empty($project)) + { + $_SESSION['error'] .= $_ENV['categories'][$cat_id]['other_cases']['project']['label'].' '._IS_EMPTY.'<br/>'; + } + } + if(!empty($project) ) + { + if(!preg_match('/\([0-9]+\)$/', $project)) + { + $_SESSION['error'] .= $_ENV['categories'][$cat_id]['other_cases']['project']['label']." "._WRONG_FORMAT." <br/>"; + } + $project_id = str_replace(')', '', substr($project, strrpos($project,'(')+1)); + $request->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$project_id); + if($request->nb_result() == 0) + { + $_SESSION['error'] .= _MARKET.' '.$project_id.' '._UNKNOWN.'<br/>'; + } + } + if(!empty($project_id) && !empty($market_id)) + { + $request->query("select folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$market_id." and parent_id = ".$project_id); + if($request->nb_result() == 0) + { + $_SESSION['error'] .= _INCOMPATIBILITY_MARKET_PROJECT.'<br/>'; + } + } + + if(empty($_SESSION['error'])) + { + $folder_id = ''; + if(!empty($market_id)) + { + $folder_id = $market_id; + } + else if(!empty($project_id)) + { + $folder_id = $project_id; + } + if(!empty($folder_id)) + { + array_push($data_res, array('column' => 'folders_system_id', 'value' => $folder_id, 'type' => "integer")); + } + } + } + + if($core->is_module_loaded('physical_archive')) + { + // Arbox id + $box_id = ''; + if(isset($post['arbox_id'])) + { + $box_id = $post['arbox_id']; + } + + if(isset($_ENV['categories'][$cat_id]['other_cases']['arbox_id']) && $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['mandatory'] == true) + { + if($box_id == false) + { + $_SESSION['error'] .= _NO_BOX_SELECTED.' <br/>'; + } + } + if($box_id != false && preg_match('/^[0-9]+$/', $box_id)) + { + require_once($_SESSION['pathtomodules'].'physical_archive'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'); + $physical_archive = new physical_archive(); + $pa_return_value = $physical_archive->load_box_db($box_id, $cat_id, $_SESSION['user']['UserId']); + if ($pa_return_value == false) + { + $_SESSION['error'] .= _ERROR_TO_INDEX_NEW_BATCH_WITH_PHYSICAL_ARCHIVE.'<br/>'; + } + else + { + array_push($data_res, array('column' => 'arbox_id', 'value' => $box_id, 'type' => "integer")); + array_push($data_res, array('column' => 'arbatch_id', 'value' => $pa_return_value, 'type' => "integer")); + } + } + } + + //$this->show_array($post); + if(empty($_SESSION['error'])) + { + //$request->show_array($data_res); + $request->update($table, $data_res, $where, $_SESSION['config']['databasetype']); + $request->update($table_ext, $data_ext, $where, $_SESSION['config']['databasetype']); + $_SESSION['error'] = _INDEX_UPDATED." (".strtolower(_NUM).$id_to_update.")"; + + $hist->add($table, $id_to_update, "UP", $_SESSION['error'], $_SESSION['config']['databasetype'],'apps'); + } + $_SESSION['error_page'] = $_SESSION['error']; + $_SESSION['error']= ''; + ?> + <script language="javascript" type="text/javascript"> + // window.opener.reload(); + var error_div = $('main_error'); + if(error_div) + { + error_div.innerHTML = '<?php echo $_SESSION['error_page'];?>'; + } + </script> + <?php + } + + public function delete_doc( $id_to_delete, $coll_id) + { + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec = new security(); + $table = $sec->retrieve_table_from_coll($coll_id); + + if(!$table) + { + $_SESSION['error'] .= _COLL_HAS_NO_TABLE; + } + if(!empty($_SESSION['error'])) + { + $_SESSION['error_page'] = $_SESSION['error']; + ?> + <script language="javascript" type="text/javascript"> + window.opener.reload(); + </script> + <?php + } + else + { + require_once($_SESSION['pathtocoreclass']."class_request.php"); + $request = new request(); + $data = array(); + array_push($data, array('column' => 'status', 'value' => 'DEL', 'type' => 'string')); + $where = "res_id = ".$id_to_delete; + $request->update($table, $data, $where, $_SESSION['config']['databasetype']); + $_SESSION['error_page'] = _DOC_DELETED." ("._NUM." : ".$id_to_delete.")"; + if($_SESSION['history']['res_del']) + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($table, $id_to_delete, "DEL", $_SESSION['error_page'], $_SESSION['config']['databasetype'],'indexing_searching'); + } + } + } + + public function send_criteria_data($param) + { + /*list_criteres = Array ("num_courrier" => Array (label => "reference courrier', + parametres => Array ( ...), + type => "text", + ), + "date courrier" => array*/ + //$this->show_array($param); + $options_criteria_list = '<option id="default" value="">'._CHOOSE_PARAMETERS.'</option>'; + $json_tab = ''; + foreach($param as $key => $value) + { + $json_tab .= "'".$key."' : {"; + //echo 'key '.$key."<br/>val "; + //$this->show_array($value); + $options_criteria_list .= '<option id="option_'.$key.'" value="'.$value['label'].'"> '.$value['label'].'</option>'; + $json_tab .= $this->json_line($key,$value['type'],$value['param']); + $json_tab .= '} + ,'; + } + $json_tab = preg_replace("/,$/", '', $json_tab); + + $tab = array($options_criteria_list, $json_tab ); + + return $tab; + } + + private function json_line($id, $field_type, $param) + { + $str = ''; + $init = "'label' : '".addslashes($param['field_label'])."', 'value' :'"; + $end = "'"; + //$hidden = '<input type="hidden" name="meta[]" value="" />'; + if($field_type == 'input_text') + { + $str = $init.'<input type="hidden" name="meta[]" value="'.$id.'#'.$id.'#input_text" /><input name="'.$id.'" id="'.$id.'" type="text" '.$param['other'].' value="" />'.$end; + } + /*elseif($field_type == 'contact') + { + $str = '<table align="center" border="0" width="100%" ><tr>'; + $str .='<td><input type="radio" class="check" name="type_contact_'.$id.'" id="type_contact_internal_'.$id.'" value="internal" onchange="change_contact_type(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\');" />'._INTERNAL.'<input type="radio" class="check" name="type_contact_'.$id.'" id="type_contact_external_'.$id.'" value="external" onchange="change_contact_type(\''.$_SESSION['config']['businessappurl'].'indexing_searching/autocomplete_contacts.php\');"/>'._EXTERNAL.'<br/></td></tr>'; + $str .='<tr><td><input type="text" name="contact" id="contact" /><div id="show_contacts" class="autocomplete"></div></td>'; + $str .= '</tr></table>'; + $str = addslashes($str); + $str = $init.$str.'<input type="hidden" name="meta[]" value="'.$id.'#'.$id.'#contact" />'.$end; + }*/ + else if($field_type == 'textarea') + { + $str = $init.'<input type="hidden" name="meta[]" value="'.$id.'#'.$id.'#textarea" /><textarea name="'.$id.'" id="'.$id.'" '.$param['other'].' rows="2" style="display:block;width:530px;"></textarea>'.$end; + } + elseif($field_type == 'date_range') + { + $str = $init.addslashes(_SINCE).' : <input type="text" name="'.$param['id1'].'" id="'.$param['id1'].'" value=""/ onclick="showCalender(this);"> ' + .addslashes(_FOR).' : <input type="text" name="'.$param['id2'].'" id="'.$param['id2'].'" value="" / onclick="showCalender(this);">'; + $str .= '<input type="hidden" name="meta[]" value="'.$id.'#'.$param['id1'].','.$param['id2'].'#date_range" />'.$end; + } + elseif($field_type == 'select_simple') + { + $str = $init.'<select name="'.$id.'" id="'.$id.'">'; + if(isset($param['default_label']) && !empty($param['default_label'])) + { + $str .='<option value="">'.$param['default_label'].'</option>'; + } + for($i=0; $i<count($param['options']);$i++) + { + $str .= '<option value="'.addslashes($param['options'][$i]['VALUE']).'">'.addslashes($param['options'][$i]['LABEL']).'</option>'; + } + $str .= '</select>'; + $str .= '<input type="hidden" name="meta[]" value="'.$id.'#'.$id.'#select_simple" />'.$end; + } + elseif($field_type == 'select_multiple') + { + $str .= '<tr><td colspan="3">'.$param['label_title'].' :</td></tr>'; + $str .= '<tr>'; + $str .= '<td width="150" align="left">'; + $str .= '<select name="'.$param['id'].'_available[]" id="'.$param['id'].'_available" size="10" ondblclick="moveclick_ext('." '".$param['id']."_available', '".$param['id']."_chosen'".');" multiple="multiple" >'; + for($i=0; $i<count($param['options']);$i++) + { + $str .= '<option value="'.$param['options'][$i]['VALUE'].'">'.$param['options'][$i]['LABEL'].'</option>'; + } + $str .='</select>'; + $str .= "<br/><em><a href=\"javascript:selectall_ext( '".$param['id']."_available');\" >"._SELECT_ALL.'</a></em>'; + $str .= '</td>'; + $str .= '<td width="135" align="center">'; + $str .= '<input type="button" class="button" value="'._ADD.'" onclick="Move_ext('."'".$param['id']."_available', '".$param['id']."_chosen'".');" /><br />'; + $str .= '<br /><input type="button" class="button" value="'._REMOVE.'" onclick="Move_ext('." '".$param['id']."_chosen', '".$param['id']."_available'".');" />'; + $str .= '</td>'; + $str .= '<td width="150" align="left">'; + $str .= '<select name="'.$param['id'].'_chosen[]" id="'.$param['id'].'_chosen" size="10" ondblclick="moveclick_ext('." '".$param['id']."_chosen', '".$param['id']."_available'".');" multiple="multiple" " >'; + $str .= '</select>'; + $str .= "<br/><em><a href=\"javascript:selectall_ext( '".$param['id']."_chosen');\" >"._SELECT_ALL.'</a></em>'; + $str .= '</td>'; + $str .= '</tr>'; + $str = addslashes($str); + $str = $init.'<table align="center" border="0" width="100%" >'.$str.'<input type="hidden" name="meta[]" value="'.$id.'#'.$param['id'].'_chosen#select_multiple" /></table>'.$end; + } + elseif($field_type == 'checkbox') + { + $str = $init.'<table align="center" border="0" width="100%" >'; + + $tmp_ids = ''; + for($i=0; $i < count($param['checkbox_data']);$i=$i+2) + { + $tmp_ids .= $param['checkbox_data'][$i]['ID'].','; + $str .= '<tr>'; + if(isset($param['checkbox_data'][$i+1]['ID'])) + { + $tmp_ids .= $param['checkbox_data'][$i+1]['ID'].','; + $str .= '<td><input type="checkbox" class="check" name="'.$param['checkbox_data'][$i]['ID'].'" id="'.$param['checkbox_data'][$i]['ID'].'" value="'.addslashes($param['checkbox_data'][$i]['VALUE']).'" />'.addslashes($param['checkbox_data'][$i]['LABEL']).'</td>'; + $str .= '<td><input type="checkbox" class="check" name="'.$param['checkbox_data'][$i+1]['ID'].'" id="'.$param['checkbox_data'][$i+1]['ID'].'" value="'.addslashes($param['checkbox_data'][$i+1]['VALUE']).'" />'.addslashes($param['checkbox_data'][$i+1]['LABEL']).'</td>'; + + } + else + { + $str .= '<td colspan="2"><input type="checkbox" class="check" name="'.$param['checkbox_data'][$i]['ID'].'" id="'.$param['checkbox_data'][$i]['ID'].'" value="'.addslashes($param['checkbox_data'][$i]['VALUE']).'" />'.addslashes($param['checkbox_data'][$i]['LABEL']).'</td>'; + } + $str .= '</tr>'; + } + $tmp_ids = preg_replace('/,$/', '', $tmp_ids ); + $str .= '</table>'; + $str .= '<input type="hidden" name="meta[]" value="'.$id.'#'.$tmp_ids.'#checkbox" />'.$end; + } + elseif($field_type == 'address') + { + $str = $init.'<input type="hidden" name="meta[]" value="'.$id.'#'.$param['address_data']['NUM']['ID'].','.$param['address_data']['ROAD']['ID'].','.$param['address_data']['CP']['ID'].','.$param['address_data']['CITY']['ID'].','.$param['address_data']['DISTRICTS']['ID'].'#address" />'; + $str .= '<table align="center" border="0" width="100%" >'; + $str .= '<tr>'; + $str .= '<td>'.$param['address_data']['NUM']['LABEL'].'</td><td><input type="text" name="'.$param['address_data']['NUM']['ID'].'" id="'.$param['address_data']['NUM']['ID'].'" class="small"/></td>'; + $str .= '<td>'.$param['address_data']['ROAD']['LABEL'].'</td><td><input type="text" name="'.$param['address_data']['ROAD']['ID'].'" id="'.$param['address_data']['ROAD']['ID'].'" /></td>'; + $str .= '</tr>'; + $str .= '<tr>'; + $str .= '<td>'.$param['address_data']['CP']['LABEL'].'</td><td><input type="text" name="'.$param['address_data']['CP']['ID'].'" id="'.$param['address_data']['CP']['ID'].'" class="medium" maxlength="5"/></td>'; + $str .= '<td>'.$param['address_data']['CITY']['LABEL'].'</td><td><input type="text" name="'.$param['address_data']['CITY']['ID'].'" id="'.$param['address_data']['CITY']['ID'].'" /></td>'; + $str .= '</tr>'; + if(isset($param['address_data']['DISTRICTS'])) + { + $str .= '<tr>'; + $str .= '<td>'.$param['address_data']['DISTRICTS']['LABEL'].'</td><td colspan="3">'; + $str .= '<select name="'.$param['address_data']['DISTRICTS']['ID'].'" id="'.$param['address_data']['DISTRICTS']['ID'].'">'; + $str .= '<option value="">'.$param['address_data']['DISTRICTS']['default_label'].'</option>'; + for($i=0; $i < count($param['address_data']['DISTRICTS']['options']); $i++) + { + $str .= '<option value="'.$param['address_data']['DISTRICTS']['options'][$i]['VALUE'].'" >'.$param['address_data']['DISTRICTS']['options'][$i]['LABEL'].'</option>'; + } + $str .= '</select>'; + $str .= '</td>'; + $str .= '</tr>'; + } + $str .= '</table>'.$end; + } + elseif($field_type == 'simple_list_or_input_text') + { + // td open in the showing function (js) + $str .= '<input type="hidden" name="meta[]" value="'.$id.'#select_'.$param['id'].',input_'.$param['id'].'#simple_list_or_input_text" />'; + $str .= '<select name="select_'.$param['id'].'" id="select_'.$param['id'].'" onchange="start_action_list('."'".'div_'.$param['id']."', 'select_".$param['id']."', this.selectedIndex".')">'; + $str .= '<option value="">'.$param['default_label_select'].'</option>'; + $str .= '<option value="SHOW_DATA">'.$param['label_define_option']."</option>"; + for($i=0; $i<count($param['options']);$i++) + { + $str .= '<option value="'.addslashes($param['options'][$i]['VALUE']).'">'.addslashes($param['options'][$i]['LABEL']).'</option>'; + } + $str .= '</select>'; + $str .= '</td>'; + $str .= '<td>'; + $str .= '<div id="div_'.$param['id'].'" style="visibility:hidden">'; + $str .= '<table width="100%" border="0">'; + $str .= '<tr>'; + $str .= '<td>'.$param['label_input'].' : <input type="text" name="input_'.$param['id'].'" id="input_'.$param['id'].'" '.$param['other'].' value="" /></td>'; + $str .= '</tr>'; + $str .= '</table>'; + $str .= '</div>'; + // td close in the showing function (js) + $str = addslashes($str); + $str = $init.$str.$end; + } + elseif($field_type == 'inputs_in_2_col') + { + $str = $init.'<table align="center" border="0" width="100%" >'; + $tmp = ""; + + for($i=0; $i<count($params['input_ids']) ;$i++) + { + $tmp .= $params['input_ids'][$i]['ID'].','; + + if ($i%2 != 1 || $i==0) // pair + { + $str .= '<tr>'; + } + $str .= '<td >'.addslashes($params['input_ids'][$i]['LABEL']).'</td><td><input type="text" name="'.$params['input_ids'][$i]['ID'].'" id="'.$params['input_ids'][$i]['ID'].'" value="" /></td>'; + if ($i%2 == 1 && $i!=0) // impair + { + echo '</tr>' ; + } + else + { + if($i+1 == count($params['input_ids'])) + { + echo '<td colspan="3"> </td></tr>'; + } + } + } + $tmp = preg_replace('/,$/', '', $tmp); + $str .= '</table>'; + $str .= '<input type="hidden" name="meta[]" value="'.$id.'#'.$tmp.'#inputs_in_2_col" />'.$end; + } + elseif($field_type == 'select_or_other_data') + { + // td open in the showing function (js) + $str .= '<table align="center" border="0" width="100%" >'; + $str .= '<tr>'; + $str .= '<td>'; + $str .= '<select name="select_'.$param['id'].'" id="select_'.$param['id'].'" onchange="start_action_list('."'".'div_'.$param['id']."', 'select_".$param['id']."', this.selectedIndex".')">'; + $str .= '<option value="">'.$param['default_label_select'].'</option>'; + $str .= '<option value="SHOW_DATA">'.$param['label_define_option']."</option>"; + for($i=0; $i<count($param['options']);$i++) + { + $str .= '<option value="'.$param['options'][$i]['VALUE'].'">'.$param['options'][$i]['LABEL'].'</option>'; + } + $str .= '</select>'; + $str .= '</td>'; + $str .= '</tr>'; + $str .= '<tr>'; + $str .= '<td>'; + $str .= '<div id="div_'.$param['id'].'" style="display:none;">'; + $str .= '<table align="center" border="0" width="100%" >'; + $tmp = "select_".$param['id'].","; + for($i=0; $i<count($param['input_ids']) ;$i++) + { + $tmp .= $param['input_ids'][$i]['ID'].','; + if ($i%2 != 1 || $i==0) // pair + { + $str .= '<tr>'; + } + $str .= '<td >'.$param['input_ids'][$i]['LABEL'].' :</td><td><input type="text" name="'.$param['input_ids'][$i]['ID'].'" id="'.$param['input_ids'][$i]['ID'].'" value="" /></td>'; + if ($i%2 == 1 && $i!=0) // impair + { + echo '</tr>' ; + } + else + { + if($i+1 == count($params['input_ids'])) + { + echo '<td colspan="3"> </td></tr>'; + } + } + } + $tmp = preg_replace('/,$/', '', $tmp); + $str .= '</table>'; + $str .= '</div>'; + $str .= '<input type="hidden" name="meta[]" value="'.$id.'#'.$tmp.'#select_or_other_data" />'; + $str .= '</td>'; + $str .= '</tr>'; + $str .= '</table>'; + // td close in the showing function (js) + $str = addslashes($str); + $str = $init.$str.$end; + } + else + { + + } + return $str; + } + + public function get_process_data($coll_id, $res_id) + { + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec =new security(); + $view = $sec->retrieve_view_from_coll_id($coll_id); + if(empty($view)) + { + $view = $table; + } + $db = new dbquery(); + $db->connect(); + $db->query("select answer_type_bitmask, process_notes, other_answer_desc from ".$view." where res_id = ".$res_id); + $res = $db->fetch_object(); + $bitmask = $res->answer_type_bitmask; + $process_notes = $db->show_string($res->process_notes); + $other_answer_desc = $db->show_string($res->other_answer_desc); + $contact = false; + $mail = false; + $AR = false; + $fax = false; + $email = false; + $other = false; + $no_answer = false; + if($bitmask == '000000' || $bitmask == '') + { + $no_answer = true; + } + else + { + /** + * Answer type bitmask + * 0 0 0 0 0 0 + * | | | | | |_ Simple Mail + * | | | | |___ Registered mail + * | | | |_____ Direct Contact + * | | |_______ Email + * | |_________ Fax + * |___________ Other Answer + **/ + + if($bitmask[0] == '1') + { + $other = true; + } + if($bitmask[1] == '1') + { + $fax = true; + } + if($bitmask[2] == '1') + { + $email = true; + } + if($bitmask[3] == '1') + { + $contact = true; + } + if($bitmask[4] == '1') + { + $AR = true; + } + if($bitmask[5] == '1') + { + $mail = true; + } + } + return array('process_notes' => $process_notes, 'direct_contact' => $contact, 'simple_mail' => $mail, 'registered_mail' => $AR, 'fax' => $fax, 'email' => $email, 'no_answer' => $no_answer, 'other' => $other, 'other_answer_desc' => $other_answer_desc); + } + +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/class/class_list_show.php b/maarch_entreprise/trunk/class/class_list_show.php new file mode 100644 index 0000000000000000000000000000000000000000..f558ea6ca53a1aefbaf7ff005f8b8adda9c94354 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_list_show.php @@ -0,0 +1,1447 @@ +<?php +/** +* List Show Class +* +* Contains all the function to manage and show list +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* @author Loïc Vinet <dev@maarch.org> +* @author Laurent Giovannoni <dev@maarch.org> +* +*/ + +/** +* Class List show : Contains all the function to manage and show list +* +* @author Claire Figueras <dev@maarch.org> +* @author Loïc Vinet <dev@maarch.org> +* @author Laurent Giovannoni <dev@maarch.org> +* @license GPL +* @package Maarch PeopleBox 1.0 +* @version 2.1 +*/ +class list_show extends functions +{ + /** + * Show the document list in result of the search + * + * @param array $listarr + * @param integer $nb_total total number of documents + * @param string $title + * @param string $what search expression + * @param string $name "search" by default, the calling page + * @param string $key the key seach for the form + * @param string $detail_destination the link to detail page + * @param boolean $bool_view_document boolean to view document or not + * @param boolean $bool_radio_form boolean to add radio to select row + * @param string $method method of the select form + * @param string $action action of the select form + * @param string $button_label label(session var) of the button of the select form + * @param boolean $bool_detail boolean to show the detail page link or not + * @param boolean $bool_order boolean to show the order icons or not + * @param boolean $bool_frame true if calling by frame + * @param boolean $bool_export true if we activate the list export (obsolete => to delete) + * @param boolean $show_close true : the close window button is showed + * @param boolean $show_big_title true : the title is displayed in the title container + * @param boolean $show_full_list true : the list takes all the screen, otherwise it is addforms2 class + * @param boolean $bool_check_form true : add checkbox to select row + * @param string $res_link obsolete (to delete) + * @param string $module module name if the function is called in a module + * @param boolean $bool_show_listletters true : show list letters, search on the elements of the list possible + * @param string $all_sentence string : all item + * @param string $whatname name of the element to search + * @param string $used_css css used in the list + * @param string $comp_link url link complement + * @param string $link_in_line + * @param string $bool_show_actions_list true : shows the possible actions of the list on a combo list + * @param array $actions list of the elements of the actions combo list + * @param string $hidden_fields hidden fields in the form + */ + public function list_doc( + $result, + $nb_total, + $title, + $what, + $name = "search", + $key, + $detail_destination, + $bool_view_document, + $bool_radio_form, + $method, + $action, + $button_label, + $bool_detail, + $bool_order, + $bool_frame= false, + $bool_export= false, + $show_close = FALSE, + $show_big_title = true, + $show_full_list = true, + $bool_check_form = false, + $res_link = '', + $module='', + $bool_show_listletters = false, + $all_sentence = '', + $whatname = '', + $used_css = 'listing spec', + $comp_link = "", + $link_in_line = false, + $bool_show_actions_list = false, + $actions = array(), + $hidden_fields = '', + $actions_json= '{}', + $do_action = false, + $id_action = '', + $open_details_popup = true, + $do_actions_arr = array(), + $template = false, + $template_list = array(), + $actual_template= '', + $mode_string = false + ) + { + if ($actual_template <> '') + { + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR.'class_list_show_with_template.php'); + $list_temp = new list_show_with_template(); + + $list_temp->list_doc_by_template($result, $nb_total, $title,$what,$name,$key,$detail_destination,$bool_view_document,$bool_radio_form,$method,$action, + $button_label, $bool_detail, $bool_order, $bool_frame,$bool_export, $show_close, $show_big_title, + $show_full_list, $bool_check_form, $res_link, $module, $bool_show_listletters, $all_sentence, + $whatname, $used_css , $comp_link, $link_in_line, $bool_show_actions_list , $actions, + $hidden_fields, $actions_json, $do_action, $id_action , $open_details_popup, $do_action_arr, $template, $template_list, $actual_template, $mode_string); + + } + else + { + //show the document list in result of the search + $page_list1 = ""; + $page_list2 = ""; + $link=""; + $str = ''; + //$listvalue = array(); + $listcolumn = array(); + $listshow = array(); + $listformat = array(); + $ordercol = array(); + + // put in tab the different label of the column + for ($j=0;$j<count($result[0]);$j++) + { + array_push($listcolumn,$result[0][$j]["label"]); + array_push($listshow,$result[0][$j]["show"]); + array_push($ordercol,$result[0][$j]["order"]); + } + + $func = new functions(); + + if($bool_frame) + { + $link = $name.".php?search=".$what; + } + else + { + $link = $_SESSION['config']['businessappurl']."index.php?page=".$name."&search=".$what; + } + for($i=0;$i<count($_SESSION['where']);$i++) + { + $link .= "&where[]=".$_SESSION['where'][$i]; + } + if(!empty($module)) + { + $link .= "&module=".$module; + } + if(isset($_GET['what'])) + { + $link .= "&what=".strip_tags($_GET['what']); + } + if(isset($_REQUEST['start']) && !empty($_REQUEST['start'])) + { + $start = strip_tags($_REQUEST['start']); + } + else + { + $start = 0; + } + if(isset($_GET['order'])) + { + $orderby = strip_tags($_GET['order']); + } + else + { + $orderby = 'asc'; + } + + $link .= "&order=".$orderby; + if(isset($_GET['order_field'])) + { + $orderfield = strip_tags($_GET['order_field']); + } + else + { + $orderfield = ''; + } + $link .= "&order_field=".$orderfield; + $link .= $comp_link; + + $nb_show = $_SESSION['config']['nblinetoshow']; + $nb_pages = ceil($nb_total/$nb_show); + $end = $start + $nb_show; + if($end > $nb_total) + { + $end = $nb_total; + } + + + + if($actual_template <> '') + { + $link .= "&template=".$actual_template; + } + else + { + $link .= "&template="; + } + + + //######################## + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + $core_tools = new core_tools(); + if($core_tools->is_module_loaded("doc_converter") && $bool_export) + { + $_SESSION['doc_convert'] = array(); + require_once($_SESSION['pathtomodules']."doc_converter".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); + $doc_converter = new doc_converter(); + $disp_dc = $doc_converter->convert_list($result, true); + } + //######################## + + if ($template == true) + { + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR.'class_list_show_with_template.php'); + $template_object = new list_show_with_template(); + $tdeto = $template_object->display_template_for_user($template_list, $link); + } + + // if they are more 1 page we do pagination with 2 forms + + if($nb_pages > 1) + { + $next_start = 0; + //$search_form = "<div class='list_show_page'><form name=\"newpage1\" method=\"get\" >"; + $page_list1 = _GO_TO_PAGE." <select name=\"startpage\" onchange=\"window.location.href='".$link."&start='+this.value;\">"; + $lastpage = 0; + for($i = 0;$i <> $nb_pages; $i++) + { + $page_name = $i + 1; + $the_line = $i + 1; + if($start == $next_start) + { + $page_list1 .= "<option value=\"".$next_start."\" selected=\"selected\">".$the_line."</option>"; + } + else + { + $page_list1 .= "<option value=\"".$next_start."\">".$the_line."</option>"; + } + $next_start = $next_start + $nb_show; + $lastpage = $next_start; + } + $page_list1 .= "</select>"; + $lastpage = $lastpage - $nb_show; + $previous = ""; + $next = ""; + if($start > 0) + { + $start_prev = $start - $nb_show; + $previous = "< <a href=\"".$link."&start=".$start_prev."\">"._PREVIOUS."</a> "; + } + + if($start <> $lastpage) + { + $start_next = $start + $nb_show; + $next = " <a href=\"".$link."&start=".$start_next."\">"._NEXT."</a> >"; + } + //$page_list1 = '<div class="block" style="height:20px;" align="center" ><b><div class="list_previous">'.$previous." </div>".$search_form." ".$page_list1."</select></div>".$next."</b> </form></div>"; + } + //$str .= "<div class='block'>"; + $page_list1 = '<div class="block" style="height:30px;vertical" align="center" ><table width="100%" border="0"><tr><td align="center" width="15%"><b>'.$previous.'</b></td><td align="center" width="15%"><b>'.$next.'</b></td><td width="10px">|</td><td align="center" width="30%">'.$page_list1.'</td><td width="10px">|</td><td width="240px" align="center">'.$disp_dc.'</td><td width="10px">|</td><td align="right">'.$tdeto.'</td></tr></table></b></div>'; + + if($show_big_title) + { + $str .= '<h1>'; + if(!empty($picto_path)) + { $str .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';} + $str .= $title.'</h1>'; + } + else + { + $str .= '<b>'; + if(!empty($picto_path)) + { $str .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';} + $str .= $title.'</b>'; + } + if($bool_show_listletters) + { + $str.=$this->listletters($link,$name,$all_sentence,_SEARCH." ".$whatname,_ALPHABETICAL_LIST, false, false, array(), true); + } + $str .= $page_list1; + $str .= ' <div align="center">'; + + if($bool_radio_form || $bool_check_form || ($do_action && !empty($id_action))) + { + $temp = '<form name="form_select" id="form_select" action="'.$action.'" method="'.$method.'" class="forms'; + if(!$show_full_list) + { + $temp .= " addforms2\" >"; + } + else + { + $temp .= "\" >"; + } + $str .= $temp; + $str .= $hidden_fields; + } + if( (($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) || ($do_action && !empty($id_action))) + { + + $str .= '<script type="text/javascript">'; + $str .= 'var arr_actions = '.$actions_json.';'; + $str .= ' var arr_msg_error = {\'confirm_title\' : \''._ACTION_CONFIRM.'\','; + $str .= ' \'validate\' : \''._VALIDATE.'\','; + $str .= ' \'cancel\' : \''._CANCEL.'\','; + $str .= ' \'choose_action\' : \''._CHOOSE_ACTION.'\','; + $str .= ' \'choose_one_doc\' : \''._CHOOSE_ONE_DOC.'\''; + $str .= ' };'; + $str .= ' valid_form=function(mode, res_id, id_action)'; + $str .= '{'; + $str .= 'if(!isAlreadyClick){'; + $str .= ' var val = \'\';'; + $str .= ' var action_id = \'\';'; + $str .= ' var table = \'\';'; + $str .= ' var coll_id = \'\';'; + $str .= ' var module = \'\';'; + $str .= ' var thisfrm = document.getElementById(\'form_select\');'; + $str .= ' if(thisfrm)'; + $str .= ' {'; + $str .= ' for(var i=0; i < thisfrm.elements.length; i++)'; + $str .= ' {'; + + $str .= ' if(thisfrm.elements[i].name = \'field\' && thisfrm.elements[i].checked == true)'; + $str .= ' {'; + $str .= ' val += thisfrm.elements[i].value+\',\';'; + $str .= ' }'; + $str .= ' else if(thisfrm.elements[i].id == \'action\')'; + $str .= ' {'; + $str .= ' action_id = thisfrm.elements[i].options[thisfrm.elements[i].selectedIndex].value;'; + $str .= ' }'; + $str .= ' else if(thisfrm.elements[i].id == \'table\')'; + $str .= ' {'; + $str .= ' table = thisfrm.elements[i].value;'; + $str .= ' }'; + $str .= ' else if(thisfrm.elements[i].id == \'coll_id\')'; + $str .= ' {'; + $str .= ' coll_id = thisfrm.elements[i].value;'; + $str .= ' }'; + $str .= ' else if(thisfrm.elements[i].id == \'module\')'; + $str .= ' {'; + $str .= ' module = thisfrm.elements[i].value;'; + $str .= ' }'; + $str .= ' }'; + $str .= ' val = val.substr(0, val.length -1);'; + $str .= ' var val_frm = {\'values\' : val, \'action_id\' : action_id, \'table\' : table, \'coll_id\' : coll_id, \'module\' : module};'; + $str .= ' if(res_id && res_id != \'\')'; + $str .= ' {'; + $str .= ' val_frm[\'values\'] = res_id;'; + $str .= ' }'; + $str .= ' if(id_action && id_action != \'\')'; + $str .= ' {'; + $str .= ' val_frm[\'action_id\'] = id_action;'; + $str .= ' }'; + + $str .= ' action_send_first_request(\''.$_SESSION['urltocore'].'manage_action.php\', mode, val_frm[\'action_id\'], val_frm[\'values\'], val_frm[\'table\'], val_frm[\'module\'], val_frm[\'coll_id\']);'; + $str .= ' }'; + $str .= ' else'; + $str .= ' {'; + $str .= ' alert(\'Validation form error\');'; + $str .= ' }'; + $str .= 'isAlreadyClick = true;'; + $str .= '}'; + $str .= ' }'; + $str .= ' </script>'; + } + $str .= ' <table border="0" cellspacing="0" class="'.$used_css.'" id="test">'; + $str .= ' <thead>'; + $str .= ' <tr>'; + if($bool_view_document) + { + $str .= ' <th width="3%"> </th>'; + } + if($bool_radio_form ||$bool_check_form) + { + $str .= ' <th width="3%"> </th>'; + } + for($count_column = 0;$count_column < count($listcolumn);$count_column++) + { + if($listshow[$count_column]==true) + { + + $str .= ' <th width="'.$result[0][$count_column]['size'].'%" valign="'.$result[0][$count_column]['valign'].'" align="'.$result[0][$count_column]['label_align'].'" ><span>'.$listcolumn[$count_column]; + if($bool_order) + { + $str .= ' <br/><br/> <a href="'.$link.'&start='.$start.'&order=desc&order_field='.$ordercol[$count_column].'" title="'._DESC_SORT.'"><img src="'.$_SESSION['config']['businessappurl'].'img/tri_down.gif" border="0" alt="'._DESC_SORT.'" /> </a> <a href="'.$link.'&start='.$start.'&order=asc&order_field='.$ordercol[$count_column].'" title="'._ASC_SORT.'"> <img src="'.$_SESSION['config']['businessappurl'].'img/tri_up.gif" border="0" alt="'._ASC_SORT.'" /></a>'; + } + $str .= ' </span></th>'; + + } + } + if($bool_detail) + { + $str .= ' <th width="4%" valign="bottom" > </th>'; + } + $str .= '</tr>'; + $str .= ' </thead>'; + $str .= ' <tbody>'; + $color = ""; + + for($theline = $start; $theline < $end ; $theline++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + + + $str .= ' <tr '.$color.'>'; + + if($bool_radio_form || $bool_check_form) + { + $str .= ' <td width="3%">'; + $str .= ' <div align="center">'; + + if($bool_radio_form) + { + if(count($do_actions_arr) == 0 || $do_actions_arr[$theline] == true) + { + $str .= '<input type="radio" class="check" name="field" value="'.$result[$theline][0]['value'].'" class="check" /> '; + } + else + { + $str .= '<img src="'.$_SESSION['config']['businessappurl'].'img/cadenas_rouge.png" alt="'._DOC_LOCKED.'" border="0"/>'; + } + } + elseif($bool_check_form) + { + if(count($do_actions_arr) == 0 || $do_actions_arr[$theline] == true) + { + $str .= '<input type="checkbox" class="check" name="field" class="check" value="'.$result[$theline][0]['value'].'" /> '; + } + else + { + $str .= '<img src="'.$_SESSION['config']['businessappurl'].'img/cadenas_rouge.png" alt="'._DOC_LOCKED.'" border="0"/>'; + } + } + $str .= ' </div>'; + $str .= ' </td>'; + } + if($bool_view_document) + { + $str .= ' <td width="3%">'; + $str .= ' <div align="center">'; + if($bool_view_document) + { + $str .= '<a href="'.$_SESSION['config']['businessappurl'].'indexing_searching/view.php?id='.$result[$theline][0][$key].'" target="_blank" title="'._VIEW_DOC.'">'; + $str .= ' <img src="'.$_SESSION['config']['businessappurl'].'img/picto_dld.gif" alt="'._VIEW_DOC.'" border="0"/></a>'; + } + $str .= ' </div>'; + $str .= ' </td>'; + } + + for($count_column = 0;$count_column < count($listcolumn);$count_column++) + { + if($result[$theline][$count_column]['show']==true) + { + if($do_action && !empty($id_action) && (count($do_actions_arr) == 0 || $do_actions_arr[$theline] == true) ) + { + $str .= ' <td width="'.$result[$theline][$count_column]['size'].'%" align="'.$result[$theline][$count_column]['align'].'" onclick="valid_form( \'page\', \''.$result[$theline][0]['value'].'\', \''.$id_action.'\');" '.$result[$theline][$count_column]['css_style'].'>'.$func->show($this->thisword($result[$theline][$count_column]['value'],$what)).'</td>'; + + } + else if($do_action && !empty($id_action) && $do_actions_arr[$theline] == false) + { + $str .= ' <td width="'.$result[$theline][$count_column]['size'].'%" align="'.$result[$theline][$count_column]['align'].'" '.$result[$theline][$count_column]['css_style'].'><em>'.$func->show($this->thisword($result[$theline][$count_column]['value'],$what)).'</em></td>'; + + } + else if($link_in_line) + { + $str .= ' <script language="javascript">'; + $str .= ' var window2 = null;'; + $str .= ' function openpopup(linkpage)'; + $str .= ' {'; + $str .= ' if(window2 == null)'; + $str .= ' {'; + $str .= ' window2=window.open(linkpage);'; + $str .= ' }'; + $str .= ' else'; + $str .= ' {'; + $str .= ' window2.close();'; + $str .= ' window2 = 0;'; + $str .= ' window2 = window.open(linkpage);'; + $str .= ' }'; + $str .= ' }'; + $str .= ' </script>'; + + $str .= ' <td width="'.$result[$theline][$count_column]['size'].'%" align="'.$result[$theline][$count_column]['align'].'" onclick="openpopup(\''.$detail_destination.'?id='.$result[$theline][0]['value'].'\');" '.$result[$theline][$count_column]['css_style'].'>'.$func->show($this->thisword($result[$theline][$count_column]['value'],$what)).'</td>'; + } + else + { + $str .= ' <td width="'.$result[$theline][$count_column]['size'].'%" align="'.$result[$theline][$count_column]['align'].'" '.$result[$theline][$count_column]['css_style'].'>'.$func->show($this->thisword($result[$theline][$count_column]['value'],$what)).'</td>'; + } + } + } + if($bool_detail) + { + if($bool_frame && $open_details_popup) + { + $str .= ' <td width="4%" align="center"><div align="right">'; + $str .= ' <a href="javascript:window.open(\''.$_SESSION['config']['businessappurl'].'index.php?page='.$detail_destination.'&id='.$result[$theline][0][$key].'\',\'_parent\',\'_parent\');" title="'._DETAILS.'"><img src="'.$_SESSION['config']['businessappurl'].'img/picto_infos.gif" alt="'._DETAILS.'" width="25" height="25" border="0" /></a></div>'; + $str .= ' </td>'; + } + elseif($bool_frame && !$open_details_popup) + { + $str .= '<td width="4%" align="center">'; + $str .= '<a href="#" title="'._DETAILS.'" onclick="javascript:window.top.location=\''.$_SESSION['config']['businessappurl'].'index.php?page='.$detail_destination.'&id='.$result[$theline][0][$key].'\';return false;"><img src="'.$_SESSION['config']['businessappurl'].'img/picto_infos.gif" alt="'._DETAILS.'" width="25" height="25" border="0" /></a>'; + $str .= ' </td>'; + } + else + { + $str .= ' <td width="4%" align="center"><div align="right"> + <a href="'.$_SESSION['config']['businessappurl'].'index.php?page='.$detail_destination.'&id='.$result[$theline][0][$key].'" title="'._DETAILS.'"><img src="'.$_SESSION['config']['businessappurl'].'img/picto_infos.gif" alt="'._DETAILS.'" width="25" height="25" border="0" /></a></div>'; + $str .= ' </td>'; + } + } + $str .= ' </tr>'; + } + $str .= '</tbody>'; + $str .= ' </table>'; + $str .= ' <br/>'; + if(($bool_radio_form || $bool_check_form) && count($result) > 0 && !$bool_show_actions_list) + { + $str .= ' <p align="center">'; + $str .= ' <input class="button" type="submit" value="'.$button_label.'" />'; + if($show_close ) + { + $str .= ' <input type="button" class="button" name="cancel" value="'._CLOSE_WINDOW.'" onclick="window.top.close();" />'; + } + $str .= ' </p>'; + $str .= ' </form>'; + $str .= ' <br/>'; + } + else if(($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) + { + $str .= ' <p align="center">'; + $str .= ' <b>'._ACTIONS.' :</b>'; + $str .= ' <select name="action" id="action">'; + $str .= ' <option value="">'. _CHOOSE_ACTION.'</option>'; + for($ind_act = 0; $ind_act < count($actions);$ind_act++) + { + $str .= ' <option value="'.$actions[$ind_act]['VALUE'].'">'.$actions[$ind_act]['LABEL'].'</option>'; + } + $str .= ' </select>'; + $str .= ' <input type="button" name="send" id="send" value="'._VALIDATE.'" onclick="valid_form(\'mass\');" class="button" />'; + $str .= ' </p>'; + $str .= ' </form>'; + $str .= ' <br/>'; + } + elseif($do_action) + { + $str .= ' </form>'; + } + elseif($show_close) + { + $str .= ' <input type="button" class="button" name="cancel" value="'._CLOSE_WINDOW.'" onclick="window.top.close();" />'; + } + + $str .= ' </div>'; + if($mode_string) + { + return $str; + } + else + { + echo $str; + } + + } + } + + /** + * Mark with a color background the word you're searching in the detail of the row + * + * @param string $words + * @param string $need + * @return string $words + * @return string $size + */ + private function thisword($words,$need, $is_split = FALSE, $size = 70) + { + // mark with a color background the word you're searching in the detail of the row + if(!$is_split || strlen($words) < $size) + { + if (strlen($need) > 3) + { + $ar_need = explode(" ", $need); + + for($i = 0; $i < count($ar_need); $i++) + { + $save_ar_need = ""; + $pos = stripos($words, $ar_need[$i]); + + if($pos !== false) + { + $save_ar_need = substr($words, $pos, strlen($ar_need[$i])); + } + + $words = preg_replace("/(".$ar_need[$i].")/i","<span class=\"thisword\">".$save_ar_need."</span>",$words); + } + } + } + else + { + $i = 0; + $newwords = ''; + if(preg_match('/@/', $words)) + { + $tab_words = preg_split('/@/', $words); + $newwords = $tab_words[0].'@<br/>'.$tab_words[1]; + } + else if(!preg_match('/ /', $words)) + { + while(true) + { + if(strlen(substr($words, $i)) > $size) + { + $newwords .= '<br/>'.substr($words,$i, $size); + + $i = $i + $size ; + } + else + { + $newwords .= '<br/>'.substr($words,$i); + break; + } + + } + } + else + { + $newwords = $words; + } + /*while(true) + { + if(strlen(substr($words, $i)) > $size) + { + $newwords .= '<br/>'.substr($words,$i, $size); + + $i = $i + $size ; + } + else + { + $newwords .= '<br/>'.substr($words,$i); + break; + } + + }*/ + $words =$newwords; + //$words = $words. '<br/>[...]'; + } + + return $words; + } + + /* * + * show the alphabetical list + * + * @param string $page the page (users, groups,...) + * @param string $all_text txt to say all item + * @param string $button_text text of button + * @param string $alpha_text text of the alphabetical list + */ + public function listletters($link, $page, $all_text, $button_text, $alpha_list_text, $show_searchbox = true, $autoCompletion = false, $autoCompletionArray2 = array()) + { + ?> + <div id="list_letter"> + <table width="100%" border="0" cellpadding="0" cellspacing="0" class="forms"> + <tr> + <td width="65%" height="30"> + <strong><?php echo $alpha_list_text; ?></strong> : + <?php for($i=ord('A'); $i <= ord('Z');$i++) + { + ?> + <a href="<?php echo $link;?>&what=<?php echo chr($i);?>"><?php echo chr($i);?></a> + <?php + } + ?> + - <a href="<?php echo $link;?>&what="><?php echo $all_text; ?></a> + </td> + <td width="35%" align="right"> + <?php + if($show_searchbox) + { + ?> + <form action="<?php echo $_SESSION['config']['businessappurl'].$link;?>" method="post" name="frmletters"> + <input name="what" id="what" type="text" size="15"/> + <?php + if($autoCompletion) + { + ?> + <div id="whatList" class="autocomplete"></div> + <script type="text/javascript"> + initList('what', 'whatList', '<?php echo $autoCompletionArray2['list_script_url'];?>', 'what', '<?php echo $autoCompletionArray2['number_to_begin'];?>'); + </script> + <?php + } + ?> + <input name="Submit" class="button" type="submit" value="<?php echo $button_text;?>"/> + </form> + <?php + } + else + { + echo " "; + } + ?> + </td> + </tr> + </table> + </div> + <?php + } + + /* * + * show an administration list + * @param array $result result of a request + * @param integer $nb_total total number of items + * @param string $title list title + * @param string $expr search expression + * @param string $name the calling page + * @param string $key the key seach for the form + * @param boolean $bool_order boolean to show the order icons or not + * @param boolean $page_name_up modification page + * @param boolean $page_name_val validation page + * @param boolean $page_name_ban suspend page + * @param boolean $page_name_del delete page + * @param boolean $page_name_add page to add a new item + * @param boolean $label_add + * @param boolean $bool_history FALSE by default, is the list an hisory list ? + * @param boolean $bool_simple_list FALSE by default, shows or not the radio or checkbox + * @param string $all_sentence + * @param string $whatname + * @param string $picto_path + * @param string $is_part_of_module + * @param string $show_big_title + * @param string $flag_not_admin + */ + public function admin_list($result, $nb_total, $title, $expr, $name, $admin, $key, $bool_order, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, $bool_history = FALSE, $bool_simple_list = FALSE, $all_sentence='', $whatname='', $picto_path ='', $is_part_of_module = FALSE, $show_big_title = true, $flag_not_admin = false, $show_listletters = true, $what ="", $autoCompletion = false, $autoCompletionArray = array(), $is_in_apps_dir = false) + { + // show the document list in result of the search + $page_list1 = ""; + $page_list2 = ""; + $link=""; + //$listvalue = array(); + $listcolumn = array(); + $listshow = array(); + $ordercol = array(); + for ($i=0;$i<1;$i++) + { + for ($j=0;$j<count($result[$i]);$j++) + { + array_push($listcolumn,$result[$i][$j]['label']); + array_push($listshow,$result[$i][$j]['show']); + array_push($ordercol,$result[$i][$j]["order"]); + } + } + + + $func = new functions(); + + if(isset($_GET['start'])) + { + $start = strip_tags($_GET['start']); + } + else + { + $start = 0; + } + + if($name == "structures" || $name == "subfolders" || $name == "types") + { + $link = "index.php?page=".$name; + } + else + { + if($is_part_of_module == false && $is_in_apps_dir == false) + { + $link = "index.php?page=".$name."&admin=".$admin; + } + elseif($is_in_apps_dir) + { + + $link = "index.php?page=".$name."&dir=".$admin; + } + else + { + $link = "index.php?page=".$name."&module=".$admin; + } + } + + if(isset($_GET['order'])) + { + $orderby = strip_tags($_GET['order']); + } + else + { + $orderby = 'asc'; + } + + $link .= "&order=".$orderby; + if(isset($_GET['order_field'])) + { + $orderfield = strip_tags($_GET['order_field']); + } + else + { + $orderfield = ''; + } + $link .= "&order_field=".$orderfield; + //$link = "index.php?page=".$name."&search=".$expr."&admin=".$admin; + + // define the defaults values + $nb_show = $_SESSION['config']['nblinetoshow']; + $nb_pages = ceil($nb_total/$nb_show); + $end = $start + $nb_show; + if($end > $nb_total) + { + $end = $nb_total; + } + + if(!empty($what)) + { + $link .= "&what=".$what; + } + + // if they are more 1 page we do pagination with 2 forms + if($nb_pages > 1) + { + $next_start = 0; + + $page_list1 = '<form name="newpage1" id="newpage1" method="get" action="'.urldecode($link).'" > + <p> + <label for="startpage">'._GO_TO_PAGE.'</label> + <select name="startpage" id="startpage" class="small" onchange="window.location.href=\''.$link.'&start=\'+document.newpage1.startpage.value;">'; + + $lastpage = 0; + + for($i = 0;$i <> $nb_pages; $i++) + { + $page_name = $i + 1; + + $the_line = $i + 1; + if($start == $next_start) + { + $page_list1 .= "<option value=\"".$next_start."\" selected=\"selected\">".$the_line."</option>"; + $page_list2 .= "<option value=\"".$next_start."\" selected=\"selected\">".$the_line."</option>"; + } + else + { + $page_list1 .= "<option value=\"".$next_start."\">".$the_line."</option>"; + $page_list2 .= "<option value=\"".$next_start."\">".$the_line."</option>"; + } + + $next_start = $next_start + $nb_show; + $lastpage = $next_start; + } + + $lastpage = $lastpage - $nb_show; + + $previous = ""; + $next = ""; + $page_list1 = $page_list1."</select>"; + if($start > 0) + { + $start_prev = $start - $nb_show; + $previous = "<a href=\"".$link."&start=".$start_prev."\" class=\"prev\">"._PREVIOUS."</a> "; + } + + if($start <> $lastpage) + { + $start_next = $start + $nb_show; + $next = " <a href=\"".$link."&start=".$start_next."\" class=\"next\">"._NEXT."</a>"; + } + + $page_list1 .= $previous." ".$next.'</p></form>'; + } + if($show_big_title) + { + echo '<h1>'; + if(!empty($picto_path)) + { echo '<img src="'.$picto_path.'" alt="" class="title_img" /> ';} + echo $title.'</h1>'; + ?><div id="inner_content" class="clearfix"><?php + } + else + { + echo '<h2>'; + if(!empty($picto_path)) + { echo '<img src="'.$picto_path.'" alt="" class="title_img" /> ';} + echo $title.'</h2>'; + echo ' <div align="center">'; + } + + if(!$bool_history) + { + if($show_listletters) + { + if(!$autoCompletion) + { + $this->listletters($link, $name, $all_sentence, _SEARCH." ".$whatname, _ALPHABETICAL_LIST); + } + else + { + $this->listletters($link, $name, $all_sentence, _SEARCH." ".$whatname, _ALPHABETICAL_LIST, true, $autoCompletion, $autoCompletionArray); + } + } + } + echo $page_list1; + ?> + <table width="100%" border="0" cellspacing="0" class="listing spec"> + <thead> + <tr> + <?php + + for($count_column = 0;$count_column < count($listcolumn);$count_column++) + { + if($listshow[$count_column]==true) + { + ?> + <th width="<?php echo $result[0][$count_column]['size'];?>%" valign="<?php echo $result[0][$count_column]['valign'];?>" align="<?php echo $result[0][$count_column]['label_align'];?>" + <?php + ?> + ><span><?php echo $listcolumn[$count_column]?> + <?php if($bool_order && !empty($ordercol[$count_column])) + { ?> <br/> <a href="<?php echo $link; ?>&start=<?php echo $start; ?>&order=desc&order_field=<?php echo $ordercol[$count_column];?>" title="<?php echo _DESC_SORT;?>"><img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/tri_down.gif" border="0" alt="<?php echo _DESC_SORT; ?>" /> </a> <a href="<?php echo $link; ?>&start=<?php echo $start; ?>&order=asc&order_field=<?php echo $ordercol[$count_column];?>" title="<?php echo _ASC_SORT;?>"> <img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/tri_up.gif" border="0" alt="<?php echo _ASC_SORT; ?>" /></a> <?php } + + ?></span></th> + <?php + } + } + + ?> + </tr> + </thead> + + <?php + if(!$bool_history && !$bool_simple_list) + { + if(!$is_part_of_module && !$flag_not_admin && !$is_in_apps_dir) + { + $path_add = "index.php?page=".$page_name_add."&admin=".$admin; + } + elseif($flag_not_admin && !$is_in_apps_dir) + { + $path_add = "index.php?page=".$page_name_add; + } + elseif($is_in_apps_dir) + { + $path_add = "index.php?page=".$page_name_add."&dir=".$admin; + } + else + { + $path_add = "index.php?page=".$page_name_add."&module=".$admin; + } + if(!empty($page_name_add)) + { + ?> + <tfoot> + <tr> + <td colspan="9" class="price"><span class="add clearfix"> + <a href="<?php echo $path_add;?>" ><span><?php echo $label_add;?></span></a></span></td> + </tr> + </tfoot> + <?php + } + } + elseif($bool_simple_list) + { + if($admin == "types" || $admin == "structures" || $admin == "subfolders") + { + $path_root = $_SESSION['config']['businessappurl']."admin/architecture/".$admin."/"; + } + else + { + if(!$is_part_of_module) + { + $path_root = $_SESSION['config']['businessappurl']."admin/".$admin."/"; + } + else + { + $path_root = $_SESSION['urltomodules'].$admin."/"; + } + } + if(!empty($page_name_add)) + { + ?> + <tfoot> + <tr> + <td colspan="<?php if($name <> 'types'){ echo'7';} else{ echo '5'; } + ?>" class="price"><span class="add clearfix"><a href="javascript://" onclick="window.open('<?php echo $path_root; if($name <> 'types'){ echo $page_name_up;?>.php?mode=add<?php } else{ echo $page_name_add; }?>','add','height=250, width=500, resizable=yes, scrollbars=yes');" ><span><?php echo $label_add;?></span></a></span></td> + </tr> + </tfoot> + <?php + } + } + ?> + <tbody> + <?php + $color = ""; + for($theline = $start; $theline < $end ; $theline++) + { + // background color + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + ?> + <tr<?php echo $color; ?>> + <?php + $enabled = ""; + if($page_name == "users") + { + $complete_name = ""; + } + else + { + $admin_id = ""; + } + $can_modify = true; + $can_delete = true; + for($count_column = 0;$count_column < count($listcolumn);$count_column++) + { + if($result[$theline][$count_column]['show']==true) + { + ?> + <td width="<?php echo $result[$theline][$count_column]['size'];?>%" align="<?php echo $result[$theline][$count_column]['align'];?>"> + + <?php + if($result[$theline][$count_column]['column'] == "enabled") + { + $enabled = $result[$theline][$count_column]['enabled']; + + if($result[$theline][$count_column]['enabled'] == "N") + { + ?> + <div align="center"> + <img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/picto_stat_disabled.gif" alt="<?php echo _NOT_ENABLED;?>" title="<?php echo _NOT_ENABLED;?>"/></div> + <?php + } + elseif($result[$theline][$count_column]['enabled'] == "Y") + { + ?> <div align="center"> + <img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/picto_stat_enabled.gif" alt="<?php echo _ENABLED; ?>" title="<?php echo _ENABLED; ?>"/></div> + <?php + } + } + else + { + if($page_name == "users") + { + if($result[$theline][$count_column]['column'] == "lastname" || $result[$theline][$count_column]['column'] == "firstname" ) + { + $complete_name .= " ".$result[$theline][$count_column]['value']; + } + } + else + { + $admin_id = $result[$theline][0][$key]; + } + if($name == 'types' || $name == "groups" || $name== 'contrat'|| $name== 'sous_dossiers' || $name== 'hist') + { + echo $result[$theline][$count_column]['value']; + } + else + { + echo $func->show($this->thisword($result[$theline][$count_column]['value'],$expr, TRUE)); + } + + } + ?> + </td> + <?php + } + elseif($result[$theline][$count_column]['can_modify']=='false') + { + $can_modify = false; + } + elseif($result[$theline][$count_column]['can_delete']=='false') + { + $can_delete = false; + } + } + if(!$bool_history && !$bool_simple_list) + { + if(!$is_part_of_module && !$flag_not_admin && !$is_in_apps_dir) + { + $path_up = $_SESSION['config']['businessappurl']."index.php?page=".$page_name_up."&admin=".$admin."&id=".$result[$theline][0][$key]; + } + elseif($flag_not_admin && !$is_in_apps_dir) + { + $path_up = $_SESSION['config']['businessappurl']."index.php?page=".$page_name_up."&id=".$result[$theline][0][$key]; + } + + elseif($is_in_apps_dir) + { + $path_up = $_SESSION['config']['businessappurl']."index.php?page=".$page_name_up."&dir=".$admin."&id=".$result[$theline][0][$key]; + } + else + { + $path_up = $_SESSION['config']['businessappurl']."index.php?page=".$page_name_up."&module=".$admin."&id=".$result[$theline][0][$key]; + } + ?> + + <td class="action"> + <?php + if( $can_modify == false) + { + echo " "; + } + else + { + ?> + <a href="<?php echo $path_up; ?>" class="change"><?php echo _MODIFY;?></a> + <?php + + }?> + </td> + <?php if($name<> 'types') + {?> + <td class="action"> + <?php + if($enabled == "N" ) + { + if(!$is_part_of_module) + { + $path_auth = $_SESSION['config']['businessappurl'].'admin/'.$admin.'/'.$page_name_val.".php?id=".$result[$theline][0][$key]; + } + else + { + $path_auth = $_SESSION['urltomodules'].$admin.'/'.$page_name_val.".php?id=".$result[$theline][0][$key]; + } + if($name == "users" && $result[$theline][0][$key] == "superadmin") + { + echo " "; + } + else + { + ?> + <a href="<?php echo $path_auth;?>" class="authorize" onclick="return(confirm('<?php echo _REALLY_AUTHORIZE." "; if($page_name == "users"){ echo $complete_name;} + else { echo $admin_id; } ?> ?'));"><?php echo _AUTHORIZE;?></a> + <?php + } + } + else + { + if(!empty($page_name_ban)) + { + if(!$is_part_of_module) + { + $path_ban = $_SESSION['config']['businessappurl'].'admin/'.$admin.'/'.$page_name_ban.".php?id=".$result[$theline][0][$key]; + } + else + { + $path_ban = $_SESSION['urltomodules'].$admin.'/'.$page_name_ban.".php?id=".$result[$theline][0][$key]; + } + if($name == "users" && $result[$theline][0][$key] == "superadmin") + { + echo " "; + } + else + { + ?> + <a href="<?php echo $path_ban; ?>" class="suspend" onclick="return(confirm('<?php echo _REALLY_SUSPEND." "; if($page_name == "users"){ echo $complete_name;} else { echo $admin_id; } ?> ?'));"><?php echo _SUSPEND;?></a><?php } + } + } + ?> + </td> + <?php } + + + ?> + <td class="action" > + <?php + if(!empty($page_name_del)) + { + if(!$is_part_of_module && !$flag_not_admin && !$is_in_apps_dir) + { + $path_del = $_SESSION['config']['businessappurl'].'admin/'.$admin.'/'.$page_name_del.".php?id=".$result[$theline][0][$key]."&admin=".$admin; + } + elseif($flag_not_admin && !$is_in_apps_dir) + { + $path_del = "index.php?page=".$page_name_del."&id=".$result[$theline][0][$key]; + } + elseif($is_in_apps_dir) + { + $path_del = $_SESSION['config']['businessappurl'].$admin.'/'.$page_name_del.".php?id=".$result[$theline][0][$key]."&dir=".$admin; + } + else + { + $path_del = $_SESSION['urltomodules'].$admin.'/'.$page_name_del.".php?id=".$result[$theline][0][$key]."&module=".$admin; + } + if( $can_delete == false || $name == "users" && $result[$theline][0][$key] == "superadmin") + { + echo " "; + } + else + { + ?> + <a href="<?php echo $path_del;?>" class="delete" + onclick="return(confirm('<?php echo _REALLY_DELETE." "; if($page_name == "users"){ echo $complete_name;} + else { echo $admin_id; }?> ?\n\r\n\r<?php echo _DEFINITIVE_ACTION; ?>'));"><?php echo _DELETE;?></a> + <?php + } + } + ?> + </td> + <?php } + else if($bool_simple_list) + { + if($page_name_up == "contrat_up" || $name == 'structures') + { + $height = "750"; + } + elseif($name == 'types') + { + $height = "650"; + } + else + { + $height = "250"; + } + + + if($admin == "types" || $admin == "structures" || $admin == "subfolders") + { + $path_up2 = $_SESSION['config']['businessappurl']."admin/architecture/".$admin."/".$page_name_up.".php?mode=up&id=".$result[$theline][0][$key]."&admin=".$admin; + $path_del2 = $_SESSION['config']['businessappurl']."admin/architecture/".$admin."/".$page_name_del.".php?id=".$result[$theline][0][$key]."&admin=".$admin; + } + elseif(!$is_part_of_module) + { + $path_up2 = $_SESSION['config']['businessappurl']."admin/".$admin."/".$page_name_up.".php?mode=up&id=".$result[$theline][0][$key]."&admin=".$admin; + $path_del2 = $_SESSION['config']['businessappurl']."admin/".$admin."/".$page_name_del.".php?id=".$result[$theline][0][$key]."&admin=".$admin; + } + else + { + $path_up2 = $_SESSION['urltomodules'].$admin."/".$page_name_up.".php?mode=up&id=".$result[$theline][0][$key]."&module=".$admin; + $path_del2 = $$_SESSION['urltomodules'].$admin."/".$page_name_del.".php?id=".$result[$theline][0][$key]."&module=".$admin; + + } + ?> + <td class="action"> + <a href="javascript://" class="change" onclick="window.open('<?php echo $path_up2;?>','','height=<?php echo $height;?>, width=450,scrollbars=yes,resizable=yes');" ><?php echo _MODIFY;?></a> + </td> + + <td class="action" > + <a href="<?php echo $path_del2;?>" class="delete" + onclick="return(confirm('<?php echo _REALLY_DELETE; if($page_name == "users"){ echo $complete_name;} + else { echo " ".$admin_id; }?> ?\n\r\n\r<?php echo _DEFINITIVE_ACTION; ?>'));"><?php echo _DELETE;?></a> + </td> + <?php } ?> + </tr> + + + <?php + } + ?> </tbody> + + </table><br/> + </div> + <?php + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + $core_tools = new core_tools(); + if($core_tools->is_module_loaded("doc_converter")) + { + $_SESSION['doc_convert'] = array(); + require_once($_SESSION['pathtomodules']."doc_converter".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); + $doc_converter = new doc_converter(); + $doc_converter->convert_list($result); + } + } + + + public function define_order($order, $field) + { + // configure the sql argument order by + $orderby = ""; + + if(isset($field) && !empty($field) && (empty($order) || $order == 'asc' || $order == 'desc')) + { + $orderby = "order by ".$field." ".$order; + } + return $orderby; + } + + + public function list_simple($result, $nb_total, $title,$what,$key,$bool_view_document, $page_view = "", $used_css = 'listing spec', $page_modify ='', $height_page_modify = 400, $width_page_modify = 500, $page_del ='', $link_in_line = false) + { + //$this->show_array($result); + + $listcolumn = array(); + $listshow = array(); + $listformat = array(); + $start = 0; + $end = $nb_total; + // put in tab the different label of the column + for ($i=0;$i<1;$i++) + { + + for ($j=0;$j<count($result[$i]);$j++) + { + array_push($listcolumn,$result[$i][$j]["label"]); + array_push($listshow,$result[$i][$j]["show"]); + } + } + //$this->show_array($listcolumn); + //$this->show_array($listshow); + $func = new functions(); + + $nb_show = $_SESSION['config']['nblinetoshow']; + + echo '<b>'; + if(!empty($picto_path)) + { echo '<img src="'.$picto_path.'" alt="" class="title_img" /> ';} + echo $title.'</b>'; + + echo ' <div align="center">'; + + ?> + <table border="0" cellspacing="0" class="<?php echo $used_css;?>"> + <thead> + <tr> + <th width="3%"> </th> + <?php + for($count_column = 0;$count_column < count($listcolumn);$count_column++) + { + if($listshow[$count_column]==true) + { + ?> + <th width="<?php echo $result[0][$count_column]['size'];?>%" valign="<?php echo $result[0][$count_column]['valign'];?>" align="<?php echo $result[0][$count_column]['label_align'];?>" ><span><?php echo $listcolumn[$count_column];?></span><?php + } + } + ?> + <th width="4%" valign="bottom" > </th> + </tr> + </thead> + <tbody> + <?php + + $color = ""; + for($theline = $start; $theline < $end ; $theline++) + { + + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + ?> + <tr <?php echo $color; ?>> + <td ><?php + if($bool_view_document) + { + echo "<a href='".$page_view."?id=".$result[$theline][0][$key]."' target=\"_blank\" title='"._VIEW_DOC."'> + <img src='".$_SESSION['config']['businessappurl']."img/picto_dld.gif' alt='"._VIEW_DOC."' border='0'/></a>"; + } + + ?></td> + <?php + $bool_modify = false; + $bool_del = false; + for($count_column = 0;$count_column < count($listcolumn);$count_column++) + { + if($result[$theline][$count_column]['show']==true) + { + if($link_in_line) + { + ?> + <td width="<?php echo $result[$theline][$count_column]['size'];?>%" align="<?php echo $result[$theline][$count_column]['align'];?>" onclick="window.open('<?php echo $action;?>?id=<?php echo $result[$theline][0]['value'];?>', '_blank');"><?php echo $func->show($this->thisword($result[$theline][$count_column]['value'],$what)); ?></td> + <?php + } + else + { + ?> + <td width="<?php echo $result[$theline][$count_column]['size'];?>%" align="<?php echo $result[$theline][$count_column]['align'];?>"><?php echo $func->show($this->thisword($result[$theline][$count_column]['value'],$what)); ?></td> + <?php + } + } + else + { + if( $result[$theline][$count_column]['column'] == 'modify_item' && $result[$theline][$count_column]['value'] == true) + { + $bool_modify = true; + } + if( $result[$theline][$count_column]['column'] == 'delete_item' && $result[$theline][$count_column]['value'] == true) + { + $bool_del = true; + } + + } + } + if($bool_modify) + { + ?><td class="action"> + <a href="javascript://" class="change" onclick="window.open('<?php echo $page_modify;?><?php if(preg_match('/\?/',$page_modify)){echo "&";}else{echo "?";}?>id=<?php echo $result[$theline][0][$key];?>','','height=<?php echo $height_page_modify;?>, width=<?php echo $width_page_modify;?>,scrollbars=yes,resizable=yes');" ><?php echo _MODIFY;?></a> + </td> + <?php } + else + { + ?> + <td class="action"> </td> + <?php + } + if($bool_del) + {?><td class="action" > + <a href="<?php echo $page_del;?>?id=<?php echo $result[$theline][0][$key];?>" class="delete" + onclick="return(confirm('<?php echo _REALLY_DELETE;?> ?\n\r\n\r<?php echo _DEFINITIVE_ACTION; ?>'));"><?php echo _DELETE;?></a> + </td> + <?php } + else + { + ?> + <td class="action"> </td> + <?php + } ?> + </tr> + <?php + } + ?> + </tbody> + </table> + + </div> + <?php + } +} + +?> diff --git a/maarch_entreprise/trunk/class/class_list_show_with_template.php b/maarch_entreprise/trunk/class/class_list_show_with_template.php new file mode 100644 index 0000000000000000000000000000000000000000..102e5b674ec20af8930d783f9255845245228819 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_list_show_with_template.php @@ -0,0 +1,840 @@ +<?php +/** +* List Show Class +* +* Contains all the function to manage and show list +* +* @package Maarch LetterBox 3.0 +* @version 3.0 +* @since 10/2005 +* @license GPL +* @author Loïc Vinet <dev@maarch.org> +* +*/ + +class list_show_with_template extends list_show +{ + + + //Public variables + + public $actual_line_css; + public $the_start; + public $the_link; + public $detail_destination; + public $bool_radio_form; + public $bool_check_form; + public $bool_view_document; + public $bool_detail; + public $do_action; + public $id_action; + public $do_action_arr; + + + //Load value from db with $result tab + public function tmplt_load_value($actual_string, $theline, $result) + { + $my_explode= explode ("|", $actual_string); + if (!$my_explode[1]) + { + return _WRONG_PARAM_FOR_LOAD_VALUE; + } + else + { + $to_share = $my_explode[1]; + for($stand= 0; $stand <= count($result[$theline]); $stand++ ) + { + if($result[$theline][$stand]['column'] == $to_share) + { + return $result[$theline][$stand]['value']; + } + + } + + } + } + + + //Load css defined in $actual_string + public function tmplt_load_css($actual_string) + { + $my_explode= explode ("|", $actual_string); + + if (!$my_explode[1]) + { + return _WRONG_PARAM_FOR_LOAD_VALUE; + } + else + { + return $my_explode[1]; + } + } + + + //Load image from apps defined in $actual_string + public function tmplt_load_img($actual_string) + { + $my_explode= explode ("|", $actual_string); + + if (!$my_explode[1]) + { + return _WRONG_PARAM_FOR_LOAD_VALUE; + } + else + { + return $_SESSION['config']['businessappurl']."img/".$my_explode[1]; + } + } + + //Load function order from templated list + public function tmplt_order_link($actual_string) + { + $my_explode= explode ("|", $actual_string); + + if (count($my_explode) <> 3) + { + + return _WRONG_PARAM_FOR_LOAD_VALUE; + } + else + { + $my_link = $this->the_link."&start=".$this->the_start."&order=".$my_explode[2]."&order_field=".$my_explode[1]; + return $my_link; + } + } + + + //Generate link to view the document + public function url_docview($actual_string, $theline, $result, $key) + { + $return = $_SESSION['urltomodules']."indexing_searching/view.php?id=".$result[$theline][0][$key]; + return $return; + } + + + //Generate link to view detail page + public function tmplt_url_docdetail($actual_string, $theline, $result, $key) + { + $return = $_SESSION['config']['businessappurl']."index.php?page=".$this->detail_destination."&id=".$result[$theline][0][$key]; + return $return; + } + + //Load radio form if this parameters is loaded in list_show and list_show_with_template + public function tmplt_func_bool_radio_form($actual_string, $theline, $result, $key) + { + + if ($this->bool_radio_form == true) + { + $return = '<input type="radio" class="check" name="field" value="'.$result[$theline][0]['value'].'" class="check" />'; + return $return; + } + + } + + + //Load check form if this parameters is loaded in list_show and list_show_with_template + public function tmplt_func_bool_check_form($actual_string, $theline, $result, $key) + { + + if ($this->bool_check_form == true) + { + $return = '<input type="checkbox" name="field" value="'.$result[$theline][0]['value'].'" class="check" />'; + return $return; + } + + } +//onclick="valid_form( \'page\', \''.$result[$theline][0]['value'].'\', \''.$id_action.'\'); + + //Load check form if this parameters is loaded in list_show and list_show_with_template + public function tmplt_func_click_form($actual_string, $theline, $result, $key) + { + + if($this->do_action && !empty($this->id_action) && (count($this->do_actions_arr) == 0 || $this->do_actions_arr[$theline] == true) ) + { + $return = '//onclick="valid_form( \'page\', \''.$result[$theline][0]['value'].'\', \''.$this->id_action.'\');"'; + return $return; + } + + } + + + //Load view_doc if this parameters is loaded in list_show and list_show_with_template + public function tmplt_func_bool_detail_doc($actual_string, $theline, $result, $key) + { + + if ($this->bool_detail == true) + { + + $return = "<a href='".$_SESSION['config']['businessappurl']."index.php?page=".$this->detail_destination."&id=".$result[$theline][0][$key]."' title='". _DETAILS."'> + <img src='".$_SESSION['config']['businessappurl']."img/picto_infos.gif' alt='"._DETAILS."' width='25' height='25' border='0' /></a>"; + + return $return; + } + + } + + + //Load check form if this parameters is loaded in list_show and list_show_with_template + public function tmplt_func_bool_view_doc($actual_string, $theline, $result, $key) + { + + if ($this->bool_view_document == true) + { + + $return = "<a href='".$_SESSION['config']['businessappurl']."indexing_searching/view.php?id=".$result[$theline][0][$key]."' target=\"_blank\" title='"._VIEW_DOC."'> + <img src='".$_SESSION['config']['businessappurl']."img/picto_dld.gif' alt='"._VIEW_DOC."' border='0'/></a>"; + return $return; + } + + } + + + + + + + //Reload last css parameter defined for the result list + public function tmplt_css_line_reload($actual_string) + { + return $this->actual_line_css; + } + + + //Load constant from lang file + function tmplt_define_lang($actual_string) + { + $my_explode= explode ("|", $actual_string); + + if (!$my_explode[1]) + { + return _WRONG_PARAM_FOR_LOAD_VALUE; + } + else + { + return constant($my_explode[1]); + } + } + + + //Load css for actual line. For the next line, arg1 is swith by arg2 + public function tmplt_css_line($actual_string) + { + $my_explode= explode ("|", $actual_string); + + if (!$my_explode[1]) + { + return _WRONG_PARAM_FOR_LOAD_VALUE; + } + else + { + if(count($my_explode) == 2 ) + { + return $my_explode[1]; + } + elseif(count($my_explode) == 3 ) + { + if ($this->actual_line_css == '') + { + $this->actual_line_css = $my_explode[1]; + return $this->actual_line_css; + } + elseif ($this->actual_line_css == $my_explode[1]) + { + $this->actual_line_css = $my_explode[2]; + return $this->actual_line_css; + } + elseif ($this->actual_line_css == $my_explode[2]) + { + $this->actual_line_css = $my_explode[1]; + return $this->actual_line_css; + } + else + { + return _WRONG_PARAM_FOR_LOAD_VALUE; + } + } + else + { + return _WRONG_PARAM_FOR_LOAD_VALUE; + } + + } + } + + + + //Load string ans search all function defined in this string + public function load_var_sys($actual_string, $theline, $result = array(), $key = 'empty' ) + { + + ##load_value|arg1##: load value in the db; arg1= column's value identifier + if (preg_match("/^load_value\|/", $actual_string)) + //elseif($actual_string == "load_value") + { + $my_var = $this->tmplt_load_value($actual_string, $theline, $result); + } + ##load_css|arg1## : load css style - arg1= name of this class + elseif (preg_match("/^load_css\|/", $actual_string)) + { + $my_var = $this->tmplt_load_css($actual_string); + } + ##css_line|coll|nonecoll## : load css style for line arg1,arg2 : switch beetwin style on line one or line two + elseif (preg_match("/^css_line_reload$/", $actual_string)) + { + $my_var = $this->tmplt_css_line_reload($actual_string); + } + ##css_line|coll|nonecoll## : load css style for line arg1,arg2 : switch beetwin style on line one or line two + elseif (preg_match("/^css_line\|/", $actual_string)) + { + $my_var = $this->tmplt_css_line($actual_string); + } + ##load_img|arg1## : show loaded image; arg1= name of img file + elseif (preg_match("/^load_img\|/", $actual_string)) + { + + $my_var = $this->tmplt_load_img($actual_string); + } + ##order_link|arg1|arg2## : reload list and change order; arg1=type; arg2=sort + elseif (preg_match("/^order_link\|/", $actual_string)) + { + + $my_var = $this->tmplt_order_link($actual_string); + + } + ##url_docview## : view the file + elseif (preg_match("/^url_docview$/", $actual_string)) + { + $my_var = $this->url_docview($actual_string, $theline, $result, $key); + + } + ##define_lang|arg1## : define constant by the lang file; arg1 = constant of lang.php + elseif (preg_match("/^define_lang\|/", $actual_string)) + { + $my_var = $this->tmplt_define_lang($actual_string); + } + ##url_docdetail## : load page detail for this file + elseif (preg_match("/^url_docdetail$/", $actual_string)) + { + $my_var = $this->tmplt_url_docdetail($actual_string, $theline, $result, $key); + } + ##func_bool_radio_form## : Activate parameters in class list show + elseif (preg_match("/^func_bool_radio_form$/", $actual_string)) + { + $my_var = $this->tmplt_func_bool_radio_form($actual_string, $theline, $result, $key); + } + ##func_bool_check_form## : Activate parameters in class list show + elseif (preg_match("/^func_bool_check_form$/", $actual_string)) + { + $my_var = $this->tmplt_func_bool_check_form($actual_string, $theline, $result, $key); + } + ##func_bool_view_doc## : Activate parameters in class list show + elseif (preg_match("/^func_bool_view_doc$/", $actual_string)) + { + $my_var = $this->tmplt_func_bool_view_doc($actual_string, $theline, $result, $key); + } + ##func_bool_detail_doc## : Activate parameters in class list show + elseif (preg_match("/^func_bool_detail_doc$/", $actual_string)) + { + $my_var = $this->tmplt_func_bool_detail_doc($actual_string, $theline, $result, $key); + } + elseif (preg_match("/^func_click_form$/", $actual_string)) + { + $my_var = $this->tmplt_func_click_form($actual_string, $theline, $result, $key); + } + else + { + $my_var = _WRONG_FUNCTION_OR_WRONG_PARAMETERS; + } + return $my_var; + } + + + //Get template and remove all comments + public function get_template($this_file) + { + //Ouverture du fichier + $list_trait = file_get_contents ($this_file); + //Suppression des commantaires dans la page + $list_trait = preg_replace("/(<!--.*?-->)/s","", $list_trait); + + return $list_trait; + + } + //show obect to switch in another lists + public function display_template_for_user($template_list, $link) + { + + /* $template_list : list of template + * [name] : name of template file + * [img] : html img to use for this template + * [label] : label to show in alt tag or title tag + */ + + //delete from link template=....& + //$link = preg_replace("^template=(.*?)&", "TOTO", $link); + + $standard = "<a href='".$link."&template='><img src='".$_SESSION['config']['businessappurl']."img/standard_list.gif' alt='"._ACCESS_LIST_STANDARD."' ></a>"; + $extend = ""; + foreach ($template_list as $temp) + { + $extend .= " <a href='".$link."&template=".$temp['name']."'> <img src='".$_SESSION['config']['businessappurl']."img/".$temp['img']."' alt='".$temp['label']."' title='".$temp['label']."'></a>"; + } + return $standard." ".$extend.""; + + + + } + + + /** + * Show the document list in result of the search + * + * @param array $listarr + * @param integer $nb_total total number of documents + * @param string $title + * @param string $what search expression + * @param string $name "search" by default, the calling page + * @param string $key the key seach for the form + * @param string $detail_destination the link to detail page + * @param boolean $bool_view_document boolean to view document or not + * @param boolean $bool_radio_form boolean to add radio to select row + * @param string $method method of the select form + * @param string $action action of the select form + * @param string $button_label label(session var) of the button of the select form + * @param boolean $bool_detail boolean to show the detail page link or not + * @param boolean $bool_order boolean to show the order icons or not + * @param boolean $bool_frame true if calling by frame + * @param boolean $bool_export true if we activate the list export (obsolete => to delete) + * @param boolean $show_close true : the close window button is showed + * @param boolean $show_big_title true : the title is displayed in the title container + * @param boolean $show_full_list true : the list takes all the screen, otherwise it is addforms2 class + * @param boolean $bool_check_form true : add checkbox to select row + * @param string $res_link obsolete (to delete) + * @param string $module module name if the function is called in a module + * @param boolean $bool_show_listletters true : show list letters, search on the elements of the list possible + * @param string $all_sentence string : all item + * @param string $whatname name of the element to search + * @param string $used_css css used in the list + * @param string $comp_link url link complement + * @param string $link_in_line + * @param string $bool_show_actions_list true : shows the possible actions of the list on a combo list + * @param array $actions list of the elements of the actions combo list + * @param string $hidden_fields hidden fields in the form + */ + public function list_doc_by_template($result, $nb_total, $title,$what,$name = "search",$key,$detail_destination,$bool_view_document,$bool_radio_form,$method,$action, + $button_label, $bool_detail, $bool_order, $bool_frame= false,$bool_export= false, $show_close = FALSE, $show_big_title = true, + $show_full_list = true, $bool_check_form = false, $res_link = '', $module='', $bool_show_listletters = false, $all_sentence = '', + $whatname = '', $used_css = 'listing spec', $comp_link = "", $link_in_line = false, $bool_show_actions_list = false, $actions = array(), + $hidden_fields = '', $actions_json= '{}', $do_action = false, $id_action = '', $open_details_popup = true, $do_actions_arr = array(), $template = false, $template_list = array(), $actual_template = '', $mode_string = false) + { + + + $core_tools = new core_tools(); + $core_tools->load_lang(); + + $this->detail_destination = $detail_destination; + $this->bool_radio_form = $bool_radio_form; + $this->bool_check_form = $bool_check_form; + $this->bool_view_document = $bool_view_document; + $this->bool_detail = $bool_detail; + $this->do_action = $do_action; + $this->id_action = $id_action; + $this->do_action_arr = $do_action_arr; + + if(isset($_REQUEST['start']) && !empty($_REQUEST['start'])) + { + $start = strip_tags($_REQUEST['start']); + } + else + { + $start = 0; + } + + + /* ---------------------- */ + + + $file = $_SESSION['config']['businessapppath']."template".DIRECTORY_SEPARATOR.$actual_template.".html"; + $list_trait = $this->get_template($file); + $tmp = explode("#!#", $list_trait); + + + + //Generate link for reloading file + + if($bool_frame) + { + $link = $name.".php?search=".$what; + } + else + { + $link = $_SESSION['config']['businessappurl']."index.php?page=".$name."&search=".$what; + } + for($i=0;$i<count($_SESSION['where']);$i++) + { + $link .= "&where[]=".$_SESSION['where'][$i]; + } + if(!empty($module)) + { + $link .= "&module=".$module; + } + if(isset($_GET['what'])) + { + $link .= "&what=".strip_tags($_GET['what']); + } + if(isset($_REQUEST['start']) && !empty($_REQUEST['start'])) + { + $start = strip_tags($_REQUEST['start']); + } + else + { + $start = 0; + } + $this->the_start = $start; + if(isset($_GET['order'])) + { + $orderby = strip_tags($_GET['order']); + } + else + { + $orderby = 'asc'; + } + $link .= "&order=".$orderby; + if(isset($_GET['order_field'])) + { + $orderfield = strip_tags($_GET['order_field']); + } + else + { + $orderfield = ''; + } + + $link .= "&order_field=".$orderfield; + $link .= $comp_link; + + + + if($actual_template <> '') + { + $link .= "&template=".$actual_template; + } + else + { + $link .= "&template="; + } + + // Load object to switch template + if ($template == true) + { + $tdeto = $this->display_template_for_user($template_list, $link); + //$tdeto = _DISPLAY." : ".$tdeto; + } + + //######################## + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + $core_tools = new core_tools(); + if($core_tools->is_module_loaded("doc_converter") && $bool_export) + { + $_SESSION['doc_convert'] = array(); + require_once($_SESSION['pathtomodules']."doc_converter".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); + $doc_converter = new doc_converter(); + $disp_dc = $doc_converter->convert_list($result, true); + } + //######################## + + + $this->the_link = $link; + + + $nb_show = $_SESSION['config']['nblinetoshow']; + $nb_pages = ceil($nb_total/$nb_show); + $end = $start + $nb_show; + if($end > $nb_total) + { + $end = $nb_total; + } + + if($show_big_title) + { + $list_title .= '<h1>'; + if(!empty($picto_path)) + { $list_title .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';} + $list_title .= $title.'</h1>'; + } + else + { + $list_title .= '<b>'; + if(!empty($picto_path)) + { $list_title .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';} + $list_title .= $title.'</b>'; + } + + + // if they are more 1 page we do pagination with 2 forms + if($nb_pages > 1) + { + $next_start = 0; + //$search_form = "<form name=\"newpage1\" method=\"get\" >"; + $page_list1 = _GO_TO_PAGE." <select name=\"startpage\" onchange=\"window.location.href='".$link."&start='+this.value;\">"; + $lastpage = 0; + for($i = 0;$i <> $nb_pages; $i++) + { + $page_name = $i + 1; + $the_line = $i + 1; + if($start == $next_start) + { + $page_list1 .= "<option value=\"".$next_start."\" selected=\"selected\">".$the_line."</option>"; + + } + else + { + $page_list1 .= "<option value=\"".$next_start."\">".$the_line."</option>"; + } + $next_start = $next_start + $nb_show; + $lastpage = $next_start; + } + $page_list1 .= "</select>"; + $lastpage = $lastpage - $nb_show; + $previous = ""; + $next = ""; + if($start > 0) + { + $start_prev = $start - $nb_show; + $previous = "< <a href=\"".$link."&start=".$start_prev."\">"._PREVIOUS."</a> "; + } + + if($start <> $lastpage) + { + $start_next = $start + $nb_show; + //$next = " <div class='list_next' ><a href=\"".$link."&start=".$start_next."\">"._NEXT."</a> ></div>"; + $next = "<a href=\"".$link."&start=".$start_next."\">"._NEXT."</a> >"; + } + } + + $page_list1 = '<div class="block" style="height:30px;vertical" align="center" ><table width="100%" border="0"><tr><td align="center" width="15%"><b>'.$previous.'</b></td><td align="center" width="15%"><b>'.$next.'</b></td><td width="10px">|</td><td align="center" width="30%">'.$page_list1.'</td><td width="10px">|</td><td width="240px" align="center">'.$disp_dc.'</td><td width="10px">|</td><td align="right">'.$tdeto.'</td></tr></table></b></div>'; + + + + //Script for action + //################# + if($bool_radio_form || $bool_check_form || ($do_action && !empty($id_action))) + { + $temp = '<form name="form_select" id="form_select" action="'.$action.'" method="'.$method.'" class="forms'; + if(!$show_full_list) + { + $temp .= " addforms2\" >"; + } + else + { + $temp .= "\" >"; + } + $str .= $temp; + $str .= $hidden_fields; + } + + + //Exploding template to lunch funtion in load_var_sys() + $table = ''; + $head = ''; + $content = ''; + $footer = ''; + foreach($tmp as $ac_tmp) + { + if (substr($ac_tmp , 0, 5) == "TABLE") + { + $table = substr($ac_tmp, 5); + $true_table = $table; + //appel des fonctions de remplacement; + preg_match_all('/##(.*?)##/', $true_table, $out); + + for($i=0;$i<count($out[0]);$i++) + { + $remplacement_table = $this->load_var_sys($out[1][$i], $theline); + $table = str_replace($out[0][$i],$remplacement_table,$true_table); + } + } + elseif (substr($ac_tmp , 0, 4) == "HEAD") + { + $head = substr($ac_tmp, 4); + $true_head = $head; + preg_match_all('/##(.*?)##/', $true_head, $out); + + for($i=0;$i<count($out[0]);$i++) + { + $remplacement_head = $this->load_var_sys($out[1][$i], $theline); + $true_head = str_replace($out[0][$i],$remplacement_head,$true_head); + } + $head = $true_head; + } + elseif (substr($ac_tmp , 0, 6) == "RESULT") + { + $content = substr($ac_tmp, 6); + } + elseif (substr($ac_tmp , 0, 6) == "FOOTER") + { + $footer = substr($ac_tmp, 6); + } + } + + $content_list = ''; + + + + + + + for($theline = $start; $theline < $end ; $theline++) + { + + + $true_content=$content; + + + preg_match_all('/##(.*?)##/', $true_content, $out); + + + + for($i=0;$i<count($out[0]);$i++) + { + $remplacement = $this->load_var_sys($out[1][$i], $theline, $result, $key); + $true_content = str_replace($out[0][$i],$remplacement,$true_content); + } + + $content_list .= $true_content; + } + + if( (($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) || ($do_action && !empty($id_action))) + { + + $str .= '<script type="text/javascript">'; + $str .= ' var arr_actions = '.$actions_json.';'; + $str .= ' var arr_msg_error = {\'confirm_title\' : \''._ACTION_CONFIRM.'\','; + $str .= ' \'validate\' : \''._VALIDATE.'\','; + $str .= ' \'cancel\' : \''._CANCEL.'\','; + $str .= ' \'choose_action\' : \''._CHOOSE_ACTION.'\','; + $str .= ' \'choose_one_doc\' : \''._CHOOSE_ONE_DOC.'\''; + $str .= ' };'; + $str .= ' valid_form=function(mode, res_id, id_action)'; + $str .= '{'; + $str .= 'if(!isAlreadyClick){'; + $str .= ' var val = \'\';'; + $str .= ' var action_id = \'\';'; + $str .= ' var table = \'\';'; + $str .= ' var coll_id = \'\';'; + $str .= ' var module = \'\';'; + $str .= ' var thisfrm = document.getElementById(\'form_select\');'; + $str .= ' if(thisfrm)'; + $str .= ' {'; + $str .= ' for(var i=0; i < thisfrm.elements.length; i++)'; + $str .= ' {'; + $str .= ' if(thisfrm.elements[i].name = \'field\' && thisfrm.elements[i].checked == true)'; + $str .= ' {'; + $str .= ' val += thisfrm.elements[i].value+\',\';'; + $str .= ' }'; + $str .= ' else if(thisfrm.elements[i].id == \'action\')'; + $str .= ' {'; + $str .= ' action_id = thisfrm.elements[i].options[thisfrm.elements[i].selectedIndex].value;'; + $str .= ' }'; + $str .= ' else if(thisfrm.elements[i].id == \'table\')'; + $str .= ' {'; + $str .= ' table = thisfrm.elements[i].value;'; + $str .= ' }'; + $str .= ' else if(thisfrm.elements[i].id == \'coll_id\')'; + $str .= ' {'; + $str .= ' coll_id = thisfrm.elements[i].value;'; + $str .= ' }'; + $str .= ' else if(thisfrm.elements[i].id == \'module\')'; + $str .= ' {'; + $str .= ' module = thisfrm.elements[i].value;'; + $str .= ' }'; + $str .= ' }'; + $str .= ' val = val.substr(0, val.length -1);'; + $str .= ' var val_frm = {\'values\' : val, \'action_id\' : action_id, \'table\' : table, \'coll_id\' : coll_id, \'module\' : module};'; + $str .= ' if(res_id && res_id != \'\')'; + $str .= ' {'; + $str .= ' val_frm[\'values\'] = res_id;'; + $str .= ' }'; + $str .= ' if(id_action && id_action != \'\')'; + $str .= ' {'; + $str .= ' val_frm[\'action_id\'] = id_action;'; + $str .= ' }'; + + $str .= ' action_send_first_request(\''.$_SESSION['urltocore'].'manage_action.php\', mode, val_frm[\'action_id\'], val_frm[\'values\'], val_frm[\'table\'], val_frm[\'module\'], val_frm[\'coll_id\']);'; + $str .= ' }'; + $str .= ' else'; + $str .= ' {'; + $str .= ' alert(\'Validation form error\');'; + $str .= ' }'; + $str .= 'isAlreadyClick = true;'; + $str .= '}'; + $str .= ' }'; + $str .= ' </script>'; + } + //################# + + + + + + + //#################### Action module + if(($bool_radio_form || $bool_check_form) && count($result) > 0 && !$bool_show_actions_list) + { + $str_foot .= ' <p align="center">'; + $str_foot .= ' <input class="button" type="submit" value="'.$button_label.'" />'; + if($show_close ) + { + $str_foot .= ' <input type="button" class="button" name="cancel" value="'._CLOSE_WINDOW.'" onclick="window.top.close();" />'; + } + $str_foot .= ' </p>'; + $str_foot .= ' </form>'; + $str_foot .= ' <br/>'; + } + else if(($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) + { + $str_foot .= ' <p align="center">'; + $str_foot .= ' <b>'._ACTIONS.' :</b>'; + $str_foot .= ' <select name="action" id="action">'; + $str_foot .= ' <option value="">'. _CHOOSE_ACTION.'</option>'; + for($ind_act = 0; $ind_act < count($actions);$ind_act++) + { + $str_foot .= ' <option value="'.$actions[$ind_act]['VALUE'].'">'.$actions[$ind_act]['LABEL'].'</option>'; + } + $str_foot .= ' </select>'; + $str_foot .= ' <input type="button" name="send" id="send" value="'._VALIDATE.'" onclick="valid_form(\'mass\');" class="button" />'; + $str_foot .= ' </p>'; + $str_foot .= ' </form>'; + $str_foot .= ' <br/>'; + } + elseif($do_action) + { + $str_foot .= ' </form>'; + } + //###################### + + + + + + + + + // Print in application the generated template list result + + if ($mode_string == false) + { + echo $list_title.$page_list1.$str.$table.$head.$content_list.$footer.$str_foot; + } + else + { + return $list_title.$page_list1.$str.$table.$head.$content_list.$footer.$str_foot; + } + + + + + } + +} + +?> diff --git a/maarch_entreprise/trunk/class/class_reopen_mail.php b/maarch_entreprise/trunk/class/class_reopen_mail.php new file mode 100644 index 0000000000000000000000000000000000000000..113ee329074589d11418aab988a55f28024e13d2 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_reopen_mail.php @@ -0,0 +1,132 @@ +<?php +/** +* Reopen Mail Class +* +* Contains all the specific functions to reopen mail +* +* @package Maarch LetterBox 2.0 +* @version 2.0 +* @since 06/2007 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* +*/ + +/** +* Class ReopenMail : Contains all the specific functions to reopen a mail +* +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @package Maarch LetterBox 2.0 +* @version 2.0 +*/ + +class ReopenMail extends dbquery +{ + + /** + * Redefinition of the LetterBox object constructor + */ + function __construct() + { + parent::__construct(); + } + + /** + * Checks the res_id + * + * @param string $mode add or up + */ + public function reopen_mail_check() + { + if(empty($_REQUEST['id'])) + { + $_SESSION['error'] = _ID.' '._IS_EMPTY; + } + else + { + $_SESSION['m_admin']['reopen_mail']['ID'] = $this->wash($_REQUEST['id'], "num", _ID." "); + } + } + + /** + * Update databse + * + */ + public function update_db() + { + // add ou modify users in the database + $this->reopen_mail_check(); + if(!empty($_SESSION['error'])) + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=reopen_mail&id=".$_SESSION['m_admin']['reopen_mail']['ID']."&admin=reopen_mail"); + exit(); + } + else + { + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec = new security(); + $ind_coll = $sec->get_ind_collection('letterbox_coll'); + $table = $_SESSION['collections'][$ind_coll]['table']; + $this->connect(); + + $this->query("select res_id from ".$table." where res_id = ".$_SESSION['m_admin']['reopen_mail']['ID']); + if($this->nb_result() == 0) + { + $_SESSION['error'] = _NUM_GED." "._UNKNOWN; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=reopen_mail&id=".$_SESSION['m_admin']['reopen_mail']['ID']."&admin=reopen_mail"); + exit(); + } + $this->query("update ".$table." set status = 'COU' + where res_id = ".$_SESSION['m_admin']['reopen_mail']['ID'].""); + + if($_SESSION['history']['resup'] == true ) + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($table, $_SESSION['m_admin']['reopen_mail']['ID'],"UP",_REOPEN_THIS_MAIL." : ".$_SESSION['m_admin']['reopen_mail']['ID'], $_SESSION['config']['databasetype'], 'apps'); + } + + $_SESSION['error'] = _REOPEN_THIS_MAIL." : ".$_SESSION['m_admin']['reopen_mail']['ID']; + unset($_SESSION['m_admin']); + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=admin"); + exit(); + } + } + + + /** + * Form to reopen a mail + * + */ + public function formreopenmail() + { + ?> + <h1><img src="<? echo $_SESSION['config']['img'];?>/default_status_big.gif" alt="" border="0" /> <? echo _REOPEN_MAIL;?></h1> + + <div id="inner_content" class="clearfix" align="center"> + <br /><br /> + <p ><? echo _MAIL_SENTENCE2._MAIL_SENTENCE3;?> </p> + <br/> + <p ><img src="<? echo $_SESSION['config']['img'];?>/separateur_1.jpg" width="90%" height="1" alt="" /></p> + <form name="form1" method="post" action="<? echo $_SESSION['config']['businessappurl']."admin/reopen_mail/reopen_mail_db.php";?>" > + <p> + <label for="id"><? echo _ENTER_DOC_ID;?> : </h2> + <input type="text" name="id" id="id" value="<?php echo $_SESSION['m_admin']['reopen_mail']['ID'];?>" /> + </p > + <br/> + + <p >(<? echo _TO_KNOW_ID;?>) </p> + + <br/> + <p class="buttons"> + <input type="submit" name="Submit" value="<? echo _MODIFY_STATUS;?>" class="button"/> + <input type="button" name="close" value="<? echo _CANCEL;?>" onclick="javascript:window.location.href='<? echo $_SESSION['config']['businessappurl'];?>index.php?page=admin';" class="button"/> + </p> + + </form> + </div> + <?php + } +} +?> diff --git a/maarch_entreprise/trunk/class/class_types.php b/maarch_entreprise/trunk/class/class_types.php new file mode 100644 index 0000000000000000000000000000000000000000..9cba283a9d26ac2bebd3b4f1bd54432e555e0c85 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_types.php @@ -0,0 +1,660 @@ +<? +/** +* Types Class +* +* Contains all the function to manage the doctypes +* +* @package Maarch LetterBox 1.0 +* @version 2.0 +* @since 10/2005 +* @license GPL +* @author Nicolas Gualtieri +* @author Claire Figueras <dev@maarch.org> +* +*/ + +/** +* Class types: Contains all the function to manage the doctypes +* +* @author Nicolas Gualtieri +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @package Maarch LetterBox 1.0 +* @version 1.1 +*/ +class types extends dbquery +{ + /** + * Redefinition of the types object constructor : configure the sql argument order by + */ + function __construct() + { + parent::__construct(); + // configure the sql argument order by + if(isset($_GET['start'])) + { + $this->the_start = strip_tags($_GET['start']); + } + else + { + $this->the_start = 0; + } + + if(isset($_GET['order'])) + { + $this->orderby = strip_tags($_GET['order']); + } + else + { + $this->orderby = "labelasc"; + } + + $this->sqlorderby = ""; + + if($this->orderby == "labelasc") + { + $this->sqlorderby = "order by description asc"; + } + + if($this->orderby == "labeldesc") + { + $this->sqlorderby = "order by description desc"; + } + + if($this->orderby == "idasc") + { + $this->sqlorderby = "order by type_id asc"; + } + + if($this->orderby == "iddesc") + { + $this->sqlorderby = "order by type_id desc"; + } + + if($this->orderby == "statusasc") + { + $this->sqlorderby = "order by enabled asc"; + } + + if($this->orderby == "statusdesc") + { + $this->sqlorderby = "order by enabled desc"; + } + + if($this->orderby == "userasc") + { + $this->sqlorderby = "order by custom_t2 asc"; + } + + if($this->orderby == "userdesc") + { + $this->sqlorderby = "order by user_id desc"; + } + } + + /** + * Form to add, modify or propose a doc type + * + * @param string $mode val, up or prop + * @param integer $id type identifier, empty by default + */ + public function formtype($mode,$id = "") + { + // form to add, modify or proposale a doc type + $func = new functions(); + $core_tools = new core_tools(); + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec = new security(); + $state = true; + if(!isset($_SESSION['m_admin']['doctypes'])) + { + $this->cleartypeinfos(); + } + if($mode <> "prop" && $mode <> "add") + { + $this->connect(); + $this->query("select * from ".$_SESSION['tablename']['doctypes']." where type_id = ".$id.""); + if($this->nb_result() == 0) + { + $_SESSION['error'] = _DOCTYPE.' '._ALREADY_EXISTS; + $state = false; + } + else + { + $_SESSION['m_admin']['doctypes'] = array(); + $line = $this->fetch_object(); + $_SESSION['m_admin']['doctypes']['TYPE_ID'] = $line->type_id; + $_SESSION['m_admin']['doctypes']['COLL_ID'] = $line->coll_id; + $_SESSION['m_admin']['doctypes']['COLL_LABEL'] = $_SESSION['m_admin']['doctypes']['COLL_ID']; + for($i=0; $i< count($_SESSION['collections']); $i++) + { + if($_SESSION['collections'][$i]['id'] == $_SESSION['m_admin']['doctypes']['COLL_ID']) + { + $_SESSION['m_admin']['doctypes']['COLL_LABEL'] = $_SESSION['collections'][$i]['label']; + break; + } + } + $_SESSION['m_admin']['doctypes']['LABEL'] = $this->show_string($line->description); + $_SESSION['m_admin']['doctypes']['SUB_FOLDER'] = $line->doctypes_second_level_id; + $_SESSION['m_admin']['doctypes']['VALIDATE'] = $line->enabled; + $_SESSION['m_admin']['doctypes']['TABLE'] = $line->coll_id; + $_SESSION['m_admin']['doctypes']['ACTUAL_COLL_ID'] = $line->coll_id; + $_SESSION['m_admin']['doctypes']['custom_t1'] = $this->show_string($line->custom_t1); + $_SESSION['m_admin']['doctypes']['custom_t2'] = $this->show_string($line->custom_t2); + $_SESSION['m_admin']['doctypes']['custom_t3'] = $this->show_string($line->custom_t3); + $_SESSION['m_admin']['doctypes']['custom_t4'] = $this->show_string($line->custom_t4); + $_SESSION['m_admin']['doctypes']['custom_t5'] = $this->show_string($line->custom_t5); + $_SESSION['m_admin']['doctypes']['custom_t6'] = $this->show_string($line->custom_t6); + $_SESSION['m_admin']['doctypes']['custom_t7'] = $this->show_string($line->custom_t7); + $_SESSION['m_admin']['doctypes']['custom_t8'] = $this->show_string($line->custom_t8); + $_SESSION['m_admin']['doctypes']['custom_t9'] = $this->show_string($line->custom_t9); + $_SESSION['m_admin']['doctypes']['custom_t10'] = $this->show_string($line->custom_t10); + $_SESSION['m_admin']['doctypes']['custom_t11'] = $this->show_string($line->custom_t11); + $_SESSION['m_admin']['doctypes']['custom_t12'] = $this->show_string($line->custom_t12); + $_SESSION['m_admin']['doctypes']['custom_t13'] = $this->show_string($line->custom_t13); + $_SESSION['m_admin']['doctypes']['custom_t14'] = $this->show_string($line->custom_t14); + $_SESSION['m_admin']['doctypes']['custom_t15'] = $this->show_string($line->custom_t15); + $_SESSION['m_admin']['doctypes']['custom_d1'] = $line->custom_d1; + $_SESSION['m_admin']['doctypes']['custom_d2'] = $line->custom_d2; + $_SESSION['m_admin']['doctypes']['custom_d3'] = $line->custom_d3; + $_SESSION['m_admin']['doctypes']['custom_d4'] = $line->custom_d4; + $_SESSION['m_admin']['doctypes']['custom_d5'] = $line->custom_d5; + $_SESSION['m_admin']['doctypes']['custom_d6'] = $line->custom_d6; + $_SESSION['m_admin']['doctypes']['custom_d7'] = $line->custom_d7; + $_SESSION['m_admin']['doctypes']['custom_d8'] = $line->custom_d8; + $_SESSION['m_admin']['doctypes']['custom_d9'] = $line->custom_d9; + $_SESSION['m_admin']['doctypes']['custom_d10'] = $line->custom_d10; + $_SESSION['m_admin']['doctypes']['custom_n1'] = $line->custom_n1; + $_SESSION['m_admin']['doctypes']['custom_n2'] = $line->custom_n2; + $_SESSION['m_admin']['doctypes']['custom_n3'] = $line->custom_n3; + $_SESSION['m_admin']['doctypes']['custom_n4'] = $line->custom_n4; + $_SESSION['m_admin']['doctypes']['custom_n5'] = $line->custom_n5; + $_SESSION['m_admin']['doctypes']['custom_f1'] = $line->custom_f1; + $_SESSION['m_admin']['doctypes']['custom_f2'] = $line->custom_f2; + $_SESSION['m_admin']['doctypes']['custom_f3'] = $line->custom_f3; + $_SESSION['m_admin']['doctypes']['custom_f4'] = $line->custom_f4; + $_SESSION['m_admin']['doctypes']['custom_f5'] = $line->custom_f5; + + $_SESSION['service_tag'] = 'doctype_up'; + $core_tools->execute_modules_services($_SESSION['modules_services'], 'doctype_up', "include"); + $core_tools->execute_app_services($_SESSION['app_services'], 'doctype_up', 'include'); + } + } + else // mode = add + { + $_SESSION['service_tag'] = 'doctype_add'; + echo $core_tools->execute_modules_services($_SESSION['modules_services'], 'doctype_up', "include"); + $core_tools->execute_app_services($_SESSION['app_services'], 'doctype_up', 'include'); + $_SESSION['service_tag'] = ''; + } + ?> + <!--<script language="javascript"> + function change_coll(totaldoc) + { + var eleselect = window.top.document.getElementById('sous_dossier'); + //window.alert(eleselect.value); + var eleframe1 = window.top.document.getElementById('choose_coll'); + eleframe1.src = '<?=$_SESSION['config']['businessappurl']?>admin/architecture/types/choose_coll.php?subfolder='+eleselect.value+'&totaldoc='+totaldoc; + } + </script>--> + <h1><img src="<? echo $_SESSION['config']['img'];?>/manage_doctypes_b.gif" alt="" /> + <? + if($mode == "up") + { + echo _DOCTYPE_MODIFICATION; + } + elseif($mode == "add") + { + echo _ADD_DOCTYPE; + } + ?> + </h1> + <div id="inner_content" class="clearfix"> + <? + if($state == false) + { + echo "<br /><br /><br /><br />"._DOCTYPE.' '._UNKOWN."<br /><br /><br /><br />"; + } + else + { + $array_coll = $sec->retrieve_insert_collections(); + ?> + <br/><br/> + <div class="block"> + <form name="frmtype" id="frmtype" method="post" action="<? echo $_SESSION['config']['businessappurl'];?>index.php?page=types_up_db" class="forms"> + <input type="hidden" name="mode" value="<? echo $mode; ?>" /> + <? + /*if(!$core_tools->is_module_loaded("folder")) + { + ?> + <!-- <p> + <iframe name="choose_coll" id="choose_coll" scrolling="no" width="100%" height="20" src="<? echo $_SESSION['config']['businessappurl'].'admin/architecture/types/choose_coll.php';?>" frameborder="0"></iframe> + </p>--> + <p> + <label><? echo _ATTACH_SUBFOLDER;?> : </label> + <select name="sous_dossier" id="sous_dossier" class="listext"> + <option value=""><? echo _CHOOSE_SUBFOLDER;?></option> + <? + for($i=0; $i< count($_SESSION['sous_dossiers']); $i++) + { + ?> + <option value="<? echo $_SESSION['sous_dossiers'][$i]['ID']; ?>" <? if($_SESSION['sous_dossiers'][$i]['ID'] == $_SESSION['m_admin']['doctypes']['SUB_FOLDER']) { echo "selected=\"selected\"" ;}?>><? echo $_SESSION['sous_dossiers'][$i]['LABEL']; ?></option> + <? + } + ?> + </select> + </p> + <? + } + else + { + if($mode == "up") + { + $this->query("select doctypes_first_level_id from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_second_level_id = ".$_SESSION['m_admin']['doctypes']['SUB_FOLDER']); + $line = $this->fetch_object(); + $this->query("select doctypes_first_level_label from ".$_SESSION['tablename']['doctypes_first_level']." where doctypes_first_level_id = ".$line->doctypes_first_level_id); + $line3 = $this->fetch_object(); + $_SESSION['m_admin']['doctypes']['STRUCT_LABEL'] = $this->show_string($line3->doctypes_first_level_label); + if(isset($_SESSION['m_admin']['doctypes']['TYPE_ID']) && !empty($_SESSION['m_admin']['doctypes']['TYPE_ID'])) + { + $table_view = $sec->retrieve_view_from_coll_id($_SESSION['m_admin']['doctypes']['COLL_ID']); + $this->query("select count(*) as total_doc from ".$table_view." where type_id = ".$_SESSION['m_admin']['doctypes']['TYPE_ID']); + //$this->show(); + $line = $this->fetch_object(); + $total_doc = $line->total_doc; + } + } change_coll('<? echo $total_doc;?>');*/ + ?> + <p> + <label><? echo _ATTACH_SUBFOLDER;?> : </label> + <select name="sous_dossier" id="sous_dossier" class="listext" onchange=""> + <option value=""><? echo _CHOOSE_SUBFOLDER;?></option> + <? + for($i=0; $i< count($_SESSION['sous_dossiers']); $i++) + { + ?> + <option value="<? echo $_SESSION['sous_dossiers'][$i]['ID']; ?>" <? if($_SESSION['sous_dossiers'][$i]['ID'] == $_SESSION['m_admin']['doctypes']['SUB_FOLDER']) { echo "selected=\"selected\"" ;}?>><? echo $_SESSION['sous_dossiers'][$i]['LABEL']; ?></option> + <? + } + ?> + </select> + </p> + <!-- <p> + <iframe name="choose_coll" id="choose_coll" scrolling="no" width="100%" height="50" src="<? echo $_SESSION['config']['businessappurl'].'admin/architecture/types/choose_coll.php';?>" frameborder="0"></iframe> + </p>--> + <? + //}?> + <p> + <label for="collection"><?php echo _COLLECTION;?> : </label> + <select name="collection" id="collection" onchange=""> + <option value="" ><?php echo _CHOOSE_COLLECTION;?></option> + <?php for($i=0; $i<count($array_coll);$i++) + { + ?> + <option value="<?php echo $array_coll[$i]['id'];?>" <?php if($_SESSION['m_admin']['doctypes']['COLL_ID'] == $array_coll[$i]['id']){ echo 'selected="selected"';}?> ><?php echo $array_coll[$i]['label'];?></option> + <?php + } + ?> + </select> + </p> + <?php + if($mode == "up") + { + ?> + <p> + <label for="id"><? echo _ID;?> : </label> + <input type="text" class="readonly" readonly="readonly" name="idbis" value="<? echo $id;?>" /> + <input type="hidden" name="id" value="<? echo $id; ?>" /> + </p> + <? + } + ?> + <p> + <label for="label"><? echo _WORDING; ?> : </label> + <input name="label" type="text" class="textbox" id="label" value="<? echo $func->show($_SESSION['m_admin']['doctypes']['LABEL']); ?>"/> + </p> + <?php + $_SESSION['service_tag'] = 'frm_doctype'; + $core_tools->execute_app_services($_SESSION['app_services'], 'doctype_up', 'include'); + + ?> + </div> + <div class="block_end"> </div> + <br/> + <? + + $core_tools->execute_modules_services($_SESSION['modules_services'], 'doctype_up', "include"); + $_SESSION['service_tag'] = ''; + ?> + <div align="center"> + <?php // To DO : index dynamiques ?> + <!-- <iframe name="choose_index" id="choose_index" scrolling="auto" width="100%" height="350" src="<? echo $_SESSION['config']['businessappurl'].'admin/architecture/types/choose_index.php';?>" frameborder="0"></iframe>--> + + <p class="buttons"> + <? + if($mode == "up") + { + ?> + <input class="button" type="submit" name="Submit" value="<? echo _MODIFY_DOCTYPE; ?>"/> <!--onclick="window.frames['choose_index'].document.forms[0].submit();" --> + <? + } + elseif($mode == "add") + { + ?> + <input type="submit" class="button" name="Submit" value="<? echo _ADD_DOCTYPE; ?>" /><!--onclick="window.frames['choose_index'].document.forms[0].submit();"--> + <? + } + ?> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<? echo $_SESSION['config']['businessappurl'];?>index.php?page=types';"/> + </p> + </form> + </div> + <? + } + ?> + </div> + <? + } + + /** + * Clean the type info + */ + private function typesinfo() + { + // clean the type info + $core_tools = new core_tools(); + $func = new functions(); + //$func->show_array($_REQUEST); + if(!isset($_REQUEST['mode'])) + { + $_SESSION['error'] = _UNKNOWN_PARAM."<br />"; + } + + if(isset($_REQUEST['label']) && !empty($_REQUEST['label'])) + { + $_SESSION['m_admin']['doctypes']['LABEL'] = $func->wash($_REQUEST['label'], "no", _THE_WORDING, 'yes', 0, 255); + } + else + { + $_SESSION['error'] .= _WORDING.' '._IS_EMPTY; + } + + $_SESSION['service_tag'] = "doctype_info"; + echo $core_tools->execute_modules_services($_SESSION['modules_services'], 'doctype_info', "include"); + $core_tools->execute_app_services($_SESSION['app_services'], 'doctype_up', 'include'); + $_SESSION['service_tag'] = ''; + if(!isset($_REQUEST['collection']) || empty($_REQUEST['collection'])) + { + $_SESSION['error'] .= _THE_COLLECTION. ' '._IS_MANDATORY.'.<br/>'; + } + else + { + $_SESSION['m_admin']['doctypes']['COLL_ID'] = $_REQUEST['collection']; + /* $coll_id = $_SESSION['m_admin']['doctypes']['COLL_ID']; + + for($i=0;$i<count($_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']]);$i++) + { + + if($_REQUEST["field_".$_SESSION['index'][$coll_id][$i]['COLUMN']] == "Y") + { + if($_REQUEST["mandatory_".$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] == "Y") + { + $_SESSION['m_admin']['doctypes'][$_SESSION['index'][$i]['COLUMN']] = "1100000000"; + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN'].", "; + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] .= "'1100000000', "; + $_SESSION['m_admin']['doctypes']['custom_query_update'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']." = "."'1100000000', "; + } + else + { + $_SESSION['m_admin']['doctypes'][$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] = "1000000000"; + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN'].", "; + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] .= "'1000000000', "; + $_SESSION['m_admin']['doctypes']['custom_query_update'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']." = "."'1000000000', "; + } + } + elseif($_REQUEST["field_".$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] == "") + { + $_SESSION['m_admin']['doctypes'][$_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']] = "0000000000"; + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN'].", "; + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] .= "'0000000000', "; + $_SESSION['m_admin']['doctypes']['custom_query_update'] .= $_SESSION['index'][$_SESSION['m_admin']['doctypes']['COLL_ID']][$i]['COLUMN']." = '0000000000', "; + } + } + + if(trim($_SESSION['m_admin']['doctypes']['custom_query_insert_colums']) <> "") + { + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] = ", ".$_SESSION['m_admin']['doctypes']['custom_query_insert_colums']; + $_SESSION['m_admin']['doctypes']['custom_query_insert_colums'] = substr($_SESSION['m_admin']['doctypes']['custom_query_insert_colums'],0,strlen($_SESSION['m_admin']['doctypes']['custom_query_insert_colums'])-2); + } + if($_SESSION['m_admin']['doctypes']['custom_query_insert_values'] <> "") + { + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] = ", ".$_SESSION['m_admin']['doctypes']['custom_query_insert_values']; + $_SESSION['m_admin']['doctypes']['custom_query_insert_values'] = substr($_SESSION['m_admin']['doctypes']['custom_query_insert_values'],0,strlen($_SESSION['m_admin']['doctypes']['custom_query_insert_values'])-2); + } + if($_SESSION['m_admin']['doctypes']['custom_query_update'] <> "") + { + $_SESSION['m_admin']['doctypes']['custom_query_update'] = ", ".$_SESSION['m_admin']['doctypes']['custom_query_update']; + $_SESSION['m_admin']['doctypes']['custom_query_update'] = substr($_SESSION['m_admin']['doctypes']['custom_query_update'],0,strlen($_SESSION['m_admin']['doctypes']['custom_query_update'])-2); + }*/ + } + if(!isset($_REQUEST['sous_dossier']) || empty($_REQUEST['sous_dossier'])) + { + $_SESSION['error'] .= _THE_SUBFOLDER. ' '._IS_MANDATORY.'.<br/>'; + } + else + { + $_SESSION['m_admin']['doctypes']['SUB_FOLDER'] = $func->wash($_REQUEST['sous_dossier'], "no", _THE_SUBFOLDER); + $this->connect(); + $this->query("select doctypes_first_level_id as id from ".$_SESSION['tablename']['doctypes_second_level']." where doctypes_second_level_id = ".$_REQUEST['sous_dossier']); + $res = $this->fetch_object(); + $_SESSION['m_admin']['doctypes']['STRUCTURE'] = $res->id; + } + } + + /** + * Modify, add or validate a doctype + */ + public function uptypes() + { + // modify, add or validate a doctype + $core_tools = new core_tools(); + $this->typesinfo(); + if(!empty($_SESSION['error'])) + { + if($_REQUEST['mode'] == "up") + { + if(!empty($_SESSION['m_admin']['doctypes']['TYPE_ID'])) + { + ?><script language="javascript" type="text/javascript">window.top.location.href='<? echo $_SESSION['config']['businessappurl']."index.php?page=types_up&id=".$_SESSION['m_admin']['doctypes']['TYPE_ID'];?>';</script> + <? + exit(); + } + else + { + ?> + <script language="javascript" type="text/javascript">window.top.location.href='<? echo $_SESSION['config']['businessappurl']."index.php?page=types";?>';</script> + <? + exit(); + } + } + elseif($_REQUEST['mode'] == "add" ) + { + ?> <script language="javascript" type="text/javascript">window.top.location.href='<? echo $_SESSION['config']['businessappurl']."index.php?page=types_add";?>';</script> + <? + exit(); + } + } + else + { + $this->connect(); + if($_REQUEST['mode'] <> "prop" && $_REQUEST['mode'] <> "add") + { + $tmp = $this->protect_string_db($_SESSION['m_admin']['doctypes']['LABEL']); + $this->query("update ".$_SESSION['tablename']['doctypes']." set description = '".$tmp."' , doctypes_first_level_id = ".$_SESSION['m_admin']['doctypes']['STRUCTURE'].", doctypes_second_level_id = ".$_SESSION['m_admin']['doctypes']['SUB_FOLDER'].", enabled = 'Y', coll_id = '".$_SESSION['m_admin']['doctypes']['COLL_ID']."' ".$_SESSION['m_admin']['doctypes']['custom_query_update']." where TYPE_ID = '".$_SESSION['m_admin']['doctypes']['TYPE_ID']."'"); + + $_SESSION['service_tag'] = "doctype_updatedb"; + $core_tools->execute_modules_services($_SESSION['modules_services'], 'doctype_load_db', "include"); + $core_tools->execute_app_services($_SESSION['app_services'], 'doctype_up', 'include'); + $_SESSION['service_tag'] = ''; + if($_REQUEST['mode'] == "up") + { + $_SESSION['error'] = _DOCTYPE_MODIFICATION; + if($_SESSION['history']['doctypesup'] == "true") + { + require($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['doctypes'], $_SESSION['m_admin']['doctypes']['TYPE_ID'],"UP",_DOCTYPE_MODIFICATION." : ".$_SESSION['m_admin']['doctypes']['LABEL'], $_SESSION['config']['databasetype']); + } + } + $this->cleartypeinfos(); + ?> + <script language="javascript" type="text/javascript">window.top.location.href='<? echo $_SESSION['config']['businessappurl']."index.php?page=types";?>';</script> + <? + exit(); + } + else + { + require($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + if( $_REQUEST['mode'] == "add") + { + $tmp = $this->protect_string_db($_SESSION['m_admin']['doctypes']['LABEL']); + + $this->query("insert into ".$_SESSION['tablename']['doctypes']." (coll_id, description, doctypes_first_level_id, doctypes_second_level_id, enabled ".$_SESSION['m_admin']['doctypes']['custom_query_insert_colums'].") VALUES ('".$_SESSION['m_admin']['doctypes']['COLL_ID']."', '".$tmp."',".$_SESSION['m_admin']['doctypes']['STRUCTURE'].",".$_SESSION['m_admin']['doctypes']['SUB_FOLDER'].", 'Y' ".$_SESSION['m_admin']['doctypes']['custom_query_insert_values'].")"); + //$this->show(); + + //exit(); + $this->query("select type_id from ".$_SESSION['tablename']['doctypes']." where coll_id = '".$_SESSION['m_admin']['doctypes']['COLL_ID']."' and description = '".$tmp."' and doctypes_first_level_id = ".$_SESSION['m_admin']['doctypes']['STRUCTURE']." and doctypes_second_level_id = ".$_SESSION['m_admin']['doctypes']['SUB_FOLDER']); + //$this->show(); + $res = $this->fetch_object(); + $_SESSION['m_admin']['doctypes']['TYPE_ID'] = $res->type_id; + /* if($core_tools->is_module_loaded("basket")) + { + $this->query("insert into ".$_SESSION['tablename']['mlb_doctype_ext']." (type_id, process_delay, delay1, delay2) values (".$res->type_id.", ".$_SESSION['m_admin']['doctypes']['process_delay'].", ".$_SESSION['m_admin']['doctypes']['delay1'].", ".$_SESSION['m_admin']['doctypes']['delay2'].")"); + }*/ + $_SESSION['service_tag'] = "doctype_insertdb"; + echo $core_tools->execute_modules_services($_SESSION['modules_services'], 'doctype_load_db', "include"); + $core_tools->execute_app_services($_SESSION['app_services'], 'doctype_up', 'include'); + $_SESSION['service_tag'] = ''; + + if($_SESSION['history']['doctypesadd'] == "true") + { + $users->add($_SESSION['tablename']['doctypes'],$res->type_id,"ADD", _DOCTYPE_ADDED." : ".$_SESSION['m_admin']['doctypes']['LABEL'],$_SESSION['config']['databasetype']); + } + //$url = "index.php?page=types"; + } + $this->cleartypeinfos(); + //header("location: ".$url); + ?> <script language="javascript" type="text/javascript">window.top.location.href='<? echo $_SESSION['config']['businessappurl']."index.php?page=types";?>';</script> + <? + exit(); + } + } + } + + /** + * Clear the session variable for the doctypes + */ + private function cleartypeinfos() + { + // clear the session variable for the doctypes + unset($_SESSION['m_admin']); + } + + /** + * Delete a doc type + * + * @param integer $id doctype indentifier + */ +/* public function deltypes($id) + { + // delete a doc type + $core_tools = new core_tools(); + $this->connect(); + $this->query("select description from ".$_SESSION['tablename']['doctypes']." where type_id = ".$id.""); + if($this->nb_result() == 0) + { + $_SESSION['error'] = _DOCTYPE.' '._UNKNOWN; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=types"); + exit(); + } + else + { + $info = $this->fetch_object(); + $this->query("delete from ".$_SESSION['tablename']['doctypes']." where type_id = ".$id.""); + + + $_SESSION['service_tag'] = "doctype_delete"; + $_SESSION['m_admin']['doctypes']['TYPE_ID'] = $id; + $core_tools->execute_modules_services($_SESSION['modules_services'], 'doctype_del', "include"); + $core_tools->execute_app_services($_SESSION['app_services'], 'doctype_del', 'include'); + $_SESSION['service_tag'] = ''; + + require($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['doctypes'], $id,"DEL",_DOCTYPE_DELETION." : ".$info->DESCRIPTION, $_SESSION['config']['databasetype']); + $_SESSION['error'] = _DELETED_DOCTYPE; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=types"); + exit(); + } + }*/ + + /** + * Return in an array all enabled doctypes for a given collection + * + * @param string $coll_id Collection identifier + */ + public function getArrayTypes($coll_id) + { + $types = array(); + if(empty($coll_id)) + { + return $types; + } + + $this->connect(); + $this->query("select type_id, description from ".$_SESSION['tablename']['doctypes']." where coll_id = '".$coll_id."' and enabled = 'Y'"); + while($res = $this->fetch_object()) + { + array_push($types, array('ID' => $res->type_id, 'LABEL' => $this->show_string($res->description))); + } + return $types; + } + + public function getArrayStructTypes($coll_id) + { + $this->connect(); + $level1 = array(); + $this->query("select d.type_id, d.description, d.doctypes_first_level_id, d.doctypes_second_level_id, dsl.doctypes_second_level_label, dfl.doctypes_first_level_label from ".$_SESSION['tablename']['doctypes']." d, ".$_SESSION['tablename']['doctypes_second_level']." dsl, ".$_SESSION['tablename']['doctypes_first_level']." dfl where coll_id = 'letterbox_coll' and d.enabled = 'Y' and d.doctypes_second_level_id = dsl.doctypes_second_level_id and d.doctypes_first_level_id = dfl.doctypes_first_level_id and dsl.enabled = 'Y' and dfl.enabled = 'Y' order by dfl.doctypes_first_level_label,dsl.doctypes_second_level_label, d.description "); + $last_level1 = ''; + $nb_level1 = 0; + $last_level2 = ''; + $nb_level2 = 0; + while($res = $this->fetch_object()) + { + //var_dump($res); + if($last_level1 <> $res->doctypes_first_level_id) + { + array_push($level1, array('id' => $res->doctypes_first_level_id, 'label' => $this->show_string($res->doctypes_first_level_label), 'level2' => array(array('id' => $res->doctypes_second_level_id, 'label' => $this->show_string($res->doctypes_second_level_label), 'types' => array(array('id' => $res->type_id, 'label' => $this->show_string($res->description))))))); + $last_level1 = $res->doctypes_first_level_id; + $nb_level1 ++; + $last_level2 = $res->doctypes_second_level_id; + $nb_level2 = 1; + } + elseif($last_level2 <> $res->doctypes_second_level_id) + { + array_push($level1[$nb_level1 -1]['level2'], array('id' => $res->doctypes_second_level_id, 'label' => $this->show_string($res->doctypes_second_level_label), 'types' => array(array('id' => $res->type_id, 'label' => $this->show_string($res->description))))); + $last_level2 = $res->doctypes_second_level_id; + $nb_level2 ++; + } + else + { + // echo 'test '.$nb_level2; + array_push($level1[$nb_level1 -1]['level2'][$nb_level2 -1]['types'], array('id' => $res->type_id, 'label' => $this->show_string($res->description))); + } + //$this->show_array($level1); + } + return $level1; + } +} +?> diff --git a/maarch_entreprise/trunk/class/class_usergroup_content.php b/maarch_entreprise/trunk/class/class_usergroup_content.php new file mode 100644 index 0000000000000000000000000000000000000000..34062e58d6c3cc95197b2f795d2d863ed3d01091 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_usergroup_content.php @@ -0,0 +1,159 @@ +<?php +/** +* Usergroup_content class +* +* Contains all the functions to manage groups and users +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 06/2006 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* +*/ + +/** +* Class usergroup_content : contains all the functions to manage the groups and users through session variables +* +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @package Maarch PeopleBox 1.0 +* @version 2.1 +*/ + +class usergroup_content extends dbquery +{ + /** + * Inits the session variables related to the user administration. + * + */ + public function init_session() + { + $_SESSION['m_admin']['users'] = array(); + $_SESSION['m_admin']['users']['UserId'] = ""; + $_SESSION['m_admin']['users']['pass'] = ""; + $_SESSION['m_admin']['users']['FirstName'] = ""; + $_SESSION['m_admin']['users']['LastName'] = ""; + $_SESSION['m_admin']['users']['Phone'] = ""; + $_SESSION['m_admin']['users']['Mail'] = ""; + $_SESSION['m_admin']['users']['Department'] = ""; + $_SESSION['m_admin']['users']['Enabled'] = ""; + $_SESSION['m_admin']['users']['groups'] = array(); + $_SESSION['m_admin']['users']['nbbelonginggroups'] = 0; + $_SESSION['m_admin']['init'] = false ; + } + + /** + * Removes the group on the tables passed in parameters for the user. + * + * @param array $tab + */ + public function remove_session($tab) + { + $tabtmp = array(); + for($i=0; $i < count($_SESSION['m_admin']['users']['groups']); $i++) + { + if( !in_array($_SESSION['m_admin']['users']['groups'][$i]['GROUP_ID'], $tab)) + { + array_push($tabtmp, $_SESSION['m_admin']['users']['groups'][$i]); + } + } + + $_SESSION['m_admin']['users']['groups'] = array(); + $_SESSION['m_admin']['users']['groups'] = $tabtmp; + + } + + /** + * No group is the primary group for the user. + * + */ + public function erase_primary_group_session() + { + for($i=0; $i < count($_SESSION['m_admin']['users']['groups']); $i++) + { + $_SESSION['m_admin']['users']['groups'][$i]["PRIMARY"] = 'N'; + } + + } + + /** + * Set the primary group for a user in the session variables. + * + * @param string $group_id group identifier + */ + public function set_primary_group_session($group_id) + { + for($i=0; $i < count($_SESSION['m_admin']['users']['groups']); $i++) + { + if ( $_SESSION['m_admin']['users']['groups'][$i]["GROUP_ID"] == $group_id) + { + $_SESSION['m_admin']['users']['groups'][$i]["PRIMARY"] = 'Y'; + break; + } + } + } + + /** + * Adds a group in the session variables related to the user administration + * + * @param string $group group identifier + * @param string $role role in the group (empty by default) + */ + public function add_usertmp_to_group_session($group, $role = "", $label) + { + $tab = array(); + $tab = array("USER_ID" => "", "GROUP_ID" => $group , "LABEL" => $this->show_string($label), "PRIMARY" => 'N', "ROLE" => $this->show_string($role) ); + array_push($_SESSION['m_admin']['users']['groups'], $tab); + + } + + /** + * Loads in the session variables the groups of the user passed in parameter + * + * @param string $user_id user identifier + */ + public function load_group_session($user_id) + { + + $this->connect(); + $this->query("select uc.user_id, uc.group_id, uc.primary_group, uc.role, u.group_desc from ".$_SESSION['tablename']['usergroup_content']." uc, ".$_SESSION['tablename']['usergroups']." u where uc.user_id = '".$user_id."' and uc.group_id = u.group_id"); + if($this->nb_result() == 0) + { + $_SESSION['m_admin']['users']['groups'] = array(); + } + else + { + $grouptab=array(); + while($res = $this->fetch_object()) + { + array_push($grouptab, array("USER_ID" => $res->user_id,"GROUP_ID" => $res->group_id, "LABEL" => $this->show_string($res->group_desc), "PRIMARY" => $res->primary_group, "ROLE" => $this->show_string($res->role) )); + } + $_SESSION['m_admin']['users']['groups'] = $grouptab; + $_SESSION['m_admin']['users']['nbbelonginggroups'] = count($grouptab); + + } + $_SESSION['m_admin']['load_group'] = false; + } + + /** + * Updates the database (usergroup_content table) with the session variables. + * + */ + public function load_db() + { + $this->connect(); + + $this->query("DELETE FROM ".$_SESSION['tablename']['usergroup_content'] ." where user_id = '".$_SESSION['m_admin']['users']['UserId']."'"); + //$this->show(); + + for($i=0; $i < count($_SESSION['m_admin']['users']['groups'] ); $i++) + { + $tmp_r = $this->protect_string_db($_SESSION['m_admin']['users']['groups'][0]['ROLE']); + $this->query("INSERT INTO ".$_SESSION['tablename']['usergroup_content']." VALUES ('".$_SESSION['m_admin']['users']['UserId']."', '".$_SESSION['m_admin']['users']['groups'][$i]['GROUP_ID']."', '".$_SESSION['m_admin']['users']['groups'][$i]['PRIMARY']."', '".$tmp_r."')"); + } + + } + +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/class/class_usergroups.php b/maarch_entreprise/trunk/class/class_usergroups.php new file mode 100644 index 0000000000000000000000000000000000000000..459738d33191c02c2c12fa39aadcd24dadcde3aa --- /dev/null +++ b/maarch_entreprise/trunk/class/class_usergroups.php @@ -0,0 +1,591 @@ +<?php +/** +* Usergroups class +* +* Contains all the functions to manage the groups +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 06/2006 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* +*/ + +/** +* Class usergroups: contains all the functions and forms to manage the usergroups +* +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @package Maarch PeopleBox 1.0 +* @version 2.1 +*/ + +class usergroups extends dbquery +{ + /** + * @access private + * @var integer + */ + private $the_start; + + /** + * Redefinition of the user object constructor : configure the SQL argument order by + */ + function __construct() + { + parent::__construct(); + // configure the sql argument order by + if(isset($_GET['start'])) + { + $this->the_start = strip_tags($_GET['start']); + } + else + { + $this->the_start = 0; + } + } + + /** + * Form for the management of the groups. + * + * @param string $mode administrator mode (modification, suspension, authorization, delete) + * @param string $id group identifier (empty by default) + */ + public function formgroups($mode,$id = "") + { + require_once($_SESSION['pathtocoreclass']."class_security.php"); + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + $sec = new security(); + $func = new functions(); + $core_tools = new core_tools(); + $state = true; + $tab = array(); + + if($mode == "up") + { + $_SESSION['m_admin']['mode'] = "up"; + if(empty($_SESSION['error'])) + { + $this->connect(); + $this->query("select * from ".$_SESSION['tablename']['usergroups']." where group_id = '".$id."' and enabled = 'Y'"); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _GROUP.' '._UNKNOWN; + $state = false; + } + else + { + $line = $this->fetch_object(); + $_SESSION['m_admin']['groups']['GroupId'] = $line->group_id; + $_SESSION['m_admin']['groups']['desc'] = $this->show_string($line->group_desc); + $this->query("select * from ".$_SESSION['tablename']['security']." where group_id = '".$id."'"); + $i=0; + while($line = $this->fetch_object()) + { + $_SESSION['m_admin']['groups']['security'][$i]['COLL_ID'] = $this->show_string($line->coll_id); + $_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE'] = $this->show_string($line->where_clause); + $i++; + } + } + + if (! isset($_SESSION['m_admin']['load_security']) || $_SESSION['m_admin']['load_security'] == true) + { + $sec->load_security_group($id); + $_SESSION['m_admin']['load_security'] = false ; + } + + if (! isset($_SESSION['m_admin']['load_services']) || $_SESSION['m_admin']['load_services'] == true) + { + $sec->load_services_group($id); + $_SESSION['m_admin']['load_services'] = false ; + } + } + } + elseif($mode == "add") + { + $_SESSION['m_admin']['mode'] = "add"; + if ($_SESSION['m_admin']['init']== true || !isset($_SESSION['m_admin']['init'] )) + { + $sec->init_session(); + } + } + + ?> + <h1><img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/manage_groupe_b.gif" alt="" /> + <?php + if($mode == "add") + { + echo _GROUP_ADDITION; + } + elseif($mode == "up") + { + echo _GROUP_MODIFICATION; + } + ?> + </h1> + + <?php + if($state == false) + { + echo "<br /><br /><br /><br />"._GROUP.' '._UNKNOWN."<br /><br /><br /><br />"; + } + else + { + ?> + <div id="inner_content" class="clearfix"> + <div id="group_box" class="bloc" style = "width:445px;" > + <?php + if($mode == "up") + { + ?> + <a href="javascript://" onclick="window.open('<?php echo $_SESSION['config']['businessappurl'];?>/admin/groups/liste_users.php?id=<?php echo $id;?>&admin=groups', '', 'scrollbars=yes,menubar=no,toolbar=no,resizable=yes,status=no,width=820,height=400')"><img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/membres_groupe_b.gif" alt="" /><i><?php echo _SEE_GROUP_MEMBERS;?></i></a><br/><br/> + <?php + } + ?> + <iframe name="group_form" id="group_form" class="frameform4" src="<?php echo $_SESSION['config']['businessappurl'].'admin/groups/groups_form.php';?>" frameborder="0" scrolling="auto"></iframe> + </div> + <form name="formgroup" method="post" class="forms" action="<?php if($mode == "up") { echo "admin/groups/group_up_db.php"; } elseif($mode == "add") { echo "admin/groups/group_add_db.php"; } ?>" > + <table border="0" align="center" width="540px"> + <tr> + <td width = "200px" align="right"> + <?php echo _GROUP; ?> : + </td> + <td align="left"> + <?php if($mode == "up") { echo $func->show($_SESSION['m_admin']['groups']['GroupId']); } ?> + <input name="GroupId" type="<?php if($mode == "up") { ?>hidden<?php } elseif($mode == "add") { ?>text<?php } ?>" id="GroupId" value="<?php echo $func->show($_SESSION['m_admin']['groups']['GroupId']); ?>" /> + <input type="hidden" name="id" value="<?php echo $id; ?>" /> + </td> + </tr> + <tr> + <td align="right"> + <?php echo _DESC; ?> : + </td> + <td align="left"> + <input name="desc" id="desc" class="text" type="text" value="<?php echo $_SESSION['m_admin']['groups']['desc']; ?>" /> + </td> + </tr> + </table> + <br><center><i><?php echo _AVAILABLE_SERVICES;?> :</i></center> + <?php + //$this->show_array($_SESSION['enabled_services']); + $enabled_services_sort_by_parent = array(); + $j=0; + for($i=0; $i<count($_SESSION['enabled_services']);$i++) + { + if( $_SESSION['enabled_services'][$i]['system'] == false) + { + if($_SESSION['enabled_services'][$i]['parent'] <> $_SESSION['enabled_services'][$i - 1]['parent']) + { + $j=0; + } + $enabled_services_sort_by_parent[$_SESSION['enabled_services'][$i]['parent']][$j] = $_SESSION['enabled_services'][$i]; + $j++; + } + } + //$this->show_array($enabled_services_sort_by_parent); + + $_SESSION['cpt']=0; + foreach(array_keys($enabled_services_sort_by_parent) as $value) + { + if($value == 'application') + { + $label = _APPS_COMMENT; + } + elseif($value == 'core') + { + $label = _CORE_COMMENT; + } + else + { + $label = $_SESSION['modules_loaded'][$value]['comment']; + } + //$this->show_array($enabled_services_sort_by_parent[$value]); + //echo $_SESSION['cpt']."<br>"; + + if(count($enabled_services_sort_by_parent[$value]) > 0) + { + ?> + + <h5 onclick="change(<?php echo $_SESSION['cpt'];?>)" id="h2<?php echo $_SESSION['cpt'];?>" class="categorie"> + <img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/plus.png" alt="" /> <b><?php echo $label ;?></b> + <span class="lb1-details"> </span> + </h5> + <br/> + <div class="desc block_light admin" id="desc<?php echo $_SESSION['cpt'];?>" style="display:none"> + <div class="ref-unit"> + <table> + <?php + for($i=0; $i<count($enabled_services_sort_by_parent[$value]); $i++) + { + if($enabled_services_sort_by_parent[$value][$i]['system'] == false) + { + ?> + <tr> + <td width="800px" align="right" title="<?php echo $enabled_services_sort_by_parent[$value][$i]['comment'];?>"> + <?php echo $enabled_services_sort_by_parent[$value][$i]['label'];?> <?php if( $enabled_services_sort_by_parent[$value][$i]['type'] == "admin") {?>(<?php echo _ADMIN;?>) <?php }elseif($enabled_services_sort_by_parent[$value][$i]['type'] == "menu"){?>(<?php echo _MENU;?>)<?php } ?> : + </td> + <td width="50px" align="left"> + <input type="checkbox" class="check" name="services[]" value="<?php echo $enabled_services_sort_by_parent[$value][$i]['id'];?>" <?php if(in_array($enabled_services_sort_by_parent[$value][$i]['id'],$_SESSION['m_admin']['groups']['services']) || $mode == "add"){ echo 'checked="checked"';}?> /> + </td> + </tr> + <?php + } + } + ?> + </table> + </div> + </div> + <?php } + + $_SESSION['cpt']++; + } + ?> + <p class="buttons"> + <?php + if($mode == "up") + { + ?> + <input id="groupbutton" type="submit" name="Submit" value="<?php echo _VALIDATE; ?>" class="button"/> + <?php + } + elseif($mode == "add") + { + ?> + <input type="submit" name="Submit" value="<?php echo _VALIDATE; ?>" class="button"/> + <?php + } + ?> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=groups&admin=groups';"/> + </p> + <p> </p> + <p> </p> + </form> + </div> + <?php + } + } + + /** + * Treats the information returned by the form of formgroups() + * + * @param string $mode administrator mode (modification, suspension, authorization, delete) + */ + public function groupsinfo($mode) + { + $func = new functions(); + + if($mode == "add") + { + $_SESSION['m_admin']['groups']['GroupId'] = $func->wash($_POST['GroupId'], "alphanum", _THE_GROUP, 'yes', 0, 32); + } + + if($mode == "up") + { + $_SESSION['m_admin']['groups']['GroupId'] = $func->wash($_POST['id'], "alphanum", _THE_GROUP, 'yes', 0, 32); + } + + if (isset($_POST['desc']) && !empty($_POST['desc'])) + { + $_SESSION['m_admin']['groups']['desc'] = $func->wash($_POST['desc'], "no", _GROUP_DESC, 'yes', 0, 255); + } + + if (count($_SESSION['m_admin']['groups']['security']) < 1 && count($_REQUEST['services']) < 1) + { + $func->add_error(_THE_GROUP.' '._NO_SECURITY_AND_NO_SERVICES, ""); + } + } + + /** + * Add ou modify groups in the database + * + * @param string $mode up or add + */ + public function addupgroups($mode) + { + // add ou modify users in the database + $this->groupsinfo($mode); + + if(!empty($_SESSION['error'])) + { + if($mode == "up") + { + if(!empty($_SESSION['m_admin']['groups']['GroupId'])) + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=group_up&id=".$_SESSION['m_admin']['groups']['GroupId']."&admin=groups"); + exit; + } + else + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=groups&admin=groups"); + exit; + } + } + elseif($mode == "add") + { + $_SESSION['m_admin']['load_group'] = false; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=group_add&admin=groups"); + exit; + } + } + else + { + $this->connect(); + if($mode == "add") + { + $this->query("select group_id from ".$_SESSION['tablename']['usergroups']." where group_id= '".$_SESSION['m_admin']['groups']['GroupId']."'"); + + if($this->nb_result() > 0) + { + $_SESSION['error'] = $_SESSION['m_admin']['groups']['GroupId']." "._ALREADY_EXISTS."<br />"; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=group_add&admin=groups"); + exit(); + } + else + { + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec = new security(); + $syntax = true; + $syntax = $sec->where_test(); + + if($syntax <> true) + { + $_SESSION['error'] .= " : "._SYNTAX_ERROR_WHERE_CLAUSE."." ; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=group_add&admin=groups"); + exit(); + } + else + { + $tmp = $this->protect_string_db($_SESSION['m_admin']['groups']['desc']); + $this->query("insert into ".$_SESSION['tablename']['usergroups']." (group_id , group_desc , enabled) values ('".$_SESSION['m_admin']['groups']['GroupId']."'," ." '".$tmp."','Y')"); + + $sec->load_db(); + $sec->load_services_db($_REQUEST['services'],$_SESSION['m_admin']['groups']['GroupId']); + + if($_SESSION['history']['usergroupsadd'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['usergroups'], $_SESSION['m_admin']['groups']['GroupId'],"ADD",_GROUP_ADDED." : ".$_SESSION['m_admin']['groups']['GroupId'], $_SESSION['config']['databasetype']); + } + $this->cleargroupinfos(); + $_SESSION['error'] = _GROUP_ADDED; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=groups&admin=groups"); + exit(); + } + } + } + elseif($mode == "up") + { + $this->query("UPDATE ".$_SESSION['tablename']['usergroups']." set group_desc = '".$this->protect_string_db($_SESSION['m_admin']['groups']['desc'])."' , administrator = '".$_SESSION['m_admin']['groups']['admin']."'," ." custom_right1 = '".$_SESSION['m_admin']['groups']['stagiaire']."', custom_right2 = '".$_SESSION['m_admin']['groups']['view']."', custom_right3 = '".$_SESSION['m_admin']['groups']['stats']."'" .", custom_right4 = '".$_SESSION['m_admin']['groups']['del']."' where group_id = '".$_SESSION['m_admin']['groups']['GroupId']."'"); + $tmp = $this->protect_string_db($_SESSION['m_admin']['groups']['desc']); + $this->query("UPDATE ".$_SESSION['tablename']['usergroups']." set group_desc = '".$this->protect_string_db($tmp)."' where group_id = '".$_SESSION['m_admin']['groups']['GroupId']."'"); + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec = new security(); + + if($sec->where_test() == false) + { + $_SESSION['error'] .= " : "._SYNTAX_ERROR_WHERE_CLAUSE."." ; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=group_up&admin=groups&id=".$_SESSION['m_admin']['groups']['GroupId']); + exit(); + } + else + { + $sec->load_db(); + $sec->load_services_db($_REQUEST['services'],$_SESSION['m_admin']['groups']['GroupId']); + if($_SESSION['history']['usergroupsup'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['usergroups'], $_SESSION['m_admin']['groups']['GroupId'],"UP",_GROUP_UPDATE." : ".$_SESSION['m_admin']['groups']['GroupId'], $_SESSION['config']['databasetype']); + } + + if($this->in_group($_SESSION['user']['UserId'], $_SESSION['m_admin']['groups']['GroupId']) ) + { + $_SESSION['user']['groups'] = array(); + $_SESSION['user']['security'] = array(); + //$sec->load_groups($_SESSION['user']['UserId']); + $tmp = $sec->load_groups($_SESSION['user']['UserId']); + $_SESSION['user']['groups'] = $tmp['groups']; + $_SESSION['user']['primarygroup'] = $tmp['primarygroup']; + + $tmp = $sec->load_security($_SESSION['user']['UserId']); + $_SESSION['user']['collections'] = $tmp['collections']; + $_SESSION['user']['security'] = $tmp['security']; + // $sec->load_security(); + $_SESSION['user']['services'] = $sec->load_user_services($_SESSION['user']['UserId']); + } + $this->cleargroupinfos(); + $_SESSION['error'] = _GROUP_UPDATED; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=groups&admin=groups"); + exit(); + } + } + } + } + + /** + * Tests if the user belong to the group + * + * @param string $user user identifier + * @param string $group group identifier + */ + public function in_group($user, $group) + { + $this->connect(); + $this->query("select user_id from ".$_SESSION['tablename']['usergroup_content']." where user_id ='".$user."' and group_id = '".$group."'"); + + if($this->nb_result() > 0) + { + return true; + } + else + { + return false; + } + } + + /** + * Clear the $_SESSION['m_admin']['groups'] variable + * + */ + private function cleargroupinfos() + { + // clear the users add or modification vars + /*$_SESSION['m_admin']['groups'] = array(); + $_SESSION['m_admin']['groups']['GroupId'] = ""; + $_SESSION['m_admin']['groups']['desc'] = ""; + $_SESSION['m_admin']['groups']['admin'] = ""; + $_SESSION['m_admin']['groups']['stagiaire'] = ""; + $_SESSION['m_admin']['groups']['view'] = ""; + $_SESSION['m_admin']['groups']['stats'] = ""; + $_SESSION['m_admin']['groups']['del'] = ""; + $_SESSION['m_admin']['groups']['security'] = array();*/ + unset($_SESSION['m_admin']); + + } + + /** + * Add ou modify groups in the database + * + * @param string $id group identifier + * @param string $mode up or add + */ + public function admingroup($id,$mode) + { + if(!empty($_SESSION['error'])) + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=groups&admin=groups"); + exit(); + } + else + { + $this->connect(); + + $this->query("select group_id from ".$_SESSION['tablename']['usergroups']." where group_id = '".$id."'"); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _GROUP.' '._UNKNWON; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=groups&admin=groups"); + exit; + } + else + { + //$info = $this->fetch_object(); + //$theuser = $info->LastName." ".$info->FirstName." (".$id.")"; + + if($mode == "allow") + { + $this->query("Update ".$_SESSION['tablename']['usergroups']." set enabled = 'Y' where group_id = '".$id."'"); + if($_SESSION['history']['usergroupsval'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['usergroups'], $id,"VAL",_GROUP_AUTORIZATION." : ".$id, $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _AUTORIZED_GROUP; + + if($this->in_group($_SESSION['user']['UserId'], $id)) + { + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $_SESSION['user']['groups'] = array(); + $_SESSION['user']['security'] = array(); + $sec = new security(); + $tmp = $sec->load_groups($_SESSION['user']['UserId']); + $_SESSION['user']['groups'] = $tmp['groups']; + $_SESSION['user']['primarygroup'] = $tmp['primarygroup']; + + $tmp = $sec->load_security($_SESSION['user']['UserId']); + $_SESSION['user']['collections'] = $tmp['collections']; + $_SESSION['user']['security'] = $tmp['security']; + } + + } + elseif($mode == "ban") + { + $this->query("Update ".$_SESSION['tablename']['usergroups']." set enabled = 'N' where group_id = '".$id."'"); + if($_SESSION['history']['usergroupsban'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['usergroups'], $id,"BAN",_GROUP_SUSPENSION." : ".$id, $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _SUSPENDED_GROUP; + + if($this->in_group($_SESSION['user']['UserId'], $id)) + { + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $_SESSION['user']['groups'] = array(); + $_SESSION['user']['security'] = array(); + $sec = new security(); + $tmp = $sec->load_groups($_SESSION['user']['UserId']); + $_SESSION['user']['groups'] = $tmp['groups']; + $_SESSION['user']['primarygroup'] = $tmp['primarygroup']; + + $tmp = $sec->load_security($_SESSION['user']['UserId']); + $_SESSION['user']['collections'] = $tmp['collections']; + $_SESSION['user']['security'] = $tmp['security']; + } + } + elseif($mode == "del" ) + { + $this->query("delete from ".$_SESSION['tablename']['usergroups']." where group_id = '".$id."'"); + $this->query("delete from ".$_SESSION['tablename']['usergroup_content']." where group_id = '".$id."'"); + $this->query("delete from ".$_SESSION['tablename']['security']." where group_id = '".$id."'"); + $this->query("delete from ".$_SESSION['tablename']['usergroup_services']." where group_id = '".$id."'"); + if($_SESSION['history']['usergroupsdel'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['usergroups'], $id,"DEL",_GROUP_DELETION." : ".$id, $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _DELETED_GROUP; + + if($this->in_group($_SESSION['user']['UserId'], $id)) + { + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $_SESSION['user']['groups'] = array(); + $_SESSION['user']['security'] = array(); + $sec = new security(); + $tmp = $sec->load_groups($_SESSION['user']['UserId']); + $_SESSION['user']['groups'] = $tmp['groups']; + $_SESSION['user']['primarygroup'] = $tmp['primarygroup']; + + $tmp = $sec->load_security($_SESSION['user']['UserId']); + $_SESSION['user']['collections'] = $tmp['collections']; + $_SESSION['user']['security'] = $tmp['security']; + + } + } + + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=groups&admin=groups"); + exit(); + } + } + } + +} + +?> diff --git a/maarch_entreprise/trunk/class/class_users.php b/maarch_entreprise/trunk/class/class_users.php new file mode 100644 index 0000000000000000000000000000000000000000..c366c688b323965f785fc3b595b6db2506a34497 --- /dev/null +++ b/maarch_entreprise/trunk/class/class_users.php @@ -0,0 +1,730 @@ +<?php +/** +* User Class +* +* Contains all the functions to manage users +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* +*/ + +/** +* Class users: Contains all the functions and forms to manage users +* +* @author Claire Figueras <dev@maarch.org> +* @license GPL +* @package Maarch PeopleBox 1.0 +* @version 2.1 +*/ + +class users extends dbquery +{ + /** + * @access private + * @var integer + */ + private $the_start; + + /** + * SQL argument orderby name + * @access private + * @var string + */ + private $orderby; + + /** + * SQL argument orderby + * @access private + * @var string + */ + private $sqlorderby; + + /** + * Redefinition of the user object constructor : configure the SQL argument order by + */ + function __construct() + { + parent::__construct(); + // configure the sql argument order by + if(isset($_GET['start'])) + { + $this->the_start = strip_tags($_GET['start']); + } + else + { + $this->the_start = 0; + } + + if(isset($_GET['order'])) + { + $this->orderby = strip_tags($_GET['order']); + } + else + { + $this->orderby = "nameasc"; + } + + $this->sqlorderby = ""; + + if($this->orderby == "nameasc") + { + $this->sqlorderby = "order by lastname asc"; + } + + if($this->orderby == "namedesc") + { + $this->sqlorderby = "order by lastname desc"; + } + + if($this->orderby == "userasc") + { + $this->sqlorderby = "order by user_id asc"; + } + + if($this->orderby == "userdesc") + { + $this->sqlorderby = "order by user_id desc"; + } + + if($this->orderby == "statusasc") + { + $this->sqlorderby = "order by status asc"; + } + + if($this->orderby == "statusdesc") + { + $this->sqlorderby = "order by status desc"; + } + + if($this->orderby == "mailasc") + { + $this->sqlorderby = "order by mail asc"; + } + + if($this->orderby == "maildesc") + { + $this->sqlorderby = "order by mail desc"; + } + } + + /** + * To allow administrator to admin users + * + * @param integer $id user identifier + * @param string $mode allow, ban or del + */ + public function adminuser($id,$mode) + { + // To allow administrator to admin users + if(!empty($_SESSION['error'])) + { + + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users&admin=users"); + exit(); + } + else + { + + $this->connect(); + + $this->query("select user_id, firstname, lastname from ".$_SESSION['tablename']['users']." where user_id = '".$id."'"); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _USER.' '._UNKNOWN; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users&admin=users"); + exit(); + } + else + { + $info = $this->fetch_object(); + $theuser = $this->show_string($info->LastName." ".$info->FirstName); + + if($mode == "allow") + { + $this->query("Update ".$_SESSION['tablename']['users']." set enabled = 'Y' where user_id = '".$id."'"); + if($_SESSION['history']['usersval'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + + $hist = new history(); + $hist->add($_SESSION['tablename']['users'], $id,"VAL",_USER_AUTORIZATION." ".$theuser, $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _AUTORIZED_USER; + + } + elseif($mode == "ban") + { + $this->query("Update ".$_SESSION['tablename']['users']." set enabled = 'N' where user_id = '".$id."'"); + if($_SESSION['history']['usersban'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + + $hist = new history(); + $hist->add($_SESSION['tablename']['users'], $id,"BAN",_USER_SUSPENSION." : ".$theuser, $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _SUSPENDED_USER; + } + elseif($mode == "del" ) + { + $this->query("delete from ".$_SESSION['tablename']['users']." where user_id = '".$id."'"); + if($_SESSION['history']['usersdel']) + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($_SESSION['tablename']['users'], $id,"DEL",_USER_DELETION." : ".$theuser, $_SESSION['config']['databasetype']); + } + $_SESSION['error'] = _DELETED_USER; + } + + // header("location: index.php?page=users&admin=users"); + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users&admin=users"); + exit(); + } + } + } + + /** + * Treats the information returned by the form of change_info_user(). + * + */ + public function user_modif() + { + //require_once("class_functions.php"); + //$this = new functions(); + $_SESSION['user']['FirstName'] = $this->wash($_POST['FirstName'], "no", _FIRSTNAME); + $_SESSION['user']['LastName'] = $this->wash($_POST['LastName'], "no", _LASTNAME); + $_SESSION['user']['pass1'] = $this->wash($_POST['pass1'], "no", _FIRST_PSW); + $_SESSION['user']['pass2'] = $this->wash($_POST['pass2'], "no", _SECOND_PSW); + + if($_SESSION['user']['pass1'] <> $_SESSION['user']['pass2']) + { + $this->add_error(_WRONG_SECOND_PSW, ''); + } + + if(isset($_POST['Phone']) && !empty($_POST['Phone'])) + { + $_SESSION['user']['Phone'] = $_POST['Phone']; + } + + if(isset($_POST['Fonction']) && !empty($_POST['Fonction'])) + { + $_SESSION['user']['Fonction'] = $_POST['Fonction']; + } + + if(isset($_POST['Department']) && !empty($_POST['Department'])) + { + $_SESSION['user']['department'] = $_POST['Department']; + } + + if(isset($_POST['Mail']) && !empty($_POST['Mail'])) + { + $_SESSION['user']['Mail'] = $_POST['Mail']; + } + if(empty($_SESSION['error'])) + { + $tmp_fn = $this->protect_string_db($_SESSION['user']['FirstName']); + $tmp_ln = $this->protect_string_db($_SESSION['user']['LastName']); + $tmp_dep = $this->protect_string_db($_SESSION['user']['department']); + $this->connect(); + $this->query("update ".$_SESSION['tablename']['users']." set password = '".md5($_SESSION['user']['pass1'])."', firstname = '".$_SESSION['user']['FirstName']."', lastname = '".$_SESSION['user']['LastName']."', phone = '".$_SESSION['user']['Phone']."', mail = '".$_SESSION['user']['Mail']."' , department = '".$_SESSION['user']['department']."' where user_id = '".$_SESSION['user']['UserId']."'"); + + + if($_SESSION['history']['usersup'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($_SESSION['tablename']['users'], $_SESSION['user']['UserId'],"UP",_USER_UPDATE." : ".$_SESSION['user']['LastName']." ".$_SESSION['user']['FirstName'], $_SESSION['config']['databasetype']); + } + + $_SESSION['error'] = _USER_UPDATED; + header("location: ".$_SESSION['config']['businessappurl']."index.php"); + exit(); + } + else + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=modify_user&admin=users"); + exit(); + } + } + + /** + * Form for the management of the current user. + * + */ + public function change_info_user() + { + require_once($_SESSION['pathtocoreclass'].'class_core_tools.php'); + $core_tools = new core_tools(); + ?> + <h1><img src="<?php echo $_SESSION['config']['img'];?>/picto_user_b.gif" alt="" /> <?php echo _MY_INFO; ?></h1> + + <div id="inner_content" class="clearfix"> + <div id="user_box" > + <div class="block"> + <h2 class="tit"><?php echo _USER_GROUPS_TITLE;?> : </h2> + <ul id="my_profil"> + <?php + $this->connect(); + $this->query("SELECT u.group_desc FROM ".$_SESSION['tablename']['usergroup_content']." uc, ".$_SESSION['tablename']['usergroups']." u + where uc.user_id ='".$_SESSION['user']['UserId']."' and uc.group_id = u.group_id order by u.group_desc"); + + if($this->nb_result() < 1) + { + echo _USER_BELONGS_NO_GROUP."."; + } + else + { + while($line = $this->fetch_object()) + { + + echo "<li>".$line->group_desc." </li>"; + } + } + ?> + </ul> + <?php if($core_tools->is_module_loaded("entities") ) + {?> + <h2 class="tit"><?php echo _USER_ENTITIES_TITLE;?> : </h2> + <ul id="my_profil"> + <?php + $this->query("SELECT e.entity_label FROM ".$_SESSION['tablename']['ent_users_entities']." ue, ".$_SESSION['tablename']['ent_entities']." e + where ue.user_id ='".$_SESSION['user']['UserId']."' and ue.entity_id = e.entity_id order by e.entity_label"); + + if($this->nb_result() < 1) + { + echo _USER_BELONGS_NO_ENTITY."."; + } + else + { + while($line = $this->fetch_object()) + { + + echo "<li>".$line->entity_label." </li>"; + } + } + ?> + </ul> + <?php }?> + </div> + <div class="block_end"> </div> + </div> + + <form name="frmuser" id="frmuser" method="post" action="admin/users/user_modif.php" class="forms addforms"> + <div class=""> + <p> + <label><?php echo _ID; ?> : </label> + <input name="UserId" type="text" id="UserId" value="<?php echo $_SESSION['user']['UserId']; ?>" readonly="readonly" /> + <input type="hidden" name="id" value="<?php echo $_SESSION['user']['UserId']; ?>" /> + </p> + <p> + <label for="pass1"><?php echo _PASSWORD; ?> : </label> + <input name="pass1" type="password" id="pass1" value="" /> + </p> + <p> + <label for="pass2"><?php echo _REENTER_PSW; ?> : </label> + <input name="pass2" type="password" id="pass2" value="" /> + </p> + <p> + <label for="LastName"><?php echo _LASTNAME; ?> : </label> + <input name="LastName" type="text" id="LastName" size="45" value="<?php echo $this->show_string($_SESSION['user']['LastName']); ?>" /> + </p> + <p> + <label for="FirstName"><?php echo _FIRSTNAME; ?> : </label> + <input name="FirstName" type="text" id="FirstName" size="45" value="<?php echo $this->show_string($_SESSION['user']['FirstName']); ?>" /> + </p> + <p> + <label for="Department"><?php echo _DEPARTMENT;?> : </label> + <input name="Department" id="Department" type="text" disabled size="45" value="<?php echo $this->show_string($_SESSION['user']['department']); ?>" /> + + </p> + + <p> + <label for="Phone"><?php echo _PHONE_NUMBER; ?> : </label> + <input name="Phone" type="text" id="Phone" value="<?php echo $_SESSION['user']['Phone']; ?>" /> + </p> + <p> + <label for="Mail"><?php echo _MAIL; ?> : </label> + <input name="Mail" type="text" id="Mail" size="45" value="<?php echo $_SESSION['user']['Mail']; ?>" /> + </p> + + <p class="buttons"> + <input type="submit" name="Submit" value="<?php echo _VALIDATE; ?>" class="button" /> + <input type="button" name="cancel" value="<?php echo _CANCEL; ?>" class="button" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php';" /> + </p> + </div> + + </form> + <div class="blank_space"></div> + <?php + + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + $core_tools = new core_tools; + echo $core_tools->execute_modules_services($_SESSION['modules_services'], 'modify_user.php', "include"); + ?> + </div> + + <?php + + } + + /** + * Form to add or modify users + * + * @param string $mode up or add + * @param integer $id user identifier, empty by default + */ + public function formuser($mode,$id = "") + { + require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_usergroup_content.php"); + // the form to add or modify users + $core = new core_tools(); + $state = true; + $ugc = new usergroup_content(); + + if(empty($_SESSION['error'])) + { + $this->connect(); + $this->query("select count(*) as total from ".$_SESSION['tablename']['usergroups']." where enabled ='Y'"); + $nb_total_1 = $this->fetch_object(); + $_SESSION['m_admin']['nbgroups'] = $nb_total_1->total; + } + if($mode == "up") + { + $_SESSION['m_admin']['mode'] = "up"; + if(empty($_SESSION['error'])) + { + $this->connect(); + $this->query("select * from ".$_SESSION['tablename']['users']." where user_id = '".$id."'"); + + if($this->nb_result() == 0) + { + $_SESSION['error'] = _USER.' '._UNKNOWN; + $state = false; + } + else + { + $line = $this->fetch_object(); + + $_SESSION['m_admin']['users']['UserId'] = $line->user_id; + $_SESSION['m_admin']['users']['FirstName'] = $this->show_string($line->firstname); + $_SESSION['m_admin']['users']['LastName'] = $this->show_string($line->lastname); + $_SESSION['m_admin']['users']['Phone'] = $line->phone; + $_SESSION['m_admin']['users']['Mail'] = $line->mail; + $_SESSION['m_admin']['users']['Department'] = $this->show_string($line->department); + $_SESSION['m_admin']['users']['Enabled'] = $line->enabled; + $_SESSION['m_admin']['users']['Status'] = $line->status; + } + + if (($_SESSION['m_admin']['load_group'] == true || ! isset($_SESSION['m_admin']['load_group'] )) && $_SESSION['m_admin']['users']['UserId'] <> "superadmin") + { + $ugc->load_group_session($_SESSION['m_admin']['users']['UserId']); + } + } + } + elseif($mode == "add" ) + { + $_SESSION['m_admin']['mode'] = "add"; + if ($_SESSION['m_admin']['init']== true || !isset($_SESSION['m_admin']['init'] )) + { + $ugc->init_session(); + } + } + + if($mode == "add") + { + echo '<h1><img src="'.$_SESSION['config']['img'].'/picto_user_b.gif" alt="" />'._USER_ADDITION.'</h1>'; + } + elseif($mode == "up") + { + echo '<h1><img src="'.$_SESSION['config']['img'].'/picto_user_b.gif" alt="" /> '._USER_MODIFICATION.'</h1>'; + } + $_SESSION['service_tag'] = 'user_init'; + echo $core->execute_modules_services($_SESSION['modules_services'], 'user_up_init', "include"); + $_SESSION['service_tag'] = 'formuser'; + echo $core->execute_modules_services($_SESSION['modules_services'], 'formuser', "include"); + + ?> + <div id="add_box"> + <p> + <?php if($_SESSION['m_admin']['users']['UserId'] <> "superadmin") + {?> + <iframe name="usergroups_content" id="usergroups_content" class="frameform2" src="<?php echo $_SESSION['config']['businessappurl'].'admin/users/ugc_form.php';?>" frameborder="0"></iframe> + <?php } ?> + </p> + </div> + <?php + if($state == false) + { + echo "<br /><br /><br /><br />"._USER.' '._UNKNOWN."<br /><br /><br /><br />"; + } + else + { + ?> + <form name="frmuser" id="frmuser" method="post" action="<?php if($mode == "up") { echo "admin/users/users_up_db.php"; } elseif($mode == "add") { echo "admin/users/users_add_db.php"; } ?>" class="forms addforms" style="width:300px"> + <p> + <label for="UserId"><?php echo _ID; ?> :</label> + <?php if($mode == "up") { echo $this->show_string($_SESSION['m_admin']['users']['UserId']); }else{ echo '<br/>'; } ?><input name="UserId" type="<?php if($mode == "up") { ?>hidden<?php } elseif($mode == "add") { ?>text<?php } ?>" id="UserId" value="<?php echo $this->show_string($_SESSION['m_admin']['users']['UserId']); ?>" /><span class="red_asterisk">*</span> + + <input type="hidden" name="id" id="id" value="<?php echo $id; ?>" /> + </p> + <p> + <label for="LastName"><?php echo _LASTNAME; ?> :</label><br/> + <input name="LastName" id="LastName" type="text" value="<?php echo $this->show_string($_SESSION['m_admin']['users']['LastName']); ?>" /><span class="red_asterisk">*</span> + </p> + <p> + <label for="FirstName"><?php echo _FIRSTNAME; ?> :</label><br/> + <input name="FirstName" id="FirstName" type="text" value="<?php echo $this->show_string($_SESSION['m_admin']['users']['FirstName']); ?>" /><span class="red_asterisk">*</span> + </p> + <?php + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + ?> + <p> + <label for="Phone"><?php echo _PHONE_NUMBER; ?> :</label><br/> + <input name="Phone" id="Phone" type="text" value="<?php echo $_SESSION['m_admin']['users']['Phone']; ?>" /> + </p> + <p> + <label for="Mail"><?php echo _MAIL; ?> :</label><br/> + <input name="Mail" id="Mail" type="text" value="<?php echo $_SESSION['m_admin']['users']['Mail']; ?>" /><span class="red_asterisk">*</span> + </p> + <p class="buttons"> + <?php + if($mode == "up") + { + ?> + + <input type="button" name="reset_pwd" value="<?php echo _RESET.' '._PASSWORD; ?>" class="button" onclick="window.open('admin/users/psw_changed.php', '', 'toolbar=no,status=yes,width=400,height=150,left=500,top=300,scrollbars=no,top=no,location=no,resize=yes,menubar=no')" /> + <?php + } + elseif($mode == "add") + { + ?> + + + <?php + } + ?><br/> + <input type="submit" name="Submit" value="<?php echo _VALIDATE; ?>" class="button"/> + <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=users&admin=users';"/> + </p> + </form> + <?php + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + $core_tools = new core_tools; + echo $core_tools->execute_modules_services($_SESSION['modules_services'], 'users_up.php', "include"); + ?> + </div> + + <?php + } + + } + + /** + * Return the user information in sessions vars + * + * @param string $mode add or up + */ + public function usersinfo($mode) + { + require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_usergroup_content.php"); + // return the user information in sessions vars + + if($mode == "add") + { + $_SESSION['m_admin']['users']['UserId'] = $this->wash($_POST['UserId'], "no", _THE_ID, 'yes', 0, 32); + $_SESSION['m_admin']['users']['pass'] = md5('maarch'); + + } + + if($mode == "up") + { + $_SESSION['m_admin']['users']['UserId'] = $this->wash($_POST['id'], "no", _THE_ID, 'yes', 0, 32); + } + + + $_SESSION['m_admin']['users']['FirstName'] = $this->wash($_POST['FirstName'], "no", _THE_FIRSTNAME, 'yes', 0, 255); + $_SESSION['m_admin']['users']['LastName'] = $this->wash($_POST['LastName'], "no", _THE_LASTNAME, 'yes', 0, 255); + + if(isset($_POST['Department']) && !empty($_POST['Department'])) + { + $_SESSION['m_admin']['users']['Department'] = $this->wash($_POST['Department'], "no", _DEPARTMENT, 'yes', 0, 50); + + } + + if(isset($_POST['Phone']) && !empty($_POST['Phone'])) + { + $_SESSION['m_admin']['users']['Phone'] = $this->wash($_POST['Phone'], "no", _PHONE, 'yes', 0, 15); + } + + if(isset($_POST['Mail']) && !empty($_POST['Mail'])) + { + $_SESSION['m_admin']['users']['Mail'] = $this->wash($_POST['Mail'], "no", _MAIL, 'yes', 0, 255); + } + + if($_SESSION['m_admin']['users']['UserId'] <> "superadmin") + { + $ugc = new usergroup_content(); + + $primary_set = false; + for($i=0; $i < count($_SESSION['m_admin']['users']['groups']);$i++) + { + if($_SESSION['m_admin']['users']['groups'][$i]['PRIMARY'] == 'Y') + { + $primary_set = true; + break; + } + } + + if ($primary_set == false) + { + $ugc->add_error(_NOTE2, ""); + } + } + + $_SESSION['service_tag'] = 'user_check'; + $core = new core_tools(); + echo $core->execute_modules_services($_SESSION['modules_services'], 'user_check', "include"); + } + + /** + * Add ou modify users in the database + * + * @param string $mode up or add + */ + public function addupusers($mode) + { + // add ou modify users in the database + $this->usersinfo($mode); + $core = new core_tools(); + if(!empty($_SESSION['error'])) + { + if($mode == "up") + { + if(!empty($_SESSION['m_admin']['users']['UserId'])) + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users_up&id=".$_SESSION['m_admin']['users']['UserId']."&admin=users"); + exit(); + } + else + { + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users&admin=users"); + exit(); + } + } + elseif($mode == "add") + { + $_SESSION['m_admin']['load_group'] = false; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users_add&admin=users"); + exit(); + } + } + else + { + $this->connect(); + + if($mode == "add") + { + $this->query("select user_id from ".$_SESSION['tablename']['users']." where user_Id = '".$_SESSION['m_admin']['users']['UserId']."'"); + + if($this->nb_result() > 0) + { + $_SESSION['error'] = _THE_USER." ".$_SESSION['m_admin']['users']['UserId']." "._ALREADY_EXISTS."<br />"; + + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users_add&admin=users"); + exit(); + } + else + { + $cookie_date = ''; + //if($_SESSION['config']['databasetype'] == "POSTGRESQL" || $_SESSION['config']['databasetype'] == "MYSQL") + //{ + $cookie_date = 'NULL'; + //} + $tmp_fn = $this->protect_string_db($_SESSION['m_admin']['users']['FirstName']); + $tmp_ln = $this->protect_string_db($_SESSION['m_admin']['users']['LastName']); + $tmp_dep = $this->protect_string_db($_SESSION['m_admin']['users']['Department']); + + $this->query("INSERT INTO ".$_SESSION['tablename']['users']." ( user_id , password , firstname , lastname , phone , mail , department , cookie_key , cookie_date , enabled ) values ( '".$_SESSION['m_admin']['users']['UserId']."', '".$_SESSION['m_admin']['users']['pass']."', '".$tmp_fn."', '".$tmp_ln."', '".$_SESSION['m_admin']['users']['Phone']."', '".$_SESSION['m_admin']['users']['Mail']."', '".$tmp_dep."', '', ".$cookie_date.", 'Y')"); + + + require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_usergroup_content.php"); + $ugc=new usergroup_content(); + $ugc->load_db(); + + if($_SESSION['history']['usersadd'] == "true") + { + $tmp_h = $this->protect_string_db(_USER_ADDED." : ".$_SESSION['m_admin']['users']['LastName']." ".$_SESSION['m_admin']['users']['FirstName']); + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $hist = new history(); + $hist->add($_SESSION['tablename']['users'], $_SESSION['m_admin']['users']['UserId'],"ADD",$tmp_h, $_SESSION['config']['databasetype']); + } + $_SESSION['service_tag'] = 'users_add_db'; + echo $core->execute_modules_services($_SESSION['modules_services'], 'users_add_db.php', "include"); + $this->clearuserinfos(); + + $_SESSION['error'] = _USER_ADDED; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users&admin=users"); + exit(); + } + } + elseif($mode == "up") + { + $tmp_fn = $this->protect_string_db($_SESSION['m_admin']['users']['FirstName']); + $tmp_ln = $this->protect_string_db($_SESSION['m_admin']['users']['LastName']); + $tmp_dep = $this->protect_string_db($_SESSION['m_admin']['users']['Department']); + $this->query("update ".$_SESSION['tablename']['users']." set firstname = '".$tmp_fn."', lastname = '".$tmp_ln."', phone = '".$_SESSION['m_admin']['users']['Phone']."', mail = '".$_SESSION['m_admin']['users']['Mail']."' , department = '".$tmp_dep."' where user_id = '".$_SESSION['m_admin']['users']['UserId']."'"); + + if($_SESSION['m_admin']['users']['UserId'] <> "superadmin") + { + require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_usergroup_content.php"); + $ugc=new usergroup_content(); + $ugc->load_db(); + } + if($_SESSION['history']['usersup'] == "true") + { + $tmp_h = $this->protect_string_db(_USER_UPDATE." : ".$_SESSION['m_admin']['users']['LastName']." ".$_SESSION['m_admin']['users']['FirstName']." (".$_SESSION['m_admin']['users']['UserId'].")"); + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($_SESSION['tablename']['users'], $_SESSION['m_admin']['users']['UserId'],"UP",$tmp_h, $_SESSION['config']['databasetype']); + } + + if( $_SESSION['m_admin']['users']['UserId'] == $_SESSION['user']['UserId'] && $_SESSION['user']['UserId'] <> "superadmin" ) + { + $_SESSION['user']['groups'] = array(); + $_SESSION['user']['security'] = array(); + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec = new security(); + $tmp = $sec->load_groups($_SESSION['user']['UserId']); + $_SESSION['user']['groups'] = $tmp['groups']; + $_SESSION['user']['primarygroup'] = $tmp['primarygroup']; + + $tmp = $sec->load_security($_SESSION['user']['UserId']); + $_SESSION['user']['collections'] = $tmp['collections']; + $_SESSION['user']['security'] = $tmp['security']; + } + $_SESSION['service_tag'] = 'users_up_db'; + echo $core->execute_modules_services($_SESSION['modules_services'], 'users_up_db.php', "include"); + $this->clearuserinfos(); + + $_SESSION['error'] = _USER_UPDATED; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users&admin=users"); + exit(); + } + } + } + + /** + * Clear the users add or modification vars + */ + private function clearuserinfos() + { + // clear the users add or modification vars + unset($_SESSION['m_admin']); + } +} +?> diff --git a/maarch_entreprise/trunk/class/ws.php b/maarch_entreprise/trunk/class/ws.php new file mode 100644 index 0000000000000000000000000000000000000000..9dd467b7194d734cb58d8d252853fc4b92233104 --- /dev/null +++ b/maarch_entreprise/trunk/class/ws.php @@ -0,0 +1,17 @@ +<?php +global $SOAP_dispatch_map; +global $XMLRPC_dispatch_map; +global $SOAP_typedef; + +$XMLRPC_dispatch_map['sendDocumentForECA'] = Array( + 'function' => 'sendDocument', + 'signature' => Array(Array('integer', 'string', 'base64')), + 'docstring' => 'Send a Maarch document'); +$SOAP_dispatch_map['sendDocumentForECA'] = Array( + 'in' => Array('gedId' => 'integer', 'tableName' => 'string'), + 'out' => Array('out' => 'array') + ); +function sendDocumentForECA($gedId, $tableName){ + return sendDocument($gedId, $tableName); +} +?> diff --git a/maarch_entreprise/trunk/contact_info.php b/maarch_entreprise/trunk/contact_info.php new file mode 100644 index 0000000000000000000000000000000000000000..d90a30da6276fcda2367a6e5adba5b5153d20e08 --- /dev/null +++ b/maarch_entreprise/trunk/contact_info.php @@ -0,0 +1,353 @@ +<? +/** +* File : contact_info.php +* +* Pop up used to view info of a contact +* +* @package Maarch Framework 3.0 +* @version 3.0 +* @since 10/2005 +* @license GPL +* @author Laurent Giovannoni <dev@maarch.org> +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_business_app_tools.php"); +$core_tools = new core_tools(); +$business = new business_app_tools(); +$core_tools->load_lang(); +$core_tools->load_html(); +$core_tools->load_header(); +$func = new functions(); +$db = new dbquery(); +$db->connect(); +$tmp = $business->get_titles(); +$titles = $tmp['titles']; +$default_title = $tmp['default_title']; +if($_REQUEST['id'] == "" && $_REQUEST['mode'] == 'view') +{ + echo '<script type="text/javascript">window.resizeTo(300, 150);</script>'; + echo '<br/><br/><center>'._YOU_MUST_SELECT_CONTACT.'</center><br/><br/><div align="center"> + <input name="close" type="button" value="'._CLOSE.'" onclick="self.close();" class="button" /> + </div>'; + exit(); +} +if(!empty($_REQUEST['submit'])) +{ + $contact['IS_CORPORATE_PERSON'] = $_REQUEST['is_corporate']; + if($contact['IS_CORPORATE_PERSON'] == 'Y') + { + $contact['SOCIETY'] = $func->wash($_REQUEST['society'], "no", _SOCIETY." "); + $contact['LASTNAME'] = ''; + } + else + { + $contact['LASTNAME'] = $func->wash($_REQUEST['lastname'], "no", _LASTNAME); + if ($_REQUEST['society'] <> '') + { + $contact['SOCIETY'] = $func->wash($_REQUEST['society'], "no", _SOCIETY." "); + } + else + { + $contact['SOCIETY'] = ''; + } + } + if ($_REQUEST['title'] <> '') + { + $contact['TITLE'] = $func->wash($_REQUEST['title'], "no", _TITLE2." "); + } + else + { + $contact['TITLE'] = ''; + } + if ($_REQUEST['firstname'] <> '') + { + $contact['FIRSTNAME'] = $func->wash($_REQUEST['firstname'], "no", _FIRSTNAME." "); + } + else + { + $contact['FIRSTNAME'] = ''; + } + if ($_REQUEST['function'] <> '') + { + $contact['FUNCTION'] = $func->wash($_REQUEST['function'], "no", _FUNCTION." "); + } + else + { + $contact['FUNCTION'] = ''; + } + if ($_REQUEST['num'] <> '') + { + $contact['ADD_NUM'] = $func->wash($_REQUEST['num'], "no", _NUM." "); + } + else + { + $contact['ADD_NUM'] = ''; + } + if ($_REQUEST['street'] <> '') + { + $contact['ADD_STREET'] = $func->wash($_REQUEST['street'], "no", _STREET." "); + } + else + { + $contact['ADD_STREET'] = ''; + } + if ($_REQUEST['add_comp'] <> '') + { + $contact['ADD_COMP'] = $func->wash($_REQUEST['add_comp'], "no", ADD_COMP." "); + } + else + { + $contact['ADD_COMP'] = ''; + } + if ($_REQUEST['town'] <> '') + { + $contact['ADD_TOWN'] = $func->wash($_REQUEST['town'], "no", _TOWN." "); + } + else + { + $contact['ADD_TOWN'] = ''; + } + if ($_REQUEST['cp'] <> '') + { + $contact['ADD_CP'] = $func->wash($_REQUEST['cp'], "no", _POSTAL_CODE); + } + else + { + $contact['ADD_CP'] = ''; + } + if ($_REQUEST['country'] <> '') + { + $contact['ADD_COUNTRY'] = $func->wash($_REQUEST['country'], "no", _COUNTRY); + } + else + { + $contact['ADD_COUNTRY'] = ''; + } + if ($_REQUEST['phone'] <> '') + { + $contact['PHONE'] = $func->wash($_REQUEST['phone'], "num", _PHONE); + } + else + { + $contact['PHONE'] = ''; + } + if ($_REQUEST['mail'] <> '') + { + $contact['MAIL'] = $func->wash($_REQUEST['mail'], "mail", _MAIL); + } + else + { + $contact['MAIL'] = ''; + } + if ($_REQUEST['comp_data'] <> '') + { + $contact['OTHER_DATA'] = $func->wash($_REQUEST['comp_data'], "no", _COMP_DATA); + } + else + { + $contact['OTHER_DATA'] = ''; + } + if(!empty($_SESSION['error'])) + { + //error + } + else + { + if($contact['IS_CORPORATE_PERSON'] == 'Y') + { + $db->query("INSERT INTO ".$_SESSION['tablename']['contacts']." (society, phone, email, address_num, address_street, address_complement, address_town, address_postal_code, address_country, other_data, is_corporate_person, user_id) values ('".$func->protect_string_db($contact['SOCIETY'])."', '".$func->protect_string_db($contact['PHONE'])."', '".$func->protect_string_db($contact['MAIL'])."', '".$func->protect_string_db($contact['ADD_NUM'])."','".$func->protect_string_db($contact['ADD_STREET'])."', '".$func->protect_string_db($contact['ADD_COMP'])."', '".$func->protect_string_db($contact['ADD_TOWN'])."', '".$func->protect_string_db($contact['ADD_CP'])."', '".$func->protect_string_db($contact['ADD_COUNTRY'])."', '".$func->protect_string_db($contact['OTHER_DATA'])."', '".$func->protect_string_db($contact['IS_CORPORATE_PERSON'])."', '".$func->protect_string_db($_SESSION['user']['UserId'])."')"); + } + else + { + $db->query("INSERT INTO ".$_SESSION['tablename']['contacts']." (lastname , firstname , society , function , phone , email , address_num, address_street, address_complement, address_town, address_postal_code, address_country, other_data, title, is_corporate_person, user_id) values ('".$func->protect_string_db($contact['LASTNAME'])."', '".$func->protect_string_db($contact['FIRSTNAME'])."', '".$func->protect_string_db($contact['SOCIETY'])."', '".$func->protect_string_db($contact['FUNCTION'])."', '".$func->protect_string_db($contact['PHONE'])."', '".$func->protect_string_db($contact['MAIL'])."', '".$func->protect_string_db($contact['ADD_NUM'])."','".$func->protect_string_db($contact['ADD_STREET'])."', '".$func->protect_string_db($contact['ADD_COMP'])."', '".$func->protect_string_db($contact['ADD_TOWN'])."', '".$func->protect_string_db($contact['ADD_CP'])."','".$func->protect_string_db($contact['ADD_COUNTRY'])."','".$func->protect_string_db($contact['OTHER_DATA'])."','".$func->protect_string_db($contact['TITLE'])."','".$func->protect_string_db($contact['IS_CORPORATE_PERSON'])."','".$func->protect_string_db($_SESSION['user']['UserId'])."')"); + } + + if($contact['IS_CORPORATE_PERSON'] == 'N') + { + $db->query("select contact_id, lastname, firstname, society from ".$_SESSION['tablename']['contacts']." where lastname = '".$func->protect_string_db($contact['LASTNAME'])."' and enabled = 'Y' order by contact_id desc"); + $res = $db->fetch_object(); + if(empty($res->society)) + { + $value_contact = $res->lastname.', '.$res->firstname.' ('.$res->contact_id.')'; + } + else + { + $value_contact = $res->society.', '.$res->lastname.' '.$res->firstname.' ('.$res->contact_id.')'; + } + } + else + { + $db->query("select contact_id, society from ".$_SESSION['tablename']['contacts']." where society = '".$func->protect_string_db($contact['SOCIETY'])."' and enabled = 'Y' order by contact_id desc"); + $res = $db->fetch_object(); + $value_contact = $res->society.' ('.$res->contact_id.')'; + } + ?> + <script type="text/javascript"> + var contact = window.opener.$('contact'); + if(contact) + { + contact.value = '<?php echo $value_contact;?>'; + window.opener.$('contact_card').style.visiblity = 'visible'; + } + self.close(); + </script> + <?php + exit(); + } +} + +$readonly = true; +if($_REQUEST['mode']== 'view') +{ + $readonly = true; + $db->query("select * from ".$_SESSION['tablename']['contacts']." where contact_id = ".$_REQUEST['id']." "); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _THE_CONTACT.' '._NOT_EXISTS; + $state = false; + } + else + { + $contact_info = array(); + $line = $db->fetch_object(); + $contact_info['ID'] = $line->contact_id; + $contact_info['TITLE'] = $line->title; + $contact_info['TITLE_LABEL'] = $business->get_label_title($line->title); + $contact_info['LASTNAME'] = $func->show_string($line->lastname); + $contact_info['FIRSTNAME'] = $func->show_string($line->firstname); + $contact_info['SOCIETY'] = $func->show_string($line->society); + $contact_info['FUNCTION'] = $func->show_string($line->function); + $contact_info['ADD_NUM'] = $func->show_string($line->address_num); + $contact_info['ADD_STREET'] = $func->show_string($line->address_street); + $contact_info['ADD_COMP'] = $func->show_string($line->address_complement); + $contact_info['ADD_TOWN'] = $func->show_string($line->address_town); + $contact_info['ADD_CP'] = $func->show_string($line->address_postal_code); + $contact_info['ADD_COUNTRY'] = $func->show_string($line->address_country); + $contact_info['PHONE'] = $func->show_string($line->phone); + $contact_info['MAIL'] = $func->show_string($line->email); + $contact_info['OTHER_DATA'] = $func->show_string($line->other_data); + $contact_info['IS_CORPORATE_PERSON'] = $func->show_string($line->is_corporate_person); + } +} +else if($_REQUEST['mode'] == 'add') +{ + $readonly = false; + $contact_info['IS_CORPORATE_PERSON'] == 'Y'; +} +?> +<script type="text/javascript">window.resizeTo(510, 555);</script> +<br/> + +<div id="contacts" style="padding-left: 20px;"> + <h2 align="center"><img src="<?php echo $_SESSION['config']['businessappurl'];?>img/account_off.gif" alt="<?php echo _CONTACT_INFO;?>" /> <?php echo _CONTACT_INFO;?></h2> <br/> + <form name="frmcontact" id="frmcontact" method="post" action="<?php echo $_SESSION['config']['businessappurl'];?>contact_info.php" class="forms addforms"> + <p> + <label for="is_corporate"><?php echo _IS_CORPORATE_PERSON; ?> : </label> + <?php if($readonly){ + if($contact_info['IS_CORPORATE_PERSON'] == 'Y'){echo _YES;}else{echo _NO;} + } + else + {?> + <input type="radio" class="check" name="is_corporate" value="Y" <? if($contact_info['IS_CORPORATE_PERSON'] == 'Y'){?> checked="checked"<? }elseif(empty($contact['IS_CORPORATE_PERSON'])){ ?> checked="checked"<? } ?> onclick="javascript:show_admin_contacts(true);"/><? echo _YES;?> + <input type="radio" class="check" name="is_corporate" value="N" <? if($contact_info['IS_CORPORATE_PERSON'] == 'N'){?> checked="checked"<? } ?> onclick="javascript:show_admin_contacts( false);"/><? echo _NO; + }?> + </p> + <p id="title_p" style="display:<?php if($contact_info['IS_CORPORATE_PERSON'] == 'Y'){ echo 'none';}else{ echo 'block';}?>"> + <label for="title"><?php echo _TITLE2; ?> : </label> + <?php if($readonly) + { + + ?><input name="title" type="text" id="title" value="<?php echo $func->show($contact_info['TITLE_LABEL']); ?>" readonly="readonly"/><? + } + else + {?> + <select name="title" id="title"> + <option value=""><?php echo _CHOOSE_TITLE;?></option> + <?php foreach(array_keys($titles) as $key) + { + ?><option value="<?php echo $key;?>" <?php if($key == $default_title){ echo 'selected="selected"';}?>><?php echo $titles[$key];?></option><?php + }?> + </select> + <?php }?> + + </p> + <p id="lastname_p" style="display:<?php if($contact_info['IS_CORPORATE_PERSON'] == 'Y'){ echo 'none';}else{ echo 'block';}?>"> + <label for="label"><?php echo _LASTNAME; ?> : </label> + <input name="lastname" type="text" id="lastname" value="<?php echo $func->show($contact_info['LASTNAME']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?> /> <?php if(!$readonly){?><span class="red_asterisk" id="lastname_mandatory" style="display:none;">*</span><?php } ?> + </p> + <p id="firstname_p" style="display:<?php if($contact_info['IS_CORPORATE_PERSON'] == 'Y'){ echo 'none';}else{ echo 'block';}?>"> + <label for="label"><?php echo _FIRSTNAME; ?> : </label> + <input name="firstname" type="text" id="firstname" value="<?php echo $func->show($contact_info['FIRSTNAME']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p > + <label for="label"><?php echo _SOCIETY; ?> : </label> + <input name="society" type="text" id="society" value="<?php echo $func->show($contact_info['SOCIETY']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> <?php if(!$readonly){?><span class="red_asterisk" id="society_mandatory" style="display:inline;">*</span><?php } ?> + </p> + <p id="function_p" style="display:<?php if($contact_info['IS_CORPORATE_PERSON'] == 'Y'){ echo 'none';}else{ echo 'block';}?>"> + <label for="label"><?php echo _FUNCTION; ?> : </label> + <input name="function" type="text" id="function" value="<?php echo $func->show($contact_info['FUNCTION']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p> + <label for="label"><?php echo _PHONE; ?> : </label> + <input name="phone" type="text" id="phone" value="<?php echo $func->show($contact_info['PHONE']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p> + <label for="label"><?php echo _MAIL; ?> : </label> + <input name="mail" type="text" id="mail" value="<?php echo $func->show($contact_info['MAIL']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p > + <label><b><?php echo _ADDRESS;?> </b></label> + </p> + <br/> + <p> + <label for="label"><?php echo _NUM; ?> : </label> + <input name="num" type="text" id="num" value="<?php echo $func->show($contact_info['ADD_NUM']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p> + <label for="label"><?php echo _STREET; ?> : </label> + <input name="street" type="text" id="street" value="<?php echo $func->show($contact_info['ADD_STREET']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p> + <label for="label"><?php echo _COMPLEMENT; ?> : </label> + <input name="add_comp" type="text" id="add_comp" value="<?php echo $func->show($contact_info['ADD_COMP']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p> + <label for="label"><?php echo _TOWN; ?> : </label> + <input name="town" type="text" id="town" value="<?php echo $func->show($contact_info['ADD_TOWN']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p> + <label for="label"><?php echo _POSTAL_CODE; ?> : </label> + <input name="cp" type="text" id="cp" value="<?php echo $func->show($contact_info['ADD_CP']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p> + <label for="label"><?php echo _COUNTRY; ?> : </label> + <input name="country" type="text" id="country" value="<?php echo $func->show($contact_info['ADD_COUNTRY']); ?>" <?php if($readonly){ echo 'readonly="readonly"';}?>/> + </p> + <p><label><b><?php echo _COMP;?> </b></label></p> + <br/> + <p> + <label for="label"><?php echo _COMP_DATA; ?> </label> + <textarea name="comp_data" id="comp_data" <?php if($readonly){ echo 'readonly="readonly"';}?>><?php echo $func->show($contact_info['OTHER_DATA']); ?></textarea> + </p> + <p class="buttons"> + <?php if(!$readonly) + { ?> + <input name="submit" type="submit" value="<?php echo _VALIDATE;?>" class="button" /> + <?php } ?> + <input name="close" type="button" value="<?php echo _CLOSE;?>" onclick="self.close();" class="button" /> + </p> + </form > +</div> +<?php if(!$readonly) +{ + ?> + <script type="text/javascript">show_admin_contacts( true);</script> + <?php +}?> +</body> +</html> diff --git a/maarch_entreprise/trunk/contact_list_by_name.php b/maarch_entreprise/trunk/contact_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..41a9293d54d44b9f9b3c86e3f48250a2d4f6bc34 --- /dev/null +++ b/maarch_entreprise/trunk/contact_list_by_name.php @@ -0,0 +1,88 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of users for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +$listArray = array(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select lastname, firstname, user_id from ".$_SESSION['tablename']['users']." where lastname ilike '".$db->protect_string_db($_REQUEST['what'])."%' order by lastname"); +} +else +{ + $db->query("select lastname, firstname, user_id from ".$_SESSION['tablename']['users']." where lastname like '".$db->protect_string_db($_REQUEST['what'])."%' order by lastname"); +} +while($line = $db->fetch_object()) +{ + array_push($listArray, $db->show_string($line->lastname)." ".$db->show_string($line->firstname)." (user:".$line->user_id.")"); + //array_push($listArray, "user : [".$db->show_string($line->lastname)." ".$db->show_string($line->firstname))."]"; +} +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select is_corporate_person, society, lastname, firstname, contact_id from ".$_SESSION['tablename']['contacts']." where (lastname ilike '".$db->protect_string_db($_REQUEST['what'])."%' or firstname ilike '".$db->protect_string_db($_REQUEST['what'])."%' or society ilike '".$db->protect_string_db($_REQUEST['what'])."%') "); + //$db->show(); +} +else +{ + $db->query("select is_corporate_person, society, lastname, firstname, contact_id from ".$_SESSION['tablename']['contacts']." where (lastname like '".$db->protect_string_db($_REQUEST['what'])."%' or firstname like '".$db->protect_string_db($_REQUEST['what'])."%' or society like '".$db->protect_string_db($_REQUEST['what'])."%') "); +} +while($line = $db->fetch_object()) +{ + if($line->is_corporate_person == "Y") + { + array_push($listArray, $db->show_string($line->society)." ".$db->show_string($line->lastname)." ".$db->show_string($line->firstname)." (contact:".$line->contact_id.")"); + } + else + { + array_push($listArray, $db->show_string($line->lastname)." ".$db->show_string($line->firstname)." (contact:".$line->contact_id.")"); + } +} +echo "<ul>\n"; +$authViewList = 0; +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; +} +echo "</ul>"; diff --git a/maarch_entreprise/trunk/contract_history.php b/maarch_entreprise/trunk/contract_history.php new file mode 100644 index 0000000000000000000000000000000000000000..cf9ba4c1f7635e045906f1e0d5cc64b261be1c38 --- /dev/null +++ b/maarch_entreprise/trunk/contract_history.php @@ -0,0 +1,75 @@ +<?php +/** +* File : contract_history.php +* +* Frame to show the contract history of a folder (used in salary_sheet) +* +* @package Maarch PeopleBox 1.0 +* @version 1.0 +* @since 06/2007 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ + session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); + require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_service('show_contract_history', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtomodules']."folder".$_SESSION['slash_env']."class".$_SESSION['slash_env']."class_modules_tools.php"); +$func = new functions(); +$hist = array(); + + if(isset($_SESSION['current_folder_id']) && !empty($_SESSION['current_folder_id'])) +{ + $folder = new folder(); + $folder->load_folder1($_SESSION['current_folder_id'],$_SESSION['tablename']['fold_folders'] ); + $hist = $folder->get_contract_history($_SESSION['tablename']['history'], $_SESSION['tablename']['fold_folders']); +} +$core_tools->load_html(); +//here we building the header +$core_tools->load_header( ); +?> + +<body id="contract_history_frame"> +<?php if(count($hist) < 1 && (empty($_SESSION['current_folder_id']) || !isset($_SESSION['current_folder_id']))) +{ + echo _PLEASE_SELECT_FOLDER."."; +} +else +{ + ?> + <table width="95%" class="listing" border="0" cellspacing="0"> + <?php + $color = ""; + for($i=0; $i < count($hist); $i++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + ?> + <tr<?php echo $color; ?>> + <td><?php echo $func->format_date_db($hist[$i]['DATE']); ?></td> + <td><?php echo $hist[$i]['EVENT']; ?></td> + </tr> + <?php + } + ?> + </table> + <?php +} +?> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/create_contact.php b/maarch_entreprise/trunk/create_contact.php new file mode 100644 index 0000000000000000000000000000000000000000..c60e3a233d22a091467d5e56c880b9b280530cfe --- /dev/null +++ b/maarch_entreprise/trunk/create_contact.php @@ -0,0 +1,168 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$func = new functions(); +$db = new dbquery(); +$contact = array(); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$contact['IS_CORPORATE_PERSON'] = $_REQUEST['is_corporate']; +if($contact['IS_CORPORATE_PERSON'] == 'Y') +{ + $contact['SOCIETY'] = $func->wash($_REQUEST['society'], "no", _SOCIETY." "); + $contact['LASTNAME'] = ''; +} +else +{ + $contact['LASTNAME'] = $func->wash($_REQUEST['lastname'], "no", _LASTNAME, 'yes', 0, 255); + if ($_REQUEST['society'] <> '') + { + $contact['SOCIETY'] = $func->wash($_REQUEST['society'], "no", _SOCIETY." ", 'yes', 0, 255); + } + else + { + $contact['SOCIETY'] = ''; + } +} +if ($_REQUEST['title'] <> '') +{ + $contact['TITLE'] = $func->wash($_REQUEST['title'], "no", _TITLE2." ", 'yes', 0, 255); +} +else +{ + $contact['TITLE'] = ''; +} +if ($_REQUEST['firstname'] <> '') +{ + $contact['FIRSTNAME'] = $func->wash($_REQUEST['firstname'], "no", _FIRSTNAME." ", 'yes', 0, 255); +} +else +{ + $contact['FIRSTNAME'] = ''; +} +if ($_REQUEST['func'] <> '') +{ + $contact['FUNCTION'] = $func->wash($_REQUEST['func'], "no", _FUNCTION." ", 'yes', 0, 255); +} +else +{ + $contact['FUNCTION'] = ''; +} +if ($_REQUEST['num'] <> '') +{ + $contact['ADD_NUM'] = $func->wash($_REQUEST['num'], "no", _NUM." ", 'yes', 0, 32); +} +else +{ + $contact['ADD_NUM'] = ''; +} +if ($_REQUEST['street'] <> '') +{ + $contact['ADD_STREET'] = $func->wash($_REQUEST['street'], "no", _STREET." ", 'yes', 0, 255); +} +else +{ + $contact['ADD_STREET'] = ''; +} +if ($_REQUEST['add_comp'] <> '') +{ + $contact['ADD_COMP'] = $func->wash($_REQUEST['add_comp'], "no", ADD_COMP." ", 'yes', 0, 255); +} +else +{ + $contact['ADD_COMP'] = ''; +} +if ($_REQUEST['town'] <> '') +{ + $contact['ADD_TOWN'] = $func->wash($_REQUEST['town'], "no", _TOWN." " , 'yes', 0, 255); +} +else +{ + $contact['ADD_TOWN'] = ''; +} +if ($_REQUEST['cp'] <> '') +{ + $contact['ADD_CP'] = $func->wash($_REQUEST['cp'], "no", _POSTAL_CODE, 'yes', 0, 255); +} +else +{ + $contact['ADD_CP'] = ''; +} +if ($_REQUEST['country'] <> '') +{ + $contact['ADD_COUNTRY'] = $func->wash($_REQUEST['country'], "no", _COUNTRY, 'yes', 0, 255); +} +else +{ + $contact['ADD_COUNTRY'] = ''; +} +if ($_REQUEST['phone'] <> '') +{ + $contact['PHONE'] = $func->wash(trim($_REQUEST['phone']), "num", _PHONE, 'yes', 0, 20); +} +else +{ + $contact['PHONE'] = ''; +} +if ($_REQUEST['mail'] <> '') +{ + $contact['MAIL'] = $func->wash($_REQUEST['mail'], "mail", _MAIL, 'yes', 0, 255); + +} +else +{ + $contact['MAIL'] = ''; +} +if ($_REQUEST['comp_data'] <> '') +{ + $contact['OTHER_DATA'] = $func->wash($_REQUEST['comp_data'], "no", _COMP_DATA); +} +else +{ + $contact['OTHER_DATA'] = ''; +} +if(!empty($_SESSION['error'])) +{ + echo "{status : 1, error_txt : '".addslashes($_SESSION['error'])."'}"; + $_SESSION['error'] = ''; + exit(); +} +else +{ + $db->connect(); + if($contact['IS_CORPORATE_PERSON'] == 'Y') + { + $db->query("INSERT INTO ".$_SESSION['tablename']['contacts']." (society, phone, email, address_num, address_street, address_complement, address_town, address_postal_code, address_country, other_data, is_corporate_person, user_id) values ('".$func->protect_string_db($contact['SOCIETY'])."', '".$func->protect_string_db($contact['PHONE'])."', '".$func->protect_string_db($contact['MAIL'])."', '".$func->protect_string_db($contact['ADD_NUM'])."','".$func->protect_string_db($contact['ADD_STREET'])."', '".$func->protect_string_db($contact['ADD_COMP'])."', '".$func->protect_string_db($contact['ADD_TOWN'])."', '".$func->protect_string_db($contact['ADD_CP'])."', '".$func->protect_string_db($contact['ADD_COUNTRY'])."', '".$func->protect_string_db($contact['OTHER_DATA'])."', '".$func->protect_string_db($contact['IS_CORPORATE_PERSON'])."', '".$func->protect_string_db($_SESSION['user']['UserId'])."')"); + } + else + { + $db->query("INSERT INTO ".$_SESSION['tablename']['contacts']." (lastname , firstname , society , function , phone , email , address_num, address_street, address_complement, address_town, address_postal_code, address_country, other_data, title, is_corporate_person, user_id) values ('".$func->protect_string_db($contact['LASTNAME'])."', '".$func->protect_string_db($contact['FIRSTNAME'])."', '".$func->protect_string_db($contact['SOCIETY'])."', '".$func->protect_string_db($contact['FUNCTION'])."', '".$func->protect_string_db($contact['PHONE'])."', '".$func->protect_string_db($contact['MAIL'])."', '".$func->protect_string_db($contact['ADD_NUM'])."','".$func->protect_string_db($contact['ADD_STREET'])."', '".$func->protect_string_db($contact['ADD_COMP'])."', '".$func->protect_string_db($contact['ADD_TOWN'])."', '".$func->protect_string_db($contact['ADD_CP'])."','".$func->protect_string_db($contact['ADD_COUNTRY'])."','".$func->protect_string_db($contact['OTHER_DATA'])."','".$func->protect_string_db($contact['TITLE'])."','".$func->protect_string_db($contact['IS_CORPORATE_PERSON'])."','".$func->protect_string_db($_SESSION['user']['UserId'])."')"); + } + + if($contact['IS_CORPORATE_PERSON'] == 'N') + { + $db->query("select contact_id, lastname, firstname, society from ".$_SESSION['tablename']['contacts']." where lastname = '".$func->protect_string_db($contact['LASTNAME'])."' and enabled = 'Y' order by contact_id desc"); + $res = $db->fetch_object(); + if(empty($res->society)) + { + $value_contact = $res->lastname.', '.$res->firstname.' ('.$res->contact_id.')'; + } + else + { + $value_contact = $res->society.', '.$res->lastname.' '.$res->firstname.' ('.$res->contact_id.')'; + } + } + else + { + $db->query("select contact_id, society from ".$_SESSION['tablename']['contacts']." where society = '".$func->protect_string_db($contact['SOCIETY'])."' and enabled = 'Y' order by contact_id desc"); + $res = $db->fetch_object(); + $value_contact = $res->society.' ('.$res->contact_id.')'; + } + echo "{status : 0, value : '".addslashes($value_contact)."'}"; + exit(); +} +?> diff --git a/maarch_entreprise/trunk/css/style_ie.css b/maarch_entreprise/trunk/css/style_ie.css new file mode 100644 index 0000000000000000000000000000000000000000..7ed6a589dc1f0a35a3ca54704ffc1cad220878db --- /dev/null +++ b/maarch_entreprise/trunk/css/style_ie.css @@ -0,0 +1,242 @@ +.addforms { +width: 420px; +} + +input.small { + width: 17px; + +} + +#frmuser{ +width: 230px; +} + +#frmtype{ +width: 400px; +} + #indexation{ +width: 480px; +} + +input.button { + padding: 0.2em 0 0.2em 0.5em; +} + +.forms p.buttons { + /*margin-left: 41.7%;*/ + margin-left: 10%; +} +#frmuser p.buttons { + /*margin-left: 41.7%;*/ + margin-left: 0%; +} +#doctype { + height: 10em; +} + +#logo { + margin: 0 0 20px 10px; +} + +#help { + margin-top: 42px; + padding-bottom: 10px; +} + +#content h1 { + color: #16ADEB; + font-style: italic; + font-weight: bold; + font-size: 1.7em; + text-align: left; + letter-spacing: 0.1em; + height: 1.6em; + position: absolute; + padding: 0; + top: 29px; + left: 190px; +} + + +#content h1 img { + margin-top: .4em; +} + +#formlogin { + width: 275px; +} + +#formlogin input { + width: 128px; +} + +#formlogin .nota, #formlogin p.buttons { + margin-right: 12px; +} + +#formlogin select { + width: 134px; +} + +#post #content { + padding-top: 0; +} + +#post_indexing input.textbox { + width: 155px; +} + +#post_indexing input.small { + width: 17px; +} + +#post_indexing div label { + margin-right: 1px; +} + +#post_indexing div ul { + width: 30%; +} + +#post_indexing .buttons { + padding-right: 11px; +} + +#post #pdf iframe { + height: 665px; +} + +#titless { + margin-left: 5px; +} + + +#menunav { + padding: 0px; +} + +#menunav li { + float: left; + width: 220px; +} + +#menunav li ol { + margin-bottom: 6px; +} +#list .file li.on li { + background-image: url(../img/case_ins_on.gif); + background-position: top left; + padding: 4px 0 4px 35px; + margin-left: 5px; +} + +#list .file a.no_doc { +padding-left :0px; + background: none; + +} + + #group_box, #type_box{ + + width: 380px; + margin: 0 0 0 0; + padding: 10px 10px; + +} + +.frameform3 { + height: 400px; + width: 430px; + +} + +#loginpage { + margin-top: 30px; + +} + + +#summary { +padding-bottom: 150px; +} + + +#gestion_rep .listing +{ + width: 410px; + margin: 0px 0px 0 0px; +} +#gestion_rep .listing .file_name +{ + width: 100px; +} + +.form_desc +{ + text-align: right; + width: 45%; + float: right; + padding-right: 30px; + +} + +.listing .date { + width: 80px; + +} +/* +#validleft +{ + width: 47%; +} +#validright +{ + width: 48%; +}*/ +h2 +{ + font-size: 16px; +} + +#loginpage { + width: 300px; + height: 350px; + margin-left: -150px; + margin-top: 0px; + left: 50%; + top: 50%; + position: absolute; +} + + +input[type="checkbox"] , input[type="radio"], .check +{ + border: none; + width: 20px; +} +.forms .check, .check +{ + width: 20px; + border: none; +} + + a{ +color:#FFFFFF; + +} + + +.img_upload_doc +{ + position:absolute; + margin-left:0px; +} + +/* +#menunav li { + padding-left: 0px; + margin-bottom: 0px; +} +#menunav li.on { + padding-left: 0px; +}*/ diff --git a/maarch_entreprise/trunk/css/style_ie7.css b/maarch_entreprise/trunk/css/style_ie7.css new file mode 100644 index 0000000000000000000000000000000000000000..8c47183fc9d1dec93d16c5a90b5e901b7cdd754f --- /dev/null +++ b/maarch_entreprise/trunk/css/style_ie7.css @@ -0,0 +1,116 @@ + + +input.small { + width: 17px; +} + +input.button { + padding: 0.2em 0 0.2em 0.5em; +} + +#doctype { + height: 10em; +} + +#logo { + margin: 0 0 20px 10px; +} + +#help { + margin-top: 42px; + padding-bottom: 10px; +} + + +#content h1 { + height: 2.05em; + padding: 0; +} + + + +#formlogin { + width: 265px; +} + +#formlogin input { + width: 128px; +} + +#formlogin .nota, #formlogin p.buttons { + margin-right: 12px; +} + +#formlogin select { + width: 134px; +} + +#post #content { + padding-top: 0; +} + +#post_indexing input.textbox { + width: 155px; +} + +#post_indexing input.small { + width: 17px; +} + +#post_indexing div label { + margin-right: 1px; +} + +#post_indexing div ul { + width: 30%; +} + +#post_indexing .buttons { + padding-right: 11px; +} + +#post #pdf iframe { + height: 665px; +} + +#titless { + margin-left: 5px; +} + + +#group_box +{ + width: 360px; + height: 550px; + margin: 0 0px 0 0; +} + +.frameform3 { + height: 370px; + width: 370px; +} + +#choose_services table +{ +text-align:left; +width: 90%; +} +.multiple_list +{ + height: 250px; + width: 150px; +} +.multiple_list_entities +{ + height: 250px; + width: 150px; +} + +.multiple_list_doctypes +{ + height: 250px; + width: 250px; +} +#calender { +top:19px; +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/css/styles.css b/maarch_entreprise/trunk/css/styles.css new file mode 100644 index 0000000000000000000000000000000000000000..9d01450cfb9d445e9fba32d8c36144a338cb72a1 --- /dev/null +++ b/maarch_entreprise/trunk/css/styles.css @@ -0,0 +1,3380 @@ +/* misc */ + + +html { + height: 100%; +} +.border_on +{ + border-style:solid; + border-color:#003399; + border-width:thin; + margin-top: 10px; +} +body { + color: #666; + /*background: white url(../img/bg_body.gif) top center repeat-y;*/ + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 12px; + font-weight: normal; + letter-spacing: 0.02em; + margin: 0; + padding: 0; + text-align: left; + width: 99.9%; + height: 99%; +} + +#validation_page +{ + background: white; + background-image : none; +} + +div, h1, h2, h3, h4, h5, h6, p, ul, ol, li { + margin: 0; + padding: 0; + list-style: none; +} + +h2 +{ + font-size: 16px; + clear:both; +} +h3 +{ + font-size: 14px; +} + +.small_text +{ + font-size: 10px; +} + +table { + font-size: 1em; +} + +img { + border: none; +} + +a, a:link, a:visited, a:hover { + color: #666; + text-decoration: none; +} + +a:hover { + color: #1B99C4; +} + +.bloc { + padding: 0px 0; + margin: 0 12px; +} + + + +#admin_types { + background: url(../img/manage_doctypes.gif) no-repeat 2px top; + width: 315px; + min-height: 110px; + float: left; + padding-top: 0px; + padding-right: 18px; + padding-bottom: 0px; + padding-left: 0px; + margin: 0px 0px 15px; + position: relative; + display: block; +} + +#admin_structures { + background: url(../img/manage_structures.gif) no-repeat 2px top; + width: 315px; + min-height: 110px; + float: left; + padding-top: 0px; + padding-right: 18px; + padding-bottom: 0px; + padding-left: 0px; + margin: 0px 0px 15px; + position: relative; + display: block; +} + +#admin_subfolders { + background: url(../img/manage_subfolders.gif) no-repeat 2px top; + width: 315px; + min-height: 110px; + float: left; + padding-top: 0px; + padding-right: 18px; + padding-bottom: 0px; + padding-left: 0px; + margin: 0px 0px 15px; + position: relative; + display: block; +} + +#view_tree_types { + background: url(../img/manage_architecture.gif) no-repeat 2px top; + width: 315px; + min-height: 110px; + float: left; + padding-top: 0px; + padding-right: 18px; + padding-bottom: 0px; + padding-left: 0px; + margin: 0px 0px 15px; + position: relative; + display: block; +} +/* floated blocks */ + +.clear { + clear: both; + height: 0; + font-size: 0; + line-height: 0; + display: block; + overflow: hidden; +} + +.floatl { + width: 1000px;float: left; + margin: 0 2em 1em 0; + position: relative; +} + +.floatr { + float: right; + margin: 0 0 1em 2em; + position: relative; +} + + +.inline { + display: inline !important; +} + + +/* Typos */ + +acronym, abbr { + border: none; +} + +.maarch, a.maarch { + color: #1B99C4; +} + +.maarch2, a.maarch2 { + color: #FFC200; +} + +.oblig { + text-align: right; + float: right; +} + +.no_doctypes { + font-weight: bold; + font-size: .9em; + color: #16ADEB; +} + +.nota { + font-size: .9em; + font-style: italic; + text-align: right; +} + +.close { + clear: both; + text-align: center; + padding-top: 20px; +} + +.tit { + font-size: 1.4em; + color: #1B99C4; + padding-bottom: 1em; + +} + +#desc_box .tit, #user_box .tit, #add_box .tit { + /*color: #FFC200;*/ + color: #1B99C4; +} + +.sstit { + color: #1B99C4; + font-size: 1em; + font-weight: normal; + padding-bottom: 1em; +} + +.text { + padding-bottom: 1em; +} + +.text li { + list-style-image: url(../img/puce.gif); + margin-left: 30px; +} + +a.next, a.change, a.suspend, a.delete, a.authorize, a.prev, a.up, a.down, a.view { + padding-left: 20px; + background: transparent url(../img/puce_prev.gif) 10px center no-repeat; + color: #16ADEB; +} + + +a.up { + background-image: url(../img/arrow_up.gif); +} +a.down { + background-image: url(../img/arrow_down.gif); +} + +a.prev { + background-position: center left; + padding-left: 10px; +} + +a.next { + background-image: url(../img/puce_next.gif); + background-position: center right; + padding-left: 0; + padding-right: 10px; +} + +a.change, a.suspend, a.delete, a.authorize, a.up, a.down, a.view { + padding: 5px 0 5px 20px; + background-position: center left; +} + +a.change { + background-image: url(../img/picto_change.gif); + padding-left: 25px; +} + +a.suspend { + background-image: url(../img/picto_suspend.gif); +} + +a.delete { + background-image: url(../img/picto_delete.gif); +} + +a.view { + background-image: url(../img/picto_view.gif); +} +a.authorize { + background-image: url(../img/picto_authorize.gif); +} + + +.add { + background: transparent url(../img/bg_but_add_left.gif) top left no-repeat; + padding: 0 0px 6px 21px; + display: block; + float: right; + font-size:11px; +} + +.add a { + padding: 5px 10px 6px 0; + background: transparent url(../img/bg_but_add_right.gif) top right no-repeat; + float: left; +} + +.add span { + padding: 4px 0 5px 4px; + background-color: White; + border: 1px solid #FFC200; + border-left: none; + border-right: none; +} + +.error { + color: #ea0000; + font-weight: bold; + text-align: center; + font-size: 1.4em; +} + +.info { + color: #FBEFCE; + color: #16ADEB; + font-weight: normal; + font-weight: bold; + text-align: center; + font-size: 1.2em; +} + + +/* Forms */ + +form, fieldset { + padding: 0; + margin: 0; + border: 0px solid white; +} + +.addforms, .addformsmall{ + width: 500px; +} +.addforms2{ + width: 460px; +} +.indexingform{ + width: 450px; +} +.addforms3{ + width: 520px; +} +label, .label { + cursor: pointer; + vertical-align: middle; +} + +input, select, textarea, .forms img { + vertical-align: middle; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: .9em; +} + +.smallforms { + padding: 0 12px; +} + +.forms input, .forms select, .forms textarea, .smallforms select, .smallforms input { + background-color: White; + border: 1px solid #999; + color: #666; + width: 200px; + text-align:left; +} + + + +.forms input, .forms textarea { + padding: 0.1em 0.2em; +} + +.forms select { + width: 196px; +} + +input.small { + width: 20px; +} + +input.year { + width: 35px; +} +select.small { + width: 5em; +} + +input.medium { + width: 120px; +} +input.medium2 { + width: 100px; +} +#newpage1, #newpage2 { + text-align: center; + color: #16ADEB; +} + +input.detail_box { + width: 260px; + font-size: 1em; +} + +#startpage { + margin-right: 10px; +} + +#frmletters a:hover, #frmletters a.on { + color: #16ADEB; +} + +#frmletters fieldset { + float: right; +} + +.button +{ + margin-top:4px; + text-align: center; +} + + +/* particular cases */ + +#dates label, #where label, .forms label.nofloat { + float: none; + display: inline; + width: auto; + margin: 0; + font-size: .9em; +} + +#dates .label, #fordate label { + padding-top: .5em; +} + +#doctype { + min-height: 10em; + height: auto; + border: 1px solid #CCC; + border-left: none; + border-right: none; + padding: 10px; +} + +#doctype .label { + padding: 3em 0; +} + +/* form quicksearch */ + +#quicksearchform input.button, input.radio { + border: none; + background-color: transparent; + background-image: none; + padding: 0; + margin: 0; + width: auto; +} + +/* more particular cases */ + +input.button { + /*border: 1px solid #1481A5;*/ + border: 1px solid #C2B8A0; + border: 1px solid; + /*color: #1481A5;*/ + color: #756666; + background: white url(../img/bg_but.gif) top left repeat-x; + cursor: pointer; + width: auto; + padding: 0.2em 0.5em; + text-align: left; +} + +.forms2 .single{ + margin-left: auto; + margin-right: auto; + width: 40%; +} + + +.forms label, .forms .label { + float: left; + display: block; + text-align: left; + width: 40%; + margin-right: 1em; + vertical-align: middle; +} + +.forms p { + clear: left; +} + +.forms p.buttons { + margin-left: 41.3%; +} + +/* tables */ + +.listing, .spec { + margin: 10px 0px 0; + width: 1000px; +} + +.detailtabricatordebug{ + width: 900px; +} + + +.listingsmall, .specsmall { + margin: 10px 12px 0 12px; + width: 100%; +} + +#iframe .listing { + margin: 5px 8px 0 5px; + width: 340px; +} + +#iframe .listingsmall { + margin: 5px 8px 0 5px; + width: 340px; +} + +#iframe .listing2 { + margin: 5px 8px 0 5px; + width: 98%; +} + +#iframe .listing3 { + margin: 5px 8px 0 5px; + width: 98%; +} +.addforms .listing +{ + width: 300px; +} + +.addforms .listingsmall +{ + width: 300px; +} + +.addforms2 .listing +{ + width: 520px; +} + +.addforms2 .listingsmall +{ + width: 450px; +} + +#hist_iframe .listing, #missing_iframe .listing, #contract_history_frame .listing, #filling_res_frame .listing { + margin: 5px 8px 0 5px; + width: 90%; +} + +#hist_courrier_frame .listing +{ +width: 770px; + +} +.listing th { + color: #16ADEB; +} +.listingsmall th { + color: #16ADEB; +} + +.listing2 th { + color: #16ADEB; +} + +.listing3 th { + color: #16ADEB; +} +.listing th .add { + font-weight: normal; +} + +.listing2 th .add { + font-weight: normal; +} + +.listing3 th .add { + font-weight: normal; +} + +.listingsmall th .add { + font-weight: normal; +} + +.listing th, .listing td { + text-align: left; + padding: 5px 10px 6px 20px; + vertical-align: middle; +} + + +.listing2 th, .listing2 td { + text-align: left; + padding: 5px 10px 6px 20px; + vertical-align: middle; +} + +.listing3 th, .listing3 td { + text-align: left; + padding: 5px 10px 6px 10px; + vertical-align: middle; +} +.listingsmall th, .listingsmall td { + text-align: left; + padding: 5px 10px 6px 20px; + vertical-align: middle; +} + +.spec th, .spec td { + padding: 5px 10px 6px 10px; +} + +.specsmall th, .specsmall td { + padding: 5px 10px 6px 10px; +} + +.spec th { + font-weight: normal; + font-size: 9px; + text-transform: uppercase; + vertical-align: bottom; +} + +.specsmall th { + font-weight: normal; + text-transform: uppercase; +} + +.spec th a { + text-transform: none; +} + +.specsmall th a { + text-transform: none; +} + +.listing td { + background-color: #93D1E4; +} + +.listing2 td { + background-color: #DEEDF3; +} + +.listing3 td { + background-color: #DEEDF3; +} + +.listingsmall td { + background-color: #93D1E4; +} + +.listing .col td { + background-color: #DEEDF3; +} +.listing .white td { + background-color: #FFFFFF; +} + +.listing2 .col td { + background-color: #93D1E4; +} + +.listing3 .col td { + background-color: #93D1E4; +} + +.listingsmall .col td { + background-color: #DEEDF3; +} + +td.picto, th.picto, td.action { + text-align: center; + padding: 0 0.2em 0; + width: 4%; +} + +th.ref { + padding: 0; + width: 100px; +} +.listing .price { + text-align: right; + padding-right: 0; + padding-bottom: 0; + +} + +.listingsmall .price { + text-align: right; + padding-right: 0; + padding-bottom: 0; + +} + +.listing tfoot .price { + background-color: transparent; +} + +.listingsmall tfoot .price { + background-color: transparent; +} + +.listing .title { + width: 180px; +} + +.listingsmall .title { + width: 180px; +} + +.listing .type { + width: 150px; +} + +.listingsmall .type { + width: 150px; +} + +.listing .type2 { + width: 100px; +} + +.listingsmall .type2 { + width: 100px; +} + +.listing td.picto { + width: 60px; + padding: 5px 0 6px 0; +} + +.listing .action { + width: 90px; + font-size:10px; +} + +.listingsmall .action { + width: 90px; + font-size:10px; +} + +.listing .date { + width: 60px; + +} + +.listingsmall .date { + width: 60px; + +} + +.listing .lastn, .listing .mail { + width: 75px +} + +.listingsmall .lastn, .listingsmall .mail { + width: 75px +} + +.listing .id, .listing .descr { + width: 140px; +} + +.listingsmall .id, .listingsmall .descr { + width: 140px; +} + +.listing .user { + width: 115px; +} + +.listingsmall .user { + width: 115px; +} + +.listing .emetteur { + width: 100px; +} + +.listingsmall .emetteur { + width: 100px; +} + +.spec .user { + width: auto; +} + +.specsmall .user { + width: auto; +} + +.listing .comment { + width: 310px; +} + +.listingsmall .comment { + width: 310px; +} + +/* Document details */ + +.detail { + margin-bottom: 1em; + margin-top: 0; +} + +.detail td { + padding: 8px 5px 9px 5px; +} + +.detail th { + background-color: #93D1E4; + width: 110px; + font-weight: normal; + color: #666; + padding: 8px 0 9px 5px; + text-align: right; +} + +.detail th.int { + width: 140px; + text-align: left; +} +.detail .col th { + background-color: #DEEDF3; +} + +.detail td.void { + width: 15px; + padding: 0; + background-color: transparent; +} + +#titless { + float: left; + font-size: 1em; + margin-left: 12px; + padding-top: 1.4em; + color: #FFC200; +} + +#titless2{ + float: left; + font-size: 1em; + margin-left: 5px; + +} + +#titless input { + font-weight: normal; +} + +#viewdoc { + float: right; + text-align: right; + margin-right: 0px; +} + +#viewdoc img { + vertical-align: middle; +} + +#viewfolder { + float: right; + margin-right: 0px; +} + +#back_list { + vertical-align: middle; + height:38px; + float: left; + margin-right: 0px; +} + +#back_list img { + vertical-align: middle; +} + +#viewfolder img { + vertical-align: middle; +} + +#detaildescr .label { + width: 31%; + margin-right: .5em; +} + +#detaildescr textarea { + width: 295px; + height: 80px; +} + + +/* Structure */ + +#prelude { +position: absolute; +left: -100em; +} + +#container { + width: 1000px; + margin: 0 auto; + text-align: left; + min-height: 400px; + height: 80%; +} + +#head { + padding-top: 1px; + width: 100%; + background-color: #16ADEB; + height: 70px; +} + +#logo { + float: right; + margin: 0px; + padding-right: 0px; + padding-top: 0px; +} +#gauchemenu { + float: left; + margin: 0px; + padding-right: 0px; + padding-top: 0px; +} + + +#this_user_name { + + margin-top: 60px; + margin-right: 30px; + color: #009ddf; + color:black; +} + + +#quicksearchform { + margin-top: 80px; + margin-left: 338px; + color: #009ddf; + width: 350px; +} + +#quicksearchform #search { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: .9em; + color: #666; + border: none; + padding: .2em .6em .4em .6em; + width: 10.7em; + background: transparent url(../img/bg_inputsearch.gif) top left no-repeat; +} + +#quicksearchform label { + clear: right; + padding-left: 15px; + padding-bottom: 12px; +} + +#quicksearchform input { + float: left; + margin: 0 5px 0 0; +} + +#help { + text-align: right; + padding-right: 12px; + margin-top: 52px; + float: right; +} + + +/* navigation bar */ + +#nav { + clear: both; + position: relative; + width: 100%; + margin-bottom: 0px; + margin-left: 1px; + height: 70px; + background: url(../img/bando_tete2.gif) repeat-x left top; + margin-top: 3px; + min-width: 1000px; +} +#foot { + clear: both; + position: relative; + width: 100%; + margin-bottom: 0px; + height: 30px; + background: url(../img/bando_foot2.gif) repeat-x left top; + margin-top: 305px; + min-width: 1000px; + float: left; +} + + + +#nav #baskets { + text-align: right; + float: right; + color: White; + font-weight: bold; + padding: 3px 20px 6px 25px; + height:20px; +} + +#nav #no_baskets { + text-align: right; + float: right; + padding: 3px 20px 6px 25px; + height:20px; + color: #FFFFFF; +} + +/* pop-up menu */ + +#menu { + position: absolute; + width: 240px; + margin-left: 10px; + margin-top: 40px; +} + +#menu p { + height: 30px; + overflow: hidden; + cursor: pointer; +} + +#menu p.off img { + margin-top: 0 !important; +} + +#menu.on p img { + margin-top: -30px; +} + +#menunav { + width: 100%;; + background: #D8F4FF; + position: absolute; + top: 29px; + left: 0px; + padding: 0px; + z-index: 10; + margin: 0px; + border: 1px solid #16ADEB; +} + +#menunav li { + padding-left: 3px; + margin-bottom: 5px; +} + +#menunav li a { + padding-right: 3px; + color: #0094D0; + display: block; + position: relative; +} + +#menunav li span { + display: block; + padding-left: 3px; +} + +#menunav li span span { + background: transparent bottom left no-repeat; + padding: 6px 10px 5px 30px; + display: block; + margin: 0px; +} + +#menunav li#admin span span { + background-image: url(../img/picto_menu_admin.gif); +} + + +#menunav li#aide span span { + background-image: url(../img/picto_menu_help.gif); +} +#menunav li#add span span { + background-image: url(../img/picto_menu_fileindex.gif); +} + +#menunav li#post span span { + background-image: url(../img/picto_menu_postindex.gif); +} + +#menunav li#browse span span { + background-image: url(../img/stats_menu_off.gif); +} +#menunav li#valid_mail span span { + background-image: url(../img/valid_menu_off.gif); +} + +#menunav li#maarch_credits span span { + background-image: url(../img/picto_menu_help.gif); +} +#menunav li#logout span span { + background-image: url(../img/logout_off.gif); +} +#menunav li#manbask span span { + background-image: url(../img/manage_baskets_off.gif); +} +#menunav li.on { + padding-left: 3px; +} + +#menunav li.on a { + color: white; + text-decoration: none; +} + +#menunav li.on span { + background-image: url(../img/bg_menu_span_on.gif); +} + +#menunav li#admin.on span span { + background-image: url(../img/picto_menu_admin_on.gif); +} +#menunav li#aide.on span span { + background-image: url(../img/picto_menu_help_on.gif); +} +#menunav li#searching span span { + background-image: url(../img/searching_off.gif); +} +#menunav li#searching.on span span { + background-image: url(../img/searching_on.gif); +} +#menunav li#market_search span span { + background-image: url(../img/search_proj_off.gif); +} +#menunav li#market_search.on span span { + background-image: url(../img/search_proj_on.gif); +} +#menunav li#add.on span span { + background-image: url(../img/picto_menu_fileindex_on.gif); +} + +#menunav li#post.on span span { + background-image: url(../img/picto_menu_postindex_on.gif); +} +#menunav li#valid_mail.on span span { + background-image: url(../img/valid_menu_on.gif); +} +#menunav li#browse.on span span { + background-image: url(../img/stats_menu_on.gif); +} +#menunav li#account span span { + background-image: url(../img/account_off.gif); +} +#menunav li#account.on span span { + background-image: url(../img/account_on.gif); +} +#menunav li#my_contacts span span { + background-image: url(../img/my_contacts_off.gif); +} +#menunav li#my_contacts.on span span { + background-image: url(../img/my_contacts_on.gif); +} +#menunav li#maarch_credits.on span span { + background-image: url(../img/picto_menu_help_on.gif); +} +#menunav li#logout.on span span { + background-image: url(../img/logout_on.gif); +} +#menunav li#manbask.on span span { + background-image: url(../img/manage_baskets_on.gif); +} +#menunav li#indexing span span { + background-image: url(../img/indexing_off.gif); +} +#menunav li#indexing.on span span { + background-image: url(../img/indexing_on.gif); +} +#menunav li ol { + font-size: .9em; +} + +#menunav li ol { + display: none; +} + +#menunav ol li { + padding-bottom: 2px; + margin-bottom: 0; +} + +#menunav ol li, #menunav ol li a, #menunav ol li a span span, #menunav ol li a span, #menunav li.on ol li, #menunav li.on ol li a, #menunav li.on ol li a span, #menunav li.on ol li a span span { + background-image: none; +} + +#menunav li ol li a, #menunav li.on ol li a { + color: #16ADEB; + display: inline; +} + +#menunav li ol li a:hover { + text-decoration: underline; +} + + + + + +/* ariane */ + +#ariane { + color: White; + position: absolute; + left: 15px; + top: 0px; + font-size: 0.9em; + height: 18px; + margin-top: 10px; +} + + +#ariane a { + color: White; +} + +/* texte footer */ + +#footext { + color: White; + position: absolute; + left: 100px; + top: 0px; + font-size: 0.9em; + margin-top: 10px; +} + + +#footext a { + color: White; +} + +/* content */ + +#content { + width: 1000px; +} +#iframe #content{ + + width: 816px; +} + +#scansnap #content{ + + width: 510px; + +} + +#inner_content { + border-top: none; + border-bottom: none; + padding: 15px 0px 0px; + width: 1000px; + min-height: 370px; + height: auto; + margin-left: 0px; +} + +#content h1 { + color: #16ADEB; + font-style: italic; + font-weight: bold; + font-size: 1.3em; + text-align: left; + letter-spacing: 0.1em; + height: 1.6em; + position: absolute; + padding: 0px; + top: 38px; + left: 190px; + width: 80%; +} +#nav h1 { + color: #16ADEB; + font-style: italic; + font-weight: bold; + font-size: 1.5em; + text-align: left; + letter-spacing: 0.1em; + position: absolute; + padding: 0px; + top: 37px; + left: 195px; +} +#nav h1 span { + font-size: 0.5em; + color: #FFFFFF; +} +#nav h1 a { + color: White; +} + +#nav h1 img { + margin-right: 8px; + height: 32px; + vertical-align: middle; +} +#content h1 img { +vertical-align: middle; +/* margin-right: 8px; + */ + margin-top: -1px; + +} + +#content h1 span { + font-size: .5em; +} + +/* Special case : back link in the title */ + +#content h1.titdetail { + text-align: left; + padding-left: 0px; + padding-right: 0px; +} + +#content h1 a { + color: White; +} + +#content h1 a:hover { + color: White; + text-decoration: underline; +} + + + +#content p, #bodylogin .forms p { + padding-bottom: 1em; +} + + +/* footer */ + +#footer { + text-align: right; + font-size: 0.8em; + color: #CCC; + padding: 18px 0 0px; + margin: 0 20px; +} + + + + + +/* Home */ + +#bodylogin { + background: White url(../img/bg_home_home.gif) center center no-repeat; + height: 100%; + text-align: left; +} + + +#loginpage { + width: 300px; + height: 350px; + margin-left: -150px; + margin-top: -175px; + left: 50%; + top: 72%; + position: absolute; +} + +#formlogin { + width: 255px; +} + +#formlogin input { + width: 120px; +} + +#formlogin input.button { + width: auto; + margin: 0; +} + +#formlogin p.buttons, #post .forms .buttons { + text-align: right; + margin: 0; +} + +#formlogin select { + width: 140px; +} + + + +/* Post Indexing Popup */ + +#post { + background-image: none; +} + +#post #content { + padding-top: 10px; +} + +#post #container { + background: transparent url(../img/bg_ht_content.gif) top center no-repeat; + margin-top: 15px; +} + +#post #inner_content { + padding: 0 4px 0px 0px; +} + +#post #infos_box, #post #post_indexing { + float: left; + clear: left; + width: 266px; + margin-left: 5px; +} + +#post #infos_box { + background: transparent url(../img/bg_boite_post.gif) top left no-repeat; + padding: 3px 7px 5px 7px; + width: 252px; + font-family: Arial, Helvetica, sans-serif; + line-height: 1.8em; + margin-bottom: 20px; +} + +#infos_box #postpagin #count { + font-size: 1.2em; + color: #16ADEB; + font-weight: bold; + float: right; +} + +#infos_box #postpagin li { + display: inline; + padding-right: 5px; +} + +#post_indexing label, #post_indexing .label { + width: 30%; +} + +#post_indexing input.textbox { + width: 169px; +} + +#post_indexing input.small { + width: 20px; +} + +#post_indexing select.small { + width: 5em; +} + +#post_indexing #subs #labelsub2 { + float: none; + width: auto; + text-align: left; + display: inline; + margin: 0 0 0 1em; +} + +#post_indexing div { + margin-left: 85px; +} + +#post_indexing div label { + width: 2.1em; + margin-right: .5em; + letter-spacing: normal; +} + +#post_indexing div ul { + float: left; + width: 31%; + margin-left: 2px +} + +#post_indexing div li { + margin-bottom: 8px; +} + +#post_indexing .buttons { +} + +#post #pdf { + border: 1px solid #999; + width: 520px; + margin-left: 285px; +} + + +/* browse by folder/post indexing */ + +#desc_box, #type_box{ + border: 1px solid #999; + background-color: White; + float: right; + width: 465px; + margin: 0 10px 0 0; + padding: 20px 25px; +} +#add_box,#user_box,#group_box{ + border: 0px; + float: right; + width: 465px; + margin: 0 10px 0 13px; +} + +#desc_box p, #desc_box ul, #user_box p, #user_box ul { + padding-bottom: 1em; +} + +#list { + padding: 21px 10px; +} + +#list .tit { + padding-bottom: .5em; +} + +#list .file { + margin-bottom: 2.4em; +} + +#list .file li { + padding-left: 13px; + background: transparent url(../img/case.gif) left .2em no-repeat; + margin-bottom: .3em; +} + +#list .file li.on { + background-image: url(../img/case_on.gif); + margin-bottom: 1em; +} + +#list .file li.on li { + background-image: url(../img/case_ins_on.gif); + background-position: top left; + padding: 4px 0 4px 35px; + margin-left: 5px; +} + +#list .file a { + padding-left: 23px; + background: transparent url(../img/file.gif) center left no-repeat; +} + +#list .file a.no_doc { +padding-left :15px; + background: none; + margin-bottom:4px; + +} + +#list .file .on a { + color: #1b99c4; +} + +#list .file .on li a { + color: #666; +} + + +/* User Profile */ + +#user_box { + width: 310px; +} + +#frmuser .buttons { + margin-left: 0%; +} + + +/* iframes in forms */ + +#iframe { + text-align: left; +} + +#iframe ul, #iframe ul { + margin-bottom: 1em; +} + +.frameform { + height: 2.1em; +} + +.frameform2 { + height: 10em; +} + + +.frameform3 { + height: 330px; + width: 410px; +} +.frameform4 { + height: 330px; + width: 445px; +} + +/* add/change a group, user or document type (width iframes) */ + +#add_box { + height: 350px; + width: 300px; +} + +#group_box +{ + width: 400px; + height: 360px; +} + +#type_box +{ + width: 350px; + height: 360px; +} +#add_box .frameform2 { + height: 360px; + +} +#type_box .frameform2 { + width: 60px; + height: 360px; + +} +#iframe .forms .listing { + width: 100%; + margin: 0 0 10px 0; +} + +#iframe .forms .listing td, #iframe .forms .listing th { + padding: 5px; +} + +.multiple_list +{ + height: 250px; + width: 150px; +} + +.multiple_list_entities +{ + height: 250px; + width: 150px; +} + +.multiple_list_doctypes +{ + height: 250px; + width: 250px; +} +/* admin summary */ + +#summary { + padding: 10px 100px; +} + +#summary li { + width: 0px; + text-align: center; + margin-bottom: 20px; +} + +/* admin core board */ +.summary_admin_users { + background: url(../img/gerer_utilisateurs.gif) no-repeat 2px top; + height:65px; +} + +.summary_admin_groups { + background: url(../img/manage_groupe.gif) no-repeat 2px top; + height:80px; +} + +.summary_admin_contacts { + background: url(../img/manage_contacts.gif) no-repeat 2px top; + height:80px; +} + +.summary_admin_doctypes { + background: url(../img/picto_managed_superb.gif) no-repeat 2px top; + height:80px; +} + +.summary_admin_modules { + background: url(../img/gerer_structures.gif) no-repeat 2px top; + height:80px; +} + +.summary_view_history { + background: url(../img/historique.gif) no-repeat 2px top; + height:80px; +} + +.sum_margin{ + margin-left:85px; +} + +#summary .imp { + margin-right: 90px; +} + +#summary h2 { + font-size: 1.3em; +} + +#summary li span { + display: block; + font-size: 1.1em; + margin-top: .5em; + color: #666; +} + +#summary a { + color: #1B99C4; +} + +#summary a:hover { + color: #666; +} + +#summary img { + display: block; + margin: 0 auto; +} +/* admin app board */ + + + +/* Stats summary */ + +#statssummary { + padding: 10px 40px; +} + +#statssummary li { + width: 110px; + text-align: center; + float: left; + margin-bottom: 10px; +} + +#statssummary .imp { + margin-right: 20px; +} + +#statssummary h2 { + font-size: 1.3em; +} + +#statssummary li span { + display: block; + font-size: 1.1em; + margin-top: .5em; + color: #666; +} + +#statssummary a { + color: #1B99C4; +} + +#statssummary a:hover { + color: #666; +} + +#statssummary img { + display: block; + margin: 0 auto; +} + +/* calendar*/ + +#basis { +position: absolute; +display:inline; +} + +#calender { + width:190px; + background-color:#fff; + border:1px solid #73BDFF; + padding:5px; + z-index:10; + text-align: center; + position: relative; + top:17px; + left:0px; + margin-left: 0px; +} + +#calender .controlPlus { + padding: 0 5px; +} +#calender #close +{ + margin-bottom: 1px; +} +#img_close +{ +margin-bottom: 3px; +} +#calender .close_window { + text-align: right; + font-size:9px; + margin-left:130px; + border: 1px solid #BBBBBB; +} + +#calender table { + width: 180px; + margin: 0 auto; +} + +#calender td { + padding: 1px 0 2px 0; +} + +#calender .weekdays td { + color: white; + font-weight: bold; + background-color: #73BDFF; +} + +#calender .week td { + cursor: pointer; +} + +#calender .week .today { + background-color: #dbf0fb; + font-weight: bold; + color: #1B99C4; +} + +#calender .week .holiday { + font-weight: bold; +color: #CCC; +} + +#calender .week .hoverEle { + background-color: #dbf0fb; + color: #1B99C4; +} + +#basis #calender select { + width: auto; +} + +#dates #basis +{ + left: 680px; +} +/* popups */ + +#pop { + padding: 2em; + text-align: left; +} + +#pop label, #pop .label { + width: 30%; +} + +#pop .buttons { + margin-left: 32.7%; +} + +#formgroup .buttons +{ +margin-left: 30%; +} + +#pop .forms p { + margin-bottom: 1em; +} + + +/* clearfix */ + +.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.clearfix { display:block; } +/* Hides from IE-mac \*/ * html .clearfix { display:block; } /* End hide from IE-mac */ + +.withcalend +{ + position:relative; +} + +#pop_up p +{ + margin-left: 5%; + margin-right:5%; + text-align: left; +} + +#pop_up .buttons +{ + text-align: center; +} + + + +.form_title +{ + font-weight:bold; + /*text-align: left; + width: 50%; + height:auto; + float: left*/ +} +/* +.form_desc +{ + text-align: left; + width: 50%; + float: right; +height:auto; +} +*/ + +.indexingform .form_title +{ + font-weight:normal; + width: 180px; +} + + +.indexingform .indexing_field +{ + text-align: right; +} +.indexingform .indexing_middle +{ + width:50px; +} + + +#rep +{ + width: 40%; + float: left; + text-align: right; +} + + +#nota_bene +{ + text-align: center; + width: 60%; + float: right; + +} + +.bloc_trait +{ + margin-left: 2%; + margin-right: 2%; + margin-bottom: 15px; +} + +.red_asterisk +{ + color: #FF0000; + font-weight: bold; + font-size: 14px; + vertical-align:top; +} + +.green_asterisk +{ + color: #00FF00; + font-weight: bold; + font-size: 14px; + vertical-align:top; +} + +#welcome_desc +{ + float:left; + width: 50%; + /*height: 375px;*/ + padding-top: 10px; + border: 1px solid #BBBBBB; + background-color: White; + padding-bottom: 20px; + margin: 10px 15px 15px 15px; + padding: 5px 5px 2px 5px; + line-height: 1.8em; +} + +#baskets_list +{ + width: 300px; + height: 45px; + padding-top: 10px; + padding-bottom: 10px; + float:right; + margin-top: 20px; +} + +#welcome_stats +{ + float:left; + width: 300px; + margin: 10px 10px 10px 10px; +} + +/*************************************************************************/ +#help_text +{ + display: block; + float:none; + clear:both; +} + +#guide_summary +{ + margin: 20px 20px 20px 20px; + text-align:left; +} + +#guide_summary .chapitre +{ + margin-bottom: 25px; + margin-left: 200px; +} + +#guide_summary .chapitre h3 +{ + margin-left: 50px; + color:#990000; +} + +.list +{ + margin-bottom: 20px; +} + +.list li +{ + margin-left: 25px; + list-style:circle; + text-align:left; +} + + +#browse_page +{ + margin-top: 30px; + +} +#prev +{ + text-align:left; + + margin-right: 282px; +} + +#next +{ + text-align:right; + margin-left: 282px; +} + +#gestion_rep .listing +{ + width: 40%; +} + +#gestion_rep p +{ + float: right; + margin-top: -40px; + clear:both; + text-align:right; +} + +.forms .readonly +{ + background-color: #E6E6E6; +} + +#guide_summary .tit a +{ + color: #1B99C4; +} + +#guide_summary .tit a:hover +{ + color: #666; +} + +#help_guide +{ + margin-left: 300px; + margin-bottom: 20px; + width: 205px; + text-align:center; +} + +#help_guide h2 a +{ + color: #1B99C4; +} + +#help_guide img { + display: block; + margin: 0 auto; +} +#help_guide span { + display: block; + font-size: 1.1em; + margin-top: .5em; + color: #666; +} + +.listing a:hover +{ + color: #666665; +} + +.listingsmall a:hover +{ + color: #666665; +} + +#gestion_rep .listing +{ + width: 400px; + margin: 0px 0px 0 0px; +} +#gestion_rep .listing .file_name +{ + width: 120px; +} + +#liste_emetteur, #type_choice, #date_limite +{ + height: 25px; + margin-top: 2px; + +} + +#nom_prenom +{ + margin-bottom: 5px; +} + +.form_elem +{ + margin-bottom: 5px; + margin-top: 2px; +} + +#allowed_actions li +{ + text-align:left; + border: none; +} + +#serviceslist, #services_chosen, #groupslist, #groups +{ + width: 150px; +} + +hr +{ + text-align:center; + margin-top: 15px; + margin-bottom: 15px; + width: 80%; + clear:both; +} + +#abs +{ +margin-left: 10px; + +} + +#welcome_desc #basket +{ + margin-left: 150px; +} + + + +#validleft +{ + /*width: 47%;*/ + padding-left: 5px; + padding-right: 5px; + float: left; + /*margin: 0 2em 1em 0;*/ + position: relative; +} + +#validleftprocess +{ + /*width: 47%;*/ + width:420px; + padding-left: 1px; + padding-right: 1px; + float: left; + /*margin: 0 2em 1em 0;*/ + position: relative; +} + +#validright +{ + /*width: 47%;*/ + padding-left: 5px; + padding-right: 5px; + vertical-align:top; + float: right; + /*margin: 0 0 1em 2em;*/ + position: relative; +} + +#search_mail, #exp2 +{ + margin-left: 330px; +} +#choose_exp_link +{ + margin-left: 0px; +} +#info_user_welcome +{ + width: 100%; + padding-top: 10px; + border: 1px solid #BBBBBB; + background-color: White; + padding-bottom: 20px; + margin: 0px 0px 15px 0px; + padding: 5px 5px 2px 5px; + line-height: 1.8em; +} + + + +#info_user .button, #select_folder .button +{ + width:125px; +} + +#select_folder +{ + background: white; + background-image : none; +} +#folder_tree +{ + + border: 1px solid #FFC200; + padding: 2px 5px 5px 2px; + vertical-align:top; + +} + +#folder_search +{ +text-align:right; +} + +#form1 +{ + border: 1px solid #FFC200; + padding-top:10px; + margin-bottom: 10px; + +} +#form2 +{ + border: 1px solid #FFC200; + padding-top:10px; + text-align:left; + padding-left: 5px; +} +.selected{ + font-weight: bold; + font-size:12px; +} + +.dir_second_level +{ + margin-left: 20px; + margin-top: 0px; + margin-bottom: 15px; + font-size:12px; +} + +.dir_third_level +{ + margin-left: 20px; + margin-top: 0px; + margin-bottom: 10px; + font-size:11px; + +} + +#link_right +{ + text-align:right; + margin-left:100px; +} + +.selectlist +{ + width: 200px; +} + +#welcome_label +{ + font-size:18px; + font-weight:bold; + color: #0099CC; +} +.forms2 input, .forms2 select, .forms2 textarea{ + background-color: White; + border: 1px solid #999; + color: #666; + width: 170px; + text-align:left; +} +.forms2 input, .forms textarea { + padding: 0.1em 0.2em; +} +.forms2 select { + width: 176px; +} +.forms2 .rightpart +{ + width: 50%; + vertical-align:top; + float: left; + float: right; + +} +.forms2 .leftpart +{ + width: 49%; + /*float: left;*/ +} +.forms2 .leftpart2 +{ + width: 70%; + +} +.forms2 .leftpart2 span +{ + width: 70%; +} +#frame .forms2 .leftpart2 +{ + width: 80%; +} +.forms2 .leftpart label, .forms2 .rightpart label, .forms2 .leftpart2 label{ + float: left; + display: block; + text-align: left; + width: 30%; + margin-right: 1em; + padding-left: 25px; +} + + + +.forms2 .leftpart .colon, .forms2 .rightpart .colon, .forms2 .leftpart2 .colon +{ + margin-right: 7%; +} + +.forms2 p { + clear: left; +} + +.forms2 p.buttons { + margin-left: 41.3%; +} + +.forms2 .date_small +{ + width: 174px; +} + +.forms2 .datespart +{ + width: 100%; +} + +.forms2 .datespart p .mainlabel +{ + padding-left: 26px; + width: 150px; + display:block; + float:left; +} + +.forms2 .datespart .period_start, .forms2 .datespart .period_end +{ + padding-left: 40px; + width: 33%; +} +.forms2 .datespart p +{ + width: 100%; + height:20px; + clear:both; + vertical-align:top; +} + +.indexingform input, .indexingform textarea +{ + width: 220px; +} +.indexingform select +{ + width: 226px; +} + +#indexingfrmcontact +{ + width:480px; + margin-left:10px; +} + +#indexingfrmcontact input, #indexingfrmcontact textarea +{ + width: 180px; +} + +#indexingfrmcontact .button +{ + width: 60px; +} +#indexingfrmcontact select +{ + width: 186px; +} +#indexingfrmcontact .check +{ + border: none; + width: 20px; +} + +#indexingfrmcontact .small +{ + width: 50px; +} +#indexingfrmcontact .medium +{ + width: 140px; +} + +input[type="checkbox"] , input[type="radio"] +{ + border: none; + width: 20px; +} + +.addforms2 .check +{ + border: none; + width: 20px; +} + +.addforms .check +{ + border: none; + width: 20px; +} + +.addforms3 .check +{ + border: none; + width: 20px; +} + +.listing td input[type="radio"]{ + background-color: #93D1E4; +} + +.listingsmall td input[type="radio"]{ + background-color: #93D1E4; +} + +.listing .col td input[type="radio"]{ + background-color: #DEEDF3; +} + +.listingsmall .col td input[type="radio"]{ + background-color: #DEEDF3; +} + +#folder_out_form +{ + width: 90%; +} + + +#stats_list li +{ + list-style-type:disc; + margin-left: 80px; +} +.input_expert_hide +{ + display:none; +} + +.input_expert_show +{ + +} + +.block /* Propriétés qui s'appliquent au cadre d'habillage en général */ +{ +background-image:url("../img/border_top.gif"); +background-repeat:repeat-x; +background-position:top center; +padding-top : 8px; +padding-left : 5px; +padding-right : 5px; +background-color: #deedf3; +} + +.block_end{ +background-image:url("../img/border_bottom.gif"); +/*background-repeat:repeat_x;*/ +background-position:bottom; +padding-bottom : 7px; +/*margin-left: 12px; +margin-right: 12px;*/ +} + +.mini_box_left{ +width:450px; +height:150px; +/*position:relative;*/ +display: block; +float: left; +} +.mini_box_right{ +width:450px; +height:150px; +/*position:relative;*/ +display: block; +float: right; +} +.blank_space{ +height:30px; +} + +.advertissement{ +width:95%; +border:1px; +background-color: #ffe09b; +color: #333333; +font-style: italic; +font-weight: bold; +letter-spacing: 0.1em; +border: 1px solid #FFC200; +position: absolute; +padding: 0px; +top: 0px; +left: 5px; +} + +.admin{ +width:450px; +} + +.block_light +{ +background-repeat:repeat-x; +background-position:top center; +padding-top : 8px; +padding-left : 5px; +padding-right : 5px; +background-color: #fefeee; +} + +.bighome_search_adv{ +background: url(../img/big_home_search.gif) no-repeat top; +width:187px; +height:64px; +color: #1B98C5; +font-weight: bold; +font-size: 1.2em; +text-align: center; +letter-spacing: 0.1em; +} + +.bighome_userinfo{ +background: url(../img/big_home_account.gif) no-repeat top; +width:187px; +height:64px; +color: #1B98C5; +font-weight: bold; +font-size: 1.2em; +text-align: center; +letter-spacing: 0.1em; +} + +.bighome_physical_archive{ +background: url(../img/big_home_physical.gif) no-repeat top; +width:187px; +height:64px; +color: #1B98C5; +font-weight: bold; +font-size: 1.2em; +text-align: center; +letter-spacing: 0.1em; +} + +.bighome_workflow{ +background: url(../img/big_home_workflow.gif) no-repeat top; +width:187px; +height:64px; +color: #1B98C5; +font-weight: bold; +font-size: 1.2em; +text-align: center; +letter-spacing: 0.1em; +} +.bighome_indexing{ +background: url(../img/big_home_indexing.gif) no-repeat top; +width:187px; +height:64px; +color: #1B98C5; +font-weight: bold; +font-size: 1.2em; +text-align: center; +letter-spacing: 0.1em; +} +.label_for_bighome_search_adv{ + +margin-left:55px; +width:137px; +padding-top : 6px; + +} +.label_for_bighome_userinfo{ + +margin-left:55px; +width:137px; +padding-top : 20px; + +} +.label_for_bighome_physical_archive{ + +margin-left:55px; +width:137px; +padding-top : 20px; + +} +.label_for_bighome_workflow{ + +margin-left:55px; +width:137px; +padding-top : 15px; + +} +.label_for_bighome_indexing{ + +margin-left:55px; + +width:130px; +padding-top : 15px; +padding-top : 15px; +} + +.welcome{ +margin-right:120px; +font-size: 14px; +} + +.welcome_details{ +/*border: 1px solid #FFC200; */ +margin-right:120px; +padding-top:10px; +font-size: 11px; +} + +.advertissement_for_welcome{ +background: url(../img/picto_menu_help.gif) no-repeat top left; +padding-left:30px; +height:30px; +} + +.header_menu{ +background-color: #1B91BA; +height:23px; +color:white; + +font-weight: bold; +font-size: 1.3em; +text-align: right; +border-bottom: 2px solid #FFFFFF; +} +.footer_menu{ +background-color: #1B91BA; +height:15px; +width:100%; +font-weight: bold; +font-size: 0.8em; +text-align: right; +padding-right:0px; +padding-top:0px; +border-top: 2px solid #FFFFFF; +position:relative; +bottom:0; +} + +.footer_menu a{ +margin-top:15px; +} + +.header_menu_blank{ +height:10px; +} +.user_name_menu{ +padding:3px; +} + + +.maarch_credits_left_box{ + +float: left; +width:680px; +height:660px; +} +.credits_list{ +text-align:center; +float: right; +width:300px; +} + +.credits_bloc_img{ +padding:4px; +background:white; +border: 2px solid #16ADEB; +} + +.img_credits_maarch_box{ +width:100%; +position:relative; +text-align:center; +bottom:0; + +} + +/*Automplete*/ +div.autocomplete { + position: absolute; + width: 500px; + background-color: white; + border: 1px solid #888; + margin: 0px; + padding: 0px; +} + +div.autocomplete ul { + list-style-type: none; + margin: 0px; + padding: 0px; + max-height: 20em; + overflow: auto; +} + +div.autocomplete ul li.selected { + background-color: #93D1E4; +} + +div.autocomplete ul li { + /*background-color: #DEEDF3;*/ + list-style-type:none; + display: block; + margin: 0; + padding: 2px; + cursor: pointer; + text-align: left; +} + +div.autocomplete ul li span.informal { + color: grey; +} + +/* clear search */ +.clearsearch { + position:absolute; + display:block; + margin-left:800px; +} +.clearsearch img{ + vertical-align:middle; + margin-right:10px; +} + +/* frame for search*/ +.frameforsearch { + background-color:#D1EDF3; + width:1000px; + height:550px; +} + +/* HR */ +hr{ + border: none; + background-color: #FFC200; + height: 2px; + width: 100%; +} +.hr_process{ + width: 80%; + text-align: center; +} + +/* TIPS */ +.newTipbox { + background-color: #deedf3; + margin: 0 auto 15px auto; +} + +.newTipContentbox { + color:#999999; + width: 100%; + font-weight:normal; + text-align:left; + padding:0 8px 0 8px; +} + +/**** TABRICATOR ****/ +.tabricator +{ + background: #93D1E4; + border: 1px solid #000; + display: inline-block; + /*height: auto!important;*/ + height: 650px; + width : 995px; + margin: 0 auto 1em; + /*max-width: 40em;*/ + padding: 5px 0 0 5px; +} + +.tabricator { + display: block; +} +.tabricator .trig { + background: #deedf3; + border: 1px solid #666; + border-bottom: 0; + cursor: pointer; + display: inline; + float: right; + margin: 2px 0 0 -1px; + padding: 2px 5px; + position: relative; + font-size: 14px; +} +.tabricator .trig:hover { + background: #f5f5f5; +} +.tabricator .open, +.tabricator .open:hover { + background: #fff; + margin-top: 0; + margin-bottom: -3px; + padding-bottom: 5px; + position: relative; + z-index: 1; +} +.tabricator .targ { + background: #fff; + border-top: 1px solid #666; + clear: both; + margin: 0 0 0 -5px; + overflow: auto; + padding: 5px; + height: 92%; + width: 99.5%; +} + + +/***** PROTOHUDS *****/ +.protohud { + font-size: 12px; + height: 0; + margin: 0; + padding: 1px 16px 0 0; + position: absolute; + top: 0px; + left: 20px; + right: 400px; + text-align: right; + z-index: 1000; +} +.protohud .trig { + display: inline-block; + border: 2px double #4a2c02; + border-top: 0; + color: #f5f5f5; + cursor: pointer; + font-weight: bold; + letter-spacing: 0.1em; + margin: 0 2px; + padding: 10px 5px 2px 5px; + position: relative; + top: -8px; + z-index: 1000; + background: #93D1E4; +} +.protohud .open { + background-color: #f1f1f1; + color: #000; + top: -1px; + padding: 10px 5px 2px 5px; +} +.protohud .trig:hover { + background-color: #f9f9f9; + color: #000; + outline: 0; +} +.protohud .trig:active, +.protohud .trig:focus { + outline: 0; +} +.protohud .targ { + background: rgba(255,255,255,0.8); + border: 1px solid #4b0802; + border-top: 0; + border-bottom-width: 3px; + bottom: 100%; + color: #4b0802; + left: 0; + margin: 0; + overflow: auto; + overflow-x: hidden; + padding: 0 5px 5px; + position: absolute; + right: 0; + text-align: left; + text-indent: 0; + z-index: 1; +} +.protohud dt {display: inline-block;} + +/* admin services board */ + +.admin_item { + width: 315px; + min-height: 80px; + /*margin: 0px 0px 15px;*/ + display: block; + float: left; + cursor: pointer; + /*background-color: #deedf3;*/ +} +.admin_item div +{ + height: 80px; + margin-top: 20px; +} +#admin_users { + background-image : url(../img/manage_users.gif); + background-repeat: no-repeat; + background-position : 2px top; + /*background: url(../img/manage_users.gif) no-repeat 2px top;*/ +} + +#admin_groups { + /*background: url(../img/manage_groups.gif) no-repeat 2px top;*/ + background-image : url(../img/manage_groups.gif); + background-repeat: no-repeat; + background-position : 2px top; +} + +#admin_architecture { +/* background: url(../img/manage_architecture.gif) no-repeat 2px top;*/ + background-image : url(../img/manage_architecture.gif); + background-repeat: no-repeat; + background-position : 2px top; +} +#admin_contacts { +/* background: url(../img/manage_architecture.gif) no-repeat 2px top;*/ + background-image : url(../img/manage_contacts.gif); + background-repeat: no-repeat; + background-position : 2px top; +} + +#admin_reopen_mail { + background-image : url(../img/file_status.gif); + background-repeat: no-repeat; + background-position : 2px top; +} + +#help_welcome_basket { + background-image : url(../img/); + background-repeat: no-repeat; + background-position : 2px top; + padding: 10px; + height: 120px; + width: 250px; + color: grey; +} + +#view_history { + /*background: url(../img/view_history.gif) no-repeat 2px top;*/ + background-image : url(../img/view_history.gif); + background-repeat: no-repeat; + background-position : 2px top; +} + +#xml_param_services { + /*background: url(../img/manage_structures2.gif) no-repeat 2px top;*/ + background-image : url(../img/manage_structures2.gif); + background-repeat: no-repeat; + background-position : 2px top; +} + +#admin_types { + background: url(../img/manage_doctypes.gif) no-repeat 2px top; + +} + +#admin_structures { + background: url(../img/manage_structures.gif) no-repeat 2px top; + +} + +#admin_subfolders { + background: url(../img/manage_subfolders.gif) no-repeat 2px top; + +} +#admin_actions { + background-image : url(../img/manage_actions.gif); + background-repeat: no-repeat; + background-position : 2px top; + /*background: url(../img/manage_users.gif) no-repeat 2px top;*/ +} +#admin_status { + background-image : url(../img/manage_status.gif); + background-repeat: no-repeat; + background-position : 2px top; + /*background: url(../img/manage_users.gif) no-repeat 2px top;*/ +} +#view_tree_types { + background: url(../img/manage_architecture.gif) no-repeat 2px top; + +} + +.admin_subtitle +{ + margin-top: 10px; + margin-bottom: 10px; + height: 30px; + /*color: #1B91BA;*/ + /*text-decoration: underline;*/ + font-weight: bold; + font-size: 18px; + /*background-color: #CFD3FF;*/ + text-align: center; + background-color: #deedf3; +} +/*#admin_modules, #admin_apps +{ + float: left; + margin-bottom: 10px; +}*/ + +/* Modal */ +div.lb1-layer{ +text-align:center; +position:absolute; +display:none; +/*background:url(../img/lb1/fond2.png);*/ +background:white;/*#555555;*/ +/*background-color: transparent;*/ +/*z-index:1000;*/ +top:0; +left:0; +/*width: 100%; +height: 100%;*/ +} +.modal{ + position:absolute; + display:block; + /*z-index:3000;*/ + margin-left:auto; + margin-right:auto; + background-color:white; + border: 3px solid ; + padding: 10px; + overflow: auto; +} + +.modal h2 { +margin-bottom: 15px; +} + +#content_process +{ + text-align: left; +} +/*********** ScrollBox *********************/ +.scrollbox_scrollbar { +float:left; +width:10px; +height:380px; +padding:0; +margin:0; +background: url(../img/scrollbox_blank.gif) top left no-repeat; + +} + + +.scrollbox_up_button { +background: url(../img/scrollbox_up.png) no-repeat scroll right top; + _background:none; + _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/scrollbox_up.png', sizingMethod='crop'); +height:7px; + +width:10px; +display:block; + +margin:0; +padding:0; + cursor:pointer; +} + +.scrollbox_down_button { +background:url(img/down.png) no-repeat scroll right top; + _background:none; + _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/scrollbox_down.png', sizingMethod='crop'); +height:7px; +width:10px; +display:block; +margin:0; +padding:0; + cursor:pointer; +} +.scrollbox_handle { + background:url(../img/scrollbox_middle.png) top left no-repeat; + _background:none; + _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/scrollbox_middle.png', sizingMethod='crop'); + width:10px; + height:10px; + display:block; + margin:0; + padding:0; + cursor:pointer; +} + +#hist_courrier_frame .listing +{ + width: 100%; +} +#hist_action_frame .listing +{ + width: 550px; +} + +.img_upload_doc +{ + position:absolute; + margin-left:50px; +} + + +#content h1 a.back { + float: right; + display: block; + /*margin-top: 1.1em;*/ + font-size: 14px; + color:#666; + text-align:right; +} +.list_previous{ + width:33%; + text-align:left; + /*position:relative;*/ + float:left; +} + +.list_next{ + width:33%; + text-align:right; + float:right; + display:inline; +} + +.list_show_page +{ + width:33%; + /*float:left;*/ + text-align:center; + position:relative; + display:inline; +} + +.thisword +{ + background-color: #ffff59; + color:#000000; +} +#welcome_box_right{ + border: 1px; + float: right; + width: 350px; + margin: 0 10px 0 13px; + display:inline; + /*position:absolute;*/ +} +#welcome_box_right_notes{ + border: 1px; + float: left; + width: 600px; + margin: 0 10px 0 13px; + display:block; +} +#welcome_box_left_quick_lunch{ + border: 1px; + float: left; + width: 600px; + margin: 0 10px 0 13px; + /*display:relative;*/ +} +#welcome_box_left_text{ + border: 100px; + /*float: left;*/ + width: 97%; + margin: 0 10px 0 13px; + /*display:relative;*/ +} + +.scroll_div +{ + overflow: auto; +} + +input.button_search_adv { + border: 1px solid #44b2bf; + color: #007583; + background: white url(../img/search_button.gif) top left repeat-x; + cursor: pointer; + width: 100px; + height: 75px; + padding: 0.2em 0.1em; + text-align: center; +} +input.button_search_adv_text { + border: 1px solid #44b2bf; + color: #007583; + cursor: pointer; + width: 100px; + text-align: center; +} + +#query_name +{ + width: 150px; +} + +/*Automplete*/ +div.autocomplete { + position: absolute; + width: 500px; + background-color: white; + border: 1px solid #888; + margin: 0px; + padding: 0px; +} + +div.autocomplete ul { + list-style-type: none; + margin: 0px; + padding: 0px; + max-height: 20em; + overflow: auto; +} + +div.autocomplete ul li.selected { + background-color: #ffb; +} + +div.autocomplete ul li { + /*background-color: #DEEDF3;*/ + list-style-type:none; + display: block; + margin: 0; + padding: 2px; + cursor: pointer; + text-align: left; +} + +div.autocomplete ul li span.informal { + color: grey; +} +/*****/ + +#frmcontact p, #frmuserdata p +{ + margin-bottom: 4px; +} + + + +.zero_padding td { +padding : 4px 3px 1px 1px; +} + +.popup_content{ +margin-left:10px; +margin-top:10px; +} + +.block .check +{ + background-color: #deedf3; +} + +.indexing_error +{ + font-size: 14px; + color: #ea0000; + font-weight: bold; + text-align: center; +} + +#index_doc select +{ + width:206px; +} + +#frmcontact .indexing_field +{ + text-align: right; +} + +#frmcontact select +{ + width:206px; +} + + +.listing td.picto { + width: 50px; + margin: 0px; + padding: 5px 0px; +} + +td.picto, th.picto, td.action { + text-align: center; + padding: 0 0.2em 0; + width: 4%; +} + diff --git a/maarch_entreprise/trunk/definition_mail_categories.php b/maarch_entreprise/trunk/definition_mail_categories.php new file mode 100644 index 0000000000000000000000000000000000000000..72e3e78727187a6665f3a7bb0ab3c8cc40c4795f --- /dev/null +++ b/maarch_entreprise/trunk/definition_mail_categories.php @@ -0,0 +1,740 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Contains data structure used to get the proper index for a given category, to checks data and to loads in db (indexing, process, validation, details, ...) and the function to access it +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup apps +*/ + +///////////////////// Pattern to check dates +if($_SESSION['config']['databasetype'] == "SQLSERVER") +{ + $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; +} +else // MYSQL & POSTGRESQL +{ + $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; +} + +/* + * Categories are described in a global variable : $_ENV['categories'] + * $_ENV['categories'][category_id] + * ['img_cat'] : url of the icon category + * [id_field] // id_field must be an identifier of a field in the form and in the database + * ['type_form'] = Form type field: 'integer', 'date', 'string', 'yes_no', 'special' + * ['type_field'] = Database type field :'integer', 'date', 'string', 'yes_no', 'special' + * ['mandatory'] = true or false + * ['label'] = label of the field + * ['img'] = Image url (optional) + * ['table'] = keyword : 'res' = field in the res_x like table + * 'coll_ext' = field in collection ext table (ex : mlb_ext_coll) + * 'none' = field in no table, only in form for special functionnality + * 'special' = field in other table, handled in the code + * ['modify'] = true or false (optional) : can we modify this field (used in details.php) + * ['form_show'] = keyword (used with modify = true) + * 'select' = displayed in a select item + * 'textfield' = displayed in text input + * 'date' = displayed in a date input (with calendar activated) + * ['other_cases'] // particular cases handled in code + * [identifier] // keyword handled in the code + * ['type_form'] = Form type field:'integer', 'date', 'string', 'yes_no', 'special' + * ['type_field'] = Databse type field :'integer', 'date', 'string', 'yes_no', 'special' + * ['mandatory'] = true or false + * ['label'] = label of the field + * ['table'] = keyword : 'res' = field in the res_x like table + * 'coll_ext' = field in collection ext table (ex : mlb_ext_coll) + * 'none' = field in no table, only in form for special functionnality + * 'special' = field in aother table, handled in the code + * ['modify'] = true or false (optional) : can we modify this field (used in details.php) + * ['form_show'] = keyword (used with modify = true) + * 'select' = displayed in a select item + * 'textfield' = keyword : 'date' = date input field + * 'date' = displayed in a date input (with calendar activated) + * + */ + +/**************************** Categories descriptions******************************/ +$_ENV['categories'] = array(); + +///////////////////////////// INCOMING //////////////////////////////////////////////// +$_ENV['categories']['incoming'] = array(); +$_ENV['categories']['incoming']['img_cat'] = $_SESSION['config']['businessappurl'].'img/cat_doc_incoming.gif'; +$_ENV['categories']['incoming']['other_cases'] = array(); +$_ENV['categories']['incoming']['priority'] = array( 'type_form' => 'integer', 'type_field' => 'integer','mandatory' => true, 'label' => _PRIORITY, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/mini_type.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['incoming']['type_id'] = array('type_form' => 'integer', 'type_field' => 'integer', 'mandatory' => true, 'label' => _DOCTYPE_MAIL, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/mini_type.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['incoming']['doc_date'] = array( 'type_form' => 'date', 'type_field' => 'date', 'mandatory' => true, 'label' => _MAIL_DATE, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/date_arr.gif', 'modify' => true, 'form_show' => 'date'); +$_ENV['categories']['incoming']['admission_date'] = array( 'type_form' => 'date', 'type_field' => 'date', 'mandatory' => true, 'label' => _RECEIVING_DATE, 'table' => 'coll_ext', 'img' => $_SESSION['config']['businessappurl'].'img/date_arriv.gif', 'modify' => true, 'form_show' => 'date'); +$_ENV['categories']['incoming']['nature_id'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _NATURE, 'table' => 'coll_ext', 'img' => $_SESSION['config']['businessappurl'].'img/nature_send.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['incoming']['subject'] = array('type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _SUBJECT, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/object.gif', 'modify' => true, 'form_show' => 'textfield'); +$_ENV['categories']['incoming']['process_limit_date_use'] = array('type_form' => 'radio', 'mandatory' => true, 'label' => _PROCESS_LIMIT_DATE_USE, 'table' => 'none', 'values' => array('Y', 'N'), 'modify' => false); +$_ENV['categories']['incoming']['other_cases']['process_limit_date'] = array( 'type_form' => 'date', 'type_field' => 'date', 'label' => _PROCESS_LIMIT_DATE, 'table' => 'coll_ext', 'img' => $_SESSION['config']['businessappurl'].'img/date_limit.gif' , 'modify' => false); +$_ENV['categories']['incoming']['type_contact'] = array( 'type_form' => 'radio', 'mandatory' => true, 'label' => _SHIPPER_TYPE, 'table' => 'none', 'values' => array('internal', 'external'), 'modify' => false); +$_ENV['categories']['incoming']['other_cases']['contact'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _SHIPPER, 'table' => 'coll_ext', 'special' => 'exp_user_id,exp_contact_id', 'modify' => false); + + +///////////////////////////// OUTGOING //////////////////////////////////////////////// +$_ENV['categories']['outgoing'] = array(); +$_ENV['categories']['outgoing']['img_cat'] = $_SESSION['config']['businessappurl'].'img/cat_doc_outgoing.gif'; +$_ENV['categories']['outgoing']['other_cases'] = array(); +$_ENV['categories']['outgoing']['priority'] = array( 'type_form' => 'integer', 'type_field' => 'integer', 'mandatory' => true, 'label' => _PRIORITY, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/mini_type.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['outgoing']['type_id'] = array('type_form' => 'integer', 'type_field' => 'integer', 'mandatory' => true, 'label' => _DOCTYPE_MAIL, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/mini_type.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['outgoing']['doc_date'] = array( 'type_form' => 'date', 'type_field' => 'date', 'mandatory' => true, 'label' => _MAIL_DATE, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/small_calend.gif', 'modify' => true, 'form_show' => 'date'); +$_ENV['categories']['outgoing']['nature_id'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _NATURE, 'table' => 'coll_ext', 'img' => $_SESSION['config']['businessappurl'].'img/nature_send.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['outgoing']['subject'] = array('type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _SUBJECT, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/object.gif', 'modify' => true, 'form_show' => 'textfield'); +$_ENV['categories']['outgoing']['other_cases']['chrono_number'] = array('type_form' => 'integer', 'type_field' => 'integer', 'mandatory' => true, 'label' => _CHRONO_NUMBER, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/object.gif', 'modify' => false, 'form_show' => 'textfield'); +$_ENV['categories']['outgoing']['process_limit_date_use'] = array('type_form' => 'radio', 'mandatory' => true, 'label' => _PROCESS_LIMIT_DATE_USE, 'table' => 'none', 'values' => array('Y', 'N'), 'modify' => false); +$_ENV['categories']['outgoing']['other_cases']['process_limit_date'] = array( 'type_form' => 'date', 'type_field' => 'date', 'label' => _PROCESS_LIMIT_DATE, 'table' => 'coll_ext', 'img' => $_SESSION['config']['businessappurl'].'img/date_limit.gif', 'modify' => false, 'form_show' => 'date'); +$_ENV['categories']['outgoing']['type_contact'] = array( 'type_form' => 'radio', 'mandatory' => true, 'label' => _DEST_TYPE, 'table' => 'none', 'values' => array('internal', 'external'), 'modify' => false); +$_ENV['categories']['outgoing']['other_cases']['contact'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _DEST, 'table' => 'coll_ext', 'special' => 'dest_user_id,dest_contact_id', 'modify' => false); + + +///////////////////////////// INTERNAL //////////////////////////////////////////////// +$_ENV['categories']['internal'] = array(); +$_ENV['categories']['internal']['img_cat'] = $_SESSION['config']['businessappurl'].'img/cat_doc_internal.gif'; +$_ENV['categories']['internal']['other_cases'] = array(); +$_ENV['categories']['internal']['priority'] = array('type_form' => 'integer', 'type_field' => 'integer', 'mandatory' => true, 'label' => _PRIORITY, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/mini_type.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['internal']['type_id'] = array('type_form' => 'integer', 'type_field' => 'integer', 'mandatory' => true, 'label' => _DOCTYPE_MAIL, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/mini_type.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['internal']['doc_date'] = array( 'type_form' => 'date', 'type_field' => 'date', 'mandatory' => true, 'label' => _MAIL_DATE, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/date_arr.gif', 'modify' => true, 'form_show' => 'date'); +$_ENV['categories']['internal']['nature_id'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _NATURE, 'table' => 'coll_ext', 'img' => $_SESSION['config']['businessappurl'].'img/nature_send.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['internal']['subject'] = array('type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _SUBJECT, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/object.gif', 'modify' => true, 'form_show' => 'textfield'); +$_ENV['categories']['internal']['process_limit_date_use'] = array('type_form' => 'radio', 'mandatory' => true, 'label' => _PROCESS_LIMIT_DATE_USE, 'table' => 'none', 'values' => array('Y', 'N'), 'modify' => false); +$_ENV['categories']['internal']['other_cases']['process_limit_date'] = array( 'type_form' => 'date', 'type_field' => 'date', 'label' => _PROCESS_LIMIT_DATE, 'table' => 'coll_ext', 'img' => $_SESSION['config']['businessappurl'].'img/date_limit.gif', 'modify' => false); +$_ENV['categories']['internal']['type_contact'] = array( 'type_form' => 'radio', 'mandatory' => true, 'label' => _DEST_TYPE, 'table' => 'none', 'values' => array('internal', 'external'), 'modify' => false); +$_ENV['categories']['internal']['other_cases']['contact'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _DEST, 'table' => 'coll_ext', 'special' => 'dest_user_id,dest_contact_id', 'modify' => false); + +/////////////////////////////MARKET DOCUMENT//////////////////////////////////////////////// +$_ENV['categories']['market_document'] = array(); +$_ENV['categories']['market_document']['img_cat'] = $_SESSION['config']['businessappurl'].'img/cat_doc_market.gif'; +$_ENV['categories']['market_document']['other_cases'] = array(); +$_ENV['categories']['market_document']['type_id'] = array('type_form' => 'integer', 'type_field' => 'integer', 'mandatory' => true, 'label' => _DOCTYPE, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/mini_type.gif', 'modify' => true, 'form_show' => 'select'); +$_ENV['categories']['market_document']['doc_date'] = array( 'type_form' => 'date', 'type_field' => 'date', 'mandatory' => true, 'label' => _DOC_DATE, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/small_calend.gif', 'modify' => true, 'form_show' => 'date'); +$_ENV['categories']['market_document']['subject'] = array('type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _SUBJECT, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/object.gif', 'modify' => true, 'form_show' => 'textfield'); +$_ENV['categories']['market_document']['author'] = array('type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _AUTHOR, 'table' => 'res', 'img' => $_SESSION['config']['businessappurl'].'img/author.gif', 'modify' => true, 'form_show' => 'textfield'); + + +/////////////////////////////MODULES SPECIFIC//////////////////////////////////////////////// +$core = new core_tools(); +if($core->is_module_loaded('entities')) +{ + //Entities module (incoming) + $_ENV['categories']['incoming']['destination'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _DEPARTMENT_DEST, 'table' => 'res', 'img' => $_SESSION['urltomodules'].'entities/img/manage_entities_b_small.gif', 'modify' => false, 'form_show' => 'select'); + $_ENV['categories']['incoming']['other_cases']['diff_list'] = array( 'type' => 'special', 'mandatory' => true, 'label' => _DIFF_LIST,'table' => 'special'); + + // Entities module (outgoing) + $_ENV['categories']['outgoing']['destination'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _DEPARTMENT_EXP, 'table' => 'res', 'img' => $_SESSION['urltomodules'].'entities/img/manage_entities_b_small.gif', 'modify' => false, 'form_show' => 'select'); + $_ENV['categories']['outgoing']['other_cases']['diff_list'] = array( 'type' => 'special', 'mandatory' => true, 'label' => _DIFF_LIST,'table' => 'special'); + + // Entities module (internal) + $_ENV['categories']['internal']['destination'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _DEPARTMENT_DEST, 'table' => 'res', 'img' => $_SESSION['urltomodules'].'entities/img/manage_entities_b_small.gif', 'modify' => false, 'form_show' => 'select'); + $_ENV['categories']['internal']['other_cases']['diff_list'] = array( 'type' => 'special', 'mandatory' => true, 'label' => _DIFF_LIST,'table' => 'special'); +} +if($core->is_module_loaded('physical_archive')) +{ + //Physical Archive (incoming) + $_ENV['categories']['incoming']['other_cases']['arbox_id'] = array( 'type_form' => 'interger', 'type_field' => 'integer', 'mandatory' => true, 'label' => _BOX_ID, 'table' => 'res', 'img' => $_SESSION['urltomodules'].'physical_archive/img/pa_boxes.gif', 'modify' => true, 'form_show' => 'select'); + // Physical Archive (outgoing) + $_ENV['categories']['outgoing']['other_cases']['arbox_id'] = array( 'type_form' => 'interger', 'type_field' => 'integer', 'mandatory' => true, 'label' => _BOX_ID, 'table' => 'res', 'img' => $_SESSION['urltomodules'].'physical_archive/img/pa_boxes.gif', 'modify' => true, 'form_show' => 'select'); + // Physical Archive (internal) + $_ENV['categories']['internal']['other_cases']['arbox_id'] = array( 'type_form' => 'interger', 'type_field' => 'integer', 'mandatory' => true, 'label' => _BOX_ID, 'table' => 'res', 'img' => $_SESSION['urltomodules'].'physical_archive/img/pa_boxes.gif', 'modify' => true, 'form_show' => 'select'); + // Physical Archive (market_document) + $_ENV['categories']['market_document']['other_cases']['arbox_id'] = array( 'type_form' => 'interger', 'type_field' => 'integer', 'mandatory' => true, 'label' => _BOX_ID, 'table' => 'res', 'img' => $_SESSION['urltomodules'].'physical_archive/img/pa_boxes.gif', 'modify' => true, 'form_show' => 'select'); +} + +if($core->is_module_loaded('folder')) +{ + //Folder (incoming) + $_ENV['categories']['incoming']['other_cases']['market'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => false, 'label' => _MARKET, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/market.gif', 'modify' => true, 'form_show' => 'autocomplete'); + $_ENV['categories']['incoming']['other_cases']['project'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => false, 'label' => _PROJECT, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/doc_project.gif', 'modify' => true, 'form_show' => 'autocomplete'); + //Folder (outgoing) + $_ENV['categories']['outgoing']['other_cases']['market'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => false, 'label' => _MARKET, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/market.gif', 'modify' => true, 'form_show' => 'autocomplete'); + $_ENV['categories']['outgoing']['other_cases']['project'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _PROJECT, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/doc_project.gif', 'modify' => true, 'form_show' => 'autocomplete'); + //Folder (internal) + $_ENV['categories']['internal']['other_cases']['market'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => false, 'label' => _MARKET, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/market.gif', 'modify' => true, 'form_show' => 'autocomplete'); + $_ENV['categories']['internal']['other_cases']['project'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => false, 'label' => _PROJECT, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/doc_project.gif', 'modify' => true, 'form_show' => 'autocomplete'); + //Folder (market_document) + $_ENV['categories']['market_document']['other_cases']['market'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => false, 'label' => _MARKET, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/market.gif', 'modify' => true, 'form_show' => 'autocomplete'); + $_ENV['categories']['market_document']['other_cases']['project'] = array( 'type_form' => 'string', 'type_field' => 'string', 'mandatory' => true, 'label' => _PROJECT, 'table' => 'none', 'img' => $_SESSION['config']['businessappurl'].'img/doc_project.gif', 'modify' => true, 'form_show' => 'autocomplete'); +} + + +/************************* END *************************************************************/ + +/** +* Gets the index of a given res_id in an array +* +* @param $coll_id string Collection identifier +* @param $res_id string Resource identifier +* @param $mode string 'full' : fills the array with maximum data (id, value, show_value,etc...), 'minimal' the array contains only the value or 'form" the array contains the data to be displayed in a form +* @param $params array optional parameters +* $params['img_'.field_id] = true (gets the img url in the 'full' mode array for the field_id), false (no img for the field_id ) +* @return Array Structure different in 'full' mode or in 'minimal' mode +* mode 'full' : $data[field_id] field_id exemple: 'priority' +* ['value'] : value of the field in the database +* ['show_value'] : value to display +* ['label'] : label to display +* ['display'] : type of display (only 'textinput' and 'textarea' for the moment) +* ['img'] : url of an icon to display (optional) +* mode 'minimal' : $data[field_id] = value of the field in the database +* mode 'form' : $data[field_id] field_id exemple: 'priority' +* ['value'] : value of the field in the database +* ['show_value'] : value to display +* ['label'] : label to display +* ['display'] : type of display (only 'textinput' and 'textarea' for the moment) +* ['img'] : url of an icon to display (optional) +* ['readonly'] : true or false +* ['field_type'] : keyword 'date' = date input field with calendar + * 'textfield' = text input field + * 'select' = select field +* ['select'] : array of options items (only if field_type = 'select') +* [$i]['id'] : option value +* ['label'] : option text +*/ +function get_general_data($coll_id, $res_id, $mode, $params = array()) +{ + require_once($_SESSION['pathtocoreclass']."class_security.php"); + $sec =new security(); + $view = $sec->retrieve_view_from_coll_id($coll_id); + if(empty($view)) + { + $view = $table; + } + $db = new dbquery(); + $db->connect(); + $db2 = new dbquery(); + $db2->connect(); + $db->query('select category_id from '.$view.' where res_id = '.$res_id); + $res = $db->fetch_object(); + $cat_id = $res->category_id; + $fields = ''; + $data = array(); + $arr = array(); + + // First we load the category_id + if($mode == 'full' || 'form') + { + if($params['img_category_id'] == true) + { + $data['category_id'] = array( 'value' => $res->category_id, 'show_value' => $_SESSION['mail_categories'][$res->category_id], 'label' => _CATEGORY, 'display' => 'textinput', 'img' => $_SESSION['config']['businessappurl'].'img/picto_change.gif'); + } + else + { + $data['category_id'] = array( 'value' => $res->category_id, 'show_value' => $_SESSION['mail_categories'][$res->category_id], 'label' => _CATEGORY, 'display' => 'textinput'); + } + } + else + { + $data['category_id'] = $res->category_id; + } + //Then we browse the $_ENV['categories'] array to get the other indexes + foreach(array_keys($_ENV['categories'][$cat_id]) as $field) + { + // Normal cases : fields are put in a string to make a query + if($field <> 'process_limit_date_use' && $field <> 'other_cases' && $field <> 'type_contact' && $field <> 'img_cat') + { + $fields .= $field.','; + if(($mode == 'full' || $mode == 'form') && (!isset($params['show_'.$field]) || $params['show_'.$field] == true)) + { + if($params['img_'.$field] == true) + { + $data[$field] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id][$field]['label'], 'display' => 'textinput', 'img' =>$_ENV['categories'][$cat_id][$field]['img']); + } + else + { + $data[$field] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id][$field]['label'], 'display' => 'textinput'); + } + array_push($arr, $field); + if($field == 'subject') + { + $data[$field]['display'] = 'textarea'; + } + $data[$field]['readonly'] = true; + if($mode == 'form' && $_ENV['categories'][$cat_id][$field]['modify']) + { + $data[$field]['readonly'] = false; + $data[$field]['field_type'] = $_ENV['categories'][$cat_id][$field]['form_show']; + if($data[$field]['field_type'] == 'select') + { + $data[$field]['select']= array(); + if($field == 'type_id') + { + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_types.php"); + $type = new types(); + $data[$field]['select'] = $type->getArrayStructTypes($coll_id); + } + else if($field == 'destination') + { + //require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_entities.php"); + // TO DO : get the entities list + } + else if($field == 'nature_id') + { + foreach(array_keys($_SESSION['mail_natures']) as $nature) + { + array_push($data[$field]['select'], array('ID' => $nature, 'LABEL' => $_SESSION['mail_natures'][$nature])); + } + } + else if($field == 'priority') + { + foreach(array_keys($_SESSION['mail_priorities']) as $prio) + { + array_push($data[$field]['select'], array('ID' => $prio, 'LABEL' => $_SESSION['mail_priorities'][$prio])); + } + } + } + } + } + else if($mode == 'minimal' && (!isset($params['show_'.$field]) || $params['show_'.$field] == true)) + { + $data[$field] = ''; + array_push($arr, $field); + } + } + } + // Special cases : fields are put in a string to make a query + // Process limit date + if(isset($_ENV['categories'][$cat_id]['other_cases']['process_limit_date'] ) && count($_ENV['categories'][$cat_id]['other_cases']['process_limit_date']) > 0 && (!isset($params['show_process_limit_date']) || $params['show_process_limit_date'] == true)) + { + $fields .= 'process_limit_date,'; + if($mode == 'full' || 'form') + { + if($params['img_process_limit_date'] == true) + { + $data['process_limit_date'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['label'], 'display' => 'textinput', 'img' => $_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['img'] ); + } + else + { + $data['process_limit_date'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['process_limit_date']['label'], 'display' => 'textinput' ); + } + $data['process_limit_date']['readonly'] = true; + if($mode == 'form' && $_ENV['categories'][$cat_id]['process_limit_date']['modify']) + { + $data['process_limit_date']['field_type'] = $_ENV['categories'][$cat_id]['process_limit_date']['form_show']; + $data['process_limit_date']['readonly'] = false; + } + } + else + { + $data['process_limit_date'] = ''; + $data['process_limit_date_use'] = false; + } + array_push($arr, 'process_limit_date'); + } + // Contact + if(isset($_ENV['categories'][$cat_id]['other_cases']['contact'] ) && count($_ENV['categories'][$cat_id]['other_cases']['contact']) > 0 && (!isset($params['show_contact']) || $params['show_contact'] == true)) + { + $fields .= $_ENV['categories'][$cat_id]['other_cases']['contact']['special'].','; + if(preg_match('/,/', $_ENV['categories'][$cat_id]['other_cases']['contact']['special'] )) + { + $arr_tmp = preg_split('/,/', $_ENV['categories'][$cat_id]['other_cases']['contact']['special']); + } + else + { + $arr_tmp = array($_ENV['categories'][$cat_id]['other_cases']['contact']['special']); + } + for($i=0;$i<count($arr_tmp);$i++) + { + if($mode == 'full' || $mode == 'form') + { + $data[$arr_tmp[$i]] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['contact']['label'], 'display' => 'textinput' ); + $data[$arr_tmp[$i]]['readonly'] = true; + if($mode == 'form' && $_ENV['categories'][$cat_id][$arr_tmp[$i]]['modify']) + { + $data[$arr_tmp[$i]]['field_type'] = $_ENV['categories'][$cat_id][$arr_tmp[$i]]['form_show']; + $data[$arr_tmp[$i]]['readonly'] = false; + } + } + array_push($arr, $arr_tmp[$i]); + } + + if($mode == 'minimal') + { + $data['contact'] = ''; + } + + } + // Market + if(isset($_ENV['categories'][$cat_id]['other_cases']['market'] ) && count($_ENV['categories'][$cat_id]['other_cases']['market']) > 0 && (!isset($params['show_market']) || $params['show_market'] == true)) + { + //echo 'market '; + $fields .= 'folders_system_id,'; + if($mode == 'full' || $mode == 'form') + { + if($params['img_project'] == true) + { + $data['project'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['project']['label'], 'display' => 'textinput', 'img' => $_ENV['categories'][$cat_id]['other_cases']['project']['img']); + } + else + { + $data['project'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['project']['label'], 'display' => 'textinput'); + } + if($params['img_market'] == true) + { + $data['market'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['market']['label'], 'display' => 'textinput', 'img' => $_ENV['categories'][$cat_id]['other_cases']['market']['img']); + } + else + { + $data['market'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['market']['label'], 'display' => 'textinput'); + } + $data['market']['readonly'] = true; + if($mode == 'form' && $_ENV['categories'][$cat_id]['other_cases']['market']['modify']) + { + $data['market']['field_type'] = $_ENV['categories'][$cat_id]['other_cases']['market']['form_show']; + $data['market']['readonly'] = false; + } + $data['project']['readonly'] = true; + if($mode == 'form' && $_ENV['categories'][$cat_id]['other_cases']['project']['modify']) + { + $data['project']['field_type'] = $_ENV['categories'][$cat_id]['other_cases']['project']['form_show']; + $data['project']['readonly'] = false; + } + } + else + { + $data['market'] = ''; + $data['project'] = ''; + } + array_push($arr, 'market'); + } + // Project + if(isset($_ENV['categories'][$cat_id]['other_cases']['project'] ) && count($_ENV['categories'][$cat_id]['other_cases']['project']) > 0 && (!isset($params['show_project']) || $params['show_project'] == true) ) + { + //echo 'project'; + if(!isset($_ENV['categories'][$cat_id]['other_cases']['market'] ) || count($_ENV['categories'][$cat_id]['other_cases']['market']) == 0) + { + + $fields .= 'folders_system_id,'; + array_push($arr, 'project'); + } + if($mode == 'full' || $mode == 'form') + { + if($params['img_project'] == true) + { + $data['project'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['project']['label'], 'display' => 'textinput', 'img' => $_ENV['categories'][$cat_id]['other_cases']['project']['img']); + } + else + { + $data['project'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['project']['label'], 'display' => 'textinput'); + } + $data['project']['readonly'] = true; + if($mode == 'form' && $_ENV['categories'][$cat_id]['other_cases']['project']['modify']) + { + $data['project']['field_type'] = $_ENV['categories'][$cat_id]['other_cases']['project']['form_show']; + $data['project']['readonly'] = false; + } + } + else + { + $data['project'] = ''; + } + } + // Arboxes + if(isset($_ENV['categories'][$cat_id]['other_cases']['arbox_id'] ) && count($_ENV['categories'][$cat_id]['other_cases']['arbox_id']) > 0 && (!isset($params['show_arbox_id']) || $params['show_arbox_id'] == true)) + { + $fields .= 'arbox_id,'; + if($mode == 'full' || $mode == 'form') + { + if($params['img_arbox_id'] == true) + { + $data['arbox_id'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['label'], 'display' => 'textinput', 'img' => $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['img']); + } + else + { + $data['arbox_id'] = array( 'value' => '', 'show_value' => '', 'label' => $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['label'], 'display' => 'textinput' ); + } + $data['arbox_id']['readonly'] = true; + if($mode == 'form' && $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['modify']) + { + $data['arbox_id']['field_type'] = $_ENV['categories'][$cat_id]['other_cases']['arbox_id']['form_show']; + $data['arbox_id']['readonly'] = false; + $data['arbox_id']['select'] = array(); + $db->query("select arbox_id, title from ".$_SESSION['tablename']['ar_boxes']." where status ='NEW' order by title"); + while($res = $db->fetch_object()) + { + array_push($data['arbox_id']['select'], array('ID' => $res->arbox_id, 'LABEL' => $res->title.' ('.$res->arbox_id.')')); + } + } + } + else + { + $data['arbox_id'] = ''; + } + array_push($arr, 'arbox_id'); + } + + if($mode == 'full') + { + $fields = preg_replace('/,$/', ',type_label', $fields); + } + else + { + $fields = preg_replace('/,$/', '', $fields); + } + // Query + $db->query("select category_id,".$fields." from ".$view." where res_id = ".$res_id); + //$db->show(); + //$db->show_array($arr); + $line = $db->fetch_object(); + // We fill the array with the query result + for($i=0; $i < count($arr);$i++) + { + if($mode == 'full' || $mode == 'form') + { + // Normal Cases + $data[$arr[$i]]['value'] = $line->$arr[$i]; + $data[$arr[$i]]['show_value'] = $line->$arr[$i]; + if($_ENV['categories'][$cat_id][$arr[$i]]['type_field'] == 'date') + { + $data[$arr[$i]]['show_value'] = $db->format_date_db($line->$arr[$i], false); + } + elseif($_ENV['categories'][$cat_id]['other_cases'][$arr[$i]]['type_field'] == 'date') + { + $data[$arr[$i]]['show_value'] = $db->format_date_db($line->$arr[$i], false); + } + elseif($_ENV['categories'][$cat_id][$arr[$i]]['type_field'] == 'string') + { + $data[$arr[$i]]['show_value'] = $db->show_string($line->$arr[$i], true ); + } + // special cases : + if($arr[$i] == 'priority') + { + $data[$arr[$i]]['show_value'] = $_SESSION['mail_priorities'][$line->$arr[$i]]; + } + elseif($arr[$i] == 'nature_id') + { + $data[$arr[$i]]['show_value'] = $_SESSION['mail_natures'][$line->$arr[$i]]; + } + elseif($arr[$i] == 'type_id') + { + $data[$arr[$i]]['show_value'] = $db->show_string($line->type_label); + } + // Arboxe + elseif($arr[$i] == 'arbox_id') + { + if(isset($line->arbox_id) && !empty($line->arbox_id)) + { + $db2->query('select title from '.$_SESSION['tablename']['ar_boxes']." where arbox_id = ".$line->arbox_id.""); + + $res = $db2->fetch_object(); + $data[$arr[$i]]['show_value'] = $db->show_string($res->title.' ('.$line->arbox_id.')'); + } + } + // Contact + elseif($arr[$i] == 'dest_user_id' || $arr[$i] == 'exp_user_id') + { + if(!empty($line->$arr[$i])) + { + $db2->query('select lastname, firstname from '.$_SESSION['tablename']['users']." where user_id = '".$line->$arr[$i]."'"); + $res = $db2->fetch_object(); + $data[$arr[$i]]['show_value'] = $res->lastname.', '.$res->firstname.' ('.$line->$arr[$i].')'; + $data[$arr[$i]]['addon'] = '<a href="#" id="contact_card" title="'._CONTACT_CARD.'" onclick="window.open(\''.$_SESSION ['config']['businessappurl'].'user_info.php?id='.$line->$arr[$i].'\', \'contact_info\', \'height=450, width=600,scrollbars=yes,resizable=yes\');" ><img src="'.$_SESSION['config']['businessappurl'].'img/my_contacts_off.gif" alt="'._CONTACT_CARD.'" /></a>'; + } + else + { + unset($data[$arr[$i]]); + } + } + elseif($arr[$i] == 'dest_contact_id' || $arr[$i] == 'exp_contact_id') + { + if(!empty($line->$arr[$i])) + { + $db2->query('select is_corporate_person, lastname, firstname, society from '.$_SESSION['tablename']['contacts']." where enabled = 'Y' and contact_id = ".$line->$arr[$i].""); + $res = $db2->fetch_object(); + if($res->is_corporate_person == 'Y') + { + $data[$arr[$i]]['show_value'] = $res->society; + } + else + { + $data[$arr[$i]]['show_value'] = $res->lastname.', '.$res->firstname; + if(!empty($res->society)) + { + $data[$arr[$i]]['show_value'] .= ' ('.$res->society.')'; + } + } + $data[$arr[$i]]['addon'] = '<a href="#" id="contact_card" title="'._CONTACT_CARD.'" onclick="window.open(\''.$_SESSION ['config']['businessappurl'].'contact_info.php?mode=view&id='.$line->$arr[$i].'\', \'contact_info\', \'height=600, width=600,scrollbars=yes,resizable=yes\');" ><img src="'.$_SESSION['config']['businessappurl'].'img/my_contacts_off.gif" alt="'._CONTACT_CARD.'" /></a>'; + } + else + { + unset($data[$arr[$i]]); + } + } + // Folder : market + elseif($arr[$i] == 'market' && isset($line->folders_system_id) && !empty($line->folders_system_id)) + { + $db2->query('select folder_name, subject, folders_system_id, parent_id from '.$_SESSION['tablename']['fold_folders']." where status <> 'DEL' and folders_system_id = ".$line->folders_system_id." and folder_level = 2"); + + + if($db2->nb_result() > 0) + { + $res = $db2->fetch_object(); + $data['market']['show_value'] = $res->folder_name.', '.$res->subject.' ('.$res->folders_system_id.')'; + $folder_id = $res->parent_id; + if(isset($folder_id) && !empty($folder_id)) + { + $db2->query('select folder_name, subject, folders_system_id from '.$_SESSION['tablename']['fold_folders']." where status <> 'DEL' and folders_system_id = ".$folder_id." and folder_level = 1"); + // $db2->show(); + $res = $db2->fetch_object(); + $data['project']['show_value'] = $res->folder_name.', '.$res->subject.' ('.$res->folders_system_id.')'; + //$db2->show_array($data['project']); + } + } + } + // Folder : project + elseif($arr[$i] == 'project' && $line->folders_system_id <> '' && isset($line->folders_system_id) && empty($data['project']['show_value'])) + { + $db2->query('select folder_name, subject, folders_system_id, parent_id from '.$_SESSION['tablename']['fold_folders']." where status <> 'DEL' and folders_system_id = ".$line->folders_system_id." and folder_level = 1"); + + if($db2->nb_result() > 0) + { + $res = $db2->fetch_object(); + $data['project']['show_value'] = $res->folder_name.', '.$res->subject.' ('.$res->folders_system_id.')'; + } + } + } + else // 'mimimal' mode + { + // Normal cases + $data[$arr[$i]] = $line->$arr[$i]; + if($_ENV['categories'][$cat_id][$arr[$i]]['type_field'] == 'date') + { + $data[$arr[$i]] = $db->format_date_db($line->$arr[$i], false); + } + elseif($_ENV['categories'][$cat_id]['other_cases'][$arr[$i]]['type_field'] == 'date') + { + $data[$arr[$i]] = $db->format_date_db($line->$arr[$i], false); + } + elseif($_ENV['categories'][$cat_id][$arr[$i]]['type_field'] == 'string') + { + $data[$arr[$i]] = $db->show_string($line->$arr[$i], true); + } + // special cases : + // Contact + if($arr[$i] == 'dest_user_id' || $arr[$i] == 'exp_user_id') + { + $data['type_contact'] = 'internal'; + if(!empty($line->$arr[$i])) + { + $db2->query('select lastname, firstname from '.$_SESSION['tablename']['users']." where user_id = '".$line->$arr[$i]."'"); + $res = $db2->fetch_object(); + $data['contact']= $res->lastname.', '.$res->firstname.' ('.$line->$arr[$i].')'; + } + unset($data[$arr[$i]]); + + } + elseif($arr[$i] == 'dest_contact_id' || $arr[$i] == 'exp_contact_id') + { + $data['type_contact'] = 'external'; + if(!empty($line->$arr[$i])) + { + $db2->query('select is_corporate_person, lastname, firstname, society from '.$_SESSION['tablename']['contacts']." where enabled = 'Y' and contact_id = ".$line->$arr[$i].""); + $res = $db2->fetch_object(); + if($res->is_corporate_person == 'Y') + { + $data['contact'] = $res->society.' ('.$line->$arr[$i].')'; + } + else + { + if(!empty($res->society)) + { + $data['contact'] = $res->society.', '.$res->lastname.' '.$res->firstname.' ('.$line->$arr[$i].')'; + } + else + { + $data['contact']= $res->lastname.', '.$res->firstname.' ('.$line->$arr[$i].')'; + } + } + } + unset($data[$arr[$i]]); + } + // Folder : market + elseif($arr[$i] == 'market' && isset($line->folders_system_id) && !empty($line->folders_system_id)) + { + $db2->query('select folder_name, subject, folders_system_id, parent_id, folder_level from '.$_SESSION['tablename']['fold_folders']." where status <> 'DEL' and folders_system_id = ".$line->folders_system_id." "); + if($db2->nb_result() > 0) + { + $res = $db2->fetch_object(); + if($res->folder_level == 2) + { + $data['market'] = $res->folder_name.', '.$res->subject.' ('.$res->folders_system_id.')'; + $folder_id = $res->parent_id; + if(isset($folder_id) && !empty($folder_id)) + { + $db2->query('select folder_name, subject, folders_system_id from '.$_SESSION['tablename']['fold_folders']." where status <> 'DEL' and folders_system_id = ".$folder_id." and folder_level = 1"); + $res = $db2->fetch_object(); + $data['project'] = $res->folder_name.', '.$res->subject.' ('.$res->folders_system_id.')'; + } + } + else + { + $data['project'] = $res->folder_name.', '.$res->subject.' ('.$res->folders_system_id.')'; + } + } + + } + // Folder : project + elseif($arr[$i] == 'project' && $line->folders_system_id <> '' && isset($line->folders_system_id) && empty($data['project'])) + { + $db2->query('select folder_name, subject, folders_system_id, parent_id from '.$_SESSION['tablename']['fold_folders']." where status <> 'DEL' and folders_system_id = ".$line->folders_system_id." and folder_level = 1"); + //$db2->show(); + $res = $db2->fetch_object(); + $data['project'] = $res->folder_name.', '.$res->subject.' ('.$res->folders_system_id.')'; + } + } + } + + if($mode == 'minimal' && isset($data['process_limit_date']) && !empty($data['process_limit_date'])) + { + $data['process_limit_date_use'] = true; + } + return $data; +} + +/** + * Returns the icon for the given category or the default icon + * + * @param $cat_id string Category identifiert + * @return string Icon Url + **/ +function get_img_cat($cat_id) +{ + $default = $_SESSION['config']['businessappurl'].'img/picto_delete.gif'; + if(empty($cat_id)) + { + + return $default; + } + else + { + if(!empty($_ENV['categories'][$cat_id]['img_cat'])) + { + return $_ENV['categories'][$cat_id]['img_cat']; + } + else + { + return $default; + } + } +} +?> diff --git a/maarch_entreprise/trunk/documents_list.php b/maarch_entreprise/trunk/documents_list.php new file mode 100755 index 0000000000000000000000000000000000000000..856abe94349ffec63c03a8ae42fd62c0f3406437 --- /dev/null +++ b/maarch_entreprise/trunk/documents_list.php @@ -0,0 +1,280 @@ +<?php +/* +* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Displays the invoices list in the following baskets (default setting): NewInvoicesSup10000, RejectedInvoices, ValidatedInvoices +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup basket +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_list_show.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR.'class_contacts.php'); +require_once($_SESSION['pathtocoreclass']."class_manage_status.php"); + +include_once($_SESSION['config']['businessapppath'].'definition_mail_categories.php'); +$status_obj = new manage_status(); +$security = new security(); +$core_tools = new core_tools(); +$request = new request(); +$contact = new contacts(); +require_once($_SESSION['pathtomodules']."basket".$_SESSION['slash_env']."class".$_SESSION['slash_env']."class_modules_tools.php"); +$bask = new basket(); +if(!empty($_REQUEST['id'])) +{ + $bask->load_current_basket(trim($_REQUEST['id']), 'frame'); +} +if(!empty($_SESSION['current_basket']['view'])) +{ + $table = $_SESSION['current_basket']['view']; +} +else +{ + $table = $_SESSION['current_basket']['table']; +} +$_SESSION['collection_id_choice'] = $_SESSION['current_basket']['coll_id']; +$select[$table]= array(); +$where = $_SESSION['current_basket']['clause']; +array_push($select[$table],"res_id", "status", "category_id","category_id as category_img", "priority", "admission_date", "subject", "process_limit_date", "destination", "dest_user", "type_label", "exp_user_id"); +$order = ''; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +else +{ + $order = 'asc'; +} +$order_field = ''; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $order_field = trim($_REQUEST['order_field']); +} +else +{ + $order_field = 'creation_date'; +} +$list=new list_show(); +$orderstr = $list->define_order($order, $order_field); +$bask->connect(); +$do_actions_arr = array(); +$tab=$request->select($select,$where,$orderstr,$_SESSION['config']['databasetype'], '1000'); + + + //Manage of template list + //################### + + //Defines template allowed for this list + $template_list=array(); + array_push($template_list, array( "name"=>"document_list_extend", "img"=>"extend_list.gif", "label"=> _ACCESS_LIST_EXTEND)); + + if(!$_REQUEST['template']) + $template_to_use = $template_list[0]["name"]; + + if(isset($_REQUEST['template']) && empty($_REQUEST['template'])) + $template_to_use = ''; + + if($_REQUEST['template']) + $template_to_use = $_REQUEST['template']; + + + //For status icon + $extension_icon = ''; + if($template_to_use <> '') + $extension_icon = "_big"; + //################### + + +//$request->show(); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="res_id") + { + $tab[$i][$j]["res_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_GED_NUM; + $tab[$i][$j]["size"]="4"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='res_id'; + $_SESSION['mlb_search_current_res_id'] = $tab[$i][$j]['value']; + } + if($tab[$i][$j][$value]=="admission_date") + { + $tab[$i][$j]["value"]=$core_tools->format_date_db($tab[$i][$j]["value"], false); + $tab[$i][$j]["label"]=_ADMISSION_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='admission_date'; + } + if($tab[$i][$j][$value]=="process_limit_date") + { + $tab[$i][$j]["value"]=$core_tools->format_date_db($tab[$i][$j]["value"], false); + $compareDate = ""; + if($tab[$i][$j]["value"] <> "" && ($statusCmp == "NEW" || $statusCmp == "COU" || $statusCmp == "VAL" || $statusCmp == "RET")) + { + $compareDate = $core_tools->compare_date($tab[$i][$j]["value"], date("d-m-Y")); + if($compareDate == "date2") + { + $tab[$i][$j]["value"] = "<span style='color:red;'><b>".$tab[$i][$j]["value"]."<br><small>(".$core_tools->nbDaysBetween2Dates($tab[$i][$j]["value"], date("d-m-Y"))." "._DAYS.")<small></b></span>"; + } + elseif($compareDate == "date1") + { + $tab[$i][$j]["value"] = $tab[$i][$j]["value"]."<br><small>(".$core_tools->nbDaysBetween2Dates(date("d-m-Y"), $tab[$i][$j]["value"])." "._DAYS.")<small>"; + } + elseif($compareDate == "equal") + { + $tab[$i][$j]["value"] = "<span style='color:blue;'><b>".$tab[$i][$j]["value"]."<br><small>("._LAST_DAY.")<small></b></span>"; + } + } + $tab[$i][$j]["label"]=_PROCESS_LIMIT_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='process_limit_date'; + } + if($tab[$i][$j][$value]=="category_id") + { + $_SESSION['mlb_search_current_category_id'] = $tab[$i][$j]["value"]; + $tab[$i][$j]["value"] = $_SESSION['mail_categories'][$tab[$i][$j]["value"]]; + $tab[$i][$j]["label"]=_CATEGORY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='category_id'; + } + if($tab[$i][$j][$value]=="priority") + { + $tab[$i][$j]["value"] = $_SESSION['mail_priorities'][$tab[$i][$j]["value"]]; + $tab[$i][$j]["label"]=_PRIORITY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='priority'; + } + if($tab[$i][$j][$value]=="subject") + { + $tab[$i][$j]["value"] = $request->show_string($tab[$i][$j]["value"]); + $tab[$i][$j]["label"]=_SUBJECT; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="right"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='subject'; + } + if($tab[$i][$j][$value]=="type_label") + { + $tab[$i][$j]["value"] = $request->show_string($tab[$i][$j]["value"]); + $tab[$i][$j]["label"]=_TYPE; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="right"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='type_label'; + } + if($tab[$i][$j][$value]=="status") + { + $res_status = $status_obj->get_status_data($tab[$i][$j]['value'],$extension_icon); + $statusCmp = $tab[$i][$j]['value']; + $tab[$i][$j]['value'] = "<img src = '".$res_status['IMG_SRC']."' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'>"; + $tab[$i][$j]["label"]=_STATUS; + $tab[$i][$j]["size"]="4"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='status'; + } + if($tab[$i][$j][$value]=="exp_user_id") + { + $tab[$i][$j]["label"]=_CONTACT; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["value"] = $contact->get_contact_information($_SESSION['mlb_search_current_res_id'],$_SESSION['mlb_search_current_category_id'],$table); + $tab[$i][$j]["order"]=false; + } + if($tab[$i][$j][$value]=="category_img") + { + $tab[$i][$j]["label"]=_CATEGORY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $my_imgcat = get_img_cat($tab[$i][$j]['value'],$extension_icon); + $tab[$i][$j]['value'] = "<img src = '".$my_imgcat."' alt = '' title = ''>"; + $tab[$i][$j]["value"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="category_id"; + } + } + } +} + + + + +$i = count($tab); +$title = _RESULTS." : ".$i." "._FOUND_DOCS; +//$request->show_array($tab); +$_SESSION['origin'] = 'basket'; +$_SESSION['collection_id_choice'] = $_SESSION['current_basket']['coll_id']; +//$tmp = preg_replace('/.php$/', '', $security->get_script_from_coll($_SESSION['current_basket']['coll_id'], 'script_details')); +//$details = $tmp.'&dir=indexing_searching'; +$details = 'details&dir=indexing_searching'; +//$param_list = array('values' => $tab, 'title' => $title, 'key' => 'res_id', 'page_name' => 'documents_list', +$param_list = array('values' => $tab, 'title' => $title, 'key' => 'res_id', 'page_name' => 'view_baskets&module=basket&baskets='.$_SESSION['current_basket']['id'] , +'what' => 'res_id', 'detail_destination' =>$details, 'details_page' => '', 'view_doc' => true, 'bool_details' => true, 'bool_order' => true, +'bool_frame' => false, 'module' => '', 'css' => 'listing spec', + 'hidden_fields' => '<input type="hidden" name="module" id="module" value="basket" /><input type="hidden" name="table" id="table" value="'.$_SESSION['current_basket']['table'].'"/> + <input type="hidden" name="coll_id" id="coll_id" value="'.$_SESSION['current_basket']['coll_id'].'"/>', 'open_details_popup' => false, 'do_actions_arr' => $do_actions_arr, 'template' => true, + 'template_list'=> $template_list, 'actual_template'=>$template_to_use, 'bool_export'=>true ); +$bask->basket_list_doc($param_list, $_SESSION['current_basket']['actions'],_CLICK_LINE_TO_PROCESS, true, $template_list, $template_to_use ); +?> diff --git a/maarch_entreprise/trunk/documents_list_with_filter.php b/maarch_entreprise/trunk/documents_list_with_filter.php new file mode 100644 index 0000000000000000000000000000000000000000..61d72caa613ec587aae68e117e5a8b63cb5c9e20 --- /dev/null +++ b/maarch_entreprise/trunk/documents_list_with_filter.php @@ -0,0 +1,404 @@ +<?php +/* +* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Displays the invoices list in the following baskets (default setting): NewInvoicesSup10000, RejectedInvoices, ValidatedInvoices +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup basket +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtomodules']."basket".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); +require_once($_SESSION['pathtomodules']."entities".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_manage_entities.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +$security = new security(); +$core_tools = new core_tools(); +$request = new request(); +$db = new dbquery(); +$db2 = new dbquery(); +$db->connect(); +$db2->connect(); +$ent = new entity(); +$bask = new basket(); +if(!empty($_REQUEST['clear'])) +{ + $_SESSION['auth_dep'] = array(); +} +if(!empty($_REQUEST['id'])) +{ + $bask->load_current_basket(trim($_REQUEST['id']), 'frame'); +} +?> +<?php +if(!empty($_SESSION['current_basket']['view'])) +{ + $table = $_SESSION['current_basket']['view']; +} +else +{ + $table = $_SESSION['current_basket']['table']; +} +$entity = ''; +$str = ''; +$entities = array(); +//$core_tools->show_array($_SESSION['status']); +$where_tmp = ''; +$where = $_SESSION['current_basket']['clause']; +$where = str_replace("and status <> 'VAL'", " ", $where); +if(!empty($where)) +{ + $where_tmp = ' and '.$where; +} +if($_SESSION['current_basket']['id'] == "DepartmentBasket") +{ + $db->query("select distinct(r.destination) as entity_id, count(distinct r.res_id) as total from ".$table." r, ".$_SESSION['tablename']['ent_entities']." e where e.entity_id = r.destination ".$where_tmp." group by e.entity_label, r.destination"); +} +else +{ + $db->query("select distinct(r.destination) as entity_id, count(distinct r.res_id) as total from ".$table." r, ".$_SESSION['tablename']['ent_entities']." e where e.entity_id = r.destination and ".$where." group by e.entity_label, r.destination"); +} +//$db->show(); +while($res = $db->fetch_object()) +{ + $db2->query("select entity_label from ".$_SESSION['tablename']['ent_entities']." e where e.entity_id = '".$res->entity_id."'"); + $res2 = $db2->fetch_object(); + array_push($entities, array('ID' => $res->entity_id, 'LABEL' => $res2->entity_label, 'IN_ENTITY' => $ent->is_user_in_entity($_SESSION['user']['UserId'], $res->entity_id), 'TOTAL' => $res->total)); +} +?> +<div align="center"> + <script> + function change_list_entity(id_entity, path_script) + { + + //Defines template allowed for this list + <?php if(!$_REQUEST['template']) + { ?> + var templateVal = 'document_list_extend'; <?php + } ?> + <?php if(isset($_REQUEST['template']) && empty($_REQUEST['template'])) + { ?> + var templateVal = ''; <?php + } ?> + <? if($_REQUEST['template']) + { ?> + var templateVal = '<? echo $_REQUEST['template']; ?>'; <? + } ?> + //################### + + + //console.log(id_entity); + var startVal = '<?php echo $_REQUEST['start'];?>'; + var orderVal = '<?php echo $_REQUEST['order'];?>'; + var order_fieldVal = '<?php echo $_REQUEST['order_field'];?>'; + if(id_entity && path_script) + { + new Ajax.Request(path_script, + { + method:'post', + parameters: {entity_id : id_entity, start : startVal, order : orderVal, order_field : order_fieldVal, template : templateVal}, + onSuccess: function(answer){ + //console.log(answer.responseText); + var item = $('list_doc'); + if(item != null) + { + item.update(answer.responseText); + } + }, + onFailure: function(){ } + }); + } + } + + function change_list_category(id_category, path_script) + { + + //Defines template allowed for this list + <?php if(!$_REQUEST['template']) + { ?> + var templateVal = 'document_list_extend'; <?php + } ?> + <?php if(isset($_REQUEST['template']) && empty($_REQUEST['template'])) + { ?> + var templateVal = ''; <?php + } ?> + <? if($_REQUEST['template']) + { ?> + var templateVal = '<? echo $_REQUEST['template']; ?>'; <? + } ?> + //################### + + //console.log(id_category); + var startVal = '<?php echo $_REQUEST['start'];?>'; + var orderVal = '<?php echo $_REQUEST['order'];?>'; + var order_fieldVal = '<?php echo $_REQUEST['order_field'];?>'; + if(id_category && path_script) + { + new Ajax.Request(path_script, + { + method:'post', + parameters: {category_id : id_category, start : startVal, order : orderVal, order_field : order_fieldVal, template : templateVal}, + onSuccess: function(answer){ + //console.log(answer.responseText); + var item = $('list_doc'); + if(item != null) + { + item.update(answer.responseText); + } + }, + onFailure: function(){ } + }); + } + } + + function change_list_status(id_status, path_script) + { + + //Defines template allowed for this list + <?php if(!$_REQUEST['template']) + { ?> + var templateVal = 'document_list_extend'; <?php + } ?> + <?php if(isset($_REQUEST['template']) && empty($_REQUEST['template'])) + { ?> + var templateVal = ''; <?php + } ?> + <? if($_REQUEST['template']) + { ?> + var templateVal = '<? echo $_REQUEST['template']; ?>'; <? + } ?> + //################### + //console.log(id_status); + var startVal = '<?php echo $_REQUEST['start'];?>'; + var orderVal = '<?php echo $_REQUEST['order'];?>'; + var order_fieldVal = '<?php echo $_REQUEST['order_field'];?>'; + if(id_status && path_script) + { + new Ajax.Request(path_script, + { + method:'post', + parameters: {status_id : id_status, start : startVal, order : orderVal, order_field : order_fieldVal, template : templateVal}, + onSuccess: function(answer){ + //console.log(answer.responseText); + var item = $('list_doc'); + if(item != null) + { + item.update(answer.responseText); + } + }, + onFailure: function(){ } + }); + } + } + + function change_contact(id_contact, path_script) + { + //Defines template allowed for this list + <?php if(!$_REQUEST['template']) + { ?> + var templateVal = 'document_list_extend'; <?php + } ?> + <?php if(isset($_REQUEST['template']) && empty($_REQUEST['template'])) + { ?> + var templateVal = ''; <?php + } ?> + <? if($_REQUEST['template']) + { ?> + var templateVal = '<? echo $_REQUEST['template']; ?>'; <? + } ?> + //################### + + //console.log(id_contact); + var startVal = '<?php echo $_REQUEST['start'];?>'; + var orderVal = '<?php echo $_REQUEST['order'];?>'; + var order_fieldVal = '<?php echo $_REQUEST['order_field'];?>'; + if(id_contact && path_script) + { + new Ajax.Request(path_script, + { + method:'post', + parameters: {contact_id : id_contact, start : startVal, order : orderVal, order_field : order_fieldVal, template : templateVal}, + onSuccess: function(answer){ + //console.log(answer.responseText); + var item = $('list_doc'); + if(item != null) + { + item.update(answer.responseText); + } + }, + onFailure: function(){ } + }); + } + } + </script> + <?php + if(empty($_SESSION['auth_dep']['bask_chosen_entity']) && empty($_SESSION['auth_dep']['bask_chosen_category']) && empty($_SESSION['auth_dep']['bask_chosen_status']) && empty($_SESSION['auth_dep']['bask_chosen_contact'])) + { + ?> + <script language="javascript"> + //Defines template allowed for this list + <?php if(!$_REQUEST['template']) + { ?> + var templateVal = 'document_list_extend'; <?php + } ?> + <?php if(isset($_REQUEST['template']) && empty($_REQUEST['template'])) + { ?> + var templateVal = ''; <?php + } ?> + <? if($_REQUEST['template']) + { ?> + var templateVal = '<? echo $_REQUEST['template']; ?>'; <? + } ?> + //################### + + var startVal = '<?php echo $_REQUEST['start'];?>'; + var orderVal = '<?php echo $_REQUEST['order'];?>'; + var order_fieldVal = '<?php echo $_REQUEST['order_field'];?>'; + new Ajax.Request('<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php', + { + method:'post', + parameters: {start : startVal, order : orderVal, order_field : order_fieldVal, template : templateVal}, + onSuccess: function(answer){ + //console.log(answer.responseText); + var item = $('list_doc'); + if(item != null) + { + item.update(answer.responseText); + } + }, + onFailure: function(){ } + }); + </script> + <?php + } + ?> + <form name="filter_by_entity" action="#" method="post"> + <?php echo _FILTER_BY;?> : + <select name="entity" id="entity" onchange="change_list_entity(this.options[this.selectedIndex].value, '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php');"> + <option value="none"><?php echo _CHOOSE_ENTITY;?></option> + <?php + for($i=0;$i<count($entities);$i++) + { + ?> + <option value="<?php echo $entities[$i]['ID'];?>"<?php if($_SESSION['auth_dep']['bask_chosen_entity'] == $entities[$i]['ID']){echo ' selected="selected"';}?><?php if($entities[$i]['IN_ENTITY']){echo ' style="font-weight:bold;"';}?>><?php echo $entities[$i]['LABEL'].' ('.$entities[$i]['TOTAL'].')';?></option> + <?php + } + ?> + </select> + <select name="category" id="category" onchange="change_list_category(this.options[this.selectedIndex].value, '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php');"> + <option value="none"><?php echo _CHOOSE_CATEGORY;?></option> + <?php + foreach(array_keys($_SESSION['mail_categories']) as $value) + { + ?> + <option value="<?php echo $value;?>"<?php if($_SESSION['auth_dep']['bask_chosen_category'] == $value){echo ' selected="selected"';}?>><?php echo $_SESSION['mail_categories'][$value];?></option> + <?php + } + ?> + </select> + <?php + if($_SESSION['current_basket']['id'] == "DepartmentBasket") + { + ?> + <select name="status" id="status" onchange="change_list_status(this.options[this.selectedIndex].value, '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php');"> + <option value="none"><?php echo _CHOOSE_STATUS;?></option> + <?php + for($cptStatus=0;$cptStatus<count($_SESSION['status']);$cptStatus++) + { + ?> + <option value="<?php echo $_SESSION['status'][$cptStatus]['id'];?>"<?php if($_SESSION['auth_dep']['bask_chosen_status'] == $_SESSION['status'][$cptStatus]['id']){echo ' selected="selected"';}?>><?php echo $_SESSION['status'][$cptStatus]['label'];?></option> + <?php + } + ?> + </select> + <?php + } + ?> + <input type="text" name="contact_id" id="contact_id" + value="<?php + if(!empty($_SESSION['auth_dep']['bask_chosen_contact'])) + { + echo $_SESSION['auth_dep']['bask_chosen_contact']; + } + else + { + echo '['._CONTACT.']'; + } + ?>" + <?php + if(empty($_SESSION['auth_dep']['bask_chosen_contact'])) + { + ?> + onfocus="if(this.value=='[<?php echo _CONTACT;?>]'){this.value='';}" + <?php + } + ?> + size="40" onKeyPress="if(event.keyCode == 9)change_contact(this.value, '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php');" onBlur="change_contact(this.value, '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php');" /> + <div id="contactListByName" class="autocomplete"></div> + <script type="text/javascript"> + initList('contact_id', 'contactListByName', '<?php echo $_SESSION['config']['businessappurl'];?>contact_list_by_name.php', 'what', '2'); + </script> + <input type="button" class="button" value="<?php echo _CLEAR_SEARCH;?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl']."index.php?page=view_baskets&module=basket&baskets=".$_SESSION['current_basket']['id']."&clear=ok";?>';"> + </form> + <?php + if(isset($_SESSION['auth_dep']['bask_chosen_entity']) && !empty($_SESSION['auth_dep']['bask_chosen_entity'])) + { + ?> + <script> + change_list_entity('<?php echo $_SESSION['auth_dep']['bask_chosen_entity'];?>', '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php'); + </script> + <?php + } + if(isset($_SESSION['auth_dep']['bask_chosen_category']) && !empty($_SESSION['auth_dep']['bask_chosen_category'])) + { + ?> + <script> + change_list_category('<?php echo $_SESSION['auth_dep']['bask_chosen_category'];?>', '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php'); + </script> + <?php + } + if(isset($_SESSION['auth_dep']['bask_chosen_status']) && !empty($_SESSION['auth_dep']['bask_chosen_status'])) + { + ?> + <script> + change_list_status('<?php echo $_SESSION['auth_dep']['bask_chosen_status'];?>', '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php'); + </script> + <?php + } + if(isset($_SESSION['auth_dep']['bask_chosen_contact']) && !empty($_SESSION['auth_dep']['bask_chosen_contact'])) + { + ?> + <script> + change_contact('<?php echo $_SESSION['auth_dep']['bask_chosen_contact'];?>', '<?php echo $_SESSION['config']['businessappurl'];?>manage_filter.php'); + </script> + <?php + } + ?> +</div> +<div id="list_doc"><?php echo $str;?></div> diff --git a/maarch_entreprise/trunk/export_list.php b/maarch_entreprise/trunk/export_list.php new file mode 100644 index 0000000000000000000000000000000000000000..098e886b4b7865b503b7c49619ad14037b20a17e --- /dev/null +++ b/maarch_entreprise/trunk/export_list.php @@ -0,0 +1,189 @@ +<?php +/** +* File : export_list.php +* +* Export a result list in a csv file +* +* @package Maarch PeopleBox 1.0 +* @version 2.0 +* @since 06/2006 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +if(file_exists($_SESSION['config']['lang'].'.php')) +{ + include($_SESSION['config']['lang'].'.php'); +} +else +{ + $_SESSION['error'] = "Language file missing...<br/>"; +} +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); + +//----------------------- suppression fichiers d'export existants ----------------------------------------// + +$source = $_SESSION['config']['exportdirectory']; +$source = "export"; +$reps = scandir($source); +$find = false; + +for($i=2; $i < count($reps); $i++) +{ + if($reps[$i] == $_SESSION['user']['UserId']) + { + $find = true; + break; + } +} + +//$source = $_SESSION['config']['exportdirectory'].$_SESSION['user']['UserId']; + +if($find) +{ +// unlink($source."\\export.csv"); +// $files = scandir($source."\\extract\\"); +// for($i = 2; $i < count($files); $i++) +// { +// unlink($source."\\extract\\".$files[$i]); +// } +} +else +{ +// if(!mkdir($source."\\")) +// { +// $_SESSION['error'] .= "Erreur lors de la création du répertoire d'export de l'utilisateur : ".$_SESSION['user']['UserId']."<br/>"; +// } +// else +// { +// if(!mkdir($source."\\extract\\")) +// { +// $_SESSION['error'] .= "Erreur lors de la crétion du répertoire extract lors de l'export"; +// } +// } +} + +//----------------------- Constitution de la liste de résultats ----------------------------------------// +$result = array(); + +$result = $_SESSION['SEARCH_ADV_RESULT']['PARAM']['RESULT']; +$listvalue = array(); +$listcolumn = array(); +$listshow = array(); +//print_r($result); +$i = $_SESSION['SEARCH_ADV_RESULT']['PARAM']['NB_TOTAL']; +// put in tab the different label of the column +for ($i=0;$i<1;$i++) +{ + for ($j=0;$j<count($result[$j]);$j++) + { + for ($j=0;$j<count($result[$i][$j]);$j++) + { + array_push($listcolumn,$result[$i][$j]["LABEL"]); + array_push($listshow,$result[$i][$j]["SHOW"]); + } + } +} +$func = new functions(); + +//columns +for($count_column = 0;$count_column < count($listcolumn);$count_column++) +{ + if($listshow[$count_column]==true) + { + $texte .=$listcolumn[$count_column].";"; + } +} +//$texte .= "lien vers le fichier".chr(13); +$texte .= chr(13); +//infos +$nb = $_SESSION['SEARCH_ADV_RESULT']['PARAM']['NB_TOTAL']; + +$connexion = new dbquery(); +$connexion->connect(); +for($theline = 0; $theline < $nb ; $theline++) +{ + //$select = array(); + //$select["res_x"]= array(); + //$tab_select = array(); + //array_push($select["res_x"],"RES_ID, DOCSERVER_ID, PATH, FILENAME, FORMAT"); + //$where_request = "RES_ID = ".$result[$theline][0]['VALUE_EXPORT']." "; + //$request = new request(); + //$tab_select=$request->select($select,$where_request,"",$_SESSION['config']['databasetype']); + /*for ($i=0;$i<count($tab_select);$i++) + { + for ($j=0;$j<count($tab_select[$i]);$j++) + { + foreach(array_keys($tab_select[$i][$j]) as $value) + { + if($tab_select[$i][$j][$value]=='res_id') + { + $res_id = $tab_select[$i][$j]['value']; + } + if($tab_select[$i][$j][$value]=="DOCSERVER_ID") + { + $docserver = $tab_select[$i][$j]['value']; + } + if($tab_select[$i][$j][$value]=="PATH") + { + $path = $tab_select[$i][$j]['value']; + } + if($tab_select[$i][$j][$value]=="FILENAME") + { + $filename = $tab_select[$i][$j]['value']; + } + if($tab_select[$i][$j][$value]=="FORMAT") + { + $format = $tab_select[$i][$j]['value']; + } + } + } + } + //$select2 = array(); + //$select2["DOCSERVERS"]= array(); + //$tab_select2 = array(); + //array_push($select2["DOCSERVERS"],"PATH_TEMPLATE"); + //$where_request2 = " DOCSERVER_ID = '".$docserver."'"; + //$request2 = new request(); + //$tab_select2=$request2->select($select2,$where_request2,"",$_SESSION['config']['databasetype']); + /*for ($i=0;$i<count($tab_select2);$i++) + { + for ($j=0;$j<count($tab_select2[$i]);$j++) + { + foreach(array_keys($tab_select2[$i][$j]) as $value) + { + if($tab_select2[$i][$j][$value]=="PATH_TEMPLATE") + { + $docserver= $tab_select2[$i][$j]['value']; + } + } + } + }*/ + $file = $docserver.$path.$filename; + $file = str_replace("#","\\",$file); + $destination = $source."\\extract\\"; + //copy($file, $destination.$filename); + + //print_r($result); + + for($count_column = 0;$count_column < count($listcolumn);$count_column++) + { + if ($result[$theline][$count_column]['VALUE_EXPORT'] <> "NO_VISIBILITY037") + { $texte .= $result[$theline][$count_column]['VALUE_EXPORT'].";"; } + } + //$texte .= "file:///".$source."/extract/".$filename.chr(13); + $texte .= chr(13); + //echo $texte; +} + +//----------------------- constitution du fichier d'index ----------------------------------------// +echo $source."/export.csv <br/>"; +$monfichier = fopen($source."/export.csv","w+,"); +fwrite($monfichier, $texte); + +?> +<a href="export/export.csv"><?php echo _CONSULT_EXTRACTION;?></a><br /><br/> +<input type="button" onclick="window.close();" value="<?php echo _CLOSE_WINDOW;?>" class="button" /> \ No newline at end of file diff --git a/maarch_entreprise/trunk/fr_comp.php b/maarch_entreprise/trunk/fr_comp.php new file mode 100644 index 0000000000000000000000000000000000000000..eea1ebf6db7c9ee325ef9b882296f65f4e172182 --- /dev/null +++ b/maarch_entreprise/trunk/fr_comp.php @@ -0,0 +1,222 @@ +<?php +/*******************************Statut courrier*********************************/ +define('_TO_PROCESS','A traiter'); +define('_IN_PROGRESS','En cours'); +define('_FIRST_WARNING','1ere Relance'); +define('_SECOND_WARNING','2e Relance (Retard)'); +define('_CLOSED','Clos'); +define('_NEW','Nouveaux'); +define('_LATE', 'En retard'); + +define('_QUICKSEARCH', 'Recherche rapide'); +define('_MANAGE_DEPARTMENTS', 'Gérer les services'); +define('_REOPEN_MAIL', 'Réouverture de courrier'); +define('_MAIL_TO_PROCESS', 'Courrier à traiter'); +define('_MAIL_TO_VALIDATE', 'Courrier à valider'); +define('_QUICK_GUIDE', 'Guide rapide d´utilisation'); +define('_ONLINE_REGISTER', 'Enregistrement en ligne'); +define('_SEARCH_UPDATES', 'Rechercher des mises à jour'); +define('_CONTACT_US', 'Contactez-nous'); +define('_MAARCH_INTEGRATION', 'Maarch™ et l´intégration'); + +/**************Mise à jour message**************/ +//Permet de mettre à jour le message d'accueil +define('_UPDATE_MSG_TITLE', 'Modification du message d´accueil de l´administrateur'); +define('_UPDATE_MSG_LINE01','Modifier le formulaire ci-dessous pour mettre à jour le message d´accueil de l´application.'); +define('_UPDATE_MSG_LINE02','Vous pouvez integrer à ce message des balises HTML pour mettre en forme le message.'); + +define('_MANAGE_DEPARTMENT_LIST', 'Gérer la liste des services') +define('_REOPEN_MAIl_EXPLANATION', 'Modifier le statut d´un courrier en cas de clôture trop rapide du traitement d´un courrier'); +; + +define('_DEPARTMENTS_LIST', 'Liste des services'); +define('_SELECTED_DEPARTMENTS', 'Services sélectionnés'); + +define('_ELECTED', 'Responsable'); +define('_AGENT', 'Agent'); +define('_CHOOSE_DEPARTMENT', 'Choisissez un service'); + +define('_PROCESS_DELAY', 'Délai de traitement'); +define('_FIRST_WARNING_DELAY', 'Délai première relance'); +define('_SECOND_WARNING_DELAY', 'Délai deuxième relance'); +define('_LINKED_DIFF_LIST', 'Liste de diffusion associée'); +define('_NO_LINKED_DIFF_LIST', 'Pas de liste associée'); +define('_CREATE_LIST', 'Créer une liste de diffusion'); +define('_MODIFY_LIST', 'Modifier la liste'); + +/* Pop up creation / modification mod�le liste */ +define('_MANAGE_MODEL_LIST_TITLE', 'Création / Modification Modèle de liste de diffusion'); +define('_SORT_BY', 'Trier par'); +define('_WELCOME_MODEL_LIST_TITLE', 'Bienvenue dans l´outil de crétion de modèle de liste de diffusion'); +define('_MODEL_LIST_EXPLANATION1', 'Pour démarrer la crétion, utilisez la navigation par service ou par utilisateur ci-dessus'); + + +/************** Services : Liste + pop up **************/ +define('_ADD_DEPARTMENT', 'Ajouter un service'); +define('_ALL_DEPARTMENTS', 'Tous les services'); + +define('_DEPARTMENT_ADDITION', 'Ajout d´un service'); +define('_CREATE_MODIFY_DEPARTMENT', 'Création / Modification d´un service'); +define('_DEPARTMENT_DELETION', 'Suppression d´un service'); +define('_MODIFY_DEPARTMENT', 'Valider les changements'); +define('_THERE_ARE_NOW', 'Il y a actuellement'); +define('_DOC_IN_THE_DEPARTMENT', 'documents attachés à ce service'); +define('_TO_DEL_DEPARTMENT', 'Pour supprimer ce service, vous devez d´abord réaffecter ces documents à un service existant'); +define('_REALLY_DEL_DEPARTMENT', 'Voulez vous vraiment supprimer ce service ?'); +define('_DEL_AND_REAFFECT', 'Supprimer et réaffecter les documents'); + +/************** R�ouverture courrier **************/ +define('_REOPEN_THIS_MAIL', 'Réouverture du courrier'); +define('_MAIL_SENTENCE1', 'Cette page permet à l´administrateur de Maarch LetterBox de corriger une erreur utilisateur.'); +define('_MAIL_SENTENCE2', 'En saisissant le n°GED du document, vous passerez le statut de ce dernier à "En cours".'); +define('_MAIL_SENTENCE3', 'Cette fonction a pour but d’ouvrir à nouveau un courrier fermé prématurément.'); +define('_ENTER_DOC_ID', 'Saisissez l´identifiant du document'); +define('_TO_KNOW_ID', 'Pour connaître l´identifiant du document, effectuez une recherche ou demandez-le à l´opérateur'); +define('_MODIFY_STATUS', 'Modifier le statut'); + + + +//liste de diffusion +define('_CHOOSE_DEPARTMENT_FIRST', 'Vous devez d´abord choisir un service avant de pouvoir accéder à la liste diffusion'); +define('_NO_LIST_DEFINED__FOR_THIS_MAIL', 'Aucune liste n´est définie pour ce courrier'); +define('_NO_LIST_DEFINED__FOR_THIS_DEPARTMENT', 'Aucune liste n´est définie pour ce service'); +define('_NO_LIST_DEFINED', 'Pas de liste définie'); + +define('_WELCOME_DIFF_LIST', 'Bienvenue dans l´outil de diffusion de courrier'); +define('_START_DIFF_EXPLANATION', 'Pour demarrer la diffusion, utilisez la navigation par service ou par utilisateur ci-dessus'); +define('_CLICK_ON', 'cliquez sur'); +define('_ADD_USER_TO_LIST_EXPLANATION', 'Pour ajouter un utilisateur à la liste de diffusion'); +define('_REMOVE_USER_FROM_LIST_EXPLANATION', 'Pour retirer l´utilisateur à cette liste de diffusion'); +define('_TO_MODIFY_LIST_ORDER_EXPLANATION', 'Pour modifier l´ordre d´attribution d´un courrier aux utilisateurs, utilisez les icônes'); + + +/************************* Validation ***********************************/ +define('_MAIL_TO_VALIDATE', 'Courrier à valider'); +define('_CLICK_LINE_VALID', 'Cliquer sur une ligne pour valider le document'); +define('_CLICK_LINE_PROCESS', 'Cliquer sur une ligne pour traiter le document'); +define('_MAIL_VALIDATION', 'Validation courrier'); +define('_MAIL_VALIDATE', 'Valider courrier'); + +/************************* Gestion des abscences ***********************************/ + +define('_MISSING_ADVERT_TITLE','Gestion des absences'); +define('_MISSING_ADVERT_01','Ce compte est actuellement définit en mode ´absent´ et les courriers sont redirigés vers un autre utilisateur.'); +define('_MISSING_ADVERT_02','Si vous desirez vous connecter avec ce compte, le mode ´absent´ sera alors supprimé.<br/> La redirection des courriers arrivera à son terme et l´application sera réactivée'); +define('_MISSING_CHOOSE','Souhaitez-vous continuer?'); + +/************************** Traitement *********************************************/ +define('_TITLE_PROCESS','Page de traitement du courrier'); +define('_N_PROCESS_LETTER','Traitement du courrier n°'); +define('_GENERAL_INFO_LETTER','Informations générales sur le courrier'); +define('_SHOW_LETTER_RECEIVER_LIST','Voir la liste des destinataires de ce courrier'); +define('_ANSWERS_CREATED','Réponses effectuées'); +define('_SIMPLE_MAIL','Par courrier simple'); +define('_MORE_INFORMATIONS','Informations complémentaires'); +define('_QUALITY','Qualité'); +define('_ADDRESS','Adresse'); +define('_DISTRICTS','Quartier'); +define('_CHOOSE_DISTRICT','Choisissez un quartier'); +define('_ACTIONS','Actions'); +define('_LETTER_SERVICE_REDIRECT','Rediriger vers le service courrier'); +define('_LETTER_SERVICE_REDIRECT_VALIDATION','Souhaitez-vous vraiment rediriger vers le service courrier'); +define('_IF_REDIRECT_YOU_LOOSE_RIGHT','En redirigeant le courrier, vous perdrez les droits d´accès sur ce courrier'); +define('_MAIL_TO_AFFECT','Affecter à un agent du service'); +define('_REDIRECT_TO_ANOTHER','Rediriger vers une autre personne'); +define('_ACCEPT_UPDATE','Valider modification'); +define('_ACCEPT_UPDATE_TEXT','Enregistre les modifications effectuées sur le courrier actuel. Si vous choisissez cette option, vous pourrez à nouveau modifier le traitement, mais le calcul du délai de traitement n´est pas arrêté!'); +define('_CLOSE_LETTER','Clôturer le dossier'); +define('_CLOSE_LETTER_TEXT','Enregistre les modifications et clôture de courrier. En clôturant le courrier, vous perdrez les droits d´accès sur ce dernier.'); +define('_CANCEL_TEXT','Ferme la fenêtre actuelle sans enregistrer les modifications.'); +define('_CC_LIST', 'Liste des destinataires en copie'); + +define('_ANSWER_JOINED','Réponses attachées'); +define('_ATTACH_ANSWER','Attacher une réponse'); + +define('_GENERATE_ANSWER','Générer une réponse'); +define('_DELETE_ANSWER','Supprimer une réponse'); + +define('_PLEASE_SELECT_FILE', 'Veuillez sélectionner le document à attacher'); +define('_PLEASE_SELECT_MODEL', 'Veuillez sélectionner un modèle de réponse'); +define('_NEW_ANSWER_ADDED', 'Réponse ajoutée pour le courrier'); +define('_ANSWER_UPDATED', 'Réponse modifiée pour le courrier'); +define('_REDIRECT_TO', 'Rediriger vers'); +define('_CHOOSE_PERSON_TO_REDIRECT', 'Choisissez la personne vers qui vous souhaitez rediriger ce courrier dans la liste ci-dessus'); +define('_CLICK_ON_THE_LINE_OR_ICON', 'Il vous suffit de cliquer sur la ligne ou sur l´icône'); +define('_TO_SELECT_USER', 'pour sélectionner un utilisateur'); + +define('_MAIL_PROCESS_END_NUM', 'Clôture du traitement du courrier n°'); +define('_REDIRECTED_TO_GENERAL', ' redirigé vers le secrétariat général'); + + +//del_doc_popup +define('_DEL_MAIl_NUM', 'Suppression de(s) courrier(s) n°'); +define('_THIS_MAIL', 'ce(s) courrier(s)'); +define('_NO_DEL_RIGHT', 'Vous n´avez pas le droit de suppression dans cette corbeille.'); + +define('_MY_ABS', 'Gérer mes absences'); +define('_MY_ABS_TXT', 'Permet de rediriger votre courrier en attente en cas de départ en congé.'); +define('_MY_ABS_REDIRECT', 'Vos courriers sont actuellement redirigés vers'); +define('_MY_ABS_DEL', 'Pour supprimer la redirection, cliquez ici pour stopper'); +define('_ADMIN_ABS', 'Gérer les absences.'); +define('_ADMIN_ABS_TXT', 'Permet de rediriger le courrier de l´utilisateur en attente en cas de départ en congé.'); +define('_ADMIN_ABS_REDIRECT', 'Redirection d´absence en cours.'); +define('_ADMIN_ABS_FIRST_PART', 'Les courrier de'); +define('_ADMIN_ABS_SECOND_PART', 'sont actuellement redirigés vers '); +define('_ADMIN_ABS_THIRD_PART', '. Cliquez ici pour supprimer la redirection.'); +define('_ACTIONS_DONE', 'Actions effectuées le'); +define('_PROCESSED_MAIL', 'Courriers traités'); +define('_INDEXED_MAIL', 'Courriers indexés'); +define('_REDIRECTED_MAIL', 'Courriers redirigés'); +define('_PROCESS_MAIL_OF', 'Courrier à traiter de'); +define('_MISSING', 'Absent'); + +define('_THE_PROCESS_LIMIT', 'La date limite de traitement '); +define('_THE_FIRST_WARNING', 'Le délai de première relance '); +define('_THE_SECOND_WARNING', 'Le délai de deuxi&eagrave;me relance '); + + +//services : liste_modif.php + del_service.php +define('_DEPARTMENT_ADDED', 'Nouveau service crée'); +define('_DEPARTMENT_MODIF', 'Modification du service'); +define('_DEPARTMENT_DESC_MISSING', 'Il manque la description du service'); +define('_DEPARTMENT_ID_MISSING', 'Il manque l´identifiant du service'); +define('_CANT_DEL_DEPARTMENT', 'Vous ne pouvez pas supprimer ce service si vous ne réaffectez pas les courriers !'); +define('_THE_DEPARTMENT', 'Le département '); + + +//admin_status_up.php +define('_MAIL_MODIF_OK', 'La modification a été effectuée avec succès'); +define('_MAIL_MODIF_NOT_OK', 'Erreur lors de la modification, veuillez vérifier l´identifiant du document.'); + + +//Gestion des r�ponses lors du traitement ( generate_answer.php et manage_generate_answer.php) +define('_NO_MODE_DEFINED', 'Erreur : mode absent'); +define('_MODEL_OR_ANSWER_ERROR', 'Erreur : problème au chargement du modèle ou de la réponse'); +define('_NO_CONTENT', 'Erreur : Contenu de la réponse vide'); +define('_FILE_OPEN_ERROR', 'Ouverture fichier impossible'); +define('_ANSWER_OPEN_ERROR', 'Erreur : problème à l´ouverture de la réponse'); +define('_MAIL_SEND', 'Mail envoyé'); +define('_RECEPT_MAIL', 'Mail destinataire'); + + +define('_MAIL_STATUS', 'Statut des courriers'); +define('_ANSWER_TITLE', 'Titre de la réponse'); +define('_INGOING', 'Entrant'); +define('_ONGOING', 'Sortant'); +define('_SELECT_ONE_MAIL', 'Vous devez sélectionner au moins un courrier'); +define('_SELECT_ACTION', 'Vous devez sélectionner une action'); +define('_ANSWER_DELETED', 'Réponse supprimée pour le courrier'); +define('_MODIFY_ANSWER','Modifier la réponse'); + +define('_REDIRECT_TO_DEP', 'Redirection vers le service'); +define('_CHOOSE_DEP', 'Vous devez choisir un service'); +define('_REDIRECT_TO', 'Redirection vers'); +define('_REDIRECT_TO_OTHER_DEP', 'Rediriger vers un autre service'); +define('_REDIRECT_TO_USER', 'Rediriger vers un utilisateur'); +define('_REDIRECT_MAIL', 'Redirection de(s) courrier(s) n°'); +define('_REDIRECT_MAIL_OF', 'Redirection des courriers de'); +define('_MAIL_ID_UNDEFINED', 'L´identifiant du courrier n´est pas défini'); +define('_SHIPPER_DATA', 'Informations sur l´émetteur du courrier n°'); + + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/get_content_js.php b/maarch_entreprise/trunk/get_content_js.php new file mode 100644 index 0000000000000000000000000000000000000000..38381efb756d7280b1c29d975a7a4446f3cc0a1a --- /dev/null +++ b/maarch_entreprise/trunk/get_content_js.php @@ -0,0 +1,50 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Script called by an ajax object to return the content of a javascript file +* +* Script called by an ajax object to return the content of a javascript file +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup apps +*/ + +session_name('PeopleBox'); +session_start(); + +header('content-type: text/javascript'); + +if(empty($_REQUEST['scripts'])) +{ + echo ''; + exit(); +} + +$arr_scripts = explode('$$', $_REQUEST['scripts']); +for($i=0; $i<count($arr_scripts ); $i++) +{ + echo file_get_contents($arr_scripts[$i]); +} +exit(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/img/Btn.gif b/maarch_entreprise/trunk/img/Btn.gif new file mode 100644 index 0000000000000000000000000000000000000000..b78047973f94c4fc377a9a3d0e88de87a8fca843 Binary files /dev/null and b/maarch_entreprise/trunk/img/Btn.gif differ diff --git a/maarch_entreprise/trunk/img/File_Image.gif b/maarch_entreprise/trunk/img/File_Image.gif new file mode 100644 index 0000000000000000000000000000000000000000..eb451a79a2c30822a2b0c8b24c5d55c4e5cb97c9 Binary files /dev/null and b/maarch_entreprise/trunk/img/File_Image.gif differ diff --git a/maarch_entreprise/trunk/img/account_off.gif b/maarch_entreprise/trunk/img/account_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..3102e7d328ec4b6d4bc1d4604f87071b632fb173 Binary files /dev/null and b/maarch_entreprise/trunk/img/account_off.gif differ diff --git a/maarch_entreprise/trunk/img/account_on.gif b/maarch_entreprise/trunk/img/account_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..c2ebaa0b3c109e7732f38fb1ec8f944b8189f6b9 Binary files /dev/null and b/maarch_entreprise/trunk/img/account_on.gif differ diff --git a/maarch_entreprise/trunk/img/admin_msg.gif b/maarch_entreprise/trunk/img/admin_msg.gif new file mode 100644 index 0000000000000000000000000000000000000000..72d3292136fafa75c0d6a6719a64001cd8f0aafe Binary files /dev/null and b/maarch_entreprise/trunk/img/admin_msg.gif differ diff --git a/maarch_entreprise/trunk/img/arrow_down.gif b/maarch_entreprise/trunk/img/arrow_down.gif new file mode 100644 index 0000000000000000000000000000000000000000..517b47020763e492bbcea9cc4bd42a69c5084319 Binary files /dev/null and b/maarch_entreprise/trunk/img/arrow_down.gif differ diff --git a/maarch_entreprise/trunk/img/arrow_primary.gif b/maarch_entreprise/trunk/img/arrow_primary.gif new file mode 100644 index 0000000000000000000000000000000000000000..e2f8c3e1feeb0541239db4061812008af2225105 Binary files /dev/null and b/maarch_entreprise/trunk/img/arrow_primary.gif differ diff --git a/maarch_entreprise/trunk/img/arrow_up.gif b/maarch_entreprise/trunk/img/arrow_up.gif new file mode 100644 index 0000000000000000000000000000000000000000..54c45d29f10a6b3d5f6c1ed1f80b0834db8ec56e Binary files /dev/null and b/maarch_entreprise/trunk/img/arrow_up.gif differ diff --git a/maarch_entreprise/trunk/img/author.gif b/maarch_entreprise/trunk/img/author.gif new file mode 100644 index 0000000000000000000000000000000000000000..270a9148b6c7f78c94be0b0ac16e195e74caa9b9 Binary files /dev/null and b/maarch_entreprise/trunk/img/author.gif differ diff --git a/maarch_entreprise/trunk/img/bando_foot2.gif b/maarch_entreprise/trunk/img/bando_foot2.gif new file mode 100644 index 0000000000000000000000000000000000000000..92a32d6117afb2eefbc86e03ce71ab90098d1e4e Binary files /dev/null and b/maarch_entreprise/trunk/img/bando_foot2.gif differ diff --git a/maarch_entreprise/trunk/img/bando_foot_dte.gif b/maarch_entreprise/trunk/img/bando_foot_dte.gif new file mode 100644 index 0000000000000000000000000000000000000000..d5e427972a1eda6f4261b65d4708851c26365468 Binary files /dev/null and b/maarch_entreprise/trunk/img/bando_foot_dte.gif differ diff --git a/maarch_entreprise/trunk/img/bando_foot_gche.gif b/maarch_entreprise/trunk/img/bando_foot_gche.gif new file mode 100644 index 0000000000000000000000000000000000000000..e46f531fa8edc320173f46fd21b50eaec4059520 Binary files /dev/null and b/maarch_entreprise/trunk/img/bando_foot_gche.gif differ diff --git a/maarch_entreprise/trunk/img/bando_tete.gif b/maarch_entreprise/trunk/img/bando_tete.gif new file mode 100644 index 0000000000000000000000000000000000000000..dff593bbb2f2c6a08fdd8b9a70c4f0eaa3c1934c Binary files /dev/null and b/maarch_entreprise/trunk/img/bando_tete.gif differ diff --git a/maarch_entreprise/trunk/img/bando_tete2.gif b/maarch_entreprise/trunk/img/bando_tete2.gif new file mode 100644 index 0000000000000000000000000000000000000000..39ace8f7a4367c5117e0012695378936a73a7b94 Binary files /dev/null and b/maarch_entreprise/trunk/img/bando_tete2.gif differ diff --git a/maarch_entreprise/trunk/img/bando_tete_dte.gif b/maarch_entreprise/trunk/img/bando_tete_dte.gif new file mode 100644 index 0000000000000000000000000000000000000000..b5027e6ae4757e475fce1e9dc2814945d3008430 Binary files /dev/null and b/maarch_entreprise/trunk/img/bando_tete_dte.gif differ diff --git a/maarch_entreprise/trunk/img/bando_tete_gche.gif b/maarch_entreprise/trunk/img/bando_tete_gche.gif new file mode 100644 index 0000000000000000000000000000000000000000..d608149feed2d2d5309012438051a36baf8ba5ab Binary files /dev/null and b/maarch_entreprise/trunk/img/bando_tete_gche.gif differ diff --git a/maarch_entreprise/trunk/img/bando_tete_gche.png b/maarch_entreprise/trunk/img/bando_tete_gche.png new file mode 100644 index 0000000000000000000000000000000000000000..4d19e1f15b8a676552ad50ef62014b466f60a439 Binary files /dev/null and b/maarch_entreprise/trunk/img/bando_tete_gche.png differ diff --git a/maarch_entreprise/trunk/img/basket_folders.gif b/maarch_entreprise/trunk/img/basket_folders.gif new file mode 100644 index 0000000000000000000000000000000000000000..84b26f26a90b11b31dfc7c31361e3166738d5133 Binary files /dev/null and b/maarch_entreprise/trunk/img/basket_folders.gif differ diff --git a/maarch_entreprise/trunk/img/bg_body.gif b/maarch_entreprise/trunk/img/bg_body.gif new file mode 100644 index 0000000000000000000000000000000000000000..fc847271c8f1e3e247e49e4d715cf487dbf9024e Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_body.gif differ diff --git a/maarch_entreprise/trunk/img/bg_boite_post.gif b/maarch_entreprise/trunk/img/bg_boite_post.gif new file mode 100644 index 0000000000000000000000000000000000000000..9f137a6523f72a003ec4926c2eb8446548e372ab Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_boite_post.gif differ diff --git a/maarch_entreprise/trunk/img/bg_but.gif b/maarch_entreprise/trunk/img/bg_but.gif new file mode 100644 index 0000000000000000000000000000000000000000..f32fd47b917047a72511f4869605af81df311b2a Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_but.gif differ diff --git a/maarch_entreprise/trunk/img/bg_but_add_left.gif b/maarch_entreprise/trunk/img/bg_but_add_left.gif new file mode 100644 index 0000000000000000000000000000000000000000..80241415209ac8c66fdcaa252646567743b66855 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_but_add_left.gif differ diff --git a/maarch_entreprise/trunk/img/bg_but_add_right.gif b/maarch_entreprise/trunk/img/bg_but_add_right.gif new file mode 100644 index 0000000000000000000000000000000000000000..a48194588984dfe93e57258bff3f05091b9b3bc9 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_but_add_right.gif differ diff --git a/maarch_entreprise/trunk/img/bg_content.gif b/maarch_entreprise/trunk/img/bg_content.gif new file mode 100644 index 0000000000000000000000000000000000000000..e6a1e97c15e83612265ded64b0b1199b37a57d6c Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_content.gif differ diff --git a/maarch_entreprise/trunk/img/bg_footer.gif b/maarch_entreprise/trunk/img/bg_footer.gif new file mode 100644 index 0000000000000000000000000000000000000000..e1ba0d35292c19c80869d536435b3bb0833b0bd8 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_footer.gif differ diff --git a/maarch_entreprise/trunk/img/bg_head.gif b/maarch_entreprise/trunk/img/bg_head.gif new file mode 100644 index 0000000000000000000000000000000000000000..469b28b9e81ac39936a3c14d75baa40901cdc376 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_head.gif differ diff --git a/maarch_entreprise/trunk/img/bg_help_nbre.gif b/maarch_entreprise/trunk/img/bg_help_nbre.gif new file mode 100644 index 0000000000000000000000000000000000000000..f16e8d2c631034a0e34838c3dcf221cad7c108db Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_help_nbre.gif differ diff --git a/maarch_entreprise/trunk/img/bg_home.gif b/maarch_entreprise/trunk/img/bg_home.gif new file mode 100644 index 0000000000000000000000000000000000000000..3b38fd58d491f37555b355a9f5e35e18608e643b Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_home.gif differ diff --git a/maarch_entreprise/trunk/img/bg_home_home.gif b/maarch_entreprise/trunk/img/bg_home_home.gif new file mode 100644 index 0000000000000000000000000000000000000000..6d9cd010f670ce2ecdbe4a3a48dd7a7c65cf0aff Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_home_home.gif differ diff --git a/maarch_entreprise/trunk/img/bg_ht_content.gif b/maarch_entreprise/trunk/img/bg_ht_content.gif new file mode 100644 index 0000000000000000000000000000000000000000..cf175343910f6ee6907a2e548cdff74e5e428181 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_ht_content.gif differ diff --git a/maarch_entreprise/trunk/img/bg_inputsearch.gif b/maarch_entreprise/trunk/img/bg_inputsearch.gif new file mode 100644 index 0000000000000000000000000000000000000000..719cceaf8f57444d5668659f55ffdba08b6e8067 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_inputsearch.gif differ diff --git a/maarch_entreprise/trunk/img/bg_menu.gif b/maarch_entreprise/trunk/img/bg_menu.gif new file mode 100644 index 0000000000000000000000000000000000000000..f94577d747f87df3cb3feb528817d81ca583ad49 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_menu.gif differ diff --git a/maarch_entreprise/trunk/img/bg_menu_a.gif b/maarch_entreprise/trunk/img/bg_menu_a.gif new file mode 100644 index 0000000000000000000000000000000000000000..0b411b4b304f0d22ba814752128af00e624ca4d6 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_menu_a.gif differ diff --git a/maarch_entreprise/trunk/img/bg_menu_a_on.gif b/maarch_entreprise/trunk/img/bg_menu_a_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..9679f33cb819f215ffbd7449594e33561bed586a Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_menu_a_on.gif differ diff --git a/maarch_entreprise/trunk/img/bg_menu_li.gif b/maarch_entreprise/trunk/img/bg_menu_li.gif new file mode 100644 index 0000000000000000000000000000000000000000..412f6f07b8a7467e83a5c637ee9fb9f6b53dca71 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_menu_li.gif differ diff --git a/maarch_entreprise/trunk/img/bg_menu_li_on.gif b/maarch_entreprise/trunk/img/bg_menu_li_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..654d0576e281fbdbc5ab3f211d42d2c007481a34 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_menu_li_on.gif differ diff --git a/maarch_entreprise/trunk/img/bg_menu_span.gif b/maarch_entreprise/trunk/img/bg_menu_span.gif new file mode 100644 index 0000000000000000000000000000000000000000..0f30e1dd24448fce4e19c67f12119ac739ddef6c Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_menu_span.gif differ diff --git a/maarch_entreprise/trunk/img/bg_menu_span_on.gif b/maarch_entreprise/trunk/img/bg_menu_span_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..b545257ccbe82392c69461f9edf6abdf793fb6bb Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_menu_span_on.gif differ diff --git a/maarch_entreprise/trunk/img/bg_nav.gif b/maarch_entreprise/trunk/img/bg_nav.gif new file mode 100644 index 0000000000000000000000000000000000000000..bed5aa3958c1b14cae902639dbbbd39ceb7bb423 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_nav.gif differ diff --git a/maarch_entreprise/trunk/img/bg_onglet_a.gif b/maarch_entreprise/trunk/img/bg_onglet_a.gif new file mode 100644 index 0000000000000000000000000000000000000000..7f53eed8bf218ae1634f703b588a1065829599dd Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_onglet_a.gif differ diff --git a/maarch_entreprise/trunk/img/bg_onglet_a_on.gif b/maarch_entreprise/trunk/img/bg_onglet_a_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..15d2194494a7ba7d3cd3aadbf813b0bc7f2d42d8 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_onglet_a_on.gif differ diff --git a/maarch_entreprise/trunk/img/bg_onglet_li.gif b/maarch_entreprise/trunk/img/bg_onglet_li.gif new file mode 100644 index 0000000000000000000000000000000000000000..cf982fdbee0d224ca94011ffa2b0be024229bce0 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_onglet_li.gif differ diff --git a/maarch_entreprise/trunk/img/bg_onglet_li_on.gif b/maarch_entreprise/trunk/img/bg_onglet_li_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..9b86cae000edec42b42d9ce81bc2d9fa6d4182d1 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_onglet_li_on.gif differ diff --git a/maarch_entreprise/trunk/img/bg_onglet_span.gif b/maarch_entreprise/trunk/img/bg_onglet_span.gif new file mode 100644 index 0000000000000000000000000000000000000000..b08057f8c5e7c9a23c8d437ceeb9c50ac138b42f Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_onglet_span.gif differ diff --git a/maarch_entreprise/trunk/img/bg_onglet_span_on.gif b/maarch_entreprise/trunk/img/bg_onglet_span_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..b079f97e2c5f926b86693fc6407869a3c01c9aae Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_onglet_span_on.gif differ diff --git a/maarch_entreprise/trunk/img/bg_titrepage.gif b/maarch_entreprise/trunk/img/bg_titrepage.gif new file mode 100644 index 0000000000000000000000000000000000000000..15186ab7f124e705280c14be84124d2a0e1cc589 Binary files /dev/null and b/maarch_entreprise/trunk/img/bg_titrepage.gif differ diff --git a/maarch_entreprise/trunk/img/big_home_account.gif b/maarch_entreprise/trunk/img/big_home_account.gif new file mode 100644 index 0000000000000000000000000000000000000000..32e00a8cd3dd480ce3315b49f86527efe80c368c Binary files /dev/null and b/maarch_entreprise/trunk/img/big_home_account.gif differ diff --git a/maarch_entreprise/trunk/img/big_home_add.gif b/maarch_entreprise/trunk/img/big_home_add.gif new file mode 100644 index 0000000000000000000000000000000000000000..d21bfc8de67dd795f57efc5ce124c41a4d435324 Binary files /dev/null and b/maarch_entreprise/trunk/img/big_home_add.gif differ diff --git a/maarch_entreprise/trunk/img/big_home_basket.gif b/maarch_entreprise/trunk/img/big_home_basket.gif new file mode 100644 index 0000000000000000000000000000000000000000..befb4b82ed3b8feed28b469f254acac39f630f79 Binary files /dev/null and b/maarch_entreprise/trunk/img/big_home_basket.gif differ diff --git a/maarch_entreprise/trunk/img/big_home_indexing.gif b/maarch_entreprise/trunk/img/big_home_indexing.gif new file mode 100644 index 0000000000000000000000000000000000000000..1eb21ac858663ec6747d3b2de70e9ef4427af55d Binary files /dev/null and b/maarch_entreprise/trunk/img/big_home_indexing.gif differ diff --git a/maarch_entreprise/trunk/img/big_home_physical.gif b/maarch_entreprise/trunk/img/big_home_physical.gif new file mode 100644 index 0000000000000000000000000000000000000000..1eba75b958cd00c849945c67b0c8feb31f8e37d5 Binary files /dev/null and b/maarch_entreprise/trunk/img/big_home_physical.gif differ diff --git a/maarch_entreprise/trunk/img/big_home_search.gif b/maarch_entreprise/trunk/img/big_home_search.gif new file mode 100644 index 0000000000000000000000000000000000000000..e811dfb5719c67aad21d60fc44626c781d7ce14c Binary files /dev/null and b/maarch_entreprise/trunk/img/big_home_search.gif differ diff --git a/maarch_entreprise/trunk/img/big_home_stats.gif b/maarch_entreprise/trunk/img/big_home_stats.gif new file mode 100644 index 0000000000000000000000000000000000000000..c7ebac8a3d76e16a9e04f077367ab89754cb0551 Binary files /dev/null and b/maarch_entreprise/trunk/img/big_home_stats.gif differ diff --git a/maarch_entreprise/trunk/img/big_home_workflow.gif b/maarch_entreprise/trunk/img/big_home_workflow.gif new file mode 100644 index 0000000000000000000000000000000000000000..9c06670da0f2eca8e536596a35104575cd3c7ee4 Binary files /dev/null and b/maarch_entreprise/trunk/img/big_home_workflow.gif differ diff --git a/maarch_entreprise/trunk/img/boite.gif b/maarch_entreprise/trunk/img/boite.gif new file mode 100644 index 0000000000000000000000000000000000000000..496b07852aec2c4d8d425c7cbc63fd5356f19645 Binary files /dev/null and b/maarch_entreprise/trunk/img/boite.gif differ diff --git a/maarch_entreprise/trunk/img/border_bottom.gif b/maarch_entreprise/trunk/img/border_bottom.gif new file mode 100644 index 0000000000000000000000000000000000000000..89486b8b0778cf965535c96a56eff307efd9d387 Binary files /dev/null and b/maarch_entreprise/trunk/img/border_bottom.gif differ diff --git a/maarch_entreprise/trunk/img/border_bottom_left.gif b/maarch_entreprise/trunk/img/border_bottom_left.gif new file mode 100644 index 0000000000000000000000000000000000000000..e1a734049111d2b0a44667d81559b97ae0d6c5ca Binary files /dev/null and b/maarch_entreprise/trunk/img/border_bottom_left.gif differ diff --git a/maarch_entreprise/trunk/img/border_bottom_right.gif b/maarch_entreprise/trunk/img/border_bottom_right.gif new file mode 100644 index 0000000000000000000000000000000000000000..2485e20fb1b45a354efd87389f0f700772f88c1a Binary files /dev/null and b/maarch_entreprise/trunk/img/border_bottom_right.gif differ diff --git a/maarch_entreprise/trunk/img/border_left.gif b/maarch_entreprise/trunk/img/border_left.gif new file mode 100644 index 0000000000000000000000000000000000000000..55d59d46f1cfd88cf03a31084f7dcde9f0b24567 Binary files /dev/null and b/maarch_entreprise/trunk/img/border_left.gif differ diff --git a/maarch_entreprise/trunk/img/border_right.gif b/maarch_entreprise/trunk/img/border_right.gif new file mode 100644 index 0000000000000000000000000000000000000000..044f71c136bbd6c4aeceda1da53f5695131f1b78 Binary files /dev/null and b/maarch_entreprise/trunk/img/border_right.gif differ diff --git a/maarch_entreprise/trunk/img/border_top.gif b/maarch_entreprise/trunk/img/border_top.gif new file mode 100644 index 0000000000000000000000000000000000000000..9dae95f1bfd2d56b316b0d21cd02ae3834f7568c Binary files /dev/null and b/maarch_entreprise/trunk/img/border_top.gif differ diff --git a/maarch_entreprise/trunk/img/border_top_left.gif b/maarch_entreprise/trunk/img/border_top_left.gif new file mode 100644 index 0000000000000000000000000000000000000000..135cb7c665b601425bdb8eb3167630600c40f4ed Binary files /dev/null and b/maarch_entreprise/trunk/img/border_top_left.gif differ diff --git a/maarch_entreprise/trunk/img/border_top_right.gif b/maarch_entreprise/trunk/img/border_top_right.gif new file mode 100644 index 0000000000000000000000000000000000000000..6354c0a536bd703f19ade9cc76ce2b4a236635b3 Binary files /dev/null and b/maarch_entreprise/trunk/img/border_top_right.gif differ diff --git a/maarch_entreprise/trunk/img/box.gif b/maarch_entreprise/trunk/img/box.gif new file mode 100644 index 0000000000000000000000000000000000000000..914ceaba83b90298e11d7df04c5b19f79c242495 Binary files /dev/null and b/maarch_entreprise/trunk/img/box.gif differ diff --git a/maarch_entreprise/trunk/img/browse.gif b/maarch_entreprise/trunk/img/browse.gif new file mode 100644 index 0000000000000000000000000000000000000000..178140148557b7cb5e6c17863f201088bc42654f Binary files /dev/null and b/maarch_entreprise/trunk/img/browse.gif differ diff --git a/maarch_entreprise/trunk/img/browse.jpg b/maarch_entreprise/trunk/img/browse.jpg new file mode 100644 index 0000000000000000000000000000000000000000..903d75d5734337ba72eaf9a7494f94f6f97ac3a0 Binary files /dev/null and b/maarch_entreprise/trunk/img/browse.jpg differ diff --git a/maarch_entreprise/trunk/img/but_backtostart_off.gif b/maarch_entreprise/trunk/img/but_backtostart_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..26469ca02ca11141c24bd4ff7bfe2701605ee383 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_backtostart_off.gif differ diff --git a/maarch_entreprise/trunk/img/but_calend.png b/maarch_entreprise/trunk/img/but_calend.png new file mode 100644 index 0000000000000000000000000000000000000000..66021077eb0c7155b54f356bab838f7d08b7f533 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_calend.png differ diff --git a/maarch_entreprise/trunk/img/but_gotoend_off.gif b/maarch_entreprise/trunk/img/but_gotoend_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..a5c7dbedf407b2c88b92dc047d08a3fe2b62ad5d Binary files /dev/null and b/maarch_entreprise/trunk/img/but_gotoend_off.gif differ diff --git a/maarch_entreprise/trunk/img/but_gotoend_on.gif b/maarch_entreprise/trunk/img/but_gotoend_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..6ecb85ef84ba657f4d300f64d5dd8e8b3124c296 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_gotoend_on.gif differ diff --git a/maarch_entreprise/trunk/img/but_help.gif b/maarch_entreprise/trunk/img/but_help.gif new file mode 100644 index 0000000000000000000000000000000000000000..6887545676db863dcf0c17472def74f435c52cf8 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_help.gif differ diff --git a/maarch_entreprise/trunk/img/but_help.png b/maarch_entreprise/trunk/img/but_help.png new file mode 100644 index 0000000000000000000000000000000000000000..0db4392fafdebcbd84adc0ae769e0ca67d89e090 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_help.png differ diff --git a/maarch_entreprise/trunk/img/but_menu.gif b/maarch_entreprise/trunk/img/but_menu.gif new file mode 100644 index 0000000000000000000000000000000000000000..ffc362b200ae75d7917bda2219dabc5c0fc9f16c Binary files /dev/null and b/maarch_entreprise/trunk/img/but_menu.gif differ diff --git a/maarch_entreprise/trunk/img/but_menu.png b/maarch_entreprise/trunk/img/but_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..4e8918d4cd660c5305390e9f1d6ce7a31bd35e33 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_menu.png differ diff --git a/maarch_entreprise/trunk/img/but_next10_off.gif b/maarch_entreprise/trunk/img/but_next10_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..9ca1aa563b14d05ce846e3bcbd6e52fa26cb367e Binary files /dev/null and b/maarch_entreprise/trunk/img/but_next10_off.gif differ diff --git a/maarch_entreprise/trunk/img/but_next10_on.gif b/maarch_entreprise/trunk/img/but_next10_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..582c9afdd8edee2c99a18dac6939ee442e02af79 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_next10_on.gif differ diff --git a/maarch_entreprise/trunk/img/but_next_off.gif b/maarch_entreprise/trunk/img/but_next_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..c15df4383753274f6fa2d955df51299ae37a534c Binary files /dev/null and b/maarch_entreprise/trunk/img/but_next_off.gif differ diff --git a/maarch_entreprise/trunk/img/but_next_on.gif b/maarch_entreprise/trunk/img/but_next_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..c6b74c10686cdbdca5052219aa0a4099bbe4259e Binary files /dev/null and b/maarch_entreprise/trunk/img/but_next_on.gif differ diff --git a/maarch_entreprise/trunk/img/but_ok.gif b/maarch_entreprise/trunk/img/but_ok.gif new file mode 100644 index 0000000000000000000000000000000000000000..8f896eaa38ea2f5c5c357f9906925c64da60acf7 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_ok.gif differ diff --git a/maarch_entreprise/trunk/img/but_prev10_off.gif b/maarch_entreprise/trunk/img/but_prev10_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..180bbce53a48e771e12dd34511e53eeeeb7264c7 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_prev10_off.gif differ diff --git a/maarch_entreprise/trunk/img/but_prev10_on.gif b/maarch_entreprise/trunk/img/but_prev10_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..d55210e10737f14a9ddf6f2591c2b6f965ef8317 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_prev10_on.gif differ diff --git a/maarch_entreprise/trunk/img/but_prev_off.gif b/maarch_entreprise/trunk/img/but_prev_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..679e96e395b8f2888921086e02fd9399f0beaaa2 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_prev_off.gif differ diff --git a/maarch_entreprise/trunk/img/but_prev_on.gif b/maarch_entreprise/trunk/img/but_prev_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..a97a301b9adce4374b61222d50f7f371acdc1052 Binary files /dev/null and b/maarch_entreprise/trunk/img/but_prev_on.gif differ diff --git a/maarch_entreprise/trunk/img/button_ok.png b/maarch_entreprise/trunk/img/button_ok.png new file mode 100644 index 0000000000000000000000000000000000000000..05a3a06be444e196009e6a026fd90afca466ed15 Binary files /dev/null and b/maarch_entreprise/trunk/img/button_ok.png differ diff --git a/maarch_entreprise/trunk/img/cadenas_rouge.png b/maarch_entreprise/trunk/img/cadenas_rouge.png new file mode 100644 index 0000000000000000000000000000000000000000..78953c9e5c0a282bdb22ccdb9ca683d233c660ed Binary files /dev/null and b/maarch_entreprise/trunk/img/cadenas_rouge.png differ diff --git a/maarch_entreprise/trunk/img/cadenas_vert.png b/maarch_entreprise/trunk/img/cadenas_vert.png new file mode 100644 index 0000000000000000000000000000000000000000..67bf50ec2aa80d149674da48a124006c9aeccc09 Binary files /dev/null and b/maarch_entreprise/trunk/img/cadenas_vert.png differ diff --git a/maarch_entreprise/trunk/img/calendar.jpg b/maarch_entreprise/trunk/img/calendar.jpg new file mode 100644 index 0000000000000000000000000000000000000000..574c7bc22126112f27b965cabe307c33dc0106e4 Binary files /dev/null and b/maarch_entreprise/trunk/img/calendar.jpg differ diff --git a/maarch_entreprise/trunk/img/case.gif b/maarch_entreprise/trunk/img/case.gif new file mode 100644 index 0000000000000000000000000000000000000000..b3aab627c1f6cbcc5e364bb7190dab8a7e23fda0 Binary files /dev/null and b/maarch_entreprise/trunk/img/case.gif differ diff --git a/maarch_entreprise/trunk/img/case_ins_on.gif b/maarch_entreprise/trunk/img/case_ins_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..5506254147e8bf279d9c7737891b0ce3dea3c378 Binary files /dev/null and b/maarch_entreprise/trunk/img/case_ins_on.gif differ diff --git a/maarch_entreprise/trunk/img/case_on.gif b/maarch_entreprise/trunk/img/case_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..d2b3ae6c030a10628a5c6eb3345853397616d53b Binary files /dev/null and b/maarch_entreprise/trunk/img/case_on.gif differ diff --git a/maarch_entreprise/trunk/img/cat_doc_incoming.gif b/maarch_entreprise/trunk/img/cat_doc_incoming.gif new file mode 100644 index 0000000000000000000000000000000000000000..ebb5f292a1145cfeefd10ea89cd6a6c56bf81801 Binary files /dev/null and b/maarch_entreprise/trunk/img/cat_doc_incoming.gif differ diff --git a/maarch_entreprise/trunk/img/cat_doc_internal.gif b/maarch_entreprise/trunk/img/cat_doc_internal.gif new file mode 100644 index 0000000000000000000000000000000000000000..2b5a8422f6e422d122fac7779e0cb8c37a21954b Binary files /dev/null and b/maarch_entreprise/trunk/img/cat_doc_internal.gif differ diff --git a/maarch_entreprise/trunk/img/cat_doc_market.gif b/maarch_entreprise/trunk/img/cat_doc_market.gif new file mode 100644 index 0000000000000000000000000000000000000000..2fce3c06d06fd7e6c3b99896ed1b6873fd10a74e Binary files /dev/null and b/maarch_entreprise/trunk/img/cat_doc_market.gif differ diff --git a/maarch_entreprise/trunk/img/cat_doc_outgoing.gif b/maarch_entreprise/trunk/img/cat_doc_outgoing.gif new file mode 100644 index 0000000000000000000000000000000000000000..f41aaf19578fd12cd1581384ba9b4e2a5d7fda4d Binary files /dev/null and b/maarch_entreprise/trunk/img/cat_doc_outgoing.gif differ diff --git a/maarch_entreprise/trunk/img/chrono.gif b/maarch_entreprise/trunk/img/chrono.gif new file mode 100644 index 0000000000000000000000000000000000000000..26b302ae404bad90896e53f2b6ee7a40b3cc2f60 Binary files /dev/null and b/maarch_entreprise/trunk/img/chrono.gif differ diff --git a/maarch_entreprise/trunk/img/close_small.gif b/maarch_entreprise/trunk/img/close_small.gif new file mode 100644 index 0000000000000000000000000000000000000000..8bfa3a4813760882cadcb50a04d126cd71f7cca8 Binary files /dev/null and b/maarch_entreprise/trunk/img/close_small.gif differ diff --git a/maarch_entreprise/trunk/img/contact_maarch.gif b/maarch_entreprise/trunk/img/contact_maarch.gif new file mode 100644 index 0000000000000000000000000000000000000000..dea5fbe454fb6b48c9951b8d5d54e852b111d0b4 Binary files /dev/null and b/maarch_entreprise/trunk/img/contact_maarch.gif differ diff --git a/maarch_entreprise/trunk/img/contrat_mini.gif b/maarch_entreprise/trunk/img/contrat_mini.gif new file mode 100644 index 0000000000000000000000000000000000000000..fb3000bd9d1335a01b429b7982088878b5cbb295 Binary files /dev/null and b/maarch_entreprise/trunk/img/contrat_mini.gif differ diff --git a/maarch_entreprise/trunk/img/contrat_mini.png b/maarch_entreprise/trunk/img/contrat_mini.png new file mode 100644 index 0000000000000000000000000000000000000000..1763ca1ae514e0055e76f30a44803446f037eaef Binary files /dev/null and b/maarch_entreprise/trunk/img/contrat_mini.png differ diff --git a/maarch_entreprise/trunk/img/create_folder_off.gif b/maarch_entreprise/trunk/img/create_folder_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..e9287a75580c9d7600ba082306788dc0045f41d8 Binary files /dev/null and b/maarch_entreprise/trunk/img/create_folder_off.gif differ diff --git a/maarch_entreprise/trunk/img/create_folder_on.gif b/maarch_entreprise/trunk/img/create_folder_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..5e146537aed86855d41cb0b0c07d24070f2784a5 Binary files /dev/null and b/maarch_entreprise/trunk/img/create_folder_on.gif differ diff --git a/maarch_entreprise/trunk/img/date_arr.gif b/maarch_entreprise/trunk/img/date_arr.gif new file mode 100644 index 0000000000000000000000000000000000000000..ac4fafc23e4e1234f170b3f1d1fb8f2dfa5173cc Binary files /dev/null and b/maarch_entreprise/trunk/img/date_arr.gif differ diff --git a/maarch_entreprise/trunk/img/date_arriv.gif b/maarch_entreprise/trunk/img/date_arriv.gif new file mode 100644 index 0000000000000000000000000000000000000000..50ec979e4f21f76ef3eb7a963dbef6d0eda35263 Binary files /dev/null and b/maarch_entreprise/trunk/img/date_arriv.gif differ diff --git a/maarch_entreprise/trunk/img/date_limit.gif b/maarch_entreprise/trunk/img/date_limit.gif new file mode 100644 index 0000000000000000000000000000000000000000..5c30d294729fdc3f182f7a7e3ed3592a62574d1b Binary files /dev/null and b/maarch_entreprise/trunk/img/date_limit.gif differ diff --git a/maarch_entreprise/trunk/img/default.png b/maarch_entreprise/trunk/img/default.png new file mode 100644 index 0000000000000000000000000000000000000000..87ae8859e9a03df01cb136c2e745543383b92280 Binary files /dev/null and b/maarch_entreprise/trunk/img/default.png differ diff --git a/maarch_entreprise/trunk/img/default_maarch.gif b/maarch_entreprise/trunk/img/default_maarch.gif new file mode 100644 index 0000000000000000000000000000000000000000..589a299bb3f91a8fd20b480d82a8bae49ad0cf45 Binary files /dev/null and b/maarch_entreprise/trunk/img/default_maarch.gif differ diff --git a/maarch_entreprise/trunk/img/default_status.gif b/maarch_entreprise/trunk/img/default_status.gif new file mode 100644 index 0000000000000000000000000000000000000000..90a7044ba24a3ce5a75b984f35a7e63635a903b5 Binary files /dev/null and b/maarch_entreprise/trunk/img/default_status.gif differ diff --git a/maarch_entreprise/trunk/img/default_status_big.gif b/maarch_entreprise/trunk/img/default_status_big.gif new file mode 100644 index 0000000000000000000000000000000000000000..5f0ee509b40ece6134f367526cb1bc3690663029 Binary files /dev/null and b/maarch_entreprise/trunk/img/default_status_big.gif differ diff --git a/maarch_entreprise/trunk/img/desarchivage.gif b/maarch_entreprise/trunk/img/desarchivage.gif new file mode 100644 index 0000000000000000000000000000000000000000..714da0c45224900a10a64e2c2ee1a788ae31fa57 Binary files /dev/null and b/maarch_entreprise/trunk/img/desarchivage.gif differ diff --git a/maarch_entreprise/trunk/img/desarchivage_on.gif b/maarch_entreprise/trunk/img/desarchivage_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..ab72bfd20ab0fab16389a219d10b9c7a333d4123 Binary files /dev/null and b/maarch_entreprise/trunk/img/desarchivage_on.gif differ diff --git a/maarch_entreprise/trunk/img/dir_close.gif b/maarch_entreprise/trunk/img/dir_close.gif new file mode 100644 index 0000000000000000000000000000000000000000..4663ee130cf9e3d9aa115e5f4243a6c121c98747 Binary files /dev/null and b/maarch_entreprise/trunk/img/dir_close.gif differ diff --git a/maarch_entreprise/trunk/img/dir_open.gif b/maarch_entreprise/trunk/img/dir_open.gif new file mode 100644 index 0000000000000000000000000000000000000000..15bd1e7e31c17233f8c4edb1b4851168a4d1a951 Binary files /dev/null and b/maarch_entreprise/trunk/img/dir_open.gif differ diff --git a/maarch_entreprise/trunk/img/dir_point.gif b/maarch_entreprise/trunk/img/dir_point.gif new file mode 100644 index 0000000000000000000000000000000000000000..d87f1ee4085dab9752c6a2e47002b6a5a77a642e Binary files /dev/null and b/maarch_entreprise/trunk/img/dir_point.gif differ diff --git a/maarch_entreprise/trunk/img/disk.gif b/maarch_entreprise/trunk/img/disk.gif new file mode 100644 index 0000000000000000000000000000000000000000..7088ac991b7345075c297d643b10f3d9b71322cb Binary files /dev/null and b/maarch_entreprise/trunk/img/disk.gif differ diff --git a/maarch_entreprise/trunk/img/doc2.jpg b/maarch_entreprise/trunk/img/doc2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1430aa8710bab355392c0011704a2e17ecd47a3d Binary files /dev/null and b/maarch_entreprise/trunk/img/doc2.jpg differ diff --git a/maarch_entreprise/trunk/img/doc_project.gif b/maarch_entreprise/trunk/img/doc_project.gif new file mode 100644 index 0000000000000000000000000000000000000000..24e4eb042d250082fb6278b8a40418e709c7a95f Binary files /dev/null and b/maarch_entreprise/trunk/img/doc_project.gif differ diff --git a/maarch_entreprise/trunk/img/dossiers2.gif b/maarch_entreprise/trunk/img/dossiers2.gif new file mode 100644 index 0000000000000000000000000000000000000000..e16201a67be4c8514a8d6a54fbb927ce4d702b6b Binary files /dev/null and b/maarch_entreprise/trunk/img/dossiers2.gif differ diff --git a/maarch_entreprise/trunk/img/emblem-noreads.png b/maarch_entreprise/trunk/img/emblem-noreads.png new file mode 100644 index 0000000000000000000000000000000000000000..5112b3057a4101fc9050247dd2c18275a73e5232 Binary files /dev/null and b/maarch_entreprise/trunk/img/emblem-noreads.png differ diff --git a/maarch_entreprise/trunk/img/etatdoc.gif b/maarch_entreprise/trunk/img/etatdoc.gif new file mode 100644 index 0000000000000000000000000000000000000000..48407801ac2e8b9c34f01f20ef66582cf99e40ec Binary files /dev/null and b/maarch_entreprise/trunk/img/etatdoc.gif differ diff --git a/maarch_entreprise/trunk/img/extend_list.gif b/maarch_entreprise/trunk/img/extend_list.gif new file mode 100644 index 0000000000000000000000000000000000000000..06778767ee9aa4d5859bb06caa3987f690085a9b Binary files /dev/null and b/maarch_entreprise/trunk/img/extend_list.gif differ diff --git a/maarch_entreprise/trunk/img/favicon.png b/maarch_entreprise/trunk/img/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..0614f1076be08c28c966b87f4b748e1680f5b37e Binary files /dev/null and b/maarch_entreprise/trunk/img/favicon.png differ diff --git a/maarch_entreprise/trunk/img/fiche_salarie.gif b/maarch_entreprise/trunk/img/fiche_salarie.gif new file mode 100644 index 0000000000000000000000000000000000000000..e50b331a30fd37d5bfbcd7724ac9004601e4e401 Binary files /dev/null and b/maarch_entreprise/trunk/img/fiche_salarie.gif differ diff --git a/maarch_entreprise/trunk/img/file.gif b/maarch_entreprise/trunk/img/file.gif new file mode 100644 index 0000000000000000000000000000000000000000..c7219169f59978e96152d1b3d844c2ba3168bbb7 Binary files /dev/null and b/maarch_entreprise/trunk/img/file.gif differ diff --git a/maarch_entreprise/trunk/img/file_index_b.gif b/maarch_entreprise/trunk/img/file_index_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..2445bab07525604cdbb7597519709a602e80c226 Binary files /dev/null and b/maarch_entreprise/trunk/img/file_index_b.gif differ diff --git a/maarch_entreprise/trunk/img/file_status.gif b/maarch_entreprise/trunk/img/file_status.gif new file mode 100644 index 0000000000000000000000000000000000000000..5bc9e191b2c052d940be61b2df3b20c0db7475d8 Binary files /dev/null and b/maarch_entreprise/trunk/img/file_status.gif differ diff --git a/maarch_entreprise/trunk/img/file_status.jpg b/maarch_entreprise/trunk/img/file_status.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aee20ee75b88036070b2edbae88930ef0d1c883d Binary files /dev/null and b/maarch_entreprise/trunk/img/file_status.jpg differ diff --git a/maarch_entreprise/trunk/img/first_visit.PNG b/maarch_entreprise/trunk/img/first_visit.PNG new file mode 100644 index 0000000000000000000000000000000000000000..075add554cc51e6c2451a2e3ff37772dbe5531ab Binary files /dev/null and b/maarch_entreprise/trunk/img/first_visit.PNG differ diff --git a/maarch_entreprise/trunk/img/fl_dte.gif b/maarch_entreprise/trunk/img/fl_dte.gif new file mode 100644 index 0000000000000000000000000000000000000000..d04f92d7e2ad1e8d6326e7f469f39bba399df13f Binary files /dev/null and b/maarch_entreprise/trunk/img/fl_dte.gif differ diff --git a/maarch_entreprise/trunk/img/folder_details_sheet_b.gif b/maarch_entreprise/trunk/img/folder_details_sheet_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..60dc1b957ea228527382fe6d85e0c48e67383aac Binary files /dev/null and b/maarch_entreprise/trunk/img/folder_details_sheet_b.gif differ diff --git a/maarch_entreprise/trunk/img/folder_documents_mini.png b/maarch_entreprise/trunk/img/folder_documents_mini.png new file mode 100644 index 0000000000000000000000000000000000000000..4e96d7a044fcfc7d048f66e024f09917b35ff8f5 Binary files /dev/null and b/maarch_entreprise/trunk/img/folder_documents_mini.png differ diff --git a/maarch_entreprise/trunk/img/folder_out.gif b/maarch_entreprise/trunk/img/folder_out.gif new file mode 100644 index 0000000000000000000000000000000000000000..714da0c45224900a10a64e2c2ee1a788ae31fa57 Binary files /dev/null and b/maarch_entreprise/trunk/img/folder_out.gif differ diff --git a/maarch_entreprise/trunk/img/folder_out_on.gif b/maarch_entreprise/trunk/img/folder_out_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..ab72bfd20ab0fab16389a219d10b9c7a333d4123 Binary files /dev/null and b/maarch_entreprise/trunk/img/folder_out_on.gif differ diff --git a/maarch_entreprise/trunk/img/folder_search.gif b/maarch_entreprise/trunk/img/folder_search.gif new file mode 100644 index 0000000000000000000000000000000000000000..8bb5f1dc577246b8099ef23049bd01975daff4ac Binary files /dev/null and b/maarch_entreprise/trunk/img/folder_search.gif differ diff --git a/maarch_entreprise/trunk/img/folder_search_on.gif b/maarch_entreprise/trunk/img/folder_search_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..be436abcb5e1c54055187ee84bc6e0d307bb72ad Binary files /dev/null and b/maarch_entreprise/trunk/img/folder_search_on.gif differ diff --git a/maarch_entreprise/trunk/img/folderopen.gif b/maarch_entreprise/trunk/img/folderopen.gif new file mode 100644 index 0000000000000000000000000000000000000000..f296307d1593f6eebcfbe9d2531aef9a305d4c59 Binary files /dev/null and b/maarch_entreprise/trunk/img/folderopen.gif differ diff --git a/maarch_entreprise/trunk/img/gerer_dossiers.gif b/maarch_entreprise/trunk/img/gerer_dossiers.gif new file mode 100644 index 0000000000000000000000000000000000000000..b4cc8566abebf7734c5c0f450e3a88d2a4404e7d Binary files /dev/null and b/maarch_entreprise/trunk/img/gerer_dossiers.gif differ diff --git a/maarch_entreprise/trunk/img/gerer_dossiers_b.gif b/maarch_entreprise/trunk/img/gerer_dossiers_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..da84e1f0d0377058f6a9d268d2c08fac5aa92e72 Binary files /dev/null and b/maarch_entreprise/trunk/img/gerer_dossiers_b.gif differ diff --git a/maarch_entreprise/trunk/img/gerer_sous-dossiers.gif b/maarch_entreprise/trunk/img/gerer_sous-dossiers.gif new file mode 100644 index 0000000000000000000000000000000000000000..11d6e1b9ac2cc9ac5d2f31a352ea80bdeb678364 Binary files /dev/null and b/maarch_entreprise/trunk/img/gerer_sous-dossiers.gif differ diff --git a/maarch_entreprise/trunk/img/gerer_sous-dossiers_b.gif b/maarch_entreprise/trunk/img/gerer_sous-dossiers_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..38477788cf9bcdf83a7873534f21c57e04a94140 Binary files /dev/null and b/maarch_entreprise/trunk/img/gerer_sous-dossiers_b.gif differ diff --git a/maarch_entreprise/trunk/img/gerer_sous_dossiers.gif b/maarch_entreprise/trunk/img/gerer_sous_dossiers.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c293757dbddf5b0006c42df976e6fae67327e78 Binary files /dev/null and b/maarch_entreprise/trunk/img/gerer_sous_dossiers.gif differ diff --git a/maarch_entreprise/trunk/img/gerer_structures.gif b/maarch_entreprise/trunk/img/gerer_structures.gif new file mode 100644 index 0000000000000000000000000000000000000000..753f6701792492aac7bd51dd6613f1f14642cc15 Binary files /dev/null and b/maarch_entreprise/trunk/img/gerer_structures.gif differ diff --git a/maarch_entreprise/trunk/img/gerer_utilisateurs.gif b/maarch_entreprise/trunk/img/gerer_utilisateurs.gif new file mode 100644 index 0000000000000000000000000000000000000000..6ea24af056c6892157e101db5071ff0382fe073c Binary files /dev/null and b/maarch_entreprise/trunk/img/gerer_utilisateurs.gif differ diff --git a/maarch_entreprise/trunk/img/global.png b/maarch_entreprise/trunk/img/global.png new file mode 100644 index 0000000000000000000000000000000000000000..5719c464a2220706649da41c20562ab71644fbda Binary files /dev/null and b/maarch_entreprise/trunk/img/global.png differ diff --git a/maarch_entreprise/trunk/img/groupsmall.gif b/maarch_entreprise/trunk/img/groupsmall.gif new file mode 100644 index 0000000000000000000000000000000000000000..f9e37abcd100583b116ced5b455ccff0092830c4 Binary files /dev/null and b/maarch_entreprise/trunk/img/groupsmall.gif differ diff --git a/maarch_entreprise/trunk/img/historique.gif b/maarch_entreprise/trunk/img/historique.gif new file mode 100644 index 0000000000000000000000000000000000000000..417bae9b4ddc3cb17d1622757f964cdc220d9b97 Binary files /dev/null and b/maarch_entreprise/trunk/img/historique.gif differ diff --git a/maarch_entreprise/trunk/img/home.gif b/maarch_entreprise/trunk/img/home.gif new file mode 100644 index 0000000000000000000000000000000000000000..611819228c8e9af118560f3ede59639960e89117 Binary files /dev/null and b/maarch_entreprise/trunk/img/home.gif differ diff --git a/maarch_entreprise/trunk/img/ico_back.gif b/maarch_entreprise/trunk/img/ico_back.gif new file mode 100644 index 0000000000000000000000000000000000000000..f44ac21efb1a1c9bcdac338a6db96559337656d4 Binary files /dev/null and b/maarch_entreprise/trunk/img/ico_back.gif differ diff --git a/maarch_entreprise/trunk/img/icone_null2.gif b/maarch_entreprise/trunk/img/icone_null2.gif new file mode 100644 index 0000000000000000000000000000000000000000..56b135de64690c49721cc618d11adfe5b6ff54e8 Binary files /dev/null and b/maarch_entreprise/trunk/img/icone_null2.gif differ diff --git a/maarch_entreprise/trunk/img/icone_pdf.gif b/maarch_entreprise/trunk/img/icone_pdf.gif new file mode 100644 index 0000000000000000000000000000000000000000..8d8ff20e943bdcf49ee2af6a0c733f3b10416152 Binary files /dev/null and b/maarch_entreprise/trunk/img/icone_pdf.gif differ diff --git a/maarch_entreprise/trunk/img/icone_pdfHQ.gif b/maarch_entreprise/trunk/img/icone_pdfHQ.gif new file mode 100644 index 0000000000000000000000000000000000000000..27f6d066446cff80352641357faf70f49c7a7f04 Binary files /dev/null and b/maarch_entreprise/trunk/img/icone_pdfHQ.gif differ diff --git a/maarch_entreprise/trunk/img/icone_pdflow.gif b/maarch_entreprise/trunk/img/icone_pdflow.gif new file mode 100644 index 0000000000000000000000000000000000000000..e20517414c54aecf970c8f45cc79c160a796feb4 Binary files /dev/null and b/maarch_entreprise/trunk/img/icone_pdflow.gif differ diff --git a/maarch_entreprise/trunk/img/icone_tiff.gif b/maarch_entreprise/trunk/img/icone_tiff.gif new file mode 100644 index 0000000000000000000000000000000000000000..f69863e832b34560781902e2ce36bd0c7df3905b Binary files /dev/null and b/maarch_entreprise/trunk/img/icone_tiff.gif differ diff --git a/maarch_entreprise/trunk/img/illustr_home.jpg b/maarch_entreprise/trunk/img/illustr_home.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6e9737cd3b6a67b46be089f0c53f2039ce9e413d Binary files /dev/null and b/maarch_entreprise/trunk/img/illustr_home.jpg differ diff --git a/maarch_entreprise/trunk/img/indexing_off.gif b/maarch_entreprise/trunk/img/indexing_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..8da5889ca3d2916079f34de0df7224ac542e636f Binary files /dev/null and b/maarch_entreprise/trunk/img/indexing_off.gif differ diff --git a/maarch_entreprise/trunk/img/indexing_on.gif b/maarch_entreprise/trunk/img/indexing_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..288402f4492b8b546580ba575e8bdbcc6f0301ef Binary files /dev/null and b/maarch_entreprise/trunk/img/indexing_on.gif differ diff --git a/maarch_entreprise/trunk/img/indexing_tab_off.gif b/maarch_entreprise/trunk/img/indexing_tab_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..e2e77d01763f07e638f0bec888e6e9d56548c8d9 Binary files /dev/null and b/maarch_entreprise/trunk/img/indexing_tab_off.gif differ diff --git a/maarch_entreprise/trunk/img/jpg.png b/maarch_entreprise/trunk/img/jpg.png new file mode 100644 index 0000000000000000000000000000000000000000..81fb5508bffba71c16e777e19fd83054cedd966c Binary files /dev/null and b/maarch_entreprise/trunk/img/jpg.png differ diff --git a/maarch_entreprise/trunk/img/letterbox_logo.gif b/maarch_entreprise/trunk/img/letterbox_logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..ec01fd4265e27bf631309782fb608777a3060feb Binary files /dev/null and b/maarch_entreprise/trunk/img/letterbox_logo.gif differ diff --git a/maarch_entreprise/trunk/img/loading.gif b/maarch_entreprise/trunk/img/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..f2a1bc0c6f545e20e631a96e8e92f9822e75d046 Binary files /dev/null and b/maarch_entreprise/trunk/img/loading.gif differ diff --git a/maarch_entreprise/trunk/img/logout_off.gif b/maarch_entreprise/trunk/img/logout_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..df89ec8cafd07fe940659f20d0ff9976ef39f595 Binary files /dev/null and b/maarch_entreprise/trunk/img/logout_off.gif differ diff --git a/maarch_entreprise/trunk/img/logout_on.gif b/maarch_entreprise/trunk/img/logout_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..5668dfb7e10697151d946fb5aae3ebffa687358d Binary files /dev/null and b/maarch_entreprise/trunk/img/logout_on.gif differ diff --git a/maarch_entreprise/trunk/img/lot.gif b/maarch_entreprise/trunk/img/lot.gif new file mode 100644 index 0000000000000000000000000000000000000000..39f0765fd8d20149a8203a522d110f73b84f35c8 Binary files /dev/null and b/maarch_entreprise/trunk/img/lot.gif differ diff --git a/maarch_entreprise/trunk/img/lunch_guide.gif b/maarch_entreprise/trunk/img/lunch_guide.gif new file mode 100644 index 0000000000000000000000000000000000000000..65debc86ea10f43ebb9e38271864f1c8bf1db681 Binary files /dev/null and b/maarch_entreprise/trunk/img/lunch_guide.gif differ diff --git a/maarch_entreprise/trunk/img/maarch_advance.gif b/maarch_entreprise/trunk/img/maarch_advance.gif new file mode 100644 index 0000000000000000000000000000000000000000..24f3cdcd51dc60e122fe69a401e604eb93a9e5ec Binary files /dev/null and b/maarch_entreprise/trunk/img/maarch_advance.gif differ diff --git a/maarch_entreprise/trunk/img/maarch_box.gif b/maarch_entreprise/trunk/img/maarch_box.gif new file mode 100755 index 0000000000000000000000000000000000000000..e6fbf76d88a88a3d2c59964fb8e26785842a10b5 Binary files /dev/null and b/maarch_entreprise/trunk/img/maarch_box.gif differ diff --git a/maarch_entreprise/trunk/img/maarch_box.png b/maarch_entreprise/trunk/img/maarch_box.png new file mode 100644 index 0000000000000000000000000000000000000000..cbad8fe45af0b859f9c051b24bc8737a2cd2a912 Binary files /dev/null and b/maarch_entreprise/trunk/img/maarch_box.png differ diff --git a/maarch_entreprise/trunk/img/maarch_peoplebox.gif b/maarch_entreprise/trunk/img/maarch_peoplebox.gif new file mode 100644 index 0000000000000000000000000000000000000000..ad00a1acc26122dc6d99460610ded5a07bee0789 Binary files /dev/null and b/maarch_entreprise/trunk/img/maarch_peoplebox.gif differ diff --git a/maarch_entreprise/trunk/img/maarch_peoplebox_bak.gif b/maarch_entreprise/trunk/img/maarch_peoplebox_bak.gif new file mode 100644 index 0000000000000000000000000000000000000000..bfc1e8f7e77f465ced6c019ff46cf1be263aaccc Binary files /dev/null and b/maarch_entreprise/trunk/img/maarch_peoplebox_bak.gif differ diff --git a/maarch_entreprise/trunk/img/maarchbox.gif b/maarch_entreprise/trunk/img/maarchbox.gif new file mode 100644 index 0000000000000000000000000000000000000000..e6fbf76d88a88a3d2c59964fb8e26785842a10b5 Binary files /dev/null and b/maarch_entreprise/trunk/img/maarchbox.gif differ diff --git a/maarch_entreprise/trunk/img/mail.gif b/maarch_entreprise/trunk/img/mail.gif new file mode 100644 index 0000000000000000000000000000000000000000..73d5e607c02537250092d27f13a5d17bdff8b69c Binary files /dev/null and b/maarch_entreprise/trunk/img/mail.gif differ diff --git a/maarch_entreprise/trunk/img/mail_big.gif b/maarch_entreprise/trunk/img/mail_big.gif new file mode 100644 index 0000000000000000000000000000000000000000..93f7b1c9f46762350c0901f0ca78507f6b1f200a Binary files /dev/null and b/maarch_entreprise/trunk/img/mail_big.gif differ diff --git a/maarch_entreprise/trunk/img/mail_end.gif b/maarch_entreprise/trunk/img/mail_end.gif new file mode 100644 index 0000000000000000000000000000000000000000..2afe34ab8eb296d10f4263066a1df77b54e6a52f Binary files /dev/null and b/maarch_entreprise/trunk/img/mail_end.gif differ diff --git a/maarch_entreprise/trunk/img/mail_end_big.gif b/maarch_entreprise/trunk/img/mail_end_big.gif new file mode 100644 index 0000000000000000000000000000000000000000..fe27f1f85731bcae4b9a9462f0a77cbfdc539977 Binary files /dev/null and b/maarch_entreprise/trunk/img/mail_end_big.gif differ diff --git a/maarch_entreprise/trunk/img/mail_gene.gif b/maarch_entreprise/trunk/img/mail_gene.gif new file mode 100644 index 0000000000000000000000000000000000000000..2a725550cac00e908f6557de454469d8280ea7ce Binary files /dev/null and b/maarch_entreprise/trunk/img/mail_gene.gif differ diff --git a/maarch_entreprise/trunk/img/mail_gene_big.gif b/maarch_entreprise/trunk/img/mail_gene_big.gif new file mode 100644 index 0000000000000000000000000000000000000000..517a831955b4c83dc4f00bd0551d6965bf0f928b Binary files /dev/null and b/maarch_entreprise/trunk/img/mail_gene_big.gif differ diff --git a/maarch_entreprise/trunk/img/mail_new.gif b/maarch_entreprise/trunk/img/mail_new.gif new file mode 100644 index 0000000000000000000000000000000000000000..0f27c636d36ef8157a7673c425c5e45ebd850c86 Binary files /dev/null and b/maarch_entreprise/trunk/img/mail_new.gif differ diff --git a/maarch_entreprise/trunk/img/mail_new_big.gif b/maarch_entreprise/trunk/img/mail_new_big.gif new file mode 100644 index 0000000000000000000000000000000000000000..09ff8b40cbaa3a207013ccecfcbc979ad795e4fc Binary files /dev/null and b/maarch_entreprise/trunk/img/mail_new_big.gif differ diff --git a/maarch_entreprise/trunk/img/manage_actions.gif b/maarch_entreprise/trunk/img/manage_actions.gif new file mode 100644 index 0000000000000000000000000000000000000000..04a8dbb0d965650c7ddae76e3890d642c39c4ead Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_actions.gif differ diff --git a/maarch_entreprise/trunk/img/manage_actions_b.gif b/maarch_entreprise/trunk/img/manage_actions_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..78b3822be0b75b5c7f3ed84d740b506eed27c8ab Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_actions_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_architecture.gif b/maarch_entreprise/trunk/img/manage_architecture.gif new file mode 100644 index 0000000000000000000000000000000000000000..35ea53910428d55d315798a011cd0d502ec55b67 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_architecture.gif differ diff --git a/maarch_entreprise/trunk/img/manage_architecture_b.gif b/maarch_entreprise/trunk/img/manage_architecture_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..af2b42435d3f05dd1ec73245e1d5a62d7eefbd21 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_architecture_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_contact_b.gif b/maarch_entreprise/trunk/img/manage_contact_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..4a9f2790659e5de92b42a91f63be42deda0c0c30 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_contact_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_contacts.gif b/maarch_entreprise/trunk/img/manage_contacts.gif new file mode 100644 index 0000000000000000000000000000000000000000..0a9855112bf1bde934f40260958398eb41c69297 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_contacts.gif differ diff --git a/maarch_entreprise/trunk/img/manage_doctypes.gif b/maarch_entreprise/trunk/img/manage_doctypes.gif new file mode 100644 index 0000000000000000000000000000000000000000..3a513a35119ffcc61553b7a2fe0ce3de28c9686f Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_doctypes.gif differ diff --git a/maarch_entreprise/trunk/img/manage_doctypes_b.gif b/maarch_entreprise/trunk/img/manage_doctypes_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..f6a89c354f01f6acca31af6d662801585655812b Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_doctypes_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_groupe.gif b/maarch_entreprise/trunk/img/manage_groupe.gif new file mode 100644 index 0000000000000000000000000000000000000000..a40d0c1530d496104139e16f5a0552a914eda5e9 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_groupe.gif differ diff --git a/maarch_entreprise/trunk/img/manage_groupe_b.gif b/maarch_entreprise/trunk/img/manage_groupe_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..8d935704c5db227b4b0f7f4b8ba3a073d6be60f1 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_groupe_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_groups.gif b/maarch_entreprise/trunk/img/manage_groups.gif new file mode 100644 index 0000000000000000000000000000000000000000..2eaf0f369305d214e2001e40c59cc373685cb389 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_groups.gif differ diff --git a/maarch_entreprise/trunk/img/manage_groups_b.gif b/maarch_entreprise/trunk/img/manage_groups_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..3e8038906247e68466107e7ad8ea4ecf61023009 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_groups_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_status.gif b/maarch_entreprise/trunk/img/manage_status.gif new file mode 100644 index 0000000000000000000000000000000000000000..b37d6acf5e7505a989d5ed4449db62a59d005149 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_status.gif differ diff --git a/maarch_entreprise/trunk/img/manage_status_b.gif b/maarch_entreprise/trunk/img/manage_status_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..21bb3c49b12d83b0b1030b87905c2fd48e94bf15 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_status_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_structures.gif b/maarch_entreprise/trunk/img/manage_structures.gif new file mode 100644 index 0000000000000000000000000000000000000000..b7e91da7b7aa7b8cd8a3f624ca5638a7c443c8d6 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_structures.gif differ diff --git a/maarch_entreprise/trunk/img/manage_structures2.gif b/maarch_entreprise/trunk/img/manage_structures2.gif new file mode 100644 index 0000000000000000000000000000000000000000..a00b55569123b65152ca65af2db6d69cf3e88d77 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_structures2.gif differ diff --git a/maarch_entreprise/trunk/img/manage_structures2_b.gif b/maarch_entreprise/trunk/img/manage_structures2_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..6dbf5b568acdc9feac6addb909ec5ad7a89eceb5 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_structures2_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_structures_b.gif b/maarch_entreprise/trunk/img/manage_structures_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..4069b30fe65a8113fb42f9078486d806c19d0b51 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_structures_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_subfolders.gif b/maarch_entreprise/trunk/img/manage_subfolders.gif new file mode 100644 index 0000000000000000000000000000000000000000..8962465dd8176b7e687b1257c8a2a97535109e2b Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_subfolders.gif differ diff --git a/maarch_entreprise/trunk/img/manage_subfolders2.gif b/maarch_entreprise/trunk/img/manage_subfolders2.gif new file mode 100644 index 0000000000000000000000000000000000000000..11d6e1b9ac2cc9ac5d2f31a352ea80bdeb678364 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_subfolders2.gif differ diff --git a/maarch_entreprise/trunk/img/manage_subfolders_b.gif b/maarch_entreprise/trunk/img/manage_subfolders_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..aca1952f30f9fc1d659dec434d1088f4bdb5ac86 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_subfolders_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_types2.gif b/maarch_entreprise/trunk/img/manage_types2.gif new file mode 100644 index 0000000000000000000000000000000000000000..b4cc8566abebf7734c5c0f450e3a88d2a4404e7d Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_types2.gif differ diff --git a/maarch_entreprise/trunk/img/manage_users.gif b/maarch_entreprise/trunk/img/manage_users.gif new file mode 100644 index 0000000000000000000000000000000000000000..9625a5efcc337b3ffe4f741c90fc3cb3c661143a Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_users.gif differ diff --git a/maarch_entreprise/trunk/img/manage_users_b.gif b/maarch_entreprise/trunk/img/manage_users_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..668d4e44bc0539d87f8de206e601156853ada754 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_users_b.gif differ diff --git a/maarch_entreprise/trunk/img/manage_users_entities_b_small.gif b/maarch_entreprise/trunk/img/manage_users_entities_b_small.gif new file mode 100644 index 0000000000000000000000000000000000000000..6a3eeca23de4b12393654c0569413a9183fa5c49 Binary files /dev/null and b/maarch_entreprise/trunk/img/manage_users_entities_b_small.gif differ diff --git a/maarch_entreprise/trunk/img/market.gif b/maarch_entreprise/trunk/img/market.gif new file mode 100644 index 0000000000000000000000000000000000000000..c0e6664fc4428c852eb0c5b067464a1d6ad148d0 Binary files /dev/null and b/maarch_entreprise/trunk/img/market.gif differ diff --git a/maarch_entreprise/trunk/img/md5.gif b/maarch_entreprise/trunk/img/md5.gif new file mode 100644 index 0000000000000000000000000000000000000000..453b9cc313a2509e951a31ca342c99b2b89f07e9 Binary files /dev/null and b/maarch_entreprise/trunk/img/md5.gif differ diff --git a/maarch_entreprise/trunk/img/membres_groupe_b.gif b/maarch_entreprise/trunk/img/membres_groupe_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..870b518ec67a137666ee459eddf7a64d417b725a Binary files /dev/null and b/maarch_entreprise/trunk/img/membres_groupe_b.gif differ diff --git a/maarch_entreprise/trunk/img/mini_type.gif b/maarch_entreprise/trunk/img/mini_type.gif new file mode 100644 index 0000000000000000000000000000000000000000..06a9be5cc095a3e402211a5b9c20a94e326888af Binary files /dev/null and b/maarch_entreprise/trunk/img/mini_type.gif differ diff --git a/maarch_entreprise/trunk/img/modif_liste.png b/maarch_entreprise/trunk/img/modif_liste.png new file mode 100644 index 0000000000000000000000000000000000000000..05711a0948ed445c97dd21645f42a22a403735c9 Binary files /dev/null and b/maarch_entreprise/trunk/img/modif_liste.png differ diff --git a/maarch_entreprise/trunk/img/moins.png b/maarch_entreprise/trunk/img/moins.png new file mode 100644 index 0000000000000000000000000000000000000000..0d0b2d5e0c519c8d590765a2f7d5949779a9c4fd Binary files /dev/null and b/maarch_entreprise/trunk/img/moins.png differ diff --git a/maarch_entreprise/trunk/img/my_contacts_off.gif b/maarch_entreprise/trunk/img/my_contacts_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..5f6a952980d1cd596430d5d966598d22f6c7c2df Binary files /dev/null and b/maarch_entreprise/trunk/img/my_contacts_off.gif differ diff --git a/maarch_entreprise/trunk/img/my_contacts_on.gif b/maarch_entreprise/trunk/img/my_contacts_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..9f351d3d95cc3b56c8189b37f994009ba295b6fc Binary files /dev/null and b/maarch_entreprise/trunk/img/my_contacts_on.gif differ diff --git a/maarch_entreprise/trunk/img/nature_send.gif b/maarch_entreprise/trunk/img/nature_send.gif new file mode 100644 index 0000000000000000000000000000000000000000..d6b0a2dceab7d70bfcf2ce845f79a8c4d7f1e393 Binary files /dev/null and b/maarch_entreprise/trunk/img/nature_send.gif differ diff --git a/maarch_entreprise/trunk/img/navback_small_blue.jpg b/maarch_entreprise/trunk/img/navback_small_blue.jpg new file mode 100644 index 0000000000000000000000000000000000000000..da73cadf29fbd309a489a7dacdc389ef92ba1723 Binary files /dev/null and b/maarch_entreprise/trunk/img/navback_small_blue.jpg differ diff --git a/maarch_entreprise/trunk/img/next.png b/maarch_entreprise/trunk/img/next.png new file mode 100644 index 0000000000000000000000000000000000000000..c1c4f5de12ced901a8a78177194c2b8b7c34f70e Binary files /dev/null and b/maarch_entreprise/trunk/img/next.png differ diff --git a/maarch_entreprise/trunk/img/next10_visit.PNG b/maarch_entreprise/trunk/img/next10_visit.PNG new file mode 100644 index 0000000000000000000000000000000000000000..b79db5605aed701145575ed3c9dc778fa5668ebd Binary files /dev/null and b/maarch_entreprise/trunk/img/next10_visit.PNG differ diff --git a/maarch_entreprise/trunk/img/next_visit.PNG b/maarch_entreprise/trunk/img/next_visit.PNG new file mode 100644 index 0000000000000000000000000000000000000000..741381076496e12ed92becafc99e329cb8e3ba11 Binary files /dev/null and b/maarch_entreprise/trunk/img/next_visit.PNG differ diff --git a/maarch_entreprise/trunk/img/noresult.gif b/maarch_entreprise/trunk/img/noresult.gif new file mode 100644 index 0000000000000000000000000000000000000000..02de1e8dd405f09b31adc0960b807e2d3903427b Binary files /dev/null and b/maarch_entreprise/trunk/img/noresult.gif differ diff --git a/maarch_entreprise/trunk/img/object.gif b/maarch_entreprise/trunk/img/object.gif new file mode 100644 index 0000000000000000000000000000000000000000..9c68ea0a1f2f9faf69eb33f19f1eca1605b95f12 Binary files /dev/null and b/maarch_entreprise/trunk/img/object.gif differ diff --git a/maarch_entreprise/trunk/img/pa_boxes.gif b/maarch_entreprise/trunk/img/pa_boxes.gif new file mode 100644 index 0000000000000000000000000000000000000000..3a7f963a2a4d15bdfe0e90d2bd5f128af29407b3 Binary files /dev/null and b/maarch_entreprise/trunk/img/pa_boxes.gif differ diff --git a/maarch_entreprise/trunk/img/page.gif b/maarch_entreprise/trunk/img/page.gif new file mode 100644 index 0000000000000000000000000000000000000000..3304be6db05d25a0804841b3aa230a088b7e2c28 Binary files /dev/null and b/maarch_entreprise/trunk/img/page.gif differ diff --git a/maarch_entreprise/trunk/img/picto_add_b.gif b/maarch_entreprise/trunk/img/picto_add_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..06d39d7eb13000342e5b510f33179d3c8ea9d379 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_add_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_admin_b.gif b/maarch_entreprise/trunk/img/picto_admin_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..7a443063bce14e3a903d2144f64c72582d86aca5 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_admin_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_authorize.gif b/maarch_entreprise/trunk/img/picto_authorize.gif new file mode 100644 index 0000000000000000000000000000000000000000..398474665cd8d41968f63a6ca42ad12d4176df38 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_authorize.gif differ diff --git a/maarch_entreprise/trunk/img/picto_basket_b.gif b/maarch_entreprise/trunk/img/picto_basket_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..d75ff027251a518cd3dce2aa5f4a66922dd9d3f2 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_basket_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_change.gif b/maarch_entreprise/trunk/img/picto_change.gif new file mode 100644 index 0000000000000000000000000000000000000000..847e96aaf7ba9ec852cf140b2e5d0ad038e04c37 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_change.gif differ diff --git a/maarch_entreprise/trunk/img/picto_change_b.gif b/maarch_entreprise/trunk/img/picto_change_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..466b952ffb8875996f257064a1b29161848b6760 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_change_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_collection.gif b/maarch_entreprise/trunk/img/picto_collection.gif new file mode 100644 index 0000000000000000000000000000000000000000..b23695b68c8c4bf62c56090742c55127e8d67195 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_collection.gif differ diff --git a/maarch_entreprise/trunk/img/picto_delete.gif b/maarch_entreprise/trunk/img/picto_delete.gif new file mode 100644 index 0000000000000000000000000000000000000000..69e705a2af645c57e1c31deb54a50cc58f1df1f1 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_delete.gif differ diff --git a/maarch_entreprise/trunk/img/picto_detail_b.gif b/maarch_entreprise/trunk/img/picto_detail_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..c26af969838b1cb2e48cb56b6e025b07bdbb7c78 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_detail_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_dld.gif b/maarch_entreprise/trunk/img/picto_dld.gif new file mode 100644 index 0000000000000000000000000000000000000000..8ccde5be01d09fc1261dee7ae465b5da680a58c8 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_dld.gif differ diff --git a/maarch_entreprise/trunk/img/picto_feedback.gif b/maarch_entreprise/trunk/img/picto_feedback.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed3a0b8ef3072916756b9b57d1db6f4c05e012b6 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_feedback.gif differ diff --git a/maarch_entreprise/trunk/img/picto_file_b.gif b/maarch_entreprise/trunk/img/picto_file_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..4db72381abe625ce600f001f283b4387f2d14f13 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_file_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_files_b.gif b/maarch_entreprise/trunk/img/picto_files_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..e921982ebdc40807eff934f9966fe9229412288d Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_files_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_group_b.gif b/maarch_entreprise/trunk/img/picto_group_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e6d272205d47f15b4c5ee66624e33260fa52ec0 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_group_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_help_admin.gif b/maarch_entreprise/trunk/img/picto_help_admin.gif new file mode 100644 index 0000000000000000000000000000000000000000..dff7a7c3109a22b8c3e9761072c9dee200880eed Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_help_admin.gif differ diff --git a/maarch_entreprise/trunk/img/picto_help_b.gif b/maarch_entreprise/trunk/img/picto_help_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..b419867c53ebff360ecff9a3c9fe29871569d85e Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_help_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_help_functions.gif b/maarch_entreprise/trunk/img/picto_help_functions.gif new file mode 100644 index 0000000000000000000000000000000000000000..dbe972b87ac77357e75d0d59b5753886f9f6b4f4 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_help_functions.gif differ diff --git a/maarch_entreprise/trunk/img/picto_help_search.gif b/maarch_entreprise/trunk/img/picto_help_search.gif new file mode 100644 index 0000000000000000000000000000000000000000..0aaab515fa5ccba110582ac23552c1ba0b56b889 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_help_search.gif differ diff --git a/maarch_entreprise/trunk/img/picto_histo_b.gif b/maarch_entreprise/trunk/img/picto_histo_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..b95a43591657397c17b86da191259662c952a309 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_histo_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_infos.gif b/maarch_entreprise/trunk/img/picto_infos.gif new file mode 100644 index 0000000000000000000000000000000000000000..f35105cb6df10e3f9d29cffdd91903fb4d43e8d3 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_infos.gif differ diff --git a/maarch_entreprise/trunk/img/picto_managed_superb.gif b/maarch_entreprise/trunk/img/picto_managed_superb.gif new file mode 100644 index 0000000000000000000000000000000000000000..0964a7315f9d9f8359511a4a7a8342d260407b4a Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_managed_superb.gif differ diff --git a/maarch_entreprise/trunk/img/picto_manageg_superb.gif b/maarch_entreprise/trunk/img/picto_manageg_superb.gif new file mode 100644 index 0000000000000000000000000000000000000000..f0bf9bd4e117a7fdf5a09a8a2b770679894c6291 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_manageg_superb.gif differ diff --git a/maarch_entreprise/trunk/img/picto_manageu_superb.gif b/maarch_entreprise/trunk/img/picto_manageu_superb.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed7c977d93c3f6b4a699315387d8c5d5bfe1d0e7 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_manageu_superb.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_admin.gif b/maarch_entreprise/trunk/img/picto_menu_admin.gif new file mode 100644 index 0000000000000000000000000000000000000000..01b372a10ec51c012743dde7f1db6556391fbcfc Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_admin.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_admin_on.gif b/maarch_entreprise/trunk/img/picto_menu_admin_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..3290f22cee156694d89dd23470d31234fcf1bbfc Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_admin_on.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_browse.gif b/maarch_entreprise/trunk/img/picto_menu_browse.gif new file mode 100644 index 0000000000000000000000000000000000000000..e9287a75580c9d7600ba082306788dc0045f41d8 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_browse.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_browse_on.gif b/maarch_entreprise/trunk/img/picto_menu_browse_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..5e146537aed86855d41cb0b0c07d24070f2784a5 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_browse_on.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_fileindex.gif b/maarch_entreprise/trunk/img/picto_menu_fileindex.gif new file mode 100644 index 0000000000000000000000000000000000000000..2994b9c61b95d7ced853940c264ceac1234b286b Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_fileindex.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_fileindex_on.gif b/maarch_entreprise/trunk/img/picto_menu_fileindex_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..978766be590d349092ac9cf4ecbb0a529376c584 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_fileindex_on.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_help.gif b/maarch_entreprise/trunk/img/picto_menu_help.gif new file mode 100644 index 0000000000000000000000000000000000000000..8efe1585ebe9abf51945f0f79395072b1a80d7b5 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_help.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_help_on.gif b/maarch_entreprise/trunk/img/picto_menu_help_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..cbffcf4ea2897c212a525747798df6a79ec48ed5 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_help_on.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_postindex.gif b/maarch_entreprise/trunk/img/picto_menu_postindex.gif new file mode 100644 index 0000000000000000000000000000000000000000..f3aa0815a9f95d42c9b8b15e34697f2b550515d9 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_postindex.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_postindex_on.gif b/maarch_entreprise/trunk/img/picto_menu_postindex_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..838d87ff1b6a751ae000ed256385f90a1afd9b64 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_postindex_on.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_search.gif b/maarch_entreprise/trunk/img/picto_menu_search.gif new file mode 100644 index 0000000000000000000000000000000000000000..ec0061b3ac93790a0a0b3b28b332c89cd143fd58 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_search.gif differ diff --git a/maarch_entreprise/trunk/img/picto_menu_search_on.gif b/maarch_entreprise/trunk/img/picto_menu_search_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..34afbcafba495e9740f10cc6af90e70b86f4d120 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_menu_search_on.gif differ diff --git a/maarch_entreprise/trunk/img/picto_post_b.gif b/maarch_entreprise/trunk/img/picto_post_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..b9338c6567df3215d12d00f029c534277531e3a0 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_post_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_primarygroup.gif b/maarch_entreprise/trunk/img/picto_primarygroup.gif new file mode 100644 index 0000000000000000000000000000000000000000..540b68762a42dc5d0939154bda357ffae27247d9 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_primarygroup.gif differ diff --git a/maarch_entreprise/trunk/img/picto_search_b.gif b/maarch_entreprise/trunk/img/picto_search_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..fcf51e58e71f495b80ed656acce9213d2bf01c3c Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_search_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_search_c.gif b/maarch_entreprise/trunk/img/picto_search_c.gif new file mode 100644 index 0000000000000000000000000000000000000000..517c5e36f710ddafd4afd5ae5b139278f472e1e2 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_search_c.gif differ diff --git a/maarch_entreprise/trunk/img/picto_service_b.gif b/maarch_entreprise/trunk/img/picto_service_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..a87d448b8caf3b51610b75b7768130d1174b1695 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_service_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_stat_disabled.gif b/maarch_entreprise/trunk/img/picto_stat_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..8301304acbabc7714bab7de2a123d7eb4b3b15f7 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_stat_disabled.gif differ diff --git a/maarch_entreprise/trunk/img/picto_stat_enabled.gif b/maarch_entreprise/trunk/img/picto_stat_enabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..53cf2856f47715369d0c70e25dd4822999d242db Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_stat_enabled.gif differ diff --git a/maarch_entreprise/trunk/img/picto_suspend.gif b/maarch_entreprise/trunk/img/picto_suspend.gif new file mode 100644 index 0000000000000000000000000000000000000000..e75d227b81bb85cac4ac09852c613c7f83bd1494 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_suspend.gif differ diff --git a/maarch_entreprise/trunk/img/picto_trait_b.gif b/maarch_entreprise/trunk/img/picto_trait_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..fbef228eebcffa29c12b49868e999b8fe145919a Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_trait_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_types_b.gif b/maarch_entreprise/trunk/img/picto_types_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..9147fa6a010a2dc27aefadabfcd712ca6cc9dbdc Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_types_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_user.gif b/maarch_entreprise/trunk/img/picto_user.gif new file mode 100644 index 0000000000000000000000000000000000000000..93dc9550427b61abe841defad2078e37234da1f0 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_user.gif differ diff --git a/maarch_entreprise/trunk/img/picto_user_b.gif b/maarch_entreprise/trunk/img/picto_user_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..4a6ee99f071d3f88c5ed335192adf9d7ab897701 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_user_b.gif differ diff --git a/maarch_entreprise/trunk/img/picto_view.gif b/maarch_entreprise/trunk/img/picto_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..972123441181db1ea31c38a167816ecb3fd39dd0 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_view.gif differ diff --git a/maarch_entreprise/trunk/img/picto_viewhis_superb.gif b/maarch_entreprise/trunk/img/picto_viewhis_superb.gif new file mode 100644 index 0000000000000000000000000000000000000000..e4e28c9033fa470765d67fd4086516381d1965a9 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_viewhis_superb.gif differ diff --git a/maarch_entreprise/trunk/img/picto_welcome_b.gif b/maarch_entreprise/trunk/img/picto_welcome_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..a3e3b8c41829e55007fa72e9f9fbcb6ba349a325 Binary files /dev/null and b/maarch_entreprise/trunk/img/picto_welcome_b.gif differ diff --git a/maarch_entreprise/trunk/img/pictos_helphome.gif b/maarch_entreprise/trunk/img/pictos_helphome.gif new file mode 100644 index 0000000000000000000000000000000000000000..5290fdae5a06d1a7664cc99d423a94a86048732e Binary files /dev/null and b/maarch_entreprise/trunk/img/pictos_helphome.gif differ diff --git a/maarch_entreprise/trunk/img/plus.png b/maarch_entreprise/trunk/img/plus.png new file mode 100644 index 0000000000000000000000000000000000000000..2905a1682a21259c0a626dab49f02c7965fa463b Binary files /dev/null and b/maarch_entreprise/trunk/img/plus.png differ diff --git a/maarch_entreprise/trunk/img/prev10.png b/maarch_entreprise/trunk/img/prev10.png new file mode 100644 index 0000000000000000000000000000000000000000..9c374c139ddb45582b08aebd164e117aea60a79d Binary files /dev/null and b/maarch_entreprise/trunk/img/prev10.png differ diff --git a/maarch_entreprise/trunk/img/prev_visit.PNG b/maarch_entreprise/trunk/img/prev_visit.PNG new file mode 100644 index 0000000000000000000000000000000000000000..ad47f91747db7e9343719133c1bfccc565afa4f8 Binary files /dev/null and b/maarch_entreprise/trunk/img/prev_visit.PNG differ diff --git a/maarch_entreprise/trunk/img/project.gif b/maarch_entreprise/trunk/img/project.gif new file mode 100644 index 0000000000000000000000000000000000000000..e0040947a9ee2f84303f8dfb12e1c3787a4b01b3 Binary files /dev/null and b/maarch_entreprise/trunk/img/project.gif differ diff --git a/maarch_entreprise/trunk/img/project_off.gif b/maarch_entreprise/trunk/img/project_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..2994b9c61b95d7ced853940c264ceac1234b286b Binary files /dev/null and b/maarch_entreprise/trunk/img/project_off.gif differ diff --git a/maarch_entreprise/trunk/img/project_on.gif b/maarch_entreprise/trunk/img/project_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..978766be590d349092ac9cf4ecbb0a529376c584 Binary files /dev/null and b/maarch_entreprise/trunk/img/project_on.gif differ diff --git a/maarch_entreprise/trunk/img/puce_next.gif b/maarch_entreprise/trunk/img/puce_next.gif new file mode 100644 index 0000000000000000000000000000000000000000..b683ccb28e2c6a8b95700978fd2cb74c85f194ca Binary files /dev/null and b/maarch_entreprise/trunk/img/puce_next.gif differ diff --git a/maarch_entreprise/trunk/img/puce_prev.gif b/maarch_entreprise/trunk/img/puce_prev.gif new file mode 100644 index 0000000000000000000000000000000000000000..77df2ec0cb4286d05dabfdff637611b3478baad4 Binary files /dev/null and b/maarch_entreprise/trunk/img/puce_prev.gif differ diff --git a/maarch_entreprise/trunk/img/rejected_doc_menu.gif b/maarch_entreprise/trunk/img/rejected_doc_menu.gif new file mode 100644 index 0000000000000000000000000000000000000000..76b5fb49c1bd03e254325d530f5800b0d78717e4 Binary files /dev/null and b/maarch_entreprise/trunk/img/rejected_doc_menu.gif differ diff --git a/maarch_entreprise/trunk/img/reset.gif b/maarch_entreprise/trunk/img/reset.gif new file mode 100644 index 0000000000000000000000000000000000000000..c482c8f6d1819f4057a5fea5b22aa81f470d904e Binary files /dev/null and b/maarch_entreprise/trunk/img/reset.gif differ diff --git a/maarch_entreprise/trunk/img/s_sheet_b.gif b/maarch_entreprise/trunk/img/s_sheet_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..94df41e01056e6fb8d745fb918310b7b17af7406 Binary files /dev/null and b/maarch_entreprise/trunk/img/s_sheet_b.gif differ diff --git a/maarch_entreprise/trunk/img/s_sheet_c.gif b/maarch_entreprise/trunk/img/s_sheet_c.gif new file mode 100644 index 0000000000000000000000000000000000000000..5751b311c2d32e0694d6323ae7d086d3679e9f46 Binary files /dev/null and b/maarch_entreprise/trunk/img/s_sheet_c.gif differ diff --git a/maarch_entreprise/trunk/img/salary_sheet.gif b/maarch_entreprise/trunk/img/salary_sheet.gif new file mode 100644 index 0000000000000000000000000000000000000000..3512c866963970ebd7a2cf7cb82041974108eb16 Binary files /dev/null and b/maarch_entreprise/trunk/img/salary_sheet.gif differ diff --git a/maarch_entreprise/trunk/img/salary_sheet_on.gif b/maarch_entreprise/trunk/img/salary_sheet_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..f3809d55ce452472763ae607602bf82c61b30749 Binary files /dev/null and b/maarch_entreprise/trunk/img/salary_sheet_on.gif differ diff --git a/maarch_entreprise/trunk/img/search_button.gif b/maarch_entreprise/trunk/img/search_button.gif new file mode 100755 index 0000000000000000000000000000000000000000..5f6f38c23375a9c3bd4307aac4ea0a8db47647b6 Binary files /dev/null and b/maarch_entreprise/trunk/img/search_button.gif differ diff --git a/maarch_entreprise/trunk/img/search_proj_off.gif b/maarch_entreprise/trunk/img/search_proj_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..5d5c2416d518c458f2135bc213110db67aa48e4e Binary files /dev/null and b/maarch_entreprise/trunk/img/search_proj_off.gif differ diff --git a/maarch_entreprise/trunk/img/search_proj_on.gif b/maarch_entreprise/trunk/img/search_proj_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..1efdf112a36debfa2a19f554a08998afe0d9e9d4 Binary files /dev/null and b/maarch_entreprise/trunk/img/search_proj_on.gif differ diff --git a/maarch_entreprise/trunk/img/searching_off.gif b/maarch_entreprise/trunk/img/searching_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..75746720505c1ceb8fdbefc4d967964f41b6cd60 Binary files /dev/null and b/maarch_entreprise/trunk/img/searching_off.gif differ diff --git a/maarch_entreprise/trunk/img/searching_on.gif b/maarch_entreprise/trunk/img/searching_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..cfe0333cfb24e62c7d15df9c2bc9f81b32a4c0a3 Binary files /dev/null and b/maarch_entreprise/trunk/img/searching_on.gif differ diff --git a/maarch_entreprise/trunk/img/selected.png b/maarch_entreprise/trunk/img/selected.png new file mode 100644 index 0000000000000000000000000000000000000000..83e448a0f97f062657bca317756a489589eb747f Binary files /dev/null and b/maarch_entreprise/trunk/img/selected.png differ diff --git a/maarch_entreprise/trunk/img/small_calend.gif b/maarch_entreprise/trunk/img/small_calend.gif new file mode 100644 index 0000000000000000000000000000000000000000..e2385515f8daed556e2ec0b342e2bd8bacb260ba Binary files /dev/null and b/maarch_entreprise/trunk/img/small_calend.gif differ diff --git a/maarch_entreprise/trunk/img/small_user.gif b/maarch_entreprise/trunk/img/small_user.gif new file mode 100644 index 0000000000000000000000000000000000000000..7382d5dd729f226e576c84e14fa20e60806aba94 Binary files /dev/null and b/maarch_entreprise/trunk/img/small_user.gif differ diff --git a/maarch_entreprise/trunk/img/standard_list.gif b/maarch_entreprise/trunk/img/standard_list.gif new file mode 100644 index 0000000000000000000000000000000000000000..3ac1d2a8aadb9e8142fdf83a4c7d4451c014cd88 Binary files /dev/null and b/maarch_entreprise/trunk/img/standard_list.gif differ diff --git a/maarch_entreprise/trunk/img/stats01.gif b/maarch_entreprise/trunk/img/stats01.gif new file mode 100644 index 0000000000000000000000000000000000000000..426bc8d35907b74273856a93e0184f15e19ab1e9 Binary files /dev/null and b/maarch_entreprise/trunk/img/stats01.gif differ diff --git a/maarch_entreprise/trunk/img/stats02.gif b/maarch_entreprise/trunk/img/stats02.gif new file mode 100644 index 0000000000000000000000000000000000000000..088e1beefa7c9a4538f572f9dfdb1a3f327e37bc Binary files /dev/null and b/maarch_entreprise/trunk/img/stats02.gif differ diff --git a/maarch_entreprise/trunk/img/stats03.gif b/maarch_entreprise/trunk/img/stats03.gif new file mode 100644 index 0000000000000000000000000000000000000000..01891dcc0df8a5bf3ab68caadc9c769910856d40 Binary files /dev/null and b/maarch_entreprise/trunk/img/stats03.gif differ diff --git a/maarch_entreprise/trunk/img/stats04.gif b/maarch_entreprise/trunk/img/stats04.gif new file mode 100644 index 0000000000000000000000000000000000000000..0cbbdbc8d8aa219bd80a16264e08142db9bc41db Binary files /dev/null and b/maarch_entreprise/trunk/img/stats04.gif differ diff --git a/maarch_entreprise/trunk/img/stats05.gif b/maarch_entreprise/trunk/img/stats05.gif new file mode 100644 index 0000000000000000000000000000000000000000..22637121eef0a42bfc8a05969fa81730d74b0a98 Binary files /dev/null and b/maarch_entreprise/trunk/img/stats05.gif differ diff --git a/maarch_entreprise/trunk/img/stats06.gif b/maarch_entreprise/trunk/img/stats06.gif new file mode 100644 index 0000000000000000000000000000000000000000..a6c08ca77ad5f33a189b94a9701c1d8ffcbad187 Binary files /dev/null and b/maarch_entreprise/trunk/img/stats06.gif differ diff --git a/maarch_entreprise/trunk/img/stats_parameters.gif b/maarch_entreprise/trunk/img/stats_parameters.gif new file mode 100644 index 0000000000000000000000000000000000000000..b2acb993f51f672f5d1204daf78793b214796180 Binary files /dev/null and b/maarch_entreprise/trunk/img/stats_parameters.gif differ diff --git a/maarch_entreprise/trunk/img/tree.gif b/maarch_entreprise/trunk/img/tree.gif new file mode 100644 index 0000000000000000000000000000000000000000..f4cbe0614fb884c0ab158640ce0fee156899a493 Binary files /dev/null and b/maarch_entreprise/trunk/img/tree.gif differ diff --git a/maarch_entreprise/trunk/img/tri_down.gif b/maarch_entreprise/trunk/img/tri_down.gif new file mode 100644 index 0000000000000000000000000000000000000000..a1cb83b679b97ae4f6bfb4231d18d3a07bffaf60 Binary files /dev/null and b/maarch_entreprise/trunk/img/tri_down.gif differ diff --git a/maarch_entreprise/trunk/img/tri_up.gif b/maarch_entreprise/trunk/img/tri_up.gif new file mode 100644 index 0000000000000000000000000000000000000000..05775b1e3cb0bcb1bd8b2aa90f714efca119c7b8 Binary files /dev/null and b/maarch_entreprise/trunk/img/tri_up.gif differ diff --git a/maarch_entreprise/trunk/img/txt.gif b/maarch_entreprise/trunk/img/txt.gif new file mode 100644 index 0000000000000000000000000000000000000000..2c3607005ccd58f36c15fb566bd6e2675bc96dc9 Binary files /dev/null and b/maarch_entreprise/trunk/img/txt.gif differ diff --git a/maarch_entreprise/trunk/img/types.gif b/maarch_entreprise/trunk/img/types.gif new file mode 100644 index 0000000000000000000000000000000000000000..a82fba247b36c7565f853d1e151730f46860bd62 Binary files /dev/null and b/maarch_entreprise/trunk/img/types.gif differ diff --git a/maarch_entreprise/trunk/img/valid_menu_on.gif b/maarch_entreprise/trunk/img/valid_menu_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..f1bd64eebd71ebd327f04f0484d80f3006625ee0 Binary files /dev/null and b/maarch_entreprise/trunk/img/valid_menu_on.gif differ diff --git a/maarch_entreprise/trunk/img/validate_indexing.gif b/maarch_entreprise/trunk/img/validate_indexing.gif new file mode 100644 index 0000000000000000000000000000000000000000..5c8071968d72509a6034ef671549f0341f8c702a Binary files /dev/null and b/maarch_entreprise/trunk/img/validate_indexing.gif differ diff --git a/maarch_entreprise/trunk/img/view_autofoldering_off.gif b/maarch_entreprise/trunk/img/view_autofoldering_off.gif new file mode 100644 index 0000000000000000000000000000000000000000..d2d0c82d21e2af8c7d2791733a2a821564cd205e Binary files /dev/null and b/maarch_entreprise/trunk/img/view_autofoldering_off.gif differ diff --git a/maarch_entreprise/trunk/img/view_autofoldering_on.gif b/maarch_entreprise/trunk/img/view_autofoldering_on.gif new file mode 100644 index 0000000000000000000000000000000000000000..9375cc065f2b7dd2871ed0d7efbf106a91103bc6 Binary files /dev/null and b/maarch_entreprise/trunk/img/view_autofoldering_on.gif differ diff --git a/maarch_entreprise/trunk/img/view_folder.gif b/maarch_entreprise/trunk/img/view_folder.gif new file mode 100644 index 0000000000000000000000000000000000000000..d2d0c82d21e2af8c7d2791733a2a821564cd205e Binary files /dev/null and b/maarch_entreprise/trunk/img/view_folder.gif differ diff --git a/maarch_entreprise/trunk/img/view_history.gif b/maarch_entreprise/trunk/img/view_history.gif new file mode 100644 index 0000000000000000000000000000000000000000..2afd8cbbd683cdc73b6a07defcc22a83fb93378d Binary files /dev/null and b/maarch_entreprise/trunk/img/view_history.gif differ diff --git a/maarch_entreprise/trunk/img/view_history_b.gif b/maarch_entreprise/trunk/img/view_history_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..6d72ab4bb479caa5f14a4b4c49445d75bc3ab9b0 Binary files /dev/null and b/maarch_entreprise/trunk/img/view_history_b.gif differ diff --git a/maarch_entreprise/trunk/img/weight.gif b/maarch_entreprise/trunk/img/weight.gif new file mode 100644 index 0000000000000000000000000000000000000000..3294f66d24ccd1a24754da83e4da2045d3984f25 Binary files /dev/null and b/maarch_entreprise/trunk/img/weight.gif differ diff --git a/maarch_entreprise/trunk/index.php b/maarch_entreprise/trunk/index.php new file mode 100644 index 0000000000000000000000000000000000000000..9d2ceff1e952ea9e4c143d078f4910c209329538 --- /dev/null +++ b/maarch_entreprise/trunk/index.php @@ -0,0 +1,129 @@ +<?php +/** +* File : index.php +* +* Maarch index +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Laurent Giovannoni <dev@maarch.org> +* @author Claire Figueras <dev@maarch.org> +* @author Loïc Vinet <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +if(!isset($_SESSION['user']['UserId'])) +{ + if(trim($_SERVER['argv'][0]) <> "") + { + header("location: reopen.php?".$_SERVER['argv'][0]); + } + else + { + header("location: reopen.php"); + } + exit; +} +if(isset($_GET['show'])) +{ + $show = $_GET['show']; +} +else +{ + $show = "true"; +} +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +//$core_tools->test_user(); +$core_tools->start_page_stat(); +$core_tools->configPosition(); +//here we loading the lang vars +$core_tools->load_lang(); +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(); +$time = $core_tools->get_session_time_expire(); + +?> +<body onLoad="HideMenu('menunav');session_expirate(<?php echo $time;?>, '<?php echo $_SESSION['config']['coreurl'];?>');"> +<!--<script type='text/javascript' + src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>--> + <div id="header"> + <div id="nav"> + <div id="menu" onMouseOver="ShowHideMenu('menunav','on');" onMouseOut="ShowHideMenu('menunav','off');" class="off"> + <p> + <img src="<?php echo $_SESSION['config']['img'];?>/but_menu.gif" alt="<?php echo _MENU;?>" /> + </p> + <div id="menunav" style="display: none;"> + <?php + echo '<div class="header_menu"><div class="user_name_menu">'.$_SESSION['user']['FirstName'].' '.$_SESSION['user']['LastName'].'</div></div>'; + echo '<div class="header_menu_blank"> </div>';?> + <ul > + <?php + //Username for menu + + //here we building the maarch menu + $core_tools->build_menu($_SESSION['menu']); + + ?> + </ul> + <?php + echo '<div class="header_menu_blank"> </div>'; + echo '<div class="footer_menu"><a style="color:white;" href="'.$_SESSION['config']['businessappurl'].'index.php?page=maarch_credits"">'; + echo ''._MAARCH_CREDITS.'</a></div>';?> + </div> + </div> + <div><p id="ariane"><?php //$core_tools->where_am_i(); + ?></p></div> + <p id="gauchemenu"><img src="img/bando_tete_gche.gif" alt=""></p> + <p id="logo"><a href="index.php"><img src="<?php echo $_SESSION['config']['img'];?>/bando_tete_dte.gif" alt="<?php echo _LOGO_ALT;?>" /></a></p> + </div> + <!-- + <dl class="protohud" id="protohudInde"> + <dt class="trig">Tab 1</dt> + <dd class="targ"> + <p>Panel 1</p> + </dd> + <dt class="trig">Tab 2</dt> + <dd class="targ"> + <p>Panel 2</p> + </dd> + </dl>--> + <div id="container"> + <div id="content"> + <div class="error" id="main_error"> + <?php echo $_SESSION['error'];?> + </div> + <div class="info" id="main_info"> + <?php echo $_SESSION['info'];?> + </div> + <?php + if($core_tools->is_module_loaded("basket") && $_SESSION['abs_user_status'] ==true) + { + include($_SESSION['pathtomodules'].'basket'.DIRECTORY_SEPARATOR."advert_missing.php"); + } + else + { + $core_tools->insert_page(); + } + ?> + </div> + <p id="footer"> + <?php + $core_tools->load_footer(); + ?> + </p> + <?php + $_SESSION['error'] = ""; + $_SESSION['info'] = ""; + $core_tools->view_debug(); + ?> + </div> +</div> +</body> +</html> diff --git a/maarch_entreprise/trunk/indexing_searching/autocomplete_contacts.php b/maarch_entreprise/trunk/indexing_searching/autocomplete_contacts.php new file mode 100644 index 0000000000000000000000000000000000000000..d6f2d2943e9813d8dfd7251fcbc2aa15728c4d0c --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/autocomplete_contacts.php @@ -0,0 +1,115 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Script used by an Ajax autocompleter object to get the contacts data (from users or contacts) +* +* @file autocomplete_contacts.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); + +$req = new request(); +$req->connect(); + +if(empty($_REQUEST['table'])) +{ + exit(); +} +$table = $_REQUEST['table']; + +if($table == 'users') +{ + $select = array(); + $select[$_SESSION['tablename']['users']]= array('lastname', 'firstname', 'user_id'); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where = " (lastname ilike '".$req->protect_string_db($_REQUEST['Input'])."%' or firstname ilike '".$req->protect_string_db($_REQUEST['Input'])."%' or user_id ilike '".$req->protect_string_db($_REQUEST['Input'])."%') and status = 'OK' and enabled = 'Y'"; + } + else + { + $where = " (lastname like '".$req->protect_string_db($_REQUEST['Input'])."%' or firstname like '".$req->protect_string_db($_REQUEST['Input'])."%' or user_id like '".$req->protect_string_db($_REQUEST['Input'])."%') and status = 'OK' and enabled = 'Y'"; + } + + $other = 'order by lastname, firstname'; + + $res = $req->select($select, $where, $other, $_SESSION['config']['databasetype'], 11,false,"","","", false); + + echo "<ul>\n"; + for($i=0; $i< min(count($res), 10) ;$i++) + { + echo "<li>".$req->show_string($res[$i][0]['value']).', '.$req->show_string($res[$i][1]['value']).' ('.$res[$i][2]['value'].")</li>\n"; + } + if(count($res) == 11) + { + echo "<li>...</li>\n"; + } + echo "</ul>"; +} +elseif($table == 'contacts') +{ + $select = array(); + $select[$_SESSION['tablename']['contacts']]= array('is_corporate_person','society', 'lastname', 'firstname', 'contact_id'); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where = " (lastname ilike '".$req->protect_string_db($_REQUEST['Input'])."%' or firstname ilike '".$req->protect_string_db($_REQUEST['Input'])."%' or society ilike '".$req->protect_string_db($_REQUEST['Input'])."%') "; + } + else + { + $where = " (lastname like '".$req->protect_string_db($_REQUEST['Input'])."%' or firstname like '".$req->protect_string_db($_REQUEST['Input'])."%' or society like '".$req->protect_string_db($_REQUEST['Input'])."%') "; + } + $where .= " and (user_id = '' or user_id = '".$req->protect_string_db($_SESSION['user']['UserId'])."' ) and enabled = 'Y'"; + $other = 'order by society, lastname, firstname'; + + $res = $req->select($select, $where, $other, $_SESSION['config']['databasetype'], 11,false,"","","", false); + + echo "<ul>\n"; + for($i=0; $i< min(count($res), 10) ;$i++) + { + if($res[$i][0]['value'] == 'Y') + { + echo "<li>".$req->show_string($res[$i][1]['value']).' ('.$res[$i][4]['value'].")</li>\n"; + } + else + { + if($res[$i][1]['value'] != '') + { + echo "<li>".$req->show_string($res[$i][1]['value']).', '.$req->show_string($res[$i][2]['value']).' '.$req->show_string($res[$i][3]['value'])." (".$res[$i][4]['value'].")</li>\n"; + } + else + { + echo "<li>".$req->show_string($res[$i][2]['value']).', '.$req->show_string($res[$i][3]['value'])." (".$res[$i][4]['value'].")</li>\n"; + } + } + + } + if(count($res) == 11) + { + echo "<li>...</li>\n"; + } + echo "</ul>"; +} diff --git a/maarch_entreprise/trunk/indexing_searching/change_category.php b/maarch_entreprise/trunk/indexing_searching/change_category.php new file mode 100644 index 0000000000000000000000000000000000000000..2fa74a57c9b57da9d598b67b7e2c1b154624d72a --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/change_category.php @@ -0,0 +1,71 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Script called by an ajax object to process the category change during indexing (index_mlb.php) : possible services from apps or module +* +* @file +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$db = new dbquery(); +$core = new core_tools(); +$core->load_lang(); + +if(!isset($_REQUEST['category_id']) || empty($_REQUEST['category_id'])) +{ + $_SESSION['error'] = _CATEGORY.' '._IS_EMPTY; + echo "{status : 1, error_txt : '".addslashes($_SESSION['error'])."'}"; + exit(); +} + +$services = '['; +$_SESSION['indexing_services_cat'] = array(); +$_SESSION['indexing_category_id'] = $_REQUEST['category_id']; +// Module and apps services +$core->execute_modules_services($_SESSION['modules_services'], 'change_category.php', 'include'); +$core->execute_app_services($_SESSION['app_services'], 'change_category.php', 'include'); +for($i=0;$i< count($_SESSION['indexing_services_cat']);$i++) +{ + $services .= "{ script : '".$_SESSION['indexing_services_cat'][$i]['script']."', function_to_execute : '".$_SESSION['indexing_services_cat'][$i]['function_to_execute']."', arguments : '["; + for($j=0;$j<count($_SESSION['indexing_services_cat'][$i]['arguments']);$j++) + { + $services .= " { id : \'".$_SESSION['indexing_services_cat'][$i]['arguments'][$j]['id']."\', value : \'".addslashes($_SESSION['indexing_services_cat'][$i]['arguments'][$j]['value'])."\' }, "; + } + $services = preg_replace('/, $/', '', $services); + $services .= "]' }, "; +} +$services = preg_replace('/, $/', '', $services); +$services .= ']'; +unset($_SESSION['indexing_category_id']); +unset($_SESSION['indexing_services_cat']); +echo "{status : 0, services : ".$services."}"; +exit(); +?> diff --git a/maarch_entreprise/trunk/indexing_searching/change_doctype.php b/maarch_entreprise/trunk/indexing_searching/change_doctype.php new file mode 100644 index 0000000000000000000000000000000000000000..505106b55f69fb00bec25054b46a518d8f10fae9 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/change_doctype.php @@ -0,0 +1,97 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Script called by an ajax object to process the document type change during indexing (index_mlb.php), process limit date calcul and possible services from apps or module +* +* @file change_doctype.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$db = new dbquery(); +$core = new core_tools(); +$core->load_lang(); + +if(!isset($_REQUEST['type_id']) || empty($_REQUEST['type_id'])) +{ + $_SESSION['error'] = _DOCTYPE.' '._IS_EMPTY; + echo "{status : 1, error_txt : '".addslashes($_SESSION['error'])."'}"; + exit(); +} + +// Process limit date calcul +$db->connect(); +$db->query("select process_delay from ".$_SESSION['tablename']['mlb_doctype_ext']." where type_id = ".$_REQUEST['type_id']); +//$db->show(); + +if($db->nb_result() == 0) +{ + $_SESSION['error'] = _NO_DOCTYPE_IN_DB; + echo "{status : 2, error_txt : '".addslashes($_SESSION['error'])."'}"; + exit(); +} + +$res = $db->fetch_object(); +$delay = $res->process_delay; + +if(!$core->is_module_loaded('alert_diffusion')) +{ + $_SESSION['error'] = _MODULE.' alert_diffusion '._IS_MISSING; + echo "{status : 3, error_txt : '".addslashes($_SESSION['error'])."'}"; + exit(); +} + +require_once($_SESSION['pathtomodules'].'alert_diffusion'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_alert_engine.php'); +$alert_engine = new alert_engine(); +$date = $alert_engine->date_max_treatment($delay, false); +$process_date = $db->dateformat($date, '-'); +$services = '['; +$_SESSION['indexing_services'] = array(); +$_SESSION['indexing_type_id'] = $_REQUEST['type_id']; +// Module and apps services +$core->execute_modules_services($_SESSION['modules_services'], 'change_doctype.php', 'include'); +$core->execute_app_services($_SESSION['app_services'], 'change_doctype.php', 'include'); +for($i=0;$i< count($_SESSION['indexing_services']);$i++) +{ + $services .= "{ script : '".$_SESSION['indexing_services'][$i]['script']."', function_to_execute : '".$_SESSION['indexing_services'][$i]['function_to_execute']."', arguments : '["; + for($j=0;$j<count($_SESSION['indexing_services'][$i]['arguments']);$j++) + { + $services .= " { id : \'".$_SESSION['indexing_services'][$i]['arguments'][$j]['id']."\', value : \'".addslashes($_SESSION['indexing_services'][$i]['arguments'][$j]['value'])."\' }, "; + } + $services = preg_replace('/, $/', '', $services); + $services .= "]' }, "; +} +$services = preg_replace('/, $/', '', $services); +$services .= ']'; +unset($_SESSION['indexing_type_id']); +unset($_SESSION['indexing_services']); +echo "{status : 0, process_date : '".trim($process_date)."', services : ".$services."}"; +exit(); +?> diff --git a/maarch_entreprise/trunk/indexing_searching/choose_file.php b/maarch_entreprise/trunk/indexing_searching/choose_file.php new file mode 100644 index 0000000000000000000000000000000000000000..76a84908fae53a5cef218d00ab812ceaf3aae357 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/choose_file.php @@ -0,0 +1,120 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Frame to choose a file to index +* +* @file choose_file.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$func = new functions(); +$db = new dbquery(); +$db->connect(); +$core_tools->load_html(); +$core_tools->load_header(); +?> +<body > + <?php + $_SESSION['upfile']['error'] = 0; + if($_FILES['file']['error'] == 1) + { + $_SESSION['upfile']['error'] = $_FILES['file']['error']; + if($_SESSION['upfile']['error'] == 1) + { + ?> + <script language="javascript" type="text/javascript"> + var test = window.top.document.getElementById('file_iframe'); + if (test != null) + { + test.src = '<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/file_iframe.php'; + } + </script> + <?php + } + } + elseif(!empty($_FILES['file']['tmp_name']) && $_FILES['file']['error'] <> 1) + { + $extension = explode(".",$_FILES['file']['name']); + $count_level = count($extension)-1; + $the_ext = $extension[$count_level]; + //$md5 = md5_file($_FILES['file']['tmp_name']); + if(!is_uploaded_file($_FILES['file']['tmp_name'])) + { + $_SESSION['error'] = _FILE_NOT_SEND.". "._TRY_AGAIN.". "._MORE_INFOS." (<a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>)"; + } + elseif(!@move_uploaded_file($_FILES['file']['tmp_name'], $_SESSION['config']['tmppath'].'tmp_file_'.$_SESSION['user']['UserId'].'.'.strtolower($the_ext))) + { + $_SESSION['error'] = _FILE_NOT_SEND.". "._TRY_AGAIN.". "._MORE_INFOS." (<a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>)"; + } + else + { + $_SESSION['upfile']['size'] = $_FILES['file']['size']; + $_SESSION['upfile']['mime'] = $_FILES['file']['type']; + $_SESSION['upfile']['local_path'] = $_SESSION['config']['tmppath'].'tmp_file_'.$_SESSION['user']['UserId'].'.'.strtolower($the_ext); + $_SESSION['upfile']['name'] = $_FILES['file']['name']; + $_SESSION['upfile']['format'] = $the_ext; + require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_indexing_searching_app.php"); + $is = new indexing_searching_app(); + $ext_ok = $is->is_filetype_allowed($the_ext); + if($ext_ok == false) + { + $_SESSION['error'] = _WRONG_FILE_TYPE."."; + $_SESSION['upfile'] = array(); + } + } + ?> + <script language="javascript" type="text/javascript"> + var test = window.top.document.getElementById('file_iframe'); + if (test != null) + { + test.src = '<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/file_iframe.php'; + } + </script> + <?php + } + ?> + <form name="select_file_form" id="select_file_form" method="get" enctype="multipart/form-data" action="<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/choose_file.php" class="forms"> + <p> + <label for="file" ><?php echo _CHOOSE_FILE; ?> </label> + <input type="file" name="file" id="file" onchange="this.form.method = 'post';this.form.submit();" value="<?php echo $_SESSION['file_path']; ?>" style="width:200px;margin-left:33px;" /><?php + if(!empty($_SESSION['upfile']['local_path']) && empty($_SESSION['error'] ) ) + { + ?><img src="<?php echo $_SESSION['config']['businessappurl'];?>img/picto_stat_enabled.gif" alt="" class="img_upload_doc" /><?php + echo "<br/><center><small>"._DOWNLOADED_FILE." : ".$_SESSION['upfile']['name'];"</small></center><br/>"; + } + else + { + ?><img src="<?php echo $_SESSION['config']['businessappurl'];?>img/picto_stat_disabled.gif" class="img_upload_doc" alt=""/><?php + } + ?> + </p> + </form> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/indexing_searching/details.php b/maarch_entreprise/trunk/indexing_searching/details.php new file mode 100755 index 0000000000000000000000000000000000000000..4a5e705ae176ff826f36894fc9861a85bf9c6155 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/details.php @@ -0,0 +1,1270 @@ +<?php +/** +* File : details.php +* +* Detailed informations on an indexed document +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_docserver.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once($_SESSION['pathtocoreclass']."class_history.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_indexing_searching_app.php"); +include($_SESSION['config']['businessapppath'].'definition_mail_categories.php'); +$_SESSION['doc_convert'] = array(); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +if($_SESSION['indexation'] == true) +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=details&dir=indexing_searching&coll_id='.$_REQUEST['coll_id'].'&id='.$_REQUEST['id']; +$page_label = _DETAILS; +$page_id = "details"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +$users = new history(); +$security = new security(); +$func = new functions(); +$request= new request; +$s_id = ""; +$_SESSION['req'] ='details'; +$_SESSION['indexing'] = array(); +$is = new indexing_searching_app(); +$coll_id = ''; +$table = ''; +if(!isset($_REQUEST['coll_id']) || empty($_REQUEST['coll_id'])) +{ + //$_SESSION['error'] = _COLL_ID.' '._IS_MISSING; + $coll_id = $_SESSION['collections'][0]['id']; + $table = $_SESSION['collections'][0]['view']; + $is_view = true; +} +else +{ + $coll_id = $_REQUEST['coll_id']; + $table = $security->retrieve_view_from_coll_id($coll_id); + $is_view = true; + if(empty($table)) + { + $table = $security->retrieve_table_from_coll($coll_id); + $is_view = false; + } +} +$_SESSION['collection_id_choice'] = $coll_id; + +/*$_SESSION['id_to_view'] = ""; +if(isset($_GET['id']) && !empty($_GET['id'])) +{ + $_SESSION['id_to_view'] = $_GET['id']; +} +if(isset($_POST['up_res_id']) && !empty($_POST['up_res_id'])) +{ + $_GET['id'] = $_POST['up_res_id']; +} +if(isset($_SESSION['detail_id']) && !empty($_SESSION['detail_id']) && $_GET['origin'] =="waiting_list") +{ + $s_id =$_SESSION['detail_id']; +}*/ +if(isset($_GET['id']) && !empty($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "num", _THE_DOC)); +} +/*else if(isset($_SESSION['scan_doc_id']) && !empty($_SESSION['scan_doc_id'])) +{ + $s_id =$_SESSION['scan_doc_id']; + $_SESSION['scan_doc_id'] = ""; +}*/ +$_SESSION['doc_id'] = $s_id; +if($_SESSION['origin'] <> "basket") +{ + $right = $security->test_right_doc($coll_id, $s_id); + //$_SESSION['error'] = 'coll '.$coll_id.', res_id : '.$s_id; +} +else +{ + $right = true; +} +if(!$right) +{ + ?> + <script language="javascript" type="text/javascript"> + window.top.location.href = '<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=no_right'; + </script> + <?php + exit(); +} +if(isset($s_id) && !empty($s_id) && $_SESSION['history']['resview'] == "true") +{ + $users->add($table, $s_id ,"VIEW", _VIEW_DOC_NUM.$s_id, $_SESSION['config']['databasetype'],'apps'); +} +$modify_doc = $security->collection_user_right($coll_id, "can_update"); +$delete_doc = $security->collection_user_right($coll_id, "can_delete"); + +//update index with the doctype +if(isset($_POST['submit_index_doc'])) +{ + /*$db->query("select type_id from ".$table." where res_id = ".$s_id.""); + $res_type_id = $db->fetch_array(); + $type_id = $res_type_id['type_id']; + $db->query("select * from ".$_SESSION['tablename']['doctypes']." where type_id = ".$type_id); + $res_type = $db->fetch_array(); + $type_id = $res_type['type_id'];*/ + $is->update_mail($_POST, "POST", $s_id, $coll_id); +} +//delete the doctype +if(isset($_POST['delete_doc'])) +{ + /*$db->query("select type_id from ".$table." where res_id = ".$s_id.""); + $res_type_id = $db->fetch_array(); + $type_id = $res_type_id['type_id']; + $db->query("select * from ".$_SESSION['tablename']['doctypes']." where type_id = ".$type_id); + $res_type = $db->fetch_array(); + $type_id = $res_type['type_id'];*/ + $is ->delete_doc( $s_id, $coll_id); + ?> + <script language="javascript" type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page=search_adv&dir=indexing_searching';?>';</script> + <?php + exit(); +} +$db = new dbquery(); +$db->connect(); +if(empty($_SESSION['error']) || $_SESSION['indexation']) +{ + $db->query("select status, format, typist, creation_date, fingerprint, filesize, res_id, work_batch, page_count, is_paper, scan_date, scan_user, scan_location, scan_wkstation, scan_batch, source, doc_language, description, closing_date, alt_identifier from ".$table." where res_id = ".$s_id.""); +} +?> +<div id="details_div" style="display:none;"> +<h1 class="titdetail"> + <img src="<?php echo $_SESSION['config']['img'];?>/picto_detail_b.gif" alt="" /><?php echo _DETAILS." : "._DOC.' '.strtolower(_NUM); ?><?php echo $s_id; ?> <span>(<?php echo $security->retrieve_coll_label_from_coll_id($coll_id); ?>)</span> +</h1> +<div id="inner_content" class="clearfix"> +<?php +if((!empty($_SESSION['error']) && ! ($_SESSION['indexation'] )) ) +{ + ?> + <div class="error"> + <br /> + <br /> + <br /> + <?php echo $_SESSION['error']; $_SESSION['error'] = "";?> + <br /> + <br /> + <br /> + </div> + <?php +} +else +{ + if($db->nb_result() == 0) + { + ?> + <div align="center"> + <br /> + <br /> + <?php echo _NO_DOCUMENT_CORRESPOND_TO_IDENTIFIER; ?>. + <br /> + <br /> + <br /> + </div> + <?php + } + else + { + $param_data = array('img_category_id' => true, 'img_priority' => true, 'img_type_id' => true, 'img_doc_date' => true, 'img_admission_date' => true, 'img_nature_id' => true, 'img_subject' => true, 'img_process_limit_date' => true, 'img_author' => true, 'img_destination' => true, 'img_arbox_id' => true, 'img_market' => true, 'img_project' => true); + + $res = $db->fetch_object(); + $typist = $res->typist; + $format = $res->format; + $filesize = $res->filesize; + $creation_date = $db->format_date_db($res->creation_date, false); + $chrono_number = $res->alt_identifier; + $fingerprint = $res->fingerprint; + $work_batch = $res->work_batch; + $page_count = $res->page_count; + $is_paper = $res->is_paper; + $scan_date = $db->format_date_db($res->scan_date); + $scan_user = $res->scan_user; + $scan_location = $res->scan_location; + $scan_wkstation = $res->scan_wkstation; + $scan_batch = $res->scan_batch; + $doc_language = $res->doc_language; + $closing_date = $db->format_date_db($res->closing_date, false); + $process_data = $is->get_process_data($coll_id, $s_id); + $status = $res->status; + if(!empty($status)) + { + require_once($_SESSION['pathtocoreclass']."class_manage_status.php"); + $status_obj = new manage_status(); + $res_status = $status_obj->get_status_data($status); + if($modify_doc) + { + $can_be_modified = $status_obj->can_be_modified($status); + if(!$can_be_modified) + { + $modify_doc = false; + } + } + } + if($modify_doc) + { + $mode_data = 'form'; + } + $data = get_general_data($coll_id, $s_id, $mode_data, $param_data ); + //$db->show_array($data); + /* + $details = $db->fetch_object(); + //$title = $details->title; + //$description = $details->description; + //$doc_date = $details->doc_date; + //$ref = $details->identifier; + $tmp = ""; + //$type = $details->type_id; + $type_id = $details->type_id; + //$_SESSION['type'] = $type_id; + $res_id = $details->res_id; + //$arbatch_id = $details->arbatch_id; + //$arbox_id = $details->arbox_id; + $source = $details->source; + $doc_date = $details->doc_date; + $desc = $details->description; + */ + //$folders_system_id = $details->folders_system_id; + //$folder_id = $details->folder_id; + /* + $select[$table] = array(); + array_push($select[$table], "res_id", 'creation_date'); + $where = " relation = ".$s_id." and status = 'REP'"; + $request= new request; + $tab=$request->select($select,$where,"",$_SESSION['config']['databasetype']); + for($cpt_documents_1=0;$cpt_documents_1<count($tab);$cpt_documents_1++) + { + for ($cpt_documents_j_1=0;$cpt_documents_j_1<count($tab[$cpt_documents_1]);$cpt_documents_j_1++) + { + foreach(array_keys($tab[$cpt_documents_1][$cpt_documents_j_1]) as $value) + { + if($tab[$cpt_documents_1][$cpt_documents_j_1][$value]=='res_id') + { + $tab[$cpt_documents_1][$cpt_documents_j_1]['res_id']=$tab[$cpt_documents_1][$cpt_documents_j_1]['value']; + $tab[$cpt_documents_1][$cpt_documents_j_1]["label"]=_GED_NUM; + $tab[$cpt_documents_1][$cpt_documents_j_1]["size"]="30"; + $tab[$cpt_documents_1][$cpt_documents_j_1]["label_align"]="center"; + $tab[$cpt_documents_1][$cpt_documents_j_1]["align"]="center"; + $tab[$cpt_documents_1][$cpt_documents_j_1]["valign"]="bottom"; + $tab[$cpt_documents_1][$cpt_documents_j_1]["show"]=true; + } + if($tab[$cpt_documents_1][$cpt_documents_j_1][$value]=='creation_date') + { + $tab[$cpt_documents_1][$cpt_documents_j_1]['creation_date']=$tab[$cpt_documents_1][$cpt_documents_j_1]['value']; + $tab[$cpt_documents_1][$cpt_documents_j_1]["label"]=_SAVE_DATE; + $tab[$cpt_documents_1][$cpt_documents_j_1]["size"]="30"; + $tab[$cpt_documents_1][$cpt_documents_j_1]["label_align"]="left"; + $tab[$cpt_documents_1][$cpt_documents_j_1]["align"]="left"; + $tab[$cpt_documents_1][$cpt_documents_j_1]["valign"]="bottom"; + $tab[$cpt_documents_1][$cpt_documents_j_1]["show"]=true; + } + } + } + } + */ + //$db->show_array($data); + $detailsExport = ""; + $detailsExport = "<html lang='fr' xmlns='http://www.w3.org/1999/xhtml' xml:lang='fr'>"; + $detailsExport = "<head><title>Maarch Details</title><meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/><meta content='fr' http-equiv='Content-Language'/>"; + $detailsExport = "<link media='screen' href='http://127.0.0.1/DGGT/apps/maarch_letterbox/css/styles.css' type='text/css' rel='stylesheet'></head>"; + $detailsExport = "<body>"; + ?> + <div class="block"> + <b> + <p id="back_list"> + <?php + if(!$_POST['up_res_id']) + { + if($_SESSION['indexation'] == false) + { + ?> + <a href="#" onclick="history.go(-1);" class="back"><?php echo _BACK; ?></a> + <?php + } + } + ?> + </p> + <!--<p id="viewfolder"> + <a href="<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=show_folder&id=<?php echo $folders_system_id ;?>&module=folder"</a> + </p>--> + <p id="viewdoc"> + <a href="<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/view.php?id=<?php echo $s_id; ?>" target="_blank"><?php echo _VIEW_DOC; ?></a> | + </p></b> + </div> + <br/> + <dl id="tabricator1"> + <?php $detailsExport .= "<h1>"._DETAILLED_PROPERTIES."</h1>";?> + <dt><?php echo _DETAILLED_PROPERTIES;?></dt> + <dd> + <h2> + <span class="date"> + <?php $detailsExport .= "<h2>"._FILE_DATA."</h2>";?> + <b><?php echo _FILE_DATA;?></b> + </span> + </h2> + <br/> + <form method="post" name="index_doc" id="index_doc" action="index.php?page=details&dir=indexing_searching&id=<?php echo $s_id; ?>"> + <?php $detailsExport .= "<table cellpadding='2' cellspacing='2' border='0' class='block forms details' width='100%'>";?> + <table cellpadding="2" cellspacing="2" border="0" class="block forms details" width="100%"> + <?php + $i=0; + foreach(array_keys($data) as $key) + { + + if($i%2 != 1 || $i==0) // pair + { + $detailsExport .= "<tr class='col'>"; + ?> + <tr class="col"> + <?php + } + $folder_id = ""; + if(($key == "market" || $key == "project") && $data[$key]['show_value'] <> "") + { + $folderTmp = $data[$key]['show_value']; + $find1 = strpos($folderTmp, '('); + $folder_id = substr($folderTmp, $find1, strlen($folderTmp)); + $folder_id = str_replace("(", "", $folder_id); + $folder_id = str_replace(")", "", $folder_id); + } + + $detailsExport .= "<th align='left' width='50px'>"; + ?> + <th align="left" class="picto"> + <?php + if(isset($data[$key]['addon'])) + { + echo $data[$key]['addon']; + $detailsExport .= $data[$key]['addon']; + } + elseif(isset($data[$key]['img'])) + { + $detailsExport .= "<img alt='".$data[$key]['label']."' title='".$data[$key]['label']."' src='".$data[$key]['img']."' />"; + if($folder_id <> "") + { + echo "<a href='".$_SESSION['config']['businessappurl']."index.php?page=show_folder&module=folder&id=".$folder_id."'>"; + ?> + <img alt="<?php echo $data[$key]['label'];?>" title="<?php echo $data[$key]['label'];?>" src="<?php echo $data[$key]['img'];?>" /></a> + <?php + } + else + { + ?> + <img alt="<?php echo $data[$key]['label'];?>" title="<?php echo $data[$key]['label'];?>" src="<?php echo $data[$key]['img'];?>" /></a> + <?php + } + ?> + + <?php + } + $detailsExport .= "</th>"; + ?> + </th> + <?php + $detailsExport .= "<td align='left' width='200px'>"; + ?> + <td align="left" width="200px"> + <?php + $detailsExport .= $data[$key]['label']; + echo $data[$key]['label'];?> : + </td> + <?php + $detailsExport .= "</td>"; + $detailsExport .= "<td>"; + ?> + <td> + <?php + $detailsExport .= $data[$key]['show_value']; + if(!isset($data[$key]['readonly']) || $data[$key]['readonly'] == true) + { + if($data[$key]['display'] == 'textinput') + { + ?> + <input type="text" name="<?php echo $key;?>" id="<?php echo $key;?>" value="<?php echo $data[$key]['show_value'];?>" readonly="readonly" class="readonly" size="40" title="<?php echo $data[$key]['show_value']; ?>" alt="<?php echo $data[$key]['show_value']; ?>" /> + <?php + } + else + { + ?> + <input type="text" name="<?php echo $key;?>" id="<?php echo $key;?>" value="<?php echo $data[$key]['show_value'];?>" readonly="readonly" class="readonly" size="40" title="<?php echo $data[$key]['show_value']; ?>" alt="<?php echo $data[$key]['show_value']; ?>" /> + <?php + if(isset($data[$key]['addon'])) + { + $frm_str .= $data[$key]['addon']; + } + } + } + else + { + if($data[$key]['field_type'] == 'textfield') + { + ?> + <input type="text" name="<?php echo $key;?>" id="<?php echo $key;?>" value="<?php echo $data[$key]['show_value'];?>" size="40" title="<?php echo $data[$key]['show_value']; ?>" alt="<?php echo $data[$key]['show_value']; ?>" /> + <?php + } + else if($data[$key]['field_type'] == 'date') + { + ?> + <input type="text" name="<?php echo $key;?>" id="<?php echo $key;?>" value="<?php echo $data[$key]['show_value'];?>" size="40" title="<?php echo $data[$key]['show_value']; ?>" alt="<?php echo $data[$key]['show_value']; ?>" onclick="showCalender(this);" /> + <?php + } + else if($data[$key]['field_type'] == 'select') + { + ?> + <select id="<?php echo $key;?>" name="<?php echo $key;?>"> + <?php + if($key == 'type_id') + { + for($k=0; $k<count($data[$key]['select']);$k++) + { + ?><option value="" class="doctype_level1"><?php echo $data[$key]['select'][$k]['label'];?></option><? + for($j=0; $j<count($data[$key]['select'][$k]['level2']);$j++) + { + ?><option value="" class="doctype_level2"> <?php echo $data[$key]['select'][$k]['level2'][$j]['label'];?></option><? + for($l=0; $l<count($data[$key]['select'][$k]['level2'][$j]['types']);$l++) + { + ?><option + <?php if($data[$key]['value'] ==$data[$key]['select'][$k]['level2'][$j]['types'][$l]['id']){ echo 'selected="selected"';}?> + value="<?php echo $data[$key]['select'][$k]['level2'][$j]['types'][$l]['id'];?>" > <?php echo $data[$key]['select'][$k]['level2'][$j]['types'][$l]['label'];?></option><? + } + } + } + } + else + { + for($k=0; $k<count($data[$key]['select']);$k++) + { + ?><option value="<?php echo $data[$key]['select'][$k]['ID'];?>" <?php if($data[$key]['value'] == $data[$key]['select'][$k]['ID']){echo 'selected="selected"';}?>><?php echo $data[$key]['select'][$k]['LABEL'];?></option><?php + } + } + ?> + </select> + <?php + } + else if($data[$key]['field_type'] == 'autocomplete') + { + if($key == 'project') + { + //$('market').value='';return false; + ?><input type="text" name="project" id="project" onblur="" value="<?php echo $data['project']['show_value']; ?>" /><div id="show_project" class="autocomplete"></div><script type="text/javascript">launch_autocompleter_folders('<?php echo $_SESSION['urltomodules'];?>folder/autocomplete_folders.php?mode=project', 'project');</script> + <?php + } + else if($key == 'market') + { + ?><input type="text" name="market" id="market" onblur="fill_project('<?php echo $_SESSION['urltomodules'];?>folder/ajax_get_project.php');return false;" value="<?php echo $data['market']['show_value']; ?>"/><div id="show_market" class="autocomplete"></div> + <script type="text/javascript">launch_autocompleter_folders('<?php echo $_SESSION['urltomodules'];?>folder/autocomplete_folders.php?mode=market', 'market');</script> + <?php + } + } + } + /* + elseif($data[$key]['display'] == 'textarea') + { + ?> + <teaxtarea name="<?php echo $key;?>" id="<?php echo $key;?>" readonly="readonly" class="readonly" style="display:block;width:504px;" ><?php echo $data[$key]['show_value'];?></teaxtarea><?php + if ($i%2 != 1 || $i==0) // pair + { + $i++; + } + }*/ + $detailsExport .= "</td>"; + ?> + </td> + <?php + if($i%2 == 1 && $i!=0) // impair + { + $detailsExport .= "</td>"; + ?> + </tr> + <?php + } + else + { + if($i+1 == count($data)) + { + $detailsExport .= "<td colspan='2'> </td></tr>"; + echo '<td colspan="2"> </td></tr>'; + } + } + $i++; + } + $detailsExport .= "<tr class='col'>"; + $detailsExport .= "<th align='left' width='50px'>"; + $detailsExport .= "<img alt='"._STATUS." : ".$res_status['LABEL']." src='".$res_status['IMG_SRC']."' />"; + $detailsExport .= "</th>"; + $detailsExport .= "<td align='left' width='200px'>"; + $detailsExport .= _STATUS." : "; + $detailsExport .= "</td>"; + $detailsExport .= "<td>"; + $detailsExport .= $res_status['LABEL']; + $detailsExport .= "</td>"; + $detailsExport .= "<th align='left' width='50px'>"; + $detailsExport .= "<img alt='"._CREATION_DATE." : ".$res_status['LABEL']." src='".$_SESSION['config']['businessappurl']."img/small_calend.gif' />"; + $detailsExport .= "</th>"; + /*$detailsExport .= "<td align='left' width='200px'>"; + $detailsExport .= _CREATION_DATE." : "; + $detailsExport .= "</td>"; + $detailsExport .= "<td>"; + $detailsExport .= $func->format_date_db($creation_date, false); + $detailsExport .= "</td>";*/ + $detailsExport .= "</tr>"; + + $detailsExport .= "<tr class='col'>"; + $detailsExport .= "<th align='left' width='50px'>"; + $detailsExport .= "<img alt='".CHRONO_NUMBER." src='".$_SESSION['config']['businessappurl']."img/chrono.gif' />"; + $detailsExport .= "</th>"; + $detailsExport .= "<td align='left' width='200px'>"; + $detailsExport .= _CHRONO_NUMBER." : "; + $detailsExport .= "</td>"; + $detailsExport .= "<td>"; + $detailsExport .= $chrono_number; + $detailsExport .= "</td>"; + + + ?> + <tr class="col"> + <th align="left" class="picto"> + <img alt="<?php echo _STATUS.' : '.$res_status['LABEL'];?>" src="<?php echo $res_status['IMG_SRC'];?>" title="<?php echo $res_status['LABEL']; ?>" alt="<?php echo $res_status['LABEL']; ?>"/> + </th> + <td align="left" width="200px"> + <?php echo _STATUS; ?> : + </td> + <td> + <input type="text" class="readonly" readonly="readonly" value="<?php echo $res_status['LABEL']; ?>" size="40" /> + </td> + <!--<th align="left" width="50px"> + <img alt="<?php echo _CREATION_DATE;?>" src="<?php echo $_SESSION['config']['businessappurl'];?>img/small_calend.gif" /> + </th> + <td align="left" width="200px"> + <?php echo _CREATION_DATE; ?> : + </td> + <td> + <input type="text" class="readonly" readonly="readonly" value="<?php echo $func->format_date_db($creation_date, false); ?>"/> + </td> --> + </tr> + <tr class="col"> + <th align="left" class="picto"> + <img alt="<?php echo _CHRONO_NUMBER; ?>" src="<?php echo $_SESSION['config']['businessappurl'];?>img/chrono.gif" /> + </th> + <td align="left" width="200px"> + <?php echo _CHRONO_NUMBER; ?> : + </td> + <td> + <input type="text" class="readonly" readonly="readonly" value="<?php echo $chrono_number; ?>" size="40" title="<?php echo $chrono_number; ?>" alt="<?php echo $chrono_number; ?>" /> + </td> + </tr> + + </table> + <?php + $detailsExport .= "</table>"; + $detailsExport .= "<br>"; + $detailsExport .= "<h2>"._FILE_PROPERTIES."</h2>"; + $detailsExport .= "<table cellpadding='2' cellspacing='2' border='0' class='block forms details' width='100%'>"; + $detailsExport .= "<tr>"; + $detailsExport .= "<th align='left' width='255px'>"; + $detailsExport .= _TYPIST." : "; + $detailsExport .= "</th>"; + $detailsExport .= "<td align='left' width='250px'>"; + $detailsExport .= $typist; + $detailsExport .= "</td>"; + $detailsExport .= "<th align='left' width='255px'>"; + $detailsExport .= _SIZE." : "; + $detailsExport .= "</th>"; + $detailsExport .= "<td align='left' width='250px'>"; + $detailsExport .= $filesize." ".$_SESSION['lang']['txt_byte']." ( ".round($filesize/1024,2)."K )"; + $detailsExport .= "</td>"; + $detailsExport .= "</tr>"; + $detailsExport .= "<tr>"; + $detailsExport .= "<th align='left' width='255px'>"; + $detailsExport .= _FORMAT." : "; + $detailsExport .= "</th>"; + $detailsExport .= "<td align='left' width='250px'>"; + $detailsExport .= $format; + $detailsExport .= "</td>"; + $detailsExport .= "<th align='left' width='255px'>"; + $detailsExport .= _CREATION_DATE." : "; + $detailsExport .= "</th>"; + $detailsExport .= "<td align='left' width='250px'>"; + $detailsExport .= $func->format_date_db($creation_date, false); + $detailsExport .= "</td>"; + $detailsExport .= "</tr>"; + $detailsExport .= "<tr>"; + $detailsExport .= "<th align='left' width='255px'>"; + $detailsExport .= _MD5." : "; + $detailsExport .= "</th>"; + $detailsExport .= "<td align='left' width='250px'>"; + $detailsExport .= $fingerprint; + $detailsExport .= "</td>"; + $detailsExport .= "<th align='left' width='255px'>"; + $detailsExport .= _WORK_BATCH." : "; + $detailsExport .= "</th>"; + $detailsExport .= "<td align='left' width='250px'>"; + $detailsExport .= $work_batch; + $detailsExport .= "</td>"; + $detailsExport .= "</tr>"; + $detailsExport .= "</table>"; + $detailsExport .= "<br><br><br><br><br><br><br><br><br><br><br><br><br><br>"; + ?> + <br> + <h2> + <span class="date"> + <b><?php echo _FILE_PROPERTIES;?></b> + </span> + </h2> + <br/> + <table cellpadding="2" cellspacing="2" border="0" class="block forms details" width="100%"> + <tr> + <th align="left" class="picto"> + <img alt="<?php echo _TYPIST; ?>" src="<?php echo $_SESSION['config']['businessappurl'];?>img/manage_users_entities_b_small.gif" /> + </th> + <td align="left" width="200px"><?php echo _TYPIST; ?> :</td> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $typist; ?>" /></td> + <th align="left" class="picto"> + <img alt="<?php echo _SIZE; ?>" src="<?php echo $_SESSION['config']['businessappurl'];?>img/weight.gif" /> + </th> + <td align="left" width="200px"><?php echo _SIZE; ?> :</td> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $filesize." ".$_SESSION['lang']['txt_byte']." ( ".round($filesize/1024,2)."K )"; ?>" /></td> + </tr> + <tr class="col"> + <th align="left" class="picto"> + <img alt="<?php echo _FORMAT; ?>" src="<?php echo $_SESSION['config']['businessappurl'];?>img/mini_type.gif" /> + </th> + <td align="left"><?php echo _FORMAT; ?> :</td> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $format; ?>" size="40" /></td> + <th align="left" class="picto"> + <img alt="<?php echo _CREATION_DATE; ?>" src="<?php echo $_SESSION['config']['businessappurl'];?>img/small_calend.gif" /> + </th> + <td align="left"><?php echo _CREATION_DATE; ?> :</td> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $func->format_date_db($creation_date, false); ?>"/></td> + </tr> + <tr> + <th align="left" class="picto"> + <img alt="<?php echo _MD5; ?>" src="<?php echo $_SESSION['config']['businessappurl'];?>img/md5.gif" /> + </th> + <td align="left"><?php echo _MD5; ?> :</td> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $fingerprint; ?>" title="<?php echo $fingerprint; ?>" alt="<?php echo $fingerprint; ?>" /></td> + + <th align="left" class="picto"> + <img alt="<?php echo _WORK_BATCH; ?>" src="<?php echo $_SESSION['config']['businessappurl'];?>img/lot.gif" /> + </th> + <td align="left"><?php echo _WORK_BATCH; ?> :</td> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $work_batch; ?>" title="<?php echo $work_batch; ?>" alt="<?php echo $work_batch; ?>" /></td> + </tr> + <!-- + <tr> + <th align="left"><?php echo _PAGECOUNT; ?> :</th> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $page_count; ?>" /></td> + <th align="left"><?php echo _ISPAPER; ?> :</th> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $is_paper; ?>" /></td> + </tr> + <tr class="col"> + <th align="left"><?php echo _SCANUSER; ?> :</th> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $scan_user; ?>" /></td> + <th align="left"><?php echo _SCANDATE; ?> :</th> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $scan_date; ?>" /></td> + </tr> + <tr> + <th align="left"><?php echo _SCANWKSATION; ?> :</th> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $scan_wkstation; ?>" /></td> + <th align="left"><?php echo _SCANLOCATION; ?> :</th> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $scan_location; ?>" /></td> + </tr> + <tr class="col"> + <th align="left"><?php echo _SCANBATCH; ?> :</th> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $scan_batch; ?>" /></td> + <th align="right"><?php echo _SOURCE; ?> :</th> + <td><input type="text" class="readonly" readonly="readonly" value="<?php echo $source; ?>" /></td> + </tr> + --> + </table> + <br/> + <div align="center"> + <?php if($delete_doc) + {?> + <input type="submit" class="button" value="<?php echo _DELETE_DOC;?>" name="delete_doc" onclick="return(confirm('<?php echo _REALLY_DELETE.' '._THIS_DOC;?> ?\n\r\n\r'));" /> + <?php } + if($modify_doc) + {?> + <input type="submit" class="button" value="<?php echo _MODIFY_DOC;?>" name="submit_index_doc" /> + <?php } ?> + <input type="button" class="button" name="back_welcome" id="back_welcome" value="<?php echo _BACK_TO_WELCOME;?>" onclick="window.top.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php';" /> + </div> + </form> + <?php + //echo $detailsExport; + /* + <h2> + <span class="date"> + <b><?php echo _DOC_PROPERTIES;?></b> + </span> + </h2> + <form method="post" name="index_doc" action="index.php?page=detailss&dir=indexing_searching&id=<?php echo $s_id; ?>&coll_id=<?php echo $coll_id;?>" class="forms"> + <div align="center"> + <?php + if($type_id <> "0" && $type_id <> "") + { + $db->query("select * from ".$_SESSION['tablename']['doctypes']." where type_id = ".$type_id); + + $res = $db->fetch_array(); + $desc = str_replace("\\","",$res['description']); + $type_id = $res['type_id']; + $indexing_searching = new indexing_searching(); + $indexing_searching->retrieve_index($res,$coll_id ); + + ?> + <form method="post" name="index_doc" action="index.php?page=details_documents&module=indexing_searching&id=<?php echo $_SESSION['id_to_view']; ?>" class="forms"> + <p> </p> + <p> + <label><?php echo _PIECE_TYPE;?> :</label> + <input type="text" readonly="readonly" class="readonly" value="<?php echo $desc; ?>" /> + </p> + <?php + $db = new dbquery(); + $db->connect(); + for($cpt_documents_5=0;$cpt_documents_5<=count($_SESSION['index_to_use']);$cpt_documents_5++) + { + if($_SESSION['index_to_use'][$cpt_documents_5]['label'] <> "") + { + $field = $_SESSION['index_to_use'][$cpt_documents_5]['column']; + if($is_view) + { + $field = "doc_".$field; + } + $connexion->query("select ".$field." from ".$table." where res_id = ".$_SESSION['id_to_view']); + $res_mastertype = $connexion->fetch_array(); + //$connexion->show_array($res_mastertype); + $_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']] = $res_mastertype[$field]; + if($_SESSION['index_to_use'][$cpt_documents_5]['date']) + { + $_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']] = $func->format_date_db($_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']], false); + } + if((isset($_SESSION['index_to_use'][$cpt_documents_5]['foreign_key']) && !empty($_SESSION['index_to_use'][$cpt_documents_5]['foreign_key']) && isset($_SESSION['index_to_use'][$cpt_documents_5]['foreign_label']) && !empty($_SESSION['index_to_use'][$cpt_documents_5]['foreign_label']) && isset($_SESSION['index_to_use'][$cpt_documents_5]['tablename']) && !empty($_SESSION['index_to_use'][$cpt_documents_5]['tablename'])) || (isset($_SESSION['index_to_use'][$cpt_documents_5]['values']) && count($_SESSION['index_to_use'][$cpt_documents_5]['values']) > 0)) + { + ?> + <p> + <label> + <?php + if($_SESSION['index_to_use'][$cpt_documents_5]['mandatory']) + { + echo "<b>".$_SESSION['index_to_use'][$cpt_documents_5]['label']."</b> : "; + } + else + { + echo $_SESSION['index_to_use'][$cpt_documents_5]['label']." : "; + } + ?> + </label> + <?php if(!$modify_doc) + { + ?> + <input type="text" class="readonly" readonly="readonly" value="<?php + if(isset($_SESSION['index_to_use'][$cpt_documents_5]['values']) && count($_SESSION['index_to_use'][$cpt_documents_5]['values']) > 0) + { + for($k=0; $k < count($_SESSION['index_to_use'][$cpt_documents_5]['values']); $k++) + { + if($_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']] == $_SESSION['index_to_use'][$cpt_documents_5]['values'][$k]['label']){ $_SESSION['index_to_use'][$cpt_documents_5]['values'][$k]['label']; + break; + } + } + } + else + { + $query = "select ".$_SESSION['index_to_use'][$cpt_documents_5]['foreign_key'].", ".$_SESSION['index_to_use'][$cpt_documents_5]['foreign_label']." from ".$_SESSION['index_to_use'][$cpt_documents_5]['tablename']; + if(isset($_SESSION['index_to_use'][$cpt_documents_5]['where']) && !empty($_SESSION['index_to_use'][$cpt_documents_5]['where'])) + { + $query .= " where ".$_SESSION['index_to_use'][$cpt_documents_5]['where']; + } + if(isset($_SESSION['index_to_use'][$cpt_documents_5]['order']) && !empty($_SESSION['index_to_use'][$cpt_documents_5]['order'])) + { + $query .= ' '.$_SESSION['index_to_use'][$cpt_documents_5]['order']; + } + $db->query($query); + while($res = $db->fetch_object()) + { + if($_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']] == $res->$_SESSION['index_to_use'][$cpt_documents_5]['foreign_key']) + { + echo $db->show_string($res->$_SESSION['index_to_use'][$cpt_documents_5]['foreign_label']); + break; + } + } + } + ?>" /> + <?php + } + else + {?> + <select name="<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['column'];?>" id="<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['column'];?>"> + <option value=""><?php echo _CHOOSE;?></option> + <?php + if(isset($_SESSION['index_to_use'][$cpt_documents_5]['values']) && count($_SESSION['index_to_use'][$cpt_documents_5]['values']) > 0) + { + for($k=0; $k < count($_SESSION['index_to_use'][$cpt_documents_5]['values']); $k++) + { + ?> + <option value="<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['values'][$k]['label'];?>" <?php if($_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']] == $_SESSION['index_to_use'][$cpt_documents_5]['values'][$k]['label']){ echo 'selected="selected"'; } ?>><?php echo $_SESSION['index_to_use'][$cpt_documents_5]['values'][$k]['label'];?></option> + <?php + } + } + else + { + $query = "select ".$_SESSION['index_to_use'][$cpt_documents_5]['foreign_key'].", ".$_SESSION['index_to_use'][$cpt_documents_5]['foreign_label']." from ".$_SESSION['index_to_use'][$cpt_documents_5]['tablename']; + if(isset($_SESSION['index_to_use'][$cpt_documents_5]['where']) && !empty($_SESSION['index_to_use'][$cpt_documents_5]['where'])) + { + $query .= " where ".$_SESSION['index_to_use'][$cpt_documents_5]['where']; + } + if(isset($_SESSION['index_to_use'][$cpt_documents_5]['order']) && !empty($_SESSION['index_to_use'][$cpt_documents_5]['order'])) + { + $query .= ' '.$_SESSION['index_to_use'][$cpt_documents_5]['order']; + } + $db->query($query); + while($res = $db->fetch_object()) + { + ?> + <option value="<?php echo $res->$_SESSION['index_to_use'][$cpt_documents_5]['foreign_key'];?>" <?php if($_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']] == $res->$_SESSION['index_to_use'][$cpt_documents_5]['foreign_key']){ echo 'selected="selected"'; } ?>><?php echo $db->show_string($res->$_SESSION['index_to_use'][$cpt_documents_5]['foreign_label']);?></option> + <?php + } + } + ?> + </select> + <?php } ?> + </p> + <?php + } + else + { + ?> + <p> + <label> + <?php + if($_SESSION['index_to_use'][$cpt_documents_5]['mandatory']) + { + echo "<b>".$_SESSION['index_to_use'][$cpt_documents_5]['label']."</b> : "; + } + else + { + echo $_SESSION['index_to_use'][$cpt_documents_5]['label']." : "; + } + ?> + </label> + <?php + if($_SESSION['index_to_use'][$cpt_documents_5]['date']) + { + ?> + <input type="text" name="<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['column'];?>" id="<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['column'];?>" value="<?php echo $func->format_date_db($_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']], false);?>" <?php if($_SESSION['field_error'][$_SESSION['index_to_use'][$cpt_documents_5]['column']]){?>style="background-color:#FF0000"<?php }?> <?php if(!$modify_doc){?> class="readonly" readonly="readonly" <?php }if($_SESSION['index_to_use'][$cpt_documents_5]['date']) + {?> onclick="showCalender(this);"<?php } ?>/> + <?php + } + else + { + ?> + <input type="text" name="<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['column'];?>" id="<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['column'];?>" value="<?php echo $_SESSION['indexing'][$_SESSION['index_to_use'][$cpt_documents_5]['column']];?>" <?php if($_SESSION['field_error'][$_SESSION['index_to_use'][$cpt_documents_5]['column']]){?>style="background-color:#FF0000"<?php }?> <?php if(!$modify_doc){?> class="readonly" readonly="readonly" <?php } ?> /> + <?php + } + + if($_SESSION['index_to_use'][$cpt_documents_5]['mandatory'] && $modify_doc) + { + ?> + <input type="hidden" name="mandatory_<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['column'];?>" id="mandatory_<?php echo $_SESSION['index_to_use'][$cpt_documents_5]['column'];?>" value="true" /> + <?php + } + if($_SESSION['index_to_use'][$cpt_documents_5]['date']) + { + ?> + + <?php + } + ?> + </p> + <?php + } + } + } + ?> + <p > + <?php + if($modify_doc && count($_SESSION['index_to_use']) > 0) + { + ?> + <input type="submit" class="button" value="<?php echo _MODIFY_DOC;?>" name="submit_index_doc" /> + <?php + } + if($security->collection_user_right($_SESSION['collection_id_choice'], "can_delete")) + { + ?> + <input type="submit" class="button" value="<?php echo _DELETE_THE_DOC;?>" name="delete_doc" onclick="return(confirm('<?php echo _REALLY_DELETE.' '._THIS_DOC;?> ?\n\r\n\r'));" /> + <?php + } + ?> + </p> + </form> + <?php + } + else + { + echo _DOC_NOT_QUALIFIED."<br/>"; + if($security->collection_user_right($_SESSION['collection_id_choice'], "can_delete")) + { + ?> + <form method="post" name="index_doc" action="index.php?page=details_documents&module=indexing_searching&id=<?php echo $_SESSION['id_to_view']; ?>" class="forms"> + <input type="submit" class="button" value="<?php echo _DELETE_THE_DOC;?>" name="delete_doc" onclick="return(confirm('<?php echo _REALLY_DELETE.' '._THIS_DOC;?> ?\n\r\n\r'));"/> + </form> + <?php + } + } + if(!empty($_SESSION['error_page'])) + { + ?> + <script language="javascript" type="text/javascript"> + alert("<?php echo $func->wash_html($_SESSION['error_page']);?>"); + <?php + if(isset($_POST['delete_doc'])) + { + ?> + window.location.href = 'index.php'; + <?php + } + ?> + </script> + <?php + $_SESSION['error'] = ""; + $_SESSION['error_page'] = ""; + } + ?> + </div> + */ + } + ?> + </dd> + <?php + if($core_tools->is_module_loaded('entities')) + { + $detailsExport .= "<h2>"._DIFF_LIST."</h2>"; + ?> + <dt><?php echo _DIFF_LIST;?></dt> + <dd><?php + require_once($_SESSION['pathtomodules']."entities".DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_listdiff.php'); + $diff_list = new diffusion_list(); + $_SESSION['details']['diff_list'] = array(); + $_SESSION['details']['diff_list'] = $diff_list->get_listinstance($s_id); + //$db->show_array($_SESSION['details']['diff_list']); + ?> + <h2> + <span class="date"> + <b><?php echo _DIFF_LIST;?></b> + </span> + </h2> + <br/> + <div id="diff_list_div"> + <?php + if(isset($_SESSION['details']['diff_list']['dest']['user_id']) && !empty($_SESSION['details']['diff_list']['dest']['user_id'])) + { + $detailsExport .= "<p class='sstit'>"._RECIPIENT."</p>"; + $detailsExport .= "<table cellpadding='0' cellspacing='0' border='0' class='listing'>"; + $detailsExport .= "<tr class='col'>"; + $detailsExport .= "<td><img src='".$_SESSION['urltomodules']."entities/img/manage_users_entities_b_small.gif' alt='"._USER."' title='"._USER."' /></td>"; + $detailsExport .= "<td>".$_SESSION['details']['diff_list']['dest']['firstname']."</td>"; + $detailsExport .= "<td>".$_SESSION['details']['diff_list']['dest']['lastname']."</td>"; + $detailsExport .= "<td>".$_SESSION['details']['diff_list']['dest']['entity_label']."</td>"; + $detailsExport .= "</tr>"; + $detailsExport .= "</table>"; + $detailsExport .= "<br>"; + ?> + <p class="sstit"><?php echo _RECIPIENT;?></p> + <table cellpadding="0" cellspacing="0" border="0" class="listing"> + <tr class="col"> + <td><img src="<?php echo $_SESSION['urltomodules'];?>entities/img/manage_users_entities_b_small.gif" alt="<?php echo _USER;?>" title="<?php echo _USER;?>" /></td> + <td><?php echo $_SESSION['details']['diff_list']['dest']['firstname'];?></td> + <td><?php echo $_SESSION['details']['diff_list']['dest']['lastname'];?></td> + <td><?php echo $_SESSION['details']['diff_list']['dest']['entity_label'];?></td> + </tr> + </table> + <br/> + <?php + } + if(count($_SESSION['details']['diff_list']['copy']['users']) > 0 || count($_SESSION['details']['diff_list']['copy']['entities']) > 0) + { + $detailsExport .= "<p class='sstit'>"._TO_CC."</p>"; + $detailsExport .= "<table cellpadding='0' cellspacing='0' border='0' class='listing'>"; + ?> + <p class="sstit"><?php echo _TO_CC;?></p> + <table cellpadding="0" cellspacing="0" border="0" class="listing"> + <?php $color = ' class="col"'; + for($i=0;$i<count($_SESSION['details']['diff_list']['copy']['entities']);$i++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + $detailsExport .= "<tr ".$color.">"; + $detailsExport .= "<td><img src='".$_SESSION['urltomodules']."entities/img/manage_entities_b_small.gif' alt='"._ENTITY."' title='"._ENTITY."' /></td>"; + $detailsExport .= "<td>".$_SESSION['details']['diff_list']['copy']['entities'][$i]['entity_id']."</td>"; + $detailsExport .= "<td colspan='2'>".$_SESSION['details']['diff_list']['copy']['entities'][$i]['entity_label']."</td>"; + $detailsExport .= "</tr>"; + ?> + <tr <?php echo $color;?> > + <td><img src="<?php echo $_SESSION['urltomodules'];?>entities/img/manage_entities_b_small.gif" alt="<?php echo _ENTITY;?>" title="<?php echo _ENTITY;?>" /></td> + <td ><?php echo $_SESSION['details']['diff_list']['copy']['entities'][$i]['entity_id'];?></td> + <td colspan="2"><?php echo $_SESSION['details']['diff_list']['copy']['entities'][$i]['entity_label'];?></td> + </tr><?php + } + for($i=0;$i<count($_SESSION['details']['diff_list']['copy']['users']);$i++) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + $detailsExport .= "<tr ".$color.">"; + $detailsExport .= "<td><img src='".$_SESSION['urltomodules']."entities/img/manage_users_entities_b_small.gif' alt='"._USER."' title='"._USER."' /></td>"; + $detailsExport .= "<td>".$_SESSION['details']['diff_list']['copy']['users'][$i]['firstname']."</td>"; + $detailsExport .= "<td>".$_SESSION['details']['diff_list']['copy']['users'][$i]['lastname']."</td>"; + $detailsExport .= "<td>".$_SESSION['details']['diff_list']['copy']['users'][$i]['entity_label']."</td>"; + $detailsExport .= "</tr>"; + ?> + <tr <?php echo $color;?> > + <td><img src="<?php echo $_SESSION['urltomodules'];?>entities/img/manage_users_entities_b_small.gif" alt="<?php echo _USER;?>" title="<?php echo _USER;?>" /></td> + <td ><?php echo $_SESSION['details']['diff_list']['copy']['users'][$i]['firstname'];?></td> + <td ><?php echo $_SESSION['details']['diff_list']['copy']['users'][$i]['lastname'];?></td> + <td><?php echo $_SESSION['details']['diff_list']['copy']['users'][$i]['entity_label'];?></td> + </tr><?php + } + $detailsExport .= "</table>"; + ?> + </table> + <?php + } + ?> + </div> + </dd> + <?php + } + $detailsExport .= "<h2>"._PROCESS."</h2>"; + ?> + <dt><?php echo _PROCESS;?></dt> + <dd> + <div> + <table width="100%"> + <tr> + <td><label for="answer_types"><?php echo _ANSWER_TYPES_DONE;?> : </label></td> + <td> + <?php + $detailsExport .= "<table width='100%'>"; + $detailsExport .= "<tr>"; + $detailsExport .= "<td><label for='answer_types'>"._ANSWER_TYPES_DONE." : </label></td>"; + $answer_type = ""; + if($process_data['simple_mail'] == true) + { + $answer_type .= _SIMPLE_MAIL.', '; + } + if($process_data['registered_mail'] == true) + { + $answer_type .= _REGISTERED_MAIL.', '; + } + if($process_data['direct_contact'] == true) + { + $answer_type .= _DIRECT_CONTACT.', '; + } + if($process_data['email'] == true) + { + $answer_type .= _EMAIL.', '; + } + if($process_data['fax'] == true) + { + $answer_type .= _FAX.', '; + } + if($process_data['no_answer'] == true) + { + $answer_type = _NO_ANSWER.', '; + } + if($process_data['other'] == true) + { + $answer_type .= " ".$process_data['other_answer_desc']."".', '; + } + $answer_type = preg_replace('/, $/', '', $answer_type); + $detailsExport .= $answer_type."</td></tr>"; + ?> + <input name="answer_types" type="text" readonly="readonly" class="readonly" value="<?php echo $answer_type;?>" style="width:500px;" /> + </td> + </tr> + <?php + $detailsExport .= "<tr>"; + $detailsExport .= "<td><label for='process_notes'>"._PROCESS_NOTES." : </label></td>"; + $detailsExport .= $db->show_string($process_data['process_notes'])."</td></tr>"; + ?> + <tr> + <td><label for="process_notes"><?php echo _PROCESS_NOTES;?> : </label></td> + <td><textarea name="process_notes" id="process_notes" readonly="readonly" style="width:500px;"><?php echo $db->show_string($process_data['process_notes']);?></textarea></td> + </tr> + <?php + if(isset($closing_date) && !empty($closing_date)) + { + $detailsExport .= "<tr>"; + $detailsExport .= "<td><label for='closing_date'>"._CLOSING_DATE." : </label></td>"; + $detailsExport .= $closing_date."</td></tr>"; + ?> + <tr> + <td><label for="closing_date"><?php echo _CLOSING_DATE;?> : </label></td> + <td><input name="closing_date" type="text" readonly="readonly" class="readonly" value="<?php echo $closing_date;?>" /></td></td> + </tr> + <?php + } + $detailsExport .= "</table>"; + ?> + </table> + </div> + <?php + if($core_tools->is_module_loaded('attachments')) + { + $detailsExport .= "<h3>"._ATTACHED_DOC." : </h3>"; + $selectAttachments = "select res_id, creation_date, title, format from ".$_SESSION['tablename']['attach_res_attachments']." where res_id_master = ".$_SESSION['doc_id']." and coll_id ='".$_SESSION['collection_id_choice']."' and status <> 'DEL'"; + $dbAttachments = new dbquery(); + $dbAttachments->connect(); + $dbAttachments->query($selectAttachments); + $detailsExport .= "<table width='100%'>"; + $detailsExport .= "<tr>"; + $detailsExport .= "<td>"._ID."</td>"; + $detailsExport .= "<td>"._DATE."</td>"; + $detailsExport .= "<td>"._TITLE."</td>"; + $detailsExport .= "<td>"._FORMAT."</td>"; + $detailsExport .= "</tr>"; + while($resAttachments = $dbAttachments->fetch_object()) + { + $detailsExport .= "<tr>"; + $detailsExport .= "<td>".$resAttachments->res_id."</td>"; + $detailsExport .= "<td>".$resAttachments->creation_date."</td>"; + $detailsExport .= "<td>".$resAttachments->title."</td>"; + $detailsExport .= "<td>".$resAttachments->format."</td>"; + $detailsExport .= "</tr>"; + } + $detailsExport .= "</table>"; + ?> + <div> + <label><?php echo _ATTACHED_DOC;?> : </label> + <iframe name="list_attach" id="list_attach" src="<?php echo $_SESSION['urltomodules'];?>attachments/frame_list_attachments.php?view_only" frameborder="0" width="100%" height="300px"></iframe> + </div> + <?php + } + $detailsExport .= "<br><br><br>"; + ?> + </dd> + <dt><?php echo _DOC_HISTORY;?></dt> + <dd> + <?php include($_SESSION['config']['businesapppath']."indexing_searching".DIRECTORY_SEPARATOR."hist_doc.php");?> + </dd> + <?php + if($core_tools->is_module_loaded('notes')) + { + $selectNotes = "select id, identifier, user_id, date, note_text from ".$_SESSION['tablename']['not_notes']." where identifier = ".$s_id." and coll_id ='".$_SESSION['collection_id_choice']."' order by date desc"; + $dbNotes = new dbquery(); + $dbNotes->connect(); + $dbNotes->query($selectNotes); + $nb_notes_for_title = $dbNotes->nb_result(); + if ($nb_notes_for_title == 0) + { + $extend_title_for_notes = ''; + } + else + { + $extend_title_for_notes = " (".$nb_notes_for_title.") "; + } + ?> + <dt><?php echo _NOTES.$extend_title_for_notes;?></dt> + <dd> + <?php + $detailsExport .= "<h3>"._NOTES." : </h3>"; + $detailsExport .= "<table width='100%'>"; + $detailsExport .= "<tr>"; + $detailsExport .= "<td>"._ID."</td>"; + $detailsExport .= "<td>"._DATE."</td>"; + $detailsExport .= "<td>"._NOTES."</td>"; + $detailsExport .= "<td>"._USER."</td>"; + $detailsExport .= "</tr>"; + while($resNotes = $dbNotes->fetch_object()) + { + $detailsExport .= "<tr>"; + $detailsExport .= "<td>".$resNotes->id."</td>"; + $detailsExport .= "<td>".$resNotes->date."</td>"; + $detailsExport .= "<td>".$resNotes->note_text."</td>"; + $detailsExport .= "<td>".$resNotes->user_id."</td>"; + $detailsExport .= "</tr>"; + } + $detailsExport .= "</table>"; + $select_notes[$_SESSION['tablename']['users']] = array(); + array_push($select_notes[$_SESSION['tablename']['users']],"user_id","lastname","firstname"); + $select_notes[$_SESSION['tablename']['not_notes']] = array(); + array_push($select_notes[$_SESSION['tablename']['not_notes']],"id", "date", "note_text", "user_id"); + $where_notes = " identifier = ".$s_id." "; + $request_notes = new request; + $tab_notes=$request_notes->select($select_notes,$where_notes,"order by ".$_SESSION['tablename']['not_notes'].".date desc",$_SESSION['config']['databasetype'], "500", true,$_SESSION['tablename']['not_notes'], $_SESSION['tablename']['users'], "user_id" ); + ?> + <div style="text-align:center;"> + <img src="<?php echo $_SESSION['urltomodules'];?>notes/img/modif_note.png" border="0" alt="" /><a href="javascript://" onclick="ouvreFenetre('<?php echo $_SESSION['urltomodules'];?>notes/note_add.php?size=full&identifier=<?php echo $s_id;?>&coll_id=<?php echo $coll_id;?>', 450, 300)" ><?php echo _ADD_NOTE;?></a> + </div> + <iframe name="list_notes_doc" id="list_notes_doc" src="<?php echo $_SESSION['urltomodules'];?>notes/frame_notes_doc.php?size=full" frameborder="0" width="100%" height="520px"></iframe> + </dd> + <?php + } + ?> + </dl> + <?php +} +?> +</div> +</div> +<script type="text/javascript"> + var item = $('details_div'); + var tabricator1 = new Tabricator('tabricator1', 'DT'); + if(item) + { + item.style.display='block'; + } +</script> +<?php +$detailsExport .= "</body></html>"; +$_SESSION['doc_convert'] = array(); +$_SESSION['doc_convert']['details_result'] = $detailsExport; +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +if($core_tools->is_module_loaded("doc_converter")) +{ + + require_once($_SESSION['pathtomodules']."doc_converter".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); + $doc_converter = new doc_converter(); + $doc_converter->convert_details($detailsExport); +} +?> diff --git a/maarch_entreprise/trunk/indexing_searching/file_iframe.php b/maarch_entreprise/trunk/indexing_searching/file_iframe.php new file mode 100755 index 0000000000000000000000000000000000000000..dc458781db61b3c21e9827a8cb2d21d0401584c8 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/file_iframe.php @@ -0,0 +1,164 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Frame to show the file to index (action index_mlb.php) +* +* @file file_iframe.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +$func = new functions(); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_indexing_searching_app.php"); +$is = new indexing_searching_app(); +$show_file = $is->show_index_frame($_SESSION['upfile']['format']); +$ext_list = $is->filetypes_showed_indexation(); +if($_SESSION['origin'] == "scan") +{ + $ext = strtolower($_SESSION['upfile']['format']); + //echo $_SESSION['pathtomodules'].'indexing_searching'.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'tmp_file_'.$_SESSION['upfile']['md5'].'.'.$ext; + if(file_exists($_SESSION['pathtomodules'].'indexing_searching'.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'tmp_file_'.$_SESSION['upfile']['md5'].'.'.$ext)) + { + header("Pragma: public"); + header("Expires: 0"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Cache-Control: public"); + header("Content-Description: File Transfer"); + header("Content-Type: ".$_SESSION['upfile']['mime']); + header("Content-Disposition: inline; filename=".basename('maarch').";"); + header("Content-Transfer-Encoding: binary"); + $loc = $_SESSION['pathtomodules'].'indexing_searching'.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'tmp_file_'.$_SESSION['upfile']['md5'].'.'.$ext; + readfile($loc); + } + else + { + echo "<br>PROBLEM DURING FILE SEND"; + } + exit(); +} +elseif(isset($_SESSION['upfile']['mime']) && !empty($_SESSION['upfile']['mime']) && isset($_SESSION['upfile']['format']) && !empty($_SESSION['upfile']['format']) && $_SESSION['upfile']['error'] <> 1) +{ + if($show_file) + { + header("Pragma: public"); + header("Expires: 0"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Cache-Control: public"); + header("Content-Description: File Transfer"); + header("Content-Type: ".$_SESSION['upfile']['mime']); + header("Content-Disposition: inline; filename=".basename('maarch').";"); + header("Content-Transfer-Encoding: binary"); + $ext = strtolower($_SESSION['upfile']['format']); + if(file_exists($_SESSION['config']['tmppath'].'/tmp_file_'.$_SESSION['user']['UserId'].'.'.$ext)) + { + $loc = $_SESSION['config']['MaarchUrl'].$_SESSION['config']['tmppath'].'/tmp_file_'.$_SESSION['user']['UserId'].'.'.$ext; + readfile($loc); + } + exit(); + } + else + { + ?> + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $_SESSION['config']['lang'] ?>" lang="<?php echo $_SESSION['config']['lang'] ?>"> + <head> + <title><?php echo $_SESSION['config']['applicationname']; ?></title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Language" content="<?php echo $_SESSION['config']['lang'] ?>" /> + <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css']; ?>" media="screen" /> + <!--[if lt IE 7.0]> <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css_IE']; ?>" media="screen" /> <![endif]--> + <!--[if gte IE 7.0]> <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css_IE7']; ?>" media="screen" /> <![endif]--> + <script type="text/javascript" src="js/functions.js"></script> + </head> + <body background="img/bg_home_home.gif" style="background-repeat:no-repeat;background-position:center"> + <?php + $ext = strtolower($_SESSION['upfile']['format']); + if(file_exists($_SESSION['config']['tmppath'].'/tmp_file_'.$_SESSION['user']['UserId'].'.'.$ext)) + { + echo "<br/><br/><div class=\"error\">"._FILE_LOADED_BUT_NOT_VISIBLE. _ONLY_FILETYPES_AUTHORISED." <br/><ul>"; + for($i=0; $i< count($ext_list); $i++) + { + echo "<li>".$ext_list[$i]."</li>"; + } + echo "</ul></div>"; + } + else + { + echo "<br/><br/><div class=\"error\">"._PROBLEM_LOADING_FILE_TMP_DIR.".</div>"; + } + ?> + + </body> + </html> + <?php + } +} +else +{ + ?> + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $_SESSION['config']['lang'] ?>" lang="<?php echo $_SESSION['config']['lang'] ?>"> + <head> + <title><?php echo $_SESSION['config']['applicationname']; ?></title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Language" content="<?php echo $_SESSION['config']['lang'] ?>" /> + <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css']; ?>" media="screen" /> + <!--[if lt IE 7.0]> <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css_IE']; ?>" media="screen" /> <![endif]--> + <!--[if gte IE 7.0]> <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css_IE7']; ?>" media="screen" /> <![endif]--> + <script type="text/javascript" src="js/functions.js"></script> + </head> + <body background="img/bg_home_home.gif" style="background-repeat:no-repeat;background-position:center"> + <?php + + if($_SESSION['upfile']['error'] == 1) + { + $filesize = $func->return_bytes(ini_get("upload_max_filesize")); + echo "<br/><br/><div class=\"error\">"._MAX_SIZE_UPLOAD_REACHED." (".round($filesize/1024,2)."Ko Max)</div>"; + } + else + { + echo "<br/><br/><div class=\"advertissement\">".$_SESSION['error']." <br/>"._ONLY_FILETYPES_AUTHORISED." <br/><ul>"; + for($i=0; $i< count($ext_list); $i++) + { + $displayed_ext_list .= $ext_list[$i].", "; + } + + echo "<li>".substr($displayed_ext_list, 0 ,-2)."</li>"; + echo "</ul></div>"; + } + $_SESSION['error'] =''; + ?> + + </body> + </html> + <?php +} +?> diff --git a/maarch_entreprise/trunk/indexing_searching/hist_doc.php b/maarch_entreprise/trunk/indexing_searching/hist_doc.php new file mode 100644 index 0000000000000000000000000000000000000000..3de1e5decc3c5d17d07ee9a84a88f5fc0b541565 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/hist_doc.php @@ -0,0 +1,124 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Displays a document logs +* +* @file hist_doc.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +//here we loading the lang vars +$core_tools->load_lang(); +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(); +$sec = new security(); +?> +<body <?php if($_SESSION['req'] == 'action'){?>id="hist_action_frame"<?php }else{?>id="hist_courrier_frame"<?php }?>> +<?php +$func = new functions(); +$db_hist = new dbquery(); +$db_hist->connect(); +$db_hist2 = new dbquery(); +$db_hist2->connect(); +$couleur=0; +if(isset($_SESSION['collection_id_choice']) && !empty($_SESSION['collection_id_choice'])) +{ + $table = $sec->retrieve_table_from_coll($_SESSION['collection_id_choice']); + $view = $sec->retrieve_view_from_coll_id($_SESSION['collection_id_choice']); +} +else +{ + $table = $_SESSION['collections'][0]['table']; + $view = $_SESSION['collections'][0]['view']; +} +if(isset($_GET['id'])) +{ + $s_id = $_GET['id']; +} +else +{ + $s_id = ""; +} +if((empty($table)|| !$table) && (!empty($view) && $view <> false)) +{ + $query = "select info, event_date, user_id from ".$_SESSION['tablename']['history']." WHERE table_name= '".$view."' AND record_id= '".$s_id."' ORDER BY event_date desc"; +} +elseif((empty($view) || !$view) && (!empty($table)&& $table <> false)) +{ + $query = "select info, event_date, user_id from ".$_SESSION['tablename']['history']." WHERE table_name= '".$table."' AND record_id= '".$s_id."' ORDER BY event_date desc"; +} +elseif(!empty($view) && !empty($table)&& $view <> false && $table <> false) +{ + $query = "select info, event_date, user_id from ".$_SESSION['tablename']['history']." WHERE (table_name= '".$table."' OR table_name = '".$view."') AND record_id= '".$s_id."' ORDER BY event_date desc"; +} +$db_hist->query($query); +//$db_hist->show(); +?> +<table cellpadding="0" cellspacing="0" border="0" class="listing"> + <thead> + <tr> + <th><?php echo _DATE;?></th> + <th><?php echo _USER;?> </th> + <th><?php echo _DONE;?></th> + </tr> + </thead> + <tbody> + <?php + $color = ' class="col"'; + while($res_hist=$db_hist->fetch_object()) + { + if($color == ' class="col"') + { + $color = ''; + } + else + { + $color = ' class="col"'; + } + $db_hist2->query("select lastname, firstname from ".$_SESSION['tablename']['users']." where user_id = '".$res_hist->user_id."'"); + $res_hist2 = $db_hist2->fetch_object(); + $nom = $res_hist2->lastname; + $prenom = $res_hist2->firstname; + ?> + <tr <?php echo $color; ?>> + <td><span><?php echo $func->dateformat($res_hist->event_date);?></span></td> + <td><span><?php echo $prenom." ".$nom." "; ?></span></td> + <td><span><?php echo $res_hist->info; ?></span></td> + </tr> + <?php + } + ?> + </tbody> +</table> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/indexing_searching/list_results_mlb.php b/maarch_entreprise/trunk/indexing_searching/list_results_mlb.php new file mode 100644 index 0000000000000000000000000000000000000000..2f972491d025315b107eeacaa469ee9773860f19 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/list_results_mlb.php @@ -0,0 +1,343 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Search result list +* +* @file list_results_mlb.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_manage_status.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR.'class_list_show.php'); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR.'class_contacts.php'); +require_once($_SESSION['pathtocoreclass']."class_manage_status.php"); + +include_once($_SESSION['config']['businessapppath'].'definition_mail_categories.php'); + +$status_obj = new manage_status(); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +$sec = new security(); +$status_obj = new manage_status(); +$contact = new contacts(); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=list_results_mlb&dir=indexing_searching&order='.$order.'&order_field='.$field.'&start='.$start; +$page_label = _RESULTS; +$page_id = "search_adv_result_mlb"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +//$_SESSION['collection_id_choice'] = $_SESSION['searching']['coll_id']; +$_SESSION['collection_id_choice'] = 'letterbox_coll'; +$view = $sec->retrieve_view_from_coll_id($_SESSION['collection_id_choice'] ); +$select = array(); +//$select[$_SESSION['searching']['coll_view']]= array(); +$select[$view]= array(); +$where_request = $_SESSION['searching']['where_request']; +array_push($select[$view], "res_id", "status", "subject", "dest_user", "type_label", "creation_date", "destination", "category_id, exp_user_id", "category_id as category_img" ); +$status = $status_obj->get_not_searchable_status(); +$status_str = ''; +for($i=0; $i<count($status);$i++) +{ + $status_str .= "'".$status[$i]['ID']."',"; +} +$status_str = preg_replace('/,$/', '', $status_str); +$where_request.= " status not in (".$status_str.") "; +$where_clause = $sec->get_where_clause_from_coll_id($_SESSION['collection_id_choice']); +if(!empty($where_request)) +{ + if($_SESSION['searching']['where_clause_bis'] <> "") + { + $where_clause = "((".$where_clause.") or (".$_SESSION['searching']['where_clause_bis']."))"; + } + $where_request = '('.$where_request.') and ('.$where_clause.')'; +} +else +{ + if($_SESSION['searching']['where_clause_bis'] <> "") + { + $where_clause = "((".$where_clause.") or (".$_SESSION['searching']['where_clause_bis']."))"; + } + $where_request = $where_clause; +} +$where_request = str_replace("()", "(1=-1)", $where_request); +$where_request = str_replace("and ()", "", $where_request); +$list=new list_show(); +$order = ''; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = ''; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$request = new request(); +$tab=$request->select($select,$where_request,$orderstr,$_SESSION['config']['databasetype']); +//$request->show();exit; + +$_SESSION['error_page'] = ''; + + +//Manage of template list + //################### + + //Defines template allowed for this list + $template_list=array(); + array_push($template_list, array( "name"=>"search_adv", "img"=>"extend_list.gif", "label"=> _ACCESS_LIST_EXTEND)); + if(!$_REQUEST['template']) + $template_to_use = $template_list[0]["name"]; + if(isset($_REQUEST['template']) && empty($_REQUEST['template'])) + $template_to_use = ''; + if($_REQUEST['template']) + $template_to_use = $_REQUEST['template']; + + //For status icon + $extension_icon = ''; + if($template_to_use <> '') + $extension_icon = "_big"; + //################### + +//build the tab with right format for list_doc function +if (count($tab) > 0) +{ + for ($i=0;$i<count($tab);$i++) + { + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=='res_id') + { + $tab[$i][$j]['res_id']=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_GED_NUM; + $tab[$i][$j]["size"]="4"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]='res_id'; + $_SESSION['mlb_search_current_res_id'] = $tab[$i][$j]['value']; + } + if($tab[$i][$j][$value]=="type_label") + { + $tab[$i][$j]["label"]=_TYPE; + $tab[$i][$j]['value'] = $request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="type_label"; + } + if($tab[$i][$j][$value]=="status") + { + $tab[$i][$j]["label"]=_STATUS; + $res_status = $status_obj->get_status_data($tab[$i][$j]['value'],$extension_icon); + $tab[$i][$j]['value'] = "<img src = '".$res_status['IMG_SRC']."' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'>"; + $tab[$i][$j]["size"]="5"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="status"; + } + if($tab[$i][$j][$value]=="subject") + { + $tab[$i][$j]["label"]=_SUBJECT; + $tab[$i][$j]['value'] = $request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["size"]="25"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="subject"; + } + if($tab[$i][$j][$value]=="dest_user") + { + $tab[$i][$j]["label"]=_DEST_USER; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="dest_user"; + } + if($tab[$i][$j][$value]=="creation_date") + { + $tab[$i][$j]["label"]=_REG_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["value"] = $request->format_date_db($tab[$i][$j]['value'], false); + $tab[$i][$j]["order"]="creation_date"; + } + if($tab[$i][$j][$value]=="destination") + { + $tab[$i][$j]["label"]=_ENTITY; + $tab[$i][$j]['value'] = $request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="destination"; + } + if($tab[$i][$j][$value]=="category_id") + { + $_SESSION['mlb_search_current_category_id'] = $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_CATEGORY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["value"] = $_SESSION['mail_categories'][$tab[$i][$j]['value']]; + $tab[$i][$j]["order"]="category_id"; + + } + if($tab[$i][$j][$value]=="category_img") + { + $tab[$i][$j]["label"]=_CATEGORY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $my_imgcat = get_img_cat($tab[$i][$j]['value'],$extension_icon); + $tab[$i][$j]['value'] = "<img src = '".$my_imgcat."' alt = '' title = ''>"; + $tab[$i][$j]["value"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="category_id"; + } + if($tab[$i][$j][$value]=="exp_user_id") + { + $tab[$i][$j]["label"]=_CONTACT; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["value"] = $contact->get_contact_information($_SESSION['mlb_search_current_res_id'],$_SESSION['mlb_search_current_category_id'],$view); + $tab[$i][$j]["order"]=false; + } + } + } + } +?> + +<h1><img src="<?php echo $_SESSION['config']['businessappurl']."img/picto_search_b.gif";?>" alt="" /> <?php echo _SEARCH_RESULTS." - ".count($tab)." "._FOUND_DOC;?></h1> + <div id="inner_content"><?php + + + +$details = 'details'; + $list->list_doc($tab,$i,'','res_id','list_results_mlb&dir=indexing_searching','res_id',$details.'&dir=indexing_searching',true,false,'','','',true,true,false, true,false,false,true,false,'', '',false,'','','listing spec', '', false, false, null, '', '{}', false, '', true, '', true, $template_list, $template_to_use ); + ?></div><?php +} +else +{ + $_SESSION['error_search'] = "<p class=\"error\"><img src=\"".$_SESSION['config']['img']."/noresult.gif\" /><br />"._NO_RESULTS."</p>"; + ?> + <script language="javascript" type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page=search_adv_error&dir=indexing_searching';?>';</script> + <?php +} +?> + <script type="text/javascript"> + <!-- + var form_txt='<form name="frm_save_query" id="frm_save_query" action="#" method="post" class="forms addforms" onsubmit="send_request(this.id);" ><h2><?php echo _SAVE_QUERY_TITLE;?></h2><p><label for="query_name"><?php echo _QUERY_NAME;?></label><input type="text" name="query_name" id="query_name" value=""/></p><p class="buttons"><input type="submit" name="submit" id="submit" value="<?php echo _VALIDATE;?>" class="button"/> <input type="button" name="cancel" id="cancel" value="<?php echo _CANCEL;?>" class="button" onclick="destroyModal();"/></p></form>'; + + function send_request(form_id) + { + var form = document.getElementById(form_id); + var q_name = form.query_name.value; + $('modal').innerHTML = '<img src="img/loading.gif" />'; + + new Ajax.Request('<? echo $_SESSION['config']['businessappurl'];?>indexing_searching/manage_query.php', + { + method:'post', + parameters: {name: q_name, + action : "creation"}, + onSuccess: function(answer){ + eval("response = "+answer.responseText) + if(response.status == 0) + { + $('modal').innerHTML ='<h2><?php echo _QUERY_SAVED;?></h2><br/><input type="button" name="close" value="<?php echo _CLOSE_WINDOW;?>" onclick="destroyModal();" class="button" />'; + } + else if(response.status == 2) + { + $('modal').innerHTML = '<div class="error"><?php echo _SQL_ERROR;?></div>'+form_txt; + form.query_name.value = this.name; + } + else if(response.status == 3) + { + $('modal').innerHTML = '<div class="error"><?php echo _QUERY_NAME.' '._IS_EMPTY;?></div>'+form_txt; + form.query_name.value = this.name; + } + else + { + $('modal').innerHTML = '<div class="error"><?php echo _SERVER_ERROR;?></div>'+form_txt; + form.query_name.value = this.name; + } + }, + onFailure: function(){ + $('modal').innerHTML = '<div class="error"><?php echo _SERVER_ERROR;?></div>'+form_txt; + form.query_name.value = this.name; + } + }); + } + --> + </script> + <input type="button" onclick="createModal(form_txt);" value="<?php echo _SAVE_QUERY;?>" class="button"/> diff --git a/maarch_entreprise/trunk/indexing_searching/little_details_invoices.php b/maarch_entreprise/trunk/indexing_searching/little_details_invoices.php new file mode 100644 index 0000000000000000000000000000000000000000..772387875f40183dd81a74536ed3a60c61915322 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/little_details_invoices.php @@ -0,0 +1,380 @@ +<?php +/** +* File : details_invoices.php +* +* Detailed informations on an indexed document +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* @author Laurent Giovannoni <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +$core_tools->load_header(); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_docserver.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_list_show.php"); +require_once($_SESSION['pathtocoreclass']."class_history.php"); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +if($_SESSION['indexation'] == true) +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=details_invoices&dir=indexing_searching'; +$page_label = _DETAILS; +$page_id = "is_details"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +$users = new history(); +$security = new security(); +$func = new functions(); +$request= new request; +$s_id = ""; +$_SESSION['req'] ='details_invoices'; +$is_view= false; +$_SESSION['indexing'] = array(); +if($_GET['status'] == "empty") +{ + ?><p align="center"><img src="<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'].'/bg_home_home.gif'; ?>" alt="Maarch" /></p> <?php +} +else +{ + if(isset($_SESSION['collection_id_choice']) && !empty($_SESSION['collection_id_choice'])) + { + $table = $security->retrieve_view_from_coll_id($_SESSION['collection_id_choice']); + $is_view = true; + if(empty($table)) + { + $table = $security->retrieve_table_from_coll($_SESSION['collection_id_choice']); + $is_view = false; + } + } + elseif(isset($_SESSION['collection_choice']) && !empty($_SESSION['collection_choice'])) + { + $table = $_SESSION['collection_choice']; + $_SESSION['collection_id_choice'] = $security->retrieve_coll_id_from_table($_SESSION['collection_choice']); + } + elseif((isset($_SESSION['indexing2']['ind_coll']) && !empty($_SESSION['indexing2']['ind_coll']))|| ($_SESSION['indexing2']['ind_coll'] == 0 && isset($_SESSION['indexing2']['ind_coll']))) + { + if(isset($_SESSION['collections'][$_SESSION['indexing2']['ind_coll']]['view']) && !empty($_SESSION['collections'][$_SESSION['indexing2']['ind_coll']]['view'])) + { + $table = $_SESSION['collections'][$_SESSION['indexing2']['ind_coll']]['view']; + $is_view = true; + } + else + { + $table = $_SESSION['collections'][$_SESSION['indexing2']['ind_coll']]['table']; + } + $_SESSION['collection_id_choice'] = $_SESSION['collections'][$_SESSION['indexing2']['ind_coll']]['id']; + } + elseif((isset($_SESSION['searching']['ind_coll']) && !empty($_SESSION['searching']['ind_coll']))|| ($_SESSION['searching']['ind_coll'] == 0 && isset($_SESSION['searching']['ind_coll']))) + { + if(isset($_SESSION['collections'][$_SESSION['searching']['ind_coll']]['view']) && !empty($_SESSION['collections'][$_SESSION['searching']['ind_coll']]['view'])) + { + $table = $_SESSION['collections'][$_SESSION['searching']['ind_coll']]['view']; + $is_view = true; + } + else + { + $table = $_SESSION['collections'][$_SESSION['searching']['ind_coll']]['table']; + } + $_SESSION['collection_id_choice'] = $_SESSION['collections'][$_SESSION['searching']['ind_coll']]['id']; + } + else + { + $table = $_SESSION['collections'][0]['view']; + $is_view = true; + $_SESSION['collection_id_choice'] = $security->retrieve_coll_id_from_table($_SESSION['collection_choice']); + } + $_SESSION['id_to_view'] = ""; + + if(isset($_GET['id']) && !empty($_GET['id'])) + { + $_SESSION['id_to_view'] = $_GET['id']; + } + if(isset($_POST['up_res_id']) && !empty($_POST['up_res_id'])) + { + $_GET['id'] = $_POST['up_res_id']; + } + if(isset($_SESSION['detail_id']) && !empty($_SESSION['detail_id']) && $_GET['origin'] =="waiting_list") + { + $s_id =$_SESSION['detail_id']; + } + if(isset($_GET['id']) && !empty($_GET['id'])) + { + $s_id = addslashes($func->wash($_GET['id'], "num", _THE_DOC)); + } + else if(isset($_SESSION['scan_doc_id']) && !empty($_SESSION['scan_doc_id'])) + { + $s_id =$_SESSION['scan_doc_id']; + $_SESSION['scan_doc_id'] = ""; + } + $_SESSION['doc_id'] = $s_id; + if($_SESSION['origin'] <> "basket") + { + $right = $security->test_right_doc($_SESSION['collection_id_choice'], $s_id); + } + else + { + $right = true; + } + if(!$right && $s_id <> "") + { + ?> + <script language="javascript" type="text/javascript"> + window.top.location.href = '<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=no_right'; + </script> + <?php + exit(); + } + if($s_id == "") + { + echo '<br><br><center><h2 style="color:#FFC200;">'._NO_RESULTS.'</h2></center>'; + exit; + } + if(isset($s_id) && !empty($s_id) && $_SESSION['history']['resview'] == "true") + { + $users->add($table, $s_id ,"VIEW", _VIEW_DOC_NUM.$s_id, $_SESSION['config']['databasetype'],'indexing_searching'); + } + $modify_doc = $security->collection_user_right($_SESSION['collection_id_choice'], "can_update"); + if(empty($_SESSION['error']) || $_SESSION['indexation']) + { + $connexion_invoices = new dbquery(); + $connexion_invoices->connect(); + $connexion_invoices->query("select type_id, type_label, format, typist, creation_date, fingerprint, filesize, res_id, work_batch, status, page_count, doc_date, identifier, description, source, doc_language from ".$table." where res_id = ".$s_id.""); + //$connexion_invoices->show(); + } + ?> + <div id="" class="clearfix"> + <?php + if((!empty($_SESSION['error']) && ! ($_SESSION['indexation'] )) ) + { + ?> + <div class="error"> + <br /> + <br /> + <br /> + <?php echo $_SESSION['error']; $_SESSION['error'] = "";?> + <br /> + <br /> + <br /> + </div> + <?php + } + else + { + if($connexion_invoices->nb_result() == 0) + { + ?> + <div align="center"> + <br /> + <br /> + <?php echo _NO_DOCUMENT_CORRESPOND_TO_IDENTIFIER; ?>. + <br /> + <br /> + <br /> + </div> + <?php + } + else + { + $details = $connexion_invoices->fetch_object(); + $title = $details->title; + //$description = $details->description; + $typist = $details->typist; + $format = $details->format; + $filesize = $details->filesize; + $creation_date = $details->creation_date; + //echo $creation_date;exit; + $doc_date = $details->doc_date; + $fingerprint = $details->fingerprint; + $work_batch = $details->work_batch; + $ref = $details->identifier; + $tmp = ""; + $type = $details->type_id; + $type_label = $details->type_label; + $type_id = $details->type_id; + $_SESSION['type'] = $type_id; + $res_id = $details->res_id; + $status = $details->status; + $page_count = $details->page_count; + $identifier = $details->identifier; + //$doc_date = $connexion_invoices->format_date_db($details->doc_date, false); + //echo "doc_date ".$doc_date;exit; + $description = $details->description; + $source = $details->source; + $doc_language = $details->doc_language; + if(!empty($type)) + { + $connexion_invoices->query("select description, coll_id from ".$_SESSION['tablename']['doctypes']." where type_id = ".$type); + $line_sql = $connexion_invoices->fetch_object(); + $type = $line_sql->description; + $tmp = $line_sql->coll_id; + for($i=0; $i < count($_SESSION['ressources']); $i++) + { + if($_SESSION['ressources'][$i]['tablename'] == $tmp) + { + $table = $_SESSION['ressources'][$i]['comment']; + break; + } + } + } + ?> + <div align="center"> + <?php + if($type_id <> "0" && $type_id <> "") + { + $connexion_invoices->query("select * from ".$_SESSION['tablename']['doctypes']." where type_id = ".$type_id); + $res = $connexion_invoices->fetch_array(); + $desc = str_replace("\\","",$res['description']); + $type_id = $res['type_id']; + $is_master = $res['is_master']; + if($is_master == "Y") + { + $doctypes_second_level_id = $res['doctypes_second_level_id']; + $_SESSION['multidoc'] = true; + } + require_once($_SESSION['pathtomodules']."indexing_searching".$_SESSION['slash_env']."class".$_SESSION['slash_env']."class_modules_tools.php"); + $indexing_searching = new indexing_searching(); + $indexing_searching->retrieve_index($res,$_SESSION['collection_id_choice'] ); + ?> + <form method="post" name="index_doc" action="index.php?page=details_invoices&dir=indexing_searching&id=<?php echo $_SESSION['id_to_view']; ?>" class="forms"> + <div class="block"> + <p align="left"> + <h3 align="left" onclick="new Effect.toggle('desc3', 'blind');" onmouseover="document.body.style.cursor='pointer';" onmouseout="document.body.style.cursor='auto';" id="h23" class="categorie"> + <a href="#"><?php echo _SHOW_DETAILS_DOC; ?></a> + </h3> + + </p> + </div> + <div class="desc block_light admin" id="desc3" style="display:none"> + <div class="ref-unit"> + <?php echo _MENU." : "; ?> + <a href="<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/view.php?id=<?php echo $s_id; ?>" target="_blank"><b><?php echo _VIEW_DOC_FULL; ?></b> </a> + | + <a href="<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=details&dir=indexing_searching&id=<?php echo $s_id; ?>" target="_blank"><b><?php echo _DETAILS_DOC_FULL; ?> </b></a> + <hr/> + <p> + <label> + <?php echo _NUM_GED." : "; ?> + </label> + <input type="text" name="resId" id="resId" value="<?php echo $s_id;?>" /> + </p> + <p> + <label> + <?php echo _PIECE_TYPE." : "; ?> + </label> + <input type="text" name="typeLabel" id="typeLabel" value="<?php echo $func->show_string($type_label);?>" /> + </p> + <?php + $db_invoices = new dbquery(); + $db_invoices->connect(); + for($cpt6=0;$cpt6<=count($_SESSION['index_to_use']);$cpt6++) + { + if($_SESSION['index_to_use'][$cpt6]['label'] <> "") + { + $field = $_SESSION['index_to_use'][$cpt6]['column']; + if($is_view) + { + $field = "doc_".$field; + } + $connexion_invoices->query("select ".$field." from ".$table." where res_id = ".$_SESSION['id_to_view']); + $res_mastertype = $connexion_invoices->fetch_array(); + //$connexion_invoices->show_array($res_mastertype); + $_SESSION['indexing'][$_SESSION['index_to_use'][$cpt6]['column']] = $res_mastertype[$field]; + if($_SESSION['index_to_use'][$cpt6]['date']) + { + $_SESSION['indexing'][$_SESSION['index_to_use'][$cpt6]['column']] = $func->format_date_db($_SESSION['indexing'][$_SESSION['index_to_use'][$cpt6]['column']], false); + } + ?> + <p> + <label for="<?php echo $_SESSION['index_to_use'][$cpt6]['column'];?>"> + <?php + if($_SESSION['index_to_use'][$cpt6]['mandatory']) + { + echo "<b>".$_SESSION['index_to_use'][$cpt6]['label']."</b> : "; + } + else + { + echo $_SESSION['index_to_use'][$cpt6]['label']." : "; + } + ?> + </label> + <input type="text" name="<?php echo $_SESSION['index_to_use'][$cpt6]['column'];?>" id="<?php echo $_SESSION['index_to_use'][$cpt6]['column'];?>" value="<?php echo $_SESSION['indexing'][$_SESSION['index_to_use'][$cpt6]['column']];?>" <?php if($_SESSION['field_error'][$_SESSION['index_to_use'][$cpt6]['column']]){?>style="background-color:#FF0000"<?php }?> <?php if(!$modify_doc){?> class="readonly" readonly="readonly" <?php } ?> <?php if($_SESSION['index_to_use'][$cpt6]['date']){?> onclick='showCalender(this)'<?php }?>/> + <?php + if($_SESSION['index_to_use'][$cpt6]['mandatory'] && $modify_doc) + { + ?> + <input type="hidden" name="mandatory_<?php echo $_SESSION['index_to_use'][$cpt6]['column'];?>" id="mandatory_<?php echo $_SESSION['index_to_use'][$cpt6]['column'];?>" value="true" /> + <?php + } + ?> + </p> + <?php + } + } + ?> + </div> + </div> + </form> + <iframe name="view" id="view" width="100%" height="700" frameborder="0" scrolling="no" src="<?php echo $_SESSION['config']['businessappurl']."indexing_searching/view.php?id=".$s_id;?>"></iframe> + <?php + } + else + { + echo _DOC_NOT_QUALIFIED."<br/>"; + if($security->collection_user_right($_SESSION['collection_id_choice'], "can_delete")) + { + ?> + <form method="post" name="index_doc" action="index.php?page=details&dir=indexing_searching&id=<?php echo $_SESSION['id_to_view']; ?>" class="forms"> + <input type="submit" class="button" value="<?php echo _DELETE_THE_DOC;?>" name="delete_doc" onclick="return(confirm('<?php echo _REALLY_DELETE.' '._THIS_DOC;?> ?\n\r\n\r'));"/> + </form> + <?php + } + } + if(!empty($_SESSION['error_page'])) + { + ?> + <script language="javascript" type="text/javascript"> + alert("<?php echo $func->wash_html($_SESSION['error_page']);?>"); + <?php + if(isset($_POST['delete_doc'])) + { + ?> + window.location.href = 'index.php'; + <?php + } + ?> + </script> + <?php + $_SESSION['error'] = ""; + $_SESSION['error_page'] = ""; + } + ?> + </div> + <?php + } + } +} +?> +</div> diff --git a/maarch_entreprise/trunk/indexing_searching/manage_query.php b/maarch_entreprise/trunk/indexing_searching/manage_query.php new file mode 100644 index 0000000000000000000000000000000000000000..19f83d6d2487a268e8e1b6cc1a1816fb6dd21259 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/manage_query.php @@ -0,0 +1,115 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Script used by an Ajax object to manage saved queries(create, modify and delete) +* +* @file manage_query.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); + +$core_tools = new core_tools(); +$core_tools->load_lang(); +$db = new dbquery(); +$req = new request(); + if($_POST['action'] == "creation") + { + $func_date = $req->current_datetime(); + if(isset($_POST['name']) && !empty($_POST['name'])) + { + $name = preg_replace('/[\'"]/', '', $_POST['name']); + $db->connect(); + $db->query("select query_id from ".$_SESSION['tablename']['saved_queries']." where user_id ='".$db->protect_string_db($_SESSION['user']['UserId'])."' and query_name='".$db->protect_string_db($_POST['name'])."'"); + + if($db->nb_result() < 1) + { + $db->query("insert into ".$_SESSION['tablename']['saved_queries']." (user_id, query_name, creation_date, created_by, query_type, query_txt) + values ('".$db->protect_string_db($_SESSION['user']['UserId'])."', '".$db->protect_string_db($_POST['name'])."', ". $func_date.",'".$db->protect_string_db($_SESSION['user']['UserId'])."', 'my_search', '".$db->protect_string_db($_SESSION['current_search_query'])."' )", true); + } + else + { + $res = $db->fetch_object(); + $id = $res->query_id; + $db->query("update ".$_SESSION['tablename']['saved_queries']." set query_txt = '".$db->protect_string_db($_SESSION['current_search_query'])."', last_modification_date = ". $func_date." where user_id ='".$db->protect_string_db($_SESSION['user']['UserId'])."' and query_name='".$db->protect_string_db($_POST['name'])."'", true); + } + if(!$db->query ) + { + echo "{status : 2}"; + exit(); + } + else + { + echo "{status : 0}"; + exit(); + } + } + else + { + echo "{status : 3}"; + } + } + else if($_POST['action'] == "load") + { + if(isset($_POST['id']) && !empty($_POST['id'])) + { + $db->connect(); + $db->query("select query_txt from ".$_SESSION['tablename']['saved_queries']." where query_id = ".$_POST['id'], true); + } + if(!$db->query ) + { + echo "{'status' : 2, 'query':'".$db->show()."'}"; + } + else + { + $res = $db->fetch_object(); + echo "{'status' : 0, 'query':".$res->query_txt."}"; + } + } + else if($_POST['action'] == "delete") + { + if(isset($_POST['id']) && !empty($_POST['id'])) + { + $db->connect(); + $db->query("delete from ".$_SESSION['tablename']['saved_queries']." where query_id = ".$_POST['id'], true); + } + if(!$db->query ) + { + echo "{'status' : 2}"; + } + else + { + echo "{'status' : 0}"; + } + } + else + { + echo "{status : 1}"; + } +?> diff --git a/maarch_entreprise/trunk/indexing_searching/search_adv.php b/maarch_entreprise/trunk/indexing_searching/search_adv.php new file mode 100644 index 0000000000000000000000000000000000000000..74edbb0268e6a04c9928ac35ee2a84ed13e07327 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/search_adv.php @@ -0,0 +1,429 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Advanced search form +* +* @file search_adv.php +* @author Claire Figueras <dev@maarch.org> +* @author Loïc Vinet <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +require_once($_SESSION['pathtocoreclass']."class_manage_status.php"); +require_once($_SESSION['config']['businessapppath'].'class'.DIRECTORY_SEPARATOR."class_indexing_searching_app.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +$core_tools->test_service('adv_search_mlb', 'apps'); +$_SESSION['indexation'] = false; +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=search_adv&dir=indexing_searching'; +$page_label = _SEARCH_ADV_SHORT; +$page_id = "search_adv_mlb"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +$func = new functions(); +$conn = new dbquery(); +$conn->connect(); +$search_obj = new indexing_searching_app(); +$status_obj = new manage_status(); +$sec = new security(); +// load saved queries for the current user in an array +$conn->query("select query_id, query_name from ".$_SESSION['tablename']['saved_queries']." where user_id = '".$_SESSION['user']['UserId']."' order by query_name"); +$queries = array(); +while($res = $conn->fetch_object()) +{ + array_push($queries, array('ID'=>$res->query_id, 'LABEL' => $res->query_name)); +} + +$conn->query("select user_id, firstname, lastname, status from ".$_SESSION['tablename']['users']." where enabled = 'Y' and status <> 'DEL' order by lastname asc"); +$users_list = array(); +while($res = $conn->fetch_object()) +{ + array_push($users_list, array('ID' => $conn->show_string($res->user_id), 'NOM' => $conn->show_string($res->lastname), 'PRENOM' => $conn->show_string($res->firstname), 'STATUT' => $res->status)); +} + +$coll_id = 'letterbox_coll'; +$view = $sec->retrieve_view_from_coll_id($coll_id); +$where = $sec->get_where_clause_from_coll_id($coll_id); +if(!empty($where)) +{ + $where = ' where '.$where; +} + +//Check if web brower is ie_6 or not +if (preg_match("/MSIE 6.0/", $_SERVER["HTTP_USER_AGENT"])) { + $browser_ie = 'true'; + $class_for_form = 'form'; + $hr = '<tr><td colspan="2"><hr></td></tr>'; + $size = ''; +} elseif(preg_match('/msie/i', $_SERVER["HTTP_USER_AGENT"]) && !preg_match('/opera/i', $HTTP_USER_AGENT) ) +{ + $browser_ie = 'true'; + $class_for_form = 'forms'; + $hr = ''; + $size = ''; +} +else +{ + $browser_ie = 'false'; + $class_for_form = 'forms'; + $hr = ''; + $size = ''; + // $size = 'style="width:40px;"'; +} + +// building of the parameters array used to pre-load the category list and the search elements +$param = array(); + +//Coming date +$arr_tmp2 = array('label' => _DATE_START, 'type' => 'date_range', 'param' => array('field_label' => _DATE_START, 'id1' => 'admission_date_from', 'id2' =>'admission_date_to')); +$param['admission_date'] = $arr_tmp2; + +//Loaded date +$arr_tmp2 = array('label' => _REG_DATE, 'type' => 'date_range', 'param' => array('field_label' => _REG_DATE, 'id1' => 'creation_date_from', 'id2' =>'creation_date_to')); +$param['creation_date'] = $arr_tmp2; + +//Closing date +$arr_tmp2 = array('label' => _PROCESS_DATE, 'type' => 'date_range', 'param' => array('field_label' => _PROCESS_DATE, 'id1' => 'closing_date_from', 'id2' =>'closing_date_to')); +$param['closing_date'] = $arr_tmp2; + +//Document date +$arr_tmp2 = array('label' => _DOC_DATE, 'type' => 'date_range', 'param' => array('field_label' => _DOC_DATE, 'id1' => 'doc_date_from', 'id2' =>'doc_date_to')); +$param['doc_date'] = $arr_tmp2; + +//Process limit date +$arr_tmp2 = array('label' => _LIMIT_DATE_PROCESS, 'type' => 'date_range', 'param' => array('field_label' => _LIMIT_DATE_PROCESS, 'id1' => 'process_limit_date_from', 'id2' =>'process_limit_date_to')); +$param['process_limit_date'] = $arr_tmp2; + +//destinataire +$arr_tmp = array(); +for($i=0; $i < count($users_list); $i++) +{ + array_push($arr_tmp, array('VALUE' => $users_list[$i]['ID'], 'LABEL' => $users_list[$i]['NOM']." ".$users_list[$i]['PRENOM'])); +} +$arr_tmp2 = array('label' => _PROCESS_RECEIPT, 'type' => 'select_multiple', 'param' => array('field_label' => _PROCESS_RECEIPT, 'label_title' => _CHOOSE_RECIPIENT_SEARCH_TITLE, +'id' => 'destinataire','options' => $arr_tmp)); +$param['destinataire'] = $arr_tmp2; + +//mail_natures +$arr_tmp = array(); +foreach(array_keys($_SESSION['mail_natures']) as $nature) +{ + array_push($arr_tmp, array('VALUE' => $nature, 'LABEL' => $_SESSION['mail_natures'][$nature])); +} +$arr_tmp2 = array('label' => _MAIL_NATURE, 'type' => 'select_simple', 'param' => array('field_label' => _MAIL_NATURE,'default_label' => addslashes(_CHOOSE_MAIL_NATURE), 'options' => $arr_tmp)); +$param['mail_nature'] = $arr_tmp2; + +//priority +$arr_tmp = array(); +foreach(array_keys($_SESSION['mail_priorities']) as $priority) +{ + array_push($arr_tmp, array('VALUE' => $priority, 'LABEL' => $_SESSION['mail_priorities'][$priority])); +} +$arr_tmp2 = array('label' => _PRIORITY, 'type' => 'select_simple', 'param' => array('field_label' => _MAIL_PRIORITY,'default_label' => addslashes(_CHOOSE_PRIORITY), 'options' => $arr_tmp)); +$param['priority'] = $arr_tmp2; + +//identifier +/*$arr_tmp2 = array('label' => _MAIL_IDENTIFIER, 'type' => 'input_text', 'param' => array('field_label' => _MAIL_IDENTIFIER, 'other' => $size)); +$param['numcourrier'] = $arr_tmp2; + +*/ + +// dest +$arr_tmp2 = array('label' => _DEST, 'type' => 'input_text', 'param' => array('field_label' => _DEST, 'other' => $size)); +$param['dest'] = $arr_tmp2; + +//shipper +$arr_tmp2 = array('label' => _SHIPPER, 'type' => 'input_text', 'param' => array('field_label' => _SHIPPER, 'other' => $size)); +$param['shipper'] = $arr_tmp2; + +if($_SESSION['features']['search_notes'] == 'true') +{ + //annotations + $arr_tmp2 = array('label' => _NOTES, 'type' => 'textarea', 'param' => array('field_label' => _NOTES, 'other' => $size)); + $param['doc_notes'] = $arr_tmp2; +} + +//destination (department) +if($core_tools->is_module_loaded('entities')) +{ + $coll_id = 'letterbox_coll'; + $where = $sec->get_where_clause_from_coll_id($coll_id); + $table = $sec->retrieve_table_from_coll($coll_id); + if(empty($table)) + { + $table = $sec->retrieve_view_from_coll_id($coll_id); + } + if(!empty($where)) + { + $where = ' and '.$where; + } + $conn->query("select distinct r.destination as entity_id, e.entity_label from ".$table." r, ".$_SESSION['tablename']['ent_entities']." e where e.entity_id = r.destination ".$where." group by e.entity_label, r.destination"); + $arr_tmp = array(); + while($res = $conn->fetch_object()) + { + array_push($arr_tmp, array('VALUE' => $res->entity_id, 'LABEL' => $res->entity_label)); + } + + $arr_tmp2 = array('label' => _DESTINATION_SEARCH, 'type' => 'select_multiple', 'param' => array('field_label' => _DESTINATION_SEARCH, 'label_title' => _CHOOSE_ENTITES_SEARCH_TITLE, +'id' => 'services','options' => $arr_tmp)); + $param['destination_mu'] = $arr_tmp2; +} + +// Folder +if($core_tools->is_module_loaded('folder')) +{ + $arr_tmp2 = array('label' => _MARKET, 'type' => 'input_text', 'param' => array('field_label' => _MARKET, 'other' => $size)); + $param['market'] = $arr_tmp2; + $arr_tmp2 = array('label' => _PROJECT, 'type' => 'input_text', 'param' => array('field_label' => _PROJECT, 'other' => $size)); + $param['project'] = $arr_tmp2; +} + +//process notes +$arr_tmp2 = array('label' => _PROCESS_NOTES, 'type' => 'textarea', 'param' => array('field_label' => _PROCESS_NOTES, 'other' => $size, 'id' => 'process_notes')); +$param['process_notes'] = $arr_tmp2; + +// chrono +$arr_tmp2 = array('label' => _CHRONO_NUMBER, 'type' => 'input_text', 'param' => array('field_label' => _CHRONO_NUMBER, 'other' => $size)); +$param['chrono'] = $arr_tmp2; + +//status +$status = $status_obj->get_searchable_status(); +$arr_tmp = array(); +for($i=0; $i < count($status); $i++) +{ + array_push($arr_tmp, array('VALUE' => $status[$i]['ID'], 'LABEL' => $status[$i]['LABEL'])); +} +array_push($arr_tmp, array('VALUE'=> 'REL1', 'LABEL' =>_FIRST_WARNING)); +array_push($arr_tmp, array('VALUE'=> 'REL2', 'LABEL' =>_SECOND_WARNING)); +array_push($arr_tmp, array('VALUE'=> 'LATE', 'LABEL' =>_LATE)); + +// Sorts the $param['status'] array +function cmp_status($a, $b) +{ + return strcmp(strtolower($a["LABEL"]), strtolower($b["LABEL"])); +} +usort($arr_tmp, "cmp_status"); +$arr_tmp2 = array('label' => _STATUS_PLUR, 'type' => 'select_multiple', 'param' => array('field_label' => _STATUS,'label_title' => _CHOOSE_STATUS_SEARCH_TITLE,'id' => 'status', 'options' => $arr_tmp)); +$param['status'] = $arr_tmp2; + +//doc_type +$conn->query("select type_id, description from ".$_SESSION['tablename']['doctypes']." where enabled = 'Y' order by description asc"); +$arr_tmp = array(); +while ($res=$conn->fetch_object()) +{ + array_push($arr_tmp, array('VALUE' => $res->type_id, 'LABEL' => $conn->show_string($res->description))); +} +$arr_tmp2 = array('label' => _DOCTYPES, 'type' => 'select_multiple', 'param' => array('field_label' => _DOCTYPE,'label_title' => _CHOOSE_DOCTYPES_SEARCH_TITLE, 'id' => 'doctypes', 'options' => $arr_tmp)); +$param['doctype'] = $arr_tmp2; + +//category +$arr_tmp = array(); +array_push($arr_tmp, array('VALUE' => '', 'LABEL' => _CHOOSE_CATEGORY)); +foreach(array_keys($_SESSION['mail_categories']) as $cat_id) +{ + array_push($arr_tmp, array('VALUE' => $cat_id, 'LABEL' => $_SESSION['mail_categories'][$cat_id])); +} +$arr_tmp2 = array('label' => _CATEGORY, 'type' => 'select_simple', 'param' => array('field_label' => _CATEGORY,'default_label' => '', 'options' => $arr_tmp)); +$param['category'] = $arr_tmp2;//Arbox_id ; for physical_archive +if ($core_tools->is_module_loaded('physical_archive') == true) +{ + //doc_type + $conn->query("select arbox_id, title from ".$_SESSION['tablename']['ar_boxes']." where status <> 'DEL' order by description asc"); + $arr_tmp = array(); + while ($res=$conn->fetch_object()) + { + array_push($arr_tmp, array('VALUE' => $res->arbox_id, 'LABEL' => $conn->show_string($res->title))); + } + $arr_tmp2 = array('label' => _ARBOXES, 'type' => 'select_multiple', 'param' => array('field_label' =>_ARBOXES,'label_title' => _CHOOSE_BOXES_SEARCH_TITLE, 'id' => 'arboxes', 'options' => $arr_tmp)); + $param['arbox_id'] = $arr_tmp2; + + + $arr_tmp2 = array('label' => _ARBATCHES, 'type' => 'input_text', 'param' => array('field_label' => _ARBATCHES, 'other' => $size)); + $param['arbatch_id'] = $arr_tmp2; + + +} + +//Answers types +$arr_tmp = array(array('ID' => 'simple_mail','VALUE'=> 'true', 'LABEL' =>_SIMPLE_MAIL),array('ID' => 'AR','VALUE'=> 'true', 'LABEL' =>_REGISTERED_MAIL),array('ID' => 'fax','VALUE'=> 'true', 'LABEL' =>_FAX),array('ID' => 'courriel','VALUE'=> 'true', 'LABEL' =>_MAIL) +,array('ID' => 'direct','VALUE'=> 'true', 'LABEL' =>_DIRECT_CONTACT),array('ID' => 'autre','VALUE'=> 'true', 'LABEL' =>_OTHER),array('ID' => 'norep','VALUE'=> 'true', 'LABEL' =>_NO_ANSWER)); +$arr_tmp2 = array('label' => _ANSWER_TYPE, 'type' => 'checkbox', 'param' => array('field_label' => _ANSWER_TYPE, 'checkbox_data' => $arr_tmp)); +$param['answer_type'] = $arr_tmp2; + +// Sorts the param array +function cmp($a, $b) +{ + return strcmp(strtolower($a["label"]), strtolower($b["label"])); +} +uasort($param, "cmp"); + +$tab = $search_obj->send_criteria_data($param); +//$conn->show_array($param); +//$conn->show_array($tab); + +// criteria list options +$src_tab = $tab[0]; + +?> +<?php // echo $_SESSION['current_search_query'];?> +<script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'];?>js/search_adv.js" ></script> +<script type="text/javascript"> +<!-- +var valeurs = { <?php echo $tab[1];?>}; +var loaded_query = <?php if(isset($_SESSION['current_search_query']) && !empty($_SESSION['current_search_query'])) +{ echo $_SESSION['current_search_query'];}else{ echo '{}';}?>; + +function del_query_confirm() +{ + if(confirm('<?php echo _REALLY_DELETE.' '._THIS_SEARCH.'?';?>')) + { + del_query_db($('query').options[$('query').selectedIndex], 'select_criteria', 'frmsearch2', '<?php echo _SQL_ERROR;?>', '<?php echo _SERVER_ERROR;?>', '<?php echo $_SESSION['config']['businessappurl'].'indexing_searching/manage_query.php';?>'); + return false; + } +} +--> +</script> + +<h1><img src="<?php echo $_SESSION['config']['img'];?>/picto_search_b.gif" alt="" /> <?php echo _ADV_SEARCH_TITLE; ?></h1> +<div id="inner_content"> + +<?php if (count($queries) > 0) +{?> +<form name="choose_query" id="choose_query" action="#" method="post" > +<div align="center" style="display:block;" id="div_query"> + +<label for="query"><?php echo _MY_SEARCHES;?> : </label> +<select name="query" id="query" onchange="load_query_db(this.options[this.selectedIndex].value, 'select_criteria', 'frmsearch2', '<?php echo _SQL_ERROR;?>', '<?php echo _SERVER_ERROR;?>', '<?php echo $_SESSION['config']['businessappurl'].'indexing_searching/manage_query.php';?>');return false;" > + <option id="default_query" value=""><?php echo _CHOOSE_SEARCH;?></option> + <?php for($i=0; $i< count($queries);$i++) + { + ?><option value="<?php echo $queries[$i]['ID'];?>" id="query_<?php echo $queries[$i]['ID'];?>"><?php echo $queries[$i]['LABEL'];?></option><?php }?> +</select> + +<input name="del_query" id="del_query" value="<?php echo _DELETE_QUERY;?>" type="button" onclick="del_query_confirm();" class="button" style="display:none" /> +</div> +</form> +<?php } ?> +<form name="frmsearch2" method="get" action="index.php" id="frmsearch2" class="<?php echo $class_for_form; ?>"> +<input type="hidden" name="page" value="search_adv_result" /> +<input type="hidden" name="dir" value="indexing_searching" /> +<table align="center" border="0" width="100%"> + <tr> + <td align="left"><a href="#" onclick="clear_search_form('frmsearch2','select_criteria');clear_q_list();"><img src="<?php echo $_SESSION['config']['businessappurl']."img/reset.gif";?>" alt="<?php echo _CLEAR_SEARCH;?>" /> <?php echo _CLEAR_SEARCH; ?></a></td> + <td width="75%" align="right" ><span class="bold"><?php echo _SEARCH_COPY_MAIL;?></span> + <input type="hidden" name="meta[]" value="copies#copies_false,copies_true#radio" /> + <input type="radio" name="copies" id="copies_false" class="check" value="false" checked="checked" /><?php echo _NO;?> + <input type="radio" name="copies" id="copies_true" class="check" value="true" /><?php echo _YES;?> + </td> + </tr> +</table> +<table align="center" border="0" width="100%"> + <tr> + <td colspan="2" ><h2><?php echo _LETTER_INFO; ?></h2></td> + </tr> + <tr > + <td > + <table border = "0" width="100%"> + <tr> + <td width="70%"><label for="subject" class="bold" ><?php echo _MAIL_OBJECT;?>:</label> + <input type="text" name="subject" id="subject" <?php echo $size; ?> /> + <input type="hidden" name="meta[]" value="subject#subject#input_text" /> + </td> + <td><em><?php echo _MAIL_OBJECT_HELP; ?></em></td> + </tr> + <tr> + <td width="70%"><label for="fulltext" class="bold" ><?php echo _FULLTEXT;?>:</label> + <input type="text" name="fulltext" id="fulltext" <?php echo $size; ?> /> + <input type="hidden" name="meta[]" value="fulltext#fulltext#input_text" /> + </td> + <td><em><?php echo _FULLTEXT_HELP; ?></em></td> + </tr> + <tr> + <td width="70%"><label for="numged" class="bold"><?php echo _N_GED;?>:</label> + <input type="text" name="numged" id="numged" <?php echo $size; ?> /> + <input type="hidden" name="meta[]" value="numged#numged#input_text" /> + </td> + <td><em><?php echo _N_GED_HELP; ?></em></td> + </tr> + <tr> + <td width="70%"><label for="multifield" class="bold" ><?php echo _MULTI_FIELD;?>:</label> + <input type="text" name="multifield" id="multifield" <?php echo $size; ?> /> + <input type="hidden" name="meta[]" value="multifield#multifield#input_text" /> + </td> + <td><em><?php echo _MULTI_FIELD_HELP; ?></em></td> + </tr> + </table> + </td> + <td> + <p align="center"> + <input class="button_search_adv" name="imageField" type="button" value="" onclick="valid_search_form('frmsearch2');this.form.submit();" /> + <input class="button_search_adv_text" name="imageField" type="button" value="<?php echo _SEARCH; ?>" onclick="valid_search_form('frmsearch2');this.form.submit();" /></p> + </td> + </tr> + <tr><td colspan="2"><hr/></td></tr> +<tr> +<td > + <table border = "0" width="100%"> + <tr> + <td width="70%"> + <label class="bold"><?php echo _ADD_PARAMETERS; ?>:</label> + <select name="select_criteria" id="select_criteria" style="display:inline;" onchange="add_criteria(this.options[this.selectedIndex].id, 'frmsearch2', <?php echo $browser_ie;?>, '<?php echo _ERROR_IE_SEARCH;?>');"> + <?php echo $src_tab; ?> + </select> + </td> + + <td width="30%"><em><?php echo _ADD_PARAMETERS_HELP; ?></em></td> + </tr> + </table> +</td></tr> +</table> + +</form> +<br/> +<div align="right"> +<input class="button" name="submit" type="button" value="<?php echo _SEARCH;?>" onclick="valid_search_form('frmsearch2');document.getElementById('frmsearch2').submit();" /> + <!--<input class="button" name="clear" type="button" value="<?php echo _CLEAR_SEARCH;?>" onclick="clear_search_form('frmsearch2','select_criteria');clear_q_list();" />--> +</div> + </div> +<script type="text/javascript"> +load_query(valeurs, loaded_query, 'frmsearch2', '<?php echo $browser_ie;?>, <?php echo _ERROR_IE_SEARCH;?>'); +</script> diff --git a/maarch_entreprise/trunk/indexing_searching/search_adv_error.php b/maarch_entreprise/trunk/indexing_searching/search_adv_error.php new file mode 100644 index 0000000000000000000000000000000000000000..334a2b746f548e9d09075e5d116fc10cd73ad59e --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/search_adv_error.php @@ -0,0 +1,68 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Advanced search form error page +* +* @file search_adv_error.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +$core_tools->test_service('adv_search_mlb', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = "3"; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = 3 ; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=search_adv_result&dir=indexing_searching'; +$page_label = _RESULTS; +$page_id = "search_adv_result_apps"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +?> +<h1><img src="<?php echo $_SESSION['config']['businessappurl']."img/picto_search_b.gif";?>" alt="" /> <?php echo _ADV_SEARCH_TITLE; ?></h1> +<div id="inner_content"> + <p> </p> + <p> </p> + <p> </p> + <p> </p> + <p> </p> + <p> </p> + <?php echo $_SESSION['error_search']; + $_SESSION['error_search'] = ""; + ?> +</div> \ No newline at end of file diff --git a/maarch_entreprise/trunk/indexing_searching/search_adv_result.php b/maarch_entreprise/trunk/indexing_searching/search_adv_result.php new file mode 100644 index 0000000000000000000000000000000000000000..9805f1fde74af286d5e441c3fe2a6adc152f1bfe --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/search_adv_result.php @@ -0,0 +1,687 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Advanced search form management +* +* @file search_adv_result.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath'].'class'.DIRECTORY_SEPARATOR."class_indexing_searching_app.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +$core_tools->test_service('adv_search_mlb', 'apps'); +$is = new indexing_searching_app(); +$func = new functions(); +$req = new request(); +$fields = ""; +$orderby = ""; +$copies = ""; +$_SESSION['copies'] = "false"; +$_SESSION['searching']['where_clause_bis'] = ""; +// define the row of the start +if(isset($_REQUEST['start'])) +{ + $start = $_REQUEST['start']; +} +else +{ + $start = 0; +} +$where_request = ""; + + $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; +$json_txt = '{'; + +/** + * Array $_REQUEST['meta'] exemple +( + [0] => copies#copies_false,copies_true#radio + [1] => objet#objet#input_text + [2] => numged#numged#input_text + [3] => multifield#multifield#input_text + [4] => category#category#select_simple + [5] => doc_date#doc_date_from,doc_date_to#date_range +) +**/ +if(count($_REQUEST['meta']) > 0) +{ + //Verif for parm sended by url + if($_GET['meta']) + { + for($m=0; $m<count($_REQUEST['meta']);$m++) + { + if (strstr($_REQUEST['meta'][$m], '||') == true) + { + $_REQUEST['meta'][$m] = str_replace('||', '#', $_REQUEST['meta'][$m]); + } + } + } + + $_SESSION['meta_search'] = $_REQUEST['meta']; + for($i=0; $i<count($_REQUEST['meta']);$i++) + { + $tab = explode('#', $_REQUEST['meta'][$i]); + $id_val = $tab[0]; + $json_txt .= "'".$tab[0]."' : { 'type' : '".$tab[2]."', 'fields' : {"; + $tab_id_fields = explode(',', $tab[1]); + //print_r($tab_id_fields); + for($j=0; $j<count($tab_id_fields);$j++) + { + // ENTITIES + if($tab_id_fields[$j] == 'services_chosen' && isset($_REQUEST['services_chosen'])) + { + $json_txt .= " 'services_chosen' : ["; + $srv_chosen_tmp = " ("; + for ($get_i = 0; $get_i <count($_REQUEST['services_chosen']); $get_i++) + { + $srv_chosen_tmp .= "'".$func->protect_string_db($_REQUEST['services_chosen'][$get_i])."',"; + $json_txt .= "'".$_REQUEST['services_chosen'][$get_i]."',"; + } + $srv_chosen_tmp = substr($srv_chosen_tmp, 0, -1); + $json_txt = substr($json_txt, 0, -1); + $srv_chosen_tmp .= ") "; + + $where_request .= " destination IN ".$srv_chosen_tmp." "; + $where_request .=" and "; + $json_txt .= '],'; + } + // MULTIFIELD : subject, title, doc_custom_t1 + else if($tab_id_fields[$j] == 'multifield' && !empty($_REQUEST['multifield'])) + { + $json_txt .= "'multifield' : ['".addslashes(trim($_REQUEST['multifield']))."'],"; + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= "(subject ilike '%".$func->protect_string_db($_REQUEST['multifield'])."%' or alt_identifier ilike '%".$func->protect_string_db($_REQUEST['multifield'])."%' or title ilike '%".$func->protect_string_db($_REQUEST['multifield'])."%' or doc_custom_t1 ilike '%".$func->protect_string_db($_REQUEST['multifield'])."%') "; + } + else //if($_SESSION['config']['databasetype'] == "MYSQL") + { + $where_request .= "(subject LIKE '%".$func->protect_string_db($_REQUEST['multifield'])."%' or alt_identifier LIKE '%".$func->protect_string_db($_REQUEST['multifield'])."%' or title LIKE '%".$func->protect_string_db($_REQUEST['multifield'])."%' or doc_custom_t1 LIKE '%".$func->protect_string_db($_REQUEST['multifield'])."%') "; + } + + $where_request .=" and "; + } + else if($tab_id_fields[$j] == 'chrono' && !empty($_REQUEST['chrono'])) + { + $json_txt .= " 'chrono' : ['".addslashes(trim($_REQUEST['chrono']))."'],"; + $chrono = $func->wash($_REQUEST['chrono'],"no",_CHRONO_NUMBER,"no"); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " alt_identifier ilike '%".$chrono."%' "; + } + else + { + $where_request .= " alt_identifier like '%".$chrono."%' "; + } + $where_request .=" and "; + } + // PRIORITY + else if($tab_id_fields[$j] == 'priority' && !empty($_REQUEST['priority'])) + { + $json_txt .= " 'priority' : ['".addslashes(trim($_REQUEST['priority']))."'],"; + $prio = $func->wash($_REQUEST['priority'],"num",_THE_PRIORITY,"no"); + $where_request .= " priority = ".$prio." "; + $where_request .=" and "; + } + // PROCESS NOTES + else if($tab_id_fields[$j] == 'process_notes' && !empty($_REQUEST['process_notes'])) + { + $json_txt .= " 'process_notes' : ['".addslashes(trim($_REQUEST['process_notes']))."'],"; + $s_process_notes = $func->wash($_REQUEST['process_notes'], "no", _PROCESS_NOTES,"no"); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " (process_notes ILIKE '%".$func->protect_string_db($s_process_notes)."%' ) and "; + } + else + { + $where_request .= " (process_notes LIKE '%".$func->protect_string_db($s_process_notes)."%' ) and "; + } + } + /*else if($tab_id_fields[$j] == 'numcourrier' && !empty($_REQUEST['numcourrier'])) + { + $json_txt .= " 'numcourrier' : ['".addslashes(trim($_REQUEST['numcourrier']))."'],"; + $s_numcourrier = $func->wash($_REQUEST['numcourrier'], "no", _MAIL_IDENTIFIER,"no"); + $_SESSION['numcourrier'] = $s_numcourrier; + $where_request .= "r.IDENTIFIER LIKE '%".$s_numcourrier."%' and "; + }*/ + // NOTES + else if($tab_id_fields[$j] == 'doc_notes' && !empty($_REQUEST['doc_notes'])) + { + $json_txt .= " 'doc_notes' : ['".addslashes(trim($_REQUEST['doc_notes']))."'],"; + $s_doc_notes = $func->wash($_REQUEST['doc_notes'], "no", _NOTES,"no"); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " res_id in(select identifier from ".$_SESSION['tablename']['not_notes']." where note_text ILIKE '%".$func->protect_string_db($s_doc_notes)."%') and "; + } + else + { + $where_request .= " res_id in(select identifier from ".$_SESSION['tablename']['not_notes']." where note_text LIKE '%".$func->protect_string_db($s_doc_notes)."%') and "; + } + } + // FOLDER : MARKET + else if($tab_id_fields[$j] == 'market' && !empty($_REQUEST['market'])) + { + $json_txt .= " 'market' : ['".addslashes(trim($_REQUEST['market']))."'],"; + $market = $func->wash($_REQUEST['market'], "no", _MARKET,"no"); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " (folder_name ilike '".$func->protect_string_db($market)."%' or fold_subject ilike '".$func->protect_string_db($market)."%' ) and "; + } + else + { + $where_request .= " (folder_name like '".$func->protect_string_db($market)."%' or fold_subject like '".$func->protect_string_db($market)."%' ) and "; + } + } + // FOLDER : PROJECT + else if($tab_id_fields[$j] == 'project' && !empty($_REQUEST['project'])) + { + $json_txt .= " 'project' : ['".addslashes(trim($_REQUEST['project']))."'],"; + $project = $func->wash($_REQUEST['project'], "no", _MARKET,"no"); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " (folder_name ilike '".$func->protect_string_db($project)."%' or fold_subject ilike '".$func->protect_string_db($project)."%' ) and "; + } + else + { + $where_request .= " (folder_name like '".$func->protect_string_db($project)."%' or fold_subject like '".$func->protect_string_db($project)."%' or folders_system_id in (select parent_id from ".$_SESSION['tablename']['fold_folders']." where folder_name like '".$func->protect_string_db($project)."%' or fold_subject like '".$func->protect_string_db($project)."%')) and "; + } + } + // DEST + else if($tab_id_fields[$j] == 'dest' && !empty($_REQUEST['dest'])) + { + $json_txt .= " 'dest' : ['".addslashes(trim($_REQUEST['dest']))."'],"; + $dest = $func->wash($_REQUEST['dest'], "no", _DEST,"no"); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " (dest_contact_id in(select contact_id from ".$_SESSION['tablename']['contacts']." where lastname ILIKE '".$func->protect_string_db($dest)."%' or firstname ILIKE '".$func->protect_string_db($dest)."%' or society ILIKE '".$func->protect_string_db($dest)."%' or function ILIKE '".$func->protect_string_db($dest)."%') or dest_user_id in (select user_id from ".$_SESSION['tablename']['users']." where lastname ILIKE '".$func->protect_string_db($dest)."%' or firstname ILIKE '".$func->protect_string_db($dest)."%' or user_id ILIKE '".$func->protect_string_db($dest)."%')) and "; + } + else + { + $where_request .= " (dest_contact_id in(select contact_id from ".$_SESSION['tablename']['contacts']." where lastname LIKE '".$func->protect_string_db($dest)."%' or firstname LIKE '".$func->protect_string_db($dest)."%' or society LIKE '".$func->protect_string_db($dest)."%' or function LIKE '".$func->protect_string_db($dest)."%') or dest_user_id in (select user_id from ".$_SESSION['tablename']['users']." where lastname LIKE '".$func->protect_string_db($dest)."%' or firstname LIKE '".$func->protect_string_db($dest)."%' or user_id LIKE '".$func->protect_string_db($dest)."%')) and "; + } + } + //SHIPPER + else if($tab_id_fields[$j] == 'shipper' && !empty($_REQUEST['shipper'])) + { + $json_txt .= " 'shipper' : ['".addslashes(trim($_REQUEST['shipper']))."'],"; + $shipper = $func->wash($_REQUEST['shipper'], "no", _SHIPPER,"no"); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " (exp_contact_id in(select contact_id from ".$_SESSION['tablename']['contacts']." where lastname ILIKE '".$func->protect_string_db($shipper)."%' or firstname ILIKE '".$func->protect_string_db($shipper)."%' or society ILIKE '".$func->protect_string_db($shipper)."%' or function ILIKE '".$func->protect_string_db($shipper)."%') or exp_user_id in (select user_id from ".$_SESSION['tablename']['users']." where lastname ILIKE '".$func->protect_string_db($shipper)."%' or firstname ILIKE '".$func->protect_string_db($shipper)."%' or user_id LIKE '".$func->protect_string_db($shipper)."%')) and "; + } + else + { + $where_request .= " (exp_contact_id in(select contact_id from ".$_SESSION['tablename']['contacts']." where lastname LIKE '".$func->protect_string_db($shipper)."%' or firstname LIKE '".$func->protect_string_db($shipper)."%' or society LIKE '".$func->protect_string_db($shipper)."%' or function LIKE '".$func->protect_string_db($shipper)."%') or exp_user_id in (select user_id from ".$_SESSION['tablename']['users']." where lastname LIKE '".$func->protect_string_db($shipper)."%' or firstname LIKE '".$func->protect_string_db($shipper)."%' or user_id LIKE '".$func->protect_string_db($shipper)."%')) and "; + } + } + // GED NUM + else if($tab_id_fields[$j] == 'numged' && !empty($_REQUEST['numged'])) + { + $json_txt .= " 'numged' : ['".addslashes(trim($_REQUEST['numged']))."'],"; + //$s_numged = $func->wash($_REQUEST['numged'], "num", _N_GED,"no"); + //$_SESSION['numged'] = $s_numged; + $where_request .= "res_id = ".$func->wash($_REQUEST['numged'], "num", _N_GED,"no")." and "; + } + // DEST_USER + else if($tab_id_fields[$j] == 'destinataire_chosen' && !empty($_REQUEST['destinataire_chosen'])) + { + $json_txt .= " 'destinataire_chosen' : ["; + $destinataire_chosen_tmp = " ("; + for ($get_i = 0; $get_i <count($_REQUEST['destinataire_chosen']); $get_i++) + { + $destinataire_chosen_tmp .= "'".$func->protect_string_db($_REQUEST['destinataire_chosen'][$get_i])."',"; + $json_txt .= "'".$_REQUEST['destinataire_chosen'][$get_i]."',"; + } + $destinataire_chosen_tmp = substr($destinataire_chosen_tmp, 0, -1); + $json_txt = substr($json_txt, 0, -1); + $destinataire_chosen_tmp .= ") "; + + $where_request .= " dest_user IN ".$destinataire_chosen_tmp." "; + $where_request .=" and "; + $json_txt .= '],'; + } + // SUBJECT + else if($tab_id_fields[$j] == 'subject' && !empty($_REQUEST['subject'])) + { + $json_txt .= " 'subject' : ['".addslashes(trim($_REQUEST['subject']))."'],"; + $where_request .= " subject ilike '%".$func->protect_string_db($_REQUEST['subject'])."%' and "; + } + // FULLTEXT + else if($tab_id_fields[$j] == 'fulltext' && !empty($_REQUEST['fulltext'])) + { + $json_txt .= " 'fulltext' : ['".addslashes(trim($_REQUEST['fulltext']))."'],"; + set_include_path($_SESSION['config']['businessapppath']."tools".$_SESSION['slash_env'].PATH_SEPARATOR.get_include_path()); + require_once('Zend/Search/Lucene.php'); + $path_to_lucene_index = $_SESSION['collections'][0]['path_to_lucene_index']; + if(is_dir($path_to_lucene_index)) + { + if(!$func->isDirEmpty($path_to_lucene_index)) + { + $index = Zend_Search_Lucene::open($path_to_lucene_index); + $hits = $index->find($_REQUEST['fulltext']); + $Liste_Ids = "0"; + foreach ($hits as $hit) + { + $Liste_Ids .= ", '". $hit->Id ."'"; + } + $where_request .= " res_id IN ($Liste_Ids) and "; + } + } + else + { + $where_request .= " 1=-1 and "; + } + } + // PRIORITY + else if($tab_id_fields[$j] == 'priority' && (!empty($_REQUEST['priority']) ||$_REQUEST['priority'] == 0) ) + { + $json_txt .= " 'priority' : ['".addslashes(trim($_REQUEST['priority']))."'],"; + $where_request .= " priority = ".$_REQUEST['priority']." and "; + } + // DOCTYPES + else if($tab_id_fields[$j] == 'doctypes_chosen' && !empty($_REQUEST['doctypes_chosen'])) + { + $json_txt .= " 'doctypes_chosen' : ["; + $doctypes_chosen_tmp = " ("; + for ($get_i = 0; $get_i <count($_REQUEST['doctypes_chosen']); $get_i++) + { + $doctypes_chosen_tmp .= "'".$func->protect_string_db($_REQUEST['doctypes_chosen'][$get_i])."',"; + $json_txt .= "'".$_REQUEST['doctypes_chosen'][$get_i]."',"; + } + $doctypes_chosen_tmp = substr($doctypes_chosen_tmp, 0, -1); + $json_txt = substr($json_txt, 0, -1); + $doctypes_chosen_tmp .= ") "; + + $where_request .= " type_id IN ".$doctypes_chosen_tmp." "; + $where_request .=" and "; + $json_txt .= '],'; + } + // ARBOXE + //Physical Archive including => filter on boxes + //else if($tab_id_fields[$j] == 'boxes_chosen' && !empty($_REQUEST['arbox_id_chosen'])) + else if($tab_id_fields[$j] == 'arboxes_chosen') + { + $json_txt .= " 'arbox_id_chosen' : ["; + $arbox_id_chosen_tmp = " ("; + for ($get_i = 0; $get_i <count($_REQUEST['arboxes_chosen']); $get_i++) + { + $arbox_id_chosen_tmp .= "'".$func->protect_string_db($_REQUEST['arboxes_chosen'][$get_i])."',"; + $json_txt .= "'".$_REQUEST['arboxes_chosen'][$get_i]."',"; + } + $arbox_id_chosen_tmp = substr($arbox_id_chosen_tmp, 0, -1); + $json_txt = substr($json_txt, 0, -1); + $arbox_id_chosen_tmp .= ") "; + + $where_request .= " arbox_id IN ".$arbox_id_chosen_tmp." "; + $where_request .=" and "; + $json_txt .= '],'; + } + // ARBATCH + //Gestion boite archive => Limitation au lot + else if($tab_id_fields[$j] == 'arbatch_id' && !empty($_REQUEST['arbatch_id'])) + { + $json_txt .= " 'arbatch_id' : ['".addslashes(trim($_REQUEST['arbatch_id']))."'],"; + $arbatch_id = $func->wash($_REQUEST['arbatch_id'], "no", _BATCH,"no"); + { + $where_request .= " arbatch_id = ".$arbatch_id." and "; + } + } + + // MAIL NATURE + else if($tab_id_fields[$j] == 'mail_nature' && !empty($_REQUEST['mail_nature'])) + { + $json_txt .= "'mail_nature' : ['".addslashes(trim($_REQUEST['mail_nature']))."'],"; + $where_request .= " nature_id = '".$func->protect_string_db($_REQUEST['mail_nature'])."' and "; + } + // CREATION DATE : FROM + else if($tab_id_fields[$j] == 'creation_date_from' && !empty($_REQUEST['creation_date_from'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['creation_date_from'])==false ) + { + $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_REQUEST['creation_date_from']; + } + else + { + $where_request .= " (creation_date >= '".$func->format_date_db($_REQUEST['creation_date_from'])."') and "; + $json_txt .= " 'creation_date_from' : ['".trim($_REQUEST['creation_date_from'])."'],"; + } + } + // CREATION DATE : TO + else if($tab_id_fields[$j] == 'creation_date_to' && !empty($_REQUEST['creation_date_to'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['creation_date_to'])==false ) + { + $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_REQUEST['creation_date_to']; + } + else + { + $where_request .= " (creation_date <= '".$func->format_date_db($_REQUEST['creation_date_to'])."') and "; + $json_txt .= " 'creation_date_to' : ['".trim($_REQUEST['creation_date_to'])."'],"; + } + } + // PROCESS DATE : FROM (closing_date) + else if($tab_id_fields[$j] == 'closing_date_from' && !empty($_REQUEST['closing_date_from'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['closing_date_from'])==false ) + { + $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_REQUEST['closing_date_from']; + } + else + { + $where_request .= " (closing_date >= '".$func->format_date_db($_REQUEST['closing_date_from'])."') and "; + $json_txt .= "'closing_date_from' : ['".trim($_REQUEST['closing_date_from'])."'],"; + } + } + // CLOSING DATE : TO + else if($tab_id_fields[$j] == 'closing_date_to' && !empty($_REQUEST['closing_date_to'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['closing_date_to'])==false ) + { + $_SESSION['error'] = _WRONG_DATE_FORMAT.' : '.$_REQUEST['closing_date_to']; + } + else + { + $where_request .= " (closing_date <= '".$func->format_date_db($_REQUEST['closing_date_to'])."') and "; + $json_txt .= "'closing_date_to' : ['".trim($_REQUEST['closing_date_to'])."'],"; + } + } + // PROCESS LIMIT DATE : FROM + else if($tab_id_fields[$j] == 'process_limit_date_from' && !empty($_REQUEST['process_limit_date_from'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['process_limit_date_from'])==false ) + { + $_SESSION['error'] = _WRONG_DATE_FORMAT.' : '.$_REQUEST['process_limit_date_from']; + } + else + { + $where_request .= " (process_limit_date >= '".$func->format_date_db($_REQUEST['lim_date_from'])."') and "; + $json_txt .= "'process_limit_date_from' : ['".trim($_REQUEST['process_limit_date_from'])."'],"; + } + } + // PROCESS LIMIT DATE : TO + else if($tab_id_fields[$j] == 'process_limit_date_to' && !empty($_REQUEST['process_limit_date_to'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['process_limit_date_to'])==false ) + { + $_SESSION['error'] = _WRONG_DATE_FORMAT.' : '.$_REQUEST['process_limit_date_to']; + } + else + { + $where_request .= " (process_limit_date <= '".$func->format_date_db($_REQUEST['process_limit_date_to'])."') and "; + $json_txt .= "'process_limit_date_to' : ['".trim($_REQUEST['process_limit_date_to'])."'],"; + } + } + // STATUS + else if($tab_id_fields[$j] == 'status_chosen' && isset($_REQUEST['status_chosen'])) + { + $json_txt .= " 'status_chosen' : ["; + $where_request .="( "; + for ($get_i = 0; $get_i <count($_REQUEST['status_chosen']); $get_i++) + { + $json_txt .= "'".$_REQUEST['status_chosen'][$get_i]."',"; + if ($_REQUEST['status_chosen'][$get_i]=="REL1") + { + $where_request .="( ".$req->extract_date('alarm1_date')." <= ".$req->current_datetime()." and ".$req->extract_date('alarm2_date')." > ".$req->current_datetime()." ) or "; + } + else + { + if ($_REQUEST['status_chosen'][$get_i]=="REL2") + { + $where_request .="( ".$req->current_datetime()." >= ".$req->extract_date('alarm2_date')." ) or "; + } + elseif ($_REQUEST['status_chosen'][$get_i]=="LATE") + { + $where_request .="( process_limit_date is not null and ".$req->current_datetime()." > ".$req->extract_date('process_limit_date')." ) or "; + } + else + { + $where_request .= " ( status = '".$func->protect_string_db($_REQUEST['status_chosen'][$get_i])."') or "; + } + } + } + $where_request = preg_replace("/or $/", "", $where_request); + $json_txt = substr($json_txt, 0, -1); + $where_request .=") and "; + $json_txt .= '],'; + } + // ANSWER TYPE BITMASK + /** + * Answer type bitmask + * 0 0 0 0 0 0 + * | | | | | |_ Simple Mail + * | | | | |___ Registered mail + * | | | |_____ Direct Contact + * | | |_______ Email + * | |_________ Fax + * |___________ Other Answer + **/ + else if($tab_id_fields[$j] == 'AR' && !empty($_REQUEST['AR'])) + { + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " answer_type_bitmask ilike '____1_' AND "; + } + else + { + $where_request .= " answer_type_bitmask like '____1_' AND "; + } + $json_txt .= " 'AR' : ['".addslashes(trim($_REQUEST['AR']))."'],"; + } + else if($tab_id_fields[$j] == 'fax' && !empty($_REQUEST['fax'])) + { + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " answer_type_bitmask ilike '_1____' AND "; + } + else + { + $where_request .= " answer_type_bitmask like '_1____' AND "; + } + $json_txt .= " 'fax' : ['".addslashes(trim($_REQUEST['fax']))."'],"; + } + else if($tab_id_fields[$j] == 'courriel' && !empty($_REQUEST['courriel'])) + { + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " answer_type_bitmask ilike '__1___' AND "; + } + else + { + $where_request .= " answer_type_bitmask like '__1___' AND "; + } + $json_txt .= " 'courriel' : ['".addslashes(trim($_REQUEST['courriel']))."'],"; + } + else if($tab_id_fields[$j] == 'autre' && !empty($_REQUEST['autre'])) + { + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " answer_type_bitmask ilike '1_____' AND "; + } + else + { + $where_request .= " answer_type_bitmask like '1_____' AND "; + } + $json_txt .= " 'autre' : ['".addslashes(trim($_REQUEST['autre']))."'],"; + } + else if($tab_id_fields[$j] == 'direct' && !empty($_REQUEST['direct'])) + { + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " answer_type_bitmask ilike '___1__' AND "; + } + else + { + $where_request .= " answer_type_bitmask like '___1__' AND "; + } + $json_txt .= " 'direct' : ['".addslashes(trim($_REQUEST['direct']))."'],"; + } + else if($tab_id_fields[$j] == 'simple_mail' && !empty($_REQUEST['simple_mail'])) + { + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " answer_type_bitmask ilike '_____1' AND "; + } + else + { + $where_request .= " answer_type_bitmask like '_____1' AND "; + } + $json_txt .= " 'simple_mail' : ['".addslashes(trim($_REQUEST['simple_mail']))."'],"; + } + else if($tab_id_fields[$j] == 'norep' && !empty($_REQUEST['norep'])) + { + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where_request .= " answer_type_bitmask = '000000' AND "; + } + else + { + $where_request .= " answer_type_bitmask = '000000' AND "; + } + $json_txt .= " 'norep' : ['".addslashes(trim($_REQUEST['norep']))."'],"; + } + // MAIL CATEGORY + else if($tab_id_fields[$j] == 'category' && !empty($_REQUEST['category'])) + { + $where_request .= " category_id = '".$func->protect_string_db($_REQUEST['category'])."' AND "; + $json_txt .= "'category' : ['".addslashes($_REQUEST['category'])."'],"; + } + // COPY + else if($tab_id_fields[$j] == 'copies_true' && $_REQUEST['copies'] == "true" ) + { + //$where_clause_bis = "res_id in (select res_id from ".$_SESSION['tablename']['bask_listinstance']." where user_id = '".$_SESSION['user']['UserId']."' and sequence > 0)"; + $_SESSION['searching']['where_clause_bis'] = "res_id in (select res_id from ".$_SESSION['tablename']['ent_listinstance']." where item_id = '".$_SESSION['user']['UserId']."' and item_type = 'user_id' and item_mode = 'cc')"; + //$core_tools->show_array($_SESSION['user']['entities']); + for($cptEntities=0;$cptEntities<count($_SESSION['user']['entities']);$cptEntities++) + { + //echo $_SESSION['user']['entities'][$cptEntities]['ENTITY_ID']."<br>"; + if($_SESSION['user']['entities'][$cptEntities]['ENTITY_ID'] <> "") + { + $whereEntities .= "item_id = '".$_SESSION['user']['entities'][$cptEntities]['ENTITY_ID']."' or "; + } + } + if(trim($whereEntities) <> "") + { + $whereEntities = substr($whereEntities, 0, count($whereEntities) - 4); + $_SESSION['searching']['where_clause_bis'] .= " or (res_id in (select res_id from ".$_SESSION['tablename']['ent_listinstance']." where (".$whereEntities.") and item_type = 'entity_id' and item_mode = 'cc'))"; + } + //echo $_SESSION['searching']['where_clause_bis'];exit; + $copies = ($_REQUEST['copies']); + $_SESSION['copies'] = $copies; + $json_txt .= " 'copies_true' : ['true'],"; + } + else if( $tab_id_fields[$j] == 'copies_false' && $_REQUEST['copies'] == "false" ) + { + $copies = "false"; + $_SESSION['copies'] = "false"; + $json_txt .= "'copies_false' : ['false'],"; + } + // ADMISSION DATE : FROM + else if($tab_id_fields[$j] == 'admission_date_from' && !empty($_REQUEST['admission_date_from'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['admission_date_from'])==false ) + { + $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_REQUEST['admission_date_from']; + } + else + { + $where_request .= " (admission_date >= '".$func->format_date_db($_REQUEST['admission_date_from'])."') and "; + $json_txt .= " 'admission_date_from' : ['".trim($_REQUEST['admission_date_from'])."'],"; + } + } + // ADMISSION DATE : TO + else if($tab_id_fields[$j] == 'admission_date_to' && !empty($_REQUEST['admission_date_to'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['admission_date_to'])==false ) + { + $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_REQUEST['admission_date_to']; + } + else + { + $where_request .= " (admission_date <= '".$func->format_date_db($_REQUEST['admission_date_to'])."') and "; + $json_txt .= " 'admission_date_to' : ['".trim($_REQUEST['admission_date_to'])."'],"; + } + } + // DOC DATE : FROM + else if($tab_id_fields[$j] == 'doc_date_from' && !empty($_REQUEST['doc_date_from'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['date_start_from'])==false ) + { + $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_REQUEST['doc_date_from']; + } + else + { + $where_request .= " (doc_date >= '".$func->format_date_db($_REQUEST['doc_date_from'])."') and "; + $json_txt .= " 'doc_date_from' : ['".trim($_REQUEST['doc_date_from'])."'],"; + } + } + // DOC DATE : TO + else if($tab_id_fields[$j] == 'doc_date_to' && !empty($_REQUEST['doc_date_to'])) + { + if( preg_match($_ENV['date_pattern'],$_REQUEST['doc_date_to'])==false ) + { + $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_REQUEST['doc_date_to']; + } + else + { + $where_request .= " (r.doc_date <= '".$func->format_date_db($_REQUEST['doc_date_to'])."') and "; + $json_txt .= " 'doc_date_to' : ['".trim($_REQUEST['doc_date_to'])."'],"; + } + } + } + $json_txt = preg_replace('/,$/', '', $json_txt); + $json_txt .= "}},"; + } + $json_txt = preg_replace('/,$/', '', $json_txt); +} +$json_txt = preg_replace("/,$/", "", $json_txt); +$json_txt .= '}'; +$_SESSION['current_search_query'] = $json_txt; +if(!empty($_SESSION['error'])) +{ + $_SESSION['error_search'] = '<br /><div class="error">'._MUST_CORRECT_ERRORS.' : <br /><br /><strong>'.$_SESSION['error_search'].'<br /><a href="'.$_SESSION['config']['businessappurl'].'index.php?page=search_adv&dir=indexing_searching">'._CLICK_HERE_TO_CORRECT.'</a></strong></div>'; + ?> + <script language="javascript" type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page=search_adv_error&dir=indexing_searching';?>';</script> + <?php +} +else +{ + $where_request = trim($where_request); + $_SESSION['searching']['where_request'] = $where_request; +} +if(empty($_SESSION['error_search'])) +{ + $page = 'list_results_mlb'; + ?> + <script language="javascript" type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page='.$page.'&dir=indexing_searching';?>';</script> + <?php + exit(); +} +?> diff --git a/maarch_entreprise/trunk/indexing_searching/search_customer.php b/maarch_entreprise/trunk/indexing_searching/search_customer.php new file mode 100644 index 0000000000000000000000000000000000000000..e590ec65ec681d03a2f294d9f467162a259dcb60 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/search_customer.php @@ -0,0 +1,107 @@ +<?php +/** +* File : search_adv.php +* +* Advanced search form +* +* @package Maarch Framework 3.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Loïc Vinet <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env'].'class_business_app_tools.php'); +$appTools = new business_app_tools(); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +$core_tools->test_service('search_customer', 'apps'); +$_SESSION['indexation'] = false; +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=search_customer&dir=indexing_searching'; +$page_label = _SEARCH_CUSTOMER; +$page_id = "is_search_customer"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +//Definition de la collection +$_SESSION['collection_id_choice'] = $_SESSION['user']['collections'][0] ; +if ($_GET['erase'] == 'true') +{ + $_SESSION['search'] = array(); +} +$_SESSION['origin'] = "search_customer"; +if($_REQUEST['num_folder'] <> "") +{ + $_REQUEST['num_folder'] = $appTools->control_abo($_REQUEST['num_folder']); + $_SESSION['search']['chosen_num_folder'] = $_REQUEST['num_folder']; +} +if($_REQUEST['name_folder'] <> "") +{ + $_SESSION['search']['chosen_name_folder'] = $_REQUEST['name_folder']; +} +//$core_tools->show_array($_REQUEST); +?> +<h1><img src="<?php echo $_SESSION['config']['businessappurl']."img/search_proj_off.gif";?>" alt="" /> <?php echo _SEARCH_CUSTOMER_TITLE; ?></h1> +<div id="inner_content" align="center"> + <div class="block"> + <table width="100%" border="0"> + <tr> + <td align="right"><label><?php echo _FOLDER_NUM;?> :</td> + <td> + <input name="num_folder" type="text" id="num_folder" onchange="javascript:submitForm();" onKeyPress="if(event.keyCode == 13)submitForm();" value="<?php echo $_SESSION['search']['chosen_num_folder'];?>" size="40" /> + <div id="foldersListById" class="autocomplete"></div> + <script type="text/javascript"> + initList('num_folder', 'foldersListById', '<?php echo $_SESSION['urltomodules'];?>folder/folders_list_by_id.php', 'folder', '2'); + </script> + </td> + <td align="right"><?php echo _FOLDERNAME;?> :</td> + <td> + <input type="text" name="name_folder" id="name_folder" onsubmit="javascript:submitForm();" onKeyPress="if(event.keyCode == 13)submitForm();" value="<?php echo $_SESSION['search']['chosen_name_folder'];?>" size="40" /> + <div id="foldersListByName" class="autocomplete"></div> + <script type="text/javascript"> + initList('name_folder', 'foldersListByName', '<?php echo $_SESSION['urltomodules'];?>folder/folders_list_by_name.php', 'folder', '2'); + </script> + </td> + <td> + <input type="button" value="<?php echo _SEARCH;?>" onclick="javascript:submitForm();" class="button"> + </td> + </tr> + </table> + </div> + <script language="javascript"> + function submitForm() + { + window.frames['show_trees'].location.href='<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/show_trees.php?num_folder='+window.document.getElementById("num_folder").value+'&name_folder='+window.document.getElementById("name_folder").value; + } + </script> + <div class="clearsearch"> + <br> + <a href="<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=search_customer&dir=indexing_searching&erase=true"><img src="<?php echo $_SESSION['config']['businessappurl']."img/reset.gif";?>" alt="" height="15px" width="15px" /><?php echo _NEW_SEARCH; ?></a> + </div> + <!-- Display the layout of search_customer --> + <table width="100%" height="100%" border="1"> + <tr> + <td width= "55%" height = "720px"> + <iframe name="show_trees" id="show_trees" width="100%" height="720" frameborder="0" scrolling="auto" src="<?php echo $_SESSION['config']['businessappurl']."indexing_searching/show_trees.php?num_folder=".$_REQUEST['num_folder']."&name_folder=".$_REQUEST['name_folder'];?>"></iframe> + </td> + <td> + <iframe name="view" id="view" width="100%" height="720" frameborder="0" scrolling="no" src="<?php echo $_SESSION['config']['businessappurl']."indexing_searching/little_details_invoices.php?status=empty";?>"></iframe> + </td> + </tr> + </table> +</div> diff --git a/maarch_entreprise/trunk/indexing_searching/show_res_trees.php b/maarch_entreprise/trunk/indexing_searching/show_res_trees.php new file mode 100644 index 0000000000000000000000000000000000000000..1ecf7e3fadb74bc96c41c6e887cd56fac036b287 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/show_res_trees.php @@ -0,0 +1,61 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); + + require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env'].'class_list_show.php'); + +require_once($_SESSION['pathtomodules']."autofoldering".$_SESSION['slash_env']."class".$_SESSION['slash_env']."class_modules_tools.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$func = new functions(); +$af = new autofoldering(); + +$id = ''; +if(isset($_GET['id']) && !empty($_GET['id'])) +{ + $id = $_GET['id']; +} +$_SESSION['af_current_branch_id'] = $id; +$tree_id = ''; +if(isset($_GET['tree_id']) && !empty($_GET['tree_id'])) +{ + $tree_id = $_GET['tree_id']; +} +$parents = array(); +if(count($_GET['parent_id']) > 0) +{ + $parents = $_GET['parent_id']; +} + +$children = array(); +if(count($_GET['children_id']) > 0) +{ + $children = $_GET['children_id']; +} +$core_tools->load_html(); +$core_tools->load_header(); +?> +<body id="iframe"> +<?php if(isset($_GET['script']) && !empty($_GET['script'])) +{ + $script = $_GET['script']; + if(file_exists($_GET['script'].".php")) + { + include($_GET['script'].".php"); + } + else + { + echo _SCRIPT_UNKNOWN; + } + +} +else +{ + +}?> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/indexing_searching/show_trees.php b/maarch_entreprise/trunk/indexing_searching/show_trees.php new file mode 100644 index 0000000000000000000000000000000000000000..be174534e5f942d51be5e4c47128ff1a48d4d393 --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/show_trees.php @@ -0,0 +1,461 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +//require_once("class/class_folder.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env'].'class_business_app_tools.php'); +$appTools = new business_app_tools(); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$sec = new security(); +$func = new functions(); +$db = new dbquery(); +$db->connect(); +$dbTmp = new dbquery(); +$dbTmp->connect(); +$db1 = new dbquery(); +$db1->connect(); +$db2 = new dbquery(); +$db2->connect(); +$db3 = new dbquery(); +$db3->connect(); +$db4 = new dbquery(); +$db4->connect(); +$nb_trees = count($_SESSION['user']['trees']); +$core_tools->load_html(); +$core_tools->load_header(); +//Définition de la collection en dur +//print_r($_REQUEST);exit; +$res_view = $_SESSION['user']['security'][0]['view']; +$coll_id = $_SESSION['user']['security'][0]['coll_id']; +$where_clause = $sec->get_where_clause_from_coll_id($_SESSION['collection_id_choice']); +if(trim($where_clause) == "") +{ + $where_clause = "1=1"; +} +?> +<body> +<?php +$label = _SEARCH_ADV_RESULT; +if(!empty($_SESSION['nc'])) +{ + $_REQUEST['num_folder'] = $_SESSION['nc']['num_folder']; + $_REQUEST['name_folder'] = $_SESSION['nc']['name_folder']; +} +unset($_SESSION['nc']); +unset($_SESSION['chosen_num_folder']); +unset($_SESSION['chosen_name_folder']); +if($_REQUEST['name_folder'] <> '' && $_REQUEST['num_folder'] <> '') +{ + $_SESSION['chosen_num_folder'] = $_REQUEST['num_folder']; + $db->query("select distinct folder_id, folder_name, fold_subject from ".$res_view." where (folder_name = '".$_REQUEST['name_folder']."' and folder_id = '".$_SESSION['chosen_num_folder']."') and (".$where_clause.")"); + //$db->show(); +} +elseif($_REQUEST['num_folder'] <> '') +{ + $_SESSION['chosen_num_folder'] = $_REQUEST['num_folder']; + $db->query("select distinct folder_id, folder_name, fold_subject from ".$res_view." where folder_id = '".$_SESSION['chosen_num_folder']."' and (".$where_clause.")"); + //$db->show(); +} +elseif($_REQUEST['name_folder'] <> '') +{ + $_SESSION['chosen_name_folder'] = $_REQUEST['name_folder']; + $dbTmp->query("select distinct folder_id, folder_name, subject, folder_level, folders_system_id from ".$_SESSION['tablename']['fold_folders']." where folder_name = '".$_REQUEST['name_folder']."'"); + //$dbTmp->show(); + while($resTmp = $dbTmp->fetch_object()) + { + if($resTmp->folder_level == '1') + { + $db->query("select distinct folder_id, folder_name, subject, folder_level, folders_system_id from ".$_SESSION['tablename']['fold_folders']." where parent_id = ".$resTmp->folders_system_id.""); + $flagProject = true; + //$db->show(); + } + else + { + $db->query("select distinct folder_id, folder_name, subject, folder_level, folders_system_id, parent_id from ".$_SESSION['tablename']['fold_folders']." where folder_name = '".$_REQUEST['name_folder']."'"); + //$db->show(); + } + } +} +//$actual_custom_result = $db->fetch_object(); +//$actual_custom_t1 = $actual_custom_result->folder_id; +if((isset($_SESSION['chosen_num_folder']) && !empty($_SESSION['chosen_num_folder'])) || (isset($_SESSION['chosen_name_folder']) && !empty($_SESSION['chosen_name_folder']))) +{ + ?> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>js/prototype.js"></script> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>js/scriptaculous.js"></script> + <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>Tree.js"></script> + <?php + //exit; + $search_customer_results = array(); + while($res = $db->fetch_object()) + { + $actual_custom_t1 = $res->folder_id; + //echo $actual_custom_t1."<br>"; + if($flagProject) + { + $dbTmp->query("select folder_name, subject from ".$_SESSION['tablename']['fold_folders']." where folder_name = '".$_REQUEST['name_folder']."'"); + $resTmp = $dbTmp->fetch_object(); + $idProject = $resTmp->folder_name; + $labelProject = $resTmp->subject; + } + else + { + $dbTmp->query("select folder_name, subject from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$res->parent_id.""); + $resTmp = $dbTmp->fetch_object(); + $idProject = $resTmp->folder_name; + $labelProject = $resTmp->subject; + } + $db4->query("select count(res_id) as cptresult from ".$_SESSION['collections'][0]['view']." where folder_id = '".$actual_custom_t1."' and (".$where_clause.")"); + $rescpt4 = $db4->fetch_object(); + if($rescpt4->cptresult > 150) + { + $error = "<br><br><p align='center' style='color:#FFC200;'>Passez SVP par la recherche avancée ou la recherche de dossiers, le nombre de documents demandé est trop important (".$rescpt4->cptresult.")</p>"; + break; + } + $f_level = array(); + $db1->query("select distinct doctypes_first_level_id, doctypes_first_level_label from ".$_SESSION['collections'][0]['view']." where folder_id = '".$actual_custom_t1."' and (".$where_clause.")"); + while($res1 = $db1->fetch_object()) + { + $s_level = array(); + $db2->query("select distinct doctypes_second_level_id, doctypes_second_level_label from ".$_SESSION['collections'][0]['view']." where (doctypes_first_level_id = ".$res1->doctypes_first_level_id." and folder_id = '".$actual_custom_t1."') and (".$where_clause.")"); + //$db2->show(); + //echo $res1->doctypes_first_level_label."<br>"; + while($res2 = $db2->fetch_object()) + { + $doctypes = array(); + //echo " ".$res2->doctypes_second_level_label."<br>"; + $db3->query("select distinct type_id, type_label as description from ".$_SESSION['collections'][0]['view']." where (doctypes_first_level_id = ".$res1->doctypes_first_level_id." and doctypes_second_level_id = ".$res2->doctypes_second_level_id." and folder_id = '".$actual_custom_t1."') and (".$where_clause.")"); + //$db3->show(); + while($res3 = $db3->fetch_object()) + { + //Dépot des documents + $results = array(); + //echo " ".$res3->description."<br>"; + $cptDoc=0; + $db4->query("select res_id, doc_date, folder_name, identifier, subject from ".$_SESSION['collections'][0]['view']." where (type_id = ".$res3->type_id." and folder_id = '".$actual_custom_t1."') and (".$where_clause.") order by doc_date desc"); + //$db4->show(); + while($res4 = $db4->fetch_object()) + { + /*$foundDoc = false; + if($_REQUEST['name_folder'] <> "" && $res4->folder_name == $_REQUEST['name_folder']) + { + //$foundDoc = true; + } + if($foundDoc) + { + $directResId = $res4->res_id; + }*/ + array_push($results, array('res_id' => $res4->res_id, 'doc_date' => $res4->doc_date, 'name_folder' => $res4->folder_name, 'num_ref' => $res4->identifier, 'found_doc' => $foundDoc, 'subject' => $func->show_string($res4->subject))); + $cptDoc++; + } + if($cptDoc == 0) + { + //array_push($doctypes, array('type_id' => $res3->type_id, 'description' => $func->show_string($res3->description), "results" => $results, "no_doc" => true )); + } + else + { + array_push($doctypes, array('type_id' => $res3->type_id, 'description' => $func->show_string($res3->description), "results" => $results, "no_doc" => false )); + } + } + array_push($s_level, array('doctypes_second_level_id' => $res2->doctypes_second_level_id, 'doctypes_second_level_label' => $func->show_string($res2->doctypes_second_level_label), 'doctypes' => $doctypes)); + } + //$func->show_array($s_level); + array_push($f_level, array('doctypes_first_level_id' => $res1->doctypes_first_level_id, 'doctypes_first_level_label' => $func->show_string($res1->doctypes_first_level_label), 'second_level' => $s_level)); + } + array_push($search_customer_results, array('folder_id' => $res->folder_id,'folder_name' => $res->folder_name, 'folder_subject' => $res->subject, 'content' => $f_level)); + } + //$core_tools->show_array($search_customer_results); + if($idProject <> "") + { + echo "<b> <i>".$labelProject." (".$idProject.")</i></b>"; + } + ?> + <script type="text/javascript"> + function funcOpen(branch, response) { + // Ici tu peux traiter le retour et retourner true si + // tu veux insérer les enfants, false si tu veux pas + //MyClick(branch); + return true; + } + + /* + function MyClick (branch) + { + if(branch.struct.script != '' && branch.struct.script != 'default') + { + var parents = []; + parents = branch.getParents(); + var str = ''; + for(var i=0; i < (parents.length -1) ;i++) + { + str = str + '&parent_id[]=' + parents[i].getId(); + } + window.top.frames['show_res_trees'].location.href='<?php // echo $_SESSION['urltomodules']."autofoldering/";?>show_res_trees.php?script='+branch.struct.script+'&id='+branch.getId()+"&tree_id="+branch.getAncestor().getId()+str; + } + } + */ + + function myClick(branch) { + //window.top.frames['view'].location.href='<?php echo $_SESSION['urltomodules']."indexing_searching/view_type_folder.php?id="; ?>'+branch.getId());; + //window.top.frames['view'].location.href='<?php echo $_SESSION['urltomodules']."indexing_searching/view_type_folder.php?id="; ?>'+branch.getId()); + window.top.frames['view'].location.href='<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/little_details_invoices.php?id='+branch.getId(); + //alert(branch.getId()); + //branch.setText('<b>'+branch.getText()+'</b>'); + } + + function MyOpen(branch) + { + if(branch.struct.script != '' && branch.struct.script != 'default') + { + var parents = []; + parents = branch.getParents(); + var str = ''; + for(var i=0; i < (parents.length -1) ;i++) + { + str = str + '&parent_id[]=' + parents[i].getId(); + } + var str_children = ''; + var children = branch.getChildren(); + for(var i=0; i < (children.length -1) ;i++) + { + str_children = str_children + '&children_id[]=' + children[i].getId(); + } + window.top.frames['show_res_trees'].location.href='<?php echo $_SESSION['config']['businessappurl']."indexing_searching/";?>show_res_trees.php?script='+branch.struct.script+'&id='+branch.getId()+"&tree_id="+branch.getAncestor().getId()+str+str_children; + } + return true; + } + + function MyClose(branch) + { + var parents = branch.getParents(); + var branch_id = branch.getId(); + //alert(branch_id); + if(current_branch_id != null) + { + var branch2 = tree.getBranchById(current_branch_id); + if(current_branch_id == branch_id ) + { + window.top.frames['show_res_trees'].location.href='<?php echo $_SESSION['config']['businessappurl']."indexing_searching/";?>show_res_trees.php'; + current_branch_id = branch.getNextOpenedBranch; + //current_branch_id = null; + } + else if(branch2 && branch2.isChild(branch_id)) + { + window.top.frames['show_res_trees'].location.href='<?php echo $_SESSION['config']['businessappurl']."indexing_searching/";?>show_res_trees.php'; + current_branch_id = branch.getNextOpenedBranch; + //current_branch_id = null; + } + } + branch.collapse(); + branch.openIt(false); + } + + function MyBeforeOpen(branch, opened) + { + if(opened == true) + { + MyClose(branch); + } + else + { + current_branch_id = branch.getId(); + MyOpen(branch); + return true; + } + } + + function myMouseOver (branch) + { + document.body.style.cursor='pointer'; + } + + function myMouseOut (branch) + { + document.body.style.cursor='auto'; + } + + var tree = null; + var current_branch_id = null; + + function TafelTreeInit () + { + var struct = [ + <?php + for($i=0;$i<count($search_customer_results);$i++) + { + ?> + { + 'id':'<?php echo $search_customer_results[$i]['folder_id'];?>', + 'txt':'<b><?php echo addslashes($search_customer_results[$i]['folder_subject'])."</b><br><small>(".$search_customer_results[$i]['folder_name'].")</small>";?>', + 'items':[ + <?php + for($j=0;$j<count($search_customer_results[$i]['content']);$j++) + { + ?> + { + 'id':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['doctypes_first_level_id']);?>', + 'txt':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['doctypes_first_level_label']);?>', + 'items':[ + <?php + for($k=0;$k<count($search_customer_results[$i]['content'][$j]['second_level']);$k++) + { + ?> + { + 'id':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes_second_level_id']);?>', + 'txt':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes_second_level_label']);?>', + 'items':[ + <?php + for($l=0;$l<count($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes']);$l++) + { + ?> + { + <?php + if($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['no_doc']) + { + /* + ?> + 'txt':'<span style="font-style:italic;"><small><small>(<?php echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['description']);?>)</small></small></span>', + 'img':'empty.gif', + <?php + */ + } + else + { + ?> + 'txt':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['description']);?>', + <?php + } + ?> + + 'items':[ + <?php + for($m=0;$m<count($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results']);$m++) + { + ?> + { + 'id':'<?php echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['res_id']);?>', + <?php + if($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['found_doc']) + { + $beginStr = "<b>"; + $endStr = "</b>"; + } + else + { + $beginStr = ""; + $endStr = ""; + } + if(trim($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['name_folder']) <> "" && $search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['type_id'] == "3") + { + echo "'txt':'".addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['doc_date'])." ".$beginStr.addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['name_folder']).$endStr."',"; + } + else + { + if($beginStr.addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['subject'] == "")) + { + echo "'txt':'".$beginStr.addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['res_id']).$endStr."',"; + } + else + { + //echo "'txt':'".$beginStr.addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['doc_date']).$endStr."',"; + echo "'txt':'".$beginStr.addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['subject']).$endStr." <small>(".$search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['res_id'].")</small>',"; + } + } + ?> + 'imgBase' : '<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>imgs/', + //'onbeforeopen' : MyBeforeOpen, + //'script' : 'window.opener.frames["view"].location.href="<? echo addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['res_id']);?>" ' + //'onclick' : 'javascript:window.top.frames["view"].location.href="<?php echo $_SESSION['urltomodules']."indexing_searching/view_type_folder.php?id=".addslashes($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results'][$m]['res_id']);?>" ' + "onclick" : myClick, + "onmouseover" : myMouseOver, + "onmouseout" : myMouseOut + } + <?php + if ($m <> count($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes'][$l]['results']) - 1) + echo ','; + } + ?> + ] + } + <?php + if ($l <> count($search_customer_results[$i]['content'][$j]['second_level'][$k]['doctypes']) - 1) + echo ','; + } ?> + ] + } + <?php + if($k <> count($search_customer_results[$i]['content'][$j]['second_level']) - 1) + echo ','; + } + ?> + ] + } + <?php + if ($j <> count($search_customer_results[$i]['content']) - 1) + echo ','; + } + ?> + ] + } + <?php + if ($i <> count($search_customer_results) - 1) + echo ','; + } + ?> + ]; + tree = new TafelTree('trees_div', struct, { + 'generate' : true, + 'imgBase' : '<?php echo $_SESSION['config']['businessappurl'].'tools/tafelTree/';?>imgs/', + 'defaultImg' : 'page.gif', + //'defaultImg' : 'folder.gif', + 'defaultImgOpen' : 'folderopen.gif', + 'defaultImgClose' : 'folder.gif', + 'onOpenPopulate' : [funcOpen, 'get_tree_children.php?IdTree=<?php echo $_SESSION['chosen_tree'];?>'] + }); + + //open all branches + tree.expend(); + }; + </script> + <?php + if($directResId <> "") + { + ?> + <script language="javascript"> + window.top.frames['view'].location.href='<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/little_details_invoices.php?id=<?php echo $directResId;?>'; + </script> + <?php + } + else + { + ?> + <script language="javascript"> + window.top.frames['view'].location.href='<?php echo $_SESSION['config']['businessappurl'];?>indexing_searching/little_details_invoices.php'; + </script> + <?php + } + ?> + <div id="trees_div"></div> + <?php + if($actual_custom_t1 == "") + { + echo '<br><br><p align="center" style="color:#FFC200;"><b>'._NO_RESULTS.'</b></p>'; + echo '<br><br><p align="center"><b>'._TO_SEARCH_DEFINE_A_SEARCH_ADV.'</b></p>'; + } + if($error <> "") + { + echo $error; + } +} +else +{ + echo '<br><br><p align="center"><b>'._TO_SEARCH_DEFINE_A_SEARCH_ADV.'</b></p>'; +} +?> +</body> +</html> diff --git a/maarch_entreprise/trunk/indexing_searching/view.php b/maarch_entreprise/trunk/indexing_searching/view.php new file mode 100644 index 0000000000000000000000000000000000000000..70487247b8dabeed204eecd0823cf2130a34a9ea --- /dev/null +++ b/maarch_entreprise/trunk/indexing_searching/view.php @@ -0,0 +1,219 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief View a document +* +* @file view.php +* @author Claire Figueras <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup indexing_searching_mlb +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); + +$core_tools = new core_tools(); +$core_tools->test_user(); +//here we loading the lang vars +$core_tools->load_lang(); +$function = new functions(); +$sec = new security(); +if(isset($_REQUEST['id'])) +{ + $s_id = $_REQUEST['id']; +} +else +{ + $s_id = ""; +} + +if($s_id =='' ) +{ + $_SESSION['error'] = _THE_DOC.' '._IS_EMPTY; + header("location: ".$_SESSION['config']['businessappurl']."index.php"); + exit(); +} +else +{ + $connexion = new dbquery(); + $connexion->connect(); + $table =""; + + if(isset($_SESSION['collection_id_choice']) && !empty($_SESSION['collection_id_choice'])) + { + $table = $sec->retrieve_view_from_coll_id($_SESSION['collection_id_choice']); + + if(!$table) + { + $table = $sec->retrieve_table_from_coll($_SESSION['collection_id_choice']); + } + } + else + { + if(isset($_SESSION['collections'][0]['view'])&& !empty($_SESSION['collections'][0]['view'])) + { + $table = $_SESSION['collections'][0]['view']; + } + else + { + $table = $_SESSION['collections'][0]['table']; + } + } + + $where2 = ""; + + if($_SESSION['origin'] <> "basket" && $_SESSION['origin'] <> "workflow") + { + $cpt_access_to_coll = 0; + for($i=0; $i < count($_SESSION['user']['security']); $i++) + { + if($_SESSION['collection_id_choice'] == $_SESSION['user']['security'][$i]['coll_id']) + { + $where2 = " and ( ".$_SESSION['user']['security'][$i]['where']." ) "; + } + $cpt_access_to_coll++; + } + if($cpt_access_to_coll==0) + { + $where2 = " and 1=-1"; + } + } + $connexion->query("select res_id, docserver_id, path, filename, format, fingerprint from ".$table." where res_id = ".$s_id.$where2); + //$connexion->show(); + if($connexion->nb_result() == 0) + { + //$_SESSION['error'] = _THE_DOC." "._EXISTS_OR_RIGHT."…"; + header("location: ".$_SESSION['config']['businessappurl']."index.php?page=no_right"); + exit(); + } + else + { + $line = $connexion->fetch_object(); + + $docserver = $line->docserver_id; + $path = $line->path; + $filename = $line->filename; + $format = $line->format; + $md5 = $line->fingerprint; + $fingerprint_from_db = $line->fingerprint; + $connexion->query("select path_template from ".$_SESSION['tablename']['docservers']." where docserver_id = '".$docserver."'"); + //$connexion->show(); + $line_doc = $connexion->fetch_object(); + $docserver = $line_doc->path_template; + $file = $docserver.$path.$filename; + $file = str_replace("#",DIRECTORY_SEPARATOR,$file); + $use_tiny_mce = false; + + if(strtolower($format) == 'maarch' && $core_tools->is_module_loaded('templates')) + { + $type_state = true; + $use_tiny_mce = true; + } + else + { + require_once($_SESSION['config']['businessapppath'].'class'.DIRECTORY_SEPARATOR."class_indexing_searching_app.php"); + $is = new indexing_searching_app(); + $type_state = $is->is_filetype_allowed($format); + //control of the fingerprint of the document + } + $fingerprint_from_docserver = md5_file($file); + if($fingerprint_from_db == $fingerprint_from_docserver) + { + if($type_state <> false) + { + if($_SESSION['history']['resview'] == "true") + { + require_once($_SESSION['pathtocoreclass']."class_history.php"); + $users = new history(); + $users->add($table, $s_id ,"VIEW", _VIEW_DOC_NUM."".$s_id, $_SESSION['config']['databasetype'],'indexing_searching'); + } + + if(!$use_tiny_mce || strtolower($format) <> 'maarch') + { + $mime_type = $is->get_mime_type($format); + } + // *************************************** + // Begin contribution of Mathieu DONZEL + // *************************************** + if (strtolower($format) == "pdf") + { + $Arguments = ""; + if(isset($_SESSION['search']['plain_text'])) if (strlen($_SESSION['search']['plain_text']) > 0) + { + $Arguments = "#search=". $_SESSION['search']['plain_text'] .""; + } + @copy($file, $_SESSION['config']['tmppath'].DIRECTORY_SEPARATOR.'tmp_file_'.$md5.$_SESSION['user']['UserId'].'.'.$format); + echo "<iframe frameborder=\"0\" scrolling=\"no\" width=\"100%\" HEIGHT=\"100%\" src=\"". $_SESSION['config']['businessappurl'] ."/tmp/tmp_file_".$md5.$_SESSION['user']['UserId'].".".$format ."$Arguments\">"._FRAME_ARE_NOT_AVAILABLE_FOR_YOUR_BROWSER."</iframe>"; + } + elseif($use_tiny_mce && strtolower($format) == 'maarch') + { + $myfile = fopen($file, "r"); + + $data = fread($myfile, filesize($file)); + fclose($myfile); + $content = stripslashes($data); + $core_tools->load_html(); + $core_tools->load_header(); + ?> + <body id="validation_page" onLoad="javascript:moveTo(0,0);resizeTo(screen.width, screen.height);"> + <div id="template_content" style="width:100%;" > + + <?php echo $content;?> + + </div> + </body> + </html> <?php + } + else + { + // *************************************** + // End contribution ofMathieu DONZEL + // *************************************** + header("Pragma: public"); + header("Expires: 0"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Cache-Control: public"); + header("Content-Description: File Transfer"); + header("Content-Type: ".$mime_type); + header("Content-Disposition: inline; filename=".basename('maarch.'.$format).";"); + header("Content-Transfer-Encoding: binary"); + readfile($file); + exit(); + } + } + else + { + echo _DOCTYPE.' '._UNKNOWN; + exit(); + } + } + else + { + echo _PB_WITH_FINGERPRINT_OF_DOCUMENT; + } + } +} +?> diff --git a/maarch_entreprise/trunk/js/builder.js b/maarch_entreprise/trunk/js/builder.js new file mode 100644 index 0000000000000000000000000000000000000000..83019994445ee44f40452ecbe1c45c6049531128 --- /dev/null +++ b/maarch_entreprise/trunk/js/builder.js @@ -0,0 +1,136 @@ +// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +var Builder = { + NODEMAP: { + AREA: 'map', + CAPTION: 'table', + COL: 'table', + COLGROUP: 'table', + LEGEND: 'fieldset', + OPTGROUP: 'select', + OPTION: 'select', + PARAM: 'object', + TBODY: 'table', + TD: 'table', + TFOOT: 'table', + TH: 'table', + THEAD: 'table', + TR: 'table' + }, + // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, + // due to a Firefox bug + node: function(elementName) { + elementName = elementName.toUpperCase(); + + // try innerHTML approach + var parentTag = this.NODEMAP[elementName] || 'div'; + var parentElement = document.createElement(parentTag); + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; + } catch(e) {} + var element = parentElement.firstChild || null; + + // see if browser added wrapping tags + if(element && (element.tagName.toUpperCase() != elementName)) + element = element.getElementsByTagName(elementName)[0]; + + // fallback to createElement approach + if(!element) element = document.createElement(elementName); + + // abort if nothing could be created + if(!element) return; + + // attributes (or text) + if(arguments[1]) + if(this._isStringOrNumber(arguments[1]) || + (arguments[1] instanceof Array) || + arguments[1].tagName) { + this._children(element, arguments[1]); + } else { + var attrs = this._attributes(arguments[1]); + if(attrs.length) { + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" +elementName + " " + + attrs + "></" + elementName + ">"; + } catch(e) {} + element = parentElement.firstChild || null; + // workaround firefox 1.0.X bug + if(!element) { + element = document.createElement(elementName); + for(attr in arguments[1]) + element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; + } + if(element.tagName.toUpperCase() != elementName) + element = parentElement.getElementsByTagName(elementName)[0]; + } + } + + // text, or array of children + if(arguments[2]) + this._children(element, arguments[2]); + + return element; + }, + _text: function(text) { + return document.createTextNode(text); + }, + + ATTR_MAP: { + 'className': 'class', + 'htmlFor': 'for' + }, + + _attributes: function(attributes) { + var attrs = []; + for(attribute in attributes) + attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + + '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"'); + return attrs.join(" "); + }, + _children: function(element, children) { + if(children.tagName) { + element.appendChild(children); + return; + } + if(typeof children=='object') { // array can hold nodes and text + children.flatten().each( function(e) { + if(typeof e=='object') + element.appendChild(e) + else + if(Builder._isStringOrNumber(e)) + element.appendChild(Builder._text(e)); + }); + } else + if(Builder._isStringOrNumber(children)) + element.appendChild(Builder._text(children)); + }, + _isStringOrNumber: function(param) { + return(typeof param=='string' || typeof param=='number'); + }, + build: function(html) { + var element = this.node('div'); + $(element).update(html.strip()); + return element.down(); + }, + dump: function(scope) { + if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope + + var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ + "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ + "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ + "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); + + tags.each( function(tag){ + scope[tag] = function() { + return Builder.node.apply(Builder, [tag].concat($A(arguments))); + } + }); + } +} diff --git a/maarch_entreprise/trunk/js/concertina.js b/maarch_entreprise/trunk/js/concertina.js new file mode 100644 index 0000000000000000000000000000000000000000..b8a3488a168629c98df8fe7351683b42b6ee9e9f --- /dev/null +++ b/maarch_entreprise/trunk/js/concertina.js @@ -0,0 +1,173 @@ +var Concertina = Class.create(); +Concertina.prototype = { + ffSmooth : true, + overflowQ : null, + root : null, + hite : null, + anim : null, + ease : null, + trig : null, + targ : null, + tick : null, + targHite : null, + allTrigs : [], + allTargs : [], + targsToHide : [], + targsToShow : [], + i : 0, + loopLimit : 50, + clicked : 0, + declick : null, + initialize : function (root,nest,hite,anim,ease) { + this.root = $(root); + this.hite = hite; + this.anim = anim; + this.ease = ease; + if (!this.root) return; + if (nest && this.root.childElements()[1].nodeName !== this.root.nodeName) { + $(root).select($(root).nodeName).each(function(kids){ + new Concertina(kids,nest,true,anim,ease); + }); + } + this.allTrigs = this.root.childElements().findAll(function(trig){ + return trig.nodeName === this.root.firstDescendant().nodeName; + }.bind(this)).invoke('addClassName','trig'); + this.allTargs = this.root.childElements().findAll(function(targ){ + return targ.nodeName === this.root.firstDescendant().next().nodeName; + }.bind(this)).invoke('addClassName','targ'); + if (hite && hite === true) { + this.allTargs.each(function(targ){ + this.hite = (targ.getHeight()+10 > this.hite) ? + targ.getHeight()+10 : this.hite; + }.bind(this)).invoke('setStyle',{height:this.hite+'px'}); + } else if (hite && hite > 1) { + this.hite = hite; + this.allTargs.invoke('setStyle',{height:this.hite+'px'}); + } + if (!this.anim) { + this.allTargs.invoke('hide').first().show(); + } else { + this.allTargs.invoke('setStyle',{height:0,overflow:'hidden'}); + if (!this.hite) { + this.allTargs.first().setStyle({height:'',overflow:'auto'}); + } else { + this.allTargs.first().setStyle({height:this.hite+'px',overflow:'auto'}); + } + } + this.root.addClassName('concertina').setStyle({position:'relative',zoom:1}) + .observe('click',this.wait.bindAsEventListener(this)); + this.allTrigs.first().addClassName('open'); + }, + unclick : function () { + this.clicked = 0; + this.declick = clearTimeout(this.declick); + }, + wait : function (event) { + this.trig = Event.element(event); + if (!this.allTrigs.include(this.trig)) return; + this.clicked++; + this.declick = setTimeout(this.unclick.bind(this),350); + if (this.clicked === 1) { + this.swap(event); + } + }, + swap : function () { + this.i = 0; + this.targsToHide.clear(); + this.targsToShow.clear(); + clearInterval(this.tick); + this.targ = this.trig.next(); + if (!this.anim) { + this.allTargs.invoke('hide'); + if (this.trig.hasClassName('open')) { + this.allTrigs.invoke('removeClassName','open'); + } else { + this.allTrigs.invoke('removeClassName','open'); + this.trig.addClassName('open'); + this.targ.show(); + } + } else { + if (Prototype.Browser.Gecko && this.ffSmooth === true) {// HACK!! + this.overflowQ = $$('body *').findAll(function(lmnt){ + return document.defaultView + .getComputedStyle(lmnt,null) + .getPropertyValue('overflow') === 'auto'; + }).invoke('setStyle',{overflow:'hidden'}); + } + this.targsToHide = this.allTargs.findAll(function(targ){ + return targ.getHeight() > 0; + }).invoke('setStyle',{overflow:'hidden'}); + if (this.trig.hasClassName('open')) { + this.allTrigs.invoke('removeClassName','open'); + } else { + this.allTrigs.invoke('removeClassName','open'); + this.trig.addClassName('open'); + if (!this.hite) { + this.targHite = this.targ.setStyle({height:''}).getHeight()+10; + this.targ.setStyle({height:0}); + } + this.targsToShow.push(this.targ); + } + if (!this.ease) { + this.tick = setInterval(this.tock.bind(this),1); + } else { + this.tick = setInterval(this.tock.bind(this),50); + } + } + }, + tock : function () { + this.i++; + if (!this.ease) { + this.targsToHide.each(function(targ){ + var hite = this.hite || this.targHite; + var frame = Math.ceil(hite/25); + if (targ.getHeight() >= frame && this.i <= this.loopLimit) { + targ.setStyle({height:(targ.getHeight() - frame) + 'px'}); + } else { + targ.setStyle({height:0,overflow:'hidden'}); + this.targsToHide[this.targsToHide.indexOf(targ)] = null; + } + }.bind(this)); + this.targsToHide = this.targsToHide.compact(); + this.targsToShow.each(function(targ){ + var hite = this.hite || this.targHite; + var frame = Math.ceil(hite/25); + if (targ.getHeight() < hite && this.i <= this.loopLimit) { + targ.setStyle({height:(targ.getHeight() + frame) + 'px'}); + } else { + targ.setStyle({height:hite + 'px',overflowQ:'auto'}); + this.targsToShow[this.targsToShow.indexOf(targ)] = null; + } + }.bind(this)); + this.targsToShow = this.targsToShow.compact(); + } else { + this.targsToHide.each(function(targ){ + if (targ.getHeight() > 0 && this.i <= this.loopLimit) { + targ.setStyle({height:targ.getHeight() - Math.ceil(targ.getHeight()/5) + 'px'}); + } else { + targ.setStyle({height:0,overflow:'hidden'}); + this.targsToHide[this.targsToHide.indexOf(targ)] = null; + } + }.bind(this)); + this.targsToHide = this.targsToHide.compact(); + this.targsToShow.each(function(targ){ + var hite = this.hite || this.targHite; + if (targ.getHeight() < hite && this.i <= this.loopLimit) { + targ.setStyle({height:targ.getHeight() + Math.ceil((hite - targ.getHeight())/5) + 'px'}); + } else { + targ.setStyle({height:hite + 'px',overflowQ:'auto'}); + this.targsToShow[this.targsToShow.indexOf(targ)] = null; + } + }.bind(this)); + this.targsToShow = this.targsToShow.compact(); + } + if (this.targsToShow.size() === 0 && this.targsToHide.size() === 0) { + this.tick = clearInterval(this.tick); + this.tick = null; + this.i = 0; + if (Prototype.Browser.Gecko && this.overflowQ) {// HACK!! + this.overflowQ.invoke('setStyle',{overflow:''}); + } + } + } +}; diff --git a/maarch_entreprise/trunk/js/controls.js b/maarch_entreprise/trunk/js/controls.js new file mode 100644 index 0000000000000000000000000000000000000000..5012cb812abb97a874b6b2d79d437e3a9c807634 --- /dev/null +++ b/maarch_entreprise/trunk/js/controls.js @@ -0,0 +1,965 @@ +// script.aculo.us controls.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan) +// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) +// Contributors: +// Richard Livsey +// Rahul Bhargava +// Rob Wills +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// Autocompleter.Base handles all the autocompletion functionality +// that's independent of the data source for autocompletion. This +// includes drawing the autocompletion menu, observing keyboard +// and mouse events, and similar. +// +// Specific autocompleters need to provide, at the very least, +// a getUpdatedChoices function that will be invoked every time +// the text inside the monitored textbox changes. This method +// should get the text for which to provide autocompletion by +// invoking this.getToken(), NOT by directly accessing +// this.element.value. This is to allow incremental tokenized +// autocompletion. Specific auto-completion logic (AJAX, etc) +// belongs in getUpdatedChoices. +// +// Tokenized incremental autocompletion is enabled automatically +// when an autocompleter is instantiated with the 'tokens' option +// in the options parameter, e.g.: +// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); +// will incrementally autocomplete with a comma as the token. +// Additionally, ',' in the above example can be replaced with +// a token array, e.g. { tokens: [',', '\n'] } which +// enables autocompletion on multiple tokens. This is most +// useful when one of the tokens is \n (a newline), as it +// allows smart autocompletion after linebreaks. + +if(typeof Effect == 'undefined') + throw("controls.js requires including script.aculo.us' effects.js library"); + +var Autocompleter = { } +Autocompleter.Base = Class.create({ + baseInitialize: function(element, update, options) { + element = $(element) + this.element = element; + this.update = $(update); + this.hasFocus = false; + this.changed = false; + this.active = false; + this.index = 0; + this.entryCount = 0; + this.oldElementValue = this.element.value; + + if(this.setOptions) + this.setOptions(options); + else + this.options = options || { }; + + this.options.paramName = this.options.paramName || this.element.name; + this.options.tokens = this.options.tokens || []; + this.options.frequency = this.options.frequency || 0.4; + this.options.minChars = this.options.minChars || 1; + this.options.onShow = this.options.onShow || + function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, { + setHeight: false, + offsetTop: element.offsetHeight + }); + } + Effect.Appear(update,{duration:0.15}); + }; + this.options.onHide = this.options.onHide || + function(element, update){ new Effect.Fade(update,{duration:0.15}) }; + + if(typeof(this.options.tokens) == 'string') + this.options.tokens = new Array(this.options.tokens); + // Force carriage returns as token delimiters anyway + if (!this.options.tokens.include('\n')) + this.options.tokens.push('\n'); + + this.observer = null; + + this.element.setAttribute('autocomplete','off'); + + Element.hide(this.update); + + Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); + Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); + }, + + show: function() { + if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); + if(!this.iefix && + (Prototype.Browser.IE) && + (Element.getStyle(this.update, 'position')=='absolute')) { + new Insertion.After(this.update, + '<iframe id="' + this.update.id + '_iefix" '+ + 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' + + 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>'); + this.iefix = $(this.update.id+'_iefix'); + } + if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); + }, + + fixIEOverlapping: function() { + Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); + this.iefix.style.zIndex = 1; + this.update.style.zIndex = 2; + Element.show(this.iefix); + }, + + hide: function() { + this.stopIndicator(); + if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); + if(this.iefix) Element.hide(this.iefix); + }, + + startIndicator: function() { + if(this.options.indicator) Element.show(this.options.indicator); + }, + + stopIndicator: function() { + if(this.options.indicator) Element.hide(this.options.indicator); + }, + + onKeyPress: function(event) { + if(this.active) + switch(event.keyCode) { + case Event.KEY_TAB: + case Event.KEY_RETURN: + this.selectEntry(); + Event.stop(event); + case Event.KEY_ESC: + this.hide(); + this.active = false; + Event.stop(event); + return; + case Event.KEY_LEFT: + case Event.KEY_RIGHT: + return; + case Event.KEY_UP: + this.markPrevious(); + this.render(); + Event.stop(event); + return; + case Event.KEY_DOWN: + this.markNext(); + this.render(); + Event.stop(event); + return; + } + else + if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || + (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; + + this.changed = true; + this.hasFocus = true; + + if(this.observer) clearTimeout(this.observer); + this.observer = + setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); + }, + + activate: function() { + this.changed = false; + this.hasFocus = true; + this.getUpdatedChoices(); + }, + + onHover: function(event) { + var element = Event.findElement(event, 'LI'); + if(this.index != element.autocompleteIndex) + { + this.index = element.autocompleteIndex; + this.render(); + } + Event.stop(event); + }, + + onClick: function(event) { + var element = Event.findElement(event, 'LI'); + this.index = element.autocompleteIndex; + this.selectEntry(); + this.hide(); + }, + + onBlur: function(event) { + // needed to make click events working + setTimeout(this.hide.bind(this), 250); + this.hasFocus = false; + this.active = false; + }, + + render: function() { + if(this.entryCount > 0) { + for (var i = 0; i < this.entryCount; i++) + this.index==i ? + Element.addClassName(this.getEntry(i),"selected") : + Element.removeClassName(this.getEntry(i),"selected"); + if(this.hasFocus) { + this.show(); + this.active = true; + } + } else { + this.active = false; + this.hide(); + } + }, + + markPrevious: function() { + if(this.index > 0) this.index-- + else this.index = this.entryCount-1; + this.getEntry(this.index).scrollIntoView(true); + }, + + markNext: function() { + if(this.index < this.entryCount-1) this.index++ + else this.index = 0; + this.getEntry(this.index).scrollIntoView(false); + }, + + getEntry: function(index) { + return this.update.firstChild.childNodes[index]; + }, + + getCurrentEntry: function() { + return this.getEntry(this.index); + }, + + selectEntry: function() { + this.active = false; + this.updateElement(this.getCurrentEntry()); + }, + + updateElement: function(selectedElement) { + if (this.options.updateElement) { + this.options.updateElement(selectedElement); + return; + } + var value = ''; + if (this.options.select) { + var nodes = $(selectedElement).select('.' + this.options.select) || []; + if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); + } else + value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); + + var bounds = this.getTokenBounds(); + if (bounds[0] != -1) { + var newValue = this.element.value.substr(0, bounds[0]); + var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); + if (whitespace) + newValue += whitespace[0]; + this.element.value = newValue + value + this.element.value.substr(bounds[1]); + } else { + this.element.value = value; + } + this.oldElementValue = this.element.value; + this.element.focus(); + + if (this.options.afterUpdateElement) + this.options.afterUpdateElement(this.element, selectedElement); + }, + + updateChoices: function(choices) { + if(!this.changed && this.hasFocus) { + this.update.innerHTML = choices; + Element.cleanWhitespace(this.update); + Element.cleanWhitespace(this.update.down()); + + if(this.update.firstChild && this.update.down().childNodes) { + this.entryCount = + this.update.down().childNodes.length; + for (var i = 0; i < this.entryCount; i++) { + var entry = this.getEntry(i); + entry.autocompleteIndex = i; + this.addObservers(entry); + } + } else { + this.entryCount = 0; + } + + this.stopIndicator(); + this.index = 0; + + if(this.entryCount==1 && this.options.autoSelect) { + this.selectEntry(); + this.hide(); + } else { + this.render(); + } + } + }, + + addObservers: function(element) { + Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); + Event.observe(element, "click", this.onClick.bindAsEventListener(this)); + }, + + onObserverEvent: function() { + this.changed = false; + this.tokenBounds = null; + if(this.getToken().length>=this.options.minChars) { + this.getUpdatedChoices(); + } else { + this.active = false; + this.hide(); + } + this.oldElementValue = this.element.value; + }, + + getToken: function() { + var bounds = this.getTokenBounds(); + return this.element.value.substring(bounds[0], bounds[1]).strip(); + }, + + getTokenBounds: function() { + if (null != this.tokenBounds) return this.tokenBounds; + var value = this.element.value; + if (value.strip().empty()) return [-1, 0]; + var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); + var offset = (diff == this.oldElementValue.length ? 1 : 0); + var prevTokenPos = -1, nextTokenPos = value.length; + var tp; + for (var index = 0, l = this.options.tokens.length; index < l; ++index) { + tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); + if (tp > prevTokenPos) prevTokenPos = tp; + tp = value.indexOf(this.options.tokens[index], diff + offset); + if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; + } + return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); + } +}); + +Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { + var boundary = Math.min(newS.length, oldS.length); + for (var index = 0; index < boundary; ++index) + if (newS[index] != oldS[index]) + return index; + return boundary; +}; + +Ajax.Autocompleter = Class.create(Autocompleter.Base, { + initialize: function(element, update, url, options) { + this.baseInitialize(element, update, options); + this.options.asynchronous = true; + this.options.onComplete = this.onComplete.bind(this); + this.options.defaultParams = this.options.parameters || null; + this.url = url; + }, + + getUpdatedChoices: function() { + this.startIndicator(); + + var entry = encodeURIComponent(this.options.paramName) + '=' + + encodeURIComponent(this.getToken()); + + this.options.parameters = this.options.callback ? + this.options.callback(this.element, entry) : entry; + + if(this.options.defaultParams) + this.options.parameters += '&' + this.options.defaultParams; + + new Ajax.Request(this.url, this.options); + }, + + onComplete: function(request) { + this.updateChoices(request.responseText); + } +}); + +// The local array autocompleter. Used when you'd prefer to +// inject an array of autocompletion options into the page, rather +// than sending out Ajax queries, which can be quite slow sometimes. +// +// The constructor takes four parameters. The first two are, as usual, +// the id of the monitored textbox, and id of the autocompletion menu. +// The third is the array you want to autocomplete from, and the fourth +// is the options block. +// +// Extra local autocompletion options: +// - choices - How many autocompletion choices to offer +// +// - partialSearch - If false, the autocompleter will match entered +// text only at the beginning of strings in the +// autocomplete array. Defaults to true, which will +// match text at the beginning of any *word* in the +// strings in the autocomplete array. If you want to +// search anywhere in the string, additionally set +// the option fullSearch to true (default: off). +// +// - fullSsearch - Search anywhere in autocomplete array strings. +// +// - partialChars - How many characters to enter before triggering +// a partial match (unlike minChars, which defines +// how many characters are required to do any match +// at all). Defaults to 2. +// +// - ignoreCase - Whether to ignore case when autocompleting. +// Defaults to true. +// +// It's possible to pass in a custom function as the 'selector' +// option, if you prefer to write your own autocompletion logic. +// In that case, the other options above will not apply unless +// you support them. + +Autocompleter.Local = Class.create(Autocompleter.Base, { + initialize: function(element, update, array, options) { + this.baseInitialize(element, update, options); + this.options.array = array; + }, + + getUpdatedChoices: function() { + this.updateChoices(this.options.selector(this)); + }, + + setOptions: function(options) { + this.options = Object.extend({ + choices: 10, + partialSearch: true, + partialChars: 2, + ignoreCase: true, + fullSearch: false, + selector: function(instance) { + var ret = []; // Beginning matches + var partial = []; // Inside matches + var entry = instance.getToken(); + var count = 0; + + for (var i = 0; i < instance.options.array.length && + ret.length < instance.options.choices ; i++) { + + var elem = instance.options.array[i]; + var foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase()) : + elem.indexOf(entry); + + while (foundPos != -1) { + if (foundPos == 0 && elem.length != entry.length) { + ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + + elem.substr(entry.length) + "</li>"); + break; + } else if (entry.length >= instance.options.partialChars && + instance.options.partialSearch && foundPos != -1) { + if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { + partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" + + elem.substr(foundPos, entry.length) + "</strong>" + elem.substr( + foundPos + entry.length) + "</li>"); + break; + } + } + + foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : + elem.indexOf(entry, foundPos + 1); + + } + } + if (partial.length) + ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)) + return "<ul>" + ret.join('') + "</ul>"; + } + }, options || { }); + } +}); + +// AJAX in-place editor and collection editor +// Full rewrite by Christophe Porteneuve <tdd@tddsworld.com> (April 2007). + +// Use this if you notice weird scrolling problems on some browsers, +// the DOM might be a bit confused when this gets called so do this +// waits 1 ms (with setTimeout) until it does the activation +Field.scrollFreeActivate = function(field) { + setTimeout(function() { + Field.activate(field); + }, 1); +} + +Ajax.InPlaceEditor = Class.create({ + initialize: function(element, url, options) { + this.url = url; + this.element = element = $(element); + this.prepareOptions(); + this._controls = { }; + arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! + Object.extend(this.options, options || { }); + if (!this.options.formId && this.element.id) { + this.options.formId = this.element.id + '-inplaceeditor'; + if ($(this.options.formId)) + this.options.formId = ''; + } + if (this.options.externalControl) + this.options.externalControl = $(this.options.externalControl); + if (!this.options.externalControl) + this.options.externalControlOnly = false; + this._originalBackground = this.element.getStyle('background-color') || 'transparent'; + this.element.title = this.options.clickToEditText; + this._boundCancelHandler = this.handleFormCancellation.bind(this); + this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); + this._boundFailureHandler = this.handleAJAXFailure.bind(this); + this._boundSubmitHandler = this.handleFormSubmission.bind(this); + this._boundWrapperHandler = this.wrapUp.bind(this); + this.registerListeners(); + }, + checkForEscapeOrReturn: function(e) { + if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; + if (Event.KEY_ESC == e.keyCode) + this.handleFormCancellation(e); + else if (Event.KEY_RETURN == e.keyCode) + this.handleFormSubmission(e); + }, + createControl: function(mode, handler, extraClasses) { + var control = this.options[mode + 'Control']; + var text = this.options[mode + 'Text']; + if ('button' == control) { + var btn = document.createElement('input'); + btn.type = 'submit'; + btn.value = text; + btn.className = 'editor_' + mode + '_button'; + if ('cancel' == mode) + btn.onclick = this._boundCancelHandler; + this._form.appendChild(btn); + this._controls[mode] = btn; + } else if ('link' == control) { + var link = document.createElement('a'); + link.href = '#'; + link.appendChild(document.createTextNode(text)); + link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; + link.className = 'editor_' + mode + '_link'; + if (extraClasses) + link.className += ' ' + extraClasses; + this._form.appendChild(link); + this._controls[mode] = link; + } + }, + createEditField: function() { + var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); + var fld; + if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { + fld = document.createElement('input'); + fld.type = 'text'; + var size = this.options.size || this.options.cols || 0; + if (0 < size) fld.size = size; + } else { + fld = document.createElement('textarea'); + fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); + fld.cols = this.options.cols || 40; + } + fld.name = this.options.paramName; + fld.value = text; // No HTML breaks conversion anymore + fld.className = 'editor_field'; + if (this.options.submitOnBlur) + fld.onblur = this._boundSubmitHandler; + this._controls.editor = fld; + if (this.options.loadTextURL) + this.loadExternalText(); + this._form.appendChild(this._controls.editor); + }, + createForm: function() { + var ipe = this; + function addText(mode, condition) { + var text = ipe.options['text' + mode + 'Controls']; + if (!text || condition === false) return; + ipe._form.appendChild(document.createTextNode(text)); + }; + this._form = $(document.createElement('form')); + this._form.id = this.options.formId; + this._form.addClassName(this.options.formClassName); + this._form.onsubmit = this._boundSubmitHandler; + this.createEditField(); + if ('textarea' == this._controls.editor.tagName.toLowerCase()) + this._form.appendChild(document.createElement('br')); + if (this.options.onFormCustomization) + this.options.onFormCustomization(this, this._form); + addText('Before', this.options.okControl || this.options.cancelControl); + this.createControl('ok', this._boundSubmitHandler); + addText('Between', this.options.okControl && this.options.cancelControl); + this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); + addText('After', this.options.okControl || this.options.cancelControl); + }, + destroy: function() { + if (this._oldInnerHTML) + this.element.innerHTML = this._oldInnerHTML; + this.leaveEditMode(); + this.unregisterListeners(); + }, + enterEditMode: function(e) { + if (this._saving || this._editing) return; + this._editing = true; + this.triggerCallback('onEnterEditMode'); + if (this.options.externalControl) + this.options.externalControl.hide(); + this.element.hide(); + this.createForm(); + this.element.parentNode.insertBefore(this._form, this.element); + if (!this.options.loadTextURL) + this.postProcessEditField(); + if (e) Event.stop(e); + }, + enterHover: function(e) { + if (this.options.hoverClassName) + this.element.addClassName(this.options.hoverClassName); + if (this._saving) return; + this.triggerCallback('onEnterHover'); + }, + getText: function() { + return this.element.innerHTML; + }, + handleAJAXFailure: function(transport) { + this.triggerCallback('onFailure', transport); + if (this._oldInnerHTML) { + this.element.innerHTML = this._oldInnerHTML; + this._oldInnerHTML = null; + } + }, + handleFormCancellation: function(e) { + this.wrapUp(); + if (e) Event.stop(e); + }, + handleFormSubmission: function(e) { + var form = this._form; + var value = $F(this._controls.editor); + this.prepareSubmission(); + var params = this.options.callback(form, value) || ''; + if (Object.isString(params)) + params = params.toQueryParams(); + params.editorId = this.element.id; + if (this.options.htmlResponse) { + var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); + Object.extend(options, { + parameters: params, + onComplete: this._boundWrapperHandler, + onFailure: this._boundFailureHandler + }); + new Ajax.Updater({ success: this.element }, this.url, options); + } else { + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: params, + onComplete: this._boundWrapperHandler, + onFailure: this._boundFailureHandler + }); + new Ajax.Request(this.url, options); + } + if (e) Event.stop(e); + }, + leaveEditMode: function() { + this.element.removeClassName(this.options.savingClassName); + this.removeForm(); + this.leaveHover(); + this.element.style.backgroundColor = this._originalBackground; + this.element.show(); + if (this.options.externalControl) + this.options.externalControl.show(); + this._saving = false; + this._editing = false; + this._oldInnerHTML = null; + this.triggerCallback('onLeaveEditMode'); + }, + leaveHover: function(e) { + if (this.options.hoverClassName) + this.element.removeClassName(this.options.hoverClassName); + if (this._saving) return; + this.triggerCallback('onLeaveHover'); + }, + loadExternalText: function() { + this._form.addClassName(this.options.loadingClassName); + this._controls.editor.disabled = true; + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + this._form.removeClassName(this.options.loadingClassName); + var text = transport.responseText; + if (this.options.stripLoadedTextTags) + text = text.stripTags(); + this._controls.editor.value = text; + this._controls.editor.disabled = false; + this.postProcessEditField(); + }.bind(this), + onFailure: this._boundFailureHandler + }); + new Ajax.Request(this.options.loadTextURL, options); + }, + postProcessEditField: function() { + var fpc = this.options.fieldPostCreation; + if (fpc) + $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); + }, + prepareOptions: function() { + this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); + Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); + [this._extraDefaultOptions].flatten().compact().each(function(defs) { + Object.extend(this.options, defs); + }.bind(this)); + }, + prepareSubmission: function() { + this._saving = true; + this.removeForm(); + this.leaveHover(); + this.showSaving(); + }, + registerListeners: function() { + this._listeners = { }; + var listener; + $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { + listener = this[pair.value].bind(this); + this._listeners[pair.key] = listener; + if (!this.options.externalControlOnly) + this.element.observe(pair.key, listener); + if (this.options.externalControl) + this.options.externalControl.observe(pair.key, listener); + }.bind(this)); + }, + removeForm: function() { + if (!this._form) return; + this._form.remove(); + this._form = null; + this._controls = { }; + }, + showSaving: function() { + this._oldInnerHTML = this.element.innerHTML; + this.element.innerHTML = this.options.savingText; + this.element.addClassName(this.options.savingClassName); + this.element.style.backgroundColor = this._originalBackground; + this.element.show(); + }, + triggerCallback: function(cbName, arg) { + if ('function' == typeof this.options[cbName]) { + this.options[cbName](this, arg); + } + }, + unregisterListeners: function() { + $H(this._listeners).each(function(pair) { + if (!this.options.externalControlOnly) + this.element.stopObserving(pair.key, pair.value); + if (this.options.externalControl) + this.options.externalControl.stopObserving(pair.key, pair.value); + }.bind(this)); + }, + wrapUp: function(transport) { + this.leaveEditMode(); + // Can't use triggerCallback due to backward compatibility: requires + // binding + direct element + this._boundComplete(transport, this.element); + } +}); + +Object.extend(Ajax.InPlaceEditor.prototype, { + dispose: Ajax.InPlaceEditor.prototype.destroy +}); + +Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { + initialize: function($super, element, url, options) { + this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; + $super(element, url, options); + }, + + createEditField: function() { + var list = document.createElement('select'); + list.name = this.options.paramName; + list.size = 1; + this._controls.editor = list; + this._collection = this.options.collection || []; + if (this.options.loadCollectionURL) + this.loadCollection(); + else + this.checkForExternalText(); + this._form.appendChild(this._controls.editor); + }, + + loadCollection: function() { + this._form.addClassName(this.options.loadingClassName); + this.showLoadingText(this.options.loadingCollectionText); + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + var js = transport.responseText.strip(); + if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check + throw 'Server returned an invalid collection representation.'; + this._collection = eval(js); + this.checkForExternalText(); + }.bind(this), + onFailure: this.onFailure + }); + new Ajax.Request(this.options.loadCollectionURL, options); + }, + + showLoadingText: function(text) { + this._controls.editor.disabled = true; + var tempOption = this._controls.editor.firstChild; + if (!tempOption) { + tempOption = document.createElement('option'); + tempOption.value = ''; + this._controls.editor.appendChild(tempOption); + tempOption.selected = true; + } + tempOption.update((text || '').stripScripts().stripTags()); + }, + + checkForExternalText: function() { + this._text = this.getText(); + if (this.options.loadTextURL) + this.loadExternalText(); + else + this.buildOptionList(); + }, + + loadExternalText: function() { + this.showLoadingText(this.options.loadingText); + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + this._text = transport.responseText.strip(); + this.buildOptionList(); + }.bind(this), + onFailure: this.onFailure + }); + new Ajax.Request(this.options.loadTextURL, options); + }, + + buildOptionList: function() { + this._form.removeClassName(this.options.loadingClassName); + this._collection = this._collection.map(function(entry) { + return 2 === entry.length ? entry : [entry, entry].flatten(); + }); + var marker = ('value' in this.options) ? this.options.value : this._text; + var textFound = this._collection.any(function(entry) { + return entry[0] == marker; + }.bind(this)); + this._controls.editor.update(''); + var option; + this._collection.each(function(entry, index) { + option = document.createElement('option'); + option.value = entry[0]; + option.selected = textFound ? entry[0] == marker : 0 == index; + option.appendChild(document.createTextNode(entry[1])); + this._controls.editor.appendChild(option); + }.bind(this)); + this._controls.editor.disabled = false; + Field.scrollFreeActivate(this._controls.editor); + } +}); + +//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** +//**** This only exists for a while, in order to let **** +//**** users adapt to the new API. Read up on the new **** +//**** API and convert your code to it ASAP! **** + +Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { + if (!options) return; + function fallback(name, expr) { + if (name in options || expr === undefined) return; + options[name] = expr; + }; + fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : + options.cancelLink == options.cancelButton == false ? false : undefined))); + fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : + options.okLink == options.okButton == false ? false : undefined))); + fallback('highlightColor', options.highlightcolor); + fallback('highlightEndColor', options.highlightendcolor); +}; + +Object.extend(Ajax.InPlaceEditor, { + DefaultOptions: { + ajaxOptions: { }, + autoRows: 3, // Use when multi-line w/ rows == 1 + cancelControl: 'link', // 'link'|'button'|false + cancelText: 'cancel', + clickToEditText: 'Click to edit', + externalControl: null, // id|elt + externalControlOnly: false, + fieldPostCreation: 'activate', // 'activate'|'focus'|false + formClassName: 'inplaceeditor-form', + formId: null, // id|elt + highlightColor: '#ffff99', + highlightEndColor: '#ffffff', + hoverClassName: '', + htmlResponse: true, + loadingClassName: 'inplaceeditor-loading', + loadingText: 'Loading...', + okControl: 'button', // 'link'|'button'|false + okText: 'ok', + paramName: 'value', + rows: 1, // If 1 and multi-line, uses autoRows + savingClassName: 'inplaceeditor-saving', + savingText: 'Saving...', + size: 0, + stripLoadedTextTags: false, + submitOnBlur: false, + textAfterControls: '', + textBeforeControls: '', + textBetweenControls: '' + }, + DefaultCallbacks: { + callback: function(form) { + return Form.serialize(form); + }, + onComplete: function(transport, element) { + // For backward compatibility, this one is bound to the IPE, and passes + // the element directly. It was too often customized, so we don't break it. + new Effect.Highlight(element, { + startcolor: this.options.highlightColor, keepBackgroundImage: true }); + }, + onEnterEditMode: null, + onEnterHover: function(ipe) { + ipe.element.style.backgroundColor = ipe.options.highlightColor; + if (ipe._effect) + ipe._effect.cancel(); + }, + onFailure: function(transport, ipe) { + alert('Error communication with the server: ' + transport.responseText.stripTags()); + }, + onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. + onLeaveEditMode: null, + onLeaveHover: function(ipe) { + ipe._effect = new Effect.Highlight(ipe.element, { + startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, + restorecolor: ipe._originalBackground, keepBackgroundImage: true + }); + } + }, + Listeners: { + click: 'enterEditMode', + keydown: 'checkForEscapeOrReturn', + mouseover: 'enterHover', + mouseout: 'leaveHover' + } +}); + +Ajax.InPlaceCollectionEditor.DefaultOptions = { + loadingCollectionText: 'Loading options...' +}; + +// Delayed observer, like Form.Element.Observer, +// but waits for delay after last key input +// Ideal for live-search fields + +Form.Element.DelayedObserver = Class.create({ + initialize: function(element, delay, callback) { + this.delay = delay || 0.5; + this.element = $(element); + this.callback = callback; + this.timer = null; + this.lastValue = $F(this.element); + Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); + }, + delayedListener: function(event) { + if(this.lastValue == $F(this.element)) return; + if(this.timer) clearTimeout(this.timer); + this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); + this.lastValue = $F(this.element); + }, + onTimerEvent: function() { + this.timer = null; + this.callback(this.element, $F(this.element)); + } +}); diff --git a/maarch_entreprise/trunk/js/dragdrop.js b/maarch_entreprise/trunk/js/dragdrop.js new file mode 100644 index 0000000000000000000000000000000000000000..bf429c2616580d857bfa551c7de706534cdf5d70 --- /dev/null +++ b/maarch_entreprise/trunk/js/dragdrop.js @@ -0,0 +1,974 @@ +// script.aculo.us dragdrop.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +if(Object.isUndefined(Effect)) + throw("dragdrop.js requires including script.aculo.us' effects.js library"); + +var Droppables = { + drops: [], + + remove: function(element) { + this.drops = this.drops.reject(function(d) { return d.element==$(element) }); + }, + + add: function(element) { + element = $(element); + var options = Object.extend({ + greedy: true, + hoverclass: null, + tree: false + }, arguments[1] || { }); + + // cache containers + if(options.containment) { + options._containers = []; + var containment = options.containment; + if(Object.isArray(containment)) { + containment.each( function(c) { options._containers.push($(c)) }); + } else { + options._containers.push($(containment)); + } + } + + if(options.accept) options.accept = [options.accept].flatten(); + + Element.makePositioned(element); // fix IE + options.element = element; + + this.drops.push(options); + }, + + findDeepestChild: function(drops) { + deepest = drops[0]; + + for (i = 1; i < drops.length; ++i) + if (Element.isParent(drops[i].element, deepest.element)) + deepest = drops[i]; + + return deepest; + }, + + isContained: function(element, drop) { + var containmentNode; + if(drop.tree) { + containmentNode = element.treeNode; + } else { + containmentNode = element.parentNode; + } + return drop._containers.detect(function(c) { return containmentNode == c }); + }, + + isAffected: function(point, element, drop) { + return ( + (drop.element!=element) && + ((!drop._containers) || + this.isContained(element, drop)) && + ((!drop.accept) || + (Element.classNames(element).detect( + function(v) { return drop.accept.include(v) } ) )) && + Position.within(drop.element, point[0], point[1]) ); + }, + + deactivate: function(drop) { + if(drop.hoverclass) + Element.removeClassName(drop.element, drop.hoverclass); + this.last_active = null; + }, + + activate: function(drop) { + if(drop.hoverclass) + Element.addClassName(drop.element, drop.hoverclass); + this.last_active = drop; + }, + + show: function(point, element) { + if(!this.drops.length) return; + var drop, affected = []; + + this.drops.each( function(drop) { + if(Droppables.isAffected(point, element, drop)) + affected.push(drop); + }); + + if(affected.length>0) + drop = Droppables.findDeepestChild(affected); + + if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); + if (drop) { + Position.within(drop.element, point[0], point[1]); + if(drop.onHover) + drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); + + if (drop != this.last_active) Droppables.activate(drop); + } + }, + + fire: function(event, element) { + if(!this.last_active) return; + Position.prepare(); + + if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) + if (this.last_active.onDrop) { + this.last_active.onDrop(element, this.last_active.element, event); + return true; + } + }, + + reset: function() { + if(this.last_active) + this.deactivate(this.last_active); + } +} + +var Draggables = { + drags: [], + observers: [], + + register: function(draggable) { + if(this.drags.length == 0) { + this.eventMouseUp = this.endDrag.bindAsEventListener(this); + this.eventMouseMove = this.updateDrag.bindAsEventListener(this); + this.eventKeypress = this.keyPress.bindAsEventListener(this); + + Event.observe(document, "mouseup", this.eventMouseUp); + Event.observe(document, "mousemove", this.eventMouseMove); + Event.observe(document, "keypress", this.eventKeypress); + } + this.drags.push(draggable); + }, + + unregister: function(draggable) { + this.drags = this.drags.reject(function(d) { return d==draggable }); + if(this.drags.length == 0) { + Event.stopObserving(document, "mouseup", this.eventMouseUp); + Event.stopObserving(document, "mousemove", this.eventMouseMove); + Event.stopObserving(document, "keypress", this.eventKeypress); + } + }, + + activate: function(draggable) { + if(draggable.options.delay) { + this._timeout = setTimeout(function() { + Draggables._timeout = null; + window.focus(); + Draggables.activeDraggable = draggable; + }.bind(this), draggable.options.delay); + } else { + window.focus(); // allows keypress events if window isn't currently focused, fails for Safari + this.activeDraggable = draggable; + } + }, + + deactivate: function() { + this.activeDraggable = null; + }, + + updateDrag: function(event) { + if(!this.activeDraggable) return; + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + // Mozilla-based browsers fire successive mousemove events with + // the same coordinates, prevent needless redrawing (moz bug?) + if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; + this._lastPointer = pointer; + + this.activeDraggable.updateDrag(event, pointer); + }, + + endDrag: function(event) { + if(this._timeout) { + clearTimeout(this._timeout); + this._timeout = null; + } + if(!this.activeDraggable) return; + this._lastPointer = null; + this.activeDraggable.endDrag(event); + this.activeDraggable = null; + }, + + keyPress: function(event) { + if(this.activeDraggable) + this.activeDraggable.keyPress(event); + }, + + addObserver: function(observer) { + this.observers.push(observer); + this._cacheObserverCallbacks(); + }, + + removeObserver: function(element) { // element instead of observer fixes mem leaks + this.observers = this.observers.reject( function(o) { return o.element==element }); + this._cacheObserverCallbacks(); + }, + + notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' + if(this[eventName+'Count'] > 0) + this.observers.each( function(o) { + if(o[eventName]) o[eventName](eventName, draggable, event); + }); + if(draggable.options[eventName]) draggable.options[eventName](draggable, event); + }, + + _cacheObserverCallbacks: function() { + ['onStart','onEnd','onDrag'].each( function(eventName) { + Draggables[eventName+'Count'] = Draggables.observers.select( + function(o) { return o[eventName]; } + ).length; + }); + } +} + +/*--------------------------------------------------------------------------*/ + +var Draggable = Class.create({ + initialize: function(element) { + var defaults = { + handle: false, + reverteffect: function(element, top_offset, left_offset) { + var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; + new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, + queue: {scope:'_draggable', position:'end'} + }); + }, + endeffect: function(element) { + var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; + new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, + queue: {scope:'_draggable', position:'end'}, + afterFinish: function(){ + Draggable._dragging[element] = false + } + }); + }, + zindex: 1000, + revert: false, + quiet: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } + delay: 0 + }; + + if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) + Object.extend(defaults, { + starteffect: function(element) { + element._opacity = Element.getOpacity(element); + Draggable._dragging[element] = true; + new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); + } + }); + + var options = Object.extend(defaults, arguments[1] || { }); + + this.element = $(element); + + if(options.handle && Object.isString(options.handle)) + this.handle = this.element.down('.'+options.handle, 0); + + if(!this.handle) this.handle = $(options.handle); + if(!this.handle) this.handle = this.element; + + if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { + options.scroll = $(options.scroll); + this._isScrollChild = Element.childOf(this.element, options.scroll); + } + + Element.makePositioned(this.element); // fix IE + + this.options = options; + this.dragging = false; + + this.eventMouseDown = this.initDrag.bindAsEventListener(this); + Event.observe(this.handle, "mousedown", this.eventMouseDown); + + Draggables.register(this); + }, + + destroy: function() { + Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); + Draggables.unregister(this); + }, + + currentDelta: function() { + return([ + parseInt(Element.getStyle(this.element,'left') || '0'), + parseInt(Element.getStyle(this.element,'top') || '0')]); + }, + + initDrag: function(event) { + if(!Object.isUndefined(Draggable._dragging[this.element]) && + Draggable._dragging[this.element]) return; + if(Event.isLeftClick(event)) { + // abort on form elements, fixes a Firefox issue + var src = Event.element(event); + if((tag_name = src.tagName.toUpperCase()) && ( + tag_name=='INPUT' || + tag_name=='SELECT' || + tag_name=='OPTION' || + tag_name=='BUTTON' || + tag_name=='TEXTAREA')) return; + + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var pos = Position.cumulativeOffset(this.element); + this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); + + Draggables.activate(this); + Event.stop(event); + } + }, + + startDrag: function(event) { + this.dragging = true; + if(!this.delta) + this.delta = this.currentDelta(); + + if(this.options.zindex) { + this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); + this.element.style.zIndex = this.options.zindex; + } + + if(this.options.ghosting) { + this._clone = this.element.cloneNode(true); + this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); + if (!this.element._originallyAbsolute) + Position.absolutize(this.element); + this.element.parentNode.insertBefore(this._clone, this.element); + } + + if(this.options.scroll) { + if (this.options.scroll == window) { + var where = this._getWindowScroll(this.options.scroll); + this.originalScrollLeft = where.left; + this.originalScrollTop = where.top; + } else { + this.originalScrollLeft = this.options.scroll.scrollLeft; + this.originalScrollTop = this.options.scroll.scrollTop; + } + } + + Draggables.notify('onStart', this, event); + + if(this.options.starteffect) this.options.starteffect(this.element); + }, + + updateDrag: function(event, pointer) { + if(!this.dragging) this.startDrag(event); + + if(!this.options.quiet){ + Position.prepare(); + Droppables.show(pointer, this.element); + } + + Draggables.notify('onDrag', this, event); + + this.draw(pointer); + if(this.options.change) this.options.change(this); + + if(this.options.scroll) { + this.stopScrolling(); + + var p; + if (this.options.scroll == window) { + with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } + } else { + p = Position.page(this.options.scroll); + p[0] += this.options.scroll.scrollLeft + Position.deltaX; + p[1] += this.options.scroll.scrollTop + Position.deltaY; + p.push(p[0]+this.options.scroll.offsetWidth); + p.push(p[1]+this.options.scroll.offsetHeight); + } + var speed = [0,0]; + if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); + if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); + if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); + if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); + this.startScrolling(speed); + } + + // fix AppleWebKit rendering + if(Prototype.Browser.WebKit) window.scrollBy(0,0); + + Event.stop(event); + }, + + finishDrag: function(event, success) { + this.dragging = false; + + if(this.options.quiet){ + Position.prepare(); + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + Droppables.show(pointer, this.element); + } + + if(this.options.ghosting) { + if (!this.element._originallyAbsolute) + Position.relativize(this.element); + delete this.element._originallyAbsolute; + Element.remove(this._clone); + this._clone = null; + } + + var dropped = false; + if(success) { + dropped = Droppables.fire(event, this.element); + if (!dropped) dropped = false; + } + if(dropped && this.options.onDropped) this.options.onDropped(this.element); + Draggables.notify('onEnd', this, event); + + var revert = this.options.revert; + if(revert && Object.isFunction(revert)) revert = revert(this.element); + + var d = this.currentDelta(); + if(revert && this.options.reverteffect) { + if (dropped == 0 || revert != 'failure') + this.options.reverteffect(this.element, + d[1]-this.delta[1], d[0]-this.delta[0]); + } else { + this.delta = d; + } + + if(this.options.zindex) + this.element.style.zIndex = this.originalZ; + + if(this.options.endeffect) + this.options.endeffect(this.element); + + Draggables.deactivate(this); + Droppables.reset(); + }, + + keyPress: function(event) { + if(event.keyCode!=Event.KEY_ESC) return; + this.finishDrag(event, false); + Event.stop(event); + }, + + endDrag: function(event) { + if(!this.dragging) return; + this.stopScrolling(); + this.finishDrag(event, true); + Event.stop(event); + }, + + draw: function(point) { + var pos = Position.cumulativeOffset(this.element); + if(this.options.ghosting) { + var r = Position.realOffset(this.element); + pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; + } + + var d = this.currentDelta(); + pos[0] -= d[0]; pos[1] -= d[1]; + + if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { + pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; + pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; + } + + var p = [0,1].map(function(i){ + return (point[i]-pos[i]-this.offset[i]) + }.bind(this)); + + if(this.options.snap) { + if(Object.isFunction(this.options.snap)) { + p = this.options.snap(p[0],p[1],this); + } else { + if(Object.isArray(this.options.snap)) { + p = p.map( function(v, i) { + return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)) + } else { + p = p.map( function(v) { + return (v/this.options.snap).round()*this.options.snap }.bind(this)) + } + }} + + var style = this.element.style; + if((!this.options.constraint) || (this.options.constraint=='horizontal')) + style.left = p[0] + "px"; + if((!this.options.constraint) || (this.options.constraint=='vertical')) + style.top = p[1] + "px"; + + if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering + }, + + stopScrolling: function() { + if(this.scrollInterval) { + clearInterval(this.scrollInterval); + this.scrollInterval = null; + Draggables._lastScrollPointer = null; + } + }, + + startScrolling: function(speed) { + if(!(speed[0] || speed[1])) return; + this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; + this.lastScrolled = new Date(); + this.scrollInterval = setInterval(this.scroll.bind(this), 10); + }, + + scroll: function() { + var current = new Date(); + var delta = current - this.lastScrolled; + this.lastScrolled = current; + if(this.options.scroll == window) { + with (this._getWindowScroll(this.options.scroll)) { + if (this.scrollSpeed[0] || this.scrollSpeed[1]) { + var d = delta / 1000; + this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); + } + } + } else { + this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; + this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; + } + + Position.prepare(); + Droppables.show(Draggables._lastPointer, this.element); + Draggables.notify('onDrag', this); + if (this._isScrollChild) { + Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); + Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; + Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; + if (Draggables._lastScrollPointer[0] < 0) + Draggables._lastScrollPointer[0] = 0; + if (Draggables._lastScrollPointer[1] < 0) + Draggables._lastScrollPointer[1] = 0; + this.draw(Draggables._lastScrollPointer); + } + + if(this.options.change) this.options.change(this); + }, + + _getWindowScroll: function(w) { + var T, L, W, H; + with (w.document) { + if (w.document.documentElement && documentElement.scrollTop) { + T = documentElement.scrollTop; + L = documentElement.scrollLeft; + } else if (w.document.body) { + T = body.scrollTop; + L = body.scrollLeft; + } + if (w.innerWidth) { + W = w.innerWidth; + H = w.innerHeight; + } else if (w.document.documentElement && documentElement.clientWidth) { + W = documentElement.clientWidth; + H = documentElement.clientHeight; + } else { + W = body.offsetWidth; + H = body.offsetHeight + } + } + return { top: T, left: L, width: W, height: H }; + } +}); + +Draggable._dragging = { }; + +/*--------------------------------------------------------------------------*/ + +var SortableObserver = Class.create({ + initialize: function(element, observer) { + this.element = $(element); + this.observer = observer; + this.lastValue = Sortable.serialize(this.element); + }, + + onStart: function() { + this.lastValue = Sortable.serialize(this.element); + }, + + onEnd: function() { + Sortable.unmark(); + if(this.lastValue != Sortable.serialize(this.element)) + this.observer(this.element) + } +}); + +var Sortable = { + SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, + + sortables: { }, + + _findRootElement: function(element) { + while (element.tagName.toUpperCase() != "BODY") { + if(element.id && Sortable.sortables[element.id]) return element; + element = element.parentNode; + } + }, + + options: function(element) { + element = Sortable._findRootElement($(element)); + if(!element) return; + return Sortable.sortables[element.id]; + }, + + destroy: function(element){ + var s = Sortable.options(element); + + if(s) { + Draggables.removeObserver(s.element); + s.droppables.each(function(d){ Droppables.remove(d) }); + s.draggables.invoke('destroy'); + + delete Sortable.sortables[s.element.id]; + } + }, + + create: function(element) { + element = $(element); + var options = Object.extend({ + element: element, + tag: 'li', // assumes li children, override with tag: 'tagname' + dropOnEmpty: false, + tree: false, + treeTag: 'ul', + overlap: 'vertical', // one of 'vertical', 'horizontal' + constraint: 'vertical', // one of 'vertical', 'horizontal', false + containment: element, // also takes array of elements (or id's); or false + handle: false, // or a CSS class + only: false, + delay: 0, + hoverclass: null, + ghosting: false, + quiet: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + format: this.SERIALIZE_RULE, + + // these take arrays of elements or ids and can be + // used for better initialization performance + elements: false, + handles: false, + + onChange: Prototype.emptyFunction, + onUpdate: Prototype.emptyFunction + }, arguments[1] || { }); + + // clear any old sortable with same element + this.destroy(element); + + // build options for the draggables + var options_for_draggable = { + revert: true, + quiet: options.quiet, + scroll: options.scroll, + scrollSpeed: options.scrollSpeed, + scrollSensitivity: options.scrollSensitivity, + delay: options.delay, + ghosting: options.ghosting, + constraint: options.constraint, + handle: options.handle }; + + if(options.starteffect) + options_for_draggable.starteffect = options.starteffect; + + if(options.reverteffect) + options_for_draggable.reverteffect = options.reverteffect; + else + if(options.ghosting) options_for_draggable.reverteffect = function(element) { + element.style.top = 0; + element.style.left = 0; + }; + + if(options.endeffect) + options_for_draggable.endeffect = options.endeffect; + + if(options.zindex) + options_for_draggable.zindex = options.zindex; + + // build options for the droppables + var options_for_droppable = { + overlap: options.overlap, + containment: options.containment, + tree: options.tree, + hoverclass: options.hoverclass, + onHover: Sortable.onHover + } + + var options_for_tree = { + onHover: Sortable.onEmptyHover, + overlap: options.overlap, + containment: options.containment, + hoverclass: options.hoverclass + } + + // fix for gecko engine + Element.cleanWhitespace(element); + + options.draggables = []; + options.droppables = []; + + // drop on empty handling + if(options.dropOnEmpty || options.tree) { + Droppables.add(element, options_for_tree); + options.droppables.push(element); + } + + (options.elements || this.findElements(element, options) || []).each( function(e,i) { + var handle = options.handles ? $(options.handles[i]) : + (options.handle ? $(e).select('.' + options.handle)[0] : e); + options.draggables.push( + new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); + Droppables.add(e, options_for_droppable); + if(options.tree) e.treeNode = element; + options.droppables.push(e); + }); + + if(options.tree) { + (Sortable.findTreeElements(element, options) || []).each( function(e) { + Droppables.add(e, options_for_tree); + e.treeNode = element; + options.droppables.push(e); + }); + } + + // keep reference + this.sortables[element.id] = options; + + // for onupdate + Draggables.addObserver(new SortableObserver(element, options.onUpdate)); + + }, + + // return all suitable-for-sortable elements in a guaranteed order + findElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.tag); + }, + + findTreeElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.treeTag); + }, + + onHover: function(element, dropon, overlap) { + if(Element.isParent(dropon, element)) return; + + if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { + return; + } else if(overlap>0.5) { + Sortable.mark(dropon, 'before'); + if(dropon.previousSibling != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, dropon); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } else { + Sortable.mark(dropon, 'after'); + var nextElement = dropon.nextSibling || null; + if(nextElement != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, nextElement); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } + }, + + onEmptyHover: function(element, dropon, overlap) { + var oldParentNode = element.parentNode; + var droponOptions = Sortable.options(dropon); + + if(!Element.isParent(dropon, element)) { + var index; + + var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); + var child = null; + + if(children) { + var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); + + for (index = 0; index < children.length; index += 1) { + if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { + offset -= Element.offsetSize (children[index], droponOptions.overlap); + } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { + child = index + 1 < children.length ? children[index + 1] : null; + break; + } else { + child = children[index]; + break; + } + } + } + + dropon.insertBefore(element, child); + + Sortable.options(oldParentNode).onChange(element); + droponOptions.onChange(element); + } + }, + + unmark: function() { + if(Sortable._marker) Sortable._marker.hide(); + }, + + mark: function(dropon, position) { + // mark on ghosting only + var sortable = Sortable.options(dropon.parentNode); + if(sortable && !sortable.ghosting) return; + + if(!Sortable._marker) { + Sortable._marker = + ($('dropmarker') || Element.extend(document.createElement('DIV'))). + hide().addClassName('dropmarker').setStyle({position:'absolute'}); + document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); + } + var offsets = Position.cumulativeOffset(dropon); + Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); + + if(position=='after') + if(sortable.overlap == 'horizontal') + Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); + else + Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); + + Sortable._marker.show(); + }, + + _tree: function(element, options, parent) { + var children = Sortable.findElements(element, options) || []; + + for (var i = 0; i < children.length; ++i) { + var match = children[i].id.match(options.format); + + if (!match) continue; + + var child = { + id: encodeURIComponent(match ? match[1] : null), + element: element, + parent: parent, + children: [], + position: parent.children.length, + container: $(children[i]).down(options.treeTag) + } + + /* Get the element containing the children and recurse over it */ + if (child.container) + this._tree(child.container, options, child) + + parent.children.push (child); + } + + return parent; + }, + + tree: function(element) { + element = $(element); + var sortableOptions = this.options(element); + var options = Object.extend({ + tag: sortableOptions.tag, + treeTag: sortableOptions.treeTag, + only: sortableOptions.only, + name: element.id, + format: sortableOptions.format + }, arguments[1] || { }); + + var root = { + id: null, + parent: null, + children: [], + container: element, + position: 0 + } + + return Sortable._tree(element, options, root); + }, + + /* Construct a [i] index for a particular node */ + _constructIndex: function(node) { + var index = ''; + do { + if (node.id) index = '[' + node.position + ']' + index; + } while ((node = node.parent) != null); + return index; + }, + + sequence: function(element) { + element = $(element); + var options = Object.extend(this.options(element), arguments[1] || { }); + + return $(this.findElements(element, options) || []).map( function(item) { + return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; + }); + }, + + setSequence: function(element, new_sequence) { + element = $(element); + var options = Object.extend(this.options(element), arguments[2] || { }); + + var nodeMap = { }; + this.findElements(element, options).each( function(n) { + if (n.id.match(options.format)) + nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; + n.parentNode.removeChild(n); + }); + + new_sequence.each(function(ident) { + var n = nodeMap[ident]; + if (n) { + n[1].appendChild(n[0]); + delete nodeMap[ident]; + } + }); + }, + + serialize: function(element) { + element = $(element); + var options = Object.extend(Sortable.options(element), arguments[1] || { }); + var name = encodeURIComponent( + (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); + + if (options.tree) { + return Sortable.tree(element, arguments[1]).children.map( function (item) { + return [name + Sortable._constructIndex(item) + "[id]=" + + encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); + }).flatten().join('&'); + } else { + return Sortable.sequence(element, arguments[1]).map( function(item) { + return name + "[]=" + encodeURIComponent(item); + }).join('&'); + } + } +} + +// Returns true if child is contained within element +Element.isParent = function(child, element) { + if (!child.parentNode || child == element) return false; + if (child.parentNode == element) return true; + return Element.isParent(child.parentNode, element); +} + +Element.findChildren = function(element, only, recursive, tagName) { + if(!element.hasChildNodes()) return null; + tagName = tagName.toUpperCase(); + if(only) only = [only].flatten(); + var elements = []; + $A(element.childNodes).each( function(e) { + if(e.tagName && e.tagName.toUpperCase()==tagName && + (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) + elements.push(e); + if(recursive) { + var grandchildren = Element.findChildren(e, only, recursive, tagName); + if(grandchildren) elements.push(grandchildren); + } + }); + + return (elements.length>0 ? elements.flatten() : []); +} + +Element.offsetSize = function (element, type) { + return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; +} diff --git a/maarch_entreprise/trunk/js/effects.js b/maarch_entreprise/trunk/js/effects.js new file mode 100644 index 0000000000000000000000000000000000000000..265915108b68e32d67cb10d414383b641de6c0a3 --- /dev/null +++ b/maarch_entreprise/trunk/js/effects.js @@ -0,0 +1,1122 @@ +// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// Contributors: +// Justin Palmer (http://encytemedia.com/) +// Mark Pilgrim (http://diveintomark.org/) +// Martin Bialasinki +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// converts rgb() and #xxx to #xxxxxx format, +// returns self (or first argument) if not convertable +String.prototype.parseColor = function() { + var color = '#'; + if (this.slice(0,4) == 'rgb(') { + var cols = this.slice(4,this.length-1).split(','); + var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); + } else { + if (this.slice(0,1) == '#') { + if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); + if (this.length==7) color = this.toLowerCase(); + } + } + return (color.length==7 ? color : (arguments[0] || this)); +}; + +/*--------------------------------------------------------------------------*/ + +Element.collectTextNodes = function(element) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); + }).flatten().join(''); +}; + +Element.collectTextNodesIgnoreClass = function(element, className) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? + Element.collectTextNodesIgnoreClass(node, className) : '')); + }).flatten().join(''); +}; + +Element.setContentZoom = function(element, percent) { + element = $(element); + element.setStyle({fontSize: (percent/100) + 'em'}); + if (Prototype.Browser.WebKit) window.scrollBy(0,0); + return element; +}; + +Element.getInlineOpacity = function(element){ + return $(element).style.opacity || ''; +}; + +Element.forceRerendering = function(element) { + try { + element = $(element); + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch(e) { } +}; + +/*--------------------------------------------------------------------------*/ + +var Effect = { + _elementDoesNotExistError: { + name: 'ElementDoesNotExistError', + message: 'The specified DOM element does not exist, but is required for this effect to operate' + }, + Transitions: { + linear: Prototype.K, + sinoidal: function(pos) { + return (-Math.cos(pos*Math.PI)/2) + 0.5; + }, + reverse: function(pos) { + return 1-pos; + }, + flicker: function(pos) { + var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; + return pos > 1 ? 1 : pos; + }, + wobble: function(pos) { + return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; + }, + pulse: function(pos, pulses) { + pulses = pulses || 5; + return ( + ((pos % (1/pulses)) * pulses).round() == 0 ? + ((pos * pulses * 2) - (pos * pulses * 2).floor()) : + 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor()) + ); + }, + spring: function(pos) { + return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); + }, + none: function(pos) { + return 0; + }, + full: function(pos) { + return 1; + } + }, + DefaultOptions: { + duration: 0.3, // seconds + fps: 100, // 100= assume 66fps max. + sync: false, // true for combining + from: 0.0, + to: 1.0, + delay: 0.0, + queue: 'parallel' + }, + tagifyText: function(element) { + var tagifyStyle = 'position:relative'; + if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; + + element = $(element); + $A(element.childNodes).each( function(child) { + if (child.nodeType==3) { + child.nodeValue.toArray().each( function(character) { + element.insertBefore( + new Element('span', {style: tagifyStyle}).update( + character == ' ' ? String.fromCharCode(160) : character), + child); + }); + Element.remove(child); + } + }); + }, + multiple: function(element, effect) { + var elements; + if (((typeof element == 'object') || + Object.isFunction(element)) && + (element.length)) + elements = element; + else + elements = $(element).childNodes; + + var options = Object.extend({ + speed: 0.1, + delay: 0.0 + }, arguments[2] || { }); + var masterDelay = options.delay; + + $A(elements).each( function(element, index) { + new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); + }); + }, + PAIRS: { + 'slide': ['SlideDown','SlideUp'], + 'blind': ['BlindDown','BlindUp'], + 'appear': ['Appear','Fade'] + }, + toggle: function(element, effect) { + element = $(element); + effect = (effect || 'appear').toLowerCase(); + var options = Object.extend({ + queue: { position:'end', scope:(element.id || 'global'), limit: 1 } + }, arguments[2] || { }); + Effect[element.visible() ? + Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); + } +}; + +Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; + +/* ------------- core effects ------------- */ + +Effect.ScopedQueue = Class.create(Enumerable, { + initialize: function() { + this.effects = []; + this.interval = null; + }, + _each: function(iterator) { + this.effects._each(iterator); + }, + add: function(effect) { + var timestamp = new Date().getTime(); + + var position = Object.isString(effect.options.queue) ? + effect.options.queue : effect.options.queue.position; + + switch(position) { + case 'front': + // move unstarted effects after this effect + this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { + e.startOn += effect.finishOn; + e.finishOn += effect.finishOn; + }); + break; + case 'with-last': + timestamp = this.effects.pluck('startOn').max() || timestamp; + break; + case 'end': + // start effect after last queued effect has finished + timestamp = this.effects.pluck('finishOn').max() || timestamp; + break; + } + + effect.startOn += timestamp; + effect.finishOn += timestamp; + + if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) + this.effects.push(effect); + + if (!this.interval) + this.interval = setInterval(this.loop.bind(this), 15); + }, + remove: function(effect) { + this.effects = this.effects.reject(function(e) { return e==effect }); + if (this.effects.length == 0) { + clearInterval(this.interval); + this.interval = null; + } + }, + loop: function() { + var timePos = new Date().getTime(); + for(var i=0, len=this.effects.length;i<len;i++) + this.effects[i] && this.effects[i].loop(timePos); + } +}); + +Effect.Queues = { + instances: $H(), + get: function(queueName) { + if (!Object.isString(queueName)) return queueName; + + return this.instances.get(queueName) || + this.instances.set(queueName, new Effect.ScopedQueue()); + } +}; +Effect.Queue = Effect.Queues.get('global'); + +Effect.Base = Class.create({ + position: null, + start: function(options) { + function codeForEvent(options,eventName){ + return ( + (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') + + (options[eventName] ? 'this.options.'+eventName+'(this);' : '') + ); + } + if (options && options.transition === false) options.transition = Effect.Transitions.linear; + this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { }); + this.currentFrame = 0; + this.state = 'idle'; + this.startOn = this.options.delay*1000; + this.finishOn = this.startOn+(this.options.duration*1000); + this.fromToDelta = this.options.to-this.options.from; + this.totalTime = this.finishOn-this.startOn; + this.totalFrames = this.options.fps*this.options.duration; + + eval('this.render = function(pos){ '+ + 'if (this.state=="idle"){this.state="running";'+ + codeForEvent(this.options,'beforeSetup')+ + (this.setup ? 'this.setup();':'')+ + codeForEvent(this.options,'afterSetup')+ + '};if (this.state=="running"){'+ + 'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+ + 'this.position=pos;'+ + codeForEvent(this.options,'beforeUpdate')+ + (this.update ? 'this.update(pos);':'')+ + codeForEvent(this.options,'afterUpdate')+ + '}}'); + + this.event('beforeStart'); + if (!this.options.sync) + Effect.Queues.get(Object.isString(this.options.queue) ? + 'global' : this.options.queue.scope).add(this); + }, + loop: function(timePos) { + if (timePos >= this.startOn) { + if (timePos >= this.finishOn) { + this.render(1.0); + this.cancel(); + this.event('beforeFinish'); + if (this.finish) this.finish(); + this.event('afterFinish'); + return; + } + var pos = (timePos - this.startOn) / this.totalTime, + frame = (pos * this.totalFrames).round(); + if (frame > this.currentFrame) { + this.render(pos); + this.currentFrame = frame; + } + } + }, + cancel: function() { + if (!this.options.sync) + Effect.Queues.get(Object.isString(this.options.queue) ? + 'global' : this.options.queue.scope).remove(this); + this.state = 'finished'; + }, + event: function(eventName) { + if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); + if (this.options[eventName]) this.options[eventName](this); + }, + inspect: function() { + var data = $H(); + for(property in this) + if (!Object.isFunction(this[property])) data.set(property, this[property]); + return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>'; + } +}); + +Effect.Parallel = Class.create(Effect.Base, { + initialize: function(effects) { + this.effects = effects || []; + this.start(arguments[1]); + }, + update: function(position) { + this.effects.invoke('render', position); + }, + finish: function(position) { + this.effects.each( function(effect) { + effect.render(1.0); + effect.cancel(); + effect.event('beforeFinish'); + if (effect.finish) effect.finish(position); + effect.event('afterFinish'); + }); + } +}); + +Effect.Tween = Class.create(Effect.Base, { + initialize: function(object, from, to) { + object = Object.isString(object) ? $(object) : object; + var args = $A(arguments), method = args.last(), + options = args.length == 5 ? args[3] : null; + this.method = Object.isFunction(method) ? method.bind(object) : + Object.isFunction(object[method]) ? object[method].bind(object) : + function(value) { object[method] = value }; + this.start(Object.extend({ from: from, to: to }, options || { })); + }, + update: function(position) { + this.method(position); + } +}); + +Effect.Event = Class.create(Effect.Base, { + initialize: function() { + this.start(Object.extend({ duration: 0 }, arguments[0] || { })); + }, + update: Prototype.emptyFunction +}); + +Effect.Opacity = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + // make this work on IE on elements without 'layout' + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + var options = Object.extend({ + from: this.element.getOpacity() || 0.0, + to: 1.0 + }, arguments[1] || { }); + this.start(options); + }, + update: function(position) { + this.element.setOpacity(position); + } +}); + +Effect.Move = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + x: 0, + y: 0, + mode: 'relative' + }, arguments[1] || { }); + this.start(options); + }, + setup: function() { + this.element.makePositioned(); + this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); + this.originalTop = parseFloat(this.element.getStyle('top') || '0'); + if (this.options.mode == 'absolute') { + this.options.x = this.options.x - this.originalLeft; + this.options.y = this.options.y - this.originalTop; + } + }, + update: function(position) { + this.element.setStyle({ + left: (this.options.x * position + this.originalLeft).round() + 'px', + top: (this.options.y * position + this.originalTop).round() + 'px' + }); + } +}); + +// for backwards compatibility +Effect.MoveBy = function(element, toTop, toLeft) { + return new Effect.Move(element, + Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); +}; + +Effect.Scale = Class.create(Effect.Base, { + initialize: function(element, percent) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + scaleX: true, + scaleY: true, + scaleContent: true, + scaleFromCenter: false, + scaleMode: 'box', // 'box' or 'contents' or { } with provided values + scaleFrom: 100.0, + scaleTo: percent + }, arguments[2] || { }); + this.start(options); + }, + setup: function() { + this.restoreAfterFinish = this.options.restoreAfterFinish || false; + this.elementPositioning = this.element.getStyle('position'); + + this.originalStyle = { }; + ['top','left','width','height','fontSize'].each( function(k) { + this.originalStyle[k] = this.element.style[k]; + }.bind(this)); + + this.originalTop = this.element.offsetTop; + this.originalLeft = this.element.offsetLeft; + + var fontSize = this.element.getStyle('font-size') || '100%'; + ['em','px','%','pt'].each( function(fontSizeType) { + if (fontSize.indexOf(fontSizeType)>0) { + this.fontSize = parseFloat(fontSize); + this.fontSizeType = fontSizeType; + } + }.bind(this)); + + this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; + + this.dims = null; + if (this.options.scaleMode=='box') + this.dims = [this.element.offsetHeight, this.element.offsetWidth]; + if (/^content/.test(this.options.scaleMode)) + this.dims = [this.element.scrollHeight, this.element.scrollWidth]; + if (!this.dims) + this.dims = [this.options.scaleMode.originalHeight, + this.options.scaleMode.originalWidth]; + }, + update: function(position) { + var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); + if (this.options.scaleContent && this.fontSize) + this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); + this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); + }, + finish: function(position) { + if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); + }, + setDimensions: function(height, width) { + var d = { }; + if (this.options.scaleX) d.width = width.round() + 'px'; + if (this.options.scaleY) d.height = height.round() + 'px'; + if (this.options.scaleFromCenter) { + var topd = (height - this.dims[0])/2; + var leftd = (width - this.dims[1])/2; + if (this.elementPositioning == 'absolute') { + if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; + if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; + } else { + if (this.options.scaleY) d.top = -topd + 'px'; + if (this.options.scaleX) d.left = -leftd + 'px'; + } + } + this.element.setStyle(d); + } +}); + +Effect.Highlight = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); + this.start(options); + }, + setup: function() { + // Prevent executing on elements not in the layout flow + if (this.element.getStyle('display')=='none') { this.cancel(); return; } + // Disable background image during the effect + this.oldStyle = { }; + if (!this.options.keepBackgroundImage) { + this.oldStyle.backgroundImage = this.element.getStyle('background-image'); + this.element.setStyle({backgroundImage: 'none'}); + } + if (!this.options.endcolor) + this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); + if (!this.options.restorecolor) + this.options.restorecolor = this.element.getStyle('background-color'); + // init color calculations + this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); + this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); + }, + update: function(position) { + this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ + return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); + }, + finish: function() { + this.element.setStyle(Object.extend(this.oldStyle, { + backgroundColor: this.options.restorecolor + })); + } +}); + +Effect.ScrollTo = function(element) { + var options = arguments[1] || { }, + scrollOffsets = document.viewport.getScrollOffsets(), + elementOffsets = $(element).cumulativeOffset(), + max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); + + if (options.offset) elementOffsets[1] += options.offset; + + return new Effect.Tween(null, + scrollOffsets.top, + elementOffsets[1] > max ? max : elementOffsets[1], + options, + function(p){ scrollTo(scrollOffsets.left, p.round()) } + ); +}; + +/* ------------- combination effects ------------- */ + +Effect.Fade = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + var options = Object.extend({ + from: element.getOpacity() || 1.0, + to: 0.0, + afterFinishInternal: function(effect) { + if (effect.options.to!=0) return; + effect.element.hide().setStyle({opacity: oldOpacity}); + } + }, arguments[1] || { }); + return new Effect.Opacity(element,options); +}; + +Effect.Appear = function(element) { + element = $(element); + var options = Object.extend({ + from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), + to: 1.0, + // force Safari to render floated elements properly + afterFinishInternal: function(effect) { + effect.element.forceRerendering(); + }, + beforeSetup: function(effect) { + effect.element.setOpacity(effect.options.from).show(); + }}, arguments[1] || { }); + return new Effect.Opacity(element,options); +}; + +Effect.Puff = function(element) { + element = $(element); + var oldStyle = { + opacity: element.getInlineOpacity(), + position: element.getStyle('position'), + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height + }; + return new Effect.Parallel( + [ new Effect.Scale(element, 200, + { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], + Object.extend({ duration: 1.0, + beforeSetupInternal: function(effect) { + Position.absolutize(effect.effects[0].element) + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().setStyle(oldStyle); } + }, arguments[1] || { }) + ); +}; + +Effect.BlindUp = function(element) { + element = $(element); + element.makeClipping(); + return new Effect.Scale(element, 0, + Object.extend({ scaleContent: false, + scaleX: false, + restoreAfterFinish: true, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }, arguments[1] || { }) + ); +}; + +Effect.BlindDown = function(element) { + element = $(element); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: 0, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping(); + } + }, arguments[1] || { })); +}; + +Effect.SwitchOff = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + return new Effect.Appear(element, Object.extend({ + duration: 0.4, + from: 0, + transition: Effect.Transitions.flicker, + afterFinishInternal: function(effect) { + new Effect.Scale(effect.element, 1, { + duration: 0.3, scaleFromCenter: true, + scaleX: false, scaleContent: false, restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); + } + }) + } + }, arguments[1] || { })); +}; + +Effect.DropOut = function(element) { + element = $(element); + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left'), + opacity: element.getInlineOpacity() }; + return new Effect.Parallel( + [ new Effect.Move(element, {x: 0, y: 100, sync: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 }) ], + Object.extend( + { duration: 0.5, + beforeSetup: function(effect) { + effect.effects[0].element.makePositioned(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); + } + }, arguments[1] || { })); +}; + +Effect.Shake = function(element) { + element = $(element); + var options = Object.extend({ + distance: 20, + duration: 0.5 + }, arguments[1] || {}); + var distance = parseFloat(options.distance); + var split = parseFloat(options.duration) / 10.0; + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left') }; + return new Effect.Move(element, + { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { + effect.element.undoPositioned().setStyle(oldStyle); + }}) }}) }}) }}) }}) }}); +}; + +Effect.SlideDown = function(element) { + element = $(element).cleanWhitespace(); + // SlideDown need to have the content of the element wrapped in a container element with fixed height! + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: window.opera ? 0 : 1, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if (window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } + }, arguments[1] || { }) + ); +}; + +Effect.SlideUp = function(element) { + element = $(element).cleanWhitespace(); + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, window.opera ? 0 : 1, + Object.extend({ scaleContent: false, + scaleX: false, + scaleMode: 'box', + scaleFrom: 100, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if (window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); + } + }, arguments[1] || { }) + ); +}; + +// Bug in opera makes the TD containing this element expand for a instance after finish +Effect.Squish = function(element) { + return new Effect.Scale(element, window.opera ? 1 : 0, { + restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }); +}; + +Effect.Grow = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.full + }, arguments[1] || { }); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var initialMoveX, initialMoveY; + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + initialMoveX = initialMoveY = moveX = moveY = 0; + break; + case 'top-right': + initialMoveX = dims.width; + initialMoveY = moveY = 0; + moveX = -dims.width; + break; + case 'bottom-left': + initialMoveX = moveX = 0; + initialMoveY = dims.height; + moveY = -dims.height; + break; + case 'bottom-right': + initialMoveX = dims.width; + initialMoveY = dims.height; + moveX = -dims.width; + moveY = -dims.height; + break; + case 'center': + initialMoveX = dims.width / 2; + initialMoveY = dims.height / 2; + moveX = -dims.width / 2; + moveY = -dims.height / 2; + break; + } + + return new Effect.Move(element, { + x: initialMoveX, + y: initialMoveY, + duration: 0.01, + beforeSetup: function(effect) { + effect.element.hide().makeClipping().makePositioned(); + }, + afterFinishInternal: function(effect) { + new Effect.Parallel( + [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), + new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), + new Effect.Scale(effect.element, 100, { + scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, + sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) + ], Object.extend({ + beforeSetup: function(effect) { + effect.effects[0].element.setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); + } + }, options) + ) + } + }); +}; + +Effect.Shrink = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.none + }, arguments[1] || { }); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + moveX = moveY = 0; + break; + case 'top-right': + moveX = dims.width; + moveY = 0; + break; + case 'bottom-left': + moveX = 0; + moveY = dims.height; + break; + case 'bottom-right': + moveX = dims.width; + moveY = dims.height; + break; + case 'center': + moveX = dims.width / 2; + moveY = dims.height / 2; + break; + } + + return new Effect.Parallel( + [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), + new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), + new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) + ], Object.extend({ + beforeStartInternal: function(effect) { + effect.effects[0].element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } + }, options) + ); +}; + +Effect.Pulsate = function(element) { + element = $(element); + var options = arguments[1] || { }; + var oldOpacity = element.getInlineOpacity(); + var transition = options.transition || Effect.Transitions.sinoidal; + var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) }; + reverser.bind(transition); + return new Effect.Opacity(element, + Object.extend(Object.extend({ duration: 2.0, from: 0, + afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } + }, options), {transition: reverser})); +}; + +Effect.Fold = function(element) { + element = $(element); + var oldStyle = { + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height }; + element.makeClipping(); + return new Effect.Scale(element, 5, Object.extend({ + scaleContent: false, + scaleX: false, + afterFinishInternal: function(effect) { + new Effect.Scale(element, 1, { + scaleContent: false, + scaleY: false, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().setStyle(oldStyle); + } }); + }}, arguments[1] || { })); +}; + +Effect.Morph = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + style: { } + }, arguments[1] || { }); + + if (!Object.isString(options.style)) this.style = $H(options.style); + else { + if (options.style.include(':')) + this.style = options.style.parseStyle(); + else { + this.element.addClassName(options.style); + this.style = $H(this.element.getStyles()); + this.element.removeClassName(options.style); + var css = this.element.getStyles(); + this.style = this.style.reject(function(style) { + return style.value == css[style.key]; + }); + options.afterFinishInternal = function(effect) { + effect.element.addClassName(effect.options.style); + effect.transforms.each(function(transform) { + effect.element.style[transform.style] = ''; + }); + } + } + } + this.start(options); + }, + + setup: function(){ + function parseColor(color){ + if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; + color = color.parseColor(); + return $R(0,2).map(function(i){ + return parseInt( color.slice(i*2+1,i*2+3), 16 ) + }); + } + this.transforms = this.style.map(function(pair){ + var property = pair[0], value = pair[1], unit = null; + + if (value.parseColor('#zzzzzz') != '#zzzzzz') { + value = value.parseColor(); + unit = 'color'; + } else if (property == 'opacity') { + value = parseFloat(value); + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + } else if (Element.CSS_LENGTH.test(value)) { + var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); + value = parseFloat(components[1]); + unit = (components.length == 3) ? components[2] : null; + } + + var originalValue = this.element.getStyle(property); + return { + style: property.camelize(), + originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), + targetValue: unit=='color' ? parseColor(value) : value, + unit: unit + }; + }.bind(this)).reject(function(transform){ + return ( + (transform.originalValue == transform.targetValue) || + ( + transform.unit != 'color' && + (isNaN(transform.originalValue) || isNaN(transform.targetValue)) + ) + ) + }); + }, + update: function(position) { + var style = { }, transform, i = this.transforms.length; + while(i--) + style[(transform = this.transforms[i]).style] = + transform.unit=='color' ? '#'+ + (Math.round(transform.originalValue[0]+ + (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + + (Math.round(transform.originalValue[1]+ + (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + + (Math.round(transform.originalValue[2]+ + (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : + (transform.originalValue + + (transform.targetValue - transform.originalValue) * position).toFixed(3) + + (transform.unit === null ? '' : transform.unit); + this.element.setStyle(style, true); + } +}); + +Effect.Transform = Class.create({ + initialize: function(tracks){ + this.tracks = []; + this.options = arguments[1] || { }; + this.addTracks(tracks); + }, + addTracks: function(tracks){ + tracks.each(function(track){ + track = $H(track); + var data = track.values().first(); + this.tracks.push($H({ + ids: track.keys().first(), + effect: Effect.Morph, + options: { style: data } + })); + }.bind(this)); + return this; + }, + play: function(){ + return new Effect.Parallel( + this.tracks.map(function(track){ + var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); + var elements = [$(ids) || $$(ids)].flatten(); + return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); + }).flatten(), + this.options + ); + } +}); + +Element.CSS_PROPERTIES = $w( + 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + + 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + + 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + + 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + + 'fontSize fontWeight height left letterSpacing lineHeight ' + + 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ + 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + + 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + + 'right textIndent top width wordSpacing zIndex'); + +Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; + +String.__parseStyleElement = document.createElement('div'); +String.prototype.parseStyle = function(){ + var style, styleRules = $H(); + if (Prototype.Browser.WebKit) + style = new Element('div',{style:this}).style; + else { + String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>'; + style = String.__parseStyleElement.childNodes[0].style; + } + + Element.CSS_PROPERTIES.each(function(property){ + if (style[property]) styleRules.set(property, style[property]); + }); + + if (Prototype.Browser.IE && this.include('opacity')) + styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); + + return styleRules; +}; + +if (document.defaultView && document.defaultView.getComputedStyle) { + Element.getStyles = function(element) { + var css = document.defaultView.getComputedStyle($(element), null); + return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { + styles[property] = css[property]; + return styles; + }); + }; +} else { + Element.getStyles = function(element) { + element = $(element); + var css = element.currentStyle, styles; + styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { + results[property] = css[property]; + return results; + }); + if (!styles.opacity) styles.opacity = element.getOpacity(); + return styles; + }; +}; + +Effect.Methods = { + morph: function(element, style) { + element = $(element); + new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); + return element; + }, + visualEffect: function(element, effect, options) { + element = $(element) + var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); + new Effect[klass](element, options); + return element; + }, + highlight: function(element, options) { + element = $(element); + new Effect.Highlight(element, options); + return element; + } +}; + +$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ + 'pulsate shake puff squish switchOff dropOut').each( + function(effect) { + Effect.Methods[effect] = function(element, options){ + element = $(element); + Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); + return element; + } + } +); + +$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( + function(f) { Effect.Methods[f] = Element[f]; } +); + +Element.addMethods(Effect.Methods); diff --git a/maarch_entreprise/trunk/js/functions.js b/maarch_entreprise/trunk/js/functions.js new file mode 100644 index 0000000000000000000000000000000000000000..9270d240c85d22fe04d2d91e6e00995c13286e48 --- /dev/null +++ b/maarch_entreprise/trunk/js/functions.js @@ -0,0 +1,1828 @@ +<!-- +var isAlreadyClick = false; +// Adding prototype and other js scripts +document.write('<script type="text/javascript" src="'+app_path+'js/prototype.js"></script>'); +document.write('<script type="text/javascript" src="'+app_path+'js/scriptaculous.js?load=effects,slider"></script>'); +document.write('<script type="text/javascript" src="'+app_path+'js/maarch.js"></script>'); +document.write('<script type="text/javascript" src="'+app_path+'js/scrollbox.js"></script>'); +document.write('<script type="text/javascript" src="'+app_path+'js/effects.js"></script>'); +document.write('<script type="text/javascript" src="'+app_path+'js/controls.js"></script>'); +document.write('<script type="text/javascript" src="'+app_path+'js/concertina.js"></script>'); +document.write('<script type="text/javascript" src="'+app_path+'js/protohuds.js"></script>'); +document.write('<script type="text/javascript" src="'+app_path+'js/tabricator.js"></script>'); + +document.write('<script type="text/javascript" src="'+app_path+'js/indexing.js"></script>'); + +function repost(php_file,update_divs,fields,action,timeout) + { + //alert('php file : '+php_file); + var event_count = 0; + + //Observe fields + for (var i = 0; i < fields.length; ++i) { + + $(fields[i]).observe(action,send); + } + + function send(event) + { + params = ''; + event_count++; + + for (var i = 0; i < fields.length; ++i) + { + params += $(fields[i]).serialize()+'&'; + } + + setTimeout(function() { + event_count--; + + if(event_count == 0) + new Ajax.Request(php_file, + { + method:'post', + onSuccess: function(transport){ + + var response = transport.responseText; + var reponse_div = new Element("div"); + reponse_div.innerHTML = response; + var replace_div = reponse_div.select('div'); + + for (var i = 0; i < replace_div.length; ++i) + for(var j = 0; j < update_divs.length; ++j) + { + if(replace_div[i].id == update_divs[j]) + $(update_divs[j]).replace(replace_div[i]); + } + }, + onFailure: function(){ alert('Something went wrong...'); }, + parameters: params + }); + }, timeout); + } + } + + + /** + * List used for autocompletion + * + */ + var initList = function (idField, idList, theUrlToListScript, paramNameSrv, minCharsSrv) + { + new Ajax.Autocompleter( + idField, + idList, + theUrlToListScript, + { + paramName: paramNameSrv, + minChars: minCharsSrv + }); + }; + + +/*********** Init vars for the calendar ****************/ + var allMonth=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var allNameOfWeekDays=["Lu","Ma", "Me", "Je", "Ve", "Sa", "Di"]; + var allNameOfMonths=["Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"]; + var newDate=new Date(); + var yearZero=newDate.getFullYear(); + var monthZero=newDate.getMonth(); + var day=newDate.getDate(); + var currentDay=0, currentDayZero=0; + var month=monthZero, year=yearZero; + var yearMin=1950, yearMax=2050; + var target=''; + var hoverEle=false; +/*************************************** + +/***********Functions used by the calendar ****************/ + function setTarget(e){ + if(e) return e.target; + if(event) return event.srcElement; + } + function newElement(type, attrs, content, toNode) { + var ele=document.createElement(type); + if(attrs) { + for(var i=0; i<attrs.length; i++) { + eval('ele.'+attrs[i][0]+(attrs[i][2] ? '=\u0027' :'=')+attrs[i][1]+(attrs[i][2] ? '\u0027' :'')); + } + } + if(content) ele.appendChild(document.createTextNode(content)); + if(toNode) toNode.appendChild(ele); + return ele; + } + function setMonth(ele){month=parseInt(ele.value);calender()} + function setYear(ele){year=parseInt(ele.value);calender()} + function setValue(ele) { + if(ele.parentNode.className=='week' && ele.firstChild){ + var dayOut=ele.firstChild.nodeValue; + if(dayOut < 10) dayOut='0'+dayOut; + var monthOut=month+1; + if(monthOut < 10) monthOut='0'+monthOut; + target.value=dayOut+'-'+monthOut+'-'+year; + removeCalender(); + } + } + function removeCalender() { + var parentEle=$("calender"); + while(parentEle.firstChild) parentEle.removeChild(parentEle.firstChild); + $('basis').parentNode.removeChild($('basis')); + } + function calender() { + var parentEle=$("calender"); + parentEle.onmouseover=function(e) { + var ele=setTarget(e); + if(ele.parentNode.className=='week' && ele.firstChild && ele!=hoverEle) { + if(hoverEle) hoverEle.className=hoverEle.className.replace(/hoverEle ?/,''); + hoverEle=ele; + ele.className='hoverEle '+ele.className; + } else { + if(hoverEle) { + hoverEle.className=hoverEle.className.replace(/hoverEle ?/,''); + hoverEle=false; + } + } + } + while(parentEle.firstChild) parentEle.removeChild(parentEle.firstChild); + function check(){ + if(year%4==0&&(year%100!=0||year%400==0))allMonth[1]=29; + else allMonth[1]=28; + } + function addClass (name) { if(!currentClass){currentClass=name} else {currentClass+=' '+name} }; + if(month < 0){month+=12; year-=1} + if(month > 11){month-=12; year+=1} + if(year==yearMax-1) yearMax+=1; + if(year==yearMin) yearMin-=1; + check(); + var close_window=newElement('p',[['id','close',1]],false,parentEle); + + var close_link = newElement('a', [['href','javascript:removeCalender()',1],['className','close_window',1]], 'Fermer', close_window); + var img_close=newElement('img', [['src','img/close_small.gif',1], ['id','img_close',1]], false, close_link); + var control=newElement('p',[['id','control',1]],false,parentEle); + var controlPlus=newElement('a', [['href','javascript:month=month-1;calender()',1],['className','controlPlus',1]], '<', control); + var select=newElement('select', [['onchange',function(){setMonth(this)}]], false, control); + for(var i=0; i<allNameOfMonths.length; i++) newElement('option', [['value',i,1]], allNameOfMonths[i], select); + select.selectedIndex=month; + select=newElement('select', [['onchange',function(){setYear(this)}]], false, control); + for(var i=yearMin; i<yearMax; i++) newElement('option', [['value',i,1]], i, select); + select.selectedIndex=year-yearMin; + controlPlus=newElement('a', [['href','javascript:month++;calender()',1],['className','controlPlus',1]], '>', control); + check(); + currentDay=1-new Date(year,month,1).getDay(); + if(currentDay > 0) currentDay-=7; + currentDayZero=currentDay; + var newMonth=newElement('table',[['cellSpacing',0,1],['onclick',function(e){setValue(setTarget(e))}]], false, parentEle); + var newMonthBody=newElement('tbody', false, false, newMonth); + var tr=newElement('tr', [['className','head',1]], false, newMonthBody); + tr=newElement('tr', [['className','weekdays',1]], false, newMonthBody); + for(i=0;i<7;i++) td=newElement('td', false, allNameOfWeekDays[i], tr); + tr=newElement('tr', [['className','week',1]], false, newMonthBody); + for(i=0; i<allMonth[month]-currentDayZero; i++){ + var currentClass=false; + currentDay++; + if(currentDay==day && month==monthZero && year==yearZero) addClass ('today'); + if(currentDay <= 0 ) { + if(currentDayZero!=-7) td=newElement('td', false, false, tr); + } + else { + if((currentDay-currentDayZero)%7==0) addClass ('holiday'); + td=newElement('td', (!currentClass ? false : [['className',currentClass,1]] ), currentDay, tr); + if((currentDay-currentDayZero)%7==0) tr=newElement('tr', [['className','week',1]], false, newMonthBody); + } + if(i==allMonth[month]-currentDayZero-1){ + i++; + while(i%7!=0){i++;td=newElement('td', false, false, tr)}; + } + } + + } + function showCalender(ele) { + if($('basis')) { removeCalender() } + else { + target=$(ele.id.replace(/for_/,'')); + var basis=ele.parentNode.insertBefore(document.createElement('div'),ele); + basis.id='basis'; + newElement('div', [['id','calender',1]], false, basis); + calender(); + + } + } + + + if(!window.Node){ + var Node = {ELEMENT_NODE : 1, TEXT_NODE : 3}; + } + + function checkNode(node, filter){ + return (filter == null || node.nodeType == Node[filter] || node.nodeName.toUpperCase() == filter.toUpperCase()); + } + + function getChildren(node, filter){ + var result = new Array(); + if(node != null) + { + var children = node.childNodes; + for(var i = 0; i < children.length; i++) + { + if(checkNode(children[i], filter)) result[result.length] = children[i]; + } + } + return result; + } + + function getChildrenByElement(node){ + return getChildren(node, "ELEMENT_NODE"); + } + + function getFirstChild(node, filter){ + var child; + var children = node.childNodes; + for(var i = 0; i < children.length; i++){ + child = children[i]; + if(checkNode(child, filter)) return child; + } + return null; + } + + function getFirstChildByText(node){ + return getFirstChild(node, "TEXT_NODE"); + } + + function getNextSibling(node, filter){ + for(var sibling = node.nextSibling; sibling != null; sibling = sibling.nextSibling){ + if(checkNode(sibling, filter)) return sibling; + } + return null; + } + function getNextSiblingByElement(node){ + return getNextSibling(node, "ELEMENT_NODE"); + } +/****************************************/ + + +/********** Menu Functions & Properties ******************/ + + var activeMenu = null; + + function showMenu() { + if(activeMenu){ + activeMenu.className = ""; + getNextSiblingByElement(activeMenu).style.display = "none"; + } + if(this == activeMenu){ + activeMenu = null; + } else { + this.className = "on"; + getNextSiblingByElement(this).style.display = "block"; + activeMenu = this; + } + return false; + } + + function initMenu(){ + var menus, menu, text, aRef, i; + menus = getChildrenByElement($("menu")); + for(i = 0; i < menus.length; i++){ + menu = menus[i]; + text = getFirstChildByText(menu); + aRef = document.createElement("a"); + if(aRef == null){ + menu.replaceChild(aRef, text); + aRef.appendChild(text); + aRef.href = "#"; + aRef.onclick = showMenu; + aRef.onfocus = function(){this.blur()}; + } + } + } + + if(document.createElement) window.onload = initMenu; + + function cacher_menu() { + with ($('menu_container')){ + if (className=='active') + { + className='inactive'; + $('limage').src="images/sortirmenu.gif"; + } + else + { + className='active'; + $('limage').src="images/rentrermenu.gif"; + } + } + } + + + /************** fonction pour afficher/cacher le menu ***********/ + + function ShowHideMenu(menu,onouoff) { + if ($) { + monmenu = $(menu); + mondivmenu = $("menu"); + monadmin = $("admin"); + monhelp = $("aide"); + } + else if(document.all) { + monmenu = document.all[menu]; + mondivmenu = document.all["menu"]; + monadmin = document.all["admin"]; + monhelp = document.all["aide"]; + } + else return; + + if (menu == "ssnav") { + if (onouoff == "fermee") { + monmenu.style.display = "block"; + monadmin.className = "on"; + } else if (onouoff == "ouverte") { + monmenu.style.display = "none"; + monadmin.className = "off"; + } + } + else if (menu == "ssnavaide") { + if (onouoff == "fermee") { + monmenu.style.display = "block"; + monhelp.className = "on"; + } else if (onouoff == "ouverte") { + monmenu.style.display = "none"; + monhelp.className = "off"; + } + } + else { + if (onouoff == "on") { + monmenu.style.display = "block"; + mondivmenu.className = "on"; + } else if (onouoff == "off") { + monmenu.style.display = "none"; + mondivmenu.className = "off"; + } + } + } + + function HideMenu(menu) { + var massnav = null ; + if ($) { + + if (menu == "ssnav") + { + massnav = $("ssnav"); + } + else if (menu == "ssnavaide") + { + massnav = $("ssnavaide"); + } + } + else if(document.all) { + if (menu == "ssnav") + { + massnav = document.all["ssnav"]; + } + else if (menu == "ssnavaide") + { + massnav = document.all["ssnavaide"]; + } + } + else return; + + if(massnav != null) + { + massnav.style.display = "none"; + } + } +/****************************************/ + + function changeCouleur(ligne,couleurPolice,isBold) { //, couleurFond + //ligne.style.backgroundColor = couleurFond; + ligne.style.color=couleurPolice; + } + + function changeCouleur2(cellule,couleurPolice,isBold) + { + var ligne = cellule.parentNode; + ligne.style.color=couleurPolice; + } + + + +function ouvreFenetre(page, largeur, hauteur) + { + window.open(page, "", "scrollbars=yes,menubar=no,toolbar=no,resizable=yes,width=" + + largeur + ",height=" + hauteur ); + } + +/************** Fonction utilisées pour la gestion des listes multiples ***********/ + +/** +* Move item(s) from a multiple list to another +* +* @param list1 Select Object Source list +* @param list2 Select Object Destination list +*/ +function Move(list1,list2) +{ + for (i=0;i<list1.length;i++) + { + if(list1[i].selected) + { + o = new Option(list1.options[list1.options.selectedIndex].text,list1.options[list1.options.selectedIndex].value,false, true); + list2.options[list2.options.length]=o; + list1.options[list1.options.selectedIndex]=null; + i--; + } + } +} + +/** +* Move an item from a multiple list to another +* +* @param list1 Select Object Source list +* @param list2 Select Object Destination list +*/ +function moveclick(list1,list2) +{ + o = new Option(list1.options[list1.options.selectedIndex].text,list1.options[list1.options.selectedIndex].value,false, true); + list2.options[list2.options.length]=o; + list1.options[list1.options.selectedIndex]=null; +} + +/** +* Select all items from a multiple list +* +* @param list Select Object Source list +*/ +function selectall(list) +{ + for (i=0;i<list.length;i++) + { + list[i].selected = true; + } +} + +/** +* Move an item from a multiple list to another +* +* @param list1 Select identifier of the Source list +* @param list2 Select identifier of the Destination list +*/ +function moveclick_ext( id_list1, id_list2) +{ + var list1 = $(id_list1); + var list2 = $(id_list2); + moveclick(list1,list2); +} + +/** +* Select all items from a multiple list +* +* @param list Select identifier of the Source list +*/ +function selectall_ext(id_list) +{ + var list = $(id_list); + selectall(list); +} + +/** +* Move item(s) from a multiple list to another +* +* @param list1 Select identifier of the Source list +* @param list2 Select identifier of the Destination list +*/ +function Move_ext( id_list1, id_list2) +{ + var list1 = $(id_list1); + var list2 = $(id_list2); + Move(list1,list2); +} +/*********************************************************/ + + +var BrowserDetect = { + init: function () { + this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; + this.version = this.searchVersion(navigator.userAgent) + || this.searchVersion(navigator.appVersion) + || "an unknown version"; + this.OS = this.searchString(this.dataOS) || "an unknown OS"; + }, + searchString: function (data) { + for (var i=0;i<data.length;i++) { + var dataString = data[i].string; + var dataProp = data[i].prop; + this.versionSearchString = data[i].versionSearch || data[i].identity; + if (dataString) { + if (dataString.indexOf(data[i].subString) != -1) + return data[i].identity; + } + else if (dataProp) + return data[i].identity; + } + }, + searchVersion: function (dataString) { + var index = dataString.indexOf(this.versionSearchString); + if (index == -1) return; + return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); + }, + dataBrowser: [ + { + string: navigator.userAgent, + subString: "Chrome", + identity: "Chrome" + }, + { string: navigator.userAgent, + subString: "OmniWeb", + versionSearch: "OmniWeb/", + identity: "OmniWeb" + }, + { + string: navigator.vendor, + subString: "Apple", + identity: "Safari", + versionSearch: "Version" + }, + { + prop: window.opera, + identity: "Opera" + }, + { + string: navigator.vendor, + subString: "iCab", + identity: "iCab" + }, + { + string: navigator.vendor, + subString: "KDE", + identity: "Konqueror" + }, + { + string: navigator.userAgent, + subString: "Firefox", + identity: "Firefox" + }, + { + string: navigator.vendor, + subString: "Camino", + identity: "Camino" + }, + { // for newer Netscapes (6+) + string: navigator.userAgent, + subString: "Netscape", + identity: "Netscape" + }, + { + string: navigator.userAgent, + subString: "MSIE", + identity: "Explorer", + versionSearch: "MSIE" + }, + { + string: navigator.userAgent, + subString: "Gecko", + identity: "Mozilla", + versionSearch: "rv" + }, + { // for older Netscapes (4-) + string: navigator.userAgent, + subString: "Mozilla", + identity: "Netscape", + versionSearch: "Mozilla" + } + ], + dataOS : [ + { + string: navigator.platform, + subString: "Win", + identity: "Windows" + }, + { + string: navigator.platform, + subString: "Mac", + identity: "Mac" + }, + { + string: navigator.userAgent, + subString: "iPhone", + identity: "iPhone/iPod" + }, + { + string: navigator.platform, + subString: "Linux", + identity: "Linux" + } + ] + +}; + +BrowserDetect.init(); + +/** +* Resize frames in a modal +* +* @param id_modal String Modal identifier +* @param id_frame String Frame identifier of the frame to resize +* @param resize_width Integer New width +* @param resize_height Integer New Height +*/ +function resize_frame_process(id_modal, id_frame, resize_width, resize_height) +{ + var modal = $(id_modal); + if(modal) + { + var newwith = modal.getWidth(); + //alert(newwith); + var newheight = modal.getHeight() - 30; + + //console.log('modal width '+newwith); + var frame2 = $(id_frame); + var div_left = $('validleft'); + var windowSize = new Array(); + if(resize_width == true && frame2 != null) + { + windowSize = getWindowSize(); + //console.log('window '+windowSize); + navName = BrowserDetect.browser; + navVersion = BrowserDetect.version; + + if(id_frame == 'file_iframe') + { + //~ var div_right = $('validright'); + //~ if(div_right && div_left) + //~ { + //~ Element.setStyle(div_right, {width : ((newwith - div_left.getWidth()) -50) +'px' }); + //~ //div_right.style.width=((newwith - div_left.getWidth()) -50) +'px'; + //~ newwith = (newwith - div_left.getWidth())- 30; + //~ } + if(navName == 'Explorer') + { + if(navVersion < 7) + { + newwith = (windowSize[0] - 800) - 10; + } + else + { + newwith = (windowSize[0] - 520) - 10; + } + } + else if(navName == 'Firefox' || navName == 'Mozilla') + { + newwith = (windowSize[0] - 550) - 10; + } + else + { + newwith = (windowSize[0] - 550) - 10; + } + } + else if(id_frame == 'viewframe') + { + if(navName == 'Explorer') + { + if(navVersion < 7) + { + newwith = (windowSize[0] - 510); + } + else + { + newwith = (windowSize[0] - 480); + } + + } + else if(navName == 'Firefox') + { + newwith = (windowSize[0] - 500); + } + else + { + newwith = (windowSize[0] - 500); + } + } + else if(id_frame == 'viewframevalid') + { + if(navName == 'Explorer') + { + newwith = (windowSize[0] - 520) - 10; + } + else if(navName == 'Firefox') + { + newwith = (windowSize[0] - 550) - 10; + } + else + { + newwith = (windowSize[0] - 550) - 10; + } + } + else + { + newwith = (windowSize[0] - 600); + } + frame2.style.width = newwith +"px"; + } + if(resize_height == true && frame2 != null) + { + frame2.style.height = newheight +"px"; + } + } +} + +function getWindowSize(){ + if (window.innerWidth || window.innerHeight){ + var width = window.innerWidth; + var height = window.innerHeight; + } + else{ + var width = $(document.documentElement).getWidth(); + var height = $(document.documentElement).getHeight(); + } + return [width,height]; +} + + +/** + * Redirect to a given url + * + * @param url String Url to redirect to + */ +function redirect_to_url(url) +{ + location.href=url; +} + +/** + * redirect to a given url when the session expirates + * + * @param expiration Integer Expiration time (in minutes)) + * @param url String Url to redirect to + */ +function session_expirate(expiration, url) +{ + var chronoExpiration=setTimeout('redirect_to_url(\''+url+'\')', expiration*60*1000); +} + +/*************** Tabs functions *****************/ + +function opentab(eleframe, url) +{ + var eleframe1 = $(eleframe); + eleframe1.src = url; +} + +function opentab_window(eleframe, url) +{ + var eleframe1 = window.top.$(eleframe); + eleframe1.src = url; +} +/********************************/ + + +/*************** Usergroups administration functions *****************/ + +function expertmodehide() +{ + var frm = $('frm_expert_mode'); + var input = $('where'); + var label1 = $('label_expert_hide'); + var label2 = $('label_expert_show'); + frm.width = "1000"; + frm.height = "370"; + input.className = "input_expert_hide"; + label1.className = "input_expert_hide"; + label2.className = "input_expert_show"; + +} + +function expertmodeview(coll_id) +{ + var frm = $('frm_expert_mode'); + var input = $('where'); + var label1 = $('label_expert_hide'); + var label2 = $('label_expert_show'); + frm.width = "1"; + frm.height = "1"; + input.className = "input_expert_show"; + label1.className = "input_expert_show"; + label2.className = "input_expert_hide"; + //document.location.reload(); + document.location.href = 'add_grant.php?expertmode=true&collection=' + coll_id; +} +/********************************/ + +/*************** Modal functions *****************/ + +/** + * Create a modal window + * + * @param txt String Text of the modal (innerHTML) + * @param id_mod String Modal identifier + * @param height String Modal Height in px + * @param width String Modal width in px + * @param mode_frm String Modal mode : fullscreen or '' + */ + function createModal(txt, id_mod,height, width, mode_frm){ + if(height == undefined || height=='') + { + height = '100px'; + } + if(width == undefined || width=='') + { + width = '400px'; + } + if( mode_frm == 'fullscreen') + { + width = (screen.availWidth-10)+'px'; + height = (screen.availHeight-10)+'px'; + } + if(id_mod && id_mod!='') + { + id_layer = id_mod+'_layer'; + } + else + { + id_mod = 'modal'; + id_layer = 'lb1-layer'; + } + var tmp_width = width; + var tmp_height = height; + + var layer = new Element('div', {'id':id_layer, 'class' : 'lb1-layer', 'style' : "display:block;filter:alpha(opacity=70);opacity:.70;z-index:"+get_z_indexes()['layer']+';width :'+document.getElementsByTagName('html')[0].offsetWidth+"px;height:"+(document.getElementsByTagName('body')[0].offsetHeight - 20)+'px;'}); + + + if( mode_frm == 'fullscreen') + { + var fenetre = new Element('div', {'id' :id_mod,'class' : 'modal', 'style' :'top:0px;left:0px;width:'+width+';height:'+height+";z-index:"+get_z_indexes()['modal']+";position:absolute;" }); + } + else + { + var fenetre = new Element('div', {'id' :id_mod,'class' : 'modal', 'style' :'top:50px;left:50px;'+'width:'+width+';height:'+height+";z-index:"+get_z_indexes()['modal']+";margin-top:"+getScrollXY()[1]+15+'px;margin-left:'+getScrollXY()[0]+15+'px;position:absolute;' }); + } + + //~ if( mode_frm == 'fullscreen') + //~ { + //~ //fenetre.writeAttribute('style','top:0px;left:0px;width:'+width+';height:'+height+";z-index:"+get_z_indexes()['modal']+";"); + //~ fenetre.setStyle({top: '0px', left :'0px', width: tmp_width, height :tmp_height, zIndex:get_z_indexes()['modal']}); + //~ } + //~ else + //~ { + //~ fenetre.writeAttribute('style','top:50px;left:50px;'+'width:'+width+';height:'+height+";z-index:"+get_z_indexes()['modal']+";"); + //~ fenetre.style.marginTop = getScrollXY()[1]+15+'px'; + //~ fenetre.style.marginLeft = getScrollXY()[0]+15+'px'; + //~ } + //alert('test 5'); + //$(document.body).insert(layer); + //$(document.body).insert(fenetre); + Element.insert(document.body,layer); + Element.insert(document.body,fenetre); + // layer.style.width=document.getElementsByTagName('html')[0].offsetWidth+"px"; + //alert('test 6'); + //var layer_height = document.getElementsByTagName('body')[0].offsetHeight + 500; + //layer.style.height=layer_height+'px'; + //layer.style.height=(document.getElementsByTagName('body')[0].offsetHeight - 20)+'px'; + //alert('test 7'); + if( mode_frm == 'fullscreen') + { + fenetre.style.width = (document.getElementsByTagName('html')[0].offsetWidth - 30)+"px"; + fenetre.style.height = layer.style.height; + } +// alert('test 8'); + //fenetre.update(txt); + Element.update(fenetre,txt); +// alert('test 9'); + Event.observe(layer, 'mousewheel', function(event){Event.stop(event);}.bindAsEventListener(), true); + Event.observe(layer, 'DOMMouseScroll', function(event){Event.stop(event);}.bindAsEventListener(), true); + //alert('test 10'); +} + +/** + * Destroy a modal window + * + * @param id_mod String Modal identifier + */ +function destroyModal(id_mod){ + if(id_mod == undefined || id_mod=='') + { + id_mod = 'modal'; + id_layer = 'lb1-layer'; + } + else + { + id_layer = id_mod+'_layer'; + } + if(isAlreadyClick) + { + isAlreadyClick = false; + } + document.getElementsByTagName('body')[0].removeChild($(id_mod)); + document.getElementsByTagName('body')[0].removeChild($(id_layer)); +} + +/** + * Calculs the z indexes for a modal + * + * @return array The z indexes of the layer and the modal + */ +function get_z_indexes() +{ + + //var elem = document.getElementsByClassName('modal'); + var elem = $$('modal'); + if(elem == undefined || elem == NaN) + { + return {layer : 995, modal : 1000}; + } + else + { + var max_modal = 1000; + for(var i=0; i< elem.length; i++) + { + if(elem[i].style.zIndex > max_modal) + { + max_modal = elem[i].style.zIndex; + } + } + max_layer = max_modal +5; + max_modal = max_modal +10; + + return {layer : max_layer, modal : max_modal}; + } +} + +/** + * Calculs the scroll X and Y of the window + * + * @return array The ScrollX and the ScrollY of the window + */ + function getScrollXY(){ + if (window.top.scrollX || window.top.scrollY){ + var scrollX = window.scrollX; + var scrollY = window.scrollY; + }else{ + var scrollX = document.body.scrollLeft; + var scrollY = document.body.scrollTop; + } + return [scrollX,scrollY]; + } + +/***********************************************************************/ + +/*************** Actions management functions and vars *****************/ + +/** +* Pile of the actions to be executed +* Object +*/ +var pile_actions = { values :[], + action_push:function(val){this.values.push(val);}, + action_pop:function(){return this.values.pop();} + }; +var res_ids = ''; +var do_nothing = false; +/** + * Executes the last actions in the actions pile + * + */ +function end_actions() +{ + + var req_action = pile_actions.action_pop(); + if(req_action) + { + if(req_action.match('to_define')) + { + req_action = req_action.replace('to_define', res_ids); + do_nothing = true; + } + //console.log('end_action : '+req_action); + try{ + eval(req_action); + } + catch(e) + { + alert('Error during pop action : '+req_action); + } + } +} + +/** + * If the action has open a modal, destroy the action modal, and if this is the last action of the pile, reload the opener window + * + */ +function close_action(id_action, page) +{ + var modal = $('modal_'+id_action); + if(modal) + { + destroyModal('modal_'+id_action); + } + if(pile_actions.values.length == 0) + { + //console.log('close'); +// alert('close'); + //console.log(page); + + if(page != '' && page != NaN && page && page != null ) + { + do_nothing = false; + window.top.location.href=page; + + } + else if(do_nothing == false) + { + window.top.location.reload(); + } + do_nothing = false; + } +} + +/** + * Validates the form of an action + * + * @param current_form_id String Identifier of the form to validate + * @param path_manage_script String Path to the php script called in the Ajax object to validates the form + * @param id_action String Action identifier + * @param values String Action do something on theses items listed in this string + * @param table String Table used for the action + * @param module String Action is this module + * @param coll_id String Collection identifier + * @param mode String Action mode : mass or page + */ +function valid_action_form(current_form_id, path_manage_script, id_action, values, table, module, coll_id, mode) +{ + var frm_values = get_form_values(current_form_id); + frm_values = frm_values.replace("\'", "\\'", 'g'); + frm_values = frm_values.replace('\"', '\\"', 'g'); + var chosen_action_id = get_chosen_action(current_form_id); + //console.log('values : '+values+', table : '+table+', module : '+module+', coll_id : '+coll_id+', chosen_action_id : '+chosen_action_id+' frm_values : '+frm_values); + if(values && table && module && coll_id && chosen_action_id != '') + { + new Ajax.Request(path_manage_script, + { + method:'post', + parameters: { action_id : id_action, + form_to_check : current_form_id, + req : 'valid_form', + form_values : frm_values + }, + onSuccess: function(answer){ + //console.log('valid form answer '+answer.responseText); + //alert('valid form answer '+answer.responseText); + eval('response='+answer.responseText); + if(response.status == 0 ) //form values checked + { + if(response.manage_form_now == false) + { + //console.log('manage_form_now false'); + pile_actions.action_push("action_send_form_confirm_result( '"+path_manage_script+"', '"+mode+"', '"+id_action+"', '"+values+"','"+table+"', '"+module+"','"+coll_id+"', '"+frm_values+"');"); + + if(chosen_action_id == 'end_action') + { + // alert('last_action'); + //console.log('last_action'); + end_actions(); + } + else + { + //console.log('not last'); + //alert('not last'); + action_send_first_request(path_manage_script, mode, chosen_action_id, values, table, module, coll_id); + } + } + else + { + pile_actions.action_push("action_send_first_request( '"+path_manage_script+"', '"+mode+"', '"+chosen_action_id+"', 'to_define','"+table+"', '"+module+"','"+coll_id+"');"); + action_send_form_confirm_result(path_manage_script, mode, id_action, values, table, module, coll_id, frm_values); + } + } + else // Form Params errors + { + //console.log(response.error_txt); + try{ + $('frm_error_'+id_action).innerHTML = response.error_txt; + } + catch(e){} + } + }, + onFailure: function(){ + } + }); + } + else + { + if(console) + { + console.log('Action Error!'); + } + //alert('Action Error!'); + } +} + +/** + * Get the chosen action identifier in the form + * + * @param form_id String Identifier of the form + */ +function get_chosen_action(form_id) +{ + var frm = $(form_id); + for(var i=0; i< frm.elements.length;i++) + { + if(frm.elements[i].id == 'chosen_action') + { + if(frm.elements[i].tagName == 'INPUT') + { + return frm.elements[i].value; + } + else if(frm.elements[i].tagName == 'SELECT') + { + return frm.elements[i].options[frm.elements[i].selectedIndex].value; + } + else + { + break; + } + } + } + return ''; +} + +/** + * Get the values of the form in an string (Id_field1#field_value1$$Id_field2#field_value2$$) + * + * @param form_id String Identifier of the form + * @return String Values of the form + */ +function get_form_values(form_id) +{ + var frm = $(form_id); + var val = ''; + if(frm) + { + for(var i=0; i< frm.elements.length;i++) + { + if(frm.elements[i].tagName == 'INPUT' || frm.elements[i].tagName == 'TEXTAREA') + { + if((frm.elements[i].tagName == 'INPUT' && frm.elements[i].type != 'checkbox' && frm.elements[i].type != 'radio') || frm.elements[i].tagName == 'TEXTAREA' ) + { + val += frm.elements[i].id+'#'+frm.elements[i].value+'$$'; + } + else + { + if(frm.elements[i].checked == true) + { + val += frm.elements[i].id+'#'+frm.elements[i].value+'$$'; + } + } + } + else if(frm.elements[i].tagName == 'SELECT') // to do : multiple list + { + val += frm.elements[i].id+'#'+frm.elements[i].options[frm.elements[i].selectedIndex].value+'$$'; + } + } + val.substring(0, val.length -3); + } + //console.log(val); + return val; +} + +/** + * Sends the first ajax request to create a form or resolve a simple action + * + * @param path_manage_script String Path to the php script called in the Ajax object + * @param mode_req String Action mode : mass or page + * @param id_action String Action identifier + * @param res_id_values String Action do something on theses items listed in this string + * @param tablename String Table used for the action + * @param modulename String Action is this module + * @param id_coll String Collection identifier + */ +function action_send_first_request( path_manage_script, mode_req, id_action, res_id_values, tablename, modulename, id_coll) +{ + //alert('action_send_first_request'); + if(id_action == undefined || id_action == null || id_action == '') + { + window.top.$('main_error').innerHTML = arr_msg_error['choose_action']; + //console.log('Choisissez une action !'); + } + if(res_id_values == undefined || res_id_values == null || res_id_values == '') + { + window.top.$('main_error').innerHTML += '<br/>' + arr_msg_error['choose_one_doc']; + //console.log('Choisissez au moins un doc !'); + } + //alert('res_id_values : '+res_id_values+', id_action '+id_action+', tablename '+tablename+', modulename : '+modulename+', id_coll : '+id_coll+', mode_req : '+mode_req); + if(res_id_values != '' && id_action != '' && tablename != '' && modulename != '' && id_coll != '' && (mode_req == 'page' || mode_req == 'mass')) + { + //alert('values : '+res_id_values+', id_action : '+id_action+', table : '+tablename+', module : '+modulename+', coll_id : '+id_coll+', mode : '+mode_req); + new Ajax.Request(path_manage_script, + { + method:'post', + parameters: { values : res_id_values, + action_id : id_action, + mode : mode_req, + req : 'first_request', + table : tablename, + coll_id : id_coll, + module : modulename + }, + onSuccess: function(answer){ + eval("response = "+answer.responseText); + // console.log(answer.responseText); + //alert(answer.responseText); + var page_result = response.page_result; + if(response.status == 0 ) // No confirm or form asked + { + //console.log('action_send_first_request OK'); + end_actions(); + close_action(id_action, page_result); + + } + else if(response.status == 2) // Confirm asked to the user + { + //console.log('confirm'); + //alert('confirm'); + var modal_txt='<h2>'+response.confirm_content+'</h2>'; + modal_txt += '<p class="buttons">'; + modal_txt += '<input type="button" name="submit" id="submit" value="'+response.validate+'" class="button" onclick="action_send_form_confirm_result( \''+path_manage_script+'\', \''+mode_req+'\',\''+id_action+'\', \''+res_id_values+'\', \''+tablename+'\', \''+modulename+'\', \''+id_coll+'\');"/>'; + modal_txt += ' <input type="button" name="cancel" id="cancel" value="'+response.cancel+'" class="button" onclick="destroyModal(\'modal_'+id_action+'\');"/></p>'; + //console.log(modal_txt); + window.top.createModal(modal_txt, 'modal_'+id_action, '200', '300'); + } + else if(response.status == 3) // Form to fill by the user + { + //alert('test'); + window.top.createModal(response.form_content,'modal_'+id_action, response.height, response.width, response.mode_frm); + } + else // Param errors + { + if(console) + { + console.log('param error'); + } + else + { + alert('param error'); + } + //close_action(id_action, page_result); + } + }, + onFailure: function(){ + //alert('erreur'); + } + }); + } +} + +/** + * Gets an item (DOM object)) from its identifier + * + * @param elem_id String Item identifier + * @return DOM Object or false + */ +function get_elem( elem_id) +{ + if ($(elem_id)) + { + return $(elem_id); + } + else + { + var tab = window.frames; + for(var i=0; i < tab.length;i++) + { + if(tab[i].document) + { + return tab[i].$(elem_id); + } + else if(tab[i].contentDocument) + { + return tab[i].content$(elem_id); + } + } + } + return false; +} + +/** + * Sends the second ajax request to process a form + * + * @param path_manage_script String Path to the php script called in the Ajax object + * @param mode_req String Action mode : mass or page + * @param id_action String Action identifier + * @param res_id_values String Action do something on theses items listed in this string + * @param tablename String Table used for the action + * @param modulename String Action is this module + * @param id_coll String Collection identifier + * @param values_new_form String Values of the form to process + */ +function action_send_form_confirm_result(path_manage_script, mode_req, id_action, res_id_values, tablename, modulename, id_coll, values_new_form) +{ + //console.log('debut send_form'); + if(res_id_values != '' && (mode_req == 'mass' || mode_req == 'page') + && id_action != '' && tablename != '' + && modulename!= '' && id_coll != '') + { + + //console.log('avant obj : '+path_manage_script); + new Ajax.Request(path_manage_script, + { + method:'post', + parameters: { values : res_id_values, + action_id : id_action, + mode : mode_req, + req : 'second_request', + table : tablename, + coll_id : id_coll, + module : modulename, + form_values : values_new_form + }, + onSuccess: function(answer){ + // console.log('answer '+answer.responseText); + // alert('answer '+answer.responseText); + eval('response='+answer.responseText); + if(response.status == 0 ) //Form or confirm processed ok + { + res_ids = response.result_id; + //console.log(res_ids); + // alert(res_ids); + end_actions(); + var page_result = response.page_result; + close_action(id_action, page_result); + } + else // Form Params errors + { + //console.log(response.error_txt); + try{ + //$('frm_error').updateContent(response.error_txt); // update the error div in the modal form + $('frm_error').innerHTML = response.error_txt; + } + catch(e){} + } + }, + onFailure: function(){ + //console.log('dans ton c** !!'); + } + }); + } +} +/***********************************************************************/ + + +/*************** Xml management functions : used with tiny_mce to load mapping_file *****************/ + +/** + * Remove a node in a xml file + * + * @param node Node Object Node to remove + */ +function remove_tag(node){ + if(!node.data.replace(/\s/g,'')) + node.parentNode.removeChild(node); +} + +/** + * Clean an xml doc + * + * @param xml XML Object Xml string to clean + */ +function clean_xml_doc(xml) +{ + // TO DO : remove comment, do not work yet + if(xml) + { + var nodes=xml.getElementsByTagName('*'); + for(var i=0;i<nodes.length;i++){ + a=nodes[i].previousSibling; + if(a && (a.nodeType==3 || a.nodeName=='#comment')) + remove_tag(a); + b=nodes[i].nextSibling; + if(b && (b.nodeType==3 || b.nodeName=='#comment')) + remove_tag(b); + c=nodes[i]; + } + + } + return xml; +} + +/** + * Loads an XML File + * + * @param xmlfile String Path or URL of the xml file to load + */ +function load_xml_file(xmlfile) +{ + var xml; + if( window.ActiveXObject && /Win/.test(navigator.userAgent) ) + { + xml= new ActiveXObject("Microsoft.XMLDOM"); + xml.async = false; + xml.load(xmlfile); + return clean_xml_doc(xml); + } + else if( document.implementation && document.implementation.createDocument ) + { + xml = document.implementation.createDocument("", "", null); + xml.async = false; + xml.load(xmlfile); + return clean_xml_doc(xml); + } + else + { + return false; + } +} +/***********************************************************************/ + +/** + * Resize the current window + * + * @param x Integer X size + * @param y Integer Y size + */ +function resize(x,y) { +parent.window.resizeTo(x,y); +} + +/** + * Sets the current window to fullscreen + */ +function fullscreen() { +parent.window.moveTo(0,0); +resize(screen.width-10,screen.height-30); +} + +/** + * Displays in a string all items of an array + its methods + * + */ +function print_r(x, max, sep, l) { + + l = l || 0; + max = max || 10; + sep = sep || ' '; + + if (l > max) { + return "[WARNING: Too much recursion]\n"; + } + + var + i, + r = '', + t = typeof x, + tab = ''; + + if (x === null) { + r += "(null)\n"; + } else if (t == 'object') { + + l++; + + for (i = 0; i < l; i++) { + tab += sep; + } + + if (x && x.length) { + t = 'array'; + } + + r += '(' + t + ") :\n"; + + for (i in x) { + try { + r += tab + '[' + i + '] : ' + print_r(x[i], max, sep, (l + 1)); + } catch(e) { + return "[ERROR: " + e + "]\n"; + } + } + + } else { + + if (t == 'string') { + if (x == '') { + x = '(empty)'; + } + } + + r += '(' + t + ') ' + x + "\n"; + + } + + return r; + + } + +/** + * Includes a javascript file + * + * @param file_url String Url of the js file to include + * @param in_html Bool The Html is already loaded (true) or not (false) + */ +function include_js(file_url, in_html) +{ + if(in_html == true) + { + var head = $$("head")[0]; + //var head = document.getElementsByTagName("head")[0]; + var node = document.createElement("script"); + node.setAttribute('type','text/javascript'); + node.setAttribute('src',file_url); + head.insert(node); + + //head.appendChild(node); + } + else + { + document.write('<script type="text/javascript" src="'+file_url+'"></script>'); + } +} + +/** + * Unlock a basket using Ajax + * + * @param path_script String Path to the Ajax script + * @param id String Basket id to unlock + * @param coll String Collection identifier of the basket + **/ +function unlock(path_script, id, coll) +{ + if(path_script && res_id && coll_id) + { + new Ajax.Request(path_script, + { + method:'post', + parameters: { + res_id : id, + coll_id : coll + }, + onSuccess: function(answer){ + + eval('response='+answer.responseText); + if(response.status == 0 ) + { + + //console.log('Unlock OK'); + + } + else + { + if(console) + { + console.log('Pb unlock'); + } + else + { + alert('Pb unlock'); + } + } + }, + onFailure: function(){ + } + }); + } +} + +/** + * Show or hide the data related to a person in the contacts admin + * + * @param is_corporate Bool True the contact is corporate, Fasle otherwise + **/ +function show_admin_contacts( is_corporate, display) +{ + var display_value = display || 'inline'; + if(is_corporate == true) + { + $("title_p").style.display = "none"; + $("lastname_p").style.display = "none"; + $("firstname_p").style.display = "none"; + $("function_p").style.display = "none"; + $('lastname_mandatory').style.visibility = 'hidden'; + $('society_mandatory').style.visibility = 'visible'; + } + else + { + $("title_p").style.display = display_value; + $("lastname_p").style.display = display_value; + $("firstname_p").style.display = display_value; + $("function_p").style.display =display_value; + $('lastname_mandatory').style.visibility = 'visible'; + $('society_mandatory').style.visibility = 'hidden'; + } +} + +/** + * Returns in an array all values selected from check boxes or radio buttons + * + * @param name_input String Item Name + * @return Array Checked values + **/ +function get_checked_values(name_input) +{ + var arr = []; + var items = document.getElementsByName(name_input); + for(var i=0; i< items.length; i++) + { + if(items[i].checked == true) + { + arr.push(items[i].value); + } + } + return arr; +} + +/** + * Clears a form (empties it) + * + * @param form_id String Form identifier + **/ +function clear_form(form_id) +{ + var frm = $(form_id); + if(frm) + { + var items = frm.getElementsByTagName('INPUT'); + for(var i=0; i<items.length;i++) + { + if(items[i].type == "text") + { + items[i].value =''; + } + } + items = frm.getElementsByTagName('TEXTAREA'); + for(var i=0; i<items.length;i++) + { + items[i].value =''; + } + items = frm.getElementsByTagName('SELECT'); + for(var i=0; i<items.length;i++) + { + if(items[i].multiple == "true") + { + // TO DO + } + else + { + items[i].options[0].selected ='selected'; + } + } + } +} + +/*************** Apps Reports functions *****************/ + +/** + * Function used to display the user access report + * + * @param url String Form Url of the php script which gets the results + **/ +function valid_userlogs(url) +{ + var user_div = $('user_id'); + var user_id_val = ''; + if(user_div) + { + user_id_val = user_div.value; + } + + if( url ) + { + new Ajax.Request(url, + { + method:'post', + parameters: { + user : user_id_val + }, + onSuccess: function(answer){ + // alert(answer.responseText); + var div_to_fill = $('result_userlogsstat'); + if(div_to_fill) + { + div_to_fill.innerHTML = answer.responseText; + } + } + }); + } +} + +/** + * Function used to display the letterbox reports + * + * @param url String Form Url of the php script which gets the results + **/ +function valid_report_by_period(url) +{ + var type_period = ''; + var type_report = 'graph'; + var datestart = ''; + var dateend = ''; + var year = ''; + var month = ''; + var error = ''; + var report_id = ''; + + var report_id_item = $('id_report'); + if(report_id_item) + { + report_id = report_id_item.value; + } + + var report = $('report_array'); + if(report && report.checked) + { + type_report = 'array'; + } + var period_custom = $('custom_period'); + var period_year = $('period_by_year'); + var period_month = $('period_by_month'); + if(period_custom && period_custom.checked) + { + type_period = 'custom_period'; + var datestart_item = $('datestart'); + if(datestart_item) + { + datestart = datestart_item.value; + } + var dateend_item = $('dateend'); + if(dateend_item) + { + dateend = dateend_item.value; + } + } + else if(period_year && period_year.checked) + { + type_period = 'period_year'; + var years_list = $('the_year'); + if(years_list) + { + year = years_list.options[years_list.selectedIndex].value; + } + } + else if(period_month && period_month.checked) + { + type_period = 'period_month'; + var months_list = $('the_month'); + if(months_list) + { + month = months_list.options[months_list.selectedIndex].value; + } + } + else + { + error = 'empty_type_period'; + } + + if(type_period != '' && url && error == '') + { + new Ajax.Request(url, + { + method:'post', + parameters: { + id_report : report_id, + report_type : type_report, + period_type : type_period, + the_year : year, + the_month : month, + date_start : datestart, + date_fin : dateend + }, + onSuccess: function(answer){ + // alert(answer.responseText); + var div_to_fill = $('result_period_report'); + // console.log(div_to_fill); + if(div_to_fill) + { + div_to_fill.innerHTML = answer.responseText; + } + } + }); + } +} + +/** + * Launch the Ajax autocomplete object to activate autocompletion on a field + * + * @param path_script String Path to the Ajax script + **/ +function launch_autocompleter(path_script, id_text, id_div) +{ + var input = id_text ; + var div = id_div ; + + if( path_script) + { + // Ajax autocompleter object creation + new Ajax.Autocompleter(input, div, path_script, { + method:'get', + paramName:'Input', + minChars: 2 + }); + } + else + { + if(console != null) + { + console.log('error parameters launch_autocompleter function'); + } + else + { + alert('error parameters launch_autocompleter function'); + } + } +} +--> diff --git a/maarch_entreprise/trunk/js/indexing.js b/maarch_entreprise/trunk/js/indexing.js new file mode 100644 index 0000000000000000000000000000000000000000..b843d14937404c5fbae5843444f2e1500ad322db --- /dev/null +++ b/maarch_entreprise/trunk/js/indexing.js @@ -0,0 +1,700 @@ + +/** + * When you choose a doctype, you must calculate the process date limit (Ajax) and execute module services + * + * @param doctype_id String Document type identifier + * @param path_manage_script String Path to the php file called in the Ajax object + * @param error_empty_type String Error label displayed when the document type is empty + * @param action_id String Action identifier + **/ +function change_doctype(doctype_id, path_manage_script, error_empty_type, action_id, get_js_script) +{ + + if(doctype_id != null && doctype_id != '' && doctype_id != NaN) + { + new Ajax.Request(path_manage_script, + { + method:'post', + parameters: { type_id : doctype_id + }, + onSuccess: function(answer){ + eval("response = "+answer.responseText); + // alert(answer.responseText); + if(response.status == 0 ) + { + var process_date = $('process_limit_date'); + if(process_date != null) + { + process_date.value = response.process_date; + } + var services_to_exec = response.services; + var path_scripts = ''; + var call_func = ''; + + for(var ind=0; ind < services_to_exec.length;ind++) + { + path_scripts += services_to_exec[ind]['script'] + '$$'; + call_func += services_to_exec[ind]['function_to_execute']+'('+services_to_exec[ind]['arguments']+');'; + } + if(call_func != '' && path_scripts != '' && get_js_script != '') + { + new Ajax.Request(get_js_script, + { + method:'post', + parameters: + { + scripts : path_scripts + }, + onSuccess: function(answer){ + eval(answer.responseText+call_func); + } + }); + } + } + else + { + try{ + $('frm_error').innerHTML = response.error_txt; + } + catch(e){} + } + } + }); + } + else + { + try{ + $('frm_error_'+action_id).innerHTML = error_empty_type; + } + catch(e){} + } +} + +/** + * Activates / Desactivates the process date limit + * + * @param activate Bool Activate mode = true, desactivate mode = false + **/ +function activate_process_date(activate, display_value_tr) +{ + var process_date = $('process_limit_date_tr'); + var tr_display_value = display_value_tr || 'table-row'; + if(process_date != null) + { + if(activate == true) + { + Element.setStyle(process_date, {display : tr_display_value}); + //process_date.style.display = tr_display_value; + } + else + { + //process_date.style.display = 'none'; + Element.setStyle(process_date, {display : 'none'}); + } + } +} + +/** + * Adapts the indexing form with the category : loads the fields to display in a JSON object + * + * @param cat_id String Category identifier + **/ +function change_category(cat_id, display_value_tr, path_manage_script,get_js_script, params_cat) +{ + //Category = INCOMING + if(cat_id == 'incoming') + { + var category = [ + {id:'doctype_mail', type:'label', state:'display'}, + {id:'doctype_res', type:'label', state:'hide'}, + {id:'priority_tr', type:'tr', state:'display'}, + {id:'doc_date_label', type:'label', state:'hide'}, + {id:'mail_date_label', type:'label', state:'display'}, + {id:'author_tr', type:'tr', state:'hide'}, + {id:'admission_date_tr', type:'tr', state:'display'}, + {id:'nature_id_tr', type:'tr', state:'display'}, + {id:'label_dep_dest', type:'label', state:'display'}, + {id:'label_dep_exp', type:'label', state:'hide'}, + {id:'process_limit_date_use_tr', type:'tr', state:'display'}, + {id:'process_limit_date_tr', type:'tr', state:'display'}, + {id:'department_tr', type:'tr', state:'display'}, + {id:'box_id_tr', type:'tr', state:'display'}, + {id:'contact_choose_tr', type:'tr', state:'display'}, + {id:'dest_contact_choose_label', type:'label', state:'hide'}, + {id:'exp_contact_choose_label', type:'label', state:'display'}, + {id:'contact_id_tr', type:'tr', state:'display'}, + {id:'dest_contact', type:'label', state:'hide'}, + {id:'exp_contact', type:'label', state:'display'}, + {id:'type_contact_internal', type:'radiobutton', state:'not_checked'}, + {id:'type_contact_external', type:'radiobutton', state:'checked'}, + {id:'market_tr', type:'tr', state:'display'}, + {id:'project_tr', type:'tr', state:'display'}, + {id:'category_id_mandatory', type:'label', state:'display'}, + {id:'type_id_mandatory', type:'label', state:'display'}, + {id:'priority_mandatory', type:'label', state:'display'}, + {id:'doc_date_mandatory', type:'label', state:'display'}, + {id:'author_mandatory', type:'label', state:'hide'}, + {id:'admission_date_mandatory', type:'label', state:'display'}, + {id:'type_contact_mandatory', type:'label', state:'display'}, + {id:'contact_mandatory', type:'label', state:'display'}, + {id:'nature_id_mandatory', type:'label', state:'display'}, + {id:'subject_mandatory', type:'label', state:'display'}, + {id:'destination_mandatory', type:'label', state:'display'}, + {id:'arbox_id_mandatory', type:'label', state:'display'}, + {id:'process_limit_date_use_mandatory', type:'label', state:'display'}, + {id:'process_limit_date_mandatory', type:'label', state:'display'}, + {id:'market_mandatory', type:'label', state:'hide'}, + {id:'chrono_number', type:'label', state:'hide'}, + {id:'chrono_number_mandatory', type:'label', state:'hide'}, + {id:'chrono_number_tr', type:'tr', state:'hide'}, + {id:'project_mandatory', type:'label', state:'hide'} + ]; + } + //Category = OUTGOING + else if(cat_id == 'outgoing') + { + var category = [ + {id:'doctype_mail', type:'label', state:'display'}, + {id:'doctype_res', type:'label', state:'hide'}, + {id:'priority_tr', type:'tr', state:'display'}, + {id:'doc_date_label', type:'label', state:'hide'}, + {id:'mail_date_label', type:'label', state:'display'}, + {id:'author_tr', type:'tr', state:'hide'}, + {id:'admission_date_tr', type:'tr', state:'hide'}, + {id:'nature_id_tr', type:'tr', state:'display'}, + {id:'department_tr', type:'tr', state:'display'}, + {id:'label_dep_dest', type:'label', state:'hide'}, + {id:'label_dep_exp', type:'label', state:'display'}, + {id:'process_limit_date_use_tr', type:'tr', state:'display'}, + {id:'process_limit_date_tr', type:'tr', state:'display'}, + {id:'box_id_tr', type:'tr', state:'display'}, + {id:'contact_choose_tr', type:'tr', state:'display'}, + {id:'dest_contact_choose_label', type:'label', state:'display'}, + {id:'exp_contact_choose_label', type:'label', state:'hide'}, + {id:'contact_id_tr', type:'tr', state:'display'}, + {id:'dest_contact', type:'label', state:'display'}, + {id:'exp_contact', type:'label', state:'hide'}, + {id:'type_contact_internal', type:'radiobutton', state:'not_checked'}, + {id:'type_contact_external', type:'radiobutton', state:'checked'}, + {id:'market_tr', type:'tr', state:'display'}, + {id:'project_tr', type:'tr', state:'display'}, + {id:'category_id_mandatory', type:'label', state:'display'}, + {id:'type_id_mandatory', type:'label', state:'display'}, + {id:'priority_mandatory', type:'label', state:'display'}, + {id:'doc_date_mandatory', type:'label', state:'display'}, + {id:'author_mandatory', type:'label', state:'hide'}, + {id:'admission_date_mandatory', type:'label', state:'hide'}, + {id:'type_contact_mandatory', type:'label', state:'display'}, + {id:'contact_mandatory', type:'label', state:'display'}, + {id:'nature_id_mandatory', type:'label', state:'display'}, + {id:'subject_mandatory', type:'label', state:'display'}, + {id:'destination_mandatory', type:'label', state:'display'}, + {id:'arbox_id_mandatory', type:'label', state:'display'}, + {id:'process_limit_date_use_mandatory', type:'label', state:'display'}, + {id:'process_limit_date_mandatory', type:'label', state:'display'}, + {id:'market_mandatory', type:'label', state:'hide'}, + {id:'chrono_number', type:'label', state:'display'}, + {id:'chrono_number_tr', type:'tr', state:'display'}, + {id:'chrono_number_mandatory', type:'label', state:'display'}, + {id:'project_mandatory', type:'label', state:'display'} + ]; + } + //Category = INTERNAL + else if(cat_id == 'internal') + { + var category = [ + {id:'doctype_mail', type:'label', state:'display'}, + {id:'doctype_res', type:'label', state:'hide'}, + {id:'priority_tr', type:'tr', state:'display'}, + {id:'doc_date_label', type:'label', state:'hide'}, + {id:'mail_date_label', type:'label', state:'display'}, + {id:'author_tr', type:'tr', state:'hide'}, + {id:'admission_date_tr', type:'tr', state:'hide'}, + {id:'nature_id_tr', type:'tr', state:'display'}, + {id:'department_tr', type:'tr', state:'display'}, + {id:'label_dep_dest', type:'label', state:'display'}, + {id:'label_dep_exp', type:'label', state:'hide'}, + {id:'process_limit_date_use_tr', type:'tr', state:'display'}, + {id:'process_limit_date_tr', type:'tr', state:'display'}, + {id:'box_id_tr', type:'tr', state:'display'}, + {id:'contact_choose_tr', type:'tr', state:'display'}, + {id:'dest_contact_choose_label', type:'label', state:'hide'}, + {id:'exp_contact_choose_label', type:'label', state:'display'}, + {id:'contact_id_tr', type:'tr', state:'display'}, + {id:'dest_contact', type:'label', state:'hide'}, + {id:'exp_contact', type:'label', state:'display'}, + {id:'type_contact_internal', type:'radiobutton', state:'checked'}, + {id:'type_contact_external', type:'radiobutton', state:'not_checked'}, + {id:'market_tr', type:'tr', state:'display'}, + {id:'project_tr', type:'tr', state:'display'}, + {id:'category_id_mandatory', type:'label', state:'display'}, + {id:'type_id_mandatory', type:'label', state:'display'}, + {id:'priority_mandatory', type:'label', state:'display'}, + {id:'doc_date_mandatory', type:'label', state:'display'}, + {id:'author_mandatory', type:'label', state:'hide'}, + {id:'admission_date_mandatory', type:'label', state:'hide'}, + {id:'type_contact_mandatory', type:'label', state:'display'}, + {id:'contact_mandatory', type:'label', state:'display'}, + {id:'nature_id_mandatory', type:'label', state:'display'}, + {id:'subject_mandatory', type:'label', state:'display'}, + {id:'destination_mandatory', type:'label', state:'display'}, + {id:'arbox_id_mandatory', type:'label', state:'display'}, + {id:'process_limit_date_use_mandatory', type:'label', state:'display'}, + {id:'process_limit_date_mandatory', type:'label', state:'display'}, + {id:'market_mandatory', type:'label', state:'hide'}, + {id:'chrono_number', type:'label', state:'hide'}, + {id:'chrono_number_tr', type:'tr', state:'hide'}, + {id:'chrono_number_mandatory', type:'label', state:'hide'}, + {id:'project_mandatory', type:'label', state:'hide'} + ]; + } + //Category = MARKET_DOCUMENT + else if(cat_id == 'market_document') + { + var category = [ + {id:'doctype_mail', type:'label', state:'hide'}, + {id:'doctype_res', type:'label', state:'display'}, + {id:'priority_tr', type:'tr', state:'hide'}, + {id:'doc_date_label', type:'label', state:'display'}, + {id:'mail_date_label', type:'label', state:'hide'}, + {id:'author_tr', type:'tr', state:'display'}, + {id:'admission_date_tr', type:'tr', state:'hide'}, + {id:'nature_id_tr', type:'tr', state:'hide'}, + {id:'department_tr', type:'tr', state:'hide'}, + {id:'process_limit_date_use_tr', type:'tr', state:'hide'}, + {id:'process_limit_date_tr', type:'tr', state:'hide'}, + {id:'diff_list_tr', type:'tr', state:'hide'}, + {id:'box_id_tr', type:'tr', state:'display'}, + {id:'contact_choose_tr', type:'tr', state:'hide'}, + {id:'contact_id_tr', type:'tr', state:'hide'}, + {id:'market_tr', type:'tr', state:'display'}, + {id:'project_tr', type:'tr', state:'display'}, + {id:'category_id_mandatory', type:'label', state:'display'}, + {id:'type_id_mandatory', type:'label', state:'display'}, + {id:'priority_mandatory', type:'label', state:'hide'}, + {id:'doc_date_mandatory', type:'label', state:'display'}, + {id:'author_mandatory', type:'label', state:'display'}, + {id:'admission_date_mandatory', type:'label', state:'hide'}, + {id:'type_contact_mandatory', type:'label', state:'hide'}, + {id:'contact_mandatory', type:'label', state:'hide'}, + {id:'nature_id_mandatory', type:'label', state:'hide'}, + {id:'subject_mandatory', type:'label', state:'display'}, + {id:'destination_mandatory', type:'label', state:'hide'}, + {id:'arbox_id_mandatory', type:'label', state:'display'}, + {id:'process_limit_date_use_mandatory', type:'label', state:'hide'}, + {id:'process_limit_date_mandatory', type:'label', state:'hide'}, + {id:'market_mandatory', type:'label', state:'hide'}, + {id:'chrono_number', type:'label', state:'hide'}, + {id:'chrono_number_tr', type:'tr', state:'hide'}, + {id:'chrono_number_mandatory', type:'label', state:'hide'}, + {id:'project_mandatory', type:'label', state:'display'} + ]; + } + if(params_cat) + { + process_category(category, display_value_tr, params_cat); + } + else + { + process_category(category, display_value_tr); + } + + + + if(cat_id != null && cat_id != '' && cat_id != NaN) + { + //Read the actual box for this category + //change_box(cat_id); + new Ajax.Request(path_manage_script, + { + method:'post', + parameters: { category_id : cat_id + }, + onSuccess: function(answer){ + eval("response = "+answer.responseText); + //~ console.log('1 '+answer.responseText); + //~ console.log('2 '+response); + if(response.status == 0 ) + { + var services_to_exec = response.services; + //console.log('3 '+print_r(services_to_exec)); + var path_scripts = ''; + var call_func = ''; + + for(var ind=0; ind < services_to_exec.length;ind++) + { + path_scripts += services_to_exec[ind]['script'] + '$$'; + call_func += services_to_exec[ind]['function_to_execute']+'('+services_to_exec[ind]['arguments']+');'; + } + //console.log(get_js_script); + if(call_func != '' && path_scripts != '' && get_js_script != '') + { + //console.log('OK'); + new Ajax.Request(get_js_script, + { + method:'post', + parameters: + { + scripts : path_scripts + }, + onSuccess: function(answer){ + //console.log(answer.responseText+call_func); + eval(answer.responseText+call_func); + } + }); + } + } + else + { + try{ + $('frm_error').innerHTML = response.error_txt; + } + catch(e){} + } + } + }); + } +} + +/** + * Shows all the required fields and labels for the category and hides all the others + * + * @param category String JSON Object of the fields to display + **/ +function process_category(category, display_value_tr, params_cat) +{ + var tr_display_val = display_value_tr || 'table-row'; + var no_param = true; + if(params_cat) + { + no_param = false; + } + if(category != null && category.length > 0) + { + for(var i=0; i < category.length; i++) + { + var item = $(category[i]['id']); + if(item != null) + { + if(category[i]['state'] == 'hide' ) + { + Element.setStyle(item, {display : 'none'}); + //item.style.display = 'none'; + } + else if(category[i]['state'] == 'display') + { + if(category[i]['type'] == 'label') + { + Element.setStyle(item, {display : 'inline'}); + //item.style.display = 'inline'; + } + else if(category[i]['type'] == 'tr') + { + Element.setStyle(item, {display : tr_display_val}); + //item.style.display = tr_display_val; + } + } + else if(category[i]['state'] == 'checked') + { + item.checked = true; + //~ if( no_param || typeof(params_cat[category[i]['id']]) == undefined || typeof(params_cat[category[i]['id']]['onchange']) == undefined || params_cat[category[i]['id']]['onchange'] == true ) + //~ { + //~ item.onchange(); + //~ } + if( no_param || typeof(params_cat[category[i]['id']]) == undefined || typeof(params_cat[category[i]['id']]['onclick']) == undefined || params_cat[category[i]['id']]['onclick'] == true ) + { + item.onclick(); + } + } + else if(category[i]['state'] == 'not_checked') + { + item.checked = false; + } + } + } + } +} +/** Declaration of the autocompleter object used for the contacts*/ +var contact_autocompleter; + +/** + * Launch the Ajax autocomplete object to activate autocompletion on contacts + * + * @param path_script String Path to the Ajax script + **/ +function launch_autocompleter_contacts(path_script, id_text, id_div) +{ + var input = id_text || 'contact'; + var div = id_div || 'show_contacts'; + // Get the parameters + var params = get_contacts_params(); + // If the object already exists, we delete it to avoid conflict + try + { + delete contact_autocompleter; + } + catch(e){ } + + if( path_script) + { + // Ajax autocompleter object creation + contact_autocompleter = new Ajax.Autocompleter(input, div, path_script, { + method:'get', + paramName:'Input', + parameters: params, + minChars: 2 + }); + } + else + { + if(console != null) + { + console.log('error parameters launch_autocompleter_contacts function'); + } + else + { + alert('error parameters launch_autocompleter_contacts function'); + } + } +} + +/** + * Gets the parameters for the contacts : the table which must be use in the ajax script + * + * @return String parameters + **/ +function get_contacts_params(name_radio) +{ + var check = name_radio || 'type_contact'; + var arr = get_checked_values(check); + var params = ''; + if(arr.length == 0) + { + if(console != null) + { + console.log('Erreur get_contacts_params, no items checked'); + } + else + { + alert('Erreur get_contacts_params, no items checked'); + } + } + else + { + if(arr[0] == 'internal') + { + params = 'table=users'; + } + else if(arr[0] == 'external') + { + params = 'table=contacts'; + } + } + return params; +} + +/** + * Update the parameters of the contact_autocompleter object + * + **/ +function update_contact_autocompleter() +{ + var params = get_contacts_params(); + if( contact_autocompleter ) + { + var old_param = contact_autocompleter.options.defaultParams; + var new_param =old_param.substring(0, old_param.indexOf('table=') -1) ; + if(new_param && new_param !='') + { + new_param += '&'+params; + } + else + { + new_param = params; + } + contact_autocompleter.options.defaultParams = new_param; + } +} + +/** + * Open in a popup the contact or user card + * + * @param path_contact_card String Path to the contact card + * @param path_user_card String Path to the user card + **/ +function open_contact_card(path_contact_card,path_user_card) +{ + var contact_value = $('contact').value; + var arr = get_checked_values('type_contact'); + if(arr.length == 0) + { + if(console != null) + { + console.log('Erreur launch_autocompleter_contacts, no items checked'); + } + else + { + alert('Erreur launch_autocompleter_contacts, no items checked'); + } + } + else + { + var contact_id = contact_value.substring(contact_value.indexOf('(')+1, contact_value.indexOf(')')); + + if(arr[0] == 'internal') + { + window.open(path_user_card+'?id='+contact_id, 'contact_info', 'height=450, width=600,scrollbars=no,resizable=yes'); + } + else if(arr[0] == 'external') + { + window.open(path_contact_card+'?mode=view&id='+contact_id, 'contact_info', 'height=600, width=600,scrollbars=yes,resizable=yes'); + } + } +} + +function create_contact(path_create, id_action) +{ + $('type_contact_external').checked = true; + $('type_contact_external').onclick(); + //window.open(path_create+'?mode=add', 'contact_info', 'height=600, width=600,scrollbars=no,resizable=yes'); + //alert('create'); + var contact_frm = $('indexingfrmcontact'); + if(contact_frm) + { + var corporate = 'Y' ; + if($('is_corporate_N').checked == true) + { + corporate = 'N' ; + } + var title_val = $('title').value; + var society_val = $('society').value; + var phone_val = $('phone').value; + var mail_val = $('mail').value; + var num_val = $('num').value; + var street_val = $('street').value; + var add_comp_val = $('add_comp').value; + var cp_val = $('cp').value; + var town_val = $('town').value; + var country_val = $('country').value; + var comp_data_val = $('comp_data').value; + var lastname_val = $('lastname').value; + var firstname_val = $('firstname').value; + var func_val = $('function').value; + + new Ajax.Request(path_create, + { + method:'post', + parameters: { + is_corporate : corporate, + title : title_val, + society : society_val, + phone : phone_val, + mail : mail_val, + num : num_val, + street : street_val, + add_comp : add_comp_val, + cp : cp_val, + town : town_val, + country : country_val, + comp_data : comp_data_val, + lastname : lastname_val, + firstname : firstname_val, + func : func_val + }, + onSuccess: function(answer){ + eval("response = "+answer.responseText); + // alert(answer.responseText); + if(response.status == 0 ) + { + var contact = $('contact'); + if(contact) + { + contact.value = response.value; + $('contact_card').style.visibility = 'visible'; + new Effect.toggle('create_contact_div', 'blind', {delay:0.2}); + clear_form('indexingfrmcontact'); + } + } + else + { + try{ + $('frm_error_'+id_action).innerHTML = response.error_txt; + } + catch(e){} + } + } + }); + } + +} + +/** + * When you change the contact type, the table used for the autocompletion change + * + * @param path_autocomplete String Path to the Ajax script + **/ +function change_contact_type(path_autocomplete, empty_contact_div, id_internal, id_external, id_contact) +{ + var contact_id = id_contact || 'contact'; + var external_type = id_external || 'type_contact_external'; + var internal_type = id_internal || 'type_contact_internal'; + var create_contact = $('create_contact'); + var contact_card = $('contact_card'); + if(typeof(empty_contact_div) == 'undefined' || empty_contact_div == null) + { + var empty_contact = true ; + } + else + { + var empty_contact = empty_contact_div ; + } + if(create_contact) + { + if($(internal_type).checked == true) + { + Element.setStyle(create_contact, {display : 'none'}); + //create_contact.style.display = 'none'; + } + else if($(external_type ).checked == true) + { + Element.setStyle(create_contact, {display : 'inline'}); + //create_contact.style.display = 'inline'; + } + } + if(empty_contact) + { + $(contact_id).value=''; + } + display_contact_card('hidden'); + update_contact_autocompleter(); +} + +function init_validation(path_autocomplete_contact, display_value_tr, path_manage_script, get_js_script) +{ + var param_cat = {'type_contact_internal' : {'onclick' : false} , 'type_contact_external' : {'onclick' : false}}; + change_category($('category_id').value, display_value_tr,path_manage_script,get_js_script, param_cat); + change_contact_type(path_autocomplete_contact, false); + $('contact').onchange(); + $('destination').onchange(); + $('market').onchange(); +} + +function clear_error(id_error) +{ + //console.log("'"+id_error+"'"); + var error_div = $(id_error); + //console.log(error_div); + if(error_div) + { + error_div.update(); + } +} + +function display_contact_card(mode) +{ + var contact_card = $('contact_card'); + if(contact_card && (mode == 'hidden' || mode == 'visible')) + { + Element.setStyle(contact_card, {visibility : mode}); + } +} diff --git a/maarch_entreprise/trunk/js/maarch.js b/maarch_entreprise/trunk/js/maarch.js new file mode 100644 index 0000000000000000000000000000000000000000..2de0250ddc9924640bc737d25dca4a0b2004386f --- /dev/null +++ b/maarch_entreprise/trunk/js/maarch.js @@ -0,0 +1,173 @@ +<!-- +// Fonction pour gérer les changements dynamiques de sous-menu. +// Prend en variable le numéro du sous-menu à afficher. + +function ChangeMenu(idsm){ + if(document.getElementById("sm"+idsm).style.visibility!='visible'){ // si le sous-menu est déjà affiché, on ne fait rien. Sinon : + for(i=1;i<=7;i++){ // boucle pour détécter quel menu est affiché + if(document.getElementById("sm"+i).style.visibility=='visible'){ + ActiveSM=i + break; + } + } + document.getElementById("sm"+ActiveSM).style.visibility='hidden' // on cache le sous menu affiché + document.getElementById("sm"+idsm).style.visibility='visible' // on affiche le nouveau + } +} + +function ChangeH2(objet){ + if(objet.getElementsByTagName('img')[0].src.indexOf("plus")>-1){ + objet.getElementsByTagName('img')[0].src="img/moins.png"; + objet.getElementsByTagName('span')[0].firstChild.nodeValue=" "; + }else{ + objet.getElementsByTagName('img')[0].src="img/plus.png"; + objet.getElementsByTagName('span')[0].firstChild.nodeValue=" "; + } +} + +function Change2H2(objet){ + if(objet.getElementsByTagName('img')[0].src.indexOf("folderopen")>-1){ + objet.getElementsByTagName('img')[0].src="img/folder.gif"; + objet.getElementsByTagName('span')[0].firstChild.nodeValue=" "; + }else{ + objet.getElementsByTagName('img')[0].src="img/folderopen.gif"; + objet.getElementsByTagName('span')[0].firstChild.nodeValue=" "; + } +} + +function afficheCalque(calque){ + calque.style.display='block'; +} +function masqueCalque(calque){ + calque.style.display='none'; +} + +function getScrollXY() { + var scrOfX = 0, scrOfY = 0; + if( typeof( window.pageYOffset ) == 'number' ) { + //Netscape compliant + scrOfY = window.pageYOffset; + scrOfX = window.pageXOffset; + } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { + //DOM compliant + scrOfY = document.body.scrollTop; + scrOfX = document.body.scrollLeft; + } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { + //IE6 standards compliant mode + scrOfY = document.documentElement.scrollTop; + scrOfX = document.documentElement.scrollLeft; + } + return new Array(scrOfX,scrOfY); +} + +function afficheImage(nom){ + var idCalque=document.getElementById('lb1-layer'); + var idIMG=document.getElementById('lb1-img'); + + idCalque.style.width=document.getElementsByTagName('html')[0].offsetWidth+"px"; + idCalque.style.height=document.getElementsByTagName('body')[0].offsetHeight+"px"; + idIMG.style.width=idCalque.style.width; + idIMG.style.marginTop=getScrollXY()[1]+15+'px'; + + + afficheCalque(idCalque); + afficheCalque(idIMG); + idIMG.innerHTML="<span style='color:white;font-weight:bold'>Cliquez sur l'image pour fermer</span><br /><br /><img src=\"img/lb1/"+nom+"\" id=\"lb1-image\" onclick=\"masqueCalque(document.getElementById('lb1-layer'));masqueCalque(document.getElementById('lb1-img'));\" />"; +} + +function DetailsOn(objet){ + objet.style.visibility="visible"; +} +function DetailsOff(objet){ + objet.style.visibility="hidden"; +} + +var initialized = 0; +var etat = new Array(); + +function reinit() +{ + initialized = 0; + etat = new Array(); +} + +function initialise(){ + for (i=0;i<500;i++){ + etat[i] = new Array(); + etat[i]["h2"] = document.getElementById('h2'+i); + etat[i]["desc"] = document.getElementById('desc'+i); + etat[i]["etat"] = 0; + } + initialized = 1; +} + +function ferme(id){ + Effect.SlideUp(etat[id]["desc"]); + ChangeH2(etat[id]["h2"]); + etat[id]["etat"] = 0; +} + +function ouvre(id){ + Effect.SlideDown(etat[id]["desc"]); + ChangeH2(etat[id]["h2"]) + etat[id]["etat"] = 1; +} + +function ferme2(id){ + Effect.SlideUp(etat[id]["desc"]); + Change2H2(etat[id]["h2"]); + etat[id]["etat"] = 0; +} + +function ouvre2(id){ + Effect.SlideDown(etat[id]["desc"]); + Change2H2(etat[id]["h2"]) + etat[id]["etat"] = 1; +} + +function change(id){ + if (!initialized ){ + initialise() + } + //alert(etat[id]["etat"]); + if (etat[id]["etat"]){ + ferme(id); + }else{ + for (i=0;i<etat.length;i++){ + if (etat[i]["etat"]){ + ferme(i); + } + } + ouvre(id); + } +} + +function change2(id){ + if (!initialized){ + initialise() + } + if (etat[id]["etat"]){ + ferme2(id); + }else{ + for (i=0;i<etat.length;i++){ + if (etat[i]["etat"]){ + //ferme(i); + } + } + ouvre2(id); + } +} + +function affDetails(obj){ + document.getElementById("conteneurDetails").innerHTML = obj.parentNode.parentNode.getElementsByTagName("div")[0].innerHTML; +} + +function show_special_form(id, var_visible) +{ + var elem = window.document.getElementById(id); + if(elem != null) + { + elem.style.display = var_visible; + } +} +// --> \ No newline at end of file diff --git a/maarch_entreprise/trunk/js/protohuds.js b/maarch_entreprise/trunk/js/protohuds.js new file mode 100644 index 0000000000000000000000000000000000000000..7350daf020403a8c5e7ddc321c8980528891474b --- /dev/null +++ b/maarch_entreprise/trunk/js/protohuds.js @@ -0,0 +1,122 @@ +Protohud = Class.create(); +Protohud.prototype = { + ffSmooth : true, + overflowQ : null, + openHUD : null, + showHUD : null, + hideHUD : [], + tick : null, + root : null, + body : null, + trig : null, + allTrigs : null, + targ : null, + allTargs : null, + trigHite : null, + targHite : null, + initialize : function (root,fixPosition) { + this.root = $(root).cleanWhitespace().addClassName('protohud'); + this.body = this.root.up(); + while (this.body.nodeName !== "BODY") this.body = this.body.up(); + this.root.observe('click',this.swap.bindAsEventListener(this)); + this.allTrigs = this.root.childElements().findAll(function(trig){ + return trig.nodeName === this.root.childElements().first().nodeName; + }.bind(this)).invoke('addClassName','trig'); + this.trigHite = this.allTrigs.max(function(trig){return trig.getHeight();}); + this.allTargs = this.root.childElements().findAll(function(targ){ + return targ.nodeName === this.root.childElements().first().next().nodeName; + }.bind(this)).invoke('setStyle',{ + paddingTop : this.trigHite + 10 + 'px', + maxHeight : ((document.viewport.getHeight()/5)*3).ceil() + 'px', + overflow : 'hidden' + }).invoke('addClassName','targ'); + this.allTargs.each(function(targ){ + this.root.insert(targ); + }.bind(this)); + this.targHite = this.allTargs.max(function(targ){return targ.getHeight()}); + if (fixPosition) { + if (!window.isLTIE7) { + this.root.setStyle({position:'fixed'}); + } else { + this.root.setStyle({position:'absolute'}).addClassName('fixIE'); + } + } else { + this.root.up().setStyle({ + paddingTop:this.trigHite+'px' + }).setStyle({ + height:this.targHite+'px', + overflow:'hidden', + position:'relative', + zIndex:1 + }); + } + }, + swap : function (event) { + this.tick = clearInterval(this.tick); + this.trig = Event.element(event); + while (!this.allTrigs.include(this.trig) && this.trig.nodeName !== 'BODY') { + this.trig = this.trig.up(); + } + if (Prototype.Browser.Gecko && this.ffSmooth === true) {// HACK!! + this.overflowQ = $$('body *').findAll(function(lmnt){ + return document.defaultView + .getComputedStyle(lmnt,null) + .getPropertyValue('overflow') === 'auto'; + }).invoke('setStyle',{overflow:'hidden'}); + } + this.allTrigs.invoke('removeClassName','open'); + this.allTargs.invoke('removeClassName','open') + .invoke('setStyle',{overflow:'hidden',zIndex:1}); + this.targ = this.allTargs[this.allTrigs.indexOf(this.trig)]; + this.hideHUD = this.allTargs.findAll(function(targ){ + return targ !== this.targ; + }.bind(this)); + if (this.targ !== this.openHUD && this.targ !== this.showHUD) { + this.showHUD = this.targ; + this.trig.addClassName('open'); + this.targ.setStyle({zIndex:999}); + } else { + this.showHUD = null; + this.openHUD = null; + this.hideHUD.push(this.targ); + } + this.tick = setInterval(this.tock.bind(this),33); + }, + tock : function () { + var newBottom; + if (this.showHUD) { + if (this.showHUD.positionedOffset()[1] < 0 ) { + newBottom = this.targ.getHeight() + this.targ.positionedOffset()[1]; + newBottom = this.targ.getHeight() - newBottom; + newBottom = (newBottom / -9).floor(); + newBottom = (parseInt(this.showHUD.getStyle('bottom')) + newBottom) + 'px'; + this.showHUD.setStyle({bottom:newBottom}); + } else { + this.showHUD.setStyle({overflow:'',zIndex:1}); + this.openHUD = this.showHUD; + this.showHUD = null; + } + } + if (this.hideHUD.size() > 0) { + this.hideHUD.each(function(targ){ + if (targ.offsetTop > (targ.getHeight()*-1) ) { + newBottom = targ.getHeight() + targ.offsetTop; + newBottom = (newBottom / 9).ceil(); + newBottom = (parseInt(targ.getStyle('bottom')) + newBottom) + 'px'; + targ.setStyle({bottom:newBottom}); + } else { + targ.setStyle({bottom:''}); + if (this.openHUD === targ) this.openHUD = null; + this.hideHUD[this.hideHUD.indexOf(targ)] = null; + } + }.bind(this)); + } + this.hideHUD = this.hideHUD.compact(); + if (!this.showHUD && this.hideHUD.size() === 0) { + this.tick = clearInterval(this.tick); + if (Prototype.Browser.Gecko && this.overflowQ) {// HACK!! + this.overflowQ.invoke('setStyle',{overflow:''}); + } + } + } +}; diff --git a/maarch_entreprise/trunk/js/prototype.js b/maarch_entreprise/trunk/js/prototype.js new file mode 100644 index 0000000000000000000000000000000000000000..dfe8ab4e13652153903d481a1b006878df6a1f3b --- /dev/null +++ b/maarch_entreprise/trunk/js/prototype.js @@ -0,0 +1,4320 @@ +/* Prototype JavaScript framework, version 1.6.0.3 + * (c) 2005-2008 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * + *--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.6.0.3', + + Browser: { + IE: !!(window.attachEvent && + navigator.userAgent.indexOf('Opera') === -1), + Opera: navigator.userAgent.indexOf('Opera') > -1, + WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, + Gecko: navigator.userAgent.indexOf('Gecko') > -1 && + navigator.userAgent.indexOf('KHTML') === -1, + MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) + }, + + BrowserFeatures: { + XPath: !!document.evaluate, + SelectorsAPI: !!document.querySelector, + ElementExtensions: !!window.HTMLElement, + SpecificElementExtensions: + document.createElement('div')['__proto__'] && + document.createElement('div')['__proto__'] !== + document.createElement('form')['__proto__'] + }, + + ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, + + emptyFunction: function() { }, + K: function(x) { return x } +}; + +if (Prototype.Browser.MobileSafari) + Prototype.BrowserFeatures.SpecificElementExtensions = false; + + +/* Based on Alex Arnell's inheritance implementation. */ +var Class = { + create: function() { + var parent = null, properties = $A(arguments); + if (Object.isFunction(properties[0])) + parent = properties.shift(); + + function klass() { + this.initialize.apply(this, arguments); + } + + Object.extend(klass, Class.Methods); + klass.superclass = parent; + klass.subclasses = []; + + if (parent) { + var subclass = function() { }; + subclass.prototype = parent.prototype; + klass.prototype = new subclass; + parent.subclasses.push(klass); + } + + for (var i = 0; i < properties.length; i++) + klass.addMethods(properties[i]); + + if (!klass.prototype.initialize) + klass.prototype.initialize = Prototype.emptyFunction; + + klass.prototype.constructor = klass; + + return klass; + } +}; + +Class.Methods = { + addMethods: function(source) { + var ancestor = this.superclass && this.superclass.prototype; + var properties = Object.keys(source); + + if (!Object.keys({ toString: true }).length) + properties.push("toString", "valueOf"); + + for (var i = 0, length = properties.length; i < length; i++) { + var property = properties[i], value = source[property]; + if (ancestor && Object.isFunction(value) && + value.argumentNames().first() == "$super") { + var method = value; + value = (function(m) { + return function() { return ancestor[m].apply(this, arguments) }; + })(property).wrap(method); + + value.valueOf = method.valueOf.bind(method); + value.toString = method.toString.bind(method); + } + this.prototype[property] = value; + } + + return this; + } +}; + +var Abstract = { }; + +Object.extend = function(destination, source) { + for (var property in source) + destination[property] = source[property]; + return destination; +}; + +Object.extend(Object, { + inspect: function(object) { + try { + if (Object.isUndefined(object)) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : String(object); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + toJSON: function(object) { + var type = typeof object; + switch (type) { + case 'undefined': + case 'function': + case 'unknown': return; + case 'boolean': return object.toString(); + } + + if (object === null) return 'null'; + if (object.toJSON) return object.toJSON(); + if (Object.isElement(object)) return; + + var results = []; + for (var property in object) { + var value = Object.toJSON(object[property]); + if (!Object.isUndefined(value)) + results.push(property.toJSON() + ': ' + value); + } + + return '{' + results.join(', ') + '}'; + }, + + toQueryString: function(object) { + return $H(object).toQueryString(); + }, + + toHTML: function(object) { + return object && object.toHTML ? object.toHTML() : String.interpret(object); + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({ }, object); + }, + + isElement: function(object) { + return !!(object && object.nodeType == 1); + }, + + isArray: function(object) { + return object != null && typeof object == "object" && + 'splice' in object && 'join' in object; + }, + + isHash: function(object) { + return object instanceof Hash; + }, + + isFunction: function(object) { + return typeof object == "function"; + }, + + isString: function(object) { + return typeof object == "string"; + }, + + isNumber: function(object) { + return typeof object == "number"; + }, + + isUndefined: function(object) { + return typeof object == "undefined"; + } +}); + +Object.extend(Function.prototype, { + argumentNames: function() { + var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1] + .replace(/\s+/g, '').split(','); + return names.length == 1 && !names[0] ? [] : names; + }, + + bind: function() { + if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } + }, + + bindAsEventListener: function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [event || window.event].concat(args)); + } + }, + + curry: function() { + if (!arguments.length) return this; + var __method = this, args = $A(arguments); + return function() { + return __method.apply(this, args.concat($A(arguments))); + } + }, + + delay: function() { + var __method = this, args = $A(arguments), timeout = args.shift() * 1000; + return window.setTimeout(function() { + return __method.apply(__method, args); + }, timeout); + }, + + defer: function() { + var args = [0.01].concat($A(arguments)); + return this.delay.apply(this, args); + }, + + wrap: function(wrapper) { + var __method = this; + return function() { + return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); + } + }, + + methodize: function() { + if (this._methodized) return this._methodized; + var __method = this; + return this._methodized = function() { + return __method.apply(null, [this].concat($A(arguments))); + }; + } +}); + +Date.prototype.toJSON = function() { + return '"' + this.getUTCFullYear() + '-' + + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + + this.getUTCDate().toPaddedString(2) + 'T' + + this.getUTCHours().toPaddedString(2) + ':' + + this.getUTCMinutes().toPaddedString(2) + ':' + + this.getUTCSeconds().toPaddedString(2) + 'Z"'; +}; + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) { } + } + + return returnValue; + } +}; + +RegExp.prototype.match = RegExp.prototype.test; + +RegExp.escape = function(str) { + return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); +}; + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create({ + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + execute: function() { + this.callback(this); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.execute(); + } finally { + this.currentlyExecuting = false; + } + } + } +}); +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = Object.isUndefined(count) ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return String(this); + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = Object.isUndefined(truncation) ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : String(this); + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var self = arguments.callee; + self.text.data = this; + return self.div.innerHTML; + }, + + unescapeHTML: function() { + var div = new Element('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return { }; + + return match[1].split(separator || '&').inject({ }, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()); + var value = pair.length > 1 ? pair.join('=') : pair[0]; + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + times: function(count) { + return count < 1 ? '' : new Array(count + 1).join(this); + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { + var character = String.specialChar[match[0]]; + return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + }, + + toJSON: function() { + return this.inspect(true); + }, + + unfilterJSON: function(filter) { + return this.sub(filter || Prototype.JSONFilter, '#{1}'); + }, + + isJSON: function() { + var str = this; + if (str.blank()) return false; + str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); + return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); + }, + + evalJSON: function(sanitize) { + var json = this.unfilterJSON(); + try { + if (!sanitize || json.isJSON()) return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + }, + + include: function(pattern) { + return this.indexOf(pattern) > -1; + }, + + startsWith: function(pattern) { + return this.indexOf(pattern) === 0; + }, + + endsWith: function(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.lastIndexOf(pattern) === d; + }, + + empty: function() { + return this == ''; + }, + + blank: function() { + return /^\s*$/.test(this); + }, + + interpolate: function(object, pattern) { + return new Template(this, pattern).evaluate(object); + } +}); + +if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { + escapeHTML: function() { + return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + }, + unescapeHTML: function() { + return this.stripTags().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (Object.isFunction(replacement)) return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +}; + +String.prototype.parseQuery = String.prototype.toQueryParams; + +Object.extend(String.prototype.escapeHTML, { + div: document.createElement('div'), + text: document.createTextNode('') +}); + +String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text); + +var Template = Class.create({ + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + if (Object.isFunction(object.toTemplateReplacements)) + object = object.toTemplateReplacements(); + + return this.template.gsub(this.pattern, function(match) { + if (object == null) return ''; + + var before = match[1] || ''; + if (before == '\\') return match[2]; + + var ctx = object, expr = match[3]; + var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; + match = pattern.exec(expr); + if (match == null) return before; + + while (match != null) { + var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; + ctx = ctx[comp]; + if (null == ctx || '' == match[3]) break; + expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); + match = pattern.exec(expr); + } + + return before + String.interpret(ctx); + }); + } +}); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; + +var $break = { }; + +var Enumerable = { + each: function(iterator, context) { + var index = 0; + try { + this._each(function(value) { + iterator.call(context, value, index++); + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + }, + + eachSlice: function(number, iterator, context) { + var index = -number, slices = [], array = this.toArray(); + if (number < 1) return array; + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.collect(iterator, context); + }, + + all: function(iterator, context) { + iterator = iterator || Prototype.K; + var result = true; + this.each(function(value, index) { + result = result && !!iterator.call(context, value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator, context) { + iterator = iterator || Prototype.K; + var result = false; + this.each(function(value, index) { + if (result = !!iterator.call(context, value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator, context) { + iterator = iterator || Prototype.K; + var results = []; + this.each(function(value, index) { + results.push(iterator.call(context, value, index)); + }); + return results; + }, + + detect: function(iterator, context) { + var result; + this.each(function(value, index) { + if (iterator.call(context, value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator, context) { + var results = []; + this.each(function(value, index) { + if (iterator.call(context, value, index)) + results.push(value); + }); + return results; + }, + + grep: function(filter, iterator, context) { + iterator = iterator || Prototype.K; + var results = []; + + if (Object.isString(filter)) + filter = new RegExp(filter); + + this.each(function(value, index) { + if (filter.match(value)) + results.push(iterator.call(context, value, index)); + }); + return results; + }, + + include: function(object) { + if (Object.isFunction(this.indexOf)) + if (this.indexOf(object) != -1) return true; + + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inGroupsOf: function(number, fillWith) { + fillWith = Object.isUndefined(fillWith) ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + }, + + inject: function(memo, iterator, context) { + this.each(function(value, index) { + memo = iterator.call(context, memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator, context) { + iterator = iterator || Prototype.K; + var result; + this.each(function(value, index) { + value = iterator.call(context, value, index); + if (result == null || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator, context) { + iterator = iterator || Prototype.K; + var result; + this.each(function(value, index) { + value = iterator.call(context, value, index); + if (result == null || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator, context) { + iterator = iterator || Prototype.K; + var trues = [], falses = []; + this.each(function(value, index) { + (iterator.call(context, value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator, context) { + var results = []; + this.each(function(value, index) { + if (!iterator.call(context, value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator, context) { + return this.map(function(value, index) { + return { + value: value, + criteria: iterator.call(context, value, index) + }; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.map(); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (Object.isFunction(args.last())) + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + size: function() { + return this.toArray().length; + }, + + inspect: function() { + return '#<Enumerable:' + this.toArray().inspect() + '>'; + } +}; + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + filter: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray, + every: Enumerable.all, + some: Enumerable.any +}); +function $A(iterable) { + if (!iterable) return []; + if (iterable.toArray) return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; +} + +if (Prototype.Browser.WebKit) { + $A = function(iterable) { + if (!iterable) return []; + // In Safari, only use the `toArray` method if it's not a NodeList. + // A NodeList is a function, has an function `item` property, and a numeric + // `length` property. Adapted from Google Doctype. + if (!(typeof iterable === 'function' && typeof iterable.length === + 'number' && typeof iterable.item === 'function') && iterable.toArray) + return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; + }; +} + +Array.from = $A; + +Object.extend(Array.prototype, Enumerable); + +if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0, length = this.length; i < length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(Object.isArray(value) ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + reduce: function() { + return this.length > 1 ? this : this[0]; + }, + + uniq: function(sorted) { + return this.inject([], function(array, value, index) { + if (0 == index || (sorted ? array.last() != value : !array.include(value))) + array.push(value); + return array; + }); + }, + + intersect: function(array) { + return this.uniq().findAll(function(item) { + return array.detect(function(value) { return item === value }); + }); + }, + + clone: function() { + return [].concat(this); + }, + + size: function() { + return this.length; + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + }, + + toJSON: function() { + var results = []; + this.each(function(object) { + var value = Object.toJSON(object); + if (!Object.isUndefined(value)) results.push(value); + }); + return '[' + results.join(', ') + ']'; + } +}); + +// use native browser JS 1.6 implementation if available +if (Object.isFunction(Array.prototype.forEach)) + Array.prototype._each = Array.prototype.forEach; + +if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) { + i || (i = 0); + var length = this.length; + if (i < 0) i = length + i; + for (; i < length; i++) + if (this[i] === item) return i; + return -1; +}; + +if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) { + i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; + var n = this.slice(0, i).reverse().indexOf(item); + return (n < 0) ? n : i - n - 1; +}; + +Array.prototype.toArray = Array.prototype.clone; + +function $w(string) { + if (!Object.isString(string)) return []; + string = string.strip(); + return string ? string.split(/\s+/) : []; +} + +if (Prototype.Browser.Opera){ + Array.prototype.concat = function() { + var array = []; + for (var i = 0, length = this.length; i < length; i++) array.push(this[i]); + for (var i = 0, length = arguments.length; i < length; i++) { + if (Object.isArray(arguments[i])) { + for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) + array.push(arguments[i][j]); + } else { + array.push(arguments[i]); + } + } + return array; + }; +} +Object.extend(Number.prototype, { + toColorPart: function() { + return this.toPaddedString(2, 16); + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator, context) { + $R(0, this, true).each(iterator, context); + return this; + }, + + toPaddedString: function(length, radix) { + var string = this.toString(radix || 10); + return '0'.times(length - string.length) + string; + }, + + toJSON: function() { + return isFinite(this) ? this.toString() : 'null'; + } +}); + +$w('abs round ceil floor').each(function(method){ + Number.prototype[method] = Math[method].methodize(); +}); +function $H(object) { + return new Hash(object); +}; + +var Hash = Class.create(Enumerable, (function() { + + function toQueryPair(key, value) { + if (Object.isUndefined(value)) return key; + return key + '=' + encodeURIComponent(String.interpret(value)); + } + + return { + initialize: function(object) { + this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); + }, + + _each: function(iterator) { + for (var key in this._object) { + var value = this._object[key], pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + }, + + set: function(key, value) { + return this._object[key] = value; + }, + + get: function(key) { + // simulating poorly supported hasOwnProperty + if (this._object[key] !== Object.prototype[key]) + return this._object[key]; + }, + + unset: function(key) { + var value = this._object[key]; + delete this._object[key]; + return value; + }, + + toObject: function() { + return Object.clone(this._object); + }, + + keys: function() { + return this.pluck('key'); + }, + + values: function() { + return this.pluck('value'); + }, + + index: function(value) { + var match = this.detect(function(pair) { + return pair.value === value; + }); + return match && match.key; + }, + + merge: function(object) { + return this.clone().update(object); + }, + + update: function(object) { + return new Hash(object).inject(this, function(result, pair) { + result.set(pair.key, pair.value); + return result; + }); + }, + + toQueryString: function() { + return this.inject([], function(results, pair) { + var key = encodeURIComponent(pair.key), values = pair.value; + + if (values && typeof values == 'object') { + if (Object.isArray(values)) + return results.concat(values.map(toQueryPair.curry(key))); + } else results.push(toQueryPair(key, values)); + return results; + }).join('&'); + }, + + inspect: function() { + return '#<Hash:{' + this.map(function(pair) { + return pair.map(Object.inspect).join(': '); + }).join(', ') + '}>'; + }, + + toJSON: function() { + return Object.toJSON(this.toObject()); + }, + + clone: function() { + return new Hash(this); + } + } +})()); + +Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; +Hash.from = $H; +var ObjectRange = Class.create(Enumerable, { + initialize: function(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + }, + + _each: function(iterator) { + var value = this.start; + while (this.include(value)) { + iterator(value); + value = value.succ(); + } + }, + + include: function(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } +}); + +var $R = function(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +}; + +var Ajax = { + getTransport: function() { + return Try.these( + function() {return new XMLHttpRequest()}, + function() {return new ActiveXObject('Msxml2.XMLHTTP')}, + function() {return new ActiveXObject('Microsoft.XMLHTTP')} + ) || false; + }, + + activeRequestCount: 0 +}; + +Ajax.Responders = { + responders: [], + + _each: function(iterator) { + this.responders._each(iterator); + }, + + register: function(responder) { + if (!this.include(responder)) + this.responders.push(responder); + }, + + unregister: function(responder) { + this.responders = this.responders.without(responder); + }, + + dispatch: function(callback, request, transport, json) { + this.each(function(responder) { + if (Object.isFunction(responder[callback])) { + try { + responder[callback].apply(responder, [request, transport, json]); + } catch (e) { } + } + }); + } +}; + +Object.extend(Ajax.Responders, Enumerable); + +Ajax.Responders.register({ + onCreate: function() { Ajax.activeRequestCount++ }, + onComplete: function() { Ajax.activeRequestCount-- } +}); + +Ajax.Base = Class.create({ + initialize: function(options) { + this.options = { + method: 'post', + asynchronous: true, + contentType: 'application/x-www-form-urlencoded', + encoding: 'UTF-8', + parameters: '', + evalJSON: true, + evalJS: true + }; + Object.extend(this.options, options || { }); + + this.options.method = this.options.method.toLowerCase(); + + if (Object.isString(this.options.parameters)) + this.options.parameters = this.options.parameters.toQueryParams(); + else if (Object.isHash(this.options.parameters)) + this.options.parameters = this.options.parameters.toObject(); + } +}); + +Ajax.Request = Class.create(Ajax.Base, { + _complete: false, + + initialize: function($super, url, options) { + $super(options); + this.transport = Ajax.getTransport(); + this.request(url); + }, + + request: function(url) { + this.url = url; + this.method = this.options.method; + var params = Object.clone(this.options.parameters); + + if (!['get', 'post'].include(this.method)) { + // simulate other verbs over post + params['_method'] = this.method; + this.method = 'post'; + } + + this.parameters = params; + + if (params = Object.toQueryString(params)) { + // when GET, append parameters to URL + if (this.method == 'get') + this.url += (this.url.include('?') ? '&' : '?') + params; + else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) + params += '&_='; + } + + try { + var response = new Ajax.Response(this); + if (this.options.onCreate) this.options.onCreate(response); + Ajax.Responders.dispatch('onCreate', this, response); + + this.transport.open(this.method.toUpperCase(), this.url, + this.options.asynchronous); + + if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); + + this.transport.onreadystatechange = this.onStateChange.bind(this); + this.setRequestHeaders(); + + this.body = this.method == 'post' ? (this.options.postBody || params) : null; + this.transport.send(this.body); + + /* Force Firefox to handle ready state 4 for synchronous requests */ + if (!this.options.asynchronous && this.transport.overrideMimeType) + this.onStateChange(); + + } + catch (e) { + this.dispatchException(e); + } + }, + + onStateChange: function() { + var readyState = this.transport.readyState; + if (readyState > 1 && !((readyState == 4) && this._complete)) + this.respondToReadyState(this.transport.readyState); + }, + + setRequestHeaders: function() { + var headers = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-Prototype-Version': Prototype.Version, + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + }; + + if (this.method == 'post') { + headers['Content-type'] = this.options.contentType + + (this.options.encoding ? '; charset=' + this.options.encoding : ''); + + /* Force "Connection: close" for older Mozilla browsers to work + * around a bug where XMLHttpRequest sends an incorrect + * Content-length header. See Mozilla Bugzilla #246651. + */ + if (this.transport.overrideMimeType && + (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) + headers['Connection'] = 'close'; + } + + // user-defined headers + if (typeof this.options.requestHeaders == 'object') { + var extras = this.options.requestHeaders; + + if (Object.isFunction(extras.push)) + for (var i = 0, length = extras.length; i < length; i += 2) + headers[extras[i]] = extras[i+1]; + else + $H(extras).each(function(pair) { headers[pair.key] = pair.value }); + } + + for (var name in headers) + this.transport.setRequestHeader(name, headers[name]); + }, + + success: function() { + var status = this.getStatus(); + return !status || (status >= 200 && status < 300); + }, + + getStatus: function() { + try { + return this.transport.status || 0; + } catch (e) { return 0 } + }, + + respondToReadyState: function(readyState) { + var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); + + if (state == 'Complete') { + try { + this._complete = true; + (this.options['on' + response.status] + || this.options['on' + (this.success() ? 'Success' : 'Failure')] + || Prototype.emptyFunction)(response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + var contentType = response.getHeader('Content-type'); + if (this.options.evalJS == 'force' + || (this.options.evalJS && this.isSameOrigin() && contentType + && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) + this.evalResponse(); + } + + try { + (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); + Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + if (state == 'Complete') { + // avoid memory leak in MSIE: clean up + this.transport.onreadystatechange = Prototype.emptyFunction; + } + }, + + isSameOrigin: function() { + var m = this.url.match(/^\s*https?:\/\/[^\/]*/); + return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ + protocol: location.protocol, + domain: document.domain, + port: location.port ? ':' + location.port : '' + })); + }, + + getHeader: function(name) { + try { + return this.transport.getResponseHeader(name) || null; + } catch (e) { return null } + }, + + evalResponse: function() { + try { + return eval((this.transport.responseText || '').unfilterJSON()); + } catch (e) { + this.dispatchException(e); + } + }, + + dispatchException: function(exception) { + (this.options.onException || Prototype.emptyFunction)(this, exception); + Ajax.Responders.dispatch('onException', this, exception); + } +}); + +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + +Ajax.Response = Class.create({ + initialize: function(request){ + this.request = request; + var transport = this.transport = request.transport, + readyState = this.readyState = transport.readyState; + + if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { + this.status = this.getStatus(); + this.statusText = this.getStatusText(); + this.responseText = String.interpret(transport.responseText); + this.headerJSON = this._getHeaderJSON(); + } + + if(readyState == 4) { + var xml = transport.responseXML; + this.responseXML = Object.isUndefined(xml) ? null : xml; + this.responseJSON = this._getResponseJSON(); + } + }, + + status: 0, + statusText: '', + + getStatus: Ajax.Request.prototype.getStatus, + + getStatusText: function() { + try { + return this.transport.statusText || ''; + } catch (e) { return '' } + }, + + getHeader: Ajax.Request.prototype.getHeader, + + getAllHeaders: function() { + try { + return this.getAllResponseHeaders(); + } catch (e) { return null } + }, + + getResponseHeader: function(name) { + return this.transport.getResponseHeader(name); + }, + + getAllResponseHeaders: function() { + return this.transport.getAllResponseHeaders(); + }, + + _getHeaderJSON: function() { + var json = this.getHeader('X-JSON'); + if (!json) return null; + json = decodeURIComponent(escape(json)); + try { + return json.evalJSON(this.request.options.sanitizeJSON || + !this.request.isSameOrigin()); + } catch (e) { + this.request.dispatchException(e); + } + }, + + _getResponseJSON: function() { + var options = this.request.options; + if (!options.evalJSON || (options.evalJSON != 'force' && + !(this.getHeader('Content-type') || '').include('application/json')) || + this.responseText.blank()) + return null; + try { + return this.responseText.evalJSON(options.sanitizeJSON || + !this.request.isSameOrigin()); + } catch (e) { + this.request.dispatchException(e); + } + } +}); + +Ajax.Updater = Class.create(Ajax.Request, { + initialize: function($super, container, url, options) { + this.container = { + success: (container.success || container), + failure: (container.failure || (container.success ? null : container)) + }; + + options = Object.clone(options); + var onComplete = options.onComplete; + options.onComplete = (function(response, json) { + this.updateContent(response.responseText); + if (Object.isFunction(onComplete)) onComplete(response, json); + }).bind(this); + + $super(url, options); + }, + + updateContent: function(responseText) { + var receiver = this.container[this.success() ? 'success' : 'failure'], + options = this.options; + + if (!options.evalScripts) responseText = responseText.stripScripts(); + + if (receiver = $(receiver)) { + if (options.insertion) { + if (Object.isString(options.insertion)) { + var insertion = { }; insertion[options.insertion] = responseText; + receiver.insert(insertion); + } + else options.insertion(receiver, responseText); + } + else receiver.update(responseText); + } + } +}); + +Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { + initialize: function($super, container, url, options) { + $super(options); + this.onComplete = this.options.onComplete; + + this.frequency = (this.options.frequency || 2); + this.decay = (this.options.decay || 1); + + this.updater = { }; + this.container = container; + this.url = url; + + this.start(); + }, + + start: function() { + this.options.onComplete = this.updateComplete.bind(this); + this.onTimerEvent(); + }, + + stop: function() { + this.updater.options.onComplete = undefined; + clearTimeout(this.timer); + (this.onComplete || Prototype.emptyFunction).apply(this, arguments); + }, + + updateComplete: function(response) { + if (this.options.decay) { + this.decay = (response.responseText == this.lastText ? + this.decay * this.options.decay : 1); + + this.lastText = response.responseText; + } + this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); + }, + + onTimerEvent: function() { + this.updater = new Ajax.Updater(this.container, this.url, this.options); + } +}); +function $(element) { + if (arguments.length > 1) { + for (var i = 0, elements = [], length = arguments.length; i < length; i++) + elements.push($(arguments[i])); + return elements; + } + if (Object.isString(element)) + element = document.getElementById(element); + return Element.extend(element); +} + +if (Prototype.BrowserFeatures.XPath) { + document._getElementsByXPath = function(expression, parentElement) { + var results = []; + var query = document.evaluate(expression, $(parentElement) || document, + null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0, length = query.snapshotLength; i < length; i++) + results.push(Element.extend(query.snapshotItem(i))); + return results; + }; +} + +/*--------------------------------------------------------------------------*/ + +if (!window.Node) var Node = { }; + +if (!Node.ELEMENT_NODE) { + // DOM level 2 ECMAScript Language Binding + Object.extend(Node, { + ELEMENT_NODE: 1, + ATTRIBUTE_NODE: 2, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + ENTITY_REFERENCE_NODE: 5, + ENTITY_NODE: 6, + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + NOTATION_NODE: 12 + }); +} + +(function() { + var element = this.Element; + this.Element = function(tagName, attributes) { + attributes = attributes || { }; + tagName = tagName.toLowerCase(); + var cache = Element.cache; + if (Prototype.Browser.IE && attributes.name) { + tagName = '<' + tagName + ' name="' + attributes.name + '">'; + delete attributes.name; + return Element.writeAttribute(document.createElement(tagName), attributes); + } + if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); + return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); + }; + Object.extend(this.Element, element || { }); + if (element) this.Element.prototype = element.prototype; +}).call(window); + +Element.cache = { }; + +Element.Methods = { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function(element) { + element = $(element); + Element[Element.visible(element) ? 'hide' : 'show'](element); + return element; + }, + + hide: function(element) { + element = $(element); + element.style.display = 'none'; + return element; + }, + + show: function(element) { + element = $(element); + element.style.display = ''; + return element; + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + return element; + }, + + update: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + content = Object.toHTML(content); + element.innerHTML = content.stripScripts(); + content.evalScripts.bind(content).defer(); + return element; + }, + + replace: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + else if (!Object.isElement(content)) { + content = Object.toHTML(content); + var range = element.ownerDocument.createRange(); + range.selectNode(element); + content.evalScripts.bind(content).defer(); + content = range.createContextualFragment(content.stripScripts()); + } + element.parentNode.replaceChild(content, element); + return element; + }, + + insert: function(element, insertions) { + element = $(element); + + if (Object.isString(insertions) || Object.isNumber(insertions) || + Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) + insertions = {bottom:insertions}; + + var content, insert, tagName, childNodes; + + for (var position in insertions) { + content = insertions[position]; + position = position.toLowerCase(); + insert = Element._insertionTranslations[position]; + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + insert(element, content); + continue; + } + + content = Object.toHTML(content); + + tagName = ((position == 'before' || position == 'after') + ? element.parentNode : element).tagName.toUpperCase(); + + childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + + if (position == 'top' || position == 'after') childNodes.reverse(); + childNodes.each(insert.curry(element)); + + content.evalScripts.bind(content).defer(); + } + + return element; + }, + + wrap: function(element, wrapper, attributes) { + element = $(element); + if (Object.isElement(wrapper)) + $(wrapper).writeAttribute(attributes || { }); + else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); + else wrapper = new Element('div', wrapper); + if (element.parentNode) + element.parentNode.replaceChild(wrapper, element); + wrapper.appendChild(element); + return wrapper; + }, + + inspect: function(element) { + element = $(element); + var result = '<' + element.tagName.toLowerCase(); + $H({'id': 'id', 'className': 'class'}).each(function(pair) { + var property = pair.first(), attribute = pair.last(); + var value = (element[property] || '').toString(); + if (value) result += ' ' + attribute + '=' + value.inspect(true); + }); + return result + '>'; + }, + + recursivelyCollect: function(element, property) { + element = $(element); + var elements = []; + while (element = element[property]) + if (element.nodeType == 1) + elements.push(Element.extend(element)); + return elements; + }, + + ancestors: function(element) { + return $(element).recursivelyCollect('parentNode'); + }, + + descendants: function(element) { + return $(element).select("*"); + }, + + firstDescendant: function(element) { + element = $(element).firstChild; + while (element && element.nodeType != 1) element = element.nextSibling; + return $(element); + }, + + immediateDescendants: function(element) { + if (!(element = $(element).firstChild)) return []; + while (element && element.nodeType != 1) element = element.nextSibling; + if (element) return [element].concat($(element).nextSiblings()); + return []; + }, + + previousSiblings: function(element) { + return $(element).recursivelyCollect('previousSibling'); + }, + + nextSiblings: function(element) { + return $(element).recursivelyCollect('nextSibling'); + }, + + siblings: function(element) { + element = $(element); + return element.previousSiblings().reverse().concat(element.nextSiblings()); + }, + + match: function(element, selector) { + if (Object.isString(selector)) + selector = new Selector(selector); + return selector.match($(element)); + }, + + up: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(element.parentNode); + var ancestors = element.ancestors(); + return Object.isNumber(expression) ? ancestors[expression] : + Selector.findElement(ancestors, expression, index); + }, + + down: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return element.firstDescendant(); + return Object.isNumber(expression) ? element.descendants()[expression] : + Element.select(element, expression)[index || 0]; + }, + + previous: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); + var previousSiblings = element.previousSiblings(); + return Object.isNumber(expression) ? previousSiblings[expression] : + Selector.findElement(previousSiblings, expression, index); + }, + + next: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); + var nextSiblings = element.nextSiblings(); + return Object.isNumber(expression) ? nextSiblings[expression] : + Selector.findElement(nextSiblings, expression, index); + }, + + select: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element, args); + }, + + adjacent: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element.parentNode, args).without(element); + }, + + identify: function(element) { + element = $(element); + var id = element.readAttribute('id'), self = arguments.callee; + if (id) return id; + do { id = 'anonymous_element_' + self.counter++ } while ($(id)); + element.writeAttribute('id', id); + return id; + }, + + readAttribute: function(element, name) { + element = $(element); + if (Prototype.Browser.IE) { + var t = Element._attributeTranslations.read; + if (t.values[name]) return t.values[name](element, name); + if (t.names[name]) name = t.names[name]; + if (name.include(':')) { + return (!element.attributes || !element.attributes[name]) ? null : + element.attributes[name].value; + } + } + return element.getAttribute(name); + }, + + writeAttribute: function(element, name, value) { + element = $(element); + var attributes = { }, t = Element._attributeTranslations.write; + + if (typeof name == 'object') attributes = name; + else attributes[name] = Object.isUndefined(value) ? true : value; + + for (var attr in attributes) { + name = t.names[attr] || attr; + value = attributes[attr]; + if (t.values[attr]) name = t.values[attr](element, value); + if (value === false || value === null) + element.removeAttribute(name); + else if (value === true) + element.setAttribute(name, name); + else element.setAttribute(name, value); + } + return element; + }, + + getHeight: function(element) { + return $(element).getDimensions().height; + }, + + getWidth: function(element) { + return $(element).getDimensions().width; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + var elementClassName = element.className; + return (elementClassName.length > 0 && (elementClassName == className || + new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + if (!element.hasClassName(className)) + element.className += (element.className ? ' ' : '') + className; + return element; + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + element.className = element.className.replace( + new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); + return element; + }, + + toggleClassName: function(element, className) { + if (!(element = $(element))) return; + return element[element.hasClassName(className) ? + 'removeClassName' : 'addClassName'](className); + }, + + // removes whitespace-only text node children + cleanWhitespace: function(element) { + element = $(element); + var node = element.firstChild; + while (node) { + var nextNode = node.nextSibling; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + element.removeChild(node); + node = nextNode; + } + return element; + }, + + empty: function(element) { + return $(element).innerHTML.blank(); + }, + + descendantOf: function(element, ancestor) { + element = $(element), ancestor = $(ancestor); + + if (element.compareDocumentPosition) + return (element.compareDocumentPosition(ancestor) & 8) === 8; + + if (ancestor.contains) + return ancestor.contains(element) && ancestor !== element; + + while (element = element.parentNode) + if (element == ancestor) return true; + + return false; + }, + + scrollTo: function(element) { + element = $(element); + var pos = element.cumulativeOffset(); + window.scrollTo(pos[0], pos[1]); + return element; + }, + + getStyle: function(element, style) { + element = $(element); + style = style == 'float' ? 'cssFloat' : style.camelize(); + var value = element.style[style]; + if (!value || value == 'auto') { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css[style] : null; + } + if (style == 'opacity') return value ? parseFloat(value) : 1.0; + return value == 'auto' ? null : value; + }, + + getOpacity: function(element) { + return $(element).getStyle('opacity'); + }, + + setStyle: function(element, styles) { + element = $(element); + var elementStyle = element.style, match; + if (Object.isString(styles)) { + element.style.cssText += ';' + styles; + return styles.include('opacity') ? + element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; + } + for (var property in styles) + if (property == 'opacity') element.setOpacity(styles[property]); + else + elementStyle[(property == 'float' || property == 'cssFloat') ? + (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : + property] = styles[property]; + + return element; + }, + + setOpacity: function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + return element; + }, + + getDimensions: function(element) { + element = $(element); + var display = element.getStyle('display'); + if (display != 'none' && display != null) // Safari bug + return {width: element.offsetWidth, height: element.offsetHeight}; + + // All *Width and *Height properties give 0 on elements with display none, + // so enable the element temporarily + var els = element.style; + var originalVisibility = els.visibility; + var originalPosition = els.position; + var originalDisplay = els.display; + els.visibility = 'hidden'; + els.position = 'absolute'; + els.display = 'block'; + var originalWidth = element.clientWidth; + var originalHeight = element.clientHeight; + els.display = originalDisplay; + els.position = originalPosition; + els.visibility = originalVisibility; + return {width: originalWidth, height: originalHeight}; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + // Opera returns the offset relative to the positioning context, when an + // element is position relative but top and left have not been defined + if (Prototype.Browser.Opera) { + element.style.top = 0; + element.style.left = 0; + } + } + return element; + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + return element; + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return element; + element._overflow = Element.getStyle(element, 'overflow') || 'auto'; + if (element._overflow !== 'hidden') + element.style.overflow = 'hidden'; + return element; + }, + + undoClipping: function(element) { + element = $(element); + if (!element._overflow) return element; + element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; + element._overflow = null; + return element; + }, + + cumulativeOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + positionedOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + if (element.tagName.toUpperCase() == 'BODY') break; + var p = Element.getStyle(element, 'position'); + if (p !== 'static') break; + } + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + absolutize: function(element) { + element = $(element); + if (element.getStyle('position') == 'absolute') return element; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + var offsets = element.positionedOffset(); + var top = offsets[1]; + var left = offsets[0]; + var width = element.clientWidth; + var height = element.clientHeight; + + element._originalLeft = left - parseFloat(element.style.left || 0); + element._originalTop = top - parseFloat(element.style.top || 0); + element._originalWidth = element.style.width; + element._originalHeight = element.style.height; + + element.style.position = 'absolute'; + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.width = width + 'px'; + element.style.height = height + 'px'; + return element; + }, + + relativize: function(element) { + element = $(element); + if (element.getStyle('position') == 'relative') return element; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + element.style.position = 'relative'; + var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); + var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); + + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.height = element._originalHeight; + element.style.width = element._originalWidth; + return element; + }, + + cumulativeScrollOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + getOffsetParent: function(element) { + if (element.offsetParent) return $(element.offsetParent); + if (element == document.body) return $(element); + + while ((element = element.parentNode) && element != document.body) + if (Element.getStyle(element, 'position') != 'static') + return $(element); + + return $(document.body); + }, + + viewportOffset: function(forElement) { + var valueT = 0, valueL = 0; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + + // Safari fix + if (element.offsetParent == document.body && + Element.getStyle(element, 'position') == 'absolute') break; + + } while (element = element.offsetParent); + + element = forElement; + do { + if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } + } while (element = element.parentNode); + + return Element._returnOffset(valueL, valueT); + }, + + clonePosition: function(element, source) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || { }); + + // find page position of source + source = $(source); + var p = source.viewportOffset(); + + // find coordinate system to use + element = $(element); + var delta = [0, 0]; + var parent = null; + // delta [0,0] will do fine with position: fixed elements, + // position:absolute needs offsetParent deltas + if (Element.getStyle(element, 'position') == 'absolute') { + parent = element.getOffsetParent(); + delta = parent.viewportOffset(); + } + + // correct by body offsets (fixes Safari) + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + // set position + if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if (options.setWidth) element.style.width = source.offsetWidth + 'px'; + if (options.setHeight) element.style.height = source.offsetHeight + 'px'; + return element; + } +}; + +Element.Methods.identify.counter = 1; + +Object.extend(Element.Methods, { + getElementsBySelector: Element.Methods.select, + childElements: Element.Methods.immediateDescendants +}); + +Element._attributeTranslations = { + write: { + names: { + className: 'class', + htmlFor: 'for' + }, + values: { } + } +}; + +if (Prototype.Browser.Opera) { + Element.Methods.getStyle = Element.Methods.getStyle.wrap( + function(proceed, element, style) { + switch (style) { + case 'left': case 'top': case 'right': case 'bottom': + if (proceed(element, 'position') === 'static') return null; + case 'height': case 'width': + // returns '0px' for hidden elements; we want it to return null + if (!Element.visible(element)) return null; + + // returns the border-box dimensions rather than the content-box + // dimensions, so we subtract padding and borders from the value + var dim = parseInt(proceed(element, style), 10); + + if (dim !== element['offset' + style.capitalize()]) + return dim + 'px'; + + var properties; + if (style === 'height') { + properties = ['border-top-width', 'padding-top', + 'padding-bottom', 'border-bottom-width']; + } + else { + properties = ['border-left-width', 'padding-left', + 'padding-right', 'border-right-width']; + } + return properties.inject(dim, function(memo, property) { + var val = proceed(element, property); + return val === null ? memo : memo - parseInt(val, 10); + }) + 'px'; + default: return proceed(element, style); + } + } + ); + + Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( + function(proceed, element, attribute) { + if (attribute === 'title') return element.title; + return proceed(element, attribute); + } + ); +} + +else if (Prototype.Browser.IE) { + // IE doesn't report offsets correctly for static elements, so we change them + // to "relative" to get the values, then change them back. + Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( + function(proceed, element) { + element = $(element); + // IE throws an error if element is not in document + try { element.offsetParent } + catch(e) { return $(document.body) } + var position = element.getStyle('position'); + if (position !== 'static') return proceed(element); + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + + $w('positionedOffset viewportOffset').each(function(method) { + Element.Methods[method] = Element.Methods[method].wrap( + function(proceed, element) { + element = $(element); + try { element.offsetParent } + catch(e) { return Element._returnOffset(0,0) } + var position = element.getStyle('position'); + if (position !== 'static') return proceed(element); + // Trigger hasLayout on the offset parent so that IE6 reports + // accurate offsetTop and offsetLeft values for position: fixed. + var offsetParent = element.getOffsetParent(); + if (offsetParent && offsetParent.getStyle('position') === 'fixed') + offsetParent.setStyle({ zoom: 1 }); + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + }); + + Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap( + function(proceed, element) { + try { element.offsetParent } + catch(e) { return Element._returnOffset(0,0) } + return proceed(element); + } + ); + + Element.Methods.getStyle = function(element, style) { + element = $(element); + style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); + var value = element.style[style]; + if (!value && element.currentStyle) value = element.currentStyle[style]; + + if (style == 'opacity') { + if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) + if (value[1]) return parseFloat(value[1]) / 100; + return 1.0; + } + + if (value == 'auto') { + if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) + return element['offset' + style.capitalize()] + 'px'; + return null; + } + return value; + }; + + Element.Methods.setOpacity = function(element, value) { + function stripAlpha(filter){ + return filter.replace(/alpha\([^\)]*\)/gi,''); + } + element = $(element); + var currentStyle = element.currentStyle; + if ((currentStyle && !currentStyle.hasLayout) || + (!currentStyle && element.style.zoom == 'normal')) + element.style.zoom = 1; + + var filter = element.getStyle('filter'), style = element.style; + if (value == 1 || value === '') { + (filter = stripAlpha(filter)) ? + style.filter = filter : style.removeAttribute('filter'); + return element; + } else if (value < 0.00001) value = 0; + style.filter = stripAlpha(filter) + + 'alpha(opacity=' + (value * 100) + ')'; + return element; + }; + + Element._attributeTranslations = { + read: { + names: { + 'class': 'className', + 'for': 'htmlFor' + }, + values: { + _getAttr: function(element, attribute) { + return element.getAttribute(attribute, 2); + }, + _getAttrNode: function(element, attribute) { + var node = element.getAttributeNode(attribute); + return node ? node.value : ""; + }, + _getEv: function(element, attribute) { + attribute = element.getAttribute(attribute); + return attribute ? attribute.toString().slice(23, -2) : null; + }, + _flag: function(element, attribute) { + return $(element).hasAttribute(attribute) ? attribute : null; + }, + style: function(element) { + return element.style.cssText.toLowerCase(); + }, + title: function(element) { + return element.title; + } + } + } + }; + + Element._attributeTranslations.write = { + names: Object.extend({ + cellpadding: 'cellPadding', + cellspacing: 'cellSpacing' + }, Element._attributeTranslations.read.names), + values: { + checked: function(element, value) { + element.checked = !!value; + }, + + style: function(element, value) { + element.style.cssText = value ? value : ''; + } + } + }; + + Element._attributeTranslations.has = {}; + + $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + + 'encType maxLength readOnly longDesc frameBorder').each(function(attr) { + Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; + Element._attributeTranslations.has[attr.toLowerCase()] = attr; + }); + + (function(v) { + Object.extend(v, { + href: v._getAttr, + src: v._getAttr, + type: v._getAttr, + action: v._getAttrNode, + disabled: v._flag, + checked: v._flag, + readonly: v._flag, + multiple: v._flag, + onload: v._getEv, + onunload: v._getEv, + onclick: v._getEv, + ondblclick: v._getEv, + onmousedown: v._getEv, + onmouseup: v._getEv, + onmouseover: v._getEv, + onmousemove: v._getEv, + onmouseout: v._getEv, + onfocus: v._getEv, + onblur: v._getEv, + onkeypress: v._getEv, + onkeydown: v._getEv, + onkeyup: v._getEv, + onsubmit: v._getEv, + onreset: v._getEv, + onselect: v._getEv, + onchange: v._getEv + }); + })(Element._attributeTranslations.read.values); +} + +else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1) ? 0.999999 : + (value === '') ? '' : (value < 0.00001) ? 0 : value; + return element; + }; +} + +else if (Prototype.Browser.WebKit) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + + if (value == 1) + if(element.tagName.toUpperCase() == 'IMG' && element.width) { + element.width++; element.width--; + } else try { + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch (e) { } + + return element; + }; + + // Safari returns margins on body which is incorrect if the child is absolutely + // positioned. For performance reasons, redefine Element#cumulativeOffset for + // KHTML/WebKit only. + Element.Methods.cumulativeOffset = function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return Element._returnOffset(valueL, valueT); + }; +} + +if (Prototype.Browser.IE || Prototype.Browser.Opera) { + // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements + Element.Methods.update = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + + content = Object.toHTML(content); + var tagName = element.tagName.toUpperCase(); + + if (tagName in Element._insertionTranslations.tags) { + $A(element.childNodes).each(function(node) { element.removeChild(node) }); + Element._getContentFromAnonymousElement(tagName, content.stripScripts()) + .each(function(node) { element.appendChild(node) }); + } + else element.innerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +if ('outerHTML' in document.createElement('div')) { + Element.Methods.replace = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + element.parentNode.replaceChild(content, element); + return element; + } + + content = Object.toHTML(content); + var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); + + if (Element._insertionTranslations.tags[tagName]) { + var nextSibling = element.next(); + var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + parent.removeChild(element); + if (nextSibling) + fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); + else + fragments.each(function(node) { parent.appendChild(node) }); + } + else element.outerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +Element._returnOffset = function(l, t) { + var result = [l, t]; + result.left = l; + result.top = t; + return result; +}; + +Element._getContentFromAnonymousElement = function(tagName, html) { + var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; + if (t) { + div.innerHTML = t[0] + html + t[1]; + t[2].times(function() { div = div.firstChild }); + } else div.innerHTML = html; + return $A(div.childNodes); +}; + +Element._insertionTranslations = { + before: function(element, node) { + element.parentNode.insertBefore(node, element); + }, + top: function(element, node) { + element.insertBefore(node, element.firstChild); + }, + bottom: function(element, node) { + element.appendChild(node); + }, + after: function(element, node) { + element.parentNode.insertBefore(node, element.nextSibling); + }, + tags: { + TABLE: ['<table>', '</table>', 1], + TBODY: ['<table><tbody>', '</tbody></table>', 2], + TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3], + TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4], + SELECT: ['<select>', '</select>', 1] + } +}; + +(function() { + Object.extend(this.tags, { + THEAD: this.tags.TBODY, + TFOOT: this.tags.TBODY, + TH: this.tags.TD + }); +}).call(Element._insertionTranslations); + +Element.Methods.Simulated = { + hasAttribute: function(element, attribute) { + attribute = Element._attributeTranslations.has[attribute] || attribute; + var node = $(element).getAttributeNode(attribute); + return !!(node && node.specified); + } +}; + +Element.Methods.ByTag = { }; + +Object.extend(Element, Element.Methods); + +if (!Prototype.BrowserFeatures.ElementExtensions && + document.createElement('div')['__proto__']) { + window.HTMLElement = { }; + window.HTMLElement.prototype = document.createElement('div')['__proto__']; + Prototype.BrowserFeatures.ElementExtensions = true; +} + +Element.extend = (function() { + if (Prototype.BrowserFeatures.SpecificElementExtensions) + return Prototype.K; + + var Methods = { }, ByTag = Element.Methods.ByTag; + + var extend = Object.extend(function(element) { + if (!element || element._extendedByPrototype || + element.nodeType != 1 || element == window) return element; + + var methods = Object.clone(Methods), + tagName = element.tagName.toUpperCase(), property, value; + + // extend methods for specific tags + if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); + + for (property in methods) { + value = methods[property]; + if (Object.isFunction(value) && !(property in element)) + element[property] = value.methodize(); + } + + element._extendedByPrototype = Prototype.emptyFunction; + return element; + + }, { + refresh: function() { + // extend methods for all tags (Safari doesn't need this) + if (!Prototype.BrowserFeatures.ElementExtensions) { + Object.extend(Methods, Element.Methods); + Object.extend(Methods, Element.Methods.Simulated); + } + } + }); + + extend.refresh(); + return extend; +})(); + +Element.hasAttribute = function(element, attribute) { + if (element.hasAttribute) return element.hasAttribute(attribute); + return Element.Methods.Simulated.hasAttribute(element, attribute); +}; + +Element.addMethods = function(methods) { + var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; + + if (!methods) { + Object.extend(Form, Form.Methods); + Object.extend(Form.Element, Form.Element.Methods); + Object.extend(Element.Methods.ByTag, { + "FORM": Object.clone(Form.Methods), + "INPUT": Object.clone(Form.Element.Methods), + "SELECT": Object.clone(Form.Element.Methods), + "TEXTAREA": Object.clone(Form.Element.Methods) + }); + } + + if (arguments.length == 2) { + var tagName = methods; + methods = arguments[1]; + } + + if (!tagName) Object.extend(Element.Methods, methods || { }); + else { + if (Object.isArray(tagName)) tagName.each(extend); + else extend(tagName); + } + + function extend(tagName) { + tagName = tagName.toUpperCase(); + if (!Element.Methods.ByTag[tagName]) + Element.Methods.ByTag[tagName] = { }; + Object.extend(Element.Methods.ByTag[tagName], methods); + } + + function copy(methods, destination, onlyIfAbsent) { + onlyIfAbsent = onlyIfAbsent || false; + for (var property in methods) { + var value = methods[property]; + if (!Object.isFunction(value)) continue; + if (!onlyIfAbsent || !(property in destination)) + destination[property] = value.methodize(); + } + } + + function findDOMClass(tagName) { + var klass; + var trans = { + "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", + "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", + "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", + "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", + "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": + "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": + "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": + "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": + "FrameSet", "IFRAME": "IFrame" + }; + if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName.capitalize() + 'Element'; + if (window[klass]) return window[klass]; + + window[klass] = { }; + window[klass].prototype = document.createElement(tagName)['__proto__']; + return window[klass]; + } + + if (F.ElementExtensions) { + copy(Element.Methods, HTMLElement.prototype); + copy(Element.Methods.Simulated, HTMLElement.prototype, true); + } + + if (F.SpecificElementExtensions) { + for (var tag in Element.Methods.ByTag) { + var klass = findDOMClass(tag); + if (Object.isUndefined(klass)) continue; + copy(T[tag], klass.prototype); + } + } + + Object.extend(Element, Element.Methods); + delete Element.ByTag; + + if (Element.extend.refresh) Element.extend.refresh(); + Element.cache = { }; +}; + +document.viewport = { + getDimensions: function() { + var dimensions = { }, B = Prototype.Browser; + $w('width height').each(function(d) { + var D = d.capitalize(); + if (B.WebKit && !document.evaluate) { + // Safari <3.0 needs self.innerWidth/Height + dimensions[d] = self['inner' + D]; + } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) { + // Opera <9.5 needs document.body.clientWidth/Height + dimensions[d] = document.body['client' + D] + } else { + dimensions[d] = document.documentElement['client' + D]; + } + }); + return dimensions; + }, + + getWidth: function() { + return this.getDimensions().width; + }, + + getHeight: function() { + return this.getDimensions().height; + }, + + getScrollOffsets: function() { + return Element._returnOffset( + window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, + window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); + } +}; +/* Portions of the Selector class are derived from Jack Slocum's DomQuery, + * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style + * license. Please see http://www.yui-ext.com/ for more information. */ + +var Selector = Class.create({ + initialize: function(expression) { + this.expression = expression.strip(); + + if (this.shouldUseSelectorsAPI()) { + this.mode = 'selectorsAPI'; + } else if (this.shouldUseXPath()) { + this.mode = 'xpath'; + this.compileXPathMatcher(); + } else { + this.mode = "normal"; + this.compileMatcher(); + } + + }, + + shouldUseXPath: function() { + if (!Prototype.BrowserFeatures.XPath) return false; + + var e = this.expression; + + // Safari 3 chokes on :*-of-type and :empty + if (Prototype.Browser.WebKit && + (e.include("-of-type") || e.include(":empty"))) + return false; + + // XPath can't do namespaced attributes, nor can it read + // the "checked" property from DOM nodes + if ((/(\[[\w-]*?:|:checked)/).test(e)) + return false; + + return true; + }, + + shouldUseSelectorsAPI: function() { + if (!Prototype.BrowserFeatures.SelectorsAPI) return false; + + if (!Selector._div) Selector._div = new Element('div'); + + // Make sure the browser treats the selector as valid. Test on an + // isolated element to minimize cost of this check. + try { + Selector._div.querySelector(this.expression); + } catch(e) { + return false; + } + + return true; + }, + + compileMatcher: function() { + var e = this.expression, ps = Selector.patterns, h = Selector.handlers, + c = Selector.criteria, le, p, m; + + if (Selector._cache[e]) { + this.matcher = Selector._cache[e]; + return; + } + + this.matcher = ["this.matcher = function(root) {", + "var r = root, h = Selector.handlers, c = false, n;"]; + + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : + new Template(c[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.matcher.push("return h.unique(n);\n}"); + eval(this.matcher.join('\n')); + Selector._cache[this.expression] = this.matcher; + }, + + compileXPathMatcher: function() { + var e = this.expression, ps = Selector.patterns, + x = Selector.xpath, le, m; + + if (Selector._cache[e]) { + this.xpath = Selector._cache[e]; return; + } + + this.matcher = ['.//*']; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + if (m = e.match(ps[i])) { + this.matcher.push(Object.isFunction(x[i]) ? x[i](m) : + new Template(x[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.xpath = this.matcher.join(''); + Selector._cache[this.expression] = this.xpath; + }, + + findElements: function(root) { + root = root || document; + var e = this.expression, results; + + switch (this.mode) { + case 'selectorsAPI': + // querySelectorAll queries document-wide, then filters to descendants + // of the context element. That's not what we want. + // Add an explicit context to the selector if necessary. + if (root !== document) { + var oldId = root.id, id = $(root).identify(); + e = "#" + id + " " + e; + } + + results = $A(root.querySelectorAll(e)).map(Element.extend); + root.id = oldId; + + return results; + case 'xpath': + return document._getElementsByXPath(this.xpath, root); + default: + return this.matcher(root); + } + }, + + match: function(element) { + this.tokens = []; + + var e = this.expression, ps = Selector.patterns, as = Selector.assertions; + var le, p, m; + + while (e && le !== e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + // use the Selector.assertions methods unless the selector + // is too complex. + if (as[i]) { + this.tokens.push([i, Object.clone(m)]); + e = e.replace(m[0], ''); + } else { + // reluctantly do a document-wide search + // and look for a match in the array + return this.findElements(document).include(element); + } + } + } + } + + var match = true, name, matches; + for (var i = 0, token; token = this.tokens[i]; i++) { + name = token[0], matches = token[1]; + if (!Selector.assertions[name](element, matches)) { + match = false; break; + } + } + + return match; + }, + + toString: function() { + return this.expression; + }, + + inspect: function() { + return "#<Selector:" + this.expression.inspect() + ">"; + } +}); + +Object.extend(Selector, { + _cache: { }, + + xpath: { + descendant: "//*", + child: "/*", + adjacent: "/following-sibling::*[1]", + laterSibling: '/following-sibling::*', + tagName: function(m) { + if (m[1] == '*') return ''; + return "[local-name()='" + m[1].toLowerCase() + + "' or local-name()='" + m[1].toUpperCase() + "']"; + }, + className: "[contains(concat(' ', @class, ' '), ' #{1} ')]", + id: "[@id='#{1}']", + attrPresence: function(m) { + m[1] = m[1].toLowerCase(); + return new Template("[@#{1}]").evaluate(m); + }, + attr: function(m) { + m[1] = m[1].toLowerCase(); + m[3] = m[5] || m[6]; + return new Template(Selector.xpath.operators[m[2]]).evaluate(m); + }, + pseudo: function(m) { + var h = Selector.xpath.pseudos[m[1]]; + if (!h) return ''; + if (Object.isFunction(h)) return h(m); + return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); + }, + operators: { + '=': "[@#{1}='#{3}']", + '!=': "[@#{1}!='#{3}']", + '^=': "[starts-with(@#{1}, '#{3}')]", + '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']", + '*=': "[contains(@#{1}, '#{3}')]", + '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", + '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" + }, + pseudos: { + 'first-child': '[not(preceding-sibling::*)]', + 'last-child': '[not(following-sibling::*)]', + 'only-child': '[not(preceding-sibling::* or following-sibling::*)]', + 'empty': "[count(*) = 0 and (count(text()) = 0)]", + 'checked': "[@checked]", + 'disabled': "[(@disabled) and (@type!='hidden')]", + 'enabled': "[not(@disabled) and (@type!='hidden')]", + 'not': function(m) { + var e = m[6], p = Selector.patterns, + x = Selector.xpath, le, v; + + var exclusion = []; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in p) { + if (m = e.match(p[i])) { + v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m); + exclusion.push("(" + v.substring(1, v.length - 1) + ")"); + e = e.replace(m[0], ''); + break; + } + } + } + return "[not(" + exclusion.join(" and ") + ")]"; + }, + 'nth-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m); + }, + 'nth-last-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m); + }, + 'nth-of-type': function(m) { + return Selector.xpath.pseudos.nth("position() ", m); + }, + 'nth-last-of-type': function(m) { + return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); + }, + 'first-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m); + }, + 'last-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); + }, + 'only-of-type': function(m) { + var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m); + }, + nth: function(fragment, m) { + var mm, formula = m[6], predicate; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + if (mm = formula.match(/^(\d+)$/)) // digit only + return '[' + fragment + "= " + mm[1] + ']'; + if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (mm[1] == "-") mm[1] = -1; + var a = mm[1] ? Number(mm[1]) : 1; + var b = mm[2] ? Number(mm[2]) : 0; + predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " + + "((#{fragment} - #{b}) div #{a} >= 0)]"; + return new Template(predicate).evaluate({ + fragment: fragment, a: a, b: b }); + } + } + } + }, + + criteria: { + tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', + className: 'n = h.className(n, r, "#{1}", c); c = false;', + id: 'n = h.id(n, r, "#{1}", c); c = false;', + attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;', + attr: function(m) { + m[3] = (m[5] || m[6]); + return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m); + }, + pseudo: function(m) { + if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); + return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m); + }, + descendant: 'c = "descendant";', + child: 'c = "child";', + adjacent: 'c = "adjacent";', + laterSibling: 'c = "laterSibling";' + }, + + patterns: { + // combinators must be listed first + // (and descendant needs to be last combinator) + laterSibling: /^\s*~\s*/, + child: /^\s*>\s*/, + adjacent: /^\s*\+\s*/, + descendant: /^\s/, + + // selectors follow + tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, + id: /^#([\w\-\*]+)(\b|$)/, + className: /^\.([\w\-\*]+)(\b|$)/, + pseudo: +/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/, + attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/, + attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ + }, + + // for Selector.match and Element#match + assertions: { + tagName: function(element, matches) { + return matches[1].toUpperCase() == element.tagName.toUpperCase(); + }, + + className: function(element, matches) { + return Element.hasClassName(element, matches[1]); + }, + + id: function(element, matches) { + return element.id === matches[1]; + }, + + attrPresence: function(element, matches) { + return Element.hasAttribute(element, matches[1]); + }, + + attr: function(element, matches) { + var nodeValue = Element.readAttribute(element, matches[1]); + return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]); + } + }, + + handlers: { + // UTILITY FUNCTIONS + // joins two collections + concat: function(a, b) { + for (var i = 0, node; node = b[i]; i++) + a.push(node); + return a; + }, + + // marks an array of nodes for counting + mark: function(nodes) { + var _true = Prototype.emptyFunction; + for (var i = 0, node; node = nodes[i]; i++) + node._countedByPrototype = _true; + return nodes; + }, + + unmark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node._countedByPrototype = undefined; + return nodes; + }, + + // mark each child node with its position (for nth calls) + // "ofType" flag indicates whether we're indexing for nth-of-type + // rather than nth-child + index: function(parentNode, reverse, ofType) { + parentNode._countedByPrototype = Prototype.emptyFunction; + if (reverse) { + for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { + var node = nodes[i]; + if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; + } + } else { + for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) + if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; + } + }, + + // filters out duplicates and extends all nodes + unique: function(nodes) { + if (nodes.length == 0) return nodes; + var results = [], n; + for (var i = 0, l = nodes.length; i < l; i++) + if (!(n = nodes[i])._countedByPrototype) { + n._countedByPrototype = Prototype.emptyFunction; + results.push(Element.extend(n)); + } + return Selector.handlers.unmark(results); + }, + + // COMBINATOR FUNCTIONS + descendant: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName('*')); + return results; + }, + + child: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) { + for (var j = 0, child; child = node.childNodes[j]; j++) + if (child.nodeType == 1 && child.tagName != '!') results.push(child); + } + return results; + }, + + adjacent: function(nodes) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + var next = this.nextElementSibling(node); + if (next) results.push(next); + } + return results; + }, + + laterSibling: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, Element.nextSiblings(node)); + return results; + }, + + nextElementSibling: function(node) { + while (node = node.nextSibling) + if (node.nodeType == 1) return node; + return null; + }, + + previousElementSibling: function(node) { + while (node = node.previousSibling) + if (node.nodeType == 1) return node; + return null; + }, + + // TOKEN FUNCTIONS + tagName: function(nodes, root, tagName, combinator) { + var uTagName = tagName.toUpperCase(); + var results = [], h = Selector.handlers; + if (nodes) { + if (combinator) { + // fastlane for ordinary descendant combinators + if (combinator == "descendant") { + for (var i = 0, node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName(tagName)); + return results; + } else nodes = this[combinator](nodes); + if (tagName == "*") return nodes; + } + for (var i = 0, node; node = nodes[i]; i++) + if (node.tagName.toUpperCase() === uTagName) results.push(node); + return results; + } else return root.getElementsByTagName(tagName); + }, + + id: function(nodes, root, id, combinator) { + var targetNode = $(id), h = Selector.handlers; + if (!targetNode) return []; + if (!nodes && root == document) return [targetNode]; + if (nodes) { + if (combinator) { + if (combinator == 'child') { + for (var i = 0, node; node = nodes[i]; i++) + if (targetNode.parentNode == node) return [targetNode]; + } else if (combinator == 'descendant') { + for (var i = 0, node; node = nodes[i]; i++) + if (Element.descendantOf(targetNode, node)) return [targetNode]; + } else if (combinator == 'adjacent') { + for (var i = 0, node; node = nodes[i]; i++) + if (Selector.handlers.previousElementSibling(targetNode) == node) + return [targetNode]; + } else nodes = h[combinator](nodes); + } + for (var i = 0, node; node = nodes[i]; i++) + if (node == targetNode) return [targetNode]; + return []; + } + return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : []; + }, + + className: function(nodes, root, className, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + return Selector.handlers.byClassName(nodes, root, className); + }, + + byClassName: function(nodes, root, className) { + if (!nodes) nodes = Selector.handlers.descendant([root]); + var needle = ' ' + className + ' '; + for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) { + nodeClassName = node.className; + if (nodeClassName.length == 0) continue; + if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle)) + results.push(node); + } + return results; + }, + + attrPresence: function(nodes, root, attr, combinator) { + if (!nodes) nodes = root.getElementsByTagName("*"); + if (nodes && combinator) nodes = this[combinator](nodes); + var results = []; + for (var i = 0, node; node = nodes[i]; i++) + if (Element.hasAttribute(node, attr)) results.push(node); + return results; + }, + + attr: function(nodes, root, attr, value, operator, combinator) { + if (!nodes) nodes = root.getElementsByTagName("*"); + if (nodes && combinator) nodes = this[combinator](nodes); + var handler = Selector.operators[operator], results = []; + for (var i = 0, node; node = nodes[i]; i++) { + var nodeValue = Element.readAttribute(node, attr); + if (nodeValue === null) continue; + if (handler(nodeValue, value)) results.push(node); + } + return results; + }, + + pseudo: function(nodes, name, value, root, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + if (!nodes) nodes = root.getElementsByTagName("*"); + return Selector.pseudos[name](nodes, value, root); + } + }, + + pseudos: { + 'first-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.previousElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'last-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.nextElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'only-child': function(nodes, value, root) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) + results.push(node); + return results; + }, + 'nth-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root); + }, + 'nth-last-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true); + }, + 'nth-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, false, true); + }, + 'nth-last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true, true); + }, + 'first-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, false, true); + }, + 'last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, true, true); + }, + 'only-of-type': function(nodes, formula, root) { + var p = Selector.pseudos; + return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root); + }, + + // handles the an+b logic + getIndices: function(a, b, total) { + if (a == 0) return b > 0 ? [b] : []; + return $R(1, total).inject([], function(memo, i) { + if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i); + return memo; + }); + }, + + // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type + nth: function(nodes, formula, root, reverse, ofType) { + if (nodes.length == 0) return []; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + var h = Selector.handlers, results = [], indexed = [], m; + h.mark(nodes); + for (var i = 0, node; node = nodes[i]; i++) { + if (!node.parentNode._countedByPrototype) { + h.index(node.parentNode, reverse, ofType); + indexed.push(node.parentNode); + } + } + if (formula.match(/^\d+$/)) { // just a number + formula = Number(formula); + for (var i = 0, node; node = nodes[i]; i++) + if (node.nodeIndex == formula) results.push(node); + } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (m[1] == "-") m[1] = -1; + var a = m[1] ? Number(m[1]) : 1; + var b = m[2] ? Number(m[2]) : 0; + var indices = Selector.pseudos.getIndices(a, b, nodes.length); + for (var i = 0, node, l = indices.length; node = nodes[i]; i++) { + for (var j = 0; j < l; j++) + if (node.nodeIndex == indices[j]) results.push(node); + } + } + h.unmark(nodes); + h.unmark(indexed); + return results; + }, + + 'empty': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + // IE treats comments as element nodes + if (node.tagName == '!' || node.firstChild) continue; + results.push(node); + } + return results; + }, + + 'not': function(nodes, selector, root) { + var h = Selector.handlers, selectorType, m; + var exclusions = new Selector(selector).findElements(root); + h.mark(exclusions); + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node._countedByPrototype) results.push(node); + h.unmark(exclusions); + return results; + }, + + 'enabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node.disabled && (!node.type || node.type !== 'hidden')) + results.push(node); + return results; + }, + + 'disabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.disabled) results.push(node); + return results; + }, + + 'checked': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.checked) results.push(node); + return results; + } + }, + + operators: { + '=': function(nv, v) { return nv == v; }, + '!=': function(nv, v) { return nv != v; }, + '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); }, + '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); }, + '*=': function(nv, v) { return nv == v || nv && nv.include(v); }, + '$=': function(nv, v) { return nv.endsWith(v); }, + '*=': function(nv, v) { return nv.include(v); }, + '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); }, + '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() + + '-').include('-' + (v || "").toUpperCase() + '-'); } + }, + + split: function(expression) { + var expressions = []; + expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { + expressions.push(m[1].strip()); + }); + return expressions; + }, + + matchElements: function(elements, expression) { + var matches = $$(expression), h = Selector.handlers; + h.mark(matches); + for (var i = 0, results = [], element; element = elements[i]; i++) + if (element._countedByPrototype) results.push(element); + h.unmark(matches); + return results; + }, + + findElement: function(elements, expression, index) { + if (Object.isNumber(expression)) { + index = expression; expression = false; + } + return Selector.matchElements(elements, expression || '*')[index || 0]; + }, + + findChildElements: function(element, expressions) { + expressions = Selector.split(expressions.join(',')); + var results = [], h = Selector.handlers; + for (var i = 0, l = expressions.length, selector; i < l; i++) { + selector = new Selector(expressions[i].strip()); + h.concat(results, selector.findElements(element)); + } + return (l > 1) ? h.unique(results) : results; + } +}); + +if (Prototype.Browser.IE) { + Object.extend(Selector.handlers, { + // IE returns comment nodes on getElementsByTagName("*"). + // Filter them out. + concat: function(a, b) { + for (var i = 0, node; node = b[i]; i++) + if (node.tagName !== "!") a.push(node); + return a; + }, + + // IE improperly serializes _countedByPrototype in (inner|outer)HTML. + unmark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node.removeAttribute('_countedByPrototype'); + return nodes; + } + }); +} + +function $$() { + return Selector.findChildElements(document, $A(arguments)); +} +var Form = { + reset: function(form) { + $(form).reset(); + return form; + }, + + serializeElements: function(elements, options) { + if (typeof options != 'object') options = { hash: !!options }; + else if (Object.isUndefined(options.hash)) options.hash = true; + var key, value, submitted = false, submit = options.submit; + + var data = elements.inject({ }, function(result, element) { + if (!element.disabled && element.name) { + key = element.name; value = $(element).getValue(); + if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted && + submit !== false && (!submit || key == submit) && (submitted = true)))) { + if (key in result) { + // a key is already present; construct an array of values + if (!Object.isArray(result[key])) result[key] = [result[key]]; + result[key].push(value); + } + else result[key] = value; + } + } + return result; + }); + + return options.hash ? data : Object.toQueryString(data); + } +}; + +Form.Methods = { + serialize: function(form, options) { + return Form.serializeElements(Form.getElements(form), options); + }, + + getElements: function(form) { + return $A($(form).getElementsByTagName('*')).inject([], + function(elements, child) { + if (Form.Element.Serializers[child.tagName.toLowerCase()]) + elements.push(Element.extend(child)); + return elements; + } + ); + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) return $A(inputs).map(Element.extend); + + for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || (name && input.name != name)) + continue; + matchingInputs.push(Element.extend(input)); + } + + return matchingInputs; + }, + + disable: function(form) { + form = $(form); + Form.getElements(form).invoke('disable'); + return form; + }, + + enable: function(form) { + form = $(form); + Form.getElements(form).invoke('enable'); + return form; + }, + + findFirstElement: function(form) { + var elements = $(form).getElements().findAll(function(element) { + return 'hidden' != element.type && !element.disabled; + }); + var firstByIndex = elements.findAll(function(element) { + return element.hasAttribute('tabIndex') && element.tabIndex >= 0; + }).sortBy(function(element) { return element.tabIndex }).first(); + + return firstByIndex ? firstByIndex : elements.find(function(element) { + return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + }); + }, + + focusFirstElement: function(form) { + form = $(form); + form.findFirstElement().activate(); + return form; + }, + + request: function(form, options) { + form = $(form), options = Object.clone(options || { }); + + var params = options.parameters, action = form.readAttribute('action') || ''; + if (action.blank()) action = window.location.href; + options.parameters = form.serialize(true); + + if (params) { + if (Object.isString(params)) params = params.toQueryParams(); + Object.extend(options.parameters, params); + } + + if (form.hasAttribute('method') && !options.method) + options.method = form.method; + + return new Ajax.Request(action, options); + } +}; + +/*--------------------------------------------------------------------------*/ + +Form.Element = { + focus: function(element) { + $(element).focus(); + return element; + }, + + select: function(element) { + $(element).select(); + return element; + } +}; + +Form.Element.Methods = { + serialize: function(element) { + element = $(element); + if (!element.disabled && element.name) { + var value = element.getValue(); + if (value != undefined) { + var pair = { }; + pair[element.name] = value; + return Object.toQueryString(pair); + } + } + return ''; + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + return Form.Element.Serializers[method](element); + }, + + setValue: function(element, value) { + element = $(element); + var method = element.tagName.toLowerCase(); + Form.Element.Serializers[method](element, value); + return element; + }, + + clear: function(element) { + $(element).value = ''; + return element; + }, + + present: function(element) { + return $(element).value != ''; + }, + + activate: function(element) { + element = $(element); + try { + element.focus(); + if (element.select && (element.tagName.toLowerCase() != 'input' || + !['button', 'reset', 'submit'].include(element.type))) + element.select(); + } catch (e) { } + return element; + }, + + disable: function(element) { + element = $(element); + element.disabled = true; + return element; + }, + + enable: function(element) { + element = $(element); + element.disabled = false; + return element; + } +}; + +/*--------------------------------------------------------------------------*/ + +var Field = Form.Element; +var $F = Form.Element.Methods.getValue; + +/*--------------------------------------------------------------------------*/ + +Form.Element.Serializers = { + input: function(element, value) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + return Form.Element.Serializers.inputSelector(element, value); + default: + return Form.Element.Serializers.textarea(element, value); + } + }, + + inputSelector: function(element, value) { + if (Object.isUndefined(value)) return element.checked ? element.value : null; + else element.checked = !!value; + }, + + textarea: function(element, value) { + if (Object.isUndefined(value)) return element.value; + else element.value = value; + }, + + select: function(element, value) { + if (Object.isUndefined(value)) + return this[element.type == 'select-one' ? + 'selectOne' : 'selectMany'](element); + else { + var opt, currentValue, single = !Object.isArray(value); + for (var i = 0, length = element.length; i < length; i++) { + opt = element.options[i]; + currentValue = this.optionValue(opt); + if (single) { + if (currentValue == value) { + opt.selected = true; + return; + } + } + else opt.selected = value.include(currentValue); + } + } + }, + + selectOne: function(element) { + var index = element.selectedIndex; + return index >= 0 ? this.optionValue(element.options[index]) : null; + }, + + selectMany: function(element) { + var values, length = element.length; + if (!length) return null; + + for (var i = 0, values = []; i < length; i++) { + var opt = element.options[i]; + if (opt.selected) values.push(this.optionValue(opt)); + } + return values; + }, + + optionValue: function(opt) { + // extend element because hasAttribute may not be native + return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; + } +}; + +/*--------------------------------------------------------------------------*/ + +Abstract.TimedObserver = Class.create(PeriodicalExecuter, { + initialize: function($super, element, frequency, callback) { + $super(callback, frequency); + this.element = $(element); + this.lastValue = this.getValue(); + }, + + execute: function() { + var value = this.getValue(); + if (Object.isString(this.lastValue) && Object.isString(value) ? + this.lastValue != value : String(this.lastValue) != String(value)) { + this.callback(this.element, value); + this.lastValue = value; + } + } +}); + +Form.Element.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = Class.create({ + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + Form.getElements(this.element).each(this.registerCallback, this); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + default: + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +}); + +Form.Element.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); +if (!window.Event) var Event = { }; + +Object.extend(Event, { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + KEY_HOME: 36, + KEY_END: 35, + KEY_PAGEUP: 33, + KEY_PAGEDOWN: 34, + KEY_INSERT: 45, + + cache: { }, + + relatedTarget: function(event) { + var element; + switch(event.type) { + case 'mouseover': element = event.fromElement; break; + case 'mouseout': element = event.toElement; break; + default: return null; + } + return Element.extend(element); + } +}); + +Event.Methods = (function() { + var isButton; + + if (Prototype.Browser.IE) { + var buttonMap = { 0: 1, 1: 4, 2: 2 }; + isButton = function(event, code) { + return event.button == buttonMap[code]; + }; + + } else if (Prototype.Browser.WebKit) { + isButton = function(event, code) { + switch (code) { + case 0: return event.which == 1 && !event.metaKey; + case 1: return event.which == 1 && event.metaKey; + default: return false; + } + }; + + } else { + isButton = function(event, code) { + return event.which ? (event.which === code + 1) : (event.button === code); + }; + } + + return { + isLeftClick: function(event) { return isButton(event, 0) }, + isMiddleClick: function(event) { return isButton(event, 1) }, + isRightClick: function(event) { return isButton(event, 2) }, + + element: function(event) { + event = Event.extend(event); + + var node = event.target, + type = event.type, + currentTarget = event.currentTarget; + + if (currentTarget && currentTarget.tagName) { + // Firefox screws up the "click" event when moving between radio buttons + // via arrow keys. It also screws up the "load" and "error" events on images, + // reporting the document as the target instead of the original image. + if (type === 'load' || type === 'error' || + (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' + && currentTarget.type === 'radio')) + node = currentTarget; + } + if (node.nodeType == Node.TEXT_NODE) node = node.parentNode; + return Element.extend(node); + }, + + findElement: function(event, expression) { + var element = Event.element(event); + if (!expression) return element; + var elements = [element].concat(element.ancestors()); + return Selector.findElement(elements, expression, 0); + }, + + pointer: function(event) { + var docElement = document.documentElement, + body = document.body || { scrollLeft: 0, scrollTop: 0 }; + return { + x: event.pageX || (event.clientX + + (docElement.scrollLeft || body.scrollLeft) - + (docElement.clientLeft || 0)), + y: event.pageY || (event.clientY + + (docElement.scrollTop || body.scrollTop) - + (docElement.clientTop || 0)) + }; + }, + + pointerX: function(event) { return Event.pointer(event).x }, + pointerY: function(event) { return Event.pointer(event).y }, + + stop: function(event) { + Event.extend(event); + event.preventDefault(); + event.stopPropagation(); + event.stopped = true; + } + }; +})(); + +Event.extend = (function() { + var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { + m[name] = Event.Methods[name].methodize(); + return m; + }); + + if (Prototype.Browser.IE) { + Object.extend(methods, { + stopPropagation: function() { this.cancelBubble = true }, + preventDefault: function() { this.returnValue = false }, + inspect: function() { return "[object Event]" } + }); + + return function(event) { + if (!event) return false; + if (event._extendedByPrototype) return event; + + event._extendedByPrototype = Prototype.emptyFunction; + var pointer = Event.pointer(event); + Object.extend(event, { + target: event.srcElement, + relatedTarget: Event.relatedTarget(event), + pageX: pointer.x, + pageY: pointer.y + }); + return Object.extend(event, methods); + }; + + } else { + Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__']; + Object.extend(Event.prototype, methods); + return Prototype.K; + } +})(); + +Object.extend(Event, (function() { + var cache = Event.cache; + + function getEventID(element) { + if (element._prototypeEventID) return element._prototypeEventID[0]; + arguments.callee.id = arguments.callee.id || 1; + return element._prototypeEventID = [++arguments.callee.id]; + } + + function getDOMEventName(eventName) { + if (eventName && eventName.include(':')) return "dataavailable"; + return eventName; + } + + function getCacheForID(id) { + return cache[id] = cache[id] || { }; + } + + function getWrappersForEventName(id, eventName) { + var c = getCacheForID(id); + return c[eventName] = c[eventName] || []; + } + + function createWrapper(element, eventName, handler) { + var id = getEventID(element); + var c = getWrappersForEventName(id, eventName); + if (c.pluck("handler").include(handler)) return false; + + var wrapper = function(event) { + if (!Event || !Event.extend || + (event.eventName && event.eventName != eventName)) + return false; + + Event.extend(event); + handler.call(element, event); + }; + + wrapper.handler = handler; + c.push(wrapper); + return wrapper; + } + + function findWrapper(id, eventName, handler) { + var c = getWrappersForEventName(id, eventName); + return c.find(function(wrapper) { return wrapper.handler == handler }); + } + + function destroyWrapper(id, eventName, handler) { + var c = getCacheForID(id); + if (!c[eventName]) return false; + c[eventName] = c[eventName].without(findWrapper(id, eventName, handler)); + } + + function destroyCache() { + for (var id in cache) + for (var eventName in cache[id]) + cache[id][eventName] = null; + } + + + // Internet Explorer needs to remove event handlers on page unload + // in order to avoid memory leaks. + if (window.attachEvent) { + window.attachEvent("onunload", destroyCache); + } + + // Safari has a dummy event handler on page unload so that it won't + // use its bfcache. Safari <= 3.1 has an issue with restoring the "document" + // object when page is returned to via the back button using its bfcache. + if (Prototype.Browser.WebKit) { + window.addEventListener('unload', Prototype.emptyFunction, false); + } + + return { + observe: function(element, eventName, handler) { + element = $(element); + var name = getDOMEventName(eventName); + + var wrapper = createWrapper(element, eventName, handler); + if (!wrapper) return element; + + if (element.addEventListener) { + element.addEventListener(name, wrapper, false); + } else { + element.attachEvent("on" + name, wrapper); + } + + return element; + }, + + stopObserving: function(element, eventName, handler) { + element = $(element); + var id = getEventID(element), name = getDOMEventName(eventName); + + if (!handler && eventName) { + getWrappersForEventName(id, eventName).each(function(wrapper) { + element.stopObserving(eventName, wrapper.handler); + }); + return element; + + } else if (!eventName) { + Object.keys(getCacheForID(id)).each(function(eventName) { + element.stopObserving(eventName); + }); + return element; + } + + var wrapper = findWrapper(id, eventName, handler); + if (!wrapper) return element; + + if (element.removeEventListener) { + element.removeEventListener(name, wrapper, false); + } else { + element.detachEvent("on" + name, wrapper); + } + + destroyWrapper(id, eventName, handler); + + return element; + }, + + fire: function(element, eventName, memo) { + element = $(element); + if (element == document && document.createEvent && !element.dispatchEvent) + element = document.documentElement; + + var event; + if (document.createEvent) { + event = document.createEvent("HTMLEvents"); + event.initEvent("dataavailable", true, true); + } else { + event = document.createEventObject(); + event.eventType = "ondataavailable"; + } + + event.eventName = eventName; + event.memo = memo || { }; + + if (document.createEvent) { + element.dispatchEvent(event); + } else { + element.fireEvent(event.eventType, event); + } + + return Event.extend(event); + } + }; +})()); + +Object.extend(Event, Event.Methods); + +Element.addMethods({ + fire: Event.fire, + observe: Event.observe, + stopObserving: Event.stopObserving +}); + +Object.extend(document, { + fire: Element.Methods.fire.methodize(), + observe: Element.Methods.observe.methodize(), + stopObserving: Element.Methods.stopObserving.methodize(), + loaded: false +}); + +(function() { + /* Support for the DOMContentLoaded event is based on work by Dan Webb, + Matthias Miller, Dean Edwards and John Resig. */ + + var timer; + + function fireContentLoadedEvent() { + if (document.loaded) return; + if (timer) window.clearInterval(timer); + document.fire("dom:loaded"); + document.loaded = true; + } + + if (document.addEventListener) { + if (Prototype.Browser.WebKit) { + timer = window.setInterval(function() { + if (/loaded|complete/.test(document.readyState)) + fireContentLoadedEvent(); + }, 0); + + Event.observe(window, "load", fireContentLoadedEvent); + + } else { + document.addEventListener("DOMContentLoaded", + fireContentLoadedEvent, false); + } + + } else { + document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>"); + $("__onDOMContentLoaded").onreadystatechange = function() { + if (this.readyState == "complete") { + this.onreadystatechange = null; + fireContentLoadedEvent(); + } + }; + } +})(); +/*------------------------------- DEPRECATED -------------------------------*/ + +Hash.toQueryString = Object.toQueryString; + +var Toggle = { display: Element.toggle }; + +Element.Methods.childOf = Element.Methods.descendantOf; + +var Insertion = { + Before: function(element, content) { + return Element.insert(element, {before:content}); + }, + + Top: function(element, content) { + return Element.insert(element, {top:content}); + }, + + Bottom: function(element, content) { + return Element.insert(element, {bottom:content}); + }, + + After: function(element, content) { + return Element.insert(element, {after:content}); + } +}; + +var $continue = new Error('"throw $continue" is deprecated, use "return" instead'); + +// This should be moved to script.aculo.us; notice the deprecated methods +// further below, that map to the newer Element methods. +var Position = { + // set to true if needed, warning: firefox performance problems + // NOT neeeded for page scrolling, only if draggable contained in + // scrollable elements + includeScrollOffsets: false, + + // must be called before calling withinIncludingScrolloffset, every time the + // page is scrolled + prepare: function() { + this.deltaX = window.pageXOffset + || document.documentElement.scrollLeft + || document.body.scrollLeft + || 0; + this.deltaY = window.pageYOffset + || document.documentElement.scrollTop + || document.body.scrollTop + || 0; + }, + + // caches x/y coordinate pair to use with overlap + within: function(element, x, y) { + if (this.includeScrollOffsets) + return this.withinIncludingScrolloffsets(element, x, y); + this.xcomp = x; + this.ycomp = y; + this.offset = Element.cumulativeOffset(element); + + return (y >= this.offset[1] && + y < this.offset[1] + element.offsetHeight && + x >= this.offset[0] && + x < this.offset[0] + element.offsetWidth); + }, + + withinIncludingScrolloffsets: function(element, x, y) { + var offsetcache = Element.cumulativeScrollOffset(element); + + this.xcomp = x + offsetcache[0] - this.deltaX; + this.ycomp = y + offsetcache[1] - this.deltaY; + this.offset = Element.cumulativeOffset(element); + + return (this.ycomp >= this.offset[1] && + this.ycomp < this.offset[1] + element.offsetHeight && + this.xcomp >= this.offset[0] && + this.xcomp < this.offset[0] + element.offsetWidth); + }, + + // within must be called directly before + overlap: function(mode, element) { + if (!mode) return 0; + if (mode == 'vertical') + return ((this.offset[1] + element.offsetHeight) - this.ycomp) / + element.offsetHeight; + if (mode == 'horizontal') + return ((this.offset[0] + element.offsetWidth) - this.xcomp) / + element.offsetWidth; + }, + + // Deprecation layer -- use newer Element methods now (1.5.2). + + cumulativeOffset: Element.Methods.cumulativeOffset, + + positionedOffset: Element.Methods.positionedOffset, + + absolutize: function(element) { + Position.prepare(); + return Element.absolutize(element); + }, + + relativize: function(element) { + Position.prepare(); + return Element.relativize(element); + }, + + realOffset: Element.Methods.cumulativeScrollOffset, + + offsetParent: Element.Methods.getOffsetParent, + + page: Element.Methods.viewportOffset, + + clone: function(source, target, options) { + options = options || { }; + return Element.clonePosition(target, source, options); + } +}; + +/*--------------------------------------------------------------------------*/ + +if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ + function iter(name) { + return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; + } + + instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? + function(element, className) { + className = className.toString().strip(); + var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); + return cond ? document._getElementsByXPath('.//*' + cond, element) : []; + } : function(element, className) { + className = className.toString().strip(); + var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); + if (!classNames && !className) return elements; + + var nodes = $(element).getElementsByTagName('*'); + className = ' ' + className + ' '; + + for (var i = 0, child, cn; child = nodes[i]; i++) { + if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || + (classNames && classNames.all(function(name) { + return !name.toString().blank() && cn.include(' ' + name + ' '); + })))) + elements.push(Element.extend(child)); + } + return elements; + }; + + return function(className, parentElement) { + return $(parentElement || document.body).getElementsByClassName(className); + }; +}(Element.Methods); + +/*--------------------------------------------------------------------------*/ + +Element.ClassNames = Class.create(); +Element.ClassNames.prototype = { + initialize: function(element) { + this.element = $(element); + }, + + _each: function(iterator) { + this.element.className.split(/\s+/).select(function(name) { + return name.length > 0; + })._each(iterator); + }, + + set: function(className) { + this.element.className = className; + }, + + add: function(classNameToAdd) { + if (this.include(classNameToAdd)) return; + this.set($A(this).concat(classNameToAdd).join(' ')); + }, + + remove: function(classNameToRemove) { + if (!this.include(classNameToRemove)) return; + this.set($A(this).without(classNameToRemove).join(' ')); + }, + + toString: function() { + return $A(this).join(' '); + } +}; + +Object.extend(Element.ClassNames.prototype, Enumerable); + +/*--------------------------------------------------------------------------*/ + +Element.addMethods(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/js/scriptaculous.js b/maarch_entreprise/trunk/js/scriptaculous.js new file mode 100644 index 0000000000000000000000000000000000000000..6cfe36e8d5240f20d161cda8648fe4ee5bf22ad3 --- /dev/null +++ b/maarch_entreprise/trunk/js/scriptaculous.js @@ -0,0 +1,58 @@ +// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +var Scriptaculous = { + Version: '1.8.1', + require: function(libraryName) { + // inserting via DOM fails in Safari 2.0, so brute force approach + document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>'); + }, + REQUIRED_PROTOTYPE: '1.6.0', + load: function() { + function convertVersionString(versionString){ + var r = versionString.split('.'); + return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]); + } + + if((typeof Prototype=='undefined') || + (typeof Element == 'undefined') || + (typeof Element.Methods=='undefined') || + (convertVersionString(Prototype.Version) < + convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE))) + throw("script.aculo.us requires the Prototype JavaScript framework >= " + + Scriptaculous.REQUIRED_PROTOTYPE); + + $A(document.getElementsByTagName("script")).findAll( function(s) { + return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) + }).each( function(s) { + var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); + var includes = s.src.match(/\?.*load=([a-z,]*)/); + (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each( + function(include) { Scriptaculous.require(path+include+'.js') }); + }); + } +} + +Scriptaculous.load(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/js/scrollbox.js b/maarch_entreprise/trunk/js/scrollbox.js new file mode 100644 index 0000000000000000000000000000000000000000..232b3520efd617e209f5051eee93a2acdb9f87d7 --- /dev/null +++ b/maarch_entreprise/trunk/js/scrollbox.js @@ -0,0 +1,336 @@ +var ScrollBox = Class.create(); + +/** + * OPTION CONTSTANTS + */ + +// bar_action: what happens when you click on the blank part of the scrollbar? +// pass this in when creating a ScrollBox or change in the default object set +// found in the initialze method to change the default behavior +ScrollBox.NO_ACTION = 0; //Do nothing +ScrollBox.PAGE_ACTION = 1; //Jump forward or back one full page +ScrollBox.JUMP_ACTION = 2; //Jump to the position on the bar that was clicked + +Object.extend(ScrollBox.prototype, { + initialize: function(element, options){ + + this.element = element; + Element.addClassName(this.element, 'scrollbox'); + + this.opts = { + scroll_increment: 20, //How many pixels to scroll per click/button press/etc + hold_delay: 500, //The delay when holding the mouse down before it starts auto scrolling + hold_interval: 100, //The interval between auto scroll increments + drag_interval: 100, //How often the display is updated while dragging the handle + update_check_interval: 100, //How often to run integrity check and make sure the scrollbar is up to date + auto_hide: false, //Does the scrollbar hide when the content is too short for scrolling? + bar_action: ScrollBox.PAGE_ACTION //What happens when you click the empty part of the scrollbar? + }; + Object.extend(this.opts, options); + + //Move content into content div + this.content_div = document.createElement('div'); + Element.addClassName(this.content_div, 'scrollbox_content'); + $A(this.element.childNodes).each(function(n){ this.content_div.appendChild(n);}.bind(this)); + this.element.appendChild(this.content_div); + this.content_div.style.overflow = 'hidden'; + this.content_div.style.height = '100%'; + + //Add scrollbar div to element + this.scrollbar = document.createElement('div'); + Element.addClassName(this.scrollbar, 'scrollbox_scrollbar'); + this.element.appendChild(this.scrollbar); + this.scrollbar.style.position = 'absolute'; + this.scrollbar.style.top = '0'; + this.scrollbar.style.right = '0'; + + //Add up button + this.up_button = document.createElement('div'); + Element.addClassName(this.up_button, 'scrollbox_up_button'); + this.up_button.style.position = 'absolute'; + this.up_button.style.width = '100%'; + this.up_button.style.top = '0'; + this.up_button.style.right = '0'; + this.scrollbar.appendChild(this.up_button); + + //Add down button + this.down_button = document.createElement('div'); + Element.addClassName(this.down_button, 'scrollbox_down_button'); + this.down_button.style.position = 'absolute'; + this.down_button.style.width = '100%'; + this.down_button.style.bottom = '0'; + this.down_button.style.right = '0'; + this.scrollbar.appendChild(this.down_button); + + //Add Scroll Handle + this.handle = document.createElement('div'); + Element.addClassName(this.handle, 'scrollbox_handle'); + this.handle.style.position = 'absolute'; + this.handle.style.width = '100%'; + this.handle.style.right = '0'; + this.scrollbar.appendChild(this.handle); + + //Setup State Info + this.scroll_pos = 0; + this.setSizes(); + + //buttons actions + Event.observe(this.up_button, 'mousedown', function(e){this.buttonDown(e, this.scrollUp.bind(this));}.bindAsEventListener(this)); + Event.observe(this.down_button, 'mousedown', function(e){this.buttonDown(e, this.scrollDown.bind(this));}.bindAsEventListener(this)); + Event.observe(document, 'mouseup', this.buttonUp.bindAsEventListener(this)); + + //handle actions + Event.observe(document, 'mousemove', this.setMousePos.bindAsEventListener(this)); + Event.observe(this.handle, 'mousedown', this.handleDown.bindAsEventListener(this)); + this.handle_update_interval = setInterval(this.updateCheck.bind(this), this.opts.update_check_interval); + + //bar actions + Event.observe(this.up_button, 'click', function(e){Event.stop(e);}.bindAsEventListener(this)); + Event.observe(this.down_button, 'click', function(e){Event.stop(e);}.bindAsEventListener(this)); + Event.observe(this.handle, 'click', function(e){Event.stop(e);}.bindAsEventListener(this)); + Event.observe(this.scrollbar, 'click', this.scrollBarClick.bindAsEventListener(this)); + + //handle keypress events + this.keyboard_events = [ + [document, 'keypress', this.keyboardEvent.bindAsEventListener(this)] + ]; + Event.observe(this.element, 'click', this.enableKeyboardEvents.bindAsEventListener(this)); + Event.observe(document, 'click', this.disableKeyboardEvents.bindAsEventListener(this)); + + //handle scroll wheel + Event.observe(this.content_div, 'mousewheel', this.scrollWheel.bindAsEventListener(this), true); + Event.observe(this.content_div, 'DOMMouseScroll', this.scrollWheel.bindAsEventListener(this), true); + + }, + scrollDown: function(){ + if(this.scroll_pos < this.scroll_max){ + this.scrollTo(this.scroll_pos + this.opts.scroll_increment < this.scroll_max ? this.scroll_pos + this.opts.scroll_increment : this.scroll_max); + return true; + } + else{ + return false; + } + }, + scrollUp: function(){ + if(this.scroll_pos > 0){ + this.scrollTo(this.scroll_pos > this.opts.scroll_increment ? this.scroll_pos - this.opts.scroll_increment : 0); + return true; + } + else{ + return false; + } + }, + scrollTo: function(new_pos){ + //console.log(new_pos, this.content_div); + if(new_pos < 0){ + new_pos = 0; + } + if(new_pos > this.scroll_max){ + new_pos = this.scroll_max; + } + this.content_div.scrollTop = new_pos; + this.scroll_pos = new_pos; + this.updateHandle(); + }, + buttonDown: function(event, action){ + action(); + this.timeout = setTimeout(function(){ + action(); + this.timeout = null; + if(this.interval){ clearInterval(this.interval);} + this.interval = setInterval(action, this.opts.hold_interval); + }.bind(this), this.opts.hold_delay); + Event.stop(event); + }, + buttonUp: function(event){ + if(this.timeout){ + clearTimeout(this.timeout); + } + if(this.interval){ + clearInterval(this.interval); + } + this.timeout = null; + this.interval = null; + this.down_position = null; + }, + updateHandle: function(){ + if(this.scroll_max){ + this.handle_height = Math.floor(this.bar_height / this.scroll_height_ratio); + } + else{ + this.handle_height = this.bar_height; + } + //console.log(this.handle_height); + + if(this.opts.auto_hide){ + if(this.handle_height == this.bar_height){ + this.scrollbar.style.visibility = 'hidden'; + } + else{ + this.scrollbar.style.visibility = ''; + } + } + this.handle_height = 10; + var handle_top = this.up_button.offsetHeight; + var handle_bottom = this.up_button.offsetHeight + (this.bar_height - this.handle_height); + var bar_dist_height = handle_bottom - handle_top; + if(this.scroll_max) + this.handle_pos = handle_top + Math.floor(bar_dist_height * (this.scroll_pos / this.scroll_max)); + else + this.handle_pos = handle_top; + + this.handle.style.height = this.handle_height + 'px'; + //this.handle.style.height = '30px'; + this.handle.style.top = this.handle_pos + 'px'; + }, + handleDown: function(){ + this.down_position = this.raw_mouse_pos - Position.cumulativeOffset(this.handle)[1]; + // console.log('Down at: ' , this.down_position, Position.cumulativeOffset(this.handle)[1], this.mouse_pos); + if(this.interval){ clearInterval(this.interval);} + this.interval = setInterval(function(){ + this.scrollTo(this.mouse_pos - (this.down_position * this.scroll_height_ratio)); + }.bindAsEventListener(this), this.opts.drag_interval); + }, + setMousePos: function(e){ + if (document.all) { // grab the x-y pos.s if browser is IE + tempY = event.clientY + document.body.scrollTop; + } else { // grab the x-y pos.s if browser is NS + tempY = e.pageY; + } + // catch possible negative values + if (tempY < 0){tempY = 0;} + + this.raw_mouse_pos = tempY; + this.mouse_pos = Math.floor((tempY - this.scrollbar_top) * this.scroll_height_ratio); + }, + setSizes: function(){ + this.scroll_max = this.content_div.scrollHeight - this.content_div.offsetHeight; + if(this.scroll_max < 0) this.scroll_max = 0; + + if(this.scroll_pos > this.scroll_max){ + this.scrollTo(this.scroll_max); + } + + this.bar_height = this.scrollbar.offsetHeight - (this.up_button.offsetHeight + this.down_button.offsetHeight); + if(!this.bar_height){ + setTimeout(this.setSizes.bind(this), 100); + } + + this.scroll_height_ratio = (this.content_div.scrollHeight / this.bar_height); + this.scroll_height_ratio = this.scroll_height_ratio >= 1 ? this.scroll_height_ratio : 1; + + this.scrollbar_top = Position.cumulativeOffset(this.scrollbar)[1] + this.up_button.offsetHeight; + this.scrollbar_bottom = this.scrollbar_top + this.bar_height; + + this.updateHandle(); + }, + scrollBarClick: function(event){ + switch(this.opts.bar_action){ + case ScrollBox.PAGE_ACTION: + //clicked above the handle + if(this.mouse_pos < this.handle_pos * this.scroll_height_ratio){ + this.pageUp(); + } + //clicked below the handle + else{ + this.pageDown(); + } + break; + case ScrollBox.JUMP_ACTION: + this.scrollTo(this.mouse_pos); + break; + } + }, + pageUp: function(){ + this.scrollTo(this.scroll_pos - this.content_div.offsetHeight); + }, + pageDown: function(){ + this.scrollTo(this.scroll_pos + this.content_div.offsetHeight); + }, + scrollWheel: function(event){ + var scroll_amount = Event.wheel(event); + if(scroll_amount > 0){ + for(var i = 0; i < Math.ceil(scroll_amount); ++i){ + this.scrollUp(); + } + if(this.scroll_pos > 0){ + Event.stop(event); + } + } + else if(scroll_amount < 0){ + for(var i = 0; i > Math.floor(scroll_amount); --i){ + this.scrollDown(); + } + if(this.scroll_pos < this.scroll_max){ + Event.stop(event); + } + } + }, + updateCheck: function(){ + //Has the scroll pos been changed by something else? + if(this.content_div.scrollTop != this.scroll_pos){ + this.scrollTo(this.content_div.scrollTop); + } + + if(this.scroll_max != this.content_div.scrollHeight - this.content_div.offsetHeight){ + this.setSizes(); + } + }, + enableKeyboardEvents: function(event){ + this.disableKeyboardEvents(event); + + this.keyboard_events.each(function(ke){ + Event.observe(ke[0], ke[1], ke[2]); + }); + + this.within_enable_event = true; + }, + disableKeyboardEvents: function(event){ + if(!this.within_enable_event){ + this.keyboard_events.each(function(ke){ + Event.stopObserving(ke[0], ke[1], ke[2]); + }); + } + else{ + this.within_enable_event = false; + } + }, + keyboardEvent: function(event){ + switch(event.keyCode){ + case Event.KEY_HOME: + this.scrollTo(0); + break; + case Event.KEY_END: + this.scrollTo(this.scroll_max); + break; + case Event.KEY_PAGEUP: + this.pageUp(); + break; + case Event.KEY_PAGEDOWN: + this.pageDown(); + break; + case Event.KEY_UP: + this.scrollUp(); + break; + case Event.KEY_DOWN: + this.scrollDown(); + break; + default: + return; + } + Event.stop(event); + } +}); + +// Add mouse wheel support to prototype +Object.extend(Event, { + wheel:function (event){ + var delta = 0; + if (!event) event = window.event; + if (event.wheelDelta) { + delta = event.wheelDelta/120; + if (window.opera) delta = -delta; + } else if (event.detail) { delta = -event.detail/3; } + return delta; //Safari Round + } +}); diff --git a/maarch_entreprise/trunk/js/search_adv.js b/maarch_entreprise/trunk/js/search_adv.js new file mode 100755 index 0000000000000000000000000000000000000000..71f9ab3e7973dff77ae42181a5bd524a445d78f9 --- /dev/null +++ b/maarch_entreprise/trunk/js/search_adv.js @@ -0,0 +1,492 @@ +<!-- +/** + * Load a query in the Advanced Search page + * + * @param valeurs Array Values of the search criteria which must be displayed + * @param loaded_query Array Values of the search criteria + * @param id_form String Search form identifier + * @param ie_browser Bool Browser is internet explorer or not + * @param error_ie_txt String Error message specific to ie browser + **/ +function load_query(valeurs, loaded_query, id_form, ie_browser, error_ie_txt) +{ + for( var critere in loaded_query) + { + if(valeurs[critere] != undefined) // in the valeurs array + { + add_criteria('option_'+critere, id_form, ie_browser, error_ie_txt); + } + eval("processingFunction=fill_field_"+loaded_query[critere]['type']); + if (typeof(processingFunction) == 'function') // test if the funtion exists + { + processingFunction(loaded_query[critere]['fields'] ); + } + } +} + +/** + * Fills inputs fields of text type in the search form whith value + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_input_text(values) +{ + for( var key in values) + { + var tmp_elem = $(key); + tmp_elem.value = values[key]; + } +} + +/** + * Fills textarea field in the search form whith value + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_textarea(values) +{ + for( var key in values) + { + var tmp_elem = $(key); + if(tmp_elem) + { + tmp_elem.value = values[key]; + } + } +} + +/** + * Fills date range in the search form whith value + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_date_range(values) +{ + for( var key in values) + { + var tmp_elem = $(key); + tmp_elem.value = values[key][0]; + } +} + +/** + * Selects an item in a simple list (html select object) in the search form + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_select_simple(values) +{ + for( var key in values) + { + var tmp_elem = $(key); + for(var j=0; j <values[key].length;j++) + { + for(var i=0; i<tmp_elem.options.length;i++) + { + if(values[key][j] == tmp_elem.options[i].value) + { + tmp_elem.options[i].selected='selected'; + } + } + } + } +} + +/** + * Selects items in a mutiple list (html select object with multiple) in the search form + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_select_multiple(values) +{ + for( var key in values) + { + if(key.indexOf('_chosen') >= 0) + { + var available = key.substring(0, key.length -7)+'_available'; + var available_list = $(available); + for(var j=0; j <values[key].length;j++) + { + for(var i=0; i<available_list.options.length;i++) + { + if(values[key][j] == available_list.options[i].value) + { + available_list.options[i].selected='selected'; + } + } + } + Move_ext(available, key); + } + } +} + +/** + * Checks checkboxes in the search form + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_checkbox(values) +{ + for( var key in values) + { + var tmp_elem = $(key); + tmp_elem.checked='checked'; + } +} + +/** + * Fills address fields in the search form whith values + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_address(values) +{ + for( var key in values) + { + var tmp_elem = $(key); + if(tmp_elem.tagName == "INPUT" && tmp_elem.type == "text") + { + tmp_elem.value = values[key][0]; + } + else if(tmp_elem.tagName == "SELECT") + { + for(var j=0; j <values[key].length;j++) + { + for(var i=0; i<tmp_elem.options.length;i++) + { + if(values[key][j] == tmp_elem.options[i].value) + { + tmp_elem.options[i].selected='selected'; + } + } + } + } + } +} + +/** + * Fills input text or selects an item in a list in the search form + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_simple_list_or_input_text(values) +{ + var show_input = false; + for( var key in values) + { + var tmp_elem = $(key); + if(key.indexOf('select_') >= 0) + { + for(var i=0; i<tmp_elem.options.length;i++) + { + if(values[key][0] == tmp_elem.options[i].value) + { + tmp_elem.options[i].selected='selected'; + } + } + if(values[key][0] == 'SHOW_DATA') + { + show_input = true; + } + } + else if(key.indexOf('input_') >= 0) + { + tmp_elem.value = values[key]; + if(show_input) + { + hide_show_elem(key, true); + } + else + { + hide_show_elem(key, false); + } + } + } +} + +/** + * Selects an item in a list and fills inputs text in the search form + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_select_or_other_data(values) +{ + var show_data = false; + var id_elem= ''; + for( var key in values) + { + var tmp_elem = $(key); + if(key.indexOf('select_') >= 0) + { + id_elem = key.substring(7, key.length); + for(var i=0; i<tmp_elem.options.length;i++) + { + if(values[key][0] == tmp_elem.options[i].value) + { + tmp_elem.options[i].selected='selected'; + } + } + if(values[key][0] == 'SHOW_DATA') + { + show_data = true; + display_elem('div_'+id_elem, true); + } + else + { + display_elem('div_'+id_elem, false); + } + } + if(id_elem != '') + { + if(key.indexOf(id_elem+'_') >= 0) + { + tmp_elem.value = values[key]; + } + } + } +} + +/** + * Checks radio button in the search form + * + * @param values Array Values of the search criteria which must be displayed + **/ +function fill_field_radio(values) +{ + for( var key in values) + { + var tmp_elem = $(key); + tmp_elem.checked='checked'; + } +} + +/** + * Adds criteria in the search form + * + * @param elem_comp String Identifier of the option of the criteria list to displays in the search form + * @param id_form String Search form identifier + * @param ie_browser Bool Is the browser internet explorer or not + * @param error_txt_ie String Error message specific to ie browser + **/ +function add_criteria(elem_comp, id_form, ie_browser, error_txt_ie) +{ + // Takes the id of the chosen option which must be one of the valeurs array + var elem = elem_comp.substring(7, elem_comp.length); + var form = window.$(id_form); + var valeur = valeurs[elem]; + if(ie_browser) + { + var div_node = $('search_parameters_'+elem); + } + if(typeof(valeur) != 'undefined'){ + if(ie_browser == true && typeof(div_node) != 'undefined' && div_node != null) + { + alert(error_txt_ie); + } + else + { + var node = document.createElement("div"); + node.setAttribute('id','search_parameters_'+elem); + tmp = '<table width="100%" border="0"><tr><td width="30%"><img src="img/puce_next.gif" /> '+valeur['label']+'</td><td>'; + tmp += valeur['value']; + tmp += '</td><td width="30px">'; + tmp += '<a href="#" onclick="delete_criteria(\''+elem+'\', \''+id_form+'\');return false;"><img src="img/picto_stat_disabled.gif"></a>'; + tmp += '</td></tr></table>'; + // Loading content in the page + node.innerHTML = tmp; + form.appendChild(node); + label = $(elem_comp); + label.parentNode.selectedIndex=0; + label.style.display="none"; + // label.disabled = !label.disabled; + } + }else{ + //Error if the valeur array has no key 'id' + //alert('Error with Javascript Search Adv '); + } +} + +/** + * Deletes a criteria in the search form + * + * @param elem_comp String Identifier of the option of the criteria list to delete in the search form + * @param id_form String Search form identifier + **/ +function delete_criteria(id_elem, id_form) +{ + var form = $(id_form); + var tmp = (id_elem.indexOf('option_') >=0)?id_elem:'option_'+id_elem; + var label = $(tmp); + label.style.display=""; +// label.disabled = !label.disabled; + tmp = (id_elem.indexOf('option_') >=0)?id_elem.substring(7, id_elem.length):id_elem; + form.removeChild($('search_parameters_'+tmp)); +} + +/** + * Validates the search form, selects all list options ending with _chosen (type select_multiple) to avoid missing elements + * + * @param id_form String Search form identifier + **/ +function valid_search_form(id_form) +{ + var frm = $(id_form); + //var reg_chosen = new RegExp("_chosen$"); + var selects = frm.getElementsByTagName('select'); //Array + for(var i=0; i< selects.length;i++) + { + if(selects[i].multiple && selects[i].id.indexOf('_chosen') >= 0) + { + selectall_ext(selects[i].id); + } + } +} + +/** + * Clears the search form : delete all optional criteria in the form + * + * @param id_form String Search form identifier + * @param id_list String Criteria list identifier + **/ +function clear_search_form(id_form,id_list) +{ + var list = $(id_list); + for(var i=0; i <list.options.length;i++) + { + if(list.options[i].style.display == "none") + { + delete_criteria(list.options[i].id, id_form); + } + } + var elems = document.getElementsByTagName('INPUT'); + for(var i=0; i<elems.length;i++) + { + if(elems[i].type == "text") + { + elems[i].value =''; + } + } + var copie_false = $('copies_false'); + copie_false.checked = true; + +} + +/** + * Clears the queries list : remove an option in this list + * + * @param item_value String Identifier of the item to remove + **/ +function clear_q_list(item_value) +{ + var query = $('query'); + if(item_value && item_value != '') + { + var item = $('query_'+item_value); + query.removeChild(item); + } + if(query.options.length > 1) + { + var q_list = $('default_query'); + q_list.selected="selected"; + var del_button = $('del_query'); + del_button.style.display='none'; + } + else + { + var div_query = $('div_query'); + div_query .style.display = 'none'; + } +} + +/** + * Load a saved query in the Advanced Search page (using Ajax) + * + * @param id_query String Identifier of the saved query to load + * @param id_form_to_load String Identifier of the search form + * @param sql_error_txt String SQL error message + * @param server_error_txt String Server error message + * @param manage_script String Ajax script + **/ +function load_query_db(id_query, id_list, id_form_to_load, sql_error_txt, server_error_txt, manage_script) +{ + if(id_query != '') + { + var query_object = new Ajax.Request(manage_script, + { + method:'post', + parameters: {id: id_query, + action : "load" + }, + onSuccess: function(answer){ + eval("response = "+answer.responseText+';'); + if(response.status == 0) + { + + clear_search_form(id_form_to_load,id_list); //Clears the search form + if(response.query instanceof Object && response.query!={}) + { + load_query(valeurs, response.query, id_form_to_load); + } + var del_button = $('del_query'); + del_button.style.display='inline'; + } + else if(response.status == 2) + { + $('error').update(sql_error_txt); + } + else + { + $('error').update(server_error_txt); + } + }, + onFailure: function(){ + $('error').update(server_error_txt); + } + }); + } + } + +/** + * Delete a saved query in the database (using Ajax) + * + * @param id_query String Identifier of the saved query to delete + * @param id_list String Identifier of the queries list + * @param id_form_to_load String Identifier of the search form + * @param sql_error_txt String SQL error message + * @param server_error_txt String Server error message + * @param path_script String Ajax script + **/ +function del_query_db( id_query, id_list, id_form_to_load, sql_error_txt, server_error_txt, path_script) +{ + if(id_query != '') + { + var query_object = new Ajax.Request(path_script, + { + method:'post', + parameters: {id: id_query.value, + action : "delete" + }, + onSuccess: function(answer){ + + eval("response = "+answer.responseText+';'); + if(response.status == 0) + { + clear_search_form(id_form_to_load,id_list); //Clears search form + clear_q_list(id_query.value); + } + else if(response.status == 2) + { + $('error').update(sql_error_txt); + } + else + { + $('error').update(server_error_txt); + } + }, + onFailure: function(){ + $('error').update(server_error_txt); + } + }); + } +} +--> diff --git a/maarch_entreprise/trunk/js/slider.js b/maarch_entreprise/trunk/js/slider.js new file mode 100644 index 0000000000000000000000000000000000000000..cc46fe37863bd9fca5fd05fef79351533f2ba947 --- /dev/null +++ b/maarch_entreprise/trunk/js/slider.js @@ -0,0 +1,275 @@ +// script.aculo.us slider.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +if (!Control) var Control = { }; + +// options: +// axis: 'vertical', or 'horizontal' (default) +// +// callbacks: +// onChange(value) +// onSlide(value) +Control.Slider = Class.create({ + initialize: function(handle, track, options) { + var slider = this; + + if (Object.isArray(handle)) { + this.handles = handle.collect( function(e) { return $(e) }); + } else { + this.handles = [$(handle)]; + } + + this.track = $(track); + this.options = options || { }; + + this.axis = this.options.axis || 'horizontal'; + this.increment = this.options.increment || 1; + this.step = parseInt(this.options.step || '1'); + this.range = this.options.range || $R(0,1); + + this.value = 0; // assure backwards compat + this.values = this.handles.map( function() { return 0 }); + this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; + this.options.startSpan = $(this.options.startSpan || null); + this.options.endSpan = $(this.options.endSpan || null); + + this.restricted = this.options.restricted || false; + + this.maximum = this.options.maximum || this.range.end; + this.minimum = this.options.minimum || this.range.start; + + // Will be used to align the handle onto the track, if necessary + this.alignX = parseInt(this.options.alignX || '0'); + this.alignY = parseInt(this.options.alignY || '0'); + + this.trackLength = this.maximumOffset() - this.minimumOffset(); + + this.handleLength = this.isVertical() ? + (this.handles[0].offsetHeight != 0 ? + this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : + (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : + this.handles[0].style.width.replace(/px$/,"")); + + this.active = false; + this.dragging = false; + this.disabled = false; + + if (this.options.disabled) this.setDisabled(); + + // Allowed values array + this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; + if (this.allowedValues) { + this.minimum = this.allowedValues.min(); + this.maximum = this.allowedValues.max(); + } + + this.eventMouseDown = this.startDrag.bindAsEventListener(this); + this.eventMouseUp = this.endDrag.bindAsEventListener(this); + this.eventMouseMove = this.update.bindAsEventListener(this); + + // Initialize handles in reverse (make sure first handle is active) + this.handles.each( function(h,i) { + i = slider.handles.length-1-i; + slider.setValue(parseFloat( + (Object.isArray(slider.options.sliderValue) ? + slider.options.sliderValue[i] : slider.options.sliderValue) || + slider.range.start), i); + h.makePositioned().observe("mousedown", slider.eventMouseDown); + }); + + this.track.observe("mousedown", this.eventMouseDown); + document.observe("mouseup", this.eventMouseUp); + document.observe("mousemove", this.eventMouseMove); + + this.initialized = true; + }, + dispose: function() { + var slider = this; + Event.stopObserving(this.track, "mousedown", this.eventMouseDown); + Event.stopObserving(document, "mouseup", this.eventMouseUp); + Event.stopObserving(document, "mousemove", this.eventMouseMove); + this.handles.each( function(h) { + Event.stopObserving(h, "mousedown", slider.eventMouseDown); + }); + }, + setDisabled: function(){ + this.disabled = true; + }, + setEnabled: function(){ + this.disabled = false; + }, + getNearestValue: function(value){ + if (this.allowedValues){ + if (value >= this.allowedValues.max()) return(this.allowedValues.max()); + if (value <= this.allowedValues.min()) return(this.allowedValues.min()); + + var offset = Math.abs(this.allowedValues[0] - value); + var newValue = this.allowedValues[0]; + this.allowedValues.each( function(v) { + var currentOffset = Math.abs(v - value); + if (currentOffset <= offset){ + newValue = v; + offset = currentOffset; + } + }); + return newValue; + } + if (value > this.range.end) return this.range.end; + if (value < this.range.start) return this.range.start; + return value; + }, + setValue: function(sliderValue, handleIdx){ + if (!this.active) { + this.activeHandleIdx = handleIdx || 0; + this.activeHandle = this.handles[this.activeHandleIdx]; + this.updateStyles(); + } + handleIdx = handleIdx || this.activeHandleIdx || 0; + if (this.initialized && this.restricted) { + if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1])) + sliderValue = this.values[handleIdx-1]; + if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1])) + sliderValue = this.values[handleIdx+1]; + } + sliderValue = this.getNearestValue(sliderValue); + this.values[handleIdx] = sliderValue; + this.value = this.values[0]; // assure backwards compat + + this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = + this.translateToPx(sliderValue); + + this.drawSpans(); + if (!this.dragging || !this.event) this.updateFinished(); + }, + setValueBy: function(delta, handleIdx) { + this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, + handleIdx || this.activeHandleIdx || 0); + }, + translateToPx: function(value) { + return Math.round( + ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * + (value - this.range.start)) + "px"; + }, + translateToValue: function(offset) { + return ((offset/(this.trackLength-this.handleLength) * + (this.range.end-this.range.start)) + this.range.start); + }, + getRange: function(range) { + var v = this.values.sortBy(Prototype.K); + range = range || 0; + return $R(v[range],v[range+1]); + }, + minimumOffset: function(){ + return(this.isVertical() ? this.alignY : this.alignX); + }, + maximumOffset: function(){ + return(this.isVertical() ? + (this.track.offsetHeight != 0 ? this.track.offsetHeight : + this.track.style.height.replace(/px$/,"")) - this.alignY : + (this.track.offsetWidth != 0 ? this.track.offsetWidth : + this.track.style.width.replace(/px$/,"")) - this.alignX); + }, + isVertical: function(){ + return (this.axis == 'vertical'); + }, + drawSpans: function() { + var slider = this; + if (this.spans) + $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); + if (this.options.startSpan) + this.setSpan(this.options.startSpan, + $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); + if (this.options.endSpan) + this.setSpan(this.options.endSpan, + $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); + }, + setSpan: function(span, range) { + if (this.isVertical()) { + span.style.top = this.translateToPx(range.start); + span.style.height = this.translateToPx(range.end - range.start + this.range.start); + } else { + span.style.left = this.translateToPx(range.start); + span.style.width = this.translateToPx(range.end - range.start + this.range.start); + } + }, + updateStyles: function() { + this.handles.each( function(h){ Element.removeClassName(h, 'selected') }); + Element.addClassName(this.activeHandle, 'selected'); + }, + startDrag: function(event) { + if (Event.isLeftClick(event)) { + if (!this.disabled){ + this.active = true; + + var handle = Event.element(event); + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var track = handle; + if (track==this.track) { + var offsets = Position.cumulativeOffset(this.track); + this.event = event; + this.setValue(this.translateToValue( + (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) + )); + var offsets = Position.cumulativeOffset(this.activeHandle); + this.offsetX = (pointer[0] - offsets[0]); + this.offsetY = (pointer[1] - offsets[1]); + } else { + // find the handle (prevents issues with Safari) + while((this.handles.indexOf(handle) == -1) && handle.parentNode) + handle = handle.parentNode; + + if (this.handles.indexOf(handle)!=-1) { + this.activeHandle = handle; + this.activeHandleIdx = this.handles.indexOf(this.activeHandle); + this.updateStyles(); + + var offsets = Position.cumulativeOffset(this.activeHandle); + this.offsetX = (pointer[0] - offsets[0]); + this.offsetY = (pointer[1] - offsets[1]); + } + } + } + Event.stop(event); + } + }, + update: function(event) { + if (this.active) { + if (!this.dragging) this.dragging = true; + this.draw(event); + if (Prototype.Browser.WebKit) window.scrollBy(0,0); + Event.stop(event); + } + }, + draw: function(event) { + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var offsets = Position.cumulativeOffset(this.track); + pointer[0] -= this.offsetX + offsets[0]; + pointer[1] -= this.offsetY + offsets[1]; + this.event = event; + this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); + if (this.initialized && this.options.onSlide) + this.options.onSlide(this.values.length>1 ? this.values : this.value, this); + }, + endDrag: function(event) { + if (this.active && this.dragging) { + this.finishDrag(event, true); + Event.stop(event); + } + this.active = false; + this.dragging = false; + }, + finishDrag: function(event, success) { + this.active = false; + this.dragging = false; + this.updateFinished(); + }, + updateFinished: function() { + if (this.initialized && this.options.onChange) + this.options.onChange(this.values.length>1 ? this.values : this.value, this); + this.event = null; + } +}); diff --git a/maarch_entreprise/trunk/js/sound.js b/maarch_entreprise/trunk/js/sound.js new file mode 100644 index 0000000000000000000000000000000000000000..eba38432cecca77232f9accc0acccaae189e2a0b --- /dev/null +++ b/maarch_entreprise/trunk/js/sound.js @@ -0,0 +1,55 @@ +// script.aculo.us sound.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// Based on code created by Jules Gravinese (http://www.webveteran.com/) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +Sound = { + tracks: {}, + _enabled: true, + template: + new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'), + enable: function(){ + Sound._enabled = true; + }, + disable: function(){ + Sound._enabled = false; + }, + play: function(url){ + if(!Sound._enabled) return; + var options = Object.extend({ + track: 'global', url: url, replace: false + }, arguments[1] || {}); + + if(options.replace && this.tracks[options.track]) { + $R(0, this.tracks[options.track].id).each(function(id){ + var sound = $('sound_'+options.track+'_'+id); + sound.Stop && sound.Stop(); + sound.remove(); + }) + this.tracks[options.track] = null; + } + + if(!this.tracks[options.track]) + this.tracks[options.track] = { id: 0 } + else + this.tracks[options.track].id++; + + options.id = this.tracks[options.track].id; + $$('body')[0].insert( + Prototype.Browser.IE ? new Element('bgsound',{ + id: 'sound_'+options.track+'_'+options.id, + src: options.url, loop: 1, autostart: true + }) : Sound.template.evaluate(options)); + } +}; + +if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){ + if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 })) + Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>') + else + Sound.play = function(){} +} diff --git a/maarch_entreprise/trunk/js/tabricator.js b/maarch_entreprise/trunk/js/tabricator.js new file mode 100644 index 0000000000000000000000000000000000000000..7ec65ae8c266b9890394558a0d7739d75dfb9449 --- /dev/null +++ b/maarch_entreprise/trunk/js/tabricator.js @@ -0,0 +1,36 @@ +var Tabricator = Class.create(); +Tabricator.prototype = { + root : null, + trigtype : null, + targtype : null, + initialize : function (lmnt,trig,deep) { + var root = this.root = $(lmnt).addClassName('tabricator').cleanWhitespace(); + this.trigtype = trig; + this.targtype = this.root.select(trig).first().next().nodeName; + var trigs = this.root.select(this.trigtype).each(function(trig){ + if (trig.up() === root) trig.addClassName('trig'); + }); + var targs = this.root.select(this.targtype).each(function(targ){ + if (targ.up() === root) { + targ.addClassName('targ').hide(); + root.insert(targ); + } + }); + trigs[0].addClassName('open'); + targs[0].show(); + this.root.observe('click',this.swap.bindAsEventListener(this)); + }, + swap : function (event) { + var trig = Event.element(event); + if (trig.nodeName !== this.trigtype || trig.up() !== this.root) return; + var trigs = this.root.select(this.trigtype).invoke('removeClassName','open'); + var targs = this.root.select(this.targtype).invoke('hide'); + var i = trigs.length; + while (i--) { + if (trigs[i] === trig) { + trigs[i].addClassName('open'); + targs[i].show(); + } + } + } +}; diff --git a/maarch_entreprise/trunk/js/unittest.js b/maarch_entreprise/trunk/js/unittest.js new file mode 100644 index 0000000000000000000000000000000000000000..7eed8a5490e75e03b147934b21e6160d28e86fc6 --- /dev/null +++ b/maarch_entreprise/trunk/js/unittest.js @@ -0,0 +1,568 @@ +// script.aculo.us unittest.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) +// (c) 2005-2007 Michael Schuerig (http://www.schuerig.de/michael/) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// experimental, Firefox-only +Event.simulateMouse = function(element, eventName) { + var options = Object.extend({ + pointerX: 0, + pointerY: 0, + buttons: 0, + ctrlKey: false, + altKey: false, + shiftKey: false, + metaKey: false + }, arguments[2] || {}); + var oEvent = document.createEvent("MouseEvents"); + oEvent.initMouseEvent(eventName, true, true, document.defaultView, + options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element)); + + if(this.mark) Element.remove(this.mark); + this.mark = document.createElement('div'); + this.mark.appendChild(document.createTextNode(" ")); + document.body.appendChild(this.mark); + this.mark.style.position = 'absolute'; + this.mark.style.top = options.pointerY + "px"; + this.mark.style.left = options.pointerX + "px"; + this.mark.style.width = "5px"; + this.mark.style.height = "5px;"; + this.mark.style.borderTop = "1px solid red;" + this.mark.style.borderLeft = "1px solid red;" + + if(this.step) + alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options)); + + $(element).dispatchEvent(oEvent); +}; + +// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2. +// You need to downgrade to 1.0.4 for now to get this working +// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much +Event.simulateKey = function(element, eventName) { + var options = Object.extend({ + ctrlKey: false, + altKey: false, + shiftKey: false, + metaKey: false, + keyCode: 0, + charCode: 0 + }, arguments[2] || {}); + + var oEvent = document.createEvent("KeyEvents"); + oEvent.initKeyEvent(eventName, true, true, window, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, + options.keyCode, options.charCode ); + $(element).dispatchEvent(oEvent); +}; + +Event.simulateKeys = function(element, command) { + for(var i=0; i<command.length; i++) { + Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)}); + } +}; + +var Test = {} +Test.Unit = {}; + +// security exception workaround +Test.Unit.inspect = Object.inspect; + +Test.Unit.Logger = Class.create(); +Test.Unit.Logger.prototype = { + initialize: function(log) { + this.log = $(log); + if (this.log) { + this._createLogTable(); + } + }, + start: function(testName) { + if (!this.log) return; + this.testName = testName; + this.lastLogLine = document.createElement('tr'); + this.statusCell = document.createElement('td'); + this.nameCell = document.createElement('td'); + this.nameCell.className = "nameCell"; + this.nameCell.appendChild(document.createTextNode(testName)); + this.messageCell = document.createElement('td'); + this.lastLogLine.appendChild(this.statusCell); + this.lastLogLine.appendChild(this.nameCell); + this.lastLogLine.appendChild(this.messageCell); + this.loglines.appendChild(this.lastLogLine); + }, + finish: function(status, summary) { + if (!this.log) return; + this.lastLogLine.className = status; + this.statusCell.innerHTML = status; + this.messageCell.innerHTML = this._toHTML(summary); + this.addLinksToResults(); + }, + message: function(message) { + if (!this.log) return; + this.messageCell.innerHTML = this._toHTML(message); + }, + summary: function(summary) { + if (!this.log) return; + this.logsummary.innerHTML = this._toHTML(summary); + }, + _createLogTable: function() { + this.log.innerHTML = + '<div id="logsummary"></div>' + + '<table id="logtable">' + + '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' + + '<tbody id="loglines"></tbody>' + + '</table>'; + this.logsummary = $('logsummary') + this.loglines = $('loglines'); + }, + _toHTML: function(txt) { + return txt.escapeHTML().replace(/\n/g,"<br/>"); + }, + addLinksToResults: function(){ + $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log + td.title = "Run only this test" + Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;}); + }); + $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log + td.title = "Run all tests" + Event.observe(td, 'click', function(){ window.location.search = "";}); + }); + } +} + +Test.Unit.Runner = Class.create(); +Test.Unit.Runner.prototype = { + initialize: function(testcases) { + this.options = Object.extend({ + testLog: 'testlog' + }, arguments[1] || {}); + this.options.resultsURL = this.parseResultsURLQueryParameter(); + this.options.tests = this.parseTestsQueryParameter(); + if (this.options.testLog) { + this.options.testLog = $(this.options.testLog) || null; + } + if(this.options.tests) { + this.tests = []; + for(var i = 0; i < this.options.tests.length; i++) { + if(/^test/.test(this.options.tests[i])) { + this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"])); + } + } + } else { + if (this.options.test) { + this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])]; + } else { + this.tests = []; + for(var testcase in testcases) { + if(/^test/.test(testcase)) { + this.tests.push( + new Test.Unit.Testcase( + this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, + testcases[testcase], testcases["setup"], testcases["teardown"] + )); + } + } + } + } + this.currentTest = 0; + this.logger = new Test.Unit.Logger(this.options.testLog); + setTimeout(this.runTests.bind(this), 1000); + }, + parseResultsURLQueryParameter: function() { + return window.location.search.parseQuery()["resultsURL"]; + }, + parseTestsQueryParameter: function(){ + if (window.location.search.parseQuery()["tests"]){ + return window.location.search.parseQuery()["tests"].split(','); + }; + }, + // Returns: + // "ERROR" if there was an error, + // "FAILURE" if there was a failure, or + // "SUCCESS" if there was neither + getResult: function() { + var hasFailure = false; + for(var i=0;i<this.tests.length;i++) { + if (this.tests[i].errors > 0) { + return "ERROR"; + } + if (this.tests[i].failures > 0) { + hasFailure = true; + } + } + if (hasFailure) { + return "FAILURE"; + } else { + return "SUCCESS"; + } + }, + postResults: function() { + if (this.options.resultsURL) { + new Ajax.Request(this.options.resultsURL, + { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false }); + } + }, + runTests: function() { + var test = this.tests[this.currentTest]; + if (!test) { + // finished! + this.postResults(); + this.logger.summary(this.summary()); + return; + } + if(!test.isWaiting) { + this.logger.start(test.name); + } + test.run(); + if(test.isWaiting) { + this.logger.message("Waiting for " + test.timeToWait + "ms"); + setTimeout(this.runTests.bind(this), test.timeToWait || 1000); + } else { + this.logger.finish(test.status(), test.summary()); + this.currentTest++; + // tail recursive, hopefully the browser will skip the stackframe + this.runTests(); + } + }, + summary: function() { + var assertions = 0; + var failures = 0; + var errors = 0; + var messages = []; + for(var i=0;i<this.tests.length;i++) { + assertions += this.tests[i].assertions; + failures += this.tests[i].failures; + errors += this.tests[i].errors; + } + return ( + (this.options.context ? this.options.context + ': ': '') + + this.tests.length + " tests, " + + assertions + " assertions, " + + failures + " failures, " + + errors + " errors"); + } +} + +Test.Unit.Assertions = Class.create(); +Test.Unit.Assertions.prototype = { + initialize: function() { + this.assertions = 0; + this.failures = 0; + this.errors = 0; + this.messages = []; + }, + summary: function() { + return ( + this.assertions + " assertions, " + + this.failures + " failures, " + + this.errors + " errors" + "\n" + + this.messages.join("\n")); + }, + pass: function() { + this.assertions++; + }, + fail: function(message) { + this.failures++; + this.messages.push("Failure: " + message); + }, + info: function(message) { + this.messages.push("Info: " + message); + }, + error: function(error) { + this.errors++; + this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")"); + }, + status: function() { + if (this.failures > 0) return 'failed'; + if (this.errors > 0) return 'error'; + return 'passed'; + }, + assert: function(expression) { + var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"'; + try { expression ? this.pass() : + this.fail(message); } + catch(e) { this.error(e); } + }, + assertEqual: function(expected, actual) { + var message = arguments[2] || "assertEqual"; + try { (expected == actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertInspect: function(expected, actual) { + var message = arguments[2] || "assertInspect"; + try { (expected == actual.inspect()) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertEnumEqual: function(expected, actual) { + var message = arguments[2] || "assertEnumEqual"; + try { $A(expected).length == $A(actual).length && + expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ? + this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + + ', actual ' + Test.Unit.inspect(actual)); } + catch(e) { this.error(e); } + }, + assertNotEqual: function(expected, actual) { + var message = arguments[2] || "assertNotEqual"; + try { (expected != actual) ? this.pass() : + this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertIdentical: function(expected, actual) { + var message = arguments[2] || "assertIdentical"; + try { (expected === actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertNotIdentical: function(expected, actual) { + var message = arguments[2] || "assertNotIdentical"; + try { !(expected === actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertNull: function(obj) { + var message = arguments[1] || 'assertNull' + try { (obj==null) ? this.pass() : + this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); } + catch(e) { this.error(e); } + }, + assertMatch: function(expected, actual) { + var message = arguments[2] || 'assertMatch'; + var regex = new RegExp(expected); + try { (regex.exec(actual)) ? this.pass() : + this.fail(message + ' : regex: "' + Test.Unit.inspect(expected) + ' did not match: ' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertHidden: function(element) { + var message = arguments[1] || 'assertHidden'; + this.assertEqual("none", element.style.display, message); + }, + assertNotNull: function(object) { + var message = arguments[1] || 'assertNotNull'; + this.assert(object != null, message); + }, + assertType: function(expected, actual) { + var message = arguments[2] || 'assertType'; + try { + (actual.constructor == expected) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + (actual.constructor) + '"'); } + catch(e) { this.error(e); } + }, + assertNotOfType: function(expected, actual) { + var message = arguments[2] || 'assertNotOfType'; + try { + (actual.constructor != expected) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + (actual.constructor) + '"'); } + catch(e) { this.error(e); } + }, + assertInstanceOf: function(expected, actual) { + var message = arguments[2] || 'assertInstanceOf'; + try { + (actual instanceof expected) ? this.pass() : + this.fail(message + ": object was not an instance of the expected type"); } + catch(e) { this.error(e); } + }, + assertNotInstanceOf: function(expected, actual) { + var message = arguments[2] || 'assertNotInstanceOf'; + try { + !(actual instanceof expected) ? this.pass() : + this.fail(message + ": object was an instance of the not expected type"); } + catch(e) { this.error(e); } + }, + assertRespondsTo: function(method, obj) { + var message = arguments[2] || 'assertRespondsTo'; + try { + (obj[method] && typeof obj[method] == 'function') ? this.pass() : + this.fail(message + ": object doesn't respond to [" + method + "]"); } + catch(e) { this.error(e); } + }, + assertReturnsTrue: function(method, obj) { + var message = arguments[2] || 'assertReturnsTrue'; + try { + var m = obj[method]; + if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; + m() ? this.pass() : + this.fail(message + ": method returned false"); } + catch(e) { this.error(e); } + }, + assertReturnsFalse: function(method, obj) { + var message = arguments[2] || 'assertReturnsFalse'; + try { + var m = obj[method]; + if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; + !m() ? this.pass() : + this.fail(message + ": method returned true"); } + catch(e) { this.error(e); } + }, + assertRaise: function(exceptionName, method) { + var message = arguments[2] || 'assertRaise'; + try { + method(); + this.fail(message + ": exception expected but none was raised"); } + catch(e) { + ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); + } + }, + assertElementsMatch: function() { + var expressions = $A(arguments), elements = $A(expressions.shift()); + if (elements.length != expressions.length) { + this.fail('assertElementsMatch: size mismatch: ' + elements.length + ' elements, ' + expressions.length + ' expressions'); + return false; + } + elements.zip(expressions).all(function(pair, index) { + var element = $(pair.first()), expression = pair.last(); + if (element.match(expression)) return true; + this.fail('assertElementsMatch: (in index ' + index + ') expected ' + expression.inspect() + ' but got ' + element.inspect()); + }.bind(this)) && this.pass(); + }, + assertElementMatches: function(element, expression) { + this.assertElementsMatch([element], expression); + }, + benchmark: function(operation, iterations) { + var startAt = new Date(); + (iterations || 1).times(operation); + var timeTaken = ((new Date())-startAt); + this.info((arguments[2] || 'Operation') + ' finished ' + + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); + return timeTaken; + }, + _isVisible: function(element) { + element = $(element); + if(!element.parentNode) return true; + this.assertNotNull(element); + if(element.style && Element.getStyle(element, 'display') == 'none') + return false; + + return this._isVisible(element.parentNode); + }, + assertNotVisible: function(element) { + this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1])); + }, + assertVisible: function(element) { + this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1])); + }, + benchmark: function(operation, iterations) { + var startAt = new Date(); + (iterations || 1).times(operation); + var timeTaken = ((new Date())-startAt); + this.info((arguments[2] || 'Operation') + ' finished ' + + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); + return timeTaken; + } +} + +Test.Unit.Testcase = Class.create(); +Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), { + initialize: function(name, test, setup, teardown) { + Test.Unit.Assertions.prototype.initialize.bind(this)(); + this.name = name; + + if(typeof test == 'string') { + test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,'); + test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)'); + this.test = function() { + eval('with(this){'+test+'}'); + } + } else { + this.test = test || function() {}; + } + + this.setup = setup || function() {}; + this.teardown = teardown || function() {}; + this.isWaiting = false; + this.timeToWait = 1000; + }, + wait: function(time, nextPart) { + this.isWaiting = true; + this.test = nextPart; + this.timeToWait = time; + }, + run: function() { + try { + try { + if (!this.isWaiting) this.setup.bind(this)(); + this.isWaiting = false; + this.test.bind(this)(); + } finally { + if(!this.isWaiting) { + this.teardown.bind(this)(); + } + } + } + catch(e) { this.error(e); } + } +}); + +// *EXPERIMENTAL* BDD-style testing to please non-technical folk +// This draws many ideas from RSpec http://rspec.rubyforge.org/ + +Test.setupBDDExtensionMethods = function(){ + var METHODMAP = { + shouldEqual: 'assertEqual', + shouldNotEqual: 'assertNotEqual', + shouldEqualEnum: 'assertEnumEqual', + shouldBeA: 'assertType', + shouldNotBeA: 'assertNotOfType', + shouldBeAn: 'assertType', + shouldNotBeAn: 'assertNotOfType', + shouldBeNull: 'assertNull', + shouldNotBeNull: 'assertNotNull', + + shouldBe: 'assertReturnsTrue', + shouldNotBe: 'assertReturnsFalse', + shouldRespondTo: 'assertRespondsTo' + }; + var makeAssertion = function(assertion, args, object) { + this[assertion].apply(this,(args || []).concat([object])); + } + + Test.BDDMethods = {}; + $H(METHODMAP).each(function(pair) { + Test.BDDMethods[pair.key] = function() { + var args = $A(arguments); + var scope = args.shift(); + makeAssertion.apply(scope, [pair.value, args, this]); }; + }); + + [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each( + function(p){ Object.extend(p, Test.BDDMethods) } + ); +} + +Test.context = function(name, spec, log){ + Test.setupBDDExtensionMethods(); + + var compiledSpec = {}; + var titles = {}; + for(specName in spec) { + switch(specName){ + case "setup": + case "teardown": + compiledSpec[specName] = spec[specName]; + break; + default: + var testName = 'test'+specName.gsub(/\s+/,'-').camelize(); + var body = spec[specName].toString().split('\n').slice(1); + if(/^\{/.test(body[0])) body = body.slice(1); + body.pop(); + body = body.map(function(statement){ + return statement.strip() + }); + compiledSpec[testName] = body.join('\n'); + titles[testName] = specName; + } + } + new Test.Unit.Runner(compiledSpec, { titles: titles, testLog: log || 'testlog', context: name }); +}; \ No newline at end of file diff --git a/maarch_entreprise/trunk/keywords_help.php b/maarch_entreprise/trunk/keywords_help.php new file mode 100644 index 0000000000000000000000000000000000000000..08879f1662e1c25ae11d422ec55621633fcb7953 --- /dev/null +++ b/maarch_entreprise/trunk/keywords_help.php @@ -0,0 +1,70 @@ +<?php +/** +* File : keywords_help.php +* +* Help for keywords +* +* @package Maarch Letterbox 3.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Loïc Vinet <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + + +function show_helper() +{ + $core_tools = new core_tools(); + $core_tools->load_lang(); + $core_tools->load_html(); + ?> + <div class="block small_text" > + + + <h3><img src = "<?php echo $_SESSION['config']['businessappurl'].$_SESSION['config']['img'];?>/picto_detail_b.gif"> <? echo _HELP_KEYWORDS; ?></h3> + <? + + echo "<p align='right'>"; + echo "<b><u>"._HELP_BY_CORE.":</u></b><br/><br/>"; + echo "</p>"; + echo "<p>"; + echo "<b>@user : </b><em>"._HELP_KEYWORD0."</em>"; + echo "</p><br/>"; + + if($core_tools->is_module_loaded('entities') == true) + { + echo "<p align='right'>"; + echo "<b><u>"._HELP_BY_ENTITY.":</u></b><br/><br/>"; + echo "</p>"; + echo "<p align='justify'>"; + echo "<p><b>@my_entities : </b><em>"._HELP_KEYWORD1."</em></p>"; + echo "<p><b>@my_primary_entity : </b><em>"._HELP_KEYWORD2."</em></p>"; + echo "<p><b>@subentities[(entity_1,...,entity_n)] : </b><em>"._HELP_KEYWORD3."</em><br/></p>"; + echo "<p><b>@parent_entity[entity_id] : <em></b>"._HELP_KEYWORD4."</em><br/></p>"; + echo "<p><b>@sisters[entity_id] : <em></b>"._HELP_KEYWORD5."</em><br/></p>"; + echo "<p><b>@all_entities : <em></b>"._HELP_KEYWORD6."</em><br/></p>"; + echo "<p><b>@immediate_children[entity_1,..., entity_id] : </b><em>"._HELP_KEYWORD7."</em><br/></p>"; + echo "<br/>"._HELP_KEYWORD_EXEMPLE_TITLE."<br/><br/>"; + echo "<div style='border:1px black solid; padding:3px;'><b>"._HELP_KEYWORD_EXEMPLE."</b></div>"; + echo "</p>"; + } + echo "</div>"; + echo "<div class='block_end'> </div>"; +} + + + + +$core_tools = new core_tools(); +$core_tools->load_lang(); +$core_tools->load_html(); +$core_tools->load_header(); +echo '<div id="header">'; +show_helper(); +echo '</div>'; + + diff --git a/maarch_entreprise/trunk/lang/en.php b/maarch_entreprise/trunk/lang/en.php new file mode 100644 index 0000000000000000000000000000000000000000..87d2ad4f439bea2ed2374d49b570d6bf39e191dc --- /dev/null +++ b/maarch_entreprise/trunk/lang/en.php @@ -0,0 +1,606 @@ +<?php +/* + * + * Copyright 2008,2009 Maarch + * + * This file is part of Maarch Framework. + * + * Maarch Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Maarch Framework is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. + */ + +/************** Administration **************/ +define('_ADMIN_USERS', 'Users'); +define('_ADMIN_USERS_DESC', 'Add, suspend, or modify users profiles. Affect users to their groups and define their primary group.'); +define('_ADMIN_GROUPS', 'User groups'); +define('_ADMIN_GROUPS_DESC', 'Add, suspend, or modify user groups. Set privileges or authorization to access resources.'); +define('_ADMIN_ARCHITECTURE', 'Folders" organisation'); +define('_ADMIN_ARCHITECTURE_DESC', 'Define the inner structure of a folder (folder / sub-folder / document type). For each, define their associated descriptors and wether they are mandatory for a folder to be complete.'); +define('_VIEW_HISTORY', 'Logs'); +define('_VIEW_HISTORY_BATCH', 'Logs of batchs'); +define('_VIEW_HISTORY_DESC', 'View the log of actions done in Maarch DMS.'); +define('_VIEW_HISTORY_BATCH_DESC', 'View the log of batchs'); +define('_ADMIN_MODULES', 'Manage modules'); +define('_ADMIN_SERVICE', 'Administration service'); +define('_XML_PARAM_SERVICE_DESC', 'View servicex XML config'); +define('_XML_PARAM_SERVICE', 'View servicex XML config'); +define('_MODULES_SERVICES', 'Services defined by modules'); +define('_APPS_SERVICES', 'Services defined by the application'); +define('_ADMIN_STATUS_DESC', 'Add or modify statuses.'); +define('_ADMIN_ACTIONS_DESC', 'Add or modify actions.'); +define('_ADMIN_SERVICES_UNKNOWN', 'Unknown administration service'); +define('_NO_RIGHTS_ON', 'No rights for'); +define('_NO_LABEL_FOUND', 'No label found for this service'); + +define('_FOLDERTYPES_LIST', 'List of document types'); +define('_SELECTED_FOLDERTYPES', 'Selected document types'); +define('_FOLDERTYPE_ADDED', 'New document added'); +define('_FOLDERTYPE_DELETION', 'Document deleted'); + + +/*********************** communs ***********************************/ + +/************** Listes **************/ +define('_GO_TO_PAGE', 'Go to page'); +define('_NEXT', 'Next'); +define('_PREVIOUS', 'Previous'); +define('_ALPHABETICAL_LIST', 'Alphabetical list'); +define('_ASC_SORT', 'Upwards sorting'); +define('_DESC_SORT', 'Downwards sorting'); +/************** Actions **************/ +define('_DELETE', 'Delete'); +define('_ADD', 'Add'); +define('_REMOVE', 'Remove'); +define('_MODIFY', 'Modify'); +define('_SUSPEND', 'Disable'); +define('_AUTHORIZE', 'Enable'); +define('_SEND', 'Send'); +define('_SEARCH', 'Search'); +define('_RESET', 'Reset'); +define('_VALIDATE', 'Confirm'); +define('_CANCEL', 'Cancel'); +define('_ADDITION', 'Addition'); +define('_MODIFICATION', 'Modification'); +define('_DIFFUSION', 'Diffusion'); +define('_DELETION', 'Deletion'); +define('_SUSPENSION', 'Suspension'); +define('_VALIDATION', 'Confirmation'); +define('_REDIRECTION', 'Redirection'); +define('_DUPLICATION', 'Duplication'); +define('_PROPOSITION', 'Proposition'); +define('_CLOSE', 'Close'); +define('_CLOSE_WINDOW', 'Close the window'); +define('_DIFFUSE', 'Diffuse'); +define('_DOWN', 'Move down'); +define('_UP', 'Move up'); +define('_REDIRECT', 'Redirect'); +define('_DELETED', 'Deleted'); +define('_CONTINUE', 'Continue'); +define('_VIEW','View'); +define('_CHOOSE_ACTION', 'Choose an action'); +define('_ACTIONS', 'Actions'); +define('_ACTION_PAGE', 'Result page for the action'); +define('_DO_NOT_MODIFY_UNLESS_EXPERT', ' Don"t modify this section unless you know exactly what you do. Wrong settings can stop the application from working!'); +define('_INFOS_ACTIONS', 'You must choose at least a status and/or a script file.'); + + + +/************** Intitulés formulaires et listes **************/ +define("_ID", 'Id'); +define("_PASSWORD", 'Password'); +define('_GROUP', 'Group'); +define('_USER', 'User'); +define('_DESC', 'Description'); +define('_LASTNAME', 'Name'); +define('_THE_LASTNAME', 'The name'); +define('_THE_FIRSTNAME', 'The first name'); +define('_FIRSTNAME', 'First name'); +define('_STATUS', 'Status'); +define('_DEPARTMENT', 'Department'); +define('_FUNCTION', 'Role'); +define('_PHONE_NUMBER', 'Phone number'); +define('_MAIL', 'E-mail'); +define('_DOCTYPE', 'Document type'); +define('_TYPE', 'Type'); +define('_SELECT_ALL', 'Select all'); +define('_DATE', 'Date'); +define('_ACTION', 'Action'); +define('_COMMENTS', 'Comments'); +define('_ENABLED', 'Enabled'); +define('_NOT_ENABLED', 'Disabled'); +define('_RESSOURCES_COLLECTION','Document collection'); +define('_RECIPIENT', 'Recipient'); +define('_START', 'Start'); +define('_END', 'End'); + +/************** Messages pop up **************/ +define('_REALLY_SUSPEND', 'Do you really want to disable '); +define('_REALLY_AUTHORIZE', 'Do you really want to enable '); +define('_REALLY_DELETE', 'Do you really want to remove '); +define('_DEFINITIVE_ACTION', 'This action is definitive.'); + +/************** Divers **************/ +define('_YES', 'yes'); +define('_NO', 'No'); +define('_UNKNOWN', 'Unknown'); +define('_SINCE','Since'); +define('_FOR','To'); +define('_HELLO','Hello'); +define('_OBJECT','Object'); +define('_BACK','Back'); +define('_FORMAT','Format'); +define('_SIZE','Size'); +define('_DOC', 'Document '); +define('_THE_DOC', 'The document'); +define('_BYTES', 'bytes'); +define('_OR', 'or'); +define('_NOT_AVAILABLE', 'Not available'); +define('_SELECTION', 'Selection'); +define('_AND', ' and ' ); +define('_FILE','File'); +define('_UNTIL', 'To'); + +//class functions +define('_SECOND', 'second'); +define('_SECONDS', 'seconds'); +define('_PAGE_GENERATED_IN', 'Generated in'); +define('_IS_EMPTY', 'is empty'); +define('_MUST_MAKE_AT_LEAST', 'must contain at least' ); +define('_CHARACTER', 'character'); +define('_CHARACTERS', 'characters'); +define('MUST_BE_LESS_THAN', 'must not be longer than'); +define('_WRONG_FORMAT', 'is not well formated'); +define('_WELCOME', 'Welcome to Maarch Framework 3.0!'); +define('_HELP', 'Help'); +define('_SEARCH_ADV_SHORT', 'Advanced search'); +define('_RESULTS', 'Results'); +define('_USERS_LIST_SHORT', 'User list'); +define('_MODELS_LIST_SHORT', 'Template list'); +define('_GROUPS_LIST_SHORT', 'Group list'); +define('_DEPARTMENTS_LIST_SHORT', 'Service list'); +define('_BITMASK', 'Bitmask parameter'); +define('_DOCTYPES_LIST_SHORT', 'Type list'); +define('_BAD_MONTH_FORMAT', 'The month is incorrect'); +define('_BAD_DAY_FORMAT', 'The day is incorrect'); +define('_BAD_YEAR_FORMAT', 'The year incorrect'); +define('_BAD_FEBRUARY', 'February has 29 days or less'); +define('_CHAPTER_SHORT', 'Chapt. '); +define('_PROCESS_SHORT', 'Processing'); +define('_CARD', 'form'); + +/************************* First login ***********************************/ +define('_MODIFICATION_PSW', 'Modifying Password'); +define('_YOUR_FIRST_CONNEXION', 'Welcome to March Framework!<br /> This is your first connexion to the application.'); +define('_PLEASE_CHANGE_PSW', ' Please modify your password.'); +define('_ASKED_ONLY_ONCE', 'This will only be asked once'); +define('_FIRST_CONN', 'First connection connection'); +define('_LOGIN', 'Connection'); +define('_RELOGIN', 'Reconnection'); + +/************************* index page***********************************/ +define('_LOGO_ALT', 'Back to homepage'); +define('_LOGOUT', 'Logout'); +define('_MENU', 'Menu'); +define('_ADMIN', 'Administration'); +define('_SUMMARY', 'Admin panel'); +define('_MANAGE_DIPLOMA', 'Manage diplomas'); +define('_MANAGE_CONTRACT', 'Manage contracts types'); +define('_MANAGE_REL_MODEL', 'Manage reminder template'); +define('_MANAGE_DOCTYPES', 'Manage document types'); +define('_MANAGE_DOCTYPES_DESC', 'Manage document types. Document types are attached to a resource collection. For each type, you can define the descriptors to fill in and whether they are mandatory.'); +define('_VIEW_HISTORY2', 'View logs'); +define('_VIEW_HISTORY_BATCH2', 'View logs of batchs'); +define('_INDEX_FILE', 'Add a document'); +define('_WORDING', 'Label'); +define('_COLLECTION', 'Collection'); +define('_VIEW_TREE_DOCTYPES', 'Folder organisation tree.'); +define('_VIEW_TREE_DOCTYPES_DESC', 'View the visualisation tree (type of folders, structure, sub-folders and type of documents)'); +define('_WELCOME_ON', 'Welcome to'); + +/************************* Administration ***********************************/ + +/**************Sommaire**************/ +define('_MANAGE_GROUPS_APP', 'Manage user groups'); +define('_MANAGE_USERS_APP', 'Manage Users'); +define('_MANAGE_DIPLOMA_APP', 'Manage diplomas'); +define('_MANAGE_DOCTYPES_APP', 'Manage document types'); +define('_MANAGE_ARCHI_APP', 'Manage documents types sorting tree'); +define('_MANAGE_CONTRACT_APP', 'Manage types of contracts'); +define('_HISTORY_EXPLANATION', 'Monitor modifications, deletions and additions in the application'); +define('_ARCHI_EXP', 'Folders, subfolders and document types'); + + +/************** Groupes : Liste + Formulaire**************/ + +define('_GROUPS_LIST', 'Group list'); +define('_ADMIN_GROUP', 'Admin Group'); +define('_ADD_GROUP', 'Add a group'); +define('_ALL_GROUPS', 'All the groups'); +define('_GROUPS', 'groups'); + +define('_GROUP_ADDITION', 'Add a group'); +define('_GROUP_MODIFICATION', 'Edit a group'); +define('_SEE_GROUP_MEMBERS', 'See users of this groups'); +define('_OTHER_RIGHTS', 'Other rights'); +define('_MODIFY_GROUP', 'Accept changes'); +define('_THE_GROUP', 'The group'); +define('_HAS_NO_SECURITY', 'has no defined security' ); + +define('_DEFINE_A_GRANT', 'Define At least an access right'); +define('_MANAGE_RIGHTS', 'This group has access to following resources'); +define('_TABLE', 'Table'); +define('_WHERE_CLAUSE', 'WHERE clause'); +define('_INSERT', 'Insertion'); +define('_UPDATE', 'Update'); +define('_REMOVE_ACCESS', 'Remove access'); +define('_MODIFY_ACCESS', 'Modify access'); +define('_UPDATE_RIGHTS', 'update rights'); +define('_ADD_GRANT', 'Add access'); +define('_USERS_LIST_IN_GROUP', 'List of users in the group'); + +/************** Utilisateurs : Liste + Formulaire**************/ + +define('_USERS_LIST', 'User list'); +define('_ADD_USER', 'Add a user'); +define('_ALL_USERS', 'all users'); +define('_USERS', 'users'); +define('_USER_ADDITION', 'Add an user'); +define('_USER_MODIFICATION', 'Modify an user'); +define('_MODIFY_USER', 'Modify the user'); + +define('_NOTES', 'Notes'); +define('_NOTE1', 'Mandatory fields are shown with a red star '); +define('_NOTE2', 'The primary group is mandatory'); +define('_NOTE3', 'The first group selected will be the primary group of the user'); +define('_USER_GROUPS_TITLE', 'The user belongs to the following groups'); +define('_DELETE_GROUPS', 'Delete group(s)'); +define('_ADD_TO_GROUP', 'Add a group'); +define('_CHOOSE_PRIMARY_GROUP', 'Choose as primary group'); +define('_USER_BELONGS_NO_GROUP', 'The user does not belong to any group'); +define('_CHOOSE_ONE_GROUP', 'Select at least one group'); +define('_PRIMARY_GROUP', 'Primary Group'); +define('_CHOOSE_GROUP', 'Select a group'); +define('_ROLE', 'Role'); + +define('_THE_PSW', 'The password'); +define('_THE_PSW_VALIDATION', 'Verification for the password' ); +define('_REENTER_PSW', 'Reenter the password'); +define('_USER_ACCESS_DEPARTMENT', 'The user has access to following departments'); +define('_FIRST_PSW', 'The first password '); +define('_SECOND_PSW', 'The second password '); + +define('_PASSWORD_MODIFICATION', 'PAssword modification'); +define('_PASSWORD_FOR_USER', 'the password for the usert'); +define('_HAS_BEEN_RESET', 'has been reset'); +define('_NEW_PASW_IS', 'the new password is '); +define('_DURING_NEXT_CONNEXION', 'on the next login '); +define('_MUST_CHANGE_PSW', 'must change his/her password'); + +define('_NEW_PASSWORD_USER', 'Resetting the password for the user'); + +/************** Types de document : Liste + Formulaire**************/ + +define('_DOCTYPES_LIST', 'List of document types'); +define('_ADD_DOCTYPE', 'Add a document type'); +define('_ALL_DOCTYPES', 'All types'); +define('_TYPES', 'types'); + +define('_DOCTYPE_MODIFICATION', 'Modifying a document type'); +define('_DOCTYPE_CREATION', 'Adding a document type'); + +define('_MODIFY_DOCTYPE', 'Confirm changes'); +define('_ATTACH_SUBFOLDER', 'Attach to subfolder'); +define('_CHOOSE_SUBFOLDER', 'Select a subfolder'); +define('_MANDATORY_FOR_COMPLETE', 'Mandatory for a folder to be complete'); +define('_MORE_THAN_ONE', 'Iterative file'); +define('_MANDATORY_FIELDS_IN_INDEX', 'Mandatory fields for indexing'); +define('_DIPLOMA_LEVEL', 'Degree of the dipoma'); +define('_THE_DIPLOMA_LEVEL', 'The Degree of the diploma'); +define('_DATE_END_DETACH_TIME', 'Date de fin de période de détachement'); +define('_START_DATE', 'Beginning date'); +define('_START_DATE_PROBATION', 'Probation beginning date'); +define('_END_DATE', 'End date'); +define('_END_DATE_PROBATION', 'Probation end date'); +define('_START_DATE_TRIAL', 'Trial beginning date'); +define('_START_DATE_MISSION', 'Mission beginning date'); +define('_END_DATE_TRIAL', 'Trial end date'); +define('_END_DATE_MISSION', 'Mission end date'); +define('_EVENT_DATE', 'Date of the event'); +define('_VISIT_DATE', 'Attendance date'); +define('_CHANGE_DATE', 'Change date '); +define('_DOCTYPES_LIST2', 'List of document types'); + +define('_INDEX_FOR_DOCTYPES', 'Available descriptors for document types'); +define('_FIELD', 'Field'); +define('_USED', 'Used'); +define('_MANDATORY', 'Mandatory'); +define('_ITERATIVE', 'Itérative'); + +define('_MASTER_TYPE', 'Master doc type'); + +/************** structures : Liste + Formulaire**************/ +define('_STRUCTURE_LIST', 'Structure list'); +define('_STRUCTURES', 'structures'); +define('_STRUCTURE', 'Structure'); +define('_ALL_STRUCTURES', 'All structures'); + +define('_THE_STRUCTURE', 'the structure'); +define('_STRUCTURE_MODIF', 'Modifying the structure'); +define('_ID_STRUCTURE_PB', 'A problem occurs with the id of the structure'); +define('_NEW_STRUCTURE_ADDED', 'Adding a new structure'); +define('_NEW_STRUCTURE', 'New structure'); +define('_DESC_STRUCTURE_MISSING', 'The description of the structure is missing'); +define('_STRUCTURE_DEL', 'Deletion of the structure'); +define('_DELETED_STRUCTURE', 'Structure deleted'); + +/************** sous-dossiers : Liste + Formulaire**************/ +define('_SUBFOLDER_LIST', 'Sub-folder list'); +define('_SUBFOLDERS', 'sub-folders'); +define('_ALL_SUBFOLDERS', 'All sub-folders'); +define('_SUBFOLDER', 'Sub-folder'); + +define('_ADD_SUBFOLDER', 'Add a new subfolder'); +define('_THE_SUBFOLDER', 'The subfolder'); +define('_SUBFOLDER_MODIF', 'Modify a subfolder'); +define('_SUBFOLDER_CREATION', 'Adding a sub-folder'); +define('_SUBFOLDER_ID_PB', 'A proble occurs with the id of the subfolder'); +define('_SUBFOLDER_ADDED', 'Adding a sub-folder'); +define('_NEW_SUBFOLDER', 'New sub-folder'); +define('_STRUCTURE_MANDATORY', 'A structure is mandatory'); +define('_SUBFOLDER_DESC_MISSING', 'The description of the sub-folder is missing'); + +define('_ATTACH_STRUCTURE', 'Attach to a structure'); +define('_CHOOSE_STRUCTURE', 'Choose a structure'); + +define('_DEL_SUBFOLDER', 'delete a sub-folder'); +define('_SUBFOLDER_DELETED', 'Sub-folder deleted'); + + +/************** Status **************/ + +define('_STATUS_LIST', 'Status list'); +define('_ADD_STATUS', 'Add a new status'); +define('_ALL_STATUS', 'All status'); +define('_STATUS_PLUR', 'statuses'); +define('_STATUS_SING', 'status'); + +define('_STATUS_DELETED', 'Delete status'); +define('_DEL_STATUS', 'Status deleted'); +define('_MODIFY_STATUS', 'Modify statut'); +define('_STATUS_ADDED','Status added'); +define('_STATUS_MODIFIED','Status modified'); +define('_NEW_STATUS', 'New status'); +define('_IS_SYSTEM', 'System'); +define('_CAN_BE_SEARCHED', 'Appear in search form'); +define('_THE_STATUS', 'The status '); +define('_ADMIN_STATUS', 'Statuses'); +define('_ADMIN_STATUS_DESC', 'Manage the available statuses for documents in this application'); +/************* Actions **************/ + +define('_ACTION_LIST', 'Actions list'); +define('_ADD_ACTION', 'Add a new action'); +define('_ALL_ACTIONS', 'Alls actions'); +define('_ACTIONS', 'actions'); +define('_ACTION', 'action'); +define('_ACTION_HISTORY', 'Log the action'); + +define('_ACTION_DELETED', 'Delete the action'); +define('_DEL_ACTION', 'Action deleted'); +define('_MODIFY_ACTION', 'Modify the action'); +define('_ACTION_ADDED','Action added'); +define('_ACTION_MODIFIED','Action modified'); +define('_NEW_ACTION', 'New action'); +define('_THE_ACTION', 'The action '); +define('_ADMIN_ACTIONS', 'Actions'); +define('_ADMIN_ACTIONS_DESC', 'Manage available actions in the application'); + +/************** Historique**************/ +define('_HISTORY_TITLE', 'Events log'); +define('_HISTORY_BATCH_TITLE', 'Events log of batchs'); +define('_HISTORY', 'Log'); +define('_HISTORY_BATCH', 'Log of batch'); +define('_BATCH_NAME', 'Batch name'); +define('_CHOOSE_BATCH', 'Choose batch'); +define('_BATCH_ID', 'Batch id'); +define('_TOTAL_PROCESSED', 'Total processed'); +define('_TOTAL_ERRORS', 'Total errors'); +define('_ONLY_ERRORS', 'Only with errors'); +define('_INFOS', 'Infos'); + +/************** Admin de l'architecture (plan de classement) **************/ +define('_ADMIN_ARCHI', 'Administration of document sorting trees'); +define('_MANAGE_STRUCTURE', 'Manage folders'); +define('_MANAGE_STRUCTURE_DESC', 'Manage folders. They are the highest element of the hierarchy. If the "Folder" module is enabled, you can attach a folder tyupe to a sorting tree.'); +define('_MANAGE_SUBFOLDER', 'Manage sub-folders'); +define('_MANAGE_SUBFOLDER_DESC', 'Manage su-foldsers in folders.'); +define('_ARCHITECTURE', 'sorting tree'); + +/************************* Messages d'erreurs ***********************************/ +define('_MORE_INFOS', 'Contact your admin for more information '); +define('_ALREADY_EXISTS', 'already exists!'); + +// class usergroups +define('_NO_GROUP', 'The group does not exist !'); +define('_NO_SECURITY_AND_NO_SERVICES', 'has no defined security and no service'); +define('_GROUP_ADDED', 'Ne group added'); +define('_SYNTAX_ERROR_WHERE_CLAUSE', 'error in the WHERE clause syntax'); +define('_GROUP_UPDATED', 'Group modified'); +define('_AUTORIZED_GROUP', 'Group enabled'); +define('_SUSPENDED_GROUP', 'Groupdisabled'); +define('_DELETED_GROUP', 'Group deleted'); +define('_GROUP_UPDATE', 'Modifying a group'); +define('_GROUP_AUTORIZATION', 'Enabling a group'); +define('_GROUP_SUSPENSION', 'Disabling a group'); +define('_GROUP_DELETION', 'Deleting a group'); +define('_GROUP_DESC', 'The description of a group '); +define('_GROUP_ID', 'The id of the group'); +define('_EXPORT_RIGHT', 'Export right'); + +//class users +define('_USER_NO_GROUP', 'you do not belong to any group'); +define('_SUSPENDED_ACCOUNT', 'Your account has been disabled'); +define('_BAD_LOGIN_OR_PSW', 'Wrong username or password'); +define('_WRONG_SECOND_PSW', 'the second password does not match the first one!'); +define('_AUTORIZED_USER', 'User enabled'); +define('_SUSPENDED_USER', 'User disabled'); +define('_DELETED_USER', 'User deleted;'); +define('_USER_DELETION', 'Deleting the user'); +define('_USER_AUTORIZATION', 'Enabling the user'); +define('_USER_SUSPENSION', 'Disabling the user'); +define('_USER_UPDATED', 'User modified'); +define('_USER_UPDATE', 'Modifying an user'); +define('_USER_ADDED', 'New user added'); +define('_NO_PRIMARY_GROUP', 'No primary group selected!'); +define('_THE_USER', 'The user '); +define('_USER_ID', 'The id of the user'); +define('_MY_INFO', 'My account'); + + +//class types +define('_UNKNOWN_PARAM', 'Unknown parameters'); +define('_DOCTYPE_UPDATED', 'Document type modified'); +define('_DOCTYPE_UPDATE', 'Modifying a document type'); +define('_DOCTYPE_ADDED', 'New document type added'); +define('_DELETED_DOCTYPE', 'Document type deleted'); +define('_DOCTYPE_DELETION', 'deleting a document type'); +define('_THE_DOCTYPE', 'the document type '); +define('_THE_WORDING', 'the label '); +define('_THE_TABLE', 'The table '); +define('_PIECE_TYPE', "type of file"); + +//class db +define('_CONNEXION_ERROR', 'An error occurs while connecting'); +define('_SELECTION_BASE_ERROR', 'An error occurs while selecting the table'); +define('_QUERY_ERROR', 'An error occurs while executing the querry'); +define('_CLOSE_CONNEXION_ERROR', 'An error occurs while while closing the connectionl'); +define('_ERROR_NUM', 'Error num.'); +define('_HAS_JUST_OCCURED', 'just occured'); +define('_MESSAGE', 'Message'); +define('_QUERY', 'Query'); +define('_LAST_QUERY', 'Latest query'); + +//Autres +define('_NO_GROUP_SELECTED', 'No group selected'); +#define('_NOW_LOG_OUT', 'You are logged out'); +define('_DOC_NOT_FOUND', 'The document cannot be found'); +define('_DOUBLED_DOC', 'Duplicate problem'); +define('_NO_DOC_OR_NO_RIGHTS', 'This document does not exist, or you do not have sufficient right to view it.'); +define('_INEXPLICABLE_ERROR', 'An unattended error occurs'); +define('_TRY_AGAIN_SOON', 'Please try again in a few seconds'); +define('_NO_OTHER_RECIPIENT', 'There is no other recipient for this document'); +define('_WAITING_INTEGER', 'Entier attendu'); + +define('_DEFINE', 'Complementary information :'); +define('_NUM', '#'); +define('_ROAD', 'Street'); +define('_POSTAL_CODE','Zip code'); +define('_CITY', 'City'); + +define('_CHOOSE_USER', 'Select an user'); +define('_CHOOSE_USER2', 'Select an user'); +define('_NUM2', 'nb'); +define('_UNDEFINED', 'N/A'); +define('_CONSULT_EXTRACTION', 'You can consult the documents here'); +define('_SERVICE', 'Service'); +define('_AVAILABLE_SERVICES', 'Available services'); + +// Mois +define('_JANUARY', 'January'); +define('_FEBRUARY', 'February'); +define('_MARCH', 'March'); +define('_APRIL', 'April'); +define('_MAY', 'May'); +define('_JUNE', 'June'); +define('_JULY', 'July'); +define('_AUGUST', 'August'); +define('_SEPTEMBER', 'September'); +define('_OCTOBER', 'October'); +define('_NOVEMBER', 'November'); +define('_DECEMBER', 'December'); + +define('_NOW_LOGOUT', 'You are logged out'); +define('_LOGOUT', 'Logout'); + +define('_WELCOME2', 'Welcome'); +define('_WELCOME_NOTES1', 'To access the different parts of the application'); +define('_WELCOME_NOTES2', 'use the <b>menu</b> above'); +define('_WELCOME_NOTES3', 'Maarch Team is very proud to present this new framework, which represents an important milestone in the development of the solution.<br><br>In this sample application, you can:<ul><li>o create archive boxes to store the original paper documents you scanned<b>(<i>Physical Archive</i> module)</b></li><li>o Print barcode separator <b>(<i>Physical Archive</i> module)</b></li><li>o Index new documents in two separate collections (production documents and customer invoices) <b>(<i>Indexing & Searching</i> module)</b></li><li>o Mass import customer invoices <b>(<i>Maarch AutoImport</i> add on)</b></li><li>o consult the two document collections <b>(<i> Indexing & Searching</i> module)</b></li><li>o Browse the invoice collection through dynamic trees<b>(<i> AutoFoldering</i> module)</b></li></ul>'); +define('_WELCOME_NOTES5', 'Refer to <u><a href="http://www.maarch.org/maarch_wiki/Maarch_Framework_3">maarch wiki</a></u> for more information.'); +define('_WELCOME_NOTES6', 'You can also visit our <u><a href="http://www.maarch.org/">community website</a></u> or Maarch <u><a href="http://www.maarch.org/maarch_forum/">forum</a></u>.'); +define('_WELCOME_NOTES7', 'If you need professional support or spefific integration, check <u><a href="http://www.maarch.fr/">our services offer</a></u>.'); +define('_WELCOME_COUNT', 'Number of resources in the collection'); + +define('_CONTRACT_HISTORY', 'Contracts history'); + +define('_CLICK_CALENDAR', 'Clic to choose a date'); +define('_MODULES', 'Modules'); +define('_CHOOSE_MODULE', 'Select a module'); +define('_FOLDER', 'Folder'); +define('_INDEX', 'Index'); + +//COLLECTIONS +define('_MAILS', 'Mail'); +define('_DOCUMENTS', 'Real estate loans'); +define('_INVOICES', 'Customer invoice'); +define('_CHOOSE_COLLECTION', 'Select a collection'); + +define('_EVENT', 'Event'); +define('_LINK', 'Link'); + + +//BITMASK +define('_BITMASK_VALUE_ALREADY_EXIST' , 'Bitmask already used'); + +define('_ASSISTANT_MODE', 'Assistant mode'); +define('_EDIT_WITH_ASSISTANT', 'Clic here to edit the WHERE clause in assistant mode'); +define('_VALID_THE_WHERE_CLAUSE', 'Clic here to validate the WHERE clause'); +define('_DELETE_SHORT', 'Delete'); +define('_CHOOSE_ANOTHER_SUBFOLDER', 'Select another subfolder'); +define('_DOCUMENTS_EXISTS_FOR_COLLECTION', 'existing documents in the collection'); +define('_MUST_CHOOSE_COLLECTION_FIRST', 'You must select a collection'); +define('_CANTCHANGECOLL', 'You cannot change the collection'); +define('_DOCUMENTS_EXISTS_FOR_COUPLE_FOLDER_TYPE_COLLECTION', 'existing documents for the duet doctype/collection'); + +define('_NO_RIGHT', 'Error'); +define('_NO_RIGHT_TXT', 'The document you are trying to access does not exist or you do not have sufficient rights to access it...'); +define('_NUM_GED', 'DMS #'); + +///// Manage action error +define('_AJAX_PARAM_ERROR', 'Wrong parameters given to the AJAX request.'); +define('_ACTION_CONFIRM', 'Do you really want to make following action: '); +define('_ACTION_NOT_IN_DB', 'This action does not exist!'); +define('_ERROR_PARAM_ACTION', 'Wrong parameters for the action'); +define('_SQL_ERROR', 'SQL Error'); +define('_ACTION_DONE', 'Action done'); +define('_ACTION_PAGE_MISSING', 'The result page for this action cannot be found !'); +define('_ERROR_SCRIPT', 'Action result page : an error occured in the script or a function is missing'); +define('_SERVER_ERROR', 'Server error'); +define('_CHOOSE_ONE_DOC', 'Select at least one document'); + +define('_CLICK_LINE_TO_CHECK_INVOICE', 'Claick on a line to check an invoice.'); +define('_FOUND_INVOICES', ' Invoice(s) found'); +define('_TO_PROCESS', 'New invoice'); +define('_IN_PROGRESS', 'Ongoing invoice'); +define('_SIMPLE_CONFIRM', 'Simple confirmation'); +define('_CHECK_INVOICE', 'Verify invoice'); + +define('_REDIRECT_TO', 'Redirect vers'); +define('_NO_STRUCTURE_ATTACHED', 'This type of documents is not attached to any structure'); + + +///// Credits +define('_MAARCH_CREDITS', 'About Maarch '); +define('_CR_LONGTEXT_INFOS', '<p>Maarch Framework 3 is a <b>DMS Platform</b>. It addresses most of the needs an organisation cas express to the operative management of its content. A vast majority of it componants are released under the terms of the open source license GNU GPLv3. As a result, the total cost of ownership makes it affordable for any kind of organisation to use it (public sector, private companies associations, etc.).</p><p>Maarch Framework has been designed by two consultants whose experience in in records management and ADF sums up to 20 years. Thus this product <b>garanties a level of stability, integrity and performance</b> one can expect for that type of product. The architecture of the software has been particularly designed so that it can run on standard servers.</p><p>Maarch is developped in PHP5 object. It is compatiblewith 4 database engines: MySQL, PostgreSQL, SQL Server and soon Oracle.</p><p>Maarch is <b>fully modular</b>: all fonctiunnalities are grouped in modules. The modules expose services, which can be enabled or disabled according to the user functional profile. A trained engineer can add or replace an existing module without modifying thr core of the program.</p><p>Maarch offers a global model and necessary tools to <b>acquire, manage, archive and restitute production document streams</b>.<p>'); + +define('_CLOSED', 'Approved'); +?> diff --git a/maarch_entreprise/trunk/lang/fr.php b/maarch_entreprise/trunk/lang/fr.php new file mode 100644 index 0000000000000000000000000000000000000000..5754303382e0219f7265e05c229c391a061bd40a --- /dev/null +++ b/maarch_entreprise/trunk/lang/fr.php @@ -0,0 +1,927 @@ +<?php +/* + * + * Copyright 2008,2009 Maarch + * + * This file is part of Maarch Framework. + * + * Maarch Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Maarch Framework is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. + */ + +/************** Administration **************/ +define('_ADMIN_USERS', 'Utilisateurs'); +define('_ADMIN_USERS_DESC', 'Ajouter, suspendre, ou modifier des profils utilisateurs. Placer les utilisateurs dans leurs groupes d’appartenance et définir leur groupe primaire.'); +define('_ADMIN_GROUPS', 'Groupes d’utilisateurs'); +define('_ADMIN_GROUPS_DESC', 'Ajouter, suspendre, ou modifier des groupes d’utilisateurs. Attribuer des privilèges ou des autorisations d’accès aux ressources.'); +define('_ADMIN_ARCHITECTURE', 'Plan de classement'); +define('_ADMIN_ARCHITECTURE_DESC', 'Définir la structure interne d’un dossier (chemise / sous-chemise / type de document). Définir pour chaque pièce la liste des index à saisir, et leur caractère obligatoire pour la complétude du dossier.'); +define('_VIEW_HISTORY', 'Historique'); +define('_VIEW_HISTORY_BATCH', 'Historique des batchs'); +define('_VIEW_HISTORY_DESC', 'Consulter l’historique des évènements relatifs à l’utilisation de la GED Maarch.'); +define('_VIEW_HISTORY_BATCH_DESC', 'Consulter l’historique des batchs'); +define('_ADMIN_MODULES', 'Gérer les modules'); +define('_ADMIN_SERVICE', 'Service d’administration'); +define('_XML_PARAM_SERVICE_DESC', 'Visualisation configuration XML des services'); +define('_XML_PARAM_SERVICE', 'Visualisation configuration XML des services'); +define('_MODULES_SERVICES', 'Services définis par les modules'); +define('_APPS_SERVICES', 'Services définis par l’application'); +define('_ADMIN_STATUS_DESC', 'Créer ou modifier des statuts.'); +define('_ADMIN_ACTIONS_DESC', 'Créer ou modifier des actions.'); +define('_ADMIN_SERVICES_UNKNOWN', 'Service d’administration inconnu'); +define('_NO_RIGHTS_ON', 'Aucun droit sur'); +define('_NO_LABEL_FOUND', 'Aucun label trouvé pour ce service'); + +define('_FOLDERTYPES_LIST', 'Liste des types de dossier'); +define('_SELECTED_FOLDERTYPES', 'Types des dossier sélectionnés'); +define('_FOLDERTYPE_ADDED', 'Nouveau dossier ajouté'); +define('_FOLDERTYPE_DELETION', 'Dossier supprimé'); + + + +/*********************** communs ***********************************/ + +/************** Listes **************/ +define('_GO_TO_PAGE', 'Aller à la page'); +define('_NEXT', 'Suivante'); +define('_PREVIOUS', 'Précédente'); +define('_ALPHABETICAL_LIST', 'Liste alphabétique'); +define('_ASC_SORT', 'Tri ascendant'); +define('_DESC_SORT', 'Tri descendant'); +define('_ACCESS_LIST_STANDARD', 'Affichage des listes simples'); +define('_ACCESS_LIST_EXTEND', 'Affichage des listes étendues'); +define('_DISPLAY', 'Affichage'); +/************** Actions **************/ +define('_DELETE', 'Supprimer'); +define('_ADD', 'Ajouter'); +define('_REMOVE', 'Enlever'); +define('_MODIFY', 'Modifier'); +define('_SUSPEND', 'Suspendre'); +define('_AUTHORIZE', 'Autoriser'); +define('_SEND', 'Envoyer'); +define('_SEARCH', 'Rechercher'); +define('_RESET', 'Réinitialiser'); +define('_VALIDATE', 'Valider'); +define('_CANCEL', 'Annuler'); +define('_ADDITION', 'Ajout'); +define('_MODIFICATION', 'Modification'); +define('_DIFFUSION', 'Diffusion'); +define('_DELETION', 'Suppression'); +define('_SUSPENSION', 'Suspension'); +define('_VALIDATION', 'Validation'); +define('_REDIRECTION', 'Redirection'); +define('_DUPLICATION', 'Duplication'); +define('_PROPOSITION', 'Proposition'); +define('_CLOSE', 'Fermer'); +define('_CLOSE_WINDOW', 'Fermer la fenêtre'); +define('_DIFFUSE', 'Diffuser'); +define('_DOWN', 'Descendre'); +define('_UP', 'Monter'); +define('_REDIRECT', 'Rediriger'); +define('_DELETED', 'Supprimé'); +define('_CONTINUE', 'Continuer'); +define('_VIEW','Visualisation'); +define('_CHOOSE_ACTION', 'Choisissez une action'); +define('_ACTIONS', 'Actions'); +define('_ACTION_PAGE', 'Page de résultat de l’action'); +define('_DO_NOT_MODIFY_UNLESS_EXPERT', ' Ne pas modifier cette section à moins de savoir ce que vous faites. Un mauvais paramètrage peut entrainer des dysfonctionnements de l’application!'); +define('_INFOS_ACTIONS', 'Vous devez choisir au moins un statut et / ou un script.'); + + + +/************** Intitulés formulaires et listes **************/ +define('_ID', 'Identifiant'); +define('_PASSWORD', 'Mot de passe'); +define('_GROUP', 'Groupe'); +define('_USER', 'Utilisateur'); +define('_DESC', 'Description'); +define('_LASTNAME', 'Nom'); +define('_THE_LASTNAME', 'Le nom'); +define('_THE_FIRSTNAME', 'Le prénom'); +define('_FIRSTNAME', 'Prénom'); +define('_STATUS', 'Statut'); +define('_DEPARTMENT', 'Département'); +define('_FUNCTION', 'Fonction'); +define('_PHONE_NUMBER', 'Numéro de téléphone'); +define('_MAIL', 'Courriel'); +define('_DOCTYPE', 'Type de document'); +define('_TYPE', 'Type'); +define('_SELECT_ALL', 'Sélectionner tout'); +define('_DATE', 'Date'); +define('_ACTION', 'Action'); +define('_COMMENTS', 'Commentaires'); +define('_ENABLED', 'Autorisé'); +define('_NOT_ENABLED', 'Suspendu'); +define('_RESSOURCES_COLLECTION','Collection documentaire'); +define('_RECIPIENT', 'Destinataire'); +define('_START', 'Début'); +define('_END', 'Fin'); + +/************** Messages pop up **************/ +define('_REALLY_SUSPEND', 'Voulez-vous vraiment suspendre '); +define('_REALLY_AUTHORIZE', 'Voulez-vous vraiment autoriser '); +define('_REALLY_DELETE', 'Voulez-vous vraiment supprimer '); +define('_DEFINITIVE_ACTION', 'Cette action est définitive'); + +/************** Divers **************/ +define('_YES', 'Oui'); +define('_NO', 'Non'); +define('_UNKNOWN', 'Inconnu'); +define('_SINCE','Depuis'); +define('_FOR','Jusqu’à'); +define('_HELLO','Bonjour'); +define('_OBJECT','Objet'); +define('_BACK','Retour'); +define('_FORMAT','Format'); +define('_SIZE','Taille'); +define('_DOC', 'Document '); +define('_THE_DOC', 'Le document'); +define('_BYTES', 'octets'); +define('_OR', 'ou'); +define('_NOT_AVAILABLE', 'Indisponible'); +define('_SELECTION', 'Sélection'); +define('_AND', ' et ' ); +define('_FILE','Fichier'); +define('_UNTIL', 'au'); +define('_ALL', 'Tous'); + +//class functions +define('_SECOND', 'seconde'); +define('_SECONDS', 'secondes'); +define('_PAGE_GENERATED_IN', 'Page générée en'); +define('_IS_EMPTY', 'est vide'); +define('_MUST_MAKE_AT_LEAST', 'doit faire au minimum' ); +define('_CHARACTER', 'caractère'); +define('_CHARACTERS', 'caractères'); +define('MUST_BE_LESS_THAN', 'ne doit pas faire plus de'); +define('_WRONG_FORMAT', 'n’est pas dans le bon format'); +define('_WELCOME', 'Bienvenue sur Maarch Entreprise !'); +define('_WELCOME_TITLE', 'Accueil'); +define('_HELP', 'Aide'); +define('_SEARCH_ADV_SHORT', 'Recherche Avancée'); +define('_RESULTS', 'Résultats'); +define('_USERS_LIST_SHORT', 'Liste utilisateurs'); +define('_MODELS_LIST_SHORT', 'Liste modèles'); +define('_GROUPS_LIST_SHORT', 'Liste groupes'); +define('_DEPARTMENTS_LIST_SHORT', 'Liste services'); +define('_BITMASK', 'Paramètre Bitmask'); +define('_DOCTYPES_LIST_SHORT', 'Liste types'); +define('_BAD_MONTH_FORMAT', 'Le mois est incorrect'); +define('_BAD_DAY_FORMAT', 'Le jour est incorrect'); +define('_BAD_YEAR_FORMAT', 'L’année est incorrect'); +define('_BAD_FEBRUARY', 'Le mois de février ne peux contenir que 29 jours maximum'); +define('_CHAPTER_SHORT', 'Chap '); +define('_PROCESS_SHORT', 'Traitement'); +define('_CARD', 'Fiche'); + +/************************* First login ***********************************/ +define('_MODIFICATION_PSW', 'Modification du mot de passe'); +define('_YOUR_FIRST_CONNEXION', 'Bienvenue sur Maarch Entreprise ! <br/>Ceci est votre première connexion'); +define('_PLEASE_CHANGE_PSW', ' veuillez définir votre mot de passe'); +define('_ASKED_ONLY_ONCE', 'Cela ne vous sera demandé qu’une seule fois'); +define('_FIRST_CONN', 'Première connexion'); +define('_LOGIN', 'Connexion'); +define('_RELOGIN', 'Reconnexion'); + +/************************* index page***********************************/ +define('_LOGO_ALT', 'Retour à la page d’accueil'); +define('_LOGOUT', 'Déconnexion'); +define('_MENU', 'Menu'); +define('_ADMIN', 'Administration'); +define('_SUMMARY', 'Sommaire'); +define('_MANAGE_DIPLOMA', 'Gérer les diplômes'); +define('_MANAGE_CONTRACT', 'Gérer les types de contrats'); +define('_MANAGE_REL_MODEL', 'Gérer le modèle de relance'); +define('_MANAGE_DOCTYPES', 'Gérer les types de documents'); +define('_MANAGE_DOCTYPES_DESC', 'Administrer les types de documents. Les types de documents sont rattachés à une collection documentaire. Pour chaque type, vous pouvez définir les index à saisir et ceux qui sont obligatoires.'); +define('_VIEW_HISTORY2', 'Visualisation de l’historique'); +define('_VIEW_HISTORY_BATCH2', 'Visualisation de l’historique des batchs'); +define('_INDEX_FILE', 'Indexer un fichier'); +define('_WORDING', 'Libellé'); +define('_COLLECTION', 'Collection'); +define('_VIEW_TREE_DOCTYPES', 'Arborescence du plan de classement'); +define('_VIEW_TREE_DOCTYPES_DESC', 'Voir l’arborescence du plan de classement (types de dossiers, chemises, sous-chemises et types de documents)'); +define('_WELCOME_ON', 'Bienvenue sur'); + +/************************* Administration ***********************************/ + +/**************Sommaire**************/ +define('_MANAGE_GROUPS_APP', 'Gérer les groupes de l’application'); +define('_MANAGE_USERS_APP', 'Gérer les utilisateurs de l’application'); +define('_MANAGE_DIPLOMA_APP', 'Gérer les diplômes de l’application'); +define('_MANAGE_DOCTYPES_APP', 'Gérer les types de document de l’application'); +define('_MANAGE_ARCHI_APP', 'Gérer l’architecture des types de document de l’application'); +define('_MANAGE_CONTRACT_APP', 'Gérer les types de contrat de l’application'); +define('_HISTORY_EXPLANATION', 'Surveiller les modifications, les suppressions et les ajouts dans l’application'); +define('_ARCHI_EXP', 'les chemises, les sous-chemises et les types de document'); + + +/************** Groupes : Liste + Formulaire**************/ + +define('_GROUPS_LIST', 'Liste des groupes'); +define('_ADMIN_GROUP', 'Groupe d’administration'); +define('_ADD_GROUP', 'Ajouter un groupe'); +define('_ALL_GROUPS', 'Tous les groupes'); +define('_GROUPS', 'groupes'); + +define('_GROUP_ADDITION', 'Ajout d’un groupe'); +define('_GROUP_MODIFICATION', 'Modification d’un groupe'); +define('_SEE_GROUP_MEMBERS', 'Voir la liste des utilisateurs de ce groupe'); +define('_OTHER_RIGHTS', 'Autres droits'); +define('_MODIFY_GROUP', 'Accepter les changements'); +define('_THE_GROUP', 'Le groupe'); +define('_HAS_NO_SECURITY', 'n’a aucune sécurité définie' ); + +define('_DEFINE_A_GRANT', 'Définissez au moins un accès'); +define('_MANAGE_RIGHTS', 'Ce groupe a accès aux ressources suivantes'); +define('_TABLE', 'Table'); +define('_WHERE_CLAUSE', 'Clause WHERE'); +define('_INSERT', 'Insertion'); +define('_UPDATE', 'Mise à jour'); +define('_REMOVE_ACCESS', 'Supprimer accès'); +define('_MODIFY_ACCESS', 'Modifier accès'); +define('_UPDATE_RIGHTS', 'Mise à jour des droits'); +define('_ADD_GRANT', 'Ajouter accès'); +define('_USERS_LIST_IN_GROUP', 'Liste des utilisateurs du groupe'); + +/************** Utilisateurs : Liste + Formulaire**************/ + +define('_USERS_LIST', 'Liste des utilisateurs'); +define('_ADD_USER', 'Ajouter un utilisateur'); +define('_ALL_USERS', 'Tous les utilisateurs'); +define('_USERS', 'utilisateurs'); +define('_USER_ADDITION', 'Ajout d’un utilisateur'); +define('_USER_MODIFICATION', 'Modification d’un utilisateur'); +define('_MODIFY_USER', 'Modifier l’utilisateur'); + +define('_NOTES', 'Notes'); +define('_NOTE1', 'Les champs obligatoires sont marqués par un astérisque rouge '); +define('_NOTE2', 'Le groupe primaire est obligatoire'); +define('_NOTE3', 'Le premier groupe sélectionné sera le groupe primaire'); +define('_USER_GROUPS_TITLE', 'L’utilisateur appartient aux groupes suivants'); +define('_USER_ENTITIES_TITLE', 'L’utilisateur appartient aux entités suivantes'); +define('_DELETE_GROUPS', 'Supprimer le(s) groupe(s)'); +define('_ADD_TO_GROUP', 'Ajouter à un groupe'); +define('_CHOOSE_PRIMARY_GROUP', 'Choisir comme groupe primaire'); +define('_USER_BELONGS_NO_GROUP', 'L’utilisateur n’appartient à aucun groupe'); +define('_USER_BELONGS_NO_ENTITY', 'L’utilisateur n’appartient à aucune entité'); +define('_CHOOSE_ONE_GROUP', 'Choisissez au moins un groupe'); +define('_PRIMARY_GROUP', 'Groupe primaire'); +define('_CHOOSE_GROUP', 'Choisissez un groupe'); +define('_ROLE', 'Rôle'); + +define('_THE_PSW', 'Le mot de passe'); +define('_THE_PSW_VALIDATION', 'La validation du mot de passe' ); +define('_REENTER_PSW', 'Retaper le mot de passe'); +define('_USER_ACCESS_DEPARTMENT', 'L’utilisateur a accès aux services suivants'); +define('_FIRST_PSW', 'Le premier mot de passe '); +define('_SECOND_PSW', 'Le deuxième mot de passe '); + +define('_PASSWORD_MODIFICATION', 'Changement du mot de passe'); +define('_PASSWORD_FOR_USER', 'Le mot de passe pour l’utilisateur'); +define('_HAS_BEEN_RESET', 'a été réinitialisé'); +define('_NEW_PASW_IS', 'Le nouveau mot de passe est '); +define('_DURING_NEXT_CONNEXION', 'Lors de la prochaine connexion'); +define('_MUST_CHANGE_PSW', 'doit modifier son mot de passe'); + +define('_NEW_PASSWORD_USER', 'Réinitialisation du mot de passe de l’utilisateur'); + +/************** Types de document : Liste + Formulaire**************/ + +define('_DOCTYPES_LIST', 'Liste des types de document'); +define('_ADD_DOCTYPE', 'Ajouter un type'); +define('_ALL_DOCTYPES', 'Tous les types'); +define('_TYPES', 'types'); + +define('_DOCTYPE_MODIFICATION', 'Modification d’un type de document'); +define('_DOCTYPE_CREATION', 'Création d’un type de document'); + +define('_MODIFY_DOCTYPE', 'Valider les changements'); +define('_ATTACH_SUBFOLDER', 'Rattaché à la sous-chemise'); +define('_CHOOSE_SUBFOLDER', 'Choisissez une sous-chemise'); +define('_MANDATORY_FOR_COMPLETE', 'Obligatoire pour la complétude du dossier d’embauche'); +define('_MORE_THAN_ONE', 'Pièce itérative'); +define('_MANDATORY_FIELDS_IN_INDEX', 'Champs obligatoires à l’indexation'); +define('_DIPLOMA_LEVEL', 'Niveau de diplôme'); +define('_THE_DIPLOMA_LEVEL', 'Le niveau de diplôme'); +define('_DATE_END_DETACH_TIME', 'Date de fin de période de détachement'); +define('_START_DATE', 'Date de début'); +define('_START_DATE_PROBATION', 'Date de début de période de probatoire'); +define('_END_DATE', 'Date de fin'); +define('_END_DATE_PROBATION', 'Date de fin de période de probatoire'); +define('_START_DATE_TRIAL', 'Date de début de période d’essai'); +define('_START_DATE_MISSION', 'Date de début de mission'); +define('_END_DATE_TRIAL', 'Date de fin de période d’essai'); +define('_END_DATE_MISSION', 'Date de fin de mission'); +define('_EVENT_DATE', 'Date de l’évènement'); +define('_VISIT_DATE', 'Date de la visite'); +define('_CHANGE_DATE', 'Date du changement '); +define('_DOCTYPES_LIST2', 'Liste des types de pièce'); + +define('_INDEX_FOR_DOCTYPES', 'Index possibles pour les types de document'); +define('_FIELD', 'Champ'); +define('_USED', 'Utilisé'); +define('_MANDATORY', 'Obligatoire'); +define('_ITERATIVE', 'Itératif'); + +define('_MASTER_TYPE', 'Type maître'); + +/************** structures : Liste + Formulaire**************/ +define('_STRUCTURE_LIST', 'Liste des chemises'); +define('_STRUCTURES', 'chemise(s)'); +define('_STRUCTURE', 'Chemise'); +define('_ALL_STRUCTURES', 'Toutes les chemises'); + +define('_THE_STRUCTURE', 'La chemise'); +define('_STRUCTURE_MODIF', 'Modification de la chemise'); +define('_ID_STRUCTURE_PB', 'Il y a un problème avec l’identifiant de la chemise'); +define('_NEW_STRUCTURE_ADDED', 'Ajout d’une nouvelle chemise'); +define('_NEW_STRUCTURE', 'Nouvelle chemise'); +define('_DESC_STRUCTURE_MISSING', 'Il manque la description de la chemise'); +define('_STRUCTURE_DEL', 'Suppression de la chemise'); +define('_DELETED_STRUCTURE', 'Chemise supprimée'); + +/************** sous-dossiers : Liste + Formulaire**************/ +define('_SUBFOLDER_LIST', 'Liste des sous-chemises'); +define('_SUBFOLDERS', 'sous-chemise(s)'); +define('_ALL_SUBFOLDERS', 'Toutes les sous-chemises'); +define('_SUBFOLDER', 'sous-chemise'); + +define('_ADD_SUBFOLDER', 'Ajouter une nouvelle sous-chemise'); +define('_THE_SUBFOLDER', 'La sous-chemise'); +define('_SUBFOLDER_MODIF', 'Modification de la sous-chemise'); +define('_SUBFOLDER_CREATION', 'Création de la sous-chemise'); +define('_SUBFOLDER_ID_PB', 'Il y a un probleme avec l’identifiant de la sous-chemise'); +define('_SUBFOLDER_ADDED', 'Ajout d’unen nouvelle sous-chemise'); +define('_NEW_SUBFOLDER', 'Nouvelle sous-chemise'); +define('_STRUCTURE_MANDATORY', 'La chemise est obligatoire'); +define('_SUBFOLDER_DESC_MISSING', 'Il manque la description de la sous-chemise'); + +define('_ATTACH_STRUCTURE', 'Rattachement à une chemise'); +define('_CHOOSE_STRUCTURE', 'Choissisez une chemise'); + +define('_DEL_SUBFOLDER', 'Suppression de la sous-chemise'); +define('_SUBFOLDER_DELETED', 'Sous-chemise supprimée'); + + +/************** Status **************/ + +define('_STATUS_LIST', 'Liste des statuts'); +define('_ADD_STATUS', 'Ajouter nouveau statut'); +define('_ALL_STATUS', 'Tous les statuts'); +define('_STATUS_PLUR', 'Statut(s)'); +define('_STATUS_SING', 'statut'); + +define('_TO_PROCESS','A traiter'); +define('_IN_PROGRESS','En cours'); +define('_FIRST_WARNING','1ere Relance'); +define('_SECOND_WARNING','2e Relance'); +define('_CLOSED','Clos'); +define('_NEW','Nouveaux'); +define('_LATE', 'En retard'); + +define('_STATUS_DELETED', 'Suppression du statut'); +define('_DEL_STATUS', 'Statut supprimé'); +define('_MODIFY_STATUS', 'Modification du statut'); +define('_STATUS_ADDED','Ajout d’un nouveau statut'); +define('_STATUS_MODIFIED','Modification d’un statut'); +define('_NEW_STATUS', 'Nouveau statut'); +define('_IS_SYSTEM', 'Système'); +define('_CAN_BE_SEARCHED', 'Recherche'); +define('_CAN_BE_MODIFIED', 'Modification des index'); +define('_THE_STATUS', 'Le statut '); +define('_ADMIN_STATUS', 'Statuts'); +define('_ADMIN_STATUS_DESC', 'Gérer les états des ressources dans l’application'); +/************* Actions **************/ + +define('_ACTION_LIST', 'Liste des actions'); +define('_ADD_ACTION', 'Ajouter nouvelle action'); +define('_ALL_ACTIONS', 'Toutes les actions'); +define('_ACTIONS', 'actions'); +define('_ACTION', 'action'); +define('_ACTION_HISTORY', 'Tracer l’action'); + +define('_ACTION_DELETED', 'Suppression de l’action'); +define('_DEL_ACTION', 'Action supprimée'); +define('_MODIFY_ACTION', 'Modification de l’action'); +define('_ACTION_ADDED','Ajout d’une nouvelle action'); +define('_ACTION_MODIFIED','Modification d’une action'); +define('_NEW_ACTION', 'Nouvelle action'); +define('_THE_ACTION', 'L’action '); +define('_ADMIN_ACTIONS', 'Actions'); +define('_ADMIN_ACTIONS_DESC', 'Gérer les actions utilisables dans l’application'); + +/************** Historique**************/ +define('_HISTORY_TITLE', 'Historique des évènements'); +define('_HISTORY_BATCH_TITLE', 'Historique des évènements des batchs'); +define('_HISTORY', 'Historique'); +define('_HISTORY_BATCH', 'Historique du batch'); +define('_BATCH_NAME', 'Nom batch'); +define('_CHOOSE_BATCH', 'Choisir batch'); +define('_BATCH_ID', 'Id batch'); +define('_TOTAL_PROCESSED', 'Documents traités'); +define('_TOTAL_ERRORS', 'Documents en erreurs'); +define('_ONLY_ERRORS', 'Seulement avec erreurs'); +define('_INFOS', 'Infos'); + +/************** Admin de l'architecture (plan de classement) **************/ +define('_ADMIN_ARCHI', 'Administration du plan de classement'); +define('_MANAGE_STRUCTURE', 'Gérer les chemises'); +define('_MANAGE_STRUCTURE_DESC', 'Administrer les chemises. Celles-ci constituent l’élément le plus haut du plan de classement. Si le module Folder est connecté, vous pouvez associer un type de dossier à un plan de classement.'); +define('_MANAGE_SUBFOLDER', 'Gérer les sous-chemises'); +define('_MANAGE_SUBFOLDER_DESC', 'Gérer les sous-chemises à l’intérieur des chemises.'); +define('_ARCHITECTURE', 'Plan de classement'); + +/************************* Messages d'erreurs ***********************************/ +define('_MORE_INFOS', 'Pour plus d’informations, contactez votre administrateur '); +define('_ALREADY_EXISTS', 'existe déjà !'); + +// class usergroups +define('_NO_GROUP', 'Le groupe n’existe pas !'); +define('_NO_SECURITY_AND_NO_SERVICES', 'n’a aucune sécurité définie et aucun service'); +define('_GROUP_ADDED', 'Nouveau groupe ajouté'); +define('_SYNTAX_ERROR_WHERE_CLAUSE', 'erreur de syntaxe dans la clause where'); +define('_GROUP_UPDATED', 'Groupe modifié'); +define('_AUTORIZED_GROUP', 'Groupe autorisé'); +define('_SUSPENDED_GROUP', 'Groupe suspendu'); +define('_DELETED_GROUP', 'Groupe supprimé'); +define('_GROUP_UPDATE', 'Modification du groupe;'); +define('_GROUP_AUTORIZATION', 'Autorisation du groupe'); +define('_GROUP_SUSPENSION', 'Suspension du groupe'); +define('_GROUP_DELETION', 'Suppression du groupe'); +define('_GROUP_DESC', 'La description du groupe '); +define('_GROUP_ID', 'L’identifiant du groupe'); +define('_EXPORT_RIGHT', 'Droits d’export'); + +//class users +define('_USER_NO_GROUP', 'Vous n’appartenez à aucun groupe'); +define('_SUSPENDED_ACCOUNT', 'Votre compte utilisateur a été suspendu'); +define('_BAD_LOGIN_OR_PSW', 'Mauvais nom d’utilisateur ou mauvais mot de passe'); +define('_WRONG_SECOND_PSW', 'Le deuxième mot de passe ne correspond pas au premier mot de passe !'); +define('_AUTORIZED_USER', 'Utilisateur autorisé'); +define('_SUSPENDED_USER', 'Utilisateur suspendu'); +define('_DELETED_USER', 'Utilisateur supprimé'); +define('_USER_DELETION', 'Suppression de l’utilisateur;'); +define('_USER_AUTORIZATION', 'Autorisation de l’utilisateur'); +define('_USER_SUSPENSION', 'Suspension de l’utilisateur'); +define('_USER_UPDATED', 'Utilisateur modifié'); +define('_USER_UPDATE', 'Modification d’un utilisateur'); +define('_USER_ADDED', 'Nouvel utilisateur ajouté'); +define('_NO_PRIMARY_GROUP', 'Aucun groupe primaire sélectionné !'); +define('_THE_USER', 'L’utilisateur '); +define('_USER_ID', 'L’identifiant de l’utilisateur'); +define('_MY_INFO', 'Mon Profil'); + + +//class types +define('_UNKNOWN_PARAM', 'Paramètres inconnus'); +define('_DOCTYPE_UPDATED', 'Type de document modifié'); +define('_DOCTYPE_UPDATE', 'Modification du type de document'); +define('_DOCTYPE_ADDED', 'Nouveau type de document ajouté'); +define('_DELETED_DOCTYPE', 'Type de document supprimé'); +define('_DOCTYPE_DELETION', 'Suppression du type de document;'); +define('_THE_DOCTYPE', 'Le type de document '); +define('_THE_WORDING', 'Le libellé '); +define('_THE_TABLE', 'La table '); +define('_PIECE_TYPE', 'Type de pièce'); + +//class db +define('_CONNEXION_ERROR', 'Erreur à la connexion'); +define('_SELECTION_BASE_ERROR', 'Erreur à la sélection de la base'); +define('_QUERY_ERROR', 'Erreur à la requête'); +define('_CLOSE_CONNEXION_ERROR', 'Erreur à la fermeture de la connexion'); +define('_ERROR_NUM', 'L’erreur n°'); +define('_HAS_JUST_OCCURED', 'vient de se produire'); +define('_MESSAGE', 'Message'); +define('_QUERY', 'Requête'); +define('_LAST_QUERY', 'Dernière requête'); + +//Autres +define('_NO_GROUP_SELECTED', 'Aucun groupe sélectionné'); +define('_NOW_LOG_OUT', 'Vous êtes maintenant déconnecté'); +define('_DOC_NOT_FOUND', 'Document introuvable'); +define('_DOUBLED_DOC', 'Problème de doublons'); +define('_NO_DOC_OR_NO_RIGHTS', 'Ce document n’existe pas ou vous n’avez pas les droits nécessaires pour y accéder'); +define('_INEXPLICABLE_ERROR', 'Une erreur inexplicable est survenue'); +define('_TRY_AGAIN_SOON', 'Veuillez réessayer dans quelques instants'); +define('_NO_OTHER_RECIPIENT', 'Il n’y a pas d’autre destinataire de ce courrier'); +define('_WAITING_INTEGER', 'Entier attendu'); + +define('_DEFINE', 'Préciser'); +define('_NUM', 'N°'); +define('_ROAD', 'Rue'); +define('_POSTAL_CODE','Code Postal'); +define('_CITY', 'Ville'); + +define('_CHOOSE_USER', 'Vous devez choisir un utilisateur'); +define('_CHOOSE_USER2', 'Choisissez un utilisateur'); +define('_NUM2', 'Numéro'); +define('_UNDEFINED', 'N.C.'); +define('_CONSULT_EXTRACTION', 'vous pouvez consulter les documents extraits ici'); +define('_SERVICE', 'Service'); +define('_AVAILABLE_SERVICES', 'Services disponibles'); + +// Mois +define('_JANUARY', 'Janvier'); +define('_FEBRUARY', 'Février'); +define('_MARCH', 'Mars'); +define('_APRIL', 'Avril'); +define('_MAY', 'Mai'); +define('_JUNE', 'Juin'); +define('_JULY', 'Juillet'); +define('_AUGUST', 'Août'); +define('_SEPTEMBER', 'Septembre'); +define('_OCTOBER', 'Octobre'); +define('_NOVEMBER', 'Novembre'); +define('_DECEMBER', 'Décembre'); + +define('_NOW_LOGOUT', 'Vous êtes maintenant déconnecté.'); +define('_LOGOUT', 'Déconnexion'); + +define('_WELCOME2', 'Bienvenue'); +define('_WELCOME_NOTES1', 'Pour naviguer dans l\'application'); +define('_WELCOME_NOTES2', 'utilisez le <b>menu</b> ci-dessus'); +define('_WELCOME_NOTES3', 'L’équipe Maarch est très fière de vous présenter ce nouveau Framework marquant une étape importante dans le développement de Maarch.<br><br>Dans cette application d’exemple, vous pouvez :<ul><li>o Créer des boites d’archives afin d’y ranger les documents papier numérisés <b>(module <i> Physical Archive</i>)</b></li><li>o Imprimer des séparateurs code-barre <b>(module <i> Physical Archive</i>)</b></li><li>o Indexer de nouveaux documents dans deux collections documentaires distinctes (documents de production et factures client) <b>(module <i> Indexing & Searching</i>)</b></li><li>o Importer en masse des factures clients <b>(utilitaire <i> Maarch AutoImport</i>)</b></li><li>o Consulter les deux fonds documentaires d’exemple <b>(module <i> Indexing & Searching</i>)</b></li><li>o Parcourir la collection des factures au travers d’arbres dynamiques <b>(module <i> AutoFoldering</i>)</b></li></ul><br><br>'); +define('_WELCOME_NOTES5', 'Consultez le <u><a href="http://www.maarch.org/maarch_wiki/Maarch_Framework_v3">wiki maarch</a></u> pour plus d’informations.'); +define('_WELCOME_NOTES6', 'Accéder au <u><a href="http://www.maarch.org/">site communautaire</a></u> ou au <u><a href="http://www.maarch.org/maarch_forum/">forum</a></u> Maarch.'); +define('_WELCOME_NOTES7', '<b>Professionnels</b> : des <u><a href="http://www.maarch.fr/">solutions</a></u> adaptées à vos besoins.'); +define('_WELCOME_COUNT', 'Nombre de ressources sur la collection'); + +define('_CONTRACT_HISTORY', 'Historique des contrats'); + +define('_CLICK_CALENDAR', 'Cliquez pour choisir une date'); +define('_MODULES', 'Modules'); +define('_CHOOSE_MODULE', 'Choisissez un module'); +define('_FOLDER', 'Dossier'); +define('_INDEX', 'Index'); + +//COLLECTIONS +define('_MAILS', 'Courriers'); +define('_DOCUMENTS', 'Prets immobiliers'); +define('_INVOICES', 'Factures'); +define('_CHOOSE_COLLECTION', 'Choisir une collection'); + +define('_EVENT', 'Evènement'); +define('_LINK', 'Lien'); + + +//BITMASK +define('_BITMASK_VALUE_ALREADY_EXIST' , 'Bitmask déjà utilisé dans un autre type'); + +define('_ASSISTANT_MODE', 'Mode assisstant'); +define('_EDIT_WITH_ASSISTANT', 'Cliquez ici pour éditer la clause where avec le mode assistant'); +define('_VALID_THE_WHERE_CLAUSE', 'Cliquez ici pour VALIDER la clause where'); +define('_DELETE_SHORT', 'Suppression'); +define('_CHOOSE_ANOTHER_SUBFOLDER', 'Choisissez une autre sous-chemise'); +define('_DOCUMENTS_EXISTS_FOR_COLLECTION', 'documents existent pour la collection'); +define('_MUST_CHOOSE_COLLECTION_FIRST', 'Vous devez choisir une collection'); +define('_CANTCHANGECOLL', 'Vous ne pouvez pas changer la collection'); +define('_DOCUMENTS_EXISTS_FOR_COUPLE_FOLDER_TYPE_COLLECTION', 'documents existent pour le couple type de dossier/collection'); + +define('_NO_RIGHT', 'Erreur'); +define('_NO_RIGHT_TXT', 'Vous avez tentez d’accéder à un document auquel vous n’avez pas droit ou le document n’existe pas...'); +define('_NUM_GED', 'N° GED'); + +///// Manage action error +define('_AJAX_PARAM_ERROR', 'Erreur passage paramètres Ajax'); +define('_ACTION_CONFIRM', 'Voulez-vous effectuer l’action suivante : '); +define('_ACTION_NOT_IN_DB', 'Action non enregistrée en base'); +define('_ERROR_PARAM_ACTION', 'Erreur paramètrage de l’action'); +define('_SQL_ERROR', 'Erreur SQL'); +define('_ACTION_DONE', 'Action effectuée'); +define('_ACTION_PAGE_MISSING', 'Page de résultat de l’action manquante'); +define('_ERROR_SCRIPT', 'Page de résultat de l’action : erreur dans le script ou fonction manquante'); +define('_SERVER_ERROR', 'Erreur serveur'); +define('_CHOOSE_ONE_DOC', 'Choisissez au moins un document'); +define('_CHOOSE_ONE_OBJECT', 'Choisissez au moins un élément'); + +define('_CLICK_LINE_TO_CHECK_INVOICE', 'Cliquer sur une ligne pour vérifier une facture'); +define('_FOUND_INVOICES', ' facture(s) trouvée(s)'); +define('_TO_PROCESS', 'Nouvelle facture'); +define('_IN_PROGRESS', 'Facture en cours'); +define('_SIMPLE_CONFIRM', 'Confirmation simple'); +define('_CHECK_INVOICE', 'Vérifier facture'); + +define('_REDIRECT_TO', 'Rediriger vers'); +define('_NO_STRUCTURE_ATTACHED', 'Ce type de document n’est attaché à aucune chemise'); + + +///// Credits +define('_MAARCH_CREDITS', 'A propos de Maarch '); +define('_CR_LONGTEXT_INFOS', '<p>Maarch Framework 3 est une infrastructure de <b>GED de Production</b>, répondant en standard à la plupart des besoins de gestion opérationnelle de contenu d\'une organisation. La très grande majorité des composants du Framework est diffusé sous les termes de la licence open source GNU GPLv3, de sorte que le coût d\'implémentation rend la solution aborbable pour tout type d\'organisation (public, privé, parapublic, monde associatif).</p> <p>Pour autant, Maarch Framework ayant été conçu par deux consultants cumulant à eux deux plus de 20 ans d\'expertise en Systèmes d\'Archivage Électronique et en Éditique, le produit offre <b>toutes les garanties de robustesse, d\'intégrité, de performance</b> que l\'on doit attendre de ce type de produit. Un grand soin a été porté sur l\'architecture afin d\'autoriser des performances maximales sur du matériel standard.</p><p>Maarch est développé en PHP5 objet. Il est compatible avec les 4 moteurs de bases de données suivants : MySQL, PostgreSQL, SQLServer, et bientôt Oracle.</p> <p>Maarch est <b>totalement modulaire</b> : toutes les fonctionnalités sont regroupées dans des modules exposant des services qui peuvent être activés/désactivés en fonction du profil de l\'utilisateur. Un ingénieur expérimenté peut ajouter ou remplacer un module existant sans toucher au coeur du système.</p><p>Maarch propose un schéma global et <b>tous les outils pour acquérir, gérer, conserver puis restituer les flux documentaires de production</b>.'); + +define('_CLOSED', 'Validé'); +define('_PROCESS_SHORT', 'Traitement'); +define('_PROCESSING_DATE', 'Date limite de traitement'); +define('_PROCESS_NUM','Traitement du courrier n°'); +define('_PROCESS_LIMIT_DATE', 'Date limite de traitement'); +define('_TO_PROCESS', 'A traiter'); +define('_IN_PROGRESS', 'En cours'); +define('_LATE_PROCESS', 'En retard'); +define('_PROCESS_DELAY', 'Délai de traitement'); +define('_ALARM1_DELAY', 'Délai relance 1'); +define('_ALARM2_DELAY', 'Délai relance 2'); +define('_CATEGORY', 'Catégorie'); +define('_CHOOSE_CATEGORY', 'Choisissez une catégorie'); +define('_RECEIVING_DATE', 'Date d’arrivée'); +define('_SUBJECT', 'Objet'); +define('_AUTHOR', 'Auteur'); +define('_DOCTYPE_MAIL', 'Type de courrier'); +define('_PROCESS_LIMIT_DATE_USE', 'Activer la date limite'); +define('_DEPARTMENT_DEST', 'Service traitant'); +define('_DEPARTMENT_EXP', 'Service expéditeur'); + + +// Mail Categories +define('_INCOMING', 'Courrier Arrivée'); +define('_OUTGOING', 'Courrier Départ'); +define('_INTERNAL', 'Courrier Interne'); +define('_MARKET_DOCUMENT', 'Document de Marché'); + +// Mail Natures +define('_SIMPLE_MAIL', 'Courrier simple'); +define('_EMAIL', 'Mail'); +define('_FAX', 'Fax'); +define('_CHRONOPOST', 'Chronopost'); +define('_FEDEX', 'Fedex'); +define('_REGISTERED_MAIL', 'Courrier AR'); +define('_COURIER', 'Coursier'); +define('_OTHER', 'Autre'); + +//Priorities +define('_NORMAL', 'Normal'); +define('_VERY_HIGH', 'Très urgent'); +define('_HIGH', 'Urgent'); +define('_LOW', 'Basse'); +define('_VERY_LOW', 'Très Basse'); + + +define('_INDEXING_MLB', 'Enregistrer un courrier'); +define('_ADV_SEARCH_MLB', 'Rechercher un courrier'); + +define('_ADV_SEARCH_TITLE', 'Recherche avancée du courrier'); +define('_MAIL_OBJECT', 'Objet du courrier'); +//define('_SHIPPER', 'Emetteur'); +//define('_SENDER', 'Expéditeur'); +//define('_SOCIETY', 'Société'); +//define('_SHIPPER_SEARCH','Dans le champ émetteur, les recherches ne sont effectuées ni sur les civilités, ni sur les prénoms.'); +//define('_MAIL_IDENTIFIER','Référence de l’affaire'); +define('_N_GED','Numéro GED '); +define('_GED_NUM', 'N° GED'); +define('_CHOOSE_TYPE_MAIL','Choisissez un type de courrier'); +//define('_INVOICE_TYPE','Nature de l’envoi'); +//define('_CHOOSE_INVOICE_TYPE','Choisissez la nature de l’envoi'); +define('_REG_DATE','Date d’enregistrement'); +define('_PROCESS_DATE','Date de traitement'); +define('_CHOOSE_STATUS','Choisissez un statut'); +define('_PROCESS_RECEIPT','Destinataire(s) pour traitement'); +define('_CHOOSE_RECEIPT','Choisissez un destinataire'); +define('_TO_CC','En copie'); +define('_ADD_COPIES','Ajouter des personnes en copie'); +//define('_ANSWER_TYPE','Type(s) de réponse'); +define('_PROCESS_NOTES','Notes de traitement'); +define('_DIRECT_CONTACT','Prise de contact direct'); +define('_NO_ANSWER','Pas de réponse'); +define('_DETAILS', 'Fiche détaillée'); +define('_DOWNLOAD', 'Télécharger le courrier'); +define('_SEARCH_RESULTS', 'Résultat de la recherche'); +define('_DOCUMENTS', 'documents'); +define('_THE_SEARCH', 'La recherche'); +define('_CHOOSE_TABLE', 'Choisissez une collection'); +define('_SEARCH_COPY_MAIL','Chercher dans mes courriers en copie'); +define('_MAIL_PRIORITY', 'Priorité du courrier'); +define('_CHOOSE_PRIORITY', 'Choisissez une priorité'); +define('_ADD_PARAMETERS', 'Ajouter des critères'); +define('_CHOOSE_PARAMETERS', 'Choisissez vos critères'); +define('_CHOOSE_ENTITES_SEARCH_TITLE', 'Ajoutez le/les service(s) désiré(s) pour restreindre la recherche'); +define('_CHOOSE_DOCTYPES_SEARCH_TITLE', 'Ajoutez le(s) type(s) de document désiré(s) pour restreindre la recherche'); +define('_DESTINATION_SEARCH', 'Service(s) affecté(s)'); +define('_ADD_PARAMETERS_HELP', 'Pour affiner le résultat, vous pouvez ajouter des critères à votre recherche... '); +define('_MAIL_OBJECT_HELP', 'Saisissez les mots clés de l’objet du courrier... '); +define('_N_GED_HELP', ''); +define('_CHOOSE_RECIPIENT_SEARCH_TITLE', 'Ajoutez le/les destinataire(s) désiré(s) pour restreindre la recherche'); +define('_MULTI_FIELD','Multi-champs'); +define('_MULTI_FIELD_HELP','Objet, description, titre, Num chrono, notes de traitement...'); +define('_SAVE_QUERY', 'Enregistrer ma recherche'); +define('_SAVE_QUERY_TITLE', 'Enregistrement de recherche'); +define('_QUERY_NAME', 'Nom de ma recherche'); +define('_QUERY_SAVED', 'Recherche sauvegardée'); +define('_SERVER_ERROR', 'Erreur serveur lors de l´enregistrement de la recherche'); +//define('_SQL_ERROR', 'Erreur SQL lors de l´enregistrement de la recherche'); +define('_LOAD_QUERY', 'Charger la recherche'); +define('_DELETE_QUERY', 'Supprimer la recherche'); +define('_CHOOSE_SEARCH', 'Choisir une recherche'); +define('_THIS_SEARCH', 'cette recherche'); +define('_MY_SEARCHES', 'Mes recherches'); +define('_CLEAR_SEARCH', 'Effacer les critères'); +define('_CHOOSE_STATUS_SEARCH_TITLE', 'Ajoutez le/les statut(s) désiré(s) pour restreindre la recherche'); +define('_ERROR_IE_SEARCH', 'Cet élément est déjà défini !'); +//define('_CIVILITIES', 'Civilité(s)'); +//define('_CIVILITY', 'Civilité'); +//define('_CHOOSE_CIVILITY_SEARCH_TITLE', 'Ajoutez le/les civilité(s) désiré(s) pour restreindre la recherche'); + +define('_DEST_USER','Destinataire'); +define('_DOCTYPES','Type(s) de document'); +define('_MAIL_NATURE', 'Nature de l’envoi'); +define('_CHOOSE_MAIL_NATURE', 'Choisissez la nature de l’envoi'); +define('_ERROR_DOCTYPE', 'Type de document non valide'); +define('_ADMISSION_DATE', 'Date d’arrivée'); +define('_FOUND_DOC', 'document(s) trouvé(s)'); +define('_PROCESS', 'Traitement '); +define('_DOC_NUM', 'document n° '); +define('_GENERAL_INFO', 'Informations générales'); +define('_ON_DOC_NUM', ' sur le document n°'); +define('_PRIORITY', 'Priorité'); +define('_MAIL_DATE', 'Date du courrier'); +define('_DOC_HISTORY', 'Historique'); +define('_DONE_ANSWERS','Réponses effectuées'); +define('_MUST_DEFINE_ANSWER_TYPE', 'Vous devez préciser le type de réponse'); +define('_MUST_CHECK_ONE_BOX', 'Vous devez cocher au moins une case'); +define('_ANSWER_TYPE','Type(s) de réponse'); + +define('_INDEXATION_TITLE', 'Indexation d’un document'); +define('_CHOOSE_FILE', 'Choisissez le fichier'); +define('_CHOOSE_TYPE', 'Choisissez un type'); + +define('_FILE_LOADED_BUT_NOT_VISIBLE', 'Le fichier est chargé et prêt à être enregistré sur le serveur.<br/>'); +define('_ONLY_FILETYPES_AUTHORISED', 'Seuls les fichiers suivants peuvent être affichés dans cette fenêtre'); +define('_PROBLEM_LOADING_FILE_TMP_DIR', 'Problème lors du chargement du fichier sur le répertoire temporaire du serveur'); +define('_DOWNLOADED_FILE', 'Fichier chargé'); +define('_WRONG_FILE_TYPE', 'Ce type de fichier n’est pas permis'); + +define('_LETTERBOX', 'Gestion de courrier'); +define('_APA_COLL', 'APA - ne pas utiliser'); +define('_REDIRECT_TO_ACTION', 'Rediriger vers une action'); +define('_DOCUMENTS_LIST', 'Liste'); + + +/********* Contacts ************/ +define('_ADMIN_CONTACTS', 'Contacts'); +define('_ADMIN_CONTACTS_DESC', 'Administration des contacts'); +define('_CONTACTS_LIST', 'Liste des contacts'); +define('_CONTACT_ADDITION', 'Ajouter contact'); +define('_CONTACTS', 'contact(s)'); +define('_CONTACT', 'Contact'); +define('_ALL_CONTACTS', 'Tous les contacts'); +define('_ADD_CONTACT', 'Ajout d’un contact'); +define('_PHONE', 'Téléphone'); +define('_ADDRESS', 'Adresse'); +define('_STREET', 'Rue'); +define('_COMPLEMENT', 'Complément'); +define('_TOWN', 'Ville'); +define('_COUNTRY', 'Pays'); +define('_SOCIETY', 'Société'); +define('_COMP', 'Autres'); +define('_COMP_DATA', 'Informations complémentaires'); +define('_CONTACT_ADDED', 'Contact ajouté'); +define('_CONTACT_MODIFIED', 'Contact modifié'); +define('_CONTACT_DELETED', 'Contact supprimé'); +define('_MODIFY_CONTACT', 'Modifier un contact'); +define('_IS_CORPORATE_PERSON', 'Personne morale'); +define('_TITLE2', 'Civilité'); +define('_TITLE2', 'Civilité'); +define('_YOU_MUST_SELECT_CONTACT', 'Vous devez sélectionner un contact '); +define('_CONTACT_INFO', 'Fiche contact'); + +define('_SHIPPER', 'Expéditeur'); +define('_DEST', 'Destinataire'); +define('_INTERNAL2', 'Interne'); +define('_EXTERNAL', 'Externe'); +define('_CHOOSE_SHIPPER', 'Choisir un expéditeur'); +define('_CHOOSE_DEST', 'Choisir un destainataire'); +define('_DOC_DATE', 'Date du document'); +define('_CONTACT_CARD', 'Fiche contact'); +define('_CREATE_CONTACT', 'Ajouter un contact'); +define('_USE_AUTOCOMPLETION', 'Utiliser l’autocomplétion'); + +define('_USER_DATA', 'Fiche utilisateur'); +define('_SHIPPER_TYPE', 'Type d’expéditeur'); +define('_DEST_TYPE', 'Type de destinataire'); +define('_VALIDATE_MAIL', 'Validation courrier'); +define('_LETTER_INFO','Informations sur le courrier'); +define('_DATE_START','Date d’arrivée'); +define('_LIMIT_DATE_PROCESS','Date limite de traitement'); + + +//// INDEXING SEARCHING +define('_NO_RESULTS', 'Aucun résultat'); +define('_FOUND_DOCS', 'document(s) trouvé(s)'); +define('_MY_CONTACTS', 'Mes contacts'); +define('_DETAILLED_PROPERTIES', 'Propriétés détaillées'); +define('_VIEW_DOC_NUM', 'Visualisation du document n°'); +define('_TO', 'vers'); +define('_FILE_PROPERTIES', 'Propriétés du fichier'); +define('_FILE_DATA', 'Informations sur le document'); +define('_VIEW_DOC', 'Voir le document'); +define('_TYPIST', 'Opérateur'); +define('_LOT', 'Lot'); +define('_ARBOX', 'Boite'); +define('_ARBOXES', 'Boites'); +define('_ARBATCHES', 'Lot'); +define('_CHOOSE_BOXES_SEARCH_TITLE', 'Sélectionnez la ou les boites pour restreindre la recherche'); +define('_PAGECOUNT', 'Nb pages'); +define('_ISPAPER', 'Papier'); +define('_SCANDATE', 'Date de numérisation'); +define('_SCANUSER', 'Utilisateur du scanner'); +define('_SCANLOCATION', 'Lieu de numérisation'); +define('_SCANWKSATION', 'Station de numérisation'); +define('_SCANBATCH', 'Lot de numérisation'); +define('_SOURCE', 'Source'); +define('_DOCLANGUAGE', 'Langage du document'); +define('_MAILDATE', 'Date du courrier'); +define('_MD5', 'Empreinte MD5'); +define('_WORK_BATCH', 'Lot de chargement'); +define('_DONE','Actions effectuées'); +define('_ANSWER_TYPES_DONE', 'Type(s) de réponses effectuées'); +define('_CLOSING_DATE', 'Date de clôture'); +define('_FULLTEXT', 'Plein texte'); +define('_FULLTEXT_HELP', 'Recherche plein texte avec le moteur Lucène...'); +define('_FILE_NOT_SEND', 'Le fichier n’a pas été envoyé'); +define('_TRY_AGAIN', 'Veuillez réessayer'); +define('_DOCTYPE_MANDATORY', 'Le type de pièce est obligatoire'); +define('_INDEX_UPDATED', 'Index mis à jour'); + +define('_QUICKLAUNCH', 'Raccourcis'); +define('_SHOW_DETAILS_DOC', 'Voir les détails du document'); +define('_VIEW_DOC_FULL', 'Voir le document'); +define('_DETAILS_DOC_FULL', 'Voir la fiche du document'); +define('_IDENTIFIER', 'Référence'); +define('_CHRONO_NUMBER', 'Numéro chrono'); +define('_NO_CHRONO_NUMBER_DEFINED', 'Le numéro chrono n\'est pas défini'); +define('_FOR_CONTACT_C', 'Pour'); +define('_TO_CONTACT_C', 'De'); + +define('_APPS_COMMENT', 'Application Maarch Entreprise'); +define('_CORE_COMMENT', 'Coeur du Framework'); +define('_CLEAR_FORM', 'Effacer le formulaire'); + +define('_MAX_SIZE_UPLOAD_REACHED', 'Taille maximum de fichier dépassée'); +define('_NOT_ALLOWED', 'interdit'); +define('_CHOOSE_TITLE', 'Choisissez une civilité'); + +/////////////////// Reports +define('_USERS_LOGS', 'Liste des accès à l’application par agent'); +define('_USERS_LOGS_DESC', 'Liste des accès à l’application par agent'); +define('_PROCESS_DELAY_REPORT', 'Délai moyen de traitement par type de courrier'); +define('_PROCESS_DELAY_REPORT_DESC', 'Délai moyen de traitement par type de courrier'); +define('_MAIL_TYPOLOGY_REPORT', 'Typologie des courriers par période'); +define('_MAIL_TYPOLOGY_REPORT_DESC', 'Typologie des courriers par période'); +define('_MAIL_VOL_BY_CAT_REPORT', 'Volume de courriers par catégorie par période'); +define('_MAIL_VOL_BY_CAT_REPORT_DESC', 'Volume de courriers par catégorie par période'); +define('_SHOW_FORM_RESULT', 'Afficher le résultat sous forme de '); +define('_GRAPH', 'Graphique'); +define('_ARRAY', 'Tableau'); +define('_SHOW_YEAR_GRAPH', 'Afficher le résultat pour l’année'); +define('_SHOW_GRAPH_MONTH', 'Afficher le résultat pour le mois de'); +define('_OF_THIS_YEAR', 'de cette année'); +define('_NB_MAILS1', 'Nombre de courriers enregistrés'); +define('_FOR_YEAR', 'pour l’année'); +define('_FOR_MONTH', 'pour le mois de'); +define('_N_DAYS','NB JOURS'); + +/******************** Specific DGGT ************/ +define('_PROJECT', 'Projet'); +define('_MARKET', 'Marché'); +define('_SEARCH_CUSTOMER', 'Consultation Projets Marchés'); +define('_SEARCH_CUSTOMER_TITLE', 'Recherche Projets Marchés'); +define('_TO_SEARCH_DEFINE_A_SEARCH_ADV', 'Pour lancer une recherche vous devez saisir un n° de dossier ou un nom de projet ou de marché'); +define('_DAYS', 'jours'); +define('_LAST_DAY', 'Dernier jour'); + + + +/******************** Keywords Helper ************/ +define('_HELP_KEYWORD0', 'id de l’utilisateur connecté'); +define('_HELP_BY_CORE', 'Mots clés de Maarch Core'); + +define('_FIRSTNAME_UPPERCASE', 'PRENOM'); +define('_TITLE_STATS_USER_LOG', 'Accès à l’application'); + +define('_DELETE_DOC', 'Supprimer ce document'); +define('_THIS_DOC', 'ce document'); +define('_MODIFY_DOC', 'Modifier des informations'); +define('_BACK_TO_WELCOME', 'Retourner à la page d’accueil'); +define('_CLOSE_MAIL', 'Clôturer un courrier'); + +/************** Réouverture courrier **************/ +define('_MAIL_SENTENCE2', 'En saisissant le n°GED du document, vous passerez le statut de ce dernier à "En cours".'); +define('_MAIL_SENTENCE3', 'Cette fonction a pour but d’ouvrir un courrier fermé prématurément.'); +define('_ENTER_DOC_ID', 'Saisissez l’identifiant du document'); +define('_TO_KNOW_ID', 'Pour connaître l’identifiant du document, effectuez une recherche ou demandez-le à l’opérateur'); +define('_MODIFY_STATUS', 'Modifier le statut'); +define('_REOPEN_MAIL', 'Réouverture de courrier'); +define('_REOPEN_THIS_MAIL', 'Réouverture du courrier'); + +define('_OWNER', 'Propriétaire'); +define('_CONTACT_OWNER_COMMENT', 'Laisser vide pour rendre ce contact public.'); +?> diff --git a/maarch_entreprise/trunk/ldap/class_adLDAP.php b/maarch_entreprise/trunk/ldap/class_adLDAP.php new file mode 100644 index 0000000000000000000000000000000000000000..44f9a80cbeaed7285b0f8a3599ec3fef2518f6b5 --- /dev/null +++ b/maarch_entreprise/trunk/ldap/class_adLDAP.php @@ -0,0 +1,385 @@ +<?php /** + * PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY + * Version 3.0 + * + * PHP Version 5 with SSL and LDAP support + * + * Written by Scott Barnett, Richard Hyland + * email: scott@wiggumworld.com, adldap@richardhyland.com + * http://adldap.sourceforge.net/ + * + * Copyright (c) 2006-2009 Scott Barnett, Richard Hyland + * + * We'd appreciate any improvements or additions to be submitted back + * to benefit the entire community :) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * @category ToolsAndUtilities + * @package adLDAP + * @author Scott Barnett, Richard Hyland + * @copyright (c) 2006-2009 Scott Barnett, Richard Hyland + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1 + * @version 3.0 + * @link http://adldap.sourceforge.net/ + */ + + + /** +* Main adLDAP class +* +* Can be initialised using $adldap = new adLDAP(); +* +* Something to keep in mind is that Active Directory is a permissions +* based directory. If you bind as a domain user, you can't fetch as +* much information on other users as you could as a domain admin. +* +* Before asking questions, please read the Documentation at +* http://adldap.sourceforge.net/wiki/doku.php?id=api +*/ +class LDAP { + + /** + * Define the different types of account in AD + */ + const ADLDAP_NORMAL_ACCOUNT = 805306368; + const ADLDAP_WORKSTATION_TRUST = 805306369; + const ADLDAP_INTERDOMAIN_TRUST = 805306370; + const ADLDAP_SECURITY_GLOBAL_GROUP = 268435456; + const ADLDAP_DISTRIBUTION_GROUP = 268435457; + const ADLDAP_SECURITY_LOCAL_GROUP = 536870912; + const ADLDAP_DISTRIBUTION_LOCAL_GROUP = 536870913; + + + protected $_domain=NULL; + + /** + * Optional account with higher privileges for searching + * This should be set to a domain admin account + * + * @var string + * @var string + */ + protected $_login=NULL; + protected $_password=NULL; + + /** + * Use SSL, your server needs to be setup, please see + * http://adldap.sourceforge.net/wiki/doku.php?id=ldap_over_ssl + * + * @var bool + */ + protected $_ssl=false; + + /* + * Connection and bind default variables + * + * @var mixed + * @var mixed + */ + protected $_conn; + protected $_bind; + + + function __construct($domain,$login,$password,$ssl='false'){ + + $this->_domain = $domain; + $this->_login = $login; + $this->_password = $password; + $this->_ssl = ($ssl == 'true'); + + // Connect to the AD/LDAP server as the username/password + if ($this->_use_ssl) + { + $this->_conn = ldap_connect("ldaps://".$this->_domain); + } + else + { + $this->_conn = ldap_connect($this->_domain); + } + + + + // Set some ldap options for talking to AD + ldap_set_option($this->_conn, LDAP_OPT_PROTOCOL_VERSION, 3); + ldap_set_option($this->_conn, LDAP_OPT_REFERRALS, 0); + + // Bind as a domain admin if they've set it up + if ($this->_login!=NULL && $this->_password!=NULL){ + $this->_bind = @ldap_bind($this->_conn,$this->_login."@".$this->_domain,$this->_password); + if (!$this->_bind){ + if ($this->_ssl) + { + throw new Exception ('FATAL: AD bind failed. Either the LDAPS connection failed or the login credentials are incorrect.'); + } + else + { + throw new Exception ("FATAL: AD bind failed. Check the login credentials."); + } + } + } + } + + /** + * Default Destructor + * + * Closes the LDAP connection + * + * @return void + */ + function __destruct(){ ldap_close($this->_conn); } + + /** + * Validate a user's login credentials + * + * @param string $username A user's AD username + * @param string $password A user's AD password + * @param bool optional $prevent_rebind + * @return bool + */ + public function authenticate($login,$password,$prevent_rebind=false){ + + // Prevent null binding + if ($login==NULL || $password==NULL){ return (false); } + + // Bind as the user + + try{ $this->_bind = @ldap_bind($this->_conn,$login."@".$this->_domain,$password); } + catch(Exception $e){} + + if (!$this->_bind){ return (false); } + + // Cnce we've checked their details, kick back into admin mode if we have it + if ($this->_login!=NULL && !$prevent_rebind){ + $this->_bind = @ldap_bind($this->_conn,$this->_login."@".$this->_domain,$this->_password); + if (!$this->_bind){ echo ("FATAL: AD rebind failed."); exit(); } // This should never happen in theory + } + return (true); + } + + //***************************************************************************************************************** + // GROUP FUNCTIONS + + + /** + * Group Information. Returns an array of information about a group. + * The group name is the distinguishedname + * + * @param string $group_dn The group distinguishedname to retrieve info about + * @param array $fields Fields to retrieve + * @return array + */ + public function group_info($group_dn,$fields=array(),$dn='',$filter=''){ + if ($group_dn==NULL){ return (false); } + if (!$this->_bind){ return (false); } + + if(count($fields) < 1) + $fields[] = "distinguishedname"; + + if(empty($dn)) + $dn="DC=".str_replace(".",",DC=",$this->_domain); + + $entries = array(); + + $filter="(&(objectCategory=group)(distinguishedName=".$group_dn.")".$filter.")"; + $sr=ldap_search($this->_conn,$dn,$filter,$fields); + $entries = ldap_get_entries($this->_conn, $sr); + + if($entries['count'] != 1) + return array(); + + $ad_info_group = array(); + + foreach($fields as $fd) + { + if( $fd == 'memberof') + { + unset($entries[0][$fd]['count']); + $ad_info_group[$fd] = $entries[0][$fd]; + } + else if( $fd == 'objectguid' && !empty($entries[0][$fd][0]) ) + { + $ad_info_group[$fd] = bin2hex($entries[0][$fd][0]); + } + else if( $fd == 'objectguid' && empty($entries[0][$fd][0]) ) + { + //Le groupe n'a pas de objectguid (pb sur l'annuaire) + return array(); + } + else if( $fd == 'member') + { + unset($entries[0][$fd]['count']); + $ad_info_group[$fd] = $entries[0][$fd]; + } + else + { + $ad_info_group[$fd] = $entries[0][$fd][0]; + } + } + + return $ad_info_group; + } + + + /** + * Returns a complete list of the groups in AD based on a SAM Account Type + * + * @param string $samaccounttype The account type to return + * @param bool $include_desc Whether to return a description + * @param string $search Search parameters + * @param bool $sorted Whether to sort the results + * @return array + */ + + public function search_groups_dn($sorted = true) { + if (!$this->_bind){ return (false); } + + // Perform the search and grab all their details + $fields=array("dn"); + + $entries = array(); + + //Search for each filter + foreach($this->_filter_dn as $k_fdn => $v_fdn) + { + $filter = "(&(objectCategory=group)".$this->_filter_dn[$k_fdn]['group'].")"; + $sr=ldap_search($this->_conn,$k_fdn,$filter,$fields); + $entries = array_merge(ldap_get_entries($this->_conn, $sr),$entries); + } + + $groups_array=array(); + + for ($i=0; $i< count($entries); $i++) + { + if(!empty($entries[$i]["dn"]) ) + $groups_array[] = $entries[$i]["dn"]; + } + + if( $sorted ){ asort($groups_array); } + + return ($groups_array); + } + + /** + * Return a list of all users in AD + * + * @param bool $include_desc Return a description of the user + * @param string $search Search parameter + * @param bool $sorted Sort the user accounts + * @return array + */ + public function all_users($fields=array(),$dn='',$filter=''){ + + if(empty($dn)) + $dn="DC=".str_replace(".",",DC=",$this->_domain); + + if (!$this->_bind){ return (false); } + + if(count($fields) < 1) + $fields[] = "distinguishedname"; + + $entries = array(); + + $filter = "(&(objectClass=user)(objectCategory=person)".$filter.")"; + $sr=ldap_search($this->_conn,$dn,$filter,$fields); + $entries = array_merge(ldap_get_entries($this->_conn, $sr),$entries); + + $ad_users = array(); + + for ($i=0; $i < (count($entries)-1); $i++) + { + foreach($fields as $fd) + { + if( $fd == 'objectguid' && !empty($entries[$i][$fd][0]) ) + { + $ad_users[$i][$fd] = bin2hex($entries[$i][$fd][0]); + } + else if( $fd == 'objectguid' && empty($entries[$i][$fd][0]) ) + { + //L'utilisateur n'a pas de objectguid (pb sur l'annuaire) + unset($ad_users[$i]); + break; + } + else if( $fd == 'memberof') + { + unset($entries[$i][$fd]['count']); + $ad_users[$i][$fd] = $entries[$i][$fd]; + } + else if( $fd == 'useraccountcontrol') + { + if( ($entries[$i][$fd][0] & 2) == 0) + $ad_users[$i][$fd] = 'Y'; + else + $ad_users[$i][$fd] = 'N'; + } + else + { + $ad_users[$i][$fd] = $entries[$i][$fd][0]; + } + } + } + return $ad_users; + } + + public function all_groups($fields=array(),$dn='',$filter=''){ + + if(empty($dn)) + $dn="DC=".str_replace(".",",DC=",$this->_domain); + + if (!$this->_bind){ return (false); } + + if(count($fields) < 1) + $fields[]="distinguishedname"; + + $entries = array(); + + //Search for each filter + $filter = "(&(objectClass=group)".$filter.")"; + + $sr=ldap_search($this->_conn,$dn,$filter,$fields); + $entries = ldap_get_entries($this->_conn, $sr); + + for ($i=0; $i< ( count($entries) -1); $i++) + { + foreach($fields as $fd) + { + if( $fd == 'objectguid' && !empty($entries[$i][$fd][0]) ) + $ad_groups[$i][$fd] = bin2hex($entries[$i][$fd][0]); + + else if( $fd == 'objectguid' && empty($entries[$i][$fd][0]) ) + { + //Le groupe n'a pas de objectguid (pb sur l'annuaire) + unset($ad_groups[$i]); + break; + } + else if( $fd == 'memberof') + { + unset($entries[$i][$fd]['count']); + $ad_groups[$i][$fd] = $entries[$i][$fd]; + } + else if( $fd == 'member') + { + unset($entries[$i][$fd]['count']); + $ad_groups[$i][$fd] = $entries[$i][$fd]; + } + else + { + $ad_groups[$i][$fd] = $entries[$i][$fd][0]; + } + } + } + + return ($ad_groups); + } + +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/ldap/class_log.php b/maarch_entreprise/trunk/ldap/class_log.php new file mode 100644 index 0000000000000000000000000000000000000000..fa0cf9250cb7b29863d2ee373c5723f03fe7ef8d --- /dev/null +++ b/maarch_entreprise/trunk/ldap/class_log.php @@ -0,0 +1,126 @@ +<?php class log +{ + private $xml_file_path; + private $xml_file; + private $log_parent_node; + private $log_node; + private $log_date; + + function __construct($xml_file_path,$log_parent_node_name) + { + $this->xml_file_path = $xml_file_path; + $this->xml_file = new DomDocument('1.0', 'iso-8859-1'); + $this->xml_file->preserveWhiteSpace = false; + + if(@$this->xml_file->load($xml_file_path)) + { + if(!$log_parent_node = $this->xml_file->getElementsByTagName($log_parent_node_name)) + { + throw new Exception('Unable to find the parent node : '.$log_parent_node_name.' in the xml file '.$xml_file_path); + } + else + { + $this->log_parent_node = $log_parent_node->item(0); + } + } + else + { + $this->xml_file = new DomDocument('1.0', 'iso-8859-1'); + $this->xml_file->preserveWhiteSpace = false; + $this->log_parent_node = $this->xml_file->createElement($log_parent_node_name); + $this->xml_file->appendChild($this->log_parent_node); + } + $this->store(); + } + + function start() + { + $this->log_node = $this->xml_file->createElement("log"); + $this->log_node->setAttribute("date",date('dmY,H:i.s')); + $this->log_node->setAttribute("state","start"); + $this->log_parent_node->appendChild($this->log_node); + $this->store(); + } + + function count() + { + if($tab_logs = $this->xml_file->getElementsByTagName("log")) + return $tab_logs->length; + else + return 0; + } + + function __destruct() + { + //$this->remove($this->log_node); + } + + function remove($log_node) + { + $this->log_parent_node->removeChild($log_node); + $this->store(); + } + + function add_notice($notice) + { + $notice_node = $this->xml_file->createElement("notice"); + $notice_text = $this->xml_file->createTextNode($notice); + $notice_node->appendChild($notice_text); + $this->log_node->appendChild($notice_node); + $this->log_node->setAttribute("state","process"); + $this->store(); + } + + function add_error($error) + { + $erreur_node = $this->xml_file->createElement("error"); + $erreur_text = $this->xml_file->createTextNode($error); + $erreur_node->appendChild($erreur_text); + $this->log_node->appendChild($erreur_node); + $this->log_node->setAttribute("state","process"); + $this->store(); + } + + function add_fatal_error($error) + { + $this->add_error($error); + $this->log_node->setAttribute("state","error"); + $this->store(); + } + + function end() + { + if($this->log_node->getAttribute("state") != "error") + $this->log_node->setAttribute("state","done"); + $this->store(); + } + + function store() + { + $this->xml_file->formatOutput = true; + $this->xml_file->normalize(); + if(!$this->xml_file->save($this->xml_file_path)) + throw new Exception('Unable to store the document '.$this->xml_file_path); + } + + function purge($max_nb_log) + { + if( !$logs = $this->xml_file->getElementsByTagName("log") ) + return false; + else + { + if( $this->count() > $max_nb_log && $max_nb_log != 0 ) + { + $this->remove($logs->item(0)); + $this->purge($max_nb_log); + } + else + { + $this->store(); + } + return true; + } + } + +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/ldap/config_ldap.xml b/maarch_entreprise/trunk/ldap/config_ldap.xml new file mode 100644 index 0000000000000000000000000000000000000000..a8ab19151bd8385fc8cb3f7075b6189d39724306 --- /dev/null +++ b/maarch_entreprise/trunk/ldap/config_ldap.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <config> + <!-- Appel la class_<type_ldap> en fonction du type d'annuaire --> + <type_ldap>adLDAP</type_ldap> + <!-- Prefixe les group_id de letterbox par --> + <group_prefix_ldap>LDAP</group_prefix_ldap> + <!-- nom de domaine ex : maarch.org --> + <domain>mairie.ville-blois.fr</domain> + <!-- login admnistrateur du domaine --> + <login_admin>Administrateur</login_admin> + <!-- mot de passe administrateur annuaire ldap --> + <pass>maarch</pass> + <!-- cryptage de la communication ( true or false) --> + <ssl>false</ssl> + <!--Nombre de logs avant purge (si purge_log == 0 alors les logs ne sont jamais purges) --> + <purge_log>1</purge_log> + <!-- Import des users qui n'appartiennent a aucun groupe --> + <lost_users>false</lost_users> + <!-- Si LDAP est desactive alors le pass de chaque utilisateur est son login --> + <pass_is_login>true</pass_is_login> + </config> + <mapping> + <user ext_id="objectguid"> + <user_id>samaccountname</user_id> + <firstname>givenname</firstname> + <lastname>sn</lastname> + <phone>telephonenumber</phone> + <mail>mail</mail> + <fonction>title</fonction> + <enabled>useraccountcontrol</enabled><!--Depend du type d'annuaire--> + <memberof role="">memberof</memberof> + </user> + <group ext_id="objectguid"> + <group_id>samaccountname</group_id> + <group_desc>cn</group_desc> + <memberof>memberof</memberof> + </group> + </mapping> + <filter> + <!-- Arbre inversé dont les feuilles sont des users --> + <dn id="" type="organization"> + <user>(cn=*)</user> + <group>(cn=*)</group> + <security><!-- Perimetre documentaire --> + <brothers>false</brothers> + <up>0</up> + <down>0</down> + </security> + <redirect_services><!-- Redirection vers les services --> + <brothers>false</brothers> + <up>0</up> + <down>0</down> + </redirect_services> + <redirect_groups><!-- Redirection vers les utilisateurs des groupes --> + <brothers>false</brothers> + <up>0</up> + <down>0</down> + </redirect_groups> + </dn> + <dn id="" type="rights"> + <user>(cn=*)</user> + <group>(cn=*)</group> + </dn> + </filter> +</root> diff --git a/maarch_entreprise/trunk/ldap/ldap_to_xml.php b/maarch_entreprise/trunk/ldap/ldap_to_xml.php new file mode 100644 index 0000000000000000000000000000000000000000..728fb60713ecdc7c5b5ab099d07c28fd9984d9b1 --- /dev/null +++ b/maarch_entreprise/trunk/ldap/ldap_to_xml.php @@ -0,0 +1,283 @@ +<?php +//Arguments + +if( !isset($argv) ) + exit(htmlentities("Ce script ne peut-etre appelé qu'en PHP CLI")); + +else if( isset($argv) && count($argv) < 3) + exit("Erreur de Syntaxe !\nLa syntaxe est $argv[0] <fichier de conf xml> <xml de sortie>"); + +else +{ + $ldap_conf_file = trim($argv[1]); + $out_xml_file = trim($argv[2]); +} + +//Extraction de /root/config dans le fichier de conf +$ldap_conf = new DomDocument(); +try +{ + $ldap_conf->load($ldap_conf_file); +} +catch(Exception $e) +{ + exit("Impossible de charger le document : ".$ldap_conf_file."\n + Erreur : ".$e.getMessage."\n"); +} + + +$xp_ldap_conf = new domxpath($ldap_conf); + +foreach($xp_ldap_conf->query("/root/config/*") as $cf) + ${$cf->nodeName} = $cf->nodeValue; + +//On inclus la class LDAP qui correspond à l'annuaire +if(!include("class_".$type_ldap.".php")) + exit("Impossible de charger class_".$type_ldap.".php\n"); + +//**********************************// +// LDAP CONNECTION // +//**********************************// + +//Try to create a new ldap instance +try +{ + $ad = new LDAP($domain,$login_admin,$pass,false); +} +catch(Exception $con_failure) +{ + exit("Impossible de se connecter à l'annuaire\n + Erreur : ".$con_failure->getMessage()."\n"); +} + +//**********************************// +// MAPPING // +//**********************************// + + +//User +foreach( $xp_ldap_conf->query("/root/mapping/user/@* | /root/mapping/user/* | /root/mapping/user/*/@*") as $us) + if( !empty($us->nodeValue) ) + $user_fields[$us->nodeName] = $us->nodeValue; + +//Group +foreach( $xp_ldap_conf->query("/root/mapping/group/@* | /root/mapping/group/* | /root/mapping/group/*/@*") as $gs) + if( !empty($gs->nodeValue) ) + $group_fields[$gs->nodeName] = $gs->nodeValue; + +//**********************************// +// FILTER AND DNs // +//**********************************// + +$i=0; +foreach( $xp_ldap_conf->query("/root/filter/dn/@id") as $dn) +{ + $dn_and_filter[$i][$dn->nodeName] = $dn->nodeValue; + if(empty($dn_and_filter[$i][$dn->nodeName])) + $dn_and_filter[$i][$dn->nodeName]= "DC=".str_replace(".",",DC=",$domain); + + $dn_and_filter[$i]['type'] = $xp_ldap_conf->query("/root/filter/dn[@id= '".$dn->nodeValue."']/@type")->item(0)->nodeValue; + if(empty($dn_and_filter[$i]['type'])) + $dn_and_filter[$i]['type'] = "organization"; //Valeur par defaut + + $dn_and_filter[$i]['user'] = $xp_ldap_conf->query("/root/filter/dn[@id= '".$dn->nodeValue."']/user")->item(0)->nodeValue; + if(empty($dn_and_filter[$i]['user'])) + $dn_and_filter[$i]['user'] = "(cn=*)"; //Valeur par defaut + + $dn_and_filter[$i]['group'] = $xp_ldap_conf->query("/root/filter/dn[@id='".$dn->nodeValue."']/group")->item(0)->nodeValue; + if(empty($dn_and_filter[$i]['group'])) + $dn_and_filter[$i]['group'] = "(cn=*)"; //Valeur par defaut + $i++; +} +unset($i); + +//Aucun DN de défini : on prend tout l'annuaire en mode organization +if(count($dn_and_filter) < 1) +{ + $dn_and_filter[0]['id'] = "DC=".str_replace(".",",DC=",$domain); + $dn_and_filter[0]['type'] = "organization"; + $dn_and_filter[0]['user'] = "(cn=*)"; + $dn_and_filter[0]['group'] = "(cn=*)"; +} + +//**********************************// +// XML OUT // +//**********************************// +$out_xml = new DomDocument('1.0', 'UTF-8'); +$xp_out = new domxpath($out_xml); + +$dns = $out_xml->createElement('dns'); +$out_xml->appendChild($dns); + +//**********************************// +// XML FUNCTIONS // +//**********************************// + +function createUserNode($parent,$user) +{ + global $out_xml, $ad, $user_fields, $group_fields; + + if($parent == null || count($user) < 1 ) + return null; + + $u_node = $out_xml->createElement("user"); + + foreach($user as $k_fd => $v_fd) + { + if( $k_fd == "dn" || $k_fd == "ext_id") + $u_node->setAttribute($k_fd,$v_fd); + + else if($k_fd == "memberof" && count($v_fd) > 0) + { + $mbof = $out_xml->createElement($k_fd); + + if( isset($user['role']) ) + $mbof->setAttribute("role",$user['role']); + + for($i=0;$i<count($v_fd);$i++) + { + $tmp_g_inf = groupInfo($v_fd[$i]); + + if( !empty( $tmp_g_inf ) ) + { + $mbof->appendChild( createGroupNode($mbof,$tmp_g_inf) ); + } + } + + if($mbof->hasChildNodes()) + $u_node->appendChild($mbof); + } + else if($k_fd == "memberof" && count($v_fd) < 1) + { + //Si l'utilisateur n'est membre d'aucun groupe : Rien à faire + } + else if($k_fd == 'role') + { + //Traité dans memberof + } + else + $u_node->appendChild($out_xml->createElement($k_fd,$v_fd)); + } + + return $u_node; +} + +function createGroupNode($parent,$group) +{ + global $out_xml, $ad, $user_fields, $group_fields; + + if($parent == null || count($group) < 1 ) + return null; + + $g_node = $out_xml->createElement("group"); + + foreach($group as $k_fd => $v_fd) + { + if( $k_fd == "dn" || $k_fd == "ext_id" ) + $g_node->setAttribute($k_fd,$v_fd); + + else if($k_fd == "memberof" && count($v_fd) > 0) + { + $mbof = $out_xml->createElement($k_fd); + + for($i=0;$i<count($v_fd);$i++) + { + $tmp_g_inf = groupInfo($v_fd[$i]); + if( !empty( $tmp_g_inf ) ) + $mbof->appendChild( createGroupNode($mbof,$tmp_g_inf) ); + } + + if($mbof->hasChildNodes()) + $g_node->appendChild($mbof); + } + else if($k_fd == "memberof" && count($v_fd) < 1) + { + //Si le groupe n'est membre d'aucun groupe : Rien à faire + } + else + $g_node->appendChild($out_xml->createElement($k_fd,$v_fd)); + } + + return $g_node; +} + +function groupInfo($group_dn) +{ + global $ad, $group_fields, $dn_and_filter; + + if(!empty($dn_and_filter)) + foreach($dn_and_filter as $dn_fil) + { + $tmp_g_inf = $ad->group_info($group_dn,array_values($group_fields),$dn_fil['id'],$dn_fil['group']); + + if( !empty($tmp_g_inf) ) + { + return array_combine(array_keys($group_fields),array_values($tmp_g_inf)); + } + } + return null; +} + +//**********************************// +// USER // +//**********************************// + +if(!empty($dn_and_filter)) +foreach($dn_and_filter as $dn_fil) +{ + //Pour chaque DN on extrait les utilisateurs comme feuilles du DN + + $dn = $out_xml->createElement('dn'); + $dn->setAttribute("id",$dn_fil['id']); + $dns->appendChild($dn); + + $list_users = array(); + $list_users = $ad->all_users(array_values($user_fields),$dn_fil['id'],$dn_fil['user']); + + foreach($list_users as $user) + { + $dn->appendChild(createUserNode($dn,array_combine( array_keys($user_fields),array_values($user)) ) ); + } +} + +//**********************************// +// TYPE OF GROUP // +//**********************************// +$xp_out_xml = new domxpath($out_xml); + +if(!empty($dn_and_filter)) +foreach($dn_and_filter as $dn_fil) +{ + //Pour chaque groupe present dans chaque DN on met à jour les groupes du xml + + $group_users = $ad->all_groups(array_values($group_fields),$dn_fil['id'],$dn_fil['group']); + + if(!empty($group_users)) + foreach($group_users as $group) + { + $group = array_combine(array_keys($group_fields),array_values($group)); + + $update_type = $xp_out_xml->query("//group[@ext_id='".$group['ext_id']."']"); + + foreach($update_type as $ut) + { + $ut->setAttribute("type",$dn_fil["type"]); + } + } +} + +//**********************************// +// SAVE XML FILE // +//**********************************// +if(file_exists($out_xml_file)) +{ + unlink(dirname($out_xml_file)."/".basename($out_xml_file)); + echo "Old file ".basename($out_xml_file)." deleted\n"; +} + +$out_xml->formatOutput = true; +$out_xml->normalize(); +$out_xml->save($out_xml_file); + +echo "File ".basename($out_xml_file)." created\n"; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/ldap/xml_to_letterbox.php b/maarch_entreprise/trunk/ldap/xml_to_letterbox.php new file mode 100644 index 0000000000000000000000000000000000000000..4997415b1d3ad808f522a3bfb79cf1c83de46631 --- /dev/null +++ b/maarch_entreprise/trunk/ldap/xml_to_letterbox.php @@ -0,0 +1,1541 @@ +<?php +$debug_group=false; +$debug_service=false; +$debug_user=false; +$debug_user_group=false; +$debug_basket=false; +$debug_security = false; +$debug_redirect_service = false; +$debug_redirect_group = false; +$debug_admin_group = false; + +//Baskets affectées par la redirection de group et de service +$group_basket_update = array( "LateMailBasket" => "mail_process", + "MyBasket" => "mail_process"); + +//Baskets qui ne tiennent pas en compte de la rediraction +$group_basket = array("CopyMailBasket" => "copy_mail", + "DepartmentBasket" => "auth_dep"); + + + +//WEB EXECUTION +if(!isset($argv)) +{ + if(!( isset($_GET['conf']) && isset($_GET['infile']) )) + exit("<p><b>Erreur de Syntaxe !</b><br>La syntaxe est + ".$_SERVER['REQUEST_URI']."?conf=".htmlentities("<fichier de conf xml>")."&infile=".htmlentities("<fichier d'import xml>")."<p>"); + + else + { + $ldap_conf_file = trim($_GET['conf']); + $in_xml_file = trim($_GET['infile']); + } +} +//CLI EXECUTION +else +{ + if(!(count($argv) > 2 )) + exit("Erreur de Syntaxe !\nLa syntaxe est $argv[0] <fichier de conf xml> <fichier d\'import xml>"); + else + { + $ldap_conf_file = trim($argv[1]); + $in_xml_file = trim($argv[2]); + } +} + +//PHP File to include +$include_file = array("class_log.php","../class_functions.php","../class_db.php"); +foreach($include_file as $if) +{ + if ( !@include_once($if)) + { + if(!isset($argv)) + exit("<p><b>Erreur:</b><br>Unable to load ".$if."</p>"); + + else + exit("Unable to load ".$if."\n"); + } +} + +//Create The Log +try +{ + $log = new log('log.xml','root'); +} +catch(Exception $e){ exit($e->getMessage()."\n"); } + +$log->start(); + + +//Looking for the config.xml +if(!@DOMDocument::load("../xml/config.xml")) +{ + $log->add_fatal_error("Unable to load the config.xml file"); + exit; +} +else + $config_xml = DOMDocument::load("../xml/config.xml"); + + +//**********************************// +// LOAD XML INFILE // +//**********************************// + +$in_xml = new DomDocument(); + +try +{ + $in_xml->load($in_xml_file); +} +catch(Exception $e) +{ + $log->add_fatal_error("Impossible de charger le document : ".$in_xml_file." Erreur : ".$e.getMessage); + exit; +} + +$xp_in_xml = new domxpath($in_xml); + + +$old_in_xml = new DomDocument(); + +try +{ + @$old_in_xml->load("old_".$in_xml_file); +} +catch(Exception $e){} + +$old_xp_in_xml = new domxpath($old_in_xml); + + +//**********************************// +// LOAD CONF // +//**********************************// + +//Extraction du fichier de conf +$ldap_conf = new DomDocument(); +try +{ + $ldap_conf->load($ldap_conf_file); +} +catch(Exception $e) +{ + $log->add_fatal_error("Impossible de charger le document : ".$ldap_conf_file." Erreur : ".$e.getMessage); + exit; +} + +$xp_ldap_conf = new domxpath($ldap_conf); + +foreach($xp_ldap_conf->query("/root/config/*") as $cf) + ${$cf->nodeName} = $cf->nodeValue; + +//Extraction du fichier de conf de la dernière execution +$old_ldap_conf = new DomDocument(); +try +{ + @$old_ldap_conf->load(dirname($ldap_conf_file)."/old_".basename($ldap_conf_file)); +} +catch(Exception $e){} + +$old_xp_ldap_conf = new domxpath($old_ldap_conf); +$old_lost_users = $xp_ldap_conf->query("/root/config/lost_users")->item(0)->nodeValue; + + +///**********************************// +// DATABASE CONNECTION // +//**********************************// + +//Database Session Var connection for the class_db +$_SESSION['config']['databaseserver'] = $config_xml->getElementsByTagName("databaseserver")->item(0)->nodeValue; +$_SESSION['config']['databaseuser'] = $config_xml->getElementsByTagName("databaseuser")->item(0)->nodeValue; +$_SESSION['config']['databasepassword'] = $config_xml->getElementsByTagName("databasepassword")->item(0)->nodeValue; +$_SESSION['config']['databasename'] = $config_xml->getElementsByTagName("databasename")->item(0)->nodeValue; +$_SESSION['config']['force_client_utf8'] = $config_xml->getElementsByTagName("force_client_utf8")->item(0)->nodeValue; + +$db = new dbquery(); +$db->connect(); + +//**********************************// +// MAPPING // +//**********************************// + +//User +foreach( $xp_ldap_conf->query("/root/mapping/user/@* | /root/mapping/user/* | /root/mapping/user/*/@*") as $us) + if( !empty($us->nodeValue) && ( trim($us->nodeValue) != "") ) + $xml_user_fields[] = $us->nodeName; + +//Group +foreach( $xp_ldap_conf->query("/root/mapping/group/@* | /root/mapping/group/* | /root/mapping/group/*/@*") as $gs) + if( !empty($gs->nodeValue) && ( trim($gs->nodeValue) != "") ) + $xml_group_fields[] = $gs->nodeName; + + +//**********************************// +// EXT_REFERENCES // +//**********************************// + +//Cree la table ext_references si elle n'existe pas +$db->query("CREATE TABLE IF NOT EXISTS `ext_references` ( + `reference_id` varchar(32) character set utf8 NOT NULL, + `type` varchar(32) character set utf8 NOT NULL, + `field` varchar(32) character set utf8 NOT NULL, + `value` varchar(32) character set utf8 NOT NULL, + PRIMARY KEY (`reference_id`,`type`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"); + + +//**********************************// +// GROUPS UPDATE // +//**********************************// + +//Prepare les champs pour l'update ou l'insert +//On enleve le champ group_id qui est traité par un increment ici +$db->query("SHOW COLUMNS FROM usergroups"); +while($field = $db->fetch_object()) + if($field->Field != "GROUP_ID") + $lb_groups_fields[] = $field->Field; + +$update_groups_fields = array_values(array_uintersect($xml_group_fields,$lb_groups_fields,"strcasecmp")); + +$xml_groups_id = array(); +foreach($xp_in_xml->query("//group/@ext_id") as $group_id) + $xml_groups_id[] = $group_id->nodeValue; + +$old_xml_groups_id = array(); +foreach($old_xp_in_xml->query("//group/@ext_id") as $old_group_id) + $old_xml_groups_id[] = $old_group_id->nodeValue; + +//On supprimer les doublons des groupes +$xml_groups_id = array_unique($xml_groups_id); +$old_xml_groups_id = array_unique($old_xml_groups_id); + + +//INSERT GROUPS +$insert_groups = array_values(array_diff($xml_groups_id,$old_xml_groups_id)); +foreach($insert_groups as $ig) +{ + $db->query("SELECT group_id FROM usergroups WHERE group_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".$ig."' + AND field = 'group_id' + AND type = '".$type_ldap."')"); + + if($group_id = $db->fetch_object()->group_id) + { + //Le groupe exise deja : on le supprime dans usergroups, on le maj dans ext_reference + $db->query("DELETE FROM usergroups WHERE group_id = '".$group_id."'"); + if($debug_group) echo "DELETE FROM usergroups WHERE user_id = '".$group_id."'<br>"; + } + else + { + //Il n'existe pas : on l'insert dans ext_reference + + //On insert un group_id = <group_prefix_ldap>{numero} + + $db->query("SELECT MAX(CAST(SUBSTRING(value,CHAR_LENGTH('".$group_prefix_ldap."')+1) as UNSIGNED )) as max_group_id + FROM ext_references + WHERE field = 'group_id' + AND type = '".$type_ldap."'"); + + $max_group_id = $db->fetch_object()->max_group_id; + + if(!isset($max_group_id)) + $max_group_id = 0; + + $group_id = $group_prefix_ldap.($max_group_id + 1); + + $db->query("INSERT IGNORE INTO ext_references (reference_id,field,value,type) + VALUES ('".$ig."','group_id','".$group_id."','".$type_ldap."')"); + if($debug_group) + echo("INSERT IGNORE INTO ext_references (reference_id,field,value,type) + VALUES ('".$ig."','group_id','".$group_id."','".$type_ldap."')<br>"); + + } + + $sql_insert = "INSERT IGNORE INTO usergroups ( group_id, ".implode(",",$update_groups_fields)." ) VALUES ('".$group_id."','"; + + foreach($update_groups_fields as $ugf) + { + $sql_insert .= addslashes($xp_in_xml->query("//group[@ext_id=\"".$ig."\"]/".$ugf)->item(0)->nodeValue)."','"; + } + + $sql_insert = substr($sql_insert,0,-2).")"; + $db->query($sql_insert); + if($debug_group) echo $sql_insert."<br>"; + unset($sql_insert); + +} + +//DELETE GROUPS +$delete_groups = array_values(array_diff($old_xml_groups_id,$xml_groups_id)); +foreach($delete_groups as $dg) +{ + //Maj enabled N + $sql_disabled = "UPDATE IGNORE usergroups SET enabled = 'N' WHERE group_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".addslashes($dg)."' + AND field = 'group_id' + AND type = '".$type_ldap."')"; + + $db->query($sql_disabled); + if($debug_group) echo $sql_disabled."<br>"; + unset($sql_disabled); +} + +//UPDATE GROUPS +$update_groups = array_values(array_intersect($xml_groups_id,$old_xml_groups_id)); + +foreach($update_groups as $ug) +{ + //Maj de group + $sql_update = "UPDATE usergroups SET Enabled = 'Y', "; + + foreach($update_groups_fields as $ugf) + { + $sql_update .= $ugf." = '".addslashes($xp_in_xml->query("//group[@ext_id=\"".$ug."\"]/".$ugf)->item(0)->nodeValue)."', "; + } + + $sql_update = substr($sql_update,0,-2)." WHERE group_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".addslashes($ug)."' + AND field = 'group_id' + AND type = '".$type_ldap."')"; + + $db->query($sql_update); + if($debug_group) echo $sql_update."<br>"; + unset($sql_update); +} + +//**********************************// +// UPDATE SERVICES // +//**********************************// +//Les services sont identiques au groupes sauf que l'on importe pas les groupes de type "rights" +$update_services_fields = array("group_desc" => "SERVICE"); + +$xml_services_id = array(); +foreach($xp_in_xml->query("//group[@type != \"rights\"]/@ext_id") as $service_id) + $xml_services_id[] = $service_id->nodeValue; + +$old_xml_services_id = array(); +foreach($old_xp_in_xml->query("//group[@type != \"rights\"]/@ext_id") as $old_service_id) + $old_xml_services_id[] = $old_service_id->nodeValue; + +//On supprimer les doublons des services +$xml_services_id = array_unique($xml_services_id); +$old_xml_services_id = array_unique($old_xml_services_id); + + +//INSERT SERVICES +$insert_services = array_values(array_diff($xml_services_id,$old_xml_services_id)); +foreach($insert_services as $is) +{ + $db->query("SELECT id FROM services WHERE id IN + (SELECT value FROM ext_references + WHERE reference_id = '".$ig."' + AND field = 'group_id' + AND type = '".$type_ldap."')"); + + if($service_id = $db->fetch_object()->id) + { + //Le service existe deja : on le supprime dans services + $db->query("DELETE FROM services WHERE id = '".$service_id."'"); + if($debug_service) echo "DELETE FROM services WHERE id = '".$service_id."'<br>"; + } + else + { + //On recupere le group_id du group qui correspond + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".$is."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $service_id = $db->fetch_object()->value; + } + + $sql_insert = "INSERT IGNORE INTO services ( id, ".implode(",",$update_services_fields)." ) VALUES ('".$service_id."','"; + + foreach($update_services_fields as $k_usf => $d_usf) + { + $sql_insert .= addslashes($xp_in_xml->query("//group[@ext_id=\"".$is."\"]/".$k_usf)->item(0)->nodeValue)."','"; + } + + $sql_insert = substr($sql_insert,0,-2).")"; + $db->query($sql_insert); + if($debug_service) echo $sql_insert."<br>"; + unset($sql_insert); + +} + +//DELETE SERVICES +$delete_services = array_values((array_diff($old_xml_services_id,$xml_services_id))); +foreach($delete_services as $ds) +{ + //Maj enabled N + $sql_disabled = "UPDATE IGNORE services SET enabled = 'N' WHERE id IN + (SELECT value FROM ext_references + WHERE reference_id = '".addslashes($ds)."' + AND field = 'group_id' + AND type = '".$type_ldap."')"; + + $db->query($sql_disabled); + if($debug_service) echo $sql_disabled."<br>"; + unset($sql_disabled); +} + +//UPDATE SERVICES +$update_services = array_values(array_intersect($xml_services_id,$old_xml_services_id)); + +foreach($update_services as $us) +{ + //Maj de service + $sql_update = "UPDATE services SET ENABLED = 'Y', "; + + foreach($update_services_fields as $k_usf => $d_usf) + { + $sql_update .= $d_usf." = '".addslashes($xp_in_xml->query("//group[@ext_id=\"".$us."\"]/".$k_usf)->item(0)->nodeValue)."', "; + } + + $sql_update = substr($sql_update,0,-2)." WHERE id IN + (SELECT value FROM ext_references + WHERE reference_id = '".addslashes($us)."' + AND field = 'group_id' + AND type = '".$type_ldap."')"; + + $db->query($sql_update); + if($debug_service) echo $sql_update."<br>"; + unset($sql_update); +} + +//**********************************// +// USERS UPDATE // +//**********************************// + +//Prepare les champs pour l'update ou l'insert dans users +$db->query("SHOW COLUMNS FROM users"); +while($field = $db->fetch_object()) + $lb_users_fields[] = $field->Field; + +$update_users_fields = array_values(array_uintersect($xml_user_fields,$lb_users_fields,"strcasecmp")); +if( $pass_is_login == 'true' ) + $update_users_fields[] = 'password'; + + +//On importe tous les users +if($lost_users == "true") +{ + $xml_users_id = array(); + foreach($xp_in_xml->query("//user/@ext_id") as $user_id) + $xml_users_id[] = $user_id->nodeValue; +} + +//On importe que les users qui sont membres d'un groupe +else +{ + $xml_users_id = array(); + foreach($xp_in_xml->query("//user[memberof]/@ext_id") as $user_id) + $xml_users_id[] = $user_id->nodeValue; +} + +//IDEM pour l'execution precedente +if(isset($old_lost_users) && $old_lost_users == "true") +{ + $old_xml_users_id = array(); + foreach($old_xp_in_xml->query("//user/@ext_id") as $old_user_id) + $old_xml_users_id[] = $old_user_id->nodeValue; +} + +else +{ + $old_xml_users_id = array(); + foreach($old_xp_in_xml->query("//user[memberof]/@ext_id") as $old_user_id) + $old_xml_users_id[] = $old_user_id->nodeValue; +} + + +//INSERT USERS +$insert_users = array_values(array_diff($xml_users_id,$old_xml_users_id)); +foreach($insert_users as $iu) +{ + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".$iu."' + AND field = 'user_id' + AND type = '".$type_ldap."'"); + + if($value = $db->fetch_object()->value) + { + //L'utilisateur existait deja : on le supprime avant de l'inserer + $db->query("DELETE FROM users WHERE user_id = '".$value."'"); + if($debug_user) echo "DELETE FROM users WHERE user_id = '".$value."'<br>"; + + $db->query("DELETE FROM ext_references + WHERE reference_id = '".$iu."' + AND field = 'user_id' + AND type = '".$type_ldap."'"); + if($debug_user) + echo ("DELETE FROM ext_references + WHERE reference_id = '".$iu."' + AND field = 'user_id' + AND type = '".$type_ldap."'").'<br>'; + } + + //Il n'existe pas : on l'insert dans ext_reference + $db->query("INSERT IGNORE INTO ext_references (reference_id,field,value,type) + VALUES ('".$iu."','user_id','".$xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/user_id")->item(0)->nodeValue."','".$type_ldap."')"); + if($debug_user) + echo("INSERT IGNORE INTO ext_references (reference_id,field,value,type) + VALUES ('".$iu."','user_id','".$xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/user_id")->item(0)->nodeValue."','".$type_ldap."')<br>"); + + $sql_insert = "INSERT IGNORE INTO users ( change_password ,".implode(",",$update_users_fields)." ) VALUES ('NO','"; + + foreach($update_users_fields as $uuf) + { + if($uuf == 'password') + $sql_insert .= md5($xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/user_id")->item(0)->nodeValue)."','"; + else + $sql_insert .= addslashes($xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/".$uuf)->item(0)->nodeValue)."','"; + } + + $sql_insert = substr($sql_insert,0,-2).")"; + $db->query($sql_insert); + if($debug_user) + echo $sql_insert."<br>"; + unset($sql_insert); + +} + +//DELETE USERS +$delete_users = array_values(array_diff($old_xml_users_id,$xml_users_id)); +foreach($delete_users as $du) +{ + //Maj status DEL + $sql_disabled = "UPDATE IGNORE users SET status = 'DEL' WHERE user_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".addslashes($du)."' + AND field = 'user_id' + AND type = '".$type_ldap."')"; + + $db->query($sql_disabled); + if($debug_user) + echo $sql_disabled."<br>"; + unset($sql_disabled); +} + +//UPDATE USERS +$update_users = array_values(array_intersect($xml_users_id,$old_xml_users_id)); + +foreach($update_users as $uu) +{ + //Maj de user + + $sql_update = "UPDATE IGNORE users SET status = 'OK', "; + + foreach($update_users_fields as $uuf) + { + if($uuf == 'password') + $sql_update .= "password = '".md5($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."', "; + else + $sql_update .= $uuf." = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/".$uuf)->item(0)->nodeValue)."', "; + } + + $sql_update = substr($sql_update,0,-2)." WHERE user_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".addslashes($uu)."' + AND field = 'user_id' + AND type = '".$type_ldap."')"; + + $db->query($sql_update); + if($debug_user) + echo $sql_update."<br>"; + unset($sql_update); + + //Maj de ext_reference + $db->query("UPDATE IGNORE ext_references + SET value = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."' + WHERE reference_id = '".addslashes($uu)."' + AND field = 'user_id' + AND type = '".$type_ldap."'"); +} + +//**********************************// +// GROUPS / SERVICES USERS LINKS // +//**********************************// + +//Memorisation des resultats des algos pour augmenter les performances +$mem_group_up = array(); +$mem_group_down = array(); + +function group_up($level,$xpath_xml,$ext_id) +{ + global $mem_group_up; + + $xml_uri = $xpath_xml->document->documentURI; + + //Si deja caculé alors on retourne le resultat + if(isset($mem_group_up[$xml_uri][$ext_id][$level])) + return $mem_group_up[$xml_uri][$ext_id][$level]; + + $group_ext_id = array(); + $current_nodes = $xpath_xml->query("//group[@ext_id =\"".$ext_id."\"][@type=\"organization\"]"); + + //Quelque soit le groupe selectionné dans l'arbre, il est membre des mêmes groupes + $current_node = $current_nodes->item(0); + + if($level == 0) + { + $group_ext_id = array($ext_id); + } + else + { + $find_nodes = false; + + //Monte dans l'arbre + foreach($xpath_xml->query("memberof[1]/group[@type=\"organization\"]",$current_node) as $this_group) + { + $find_nodes = true; + + if($this_group->nodeName == "group") + { + $group_ext_id = array_merge(array($ext_id),array_merge($group_ext_id,group_up(($level - 1),$xpath_xml,$this_group->getAttribute("ext_id")))); + } + else + { + $group_ext_id = array_merge(array($ext_id),$group_ext_id); + } + } + + if(!$find_nodes) + $group_ext_id = array_merge(array($ext_id),$group_ext_id); + } + + //Stocke le resultat pour optimisation resultat + $mem_group_up[$xml_uri][$ext_id][$level] = array_values(array_unique($group_ext_id)); + + return $mem_group_up[$xml_uri][$ext_id][$level]; +} + +function group_down($level,$xpath_xml,$ext_id) +{ + global $mem_group_down; + + $xml_uri = $xpath_xml->document->documentURI; + + //Si deja caculé alors on retourne le resultat + if(isset($mem_group_down[$xml_uri][$ext_id][$level])) + return $mem_group_down[$xml_uri][$ext_id][$level]; + + $group_ext_id = array(); + //Les groupes selectionnés ne sont n'ont pas tous pour membres les mêmes groupes et les mêmes users + $current_nodes = $xpath_xml->query("//group[@ext_id =\"".$ext_id."\"][@type=\"organization\"]"); + + if($level == 0) + { + $group_ext_id = array($ext_id); + } + + else + { + $find_nodes = false; + + //Descend dans l'arbre + foreach($current_nodes as $current_node) + { + + $find_nodes = true; + $this_group = $xpath_xml->query("parent::memberof/parent::group[@type=\"organization\"]",$current_node)->item(0); + if($this_group->nodeName == "group") + $group_ext_id = array_merge(array($this_group->getAttribute("ext_id")),array_merge($group_ext_id,group_down(($level - 1),$xpath_xml,$this_group->getAttribute("ext_id")))); + } + + if(!$find_nodes) + $group_ext_id = array_merge(array($ext_id),$group_ext_id); + } + + //Stocke le resultat pour optimisation algo + $mem_group_down[$xml_uri][$ext_id][$level] = array_values(array_unique($group_ext_id)); + + return array_values(array_unique($group_ext_id)); +} + +function group_brothers($xpath_xml,$ext_id) +{ + $group_ext_id = array(); + + foreach(group_up(1,$xpath_xml,$ext_id) as $parent) + { + $group_ext_id = array_diff(array_merge($group_ext_id,group_down(1,$xpath_xml,$parent)),$parent); + } + + return array_values(array_unique($group_ext_id)); +} + +//Prepare les champs pour l'update ou l'insert dans usergroup_content +$db->query("SHOW COLUMNS FROM usergroup_content"); +while($field = $db->fetch_object()) + $lb_usergroup_content_fields[] = $field->Field; + +$update_usergroup_content_fields = array_values(array_uintersect($xml_user_fields,$lb_usergroup_content_fields,"strcasecmp")); + +//On importe tous les users +if($lost_users == "true") +{ + $xml_users_id = array(); + foreach($xp_in_xml->query("//user/@ext_id") as $user_id) + $xml_users_id[] = $user_id->nodeValue; +} + +//On importe que les users qui sont membres d'un groupe +else +{ + $xml_users_id = array(); + foreach($xp_in_xml->query("//user[memberof]/@ext_id") as $user_id) + $xml_users_id[] = $user_id->nodeValue; +} + +//IDEM pour l'execution precedente +if(isset($old_lost_users) && $old_lost_users == "true") +{ + $old_xml_users_id = array(); + foreach($old_xp_in_xml->query("//user/@ext_id") as $old_user_id) + $old_xml_users_id[] = $old_user_id->nodeValue; +} + +else +{ + $old_xml_users_id = array(); + foreach($old_xp_in_xml->query("//user[memberof]/@ext_id") as $old_user_id) + $old_xml_users_id[] = $old_user_id->nodeValue; +} + +//**********************************// +// NEW USERS // +//**********************************// + +$insert_users = array_values(array_diff($xml_users_id,$old_xml_users_id)); +foreach($insert_users as $iu) +{ + //Les groupes de type "organization" de premier niveau rencontrés en remontant dans l'arbre + $primary_groups_group_id = array(); + foreach($xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/memberof[1]/group[@type =\"organization\"]/@ext_id") as $node_ext_id) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($node_ext_id->nodeValue)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $primary_groups_group_id[] = $db->fetch_object()->value; + } + + //Les groupes de type "rights" + $group_rights_group_id = array(); + foreach($xp_in_xml->query("//user[@ext_id=\"".$iu."\"]//group[@type=\"rights\"]/@ext_id") as $group_rights_ext_id) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($group_rights_ext_id->nodeValue)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $group_rights_group_id[] = $db->fetch_object()->value; + } + + //INSERT USER / ORGA GROUP(S) LINK(S) + foreach($primary_groups_group_id as $pggi ) + { + $sql_insert_usergroup_content = "INSERT IGNORE INTO usergroup_content (group_id, Primary_group, ".implode(",",$update_usergroup_content_fields)." ) + VALUES ('".addslashes($pggi)."','N','"; + + foreach($update_usergroup_content_fields as $uugf) + { + $sql_insert_usergroup_content .= addslashes($xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/".$uugf)->item(0)->nodeValue)."','"; + } + + $sql_insert_usergroup_content = substr($sql_insert_usergroup_content,0,-2).")"; + $db->query($sql_insert_usergroup_content); + if($debug_user_group) + echo $sql_insert_usergroup_content."<br>"; + unset($sql_insert_usergroup_content); + } + + //INSERT USER / RIGHTS GROUP(S) LINK(S) + foreach($group_rights_group_id as $grgi) + { + $sql_insert_usergroup_content = "INSERT IGNORE INTO usergroup_content (group_id, Primary_group, ".implode(",",$update_usergroup_content_fields)." ) + VALUES ('".addslashes($grgi)."','N','"; + + foreach($update_usergroup_content_fields as $uugf) + { + $sql_insert_usergroup_content .= addslashes($xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/".$uugf)->item(0)->nodeValue)."','"; + } + + $sql_insert_usergroup_content = substr($sql_insert_usergroup_content,0,-2).")"; + $db->query($sql_insert_usergroup_content); + if($debug_user_group) + echo $sql_insert_usergroup_content."<br>"; + unset($sql_insert_usergroup_content); + } + + //INSERT PRIMARY GROUP + if(isset($primary_groups_group_id[0])) + { + $sql_insert_service = + "UPDATE usergroup_content SET PRIMARY_GROUP = 'Y' + WHERE user_id ='".addslashes($xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/user_id")->item(0)->nodeValue)."' + AND group_id = '".$primary_groups_group_id[0]."'"; + + $db->query($sql_insert_service); + if($debug_user_group) + echo $sql_insert_service."<br>"; + } + + //INSERT USER SERVICE + if(isset($primary_groups_group_id[0])) + { + $sql_insert_service = + "UPDATE users SET department = '".$primary_groups_group_id[0]."' + WHERE user_id ='".addslashes($xp_in_xml->query("//user[@ext_id=\"".$iu."\"]/user_id")->item(0)->nodeValue)."' "; + + $db->query($sql_insert_service); + if($debug_user_group) + echo $sql_insert_service."<br>"; + } +} + +//**********************************// +// UPDATE USERS // +//**********************************// + +$update_users = array_values(array_intersect($xml_users_id,$old_xml_users_id)); +foreach($update_users as $uu) +{ + //**********************************// + //GROUPS TYPE ORGANIZATION / RIGHTS // + //**********************************// + + //UPDATE USER / GROUP(S) LINK(S) + //On compare la liste des groupes de premier niveau à celle du xml de l'execution precedente + + $group_level_one = array(); + foreach($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/memberof[1]/group[@type =\"organization\"]/@ext_id") as $glo) + $group_level_one[] = $glo->nodeValue; + + $old_group_level_one = array(); + foreach($old_xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/memberof[1]/group[@type =\"organization\"]/@ext_id") as $oglo) + $old_group_level_one[] = $oglo->nodeValue; + + $group_rights = array(); + foreach($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]//group[@type=\"rights\"]/@ext_id") as $gr) + $group_rights[] = $gr->nodeValue; + + $old_group_rights = array(); + foreach($old_xp_in_xml->query("//user[@ext_id=\"".$uu."\"]//group[@type=\"rights\"]/@ext_id") as $ogr) + $old_group_rights[] = $ogr->nodeValue; + + //INSERT GROUPS ORGANIZATION AND RIGHTS + $user_group_link_insert = array_values(array_merge(array_diff($group_level_one,$old_group_level_one),array_diff($group_rights,$old_group_rights))); + foreach($user_group_link_insert as $ugli) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($ugli->nodeValue)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $ugli_group_id = $db->fetch_object()->value; + + $sql_insert_usergroup_content = "INSERT IGNORE INTO usergroup_content (group_id, ".implode(",",$update_usergroup_content_fields)." ) + VALUES ('".addslashes($ugli_group_id)."','"; + + foreach($update_usergroup_content_fields as $uugf) + { + if($uugf == 'user_id') + $sql_insert_usergroup_content .= addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."','"; + else + $sql_insert_usergroup_content .= addslashes($xp_in_xml->query("//user[@ext_id=\"".$ugli->nodeValue."\"]/".$uugf)->item(0)->nodeValue)."','"; + } + + $sql_insert_usergroup_content = substr($sql_insert_usergroup_content,0,-2).")"; + $db->query($sql_insert_usergroup_content); + if($debug_user_group) + echo $sql_insert_usergroup_content."<br>"; + unset($sql_insert_usergroup_content); + } + + //DELETE GROUPS ORGANIZATION AND RIGHTS + $user_group_link_delete = array_values(array_merge(array_diff($old_group_level_one,$group_level_one),array_diff($old_group_rights,$group_rights))); + + foreach($user_group_link_delete as $ugld) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($ugld)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $ugld_group_id = $db->fetch_object()->value; + + $sql_delete_usergroup_content = "DELETE FROM usergroup_content + WHERE user_id = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."' + AND group_id = '".addslashes($ugld_group_id)."' "; + if($debug_user_group) + echo $sql_delete_usergroup_content."<br>"; + unset($sql_delete_usergroup_content); + } + + //UPDATE GROUPS ORGANIZATION AND RIGHTS + //Update l'intersection + $user_group_link_update = array_values(array_merge(array_intersect($old_group_level_one,$group_level_one),array_intersect($old_group_rights,$group_rights))); + + foreach($user_group_link_update as $uglu) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($uglu)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $uglu_group_id = $db->fetch_object()->value; + + $sql_update_usergroup_content = "UPDATE IGNORE usergroup_content SET group_id ='".$uglu_group_id."',"; + + foreach($update_usergroup_content_fields as $uugf) + { + if($uugf == 'user_id') + $sql_update_usergroup_content .= $uugf." = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."',"; + else + $sql_update_usergroup_content .= $uugf." = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uglu."\"]/".$uugf)->item(0)->nodeValue)."',"; + } + + $sql_update_usergroup_content = substr($sql_update_usergroup_content,0,-1); + $db->query($sql_update_usergroup_content); + if($debug_user_group) + echo $sql_update_usergroup_content."<br>"; + unset($sql_update_usergroup_content); + } + + //Impossible de ne pas avoir de groupe primaire dans letterbox ni de service + + /* + //UPDATE PRIMARY GROUP + + $db->query("SELECT group_id FROM usergroup_content + WHERE user_id = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."' + AND Primary_group = 'Y'"); + + if(!$db->fetch_object()->group_id) + { + $db->query("SELECT group_id FROM usergroup_content + WHERE user_id ='".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."' + AND group_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".$group_level_one[0]."' + AND field = 'group_id' + AND type = '".$type_ldap."')"); + + $primary_group_id = $db->fetch_object()->group_id; + + if(!empty($primary_group_id)) + { + $sql_update_usergroup_content = "UPDATE usergroup_content SET Primary_group ='Y' + WHERE user_id = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."' + AND group_id = '".$primary_group_id.'"'; + + $db->query($sql_update_usergroup_content); + if($debug_user_group) + echo $sql_update_usergroup_content."<br>"; + unset($sql_update_usergroup_content); + } + } + + //UPDATE SERVICE + $db->query("SELECT department FROM users + WHERE user_id = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."'"); + + if(empty($db->fetch_object()->department)) + { + $db->query("SELECT group_id FROM usergroup_content + WHERE user_id ='".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."' + AND group_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".$group_level_one[0]."' + AND field = 'group_id' + AND type = '".$type_ldap."')"); + + $primary_group_id = $db->fetch_object()->group_id; + + if(!empty($primary_group_id)) + { + $sql_update_usergroup_content = "UPDATE users SET group_id = '".$primary_group_id."' + WHERE user_id = '".addslashes($xp_in_xml->query("//user[@ext_id=\"".$uu."\"]/user_id")->item(0)->nodeValue)."'"; + + $db->query($sql_update_usergroup_content); + if($debug_user) + echo $sql_update_users."<br>"; + unset($sql_update_users); + } + } + */ +} +//**********************************// +// BASKET INSERT // +//**********************************// + +//MyBasket +$db->query("INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) +VALUES ('res_x','MyBasket','Mes courriers à traiter','Courriers à traiter','(status = ''NEW'' or status=''COU'') and DEST_USER = @user and is_folder = ''Y''','Y')"); + +if($debug_basket) + echo "INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','MyBasket','Mes courriers à traiter','Courriers à traiter','(status = ''NEW'' or status=''COU'') and DEST_USER = @user and is_folder = ''Y''','Y')<br>"; + +//LateMailBasket +$db->query("INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) +VALUES ('res_x','LateMailBasket','Mes courriers en retard','Courriers en retards','(STATUS=''NEW'' or STATUS=''COU'') and DEST_USER = @user and now() > CUSTOM_D2 and is_folder = ''Y''','Y')"); + +if($debug_basket) + echo "INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','LateMailBasket','Mes courriers en retard','Courriers en retards','(STATUS=''NEW'' or STATUS=''COU'') and DEST_USER = @user and now() > CUSTOM_D2 and is_folder = ''Y''','Y')<br>"; + + +//CopyMailBasket +$db->query("INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','CopyMailBasket','Mes courriers en copie','Liste des courriers en copie','l.res_table = ''res_x'' and l.user_id = @user and l.res_id = r.res_id and l.sequence > 1 and ( r.status=''NEW'' or r.status=''COU'' or r.status=''WAI'') and is_folder = ''Y''', 'Y')"); + +if($debug_basket) + echo "INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','CopyMailBasket','Mes courriers en copie','Liste des courriers en copie','l.res_table = ''res_x'' and l.user_id = @user and l.res_id = r.res_id and l.sequence > 1 and ( r.status=''NEW'' or r.status=''COU'' or r.status=''WAI'') and is_folder = ''Y''', 'Y')<br>"; + + +//DepartmentBasket +$db->query("INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','DepartmentBasket','Services autorisés','Services autorisés','status <> ''DEL'' AND status <> ''REP'' and status <> ''VAL'' and status <> ''END'' and is_folder=''Y''','Y')"); + +if($debug_basket) + echo "INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','DepartmentBasket','Mes courriers en copie','Liste des courriers en copie','status <> ''DEL'' AND status <> ''REP'' and status <> ''VAL'' and status <> ''END'' and is_folder=''Y''','Y')<br>"; + + +//OutMails +$db->query("INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','OutMails', 'Mes Courriers sortant', 'Mes courriers sortant', 'IS_INGOING = ''N'' and AUTHOR = @user and is_folder = ''Y''','N')"); + +if($debug_basket) + echo "INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','OutMails', 'Mes Courriers sortant', 'Mes courriers sortant', 'IS_INGOING = ''N'' and AUTHOR = @user and is_folder = ''Y''','N')<br>"; + + +//QualifBasket +$db->query("INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','QualifBasket','Mes affaires à qualifier','Mes affaires à qualifier','(status = ''ATT'' or status =''RSV'') and destination = @my_entity ','N')"); + +if($debug_basket) + echo "INSERT Ignore Into baskets (res_table,basket_id,basket_name,basket_desc,basket_clause,is_generic) + VALUES ('res_x','QualifBasket','Mes affaires à qualifier','Mes affaires à qualifier','(status = ''ATT'' or status =''RSV'') and destination = @my_entity ','N')<br>"; + + +//**********************************// +// GROUPBASKET / SECURITY UPDATE // +//**********************************// + +//GROUPS TYPE RIGHTS +$group_rights = array(); + foreach($xp_in_xml->query("//group[@type=\"rights\"]/@ext_id") as $gr) + $group_rights[] = $gr->nodeValue; +$group_rights = array_values(array_unique($group_rights)); + +$old_group_rights = array(); + foreach($old_xp_in_xml->query("//group[@type=\"rights\"]/@ext_id") as $ogr) + $old_group_rights[] = $ogr->nodeValue; +$old_group_rights = array_values(array_unique($old_group_rights)); + + +$group_rights_insert = array_values(array_diff($group_rights,$old_group_rights)); +//INSERT +foreach($group_rights_insert as $gri) +{ + //Security + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($gri)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $gri_id = $db->fetch_object()->value; + + $sql_security_insert = "INSERT IGNORE INTO security (group_id,res_table,where_clause) + VALUES ('".$gri_id."','res_x','(1=0)')"; + + $db->query($sql_security_insert); + if($debug_security) + echo $sql_security_insert."<br>"; + + //Groupbasket + //Pas de redirection +} + +$group_rights_delete = array_values(array_diff($old_group_rights,$group_rights)); +//DELETE +foreach($group_rights_delete as $grd) +{ + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($grd)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $grd_id = $db->fetch_object()->value; + + $sql_security_delete = "DELETE IGNORE FROM security WHERE group_id ='".$grd_id."'"; + $db->query($sql_security_delete); + if($debug_security) + echo $sql_security_delete."<br>"; + + //Groupbasket + //Pas de redirection +} + +$group_rights_update = array_values(array_intersect($group_rights,$old_group_rights)); +//UPDATE +//foreach($group_rights_update as $gru) +{ + //On ne met rien à jour +} + + +//GROUPS TYPE ORGANIZATION +$dns = $xp_in_xml->query("//dns/dn/@id"); + +foreach($dns as $dn) +{ + //CONF XML Parameters + foreach($xp_ldap_conf->query("//dn[@id=\"".$dn->nodeValue."\"]/security/*") as $s) + $security[$s->nodeName] = $s->nodeValue; + + foreach($xp_ldap_conf->query("//dn[@id=\"".$dn->nodeValue."\"]/redirect_services/*") as $rs) + $redirect_services[$rs->nodeName] = $rs->nodeValue; + + foreach($xp_ldap_conf->query("//dn[@id=\"".$dn->nodeValue."\"]/redirect_groups/*") as $rg) + $redirect_groups[$rg->nodeName] = $rg->nodeValue; + + //CONF OLD XML Parameters + foreach($old_xp_ldap_conf->query("//dn[@id=\"".$dn->nodeValue."\"]/security/*") as $s) + $old_security[$s->nodeName] = $s->nodeValue; + + foreach($old_xp_ldap_conf->query("//dn[@id=\"".$dn->nodeValue."\"]/redirect_services/*") as $rs) + $old_redirect_services[$rs->nodeName] = $rs->nodeValue; + + foreach($old_xp_ldap_conf->query("//dn[@id=\"".$dn->nodeValue."\"]/redirect_groups/*") as $rg) + $old_redirect_groups[$rg->nodeName] = $rg->nodeValue; + + //GROUPS IN DN + $group_orga = array(); + foreach($xp_in_xml->query("/dns/dn[@id=\"".$dn->nodeValue."\"]//group[@type=\"organization\"]/@ext_id") as $go) + $group_orga[] = $go->nodeValue; + $group_orga = array_values(array_unique($group_orga)); + + //TREE CONSTRUCTION (Security, Redirect_services, Redirect_groups) + + foreach($group_orga as $go) + { + $tree_security[$go] = array(); + $tree_redirect_services[$go]= array(); + $tree_redirect_groups[$go]=array(); + + $tree_security[$go] = array_values(array_unique(array_merge($tree_security[$go],group_up(intval($security['up']),$xp_in_xml,$go)))); + $tree_redirect_services[$go] = array_values(array_unique(array_merge($tree_redirect_services[$go],group_up(intval($redirect_services['up']),$xp_in_xml,$go)))); + $tree_redirect_groups[$go] = array_values(array_unique(array_merge($tree_redirect_groups[$go],group_up(intval($redirect_groups['up']),$xp_in_xml,$go)))); + + $tree_security[$go] = array_values(array_unique(array_merge($tree_security[$go],group_down(intval($security['down']),$xp_in_xml,$go)))); + $tree_redirect_services[$go] = array_values(array_unique(array_merge($tree_redirect_services[$go],group_down(intval($redirect_services['down']),$xp_in_xml,$go)))); + $tree_redirect_groups[$go] = array_values(array_unique(array_merge($tree_redirect_groups[$go],group_down(intval($redirect_groups['down']),$xp_in_xml,$go)))); + + if($security['brothers'] == 'true') + $tree_security[$go] = array_values(array_unique(array_merge($tree_security[$go],group_brothers($xp_in_xml,$go)))); + + if($redirect_services['brothers'] == 'true') + $tree_redirect_services[$go] = array_values(array_unique(array_merge($tree_redirect_services[$go],group_brothers($xp_in_xml,$go)))); + + if($redirect_groups['brothers'] == 'true') + $tree_redirect_groups[$go] = array_values(array_unique(array_merge($tree_redirect_groups[$go],group_brothers($xp_in_xml,$go)))); + } + + //GROUPS IN DN + $old_group_orga = array(); + foreach($old_xp_in_xml->query("/dns/dn[@id=\"".$dn->nodeValue."\"]//group[@type=\"organization\"]/@ext_id") as $ogo) + $old_group_orga[] = $ogo->nodeValue; + $old_group_orga = array_values(array_unique($old_group_orga)); + + //TREE CONSTRUCTION (Security, Redirect_services, Redirect_groups) + foreach($old_group_orga as $ogo) + { + $old_tree_security[$ogo] = array(); + $old_tree_redirect_services[$ogo]= array(); + $old_tree_redirect_groups[$ogo]=array(); + + $old_tree_security[$ogo] = array_values(array_unique(array_merge($old_tree_security[$ogo],group_up(intval($old_security['up']),$old_xp_in_xml,$ogo)))); + $old_tree_redirect_services[$ogo] = array_values(array_unique(array_merge($old_tree_redirect_services[$ogo],group_up(intval($old_redirect_services['up']),$old_xp_in_xml,$ogo)))); + $old_tree_redirect_groups[$ogo] = array_values(array_unique(array_merge($old_tree_redirect_groups[$ogo],group_up(intval($old_redirect_groups['up']),$old_xp_in_xml,$ogo)))); + + $old_tree_security[$ogo] = array_values(array_unique(array_merge($old_tree_security[$ogo],group_down(intval($old_security['down']),$old_xp_in_xml,$ogo)))); + $old_tree_redirect_services[$ogo] = array_values(array_unique(array_merge($old_tree_redirect_services[$ogo],group_down(intval($old_redirect_services['down']),$old_xp_in_xml,$ogo)))); + $old_tree_redirect_groups[$ogo] = array_values(array_unique(array_merge($old_tree_redirect_groups[$ogo],group_down(intval($old_redirect_groups['down']),$old_xp_in_xml,$ogo)))); + + if($security['brothers'] == 'true') + $old_tree_security[$ogo] = array_values(array_unique(array_merge($old_tree_security[$ogo],group_brothers($old_xp_in_xml,$ogo)))); + + if($redirect_services['brothers'] == 'true') + $old_tree_redirect_services[$ogo] = array_values(array_unique(array_merge($old_tree_redirect_services[$ogo],group_brothers($old_xp_in_xml,$ogo)))); + + if($redirect_groups['brothers'] == 'true') + $old_tree_redirect_groups[$ogo] = array_values(array_unique(array_merge($old_tree_redirect_groups[$ogo],group_brothers($old_xp_in_xml,$ogo)))); + } +} + +//EACH GROUP UPDATE SECURITY AND GROUPBASKET +$group_ext_id = array(); +foreach($xp_in_xml->query("//group[@type=\"organization\"]/@ext_id") as $group) +{ + $group_ext_id[] = $group->nodeValue; +} +$group_ext_id = array_values(array_unique($group_ext_id)); + + +foreach($group_ext_id as $gei) +{ + //SECURITY + if(isset($tree_security[$gei])) + { + //Identifiant reel du groupe + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($gei)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $this_group = $db->fetch_object()->value; + + //LIST SERVICE + $services_list = array(); + + //Les services present lors de la derniere execution + foreach($tree_security[$gei] as $s) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($s)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $services_list[] = $db->fetch_object()->value; + } + + $old_services_list = array(); + + //Les services presents lors de l'avant derniere execution + if(isset($old_tree_security[$gei])) + foreach($old_tree_security[$gei] as $s) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($s)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $old_services_list[] = $db->fetch_object()->value; + } + + //Clause precedente + $db->query("SELECT where_clause FROM security WHERE group_id ='".$this_group."'"); + + if($where_clause = $db->fetch_object()->where_clause) + { + $find_services = preg_replace("#\s#","",$where_clause); + preg_match("#DESTINATIONIN\('(.*)'\)#" ,$find_services,$all_matches); + + $sql_services=array(); + + foreach(explode("','",$all_matches[1]) as $am) + $sql_services[] = $am; + + $final_services=array(); + + //On enleve les services qui n'existent plus + $final_services = array_unique(array_diff(array_unique(array_merge($sql_services,$services_list)),array_diff($old_services_list,$services_list))); + + $update_security = "UPDATE security SET where_clause = + 'DESTINATION IN (''".implode("'',''",$final_services)."'')' + WHERE group_id = '".$this_group."'"; + + if($debug_security) + echo $update_security."<br>"; + + $db->query($update_security); + } + else + { + $insert_security = "INSERT INTO security (group_id,res_table,where_clause) + VALUES ('".$this_group."','res_x','DESTINATION IN (''".implode("'',''",$services_list)."'')')"; + + if($debug_security) + echo $insert_security."<br>"; + + $db->query($insert_security); + } + } + + //Liste des baskets affectés par cette mise à jour + foreach($group_basket_update as $k_gbu => $d_gbu) + { + //REDIRECT SERVICES + if(isset($tree_redirect_services[$gei])) + { + //Identifiant reel du groupe + + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($gei)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $this_group = $db->fetch_object()->value; + + //LIST SERVICE + $services_list = array(); + + //Les services present lors de la derniere execution + foreach($tree_redirect_services[$gei] as $s) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($s)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $services_list[] = $db->fetch_object()->value; + } + + $old_services_list = array(); + + //Les services present lors de l'avant derniere execution + if(isset($old_tree_redirect_services[$gei])) + foreach($old_tree_redirect_services[$gei] as $s) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($s)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $old_services_list[] = $db->fetch_object()->value; + } + + //Clause precedente + $db->query("SELECT redirect_basketlist FROM groupbasket WHERE group_id = '".$this_group."' AND basket_id = '".$k_gbu."' "); + + if($where_clause = $db->fetch_object()->where_clause) + { + $find_services = preg_replace("#\s#","",$where_clause); + preg_match("#'(.*)'#",$find_groups,$all_matches); + + $sql_services=array(); + + foreach(explode("','",$all_matches[1]) as $am) + $sql_services[] = $am; + + $final_services=array(); + + //On enleve les services qui n'existent plus + $final_services = array_unique(array_diff(array_unique(array_merge($sql_services,$services_list)),array_diff($old_services_list,$services_list))); + + $update_redirect_service = "UPDATE groupbasket SET redirect_basketlist = + '''".implode("'',''",$final_services)."''' + WHERE group_id = '".$this_group."' AND basket_id = '".$gbu."'"; + + if($debug_redirect_service) + echo $update_redirect_service."<br>"; + + $db->query($update_redirect_service); + } + else + { + $insert_redirect_service = "INSERT Ignore Into groupbasket (group_id,basket_id,redirect_basketlist,result_page) + VALUES ('".$this_group."','".$k_gbu."','''".implode("'',''",$services_list)."''','".$d_gbu."')"; + + if($debug_redirect_service) + echo $insert_redirect_service."<br>"; + + $db->query($insert_redirect_service); + + //Si la ligne existe pas de insert, donc UPDATE + + $update_redirect_service = "UPDATE groupbasket SET redirect_basketlist = + '''".implode("'',''",$services_list)."''' + WHERE group_id = '".$this_group."' AND basket_id = '".$k_gbu."'"; + + if($debug_redirect_service) + echo $update_redirect_service."<br>"; + + $db->query($update_redirect_service); + } + } + + //REDIRECT GROUPS + + if(isset($tree_redirect_groups[$gei])) + { + //Identifiant reel du groupe + + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($gei)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $this_group = $db->fetch_object()->value; + + //LIST SERVICE + $services_list = array(); + + //Les services present lors de la derniere execution + foreach($tree_redirect_groups[$gei] as $s) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($s)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $services_list[] = $db->fetch_object()->value; + } + + $old_services_list = array(); + + if(isset($old_tree_redirect_groups[$gei])) + //Les services present lors de l'avant derniere execution + foreach($old_tree_redirect_groups[$gei] as $s) + { + $db->query("SELECT value FROM ext_references + WHERE reference_id = '".addslashes($s)."' + AND field = 'group_id' + AND type = '".$type_ldap."'"); + + $old_services_list[] = $db->fetch_object()->value; + } + + //Clause precedente + $db->query("SELECT redirect_grouplist FROM groupbasket WHERE group_id = '".$this_group."' AND basket_id = '".$k_gbu."' "); + + if($where_clause = $db->fetch_object()->where_clause) + { + $find_services = preg_replace("#\s#","",$where_clause); + preg_match("#'(.*)'#",$find_groups,$all_matches); + + $sql_services=array(); + + foreach(explode("','",$all_matches[1]) as $am) + $sql_services[] = $am; + + $final_services=array(); + + //On enleve les services qui n'existent plus + $final_services = array_unique(array_diff(array_unique(array_merge($sql_services,$services_list)),array_diff($old_services_list,$services_list))); + + $update_redirect_group = "UPDATE groupbasket SET redirect_grouplist = + '''".implode("'',''",$final_services)."''' + WHERE group_id = '".$this_group."' AND basket_id = '".$k_gbu."'"; + + if($debug_redirect_group) + echo $update_redirect_group."<br>"; + + $db->query($update_redirect_group); + } + else + { + $insert_redirect_group = "INSERT Ignore Into groupbasket (group_id,basket_id,redirect_grouplist,result_page) + VALUES ('".$this_group."','".$k_gbu."','''".implode("'',''",$services_list)."''','".$d_gbu."')"; + + if($debug_redirect_group) + echo $insert_redirect_group."<br>"; + + $db->query($insert_redirect_group); + + //Si la ligne existe pas de insert, donc UPDATE + + $update_redirect_group = "UPDATE groupbasket SET redirect_grouplist = + '''".implode("'',''",$services_list)."''' + WHERE group_id = '".$this_group."' AND basket_id = '".$k_gbu."'"; + + if($debug_redirect_group) + echo $update_redirect_group."<br>"; + + $db->query($update_redirect_group); + } + } + } + foreach($group_basket as $k_gb => $d_gb) + { + //Identifiant reel du groupe + $db->query("SELECT enabled, group_id FROM usergroups + WHERE group_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".addslashes($gei)."' + AND field = 'group_id' + AND type = '".$type_ldap."')"); + + $enabled_group_id = $db->fetch_object(); + + if($enabled_group_id->enabled == 'Y') + { + $db->query("INSERT Ignore Into groupbasket (group_id,basket_id,result_page) + VALUES ('".$enabled_group_id->group_id."','".$k_gb."','".$d_gb."')"); + + if($debug_basket) + echo "INSERT Ignore Into groupbasket (group_id,basket_id,result_page) + VALUES ('".$enabled_group_id->group_id."','".$k_gb."','".$d_gb."')<br>"; + } + else + { + $db->query("DELETE Ignore FROM groupbasket WHERE group_id ='".$enabled_group_id->group_id."' AND basket_id = '".$k_gb."' "); + + if($debug_basket) + echo "DELETE Ignore FROM groupbasket WHERE group_id ='".$enabled_group_id->group_id."' AND basket_id = '".$k_gb."'<br>"; + } + } +} + +//Les CopyMailBasket ne peuvent pas rediriger + +$db->query("UPDATE IGNORE groupbasket SET can_redirect ='N' WHERE basket_id = 'CopyMailBasket'"); + +if($debug_basket) + echo "UPDATE IGNORE groupbasket SET can_redirect ='N' WHERE basket_id = 'CopyMailBasket'"; + + +//**********************************// +// INSERT ADMIN RIGHTS // +//**********************************// +//Note : L'admin doit appartenir aux dn mappés de l'AD +//On considere que le groupe primaire de l'admin est le groupe administrateur + +$admin_group_ext_id = $xp_in_xml->query("//user[user_id = \"".$login_admin."\"]/memberof[1]/group[@type = \"rights\"][1]/@ext_id"); + +if(isset($admin_group_ext_id)) +{ + $set_admin_group = "UPDATE usergroups + SET Administrator = 'Y', consult_group ='Y', view_relance = 'Y', view_stats = 'Y', + modif_rights = 'Y', export = 'Y', delete_rights = 'Y', print_rights = 'Y', param ='Y' + WHERE group_id IN + (SELECT value FROM ext_references + WHERE reference_id = '".addslashes($admin_group_ext_id->item(0)->nodeValue)."' + AND field = 'group_id' + AND type = '".$type_ldap."')"; + + $db->query($set_admin_group); + + if($debug_admin_group) + echo $set_admin_group."<br>"; +} +else +{ + //Aucun admin il va falloir definir le groupe d'admin à la main +} + +//**********************************// +// RENAME XML // +//**********************************// + +if(file_exists(dirname($in_xml_file)."/old_".basename($in_xml_file))) + unlink(dirname($in_xml_file)."/old_".basename($in_xml_file)); + +if(file_exists(dirname($ldap_conf_file)."/old_".basename($ldap_conf_file))) + unlink(dirname($ldap_conf_file)."/old_".basename($ldap_conf_file)); + +copy(dirname($in_xml_file)."/".basename($in_xml_file),dirname($in_xml_file)."/old_".basename($in_xml_file)); +copy(dirname($ldap_conf_file)."/".basename($ldap_conf_file),dirname($ldap_conf_file)."/old_".basename($ldap_conf_file)); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/log.php b/maarch_entreprise/trunk/log.php new file mode 100644 index 0000000000000000000000000000000000000000..d5a44ac137947438e171b678a40a453718a49183 --- /dev/null +++ b/maarch_entreprise/trunk/log.php @@ -0,0 +1,150 @@ +<?php +/** +* File : log.php +* +* User identification +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* @author Laurent Giovannoni <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); + +$core_tools = new core_tools(); +$core_tools->load_lang(); +$func = new functions(); + +$_SESSION['error'] = ""; +$s_login = $func->wash($_REQUEST['login'],"no",_THE_ID,"yes"); +$s_pass =$func->wash($_REQUEST['pass'],"no",_PASSWORD_FOR_USER,"yes"); +require($_SESSION['pathtocoreclass']."class_security.php"); +require($_SESSION['pathtocoreclass']."class_request.php"); +require($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_business_app_tools.php"); +$sec = new security(); +$business_app_tools = new business_app_tools(); + +if(count($_SESSION['config']) <= 0) +{ + if( strtoupper(substr(PHP_OS, 0, 3)) != "WIN") + { + $_SESSION['slash_env'] = "/"; + } + else + { + $_SESSION['slash_env'] = "\\"; + } + + /*$path_server = $_SERVER['DOCUMENT_ROOT']; + if(!preg_match("/[/\\]$/",$path_server)) + { + $path_server = $path_server.$_SESSION['slash_env']; + }*/ + + $path_tmp = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR,$_SERVER['SCRIPT_FILENAME'])); + $path_server = implode(DIRECTORY_SEPARATOR,array_slice($path_tmp,0,array_search('apps',$path_tmp))).DIRECTORY_SEPARATOR; + + $core_tools->build_core_config($path_server."core".$_SESSION['slash_env']."xml".$_SESSION['slash_env']."config.xml"); + $business_app_tools->build_business_app_config(); + $core_tools->load_modules_config($_SESSION['modules']); + $core_tools->load_menu($_SESSION['modules']); + $core_tools->load_admin_core_board(); + $core_tools->load_admin_module_board($_SESSION['modules']); + //loading app admin board + $core_tools->load_admin_app_board($_SESSION['config']['businessapppath']); + //$func->show_array($_SESSION['config']); + //$func->show_array($_SESSION['ressources']); + //$func->show_array($_SESSION['history']); + //$func->show_array($_SESSION['modules']); + //$func->show_array($_SESSION['modules_loaded']); + //$func->show_array($_SESSION['menu']); + //$func->show_array($_SESSION['tablename']); + //$func->show_array($_SESSION['core_admin_board']); + //$func->show_array($_SESSION['modules_admin_board']); +} + +if(!empty($_SESSION['error'])) +{ + header("location: ".$_SESSION['config']['businessappurl']."login.php?coreurl=".$_SESSION['config']['coreurl']); + exit(); +} +else +{ + if ($_SESSION['config']['ldap'] == "true") + { + //Extraction de /root/config dans le fichier de conf + $ldap_conf = new DomDocument(); + try + { + if(!@$ldap_conf->load($_SESSION['config']['businessapppath']."ldap".DIRECTORY_SEPARATOR."config_ldap.xml")) + { + throw new Exception("Impossible de charger le document : ".$_SESSION['config']['businessappurl']."ldap".DIRECTORY_SEPARATOR."config_ldap.xml"); + } + } + catch(Exception $e) + { + exit($e->getMessage()); + } + + $xp_ldap_conf = new domxpath($ldap_conf); + + foreach($xp_ldap_conf->query("/root/config/*") as $cf) + { + ${$cf->nodeName} = $cf->nodeValue; + } + + //On inclus la class LDAP qui correspond à l'annuaire + if(!include($_SESSION['config']['businessapppath']."ldap".DIRECTORY_SEPARATOR."class_".$type_ldap.".php")) + { + exit("Impossible de charger class_".$type_ldap.".php\n"); + } + + //Try to create a new ldap instance + try + { + $ad = new LDAP($domain,$login_admin,$pass,$ssl); + } + catch(Exception $con_failure) + { + echo $con_failure->getMessage(); + exit; + } + + if($ad -> authenticate($s_login, $s_pass)) + { + $db = new dbquery(); + $db->connect(); + $db->query("SELECT * From users WHERE user_id ='".$s_login."'"); + if($db->fetch_object()) + { + $pass = md5($s_pass); + $sec->login($s_login,$pass); + } + else + { + $_SESSION['error'] = _NO_LOGIN_OR_PSW_BY_LDAP."..."; + header("location: login.php"); + exit; + } + } + else + { + $_SESSION['error'] = _BAD_LOGIN_OR_PSW."..."; + header("location: login.php"); + exit; + } + } + else + { + $pass = md5($s_pass); + $sec->login($s_login,$pass); + } +} +?> diff --git a/maarch_entreprise/trunk/login.php b/maarch_entreprise/trunk/login.php new file mode 100644 index 0000000000000000000000000000000000000000..9d543d612e644b77f3653a6c072cde21e8c84b51 --- /dev/null +++ b/maarch_entreprise/trunk/login.php @@ -0,0 +1,147 @@ +<?php +/** +* File : login.php +* +* Identification form : Login page +* +* @package Maarch PeopleBox 1.1 +* @version 1.1 +* @since 02/2007 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +* @author Laurent Giovannoni <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +//print_r($_SESSION['config']); +if(trim($_GET["coreurl"]) <> '') +{ + $_SESSION['config']['coreurl'] = $_GET["coreurl"]; +} + +if(trim($_SESSION['config']['corename']) == "") +{ + $xmlconfig = simplexml_load_file('../../core/xml/config.xml'); + foreach($xmlconfig->CONFIG as $CONFIG) + { + $_SESSION['config']['corename'] = (string) $CONFIG->corename; + $_SESSION['config']['corepath'] = (string) $CONFIG->corepath; + $_SESSION['config']['tmppath'] = (string) $CONFIG->tmppath; + $_SESSION['config']['unixserver'] = (string) $CONFIG->unixserver; + $_SESSION['config']['defaultpage'] = (string) $CONFIG->defaultpage; + $_SESSION['config']['defaultlang'] = (string) $CONFIG->defaultlanguage; + //$_SESSION['config']['coreurl'] = (string) $CONFIG->coreurl; + if(!isset($_SESSION['config']['coreurl'])) + { + if($_SERVER['SERVER_PORT'] <> 80) + $server_port = ":".$_SERVER['SERVER_PORT']; + else + $server_port = ""; + + $array_uri = explode("/",$_SERVER['SCRIPT_NAME']); + $slice_uri = array_slice($array_uri, 0, -3); + $final_uri = implode("/", $slice_uri)."/"; + //$_SESSION['config']['coreurl'] = "http://".$_SERVER['SERVER_NAME'].$server_port.array_slice('index.php','',arr$_SERVER['SCRIPT_NAME']); + $_SESSION['config']['coreurl'] = "http://".$_SERVER['SERVER_NAME'].$server_port.$final_uri; + //$tabCoreUrl = array(); + //$tabCoreUrl = explode("/", $_SESSION['config']['coreurl']); + //$_SESSION['config']['coreurl'] = $tabCoreUrl[0]."/".$tabCoreUrl[1]."/".$tabCoreUrl[2]."/".$tabCoreUrl[3]."/"; + } + } + $i=0; + foreach($xmlconfig->BUSINESSAPPS as $BUSINESSAPPS) + { + $_SESSION['businessapps'][$i] = array("appid" => (string) $BUSINESSAPPS->appid, + "comment" => (string) $BUSINESSAPPS->comment); + $i++; + } +} +if(trim($_GET['target_page']) <> "") +{ + $_SESSION['target_page'] = $_GET['target_page']; + if(trim($_GET['target_module']) <> "") + { + $_SESSION['target_module'] = $_GET['target_module']; + } + elseif(trim($_GET['target_admin']) <> "") + { + $_SESSION['target_admin'] = $_GET['target_admin']; + } +} +$_SESSION['requestUri'] = ""; +if(trim($_SERVER['argv'][0]) <> "") +{ + $requestUri = $_SERVER['argv'][0]; + $requestUri = str_replace("coreurl=".$_REQUEST["coreurl"], "", $requestUri); + $_SESSION['requestUri'] = $requestUri; +} +//$path_server = $_SERVER['DOCUMENT_ROOT']; +if(strtoupper(substr(PHP_OS, 0, 3)) != "WIN" && strtoupper(substr(PHP_OS, 0, 3)) != "WINNT") +{ + $_SESSION['slash_env'] = "/"; + $path_server = str_replace("\\",DIRECTORY_SEPARATOR, $path_server); +} +else +{ + $_SESSION['slash_env'] = "\\"; + $path_server = str_replace("/",DIRECTORY_SEPARATOR, $path_server); +} + +$path_tmp = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR,$_SERVER['SCRIPT_FILENAME'])); +$path_server = implode(DIRECTORY_SEPARATOR,array_slice($path_tmp,0,array_search('apps',$path_tmp))).DIRECTORY_SEPARATOR; + +$_SESSION['pathtocore'] = $path_server."core".DIRECTORY_SEPARATOR;; +$_SESSION['pathtocoreclass'] = $path_server."core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR; +$_SESSION['pathtomodules'] = $path_server."modules".DIRECTORY_SEPARATOR; + +$_SESSION['urltomodules'] = $_SESSION['config']['coreurl']."modules/"; +$_SESSION['urltocore'] = $_SESSION['config']['coreurl'].'core/'; +$error = $_SESSION['error']; +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_business_app_tools.php"); +$core_tools = new core_tools(); +$business_app_tools = new business_app_tools(); +$func = new functions(); + +$core_tools->build_core_config($_SESSION['pathtocore'].'xml'.DIRECTORY_SEPARATOR.'config.xml'); + +$business_app_tools->build_business_app_config(); + +$core_tools->load_modules_config($_SESSION['modules']); +//$func->show_array($_SESSION); +$core_tools->load_app_services(); +$core_tools->load_modules_services($_SESSION['modules']); +//$core_tools->load_menu($_SESSION['modules']); // transfer in class_security (login + reopen) +$core_tools->load_lang(); +$core_tools->load_html(); +$core_tools->load_header(); +$time = $core_tools->get_session_time_expire(); + +?> +<body id="bodylogin" onload="setTimeout('window.location.reload(true)', <?php echo $time;?>*60*1000);"> + <div id="loginpage"> + <p id="logo"><img src="<?php echo $_SESSION['config']['img'];?>/default_maarch.gif" alt="Maarch" /></p> + <form name="formlogin" id="formlogin" method="post" action="log.php" class="forms"> + <p> + <label for="login"><?php echo _ID; ?> :</label> + <input name="login" id="login" value="" type="text" /> + </p> + + <p> + <label for="pass"><?php echo _PASSWORD; ?> :</label> + <input name="pass" id="pass" value="" type="password" /> + </p> + <p class="buttons"> + <input type="submit" class="button" name="submit" value="<?php echo _SEND; ?>" /> + </p> + <div class="error"><?php echo $error; + $_SESSION['error'] = ''; + ?> + </div> + </form> + </div> +</body> +</html> diff --git a/maarch_entreprise/trunk/logout.php b/maarch_entreprise/trunk/logout.php new file mode 100644 index 0000000000000000000000000000000000000000..faef8f55e37f6c47418de214fd65ae266f393924 --- /dev/null +++ b/maarch_entreprise/trunk/logout.php @@ -0,0 +1,42 @@ +<?php +/** +* File : deco.php +* +* use this to terminate your session +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_history.php"); + +setcookie("maarch", "",time()-3600000); +$_SESSION['error'] = _NOW_LOGOUT; +if(isset($_GET['abs_mode'])) +{ + $_SESSION['error'] .= ', '._ABS_LOG_OUT; +} + + +if($_SESSION['history']['userlogout'] == "true") +{ + $hist = new history(); + $ip = $_SERVER['REMOTE_ADDR']; + $navigateur = addslashes($_SERVER['HTTP_USER_AGENT']); + $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); + + $hist->add($_SESSION['tablename']['users'],$_SESSION['user']['UserId'],"LOGOUT","IP : ".$ip.", BROWSER : ".$navigateur.", HOST : ".$host, $_SESSION['config']['databasetype']); +} + +$path = $_SESSION['config']['businessappurl']; + +$_SESSION = array(); +header("location: ".$path."login.php?coreurl=".$_GET['coreurl']); +exit(); +?> diff --git a/maarch_entreprise/trunk/maarch_credits.php b/maarch_entreprise/trunk/maarch_credits.php new file mode 100644 index 0000000000000000000000000000000000000000..d46fd073f24a5573637dc1e9d598807b09699e73 --- /dev/null +++ b/maarch_entreprise/trunk/maarch_credits.php @@ -0,0 +1,99 @@ +<?php +/** +* File : maarch_credits.php +* +* Show all contributors for Maarch. +* Thanks a lot for your help!! +* +* @package Maarch FrameWork 3.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Loic Vinet <dev@maarch.org> +*/ + + + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +$core_tools = new core_tools(); + +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=boxes&module=maarch_credits'; +$page_label = _MAARCH_CREDITS; +$page_id = "maarch_credits"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +?> + +<h1><img src="<?php echo $_SESSION['config']['img'];?>/picto_menu_help.gif" alt="" /> <?php echo _MAARCH_CREDITS; ?></h1> +<div id="inner_content" class="clearfix"> + <div class="maarch_credits_left_box" style="height:420px;"> + <h3><?php echo _MAARCH_CREDITS; ?></h3> + <hr/> + <p><em>Copyright © 2008, 2009 Maarch SAS.</em></p> + <p>Maarch Entreprise est diffusé sous les termes de la <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html">licence GNU GPLv3</a></p> + <div> + <ul> + <li>Site officiel : <a href="http://www.maarch.fr">http://www.maarch.fr</a></li> + <li>Communtauté : <a href="http://www.maarch.org">http://www.maarch.org</a></li> + <li>Documentation : <a href="http://www.maarch.org/maarch_wiki">http://www.maarch.org/maarch_wiki</a></li> + </ul> + </div> + <p> </p> + <h3>Composants externes</h3> + <hr/> + <em>Maarch Entreprise s'appuie sur quelques composants externes. Merci à leurs développeurs !</em> + <p> </p> + <ul> + <li><a href="http://www.fpdf.org/">Fpdf</a></li> + <li><a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/">fpdi</a></li> + <li><a href="http://chir.ag/tech/download/pdfb">Pdfb</a></li> + <li><a href="http://www.foolabs.com/xpdf/">Pdftotext</a></li> + <li><a href="http://www.prototypejs.org/">Prototype</a></li> + <li><a href="http://script.aculo.us/">Script.aculo.us</a></li> + <li><a href="http://www.cyber-sandbox.com/">Tabricator</a></li> + <li><a href="http://tafel.developpez.com">Tafel Tree</a></li> + <li><a href="http://framework.zend.com/">Zend Lucene Search</a></li> + </ul> + </div> + + <div class="credits_list block" style="height:420px;"> + + + <h3>Credits</h3> + <p> </p> + <ul> + <li>Bruno CARLIN</li> + <li>Driss DEMIRAY</li> + <li>Mathieu DONZEL</li> + <li>Jean-Louis ERCOLANI</li> + <li>Claire FIGUERAS</li> + <li>Laurent GIOVANNONI</li> + <li>Yves-Christian KPAKPO</li> + <li>Fodé NDIAYE</li> + <li>Cédric NDOUMBA</li> + <li>Serge THIERRY-MIEG</li> + <li>Loic VINET</li> + <li><em>Et toute la communauté Maarch</em></li> + </ul> + <p> </p> + + + <div class="img_credits_maarch_box"><img src="<?php echo $_SESSION['config']['img']; ?>/maarch_box.png"></div> + </div> +</div> +<p style="clear:both"></p> diff --git a/maarch_entreprise/trunk/manage_filter.php b/maarch_entreprise/trunk/manage_filter.php new file mode 100644 index 0000000000000000000000000000000000000000..e0934e7e6cb547724cede340c8de3f5d74dc4087 --- /dev/null +++ b/maarch_entreprise/trunk/manage_filter.php @@ -0,0 +1,376 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +require_once($_SESSION['pathtomodules']."basket".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_manage_status.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR.'class_contacts.php'); + +include_once($_SESSION['config']['businessapppath'].'definition_mail_categories.php'); +$status_obj = new manage_status(); +$security = new security(); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$request = new request(); +$bask = new basket(); +$contact = new contacts(); +//$core_tools->show_array($_REQUEST); +if(!empty($_SESSION['current_basket']['view'])) +{ + $table = $_SESSION['current_basket']['view']; +} +else +{ + $table = $_SESSION['current_basket']['table']; +} +$_SESSION['collection_id_choice'] = $_SESSION['current_basket']['coll_id']; +$select[$table]= array(); +$where = $_SESSION['current_basket']['clause']; +array_push($select[$table],"res_id","status","category_id","category_id as category_img", "priority", "admission_date", "subject", "process_limit_date", "destination", "dest_user", "type_label", "exp_user_id" ); +$order = ''; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +else +{ + $order = 'asc'; +} +$order_field = ''; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $order_field = trim($_REQUEST['order_field']); +} +else +{ + $order_field = 'creation_date'; +} +$list=new list_show(); +$orderstr = $list->define_order($order, $order_field); +$bask->connect(); +$do_actions_arr = array(); +if(!empty($_SESSION['current_basket']['clause'])) +{ + $bask->query("select res_id from ".$table." where ".$_SESSION['current_basket']['clause']." ".$orderstr); +} +else +{ + $bask->query("select res_id from ".$table." ".$orderstr); +} +while($res = $bask->fetch_object()) +{ + $tmp = $bask->check_reserved_time($res->res_id, $_SESSION['current_basket']['coll_id']); + array_push($do_actions_arr, $tmp); +} +$str = ''; +$search = false; +if(trim($_REQUEST['entity_id']) == "none") +{ + $_SESSION['auth_dep']['bask_chosen_entity'] = ""; +} +if(trim($_REQUEST['category_id']) == "none") +{ + $_SESSION['auth_dep']['bask_chosen_category'] = ""; +} +if(trim($_REQUEST['status_id']) == "none") +{ + $_SESSION['auth_dep']['bask_chosen_status'] = ""; +} +if(($_REQUEST['entity_id'] <> "none" && $_REQUEST['entity_id'] <> "")) +{ + $_SESSION['auth_dep']['bask_chosen_entity'] = trim($_REQUEST['entity_id']); +} +if(($_REQUEST['category_id'] <> "none" && $_REQUEST['category_id'] <> "")) +{ + $_SESSION['auth_dep']['bask_chosen_category'] = trim($_REQUEST['category_id']); +} +if(($_REQUEST['status_id'] <> "none" && $_REQUEST['status_id'] <> "")) +{ + $_SESSION['auth_dep']['bask_chosen_status'] = trim($_REQUEST['status_id']); +} +if(trim($_REQUEST['contact_id']) <> "") +{ + $contactTmp = str_replace(')', '', substr($_REQUEST['contact_id'], strrpos($_REQUEST['contact_id'],'(')+1)); + $find1 = strpos($contactTmp, ':'); + $find2 = $find1 + 1; + $contact_type = substr($contactTmp, 0, $find1); + $contact_id = substr($contactTmp, $find2, strlen($contactTmp)); + if($contact_id <> "" && $contact_type <> "") + { + $_SESSION['auth_dep']['bask_chosen_contact'] = trim($_REQUEST['contact_id']); + } +} +elseif($_SESSION['auth_dep']['bask_chosen_contact'] <> "") +{ + $contactTmp = str_replace(')', '', substr($_SESSION['auth_dep']['bask_chosen_contact'], strrpos($_SESSION['auth_dep']['bask_chosen_contact'],'(')+1)); + $find1 = strpos($contactTmp, ':'); + $find2 = $find1 + 1; + $contact_type = substr($contactTmp, 0, $find1); + $contact_id = substr($contactTmp, $find2, strlen($contactTmp)); +} +$where = trim($_SESSION['current_basket']['clause']); +$where = str_replace("and status <> 'VAL'", " ", $where); +$where_concat = $where; +if(isset($_SESSION['auth_dep']['bask_chosen_entity']) && !empty($_SESSION['auth_dep']['bask_chosen_entity'])) +{ + if(!empty($where)) + { + $where_concat = "(".$where.") and destination = '".$bask->protect_string_db($_SESSION['auth_dep']['bask_chosen_entity'])."'"; + } + $search = true; +} +if(isset($_SESSION['auth_dep']['bask_chosen_category']) && !empty($_SESSION['auth_dep']['bask_chosen_category'])) +{ + if(!empty($where)) + { + $where_concat = "(".$where.") and category_id = '".$bask->protect_string_db($_SESSION['auth_dep']['bask_chosen_category'])."'"; + } + $search = true; +} +if(isset($_SESSION['auth_dep']['bask_chosen_contact']) && !empty($_SESSION['auth_dep']['bask_chosen_contact'])) +{ + if($where_concat <> "") + { + if($contact_type == "user") + { + $where_concat .= " and (exp_user_id = '".$contact_id."' or dest_user_id = '".$contact_id."')"; + } + elseif($contact_type == "contact") + { + $where_concat .= " and (exp_contact_id = '".$contact_id."' or dest_contact_id = '".$contact_id."')"; + } + } + else + { + if(!empty($where)) + { + if($contact_type == "user") + { + $where_concat = "(".$where.") and (exp_user_id = '".$contact_id."' or dest_user_id = '".$contact_id."')"; + } + elseif($contact_type == "contact") + { + $where_concat = "(".$where.") and (exp_contact_id = '".$contact_id."' or dest_contact_id = '".$contact_id."')"; + } + } + } + $search = true; +} +if(isset($_SESSION['auth_dep']['bask_chosen_status']) && !empty($_SESSION['auth_dep']['bask_chosen_status'])) +{ + if($where_concat <> "") + { + $where_concat .= " and status = '".$bask->protect_string_db($_SESSION['auth_dep']['bask_chosen_status'])."'"; + } + else + { + if(!empty($where)) + { + $where_concat = "(".$where.") and status = '".$bask->protect_string_db($_SESSION['auth_dep']['bask_chosen_status'])."'"; + } + } + $search = true; +} +$tab=$request->select($select,$where_concat,$orderstr,$_SESSION['config']['databasetype'], '1000'); +//$request->show(); + + //Manage of template list + //################### + + //Defines template allowed for this list + $template_list=array(); + array_push($template_list, array( "name"=>"document_list_extend", "img"=>"extend_list.gif", "label"=> _ACCESS_LIST_EXTEND)); + + if(!$_REQUEST['template']) + { + $template_to_use = $template_list[0]["name"]; + } + if(isset($_REQUEST['template']) && empty($_REQUEST['template'])) + { + $template_to_use = ''; + } + if($_REQUEST['template']) + { + $template_to_use = $_REQUEST['template']; + } + + //For status icon + $extension_icon = ''; + if($template_to_use <> '') + $extension_icon = "_big"; + //################### + + + +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="res_id") + { + $tab[$i][$j]["res_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_GED_NUM; + $tab[$i][$j]["size"]="4"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='res_id'; + $_SESSION['mlb_search_current_res_id'] = $tab[$i][$j]["value"]; + } + if($tab[$i][$j][$value]=="admission_date") + { + $tab[$i][$j]["value"]=$core_tools->format_date_db($tab[$i][$j]["value"], false); + $tab[$i][$j]["label"]=_ADMISSION_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='admission_date'; + } + if($tab[$i][$j][$value]=="process_limit_date") + { + $tab[$i][$j]["value"]=$core_tools->format_date_db($tab[$i][$j]["value"], false); + $compareDate = ""; + if($tab[$i][$j]["value"] <> "" && ($statusCmp == "NEW" || $statusCmp == "COU" || $statusCmp == "VAL" || $statusCmp == "RET")) + { + $compareDate = $core_tools->compare_date($tab[$i][$j]["value"], date("d-m-Y")); + if($compareDate == "date2") + { + $tab[$i][$j]["value"] = "<span style='color:red;'><b>".$tab[$i][$j]["value"]."<br><small>(".$core_tools->nbDaysBetween2Dates($tab[$i][$j]["value"], date("d-m-Y"))." "._DAYS.")<small></b></span>"; + } + elseif($compareDate == "date1") + { + $tab[$i][$j]["value"] = $tab[$i][$j]["value"]."<br><small>(".$core_tools->nbDaysBetween2Dates(date("d-m-Y"), $tab[$i][$j]["value"])." "._DAYS.")<small>"; + } + elseif($compareDate == "equal") + { + $tab[$i][$j]["value"] = "<span style='color:blue;'><b>".$tab[$i][$j]["value"]."<br><small>("._LAST_DAY.")<small></b></span>"; + } + } + $tab[$i][$j]["label"]=_PROCESS_LIMIT_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='process_limit_date'; + } + if($tab[$i][$j][$value]=="category_id") + { + $_SESSION['mlb_search_current_category_id'] = $tab[$i][$j]["value"]; + $tab[$i][$j]["value"] = $_SESSION['mail_categories'][$tab[$i][$j]["value"]]; + $tab[$i][$j]["label"]=_CATEGORY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='category_id'; + //echo "table : ".$table." res_id : ".$_SESSION['mlb_search_current_res_id']." categorie : ".$_SESSION['mlb_search_current_category_id']."<br>"; + } + if($tab[$i][$j][$value]=="priority") + { + $tab[$i][$j]["value"] = $_SESSION['mail_priorities'][$tab[$i][$j]["value"]]; + $tab[$i][$j]["label"]=_PRIORITY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='priority'; + } + if($tab[$i][$j][$value]=="subject") + { + $tab[$i][$j]["value"] = $request->show_string($tab[$i][$j]["value"]); + $tab[$i][$j]["label"]=_SUBJECT; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="right"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='subject'; + } + if($tab[$i][$j][$value]=="type_label") + { + $tab[$i][$j]["value"] = $request->show_string($tab[$i][$j]["value"]); + $tab[$i][$j]["label"]=_TYPE; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="right"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='type_label'; + } + if($tab[$i][$j][$value]=="status") + { + $res_status = $status_obj->get_status_data($tab[$i][$j]['value'],$extension_icon); + $statusCmp = $tab[$i][$j]['value']; + $tab[$i][$j]['value'] = "<img src = '".$res_status['IMG_SRC']."' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'>"; + $tab[$i][$j]["label"]=_STATUS; + $tab[$i][$j]["size"]="4"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='status'; + } + if($tab[$i][$j][$value]=="exp_user_id") + { + $tab[$i][$j]["label"]=_CONTACT; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["value"] = $contact->get_contact_information($_SESSION['mlb_search_current_res_id'],$_SESSION['mlb_search_current_category_id'],$table); + $tab[$i][$j]["order"]=false; + } + if($tab[$i][$j][$value]=="category_img") + { + $tab[$i][$j]["label"]=_CATEGORY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $my_imgcat = get_img_cat($tab[$i][$j]['value'],$extension_icon); + $tab[$i][$j]['value'] = "<img src = '".$my_imgcat."' alt = '' title = ''>"; + $tab[$i][$j]["value"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="category_id"; + } + } + } +} +if(count($tab) > 0) +{ + + + + $i = count($tab); + $title = _RESULTS." : ".$i." "._FOUND_DOCS; + $_SESSION['origin'] = 'basket'; + $_SESSION['collection_id_choice'] = $_SESSION['current_basket']['coll_id']; + //$tmp = preg_replace('/.php$/', '', $security->get_script_from_coll($_SESSION['current_basket']['coll_id'], 'script_details')); + //$details = $tmp.'&dir=indexing_searching'; + $details = 'details&dir=indexing_searching'; + //$param_list = array('values' => $tab, 'title' => $title, 'key' => 'res_id', 'page_name' => 'documents_list', + $param_list = array('values' => $tab, 'title' => $title, 'key' => 'res_id', 'page_name' => 'view_baskets&module=basket&baskets='.$_SESSION['current_basket']['id'] , + 'what' => 'res_id', 'detail_destination' =>$details, 'details_page' => '', 'view_doc' => true, 'bool_details' => true, 'bool_order' => true, + 'bool_frame' => false, 'module' => '', 'css' => 'listing spec', + 'hidden_fields' => '<input type="hidden" name="module" id="module" value="basket" /><input type="hidden" name="table" id="table" value="'.$_SESSION['current_basket']['table'].'"/> + <input type="hidden" name="coll_id" id="coll_id" value="'.$_SESSION['current_basket']['coll_id'].'"/>', 'open_details_popup' => false, 'do_actions_arr' => $do_actions_arr, 'template' => true, + 'template_list'=> $template_list, 'actual_template'=>$template_to_use, 'bool_export'=>true ); + $bask->basket_list_doc($param_list, $_SESSION['current_basket']['actions'], _CLICK_LINE_TO_PROCESS); +} +?> diff --git a/maarch_entreprise/trunk/my_contacts/contact_list_by_name.php b/maarch_entreprise/trunk/my_contacts/contact_list_by_name.php new file mode 100644 index 0000000000000000000000000000000000000000..3f3bc373b7ee3b00820da26bd61410222cc39736 --- /dev/null +++ b/maarch_entreprise/trunk/my_contacts/contact_list_by_name.php @@ -0,0 +1,70 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief List of users for autocompletion +* +* +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +$db = new dbquery(); +$db->connect(); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $db->query("select lastname as tag from ".$_SESSION['tablename']['contacts']." where lastname ilike '".$_REQUEST['what']."%' and user_id = '".$_SESSION['user']['UserId']."' order by lastname"); +} +else +{ + $db->query("select lastname as tag from ".$_SESSION['tablename']['contacts']." where lastname like '".$_REQUEST['what']."%' and user_id = '".$_SESSION['user']['UserId']."' order by lastname"); +} +$listArray = array(); +while($line = $db->fetch_object()) +{ + array_push($listArray, $line->tag); +} +echo "<ul>\n"; +$authViewList = 0; +foreach($listArray as $what) +{ + if($authViewList >= 10) + { + $flagAuthView = true; + } + if(stripos($what, $_REQUEST['what']) === 0) + { + echo "<li>".$what."</li>\n"; + if($flagAuthView) + { + echo "<li>...</li>\n"; + break; + } + $authViewList++; + } +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/my_contacts/my_contact_add.php b/maarch_entreprise/trunk/my_contacts/my_contact_add.php new file mode 100644 index 0000000000000000000000000000000000000000..41704861e033fa98a88810aa69a1b82ae9d384f5 --- /dev/null +++ b/maarch_entreprise/trunk/my_contacts/my_contact_add.php @@ -0,0 +1,41 @@ +<?php +/** +* File : my_contact_add.php +* +* Add contact form +* +* @package Maarch LetterBox 2.3 +* @version 2.0 +* @since 10/2007 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); + +$core_tools2 = new core_tools(); +//here we loading the lang vars +$core_tools2->load_lang(); +$core_tools2->test_service('my_contacts', 'apps'); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=my_contact_add&dir=my_contacts'; +$page_label = _ADDITION; +$page_id = "my_contact_add"; +$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_contacts.php"); + +$contact = new contacts(); +$contact->formcontact("add", '', false); +?> diff --git a/maarch_entreprise/trunk/my_contacts/my_contact_del.php b/maarch_entreprise/trunk/my_contacts/my_contact_del.php new file mode 100644 index 0000000000000000000000000000000000000000..5ed8878446c7b0053ae496ed5e3d152612f7d764 --- /dev/null +++ b/maarch_entreprise/trunk/my_contacts/my_contact_del.php @@ -0,0 +1,40 @@ +<?php +/** +* File : my_contact_del.php +* +* Delete contact +* +* @package Maarch LetterBox 2.3 +* @version 1.0 +* @since 10/2007 +* @license GPL +* @author Loic Vinet <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_service('my_contacts', 'apps'); +require_once($_SESSION['pathtocoreclass']."class_db.php"); + +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_contacts.php"); + + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $s_id = addslashes($func->wash($_GET['id'], "alphanum", _THE_CONTACT)); +} +else +{ + $s_id = ""; +} + +$contact = new contacts(); +$contact->delcontact($s_id, false); +?> diff --git a/maarch_entreprise/trunk/my_contacts/my_contact_up.php b/maarch_entreprise/trunk/my_contacts/my_contact_up.php new file mode 100644 index 0000000000000000000000000000000000000000..c4956f455531e2b18626ffb83e888cabea8ac3f3 --- /dev/null +++ b/maarch_entreprise/trunk/my_contacts/my_contact_up.php @@ -0,0 +1,56 @@ +<?php +/** +* File : my_contact_up.php +* +* Form to modify a contact +* +* @package Maarch LetterBox 2.3 +* @version 2.0 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_service('my_contacts', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_contacts.php"); + +$func = new functions(); + +if(isset($_GET['id'])) +{ + $id = addslashes($func->wash($_GET['id'], "alphanum", _THE_CONTACT)); +} +else +{ + $id = ""; +} + /****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=my_contact_up&dir=my_contacts'; +$page_label = _MODIFICATION; +$page_id = "my_contact_up"; +$core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + + +$contact = new contacts(); +$contact->formcontact("up",$id, false); +?> diff --git a/maarch_entreprise/trunk/my_contacts/my_contact_up_db.php b/maarch_entreprise/trunk/my_contacts/my_contact_up_db.php new file mode 100644 index 0000000000000000000000000000000000000000..3144bce842adad143028adbbe1e3a5f9dcb4472b --- /dev/null +++ b/maarch_entreprise/trunk/my_contacts/my_contact_up_db.php @@ -0,0 +1,29 @@ +<?php +/** +* File : my_contact_up_db.php +* +* Modify the contact in the database after the form +* +* @package Maarch LetterBox 2.3 +* @version 2.0 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +//here we loading the lang vars +$core_tools->load_lang(); +$core_tools->test_service('my_contacts', 'apps'); + +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_contacts.php"); + +$contact = new contacts(); +$contact->addupcontact($_POST['mode'], false); +?> diff --git a/maarch_entreprise/trunk/my_contacts/my_contacts.php b/maarch_entreprise/trunk/my_contacts/my_contacts.php new file mode 100644 index 0000000000000000000000000000000000000000..f47b2e077e93c288c50db77f1df1dfee1350e024 --- /dev/null +++ b/maarch_entreprise/trunk/my_contacts/my_contacts.php @@ -0,0 +1,140 @@ +<? +/** +* File : my_contacts.php +* +* contacts list of the current user +* +* @package Maarch LetterBox 2.3 +* @version 2.5 +* @since 06/2007 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +$admin = new core_tools(); +$admin->test_service('my_contacts', 'apps'); +$func = new functions(); +/****************Management of the location bar ************/ +$init = false; +if($_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=my_contacts&dir=my_contacts'; +$page_label = _CONTACTS_LIST; +$page_id = "my_contacts"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$select[$_SESSION['tablename']['contacts']] = array(); +array_push($select[$_SESSION['tablename']['contacts']],"contact_id", "society","lastname","firstname"); +$what = ""; +$where =" user_id = '".$_SESSION['user']['UserId']."' and enabled = 'Y' "; +if(isset($_REQUEST['what'])) +{ + $what = $func->protect_string_db($func->wash($_REQUEST['what'], "alphanum", "", "no")); + if($_SESSION['config']['databasetype'] == "POSTGRESQL") + { + $where .= " and (lastname ilike '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' or society ilike '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' ) "; + } + else + { + $where .= " and (lastname like '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' or society like '".$func->protect_string_db($what,$_SESSION['config']['databasetype'])."%' ) "; + } +} +$orderby = "order by lastname, society asc"; +$request= new request; +$tab=$request->select($select,$where,$orderby,$_SESSION['config']['databasetype']); +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="contact_id") + { + $tab[$i][$j]["contact_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="18"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "contact_id"; + } + if($tab[$i][$j][$value]=="society") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["society"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_SOCIETY; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "society"; + } + if($tab[$i][$j][$value]=="lastname") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["lastname"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_LASTNAME; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "lastname"; + } + if($tab[$i][$j][$value]=="firstname") + { + $tab[$i][$j]["firstname"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_FIRSTNAME; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="center"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]= "firstname"; + } + } + } +} +$page_name = "my_contacts"; +$page_name_up = "my_contact_up"; +$page_name_del = "my_contact_del"; +$page_name_val= ""; +$page_name_ban = ""; +$page_name_add = "my_contact_add"; +$label_add = _CONTACT_ADDITION; +$_SESSION['m_admin']['init'] = true; +$title = _CONTACTS_LIST." : ".$i." "._CONTACTS; +$list = new list_show(); +$autoCompletionArray = array(); +$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."my_contacts/contact_list_by_name.php"; +$autoCompletionArray["number_to_begin"] = 1; +$list->admin_list($tab, $i, $title, 'contact_id','my_contacts','my_contacts','contact_id', false, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_CONTACTS, _CONTACT, $_SESSION['config']['img'].'/manage_contact_b.gif', false, true, false, true, $what, true, $autoCompletionArray, true); +//($result, $nb_total, $title, $expr, $name, $admin, $key, $bool_order, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, $bool_history = false, $bool_simple_list = false, $all_sentence='', $whatname='', $picto_path ='', $is_part_of_module = false, $show_big_title = true, $flag_not_admin = false, $show_listletters = true, $what ="", $autoCompletion = false, $autoCompletionArray = array(), $is_in_apps_dir = false) +$_SESSION['m_admin']['contacts'] = array(); +$_SESSION['m_admin']['contacts']['id'] = ""; +$_SESSION['m_admin']['contacts']['title'] = ""; +$_SESSION['m_admin']['contacts']['lastname'] = ""; +$_SESSION['m_admin']['contacts']['firtsname'] = ""; +$_SESSION['m_admin']['contacts']['society'] = ""; +$_SESSION['m_admin']['contacts']['function'] = ""; +$_SESSION['m_admin']['contacts']['address_num'] = ""; +$_SESSION['m_admin']['contacts']['address_street'] = ""; +$_SESSION['m_admin']['contacts']['address_complement'] = ""; +$_SESSION['m_admin']['contacts']['address_town'] = ""; +$_SESSION['m_admin']['contacts']['address_postal_code'] = ""; +$_SESSION['m_admin']['contacts']['address_country'] = ""; +$_SESSION['m_admin']['contacts']['email'] = ""; +$_SESSION['m_admin']['contacts']['phone'] = ""; +$_SESSION['m_admin']['contacts']['other_data'] = ""; +$_SESSION['m_admin']['contacts']['is_corporate_person'] = ""; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/no_right.php b/maarch_entreprise/trunk/no_right.php new file mode 100644 index 0000000000000000000000000000000000000000..6f428e6c6c8a5c26632ff1ff7fb49554b4f39744 --- /dev/null +++ b/maarch_entreprise/trunk/no_right.php @@ -0,0 +1,26 @@ +<?php +/** +* File : no_right.php +* +* Default error of right page +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/; +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); + +unset($_SESSION['location_bar']['level2']); +unset($_SESSION['location_bar']['level3']); +unset($_SESSION['location_bar']['level4']); +$core_tools->manage_location_bar(); +?> +<h1><img src="<?php echo $_SESSION['config']['img'];?>/picto_welcome_b.gif" alt="" /><?php echo _NO_RIGHT;?></h1> +<div id="inner_content" class="clearfix"> +<br/><br/> +<div class="error"><?php echo _NO_RIGHT_TXT;?></div> +</div> diff --git a/maarch_entreprise/trunk/param_mlb_doctypes.php b/maarch_entreprise/trunk/param_mlb_doctypes.php new file mode 100644 index 0000000000000000000000000000000000000000..f66cb8c68e0c7b480a8725c46eceff0d303efd6d --- /dev/null +++ b/maarch_entreprise/trunk/param_mlb_doctypes.php @@ -0,0 +1,98 @@ +<? +session_name('PeopleBox'); +session_start(); + +if($_SESSION['service_tag'] == 'doctype_up') +{ + require_once($_SESSION['pathtocoreclass']."class_db.php"); + $db = new dbquery(); + $db->connect(); + $db->query("select * from ".$_SESSION['tablename']['mlb_doctype_ext']." where type_id = ".$_SESSION['m_admin']['doctypes']['TYPE_ID'].""); + //$db->show(); + if($db->nb_result() == 0) + { + $_SESSION['m_admin']['doctypes']['process_delay'] = 21; + $_SESSION['m_admin']['doctypes']['delay1'] = 14; + $_SESSION['m_admin']['doctypes']['delay2'] = 1; + } + else + { + $line = $db->fetch_object(); + $_SESSION['m_admin']['doctypes']['process_delay'] = $line->process_delay; + $_SESSION['m_admin']['doctypes']['delay1'] = $line->delay1; + $_SESSION['m_admin']['doctypes']['delay2'] = $line->delay2; + } +} +elseif($_SESSION['service_tag'] == 'doctype_add') +{ + $_SESSION['m_admin']['doctypes']['process_delay'] = 21; + $_SESSION['m_admin']['doctypes']['delay1'] = 14; + $_SESSION['m_admin']['doctypes']['delay2'] = 1; + +} +elseif($_SESSION['service_tag'] == 'frm_doctype') +{ + $func = new functions(); + ?> + <p> + <label for="label"><? echo _PROCESS_DELAY; ?> : </label> + <input name="process_delay" type="text" class="textbox" id="label" maxlength="2" value="<? echo $func->show($_SESSION['m_admin']['doctypes']['process_delay']); ?>"/> + </p> + <p> + <label for="label"><? echo _ALARM1_DELAY; ?> : </label> + <input name="delay1" type="text" class="textbox" id="label" maxlength="2" value="<? echo $func->show($_SESSION['m_admin']['doctypes']['delay1']); ?>"/> + </p> + <p> + <label for="label"><? echo _ALARM2_DELAY; ?> : </label> + <input name="delay2" type="text" class="textbox" id="label" maxlength="2" value="<? echo $func->show($_SESSION['m_admin']['doctypes']['delay2']); ?>"/> + </p> + <? +} +elseif($_SESSION['service_tag'] == "doctype_info") +{ + $func = new functions(); + if(isset($_REQUEST['process_delay']) && $_REQUEST['process_delay'] >= 0) + { + $_SESSION['m_admin']['doctypes']['process_delay'] = $func->wash($_REQUEST['process_delay'], "num", _TREATMENT_DELAY); + } + if(isset($_REQUEST['delay1']) && $_REQUEST['delay1'] >= 0) + { + $_SESSION['m_admin']['doctypes']['delay1'] = $func->wash($_REQUEST['delay1'], "num", _ALERT_DELAY_1); + } + if(isset($_REQUEST['delay2']) && $_REQUEST['delay2'] >= 0) + { + $_SESSION['m_admin']['doctypes']['delay2'] = $func->wash($_REQUEST['delay2'], "num", _ALERT_DELAY_2); + } +} +elseif($_SESSION['service_tag'] == "doctype_updatedb") +{ + require_once($_SESSION['pathtocoreclass']."class_db.php"); + $db = new dbquery(); + $db->connect(); + + $db->query("select type_id from ".$_SESSION['tablename']['mlb_doctype_ext']." where type_id = ".$_SESSION['m_admin']['doctypes']['TYPE_ID']); + if($db->nb_result() > 0) + { + $db->query("update ".$_SESSION['tablename']['mlb_doctype_ext']." set process_delay = ".$_SESSION['m_admin']['doctypes']['process_delay'].", delay1 = ".$_SESSION['m_admin']['doctypes']['delay1'].", delay2 = ".$_SESSION['m_admin']['doctypes']['delay2']." where type_id = '".$_SESSION['m_admin']['doctypes']['TYPE_ID']."'"); + } + else + { + $db->query("insert into ".$_SESSION['tablename']['mlb_doctype_ext']." (type_id, process_delay, delay1, delay2) values (".$_SESSION['m_admin']['doctypes']['TYPE_ID'].", ".$_SESSION['m_admin']['doctypes']['process_delay'].", ".$_SESSION['m_admin']['doctypes']['delay1'].", ".$_SESSION['m_admin']['doctypes']['delay2'].")"); + } + +} +elseif($_SESSION['service_tag'] == "doctype_insertdb") +{ + require_once($_SESSION['pathtocoreclass']."class_db.php"); + $db = new dbquery(); + $db->connect(); + $db->query("insert into ".$_SESSION['tablename']['mlb_doctype_ext']." (type_id, process_delay, delay1, delay2) values (".$_SESSION['m_admin']['doctypes']['TYPE_ID'].", ".$_SESSION['m_admin']['doctypes']['process_delay'].", ".$_SESSION['m_admin']['doctypes']['delay1'].", ".$_SESSION['m_admin']['doctypes']['delay2'].")"); +} +elseif($_SESSION['service_tag'] == "doctype_delete") +{ + require_once($_SESSION['pathtocoreclass']."class_db.php"); + $db = new dbquery(); + $db->connect(); + $db->query("delete from ".$_SESSION['tablename']['mlb_doctype_ext']." where type_id = ".$_SESSION['m_admin']['doctypes']['TYPE_ID'].""); +} +?> diff --git a/maarch_entreprise/trunk/quicklaunch.php b/maarch_entreprise/trunk/quicklaunch.php new file mode 100644 index 0000000000000000000000000000000000000000..affd85f26edbb782d733cbb510bb04862b1b43e5 --- /dev/null +++ b/maarch_entreprise/trunk/quicklaunch.php @@ -0,0 +1,84 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* +* @brief Access to the baskets +* +* +* @file +* @author Loic Vinet <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup basket +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +$core_tools->test_service('quicklaunch', "apps"); +?> +<div id="welcome_box_left_quick_lunch" > + <div class="block"> + <h2><?php echo _QUICKLAUNCH; ?> : </h2> + </div> + <div class="blank_space"> </div> + <table align="center"> + <tr > + <?php + $nb_max = 0; + $menu_array = $_SESSION['menu']; + foreach($menu_array as $element) + { + if($nb_max < 3) + { + if($element['id'] == 'physical_archive' && $element['show'] == true) + { + echo '<td><a href="index.php?page=boxes&module=physical_archive&reinit=true"><div class="bighome_physical_archive"><div class="label_for_bighome_physical_archive">'._PHYSICAL_ARCHIVE.'</div></div></a></td>'; + $nb_max++; + } + if ($element['id'] == 'adv_search_mlb' && $element['show'] == true) + { + echo '<td><a href="index.php?page=search_adv&dir=indexing_searching&reinit=true"><div class="bighome_search_adv"><div class="label_for_bighome_search_adv">'._ADV_SEARCH_TITLE.'</div></div></a></td>'; + $nb_max++; + } + if ($element['id'] == 'index_mlb' && $element['show'] == true ) + { + echo '<td><a href="index.php?page=view_baskets&module=basket&baskets=IndexingBasket"><div class="bighome_indexing"><div class="label_for_bighome_indexing">'._INDEXING_MLB.'</div></div></a></td>'; + $nb_max++; + } + } + } + + if ($nb_max <3) + { + ?> + <td><a href="index.php?page=modify_user&admin=users&reinit=true"><div class="bighome_userinfo"><div class="label_for_bighome_userinfo"><?php echo _MY_INFO; ?></div></div></a> </td> + <?php + } + ?> + </tr> + </table> + <div class="blank_space"> </div> +</div> diff --git a/maarch_entreprise/trunk/redirect_to_action.php b/maarch_entreprise/trunk/redirect_to_action.php new file mode 100644 index 0000000000000000000000000000000000000000..da756b5f7337051683dc2679244cba66856fa1c5 --- /dev/null +++ b/maarch_entreprise/trunk/redirect_to_action.php @@ -0,0 +1,47 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +$security = new security(); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$core_tools->load_html(); +$core_tools->load_header(); +require_once($_SESSION['pathtomodules']."basket".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); + +$bask = new basket(); +if(!empty($_REQUEST['id'])) +{ + $bask->load_current_basket(trim($_REQUEST['id']), 'frame'); +} +$actions_json = $bask->translates_actions_to_json($_SESSION['current_basket']['actions']); +?> +<body> +<script type="text/javascript"> + + var arr_actions = <?php echo $actions_json;?>; + //alert(arr_actions); + var arr_msg_error = {'confirm_title' : '<?php echo addslashes(_ACTION_CONFIRM);?>', + 'validate' : '<?php echo addslashes(_VALIDATE);?>', + 'cancel' : '<?php echo addslashes(_CANCEL);?>', + 'choose_action' : '<?php echo addslashes(_CHOOSE_ACTION);?>', + 'choose_one_doc' : '<?php echo addslashes(_CHOOSE_ONE_DOC);?>' + }; + + var val = 'none'; + var action_id = '<?php echo $_SESSION['current_basket']['default_action'];?>'; + var table = '<?php echo $_SESSION['current_basket']['table'];?>'; + var coll_id = '<?php echo $_SESSION['current_basket']['coll_id'];?>'; + var module = 'apps'; + var mode = 'page'; + var val_frm = {'values' : val, 'action_id' : action_id, 'table' : table, 'coll_id' : coll_id, 'module' : module} + //alert(val_frm); + action_send_first_request('<?php echo $_SESSION['urltocore'];?>manage_action.php', mode, val_frm['action_id'], val_frm['values'], val_frm['table'], val_frm['module'], val_frm['coll_id']); +// alert('apres_action_send'); + +</script> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/reopen.php b/maarch_entreprise/trunk/reopen.php new file mode 100644 index 0000000000000000000000000000000000000000..b54c56653b9b49bd2c9d71695dc22c6795885bad --- /dev/null +++ b/maarch_entreprise/trunk/reopen.php @@ -0,0 +1,68 @@ +<?php +/** +* File : reopen.php +* +* Identification with cookie +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +/*if( strtoupper(substr(PHP_OS, 0, 3)) != "WIN") +{ + $_SESSION['slash_env'] = "/"; +} +else +{ + $_SESSION['slash_env'] = "\\"; +}*/ +$_SESSION['slash_env'] = DIRECTORY_SEPARATOR; + +$path_tmp = explode('/',$_SERVER['SCRIPT_FILENAME']); +$path_server = implode('/',array_slice($path_tmp,0,array_search('apps',$path_tmp))).'/'; + +$_SESSION['pathtocore'] = $path_server."core".$_SESSION['slash_env']; +$_SESSION['pathtocoreclass'] = $path_server."core".$_SESSION['slash_env']."class".$_SESSION['slash_env']; +$_SESSION['pathtomodules'] = $path_server."modules".$_SESSION['slash_env']; + +$_SESSION['urltomodules'] = $_SESSION['config']['coreurl']."/modules/"; +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once("class/class_business_app_tools.php"); +$core_tools = new core_tools(); +$business_app_tools = new business_app_tools(); +$func = new functions(); +$cookie = explode("&",$_COOKIE['maarch']); +$user = explode("=",$cookie[0]); +$thekey = explode("=",$cookie[1]); +$s_UserId = strtolower($func->wash($user[1],"no","","yes")); +$s_key =strtolower($func->wash($thekey[1],"no","","yes")); +if(!empty($_SESSION['error']) || ($s_UserId == "1" && $s_key == "")) +{ + header("location: ".$_SESSION['config']['businessappurl']."login.php?coreurl=".$_SESSION['config']['coreurl']); + exit(); +} +else +{ + if(trim($_SERVER['argv'][0]) <> "") + { + header("location: ".$_SESSION['config']['businessappurl']."login.php?coreurl=".$_SESSION['config']['coreurl']."&".$_SERVER['argv'][0]); + } + else + { + header("location: ".$_SESSION['config']['businessappurl']."login.php?coreurl=".$_SESSION['config']['coreurl']); + } + exit(); + /*$pass = md5($s_pass); + require($_SESSION['pathtocoreclass']."class_security.php"); + $sec = new security(); + //$sec->show_array($_SESSION); + //$sec->build_config(); + $sec->reopen($s_UserId,$s_key);*/ +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/reports/get_report_by_period_val.php b/maarch_entreprise/trunk/reports/get_report_by_period_val.php new file mode 100644 index 0000000000000000000000000000000000000000..325ba82ff0ac3dc30e43da8bb561b4a7cb034b6a --- /dev/null +++ b/maarch_entreprise/trunk/reports/get_report_by_period_val.php @@ -0,0 +1,407 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_security.php"); +require_once($_SESSION['pathtocoreclass']."class_manage_status.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once($_SESSION['pathtomodules'].'reports'.DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_graphics.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$db = new dbquery(); +$db->connect(); +$db2 = new dbquery(); +$db2->connect(); +$req = new request(); +$list = new list_show(); +$graph = new graphics(); +$sec = new security(); +$status_obj = new manage_status(); +$ind_coll = $sec->get_ind_collection('letterbox_coll'); +$table = $_SESSION['collections'][$ind_coll]['table']; +$view = $_SESSION['collections'][$ind_coll]['view']; +$search_status = $status_obj->get_searchable_status(); + +$id_report = $_REQUEST['id_report']; +if(empty($id_report)) +{ + ?> + <div class="error"><?php echo _REPORT.' '._UNKNOWN;?></div> + <?php + exit(); +} + +$report_type = $_REQUEST['report_type']; +if(empty($report_type)) +{ + ?> + <div class="error"><?php echo _ERROR_REPORT_TYPE;?></div> + <?php + exit(); +} + +$period_type = $_REQUEST['period_type']; +if(empty($period_type)) +{ + ?> + <div class="error"><?php echo _ERROR_PERIOD_TYPE;?></div> + <?php + exit(); +} +$default_year = date('Y'); +$where_date = ''; +$date_title = ''; + +$str_status = '('; +for($i=0;$i<count($search_status);$i++) +{ + $str_status .= "'".$search_status[$i]['ID']."',"; +} +$str_status = preg_replace('/,$/', ')', $str_status); + +if($period_type == 'period_year') +{ + if(empty($_REQUEST['the_year']) || !isset($_REQUEST['the_year'])) + { + ?> + <div class="error"><?php echo _YEAR.' '._MISSING;?></div> + <?php + exit(); + } + if( !preg_match('/^[1-2](0|9)[0-9][0-9]$/', $_REQUEST['the_year'])) + { + ?> + <div class="error"><?php echo _YEAR.' '._WRONG_FORMAT;?></div> + <?php + exit(); + } + $where_date = $req->extract_date('creation_date', 'year')." = '".$_REQUEST['the_year']."'"; + $date_title = _FOR_YEAR.' '.$_REQUEST['the_year']; +} +else if($period_type == 'period_month') +{ + $arr_month = array('01','02','03','04','05','06','07','08','09','10','11','12'); + if(empty($_REQUEST['the_month']) || !isset($_REQUEST['the_month'])) + { + ?> + <div class="error"><?php echo _MONTH.' '._MISSING;?></div> + <?php + exit(); + } + if( !in_array($_REQUEST['the_month'], $arr_month)) + { + ?> + <div class="error"><?php echo _MONTH.' '._WRONG_FORMAT;?></div> + <?php + exit(); + } + $where_date = $req->extract_date('creation_date', 'year')." = '".$default_year."' and ".$req->extract_date('creation_date', 'month')." = '".$_REQUEST['the_month']."'"; + $month = ''; + switch($_REQUEST['the_month']) + { + case '01': + $month = _JANUARY; + break; + case '02': + $month = _FEBRUARY; + break; + case '03': + $month = _MARCH; + break; + case '04': + $month = _APRIL; + break; + case '05': + $month = _MAY; + break; + case '06': + $month = _JUNE; + break; + case '07': + $month = _JULY; + break; + case '08': + $month = _AUGUST; + break; + case '09': + $month = _SEPTEMBER; + break; + case '10': + $month = _OCTOBER; + break; + case '11': + $month = _NOVEMBER; + case '12': + $month = _DECEMBER; + break; + default: + $month = ''; + } + $date_title = _FOR_MONTH.' '.$month; +} +else if($period_type == 'custom_period') +{ + if(isset($_REQUEST['date_start']) && $_REQUEST['date_start'] <> '') + { + $where_date .= " AND ".$req->extract_date('creation_date')." > '".$db->format_date_db($_REQUEST['date_start'])."'"; + $date_title .= strtolower(_SINCE).' '.$_REQUEST['date_start'].' '; + } + + if(isset($_REQUEST['date_fin']) && $_REQUEST['date_fin'] <> '') + { + $where_date .= " AND ".$req->extract_date('creation_date')." < '".$db->format_date_db($_REQUEST['date_fin'])."'"; + $date_title.= strtolower(_FOR).' '.$_REQUEST['date_fin'].' '; + } + if(empty($where_date)) + { + $where_date = $req->extract_date('creation_date', 'year')." = '".$default_year."'"; + $date_title = _FOR_YEAR.' '.$default_year; + } +} +else +{ + ?> + <div class="error"><?php echo _PERIOD.' '._MISSING;?></div> + <?php + exit(); +} + +$where_date = preg_replace('/^ AND/', '', $where_date); +//echo $where_date ; + +if($id_report == 'process_delay') +{ + $db->query("select type_id, description from ".$_SESSION['tablename']['doctypes']." where enabled = 'Y' order by description"); + $doctypes = array(); + while($res = $db->fetch_object()) + { + array_push($doctypes, array('ID' => $res->type_id, 'LABEL' => $res->description)); + } + + if($report_type == 'graph') + { + $val_an = array(); + $_SESSION['labels1'] = array(); + } + elseif($report_type == 'array') + { + $data = array(); + } + $has_data = false; + + for($i=0; $i<count($doctypes);$i++) + { + $db->query("SELECT ".$req->get_date_diff('closing_date', 'creation_date' )." AS delay FROM ".$view." WHERE ".$where_date." AND status in ".$str_status." and type_id = ".$doctypes[$i]['ID'].""); + + if( $db->nb_result() > 0) + { + $tmp = 0; + while($res = $db->fetch_object()) + { + $tmp = $tmp + $res->delay; + } + if($report_type == 'graph') + { + array_push($val_an, (string)$tmp / $db->nb_result()); + } + elseif($report_type == 'array') + { + array_push($data, array('LABEL' => $db->show_string($doctypes[$i]['LABEL']), 'VALUE' => (string)$tmp / $db->nb_result())); + } + if($tmp / $db->nb_result() > 0) + { + $has_data = true; + } + } + else + { + if($report_type == 'graph') + { + array_push($val_an, 0); + } + elseif($report_type == 'array') + { + array_push($data, array('LABEL' => $db->show_string($doctypes[$i]['LABEL']), 'VALUE' => _UNDEFINED)); + } + } + if($report_type == 'graph') + { + array_push($_SESSION['labels1'], $db->show_string($doctypes[$i]['LABEL'])); + } + } + + if($report_type == 'graph') + { + $src1 = $_SESSION['urltomodules']."reports/graphs.php?type=histo&largeur=1000&hauteur=400&title=".$title."&labelX="._MONTH."&labelY="._N_DAYS; + for($i=0;$i<count($_SESSION['labels1']);$i++) + { + $src1 .= "&labels[]=".$_SESSION['labels1'][$i]; + } + for($i=0;$i<count($val_an);$i++) + { + $src1 .= "&values[]=".$val_an[$i]; + } + } + elseif($report_type == 'array') + { + array_unshift($data, array('LABEL' => _DOCTYPE, 'VALUE' => _PROCESS_DELAY)); + } + + if ( $has_data) + { + if($report_type == 'graph') + { + ?> + <img src="<? echo $src1;?>" alt="<? echo $title;?>"/><? + } + elseif($report_type == 'array') + { + $graph->show_stats_array($title, $data); + } + } + else + { + echo '<br/><br/><div class="error">'._NO_DATA_MESSAGE.'</div>'; + } + +} +else if($id_report == 'mail_typology') +{ + $has_data = false; + $title = _MAIL_TYPOLOGY_REPORT.' '.$date_title ; + $db->query("select distinct type_id, type_label from ".$view ." where status in ".$str_status." and ".$where_date); + //$db->show(); + if($report_type == 'graph') + { + $vol_an = array(); + $vol_mois = array(); + $_SESSION['labels1'] = array(); + } + elseif($report_type == 'array') + { + $data = array(); + + } + while($line = $db->fetch_object()) + { + $db2->query("select count(*) as total from ".$view." where status in ".$str_status." and ".$where_date." and type_id = ".$line->type_id.""); + $res = $db2->fetch_object(); + if($report_type == 'graph') + { + array_push($_SESSION['labels1'], (string) $line->type_label); + array_push($vol_an, $res->total); + } + elseif($report_type == 'array') + { + array_push($data, array('LABEL' =>$line->type_label, 'VALUE' => $res->total )); + } + + if($res->total > 0) + { + $has_data = true; + } + } + + if($report_type == 'graph') + { + $src1 = $_SESSION['urltomodules']."reports/graphs.php?type=pie&largeur=1000&hauteur=300&title=".$title; + + for($i=0;$i<count($vol_an);$i++) + { + $src1 .= "&values[]=".$vol_an[$i]; + } + } + elseif($report_type == 'array') + { + array_unshift($data, array('LABEL' => _DOCTYPE, 'VALUE' => _NB_MAILS1)); + } + //echo $src1; + if($has_data) + { + if($report_type == 'graph') + { + ?> + <img src="<? echo $src1;?>" alt=""/><br/><br/> + <? + } + elseif($report_type == 'array') + { + $graph->show_stats_array($title, $data); + } + } + else + { + echo '<br/><br/><div class="error">'._NO_DATA_MESSAGE.'</div>'; + } + exit(); +} +else if($id_report == 'mail_vol_by_cat') +{ + $has_data = false; + $title = _MAIL_VOL_BY_CAT_REPORT.' '.$date_title ; + if($report_type == 'graph') + { + $vol_an = array(); + $vol_mois = array(); + $_SESSION['labels1'] = array(); + } + elseif($report_type == 'array') + { + $data = array(); + } + + foreach(array_keys($_SESSION['mail_categories']) as $key) + { + $db->query("select count(*) as total from ".$view." where status in ".$str_status." and ".$where_date." and category_id = '".$key."'"); + $res = $db->fetch_object(); + if($report_type == 'graph') + { + array_push($_SESSION['labels1'], $db->wash_html($_SESSION['mail_categories'][$key], 'NO_ACCENT')); + array_push($vol_an, $res->total); + } + elseif($report_type == 'array') + { + array_push($data, array('LABEL' => $_SESSION['mail_categories'][$key], 'VALUE' => $res->total )); + } + + if($res->total > 0) + { + $has_data = true; + } + } + if($report_type == 'graph') + { + $src1 = $_SESSION['urltomodules']."reports/graphs.php?type=pie&largeur=1000&hauteur=300&title=".$title; + + for($i=0;$i<count($vol_an);$i++) + { + $src1 .= "&values[]=".$vol_an[$i]; + } + } + elseif($report_type == 'array') + { + array_unshift($data, array('LABEL' => _CATEGORY, 'VALUE' => _NB_MAILS1)); + } + //echo $src1; + if($has_data) + { + if($report_type == 'graph') + { + ?> + <img src="<? echo $src1;?>" alt=""/><br/><br/> + <? + } + elseif($report_type == 'array') + { + $graph->show_stats_array($title, $data); + } + } + else + { + echo '<br/><br/><div class="error">'._NO_DATA_MESSAGE.'</div>'; + } + exit(); +} diff --git a/maarch_entreprise/trunk/reports/get_user_logs_stats_val.php b/maarch_entreprise/trunk/reports/get_user_logs_stats_val.php new file mode 100644 index 0000000000000000000000000000000000000000..feb5b478c8f09f2428cc6496c1c7dbc7100c1750 --- /dev/null +++ b/maarch_entreprise/trunk/reports/get_user_logs_stats_val.php @@ -0,0 +1,96 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$db = new dbquery(); +$db->connect(); +$req = new request(); +$list = new list_show(); + +if(isset($_REQUEST['user']) && $_REQUEST['user'] != '') +{ + $db->query('select lastname, firstname from '.$_SESSION['tablename']['users']." where user_id ='".$db->protect_string_db($_REQUEST['user'])."'"); + if($db->nb_result() == 0) + { + ?> + <div class="error"><?php echo _USER.' '._UNKNOWN;?></div> + <?php + } + + $res = $db->fetch_object(); + $user_name = $res->firstname.' '.$res->lastname; + + $select[$_SESSION['tablename']['history']] = array(); + array_push($select[$_SESSION['tablename']['history']],'id','event_type','event_date' ); + $where = " (".$_SESSION['tablename']['history'].".event_type = 'LOGIN' or ".$_SESSION['tablename']['history'].".event_type = 'LOGOUT') AND ".$_SESSION['tablename']['history'].".user_id = '".$_REQUEST['user']."' "; + $req = new request(); + $tab = $req->select($select, $where, " ORDER BY ".$_SESSION['tablename']['history'].".event_date DESC ", $_SESSION['config']['databasetype'], $limit="500",false); + + if (count($tab) > 0) + { + for ($i=0;$i<count($tab);$i++) + { + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value] == "id") + { + $tab[$i][$j]["label"]=_ID; + $tab[$i][$j]["size"]="20"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + //$tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["value"]=$tab[$i][$j]['value']; + } + if($tab[$i][$j][$value]=="event_type"){ + $tab[$i][$j]["label"]=_ACTION; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + //$tab[$i][$j]["value_export"] = $core_tools->is_var_in_history_keywords_tab($tab[$i][$j]['value']); + $tab[$i][$j]["value"] = $core_tools->is_var_in_history_keywords_tab($tab[$i][$j]['value']); + } + + if($tab[$i][$j][$value]=="event_date"){ + $tab[$i][$j]["label"]=_DATE; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="center"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + //$tab[$i][$j]["value_export"] = $funct -> dateformat($tab[$i][$j]['value']); + $tab[$i][$j]["value"] = $db -> dateformat($tab[$i][$j]['value']); + } + } + } + } + $title = _TITLE_STATS_USER_LOG.' : '.$user_name.' ('.$_REQUEST['user'].')'; + ?><div align="center"><?php $list->list_simple($tab, $i, $title, 'folder_id', 'istats_result', false, "", 'listing spec', '', 400, 500, '', false); ?></div> + <?php + } + else + { + $title = _TITLE_STATS_USER_LOG.' : '.$user_name.' ('.$_REQUEST['user'].')'; + echo '<h3>'.$title.'</h3>'; + ?><div align="center"><?php echo _NO_RESULTS;?></div> + <?php + } +} +else +{ +?> + <div class="error"><?php echo _USER.' '._IS_EMPTY;?></div> +<?php + exit(); +} diff --git a/maarch_entreprise/trunk/reports/report_by_period.php b/maarch_entreprise/trunk/reports/report_by_period.php new file mode 100644 index 0000000000000000000000000000000000000000..4b42ac163be7a3d8d51d68ed85804fb7d6d2ab08 --- /dev/null +++ b/maarch_entreprise/trunk/reports/report_by_period.php @@ -0,0 +1,79 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +require_once($_SESSION['pathtomodules']."reports".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); +$core_tools = new core_tools(); +$rep = new reports(); +$core_tools->load_lang(); +$id = ''; +if(isset($_REQUEST['arguments']) && !empty($_REQUEST['arguments'])) +{ + $id = $rep->get_arguments_for_report($_REQUEST['arguments'], 'id'); +} +if(empty($id)) +{ + echo _ID.' '._IS_MISSING; +} +$content = ''; +$content .='<div id="params">'; + $content .='<form id="report_by_period_form" name="report_by_period_form" method="get" action="">'; + $content .='<input type="hidden" name="id_report" id="id_report" value="'.$id.'" />'; + $content .='<table width="100%" border="0">'; + $content .='<tr>'; + $content .='<td><img src="'.$_SESSION['config']['img'].'/stats_parameters.gif" alt="'._ADV_OPTIONS.'" /></td>'; + $content .='<td align="left">'; + $content .='<p>'; + $content .='<span>'._SHOW_FORM_RESULT.' : </span> <input type="radio" name="form_report" id="report_graph" value="graph" checked="checked" /> '._GRAPH.' <input type="radio" name="form_report" id="report_array" value="array" /> '. _ARRAY; + $content .='</p>'; + $content .='<br/>'; + $content .='<p class="double">'; + $content .='<input type="radio" name="type_period" id="period_by_year" value="year" checked="checked" />'; + $content .= _SHOW_YEAR_GRAPH; + $content .='<select name="the_year" id="the_year">'; + $year=date("Y"); + $i_current=date("Y'"); + while ($year <> ($i_current-5)) + { + $content .= '<option value = "'.$year.'">'.$year.'</option>'; + $year= $year-1; + } + $content .='</select>'; + $content .='</p>'; + + $content .='<p class="double">'; + $content .='<input type="radio" name="type_period" id="period_by_month" value="month" />'; + $content .= _SHOW_GRAPH_MONTH; + $content .='<select name="the_month" id="the_month">'; + $content .='<option value ="01"> '. _JANUARY.' </option>'; + $content .='<option value ="02"> '._FEBRUARY.' </option>'; + $content .='<option value ="03"> '._MARCH.' </option>'; + $content .='<option value ="04"> '._APRIL.' </option>'; + $content .='<option value ="05"> '._MAY.' </option>'; + $content .='<option value ="06"> '._JUNE.' </option>'; + $content .='<option value ="07"> '._JULY.' </option>'; + $content .='<option value ="08"> '._AUGUST.' </option>'; + $content .='<option value ="09"> '._SEPTEMBER.' </option>'; + $content .='<option value ="10"> '._OCTOBER.'</option>'; + $content .='<option value ="11"> '._NOVEMBER.' </option>'; + $content .='<option value ="12"> '._DECEMBER.' </option>'; + $content .='</select>'; + $content .= _OF_THIS_YEAR.'.</p>'; + if($id <> 'process_delay') + { + $content .='<p class="double">'; + $content .='<input type="radio" id="custom_period" name="type_period" value="custom_period" /><label for="period">'._TITLE_STATS_CHOICE_PERIOD.'. </label>'._SINCE.' : <input name="datestart" type="text" id="datestart" onclick="showCalender(this);" /> '._FOR.' : <input name="dateend" type="text" id="dateend" onclick="showCalender(this);" /></p>'; + } + $content .='</td>'; + $content .='<td><input type="button" name="validate" value="'._VALIDATE.'" class="button" onclick="valid_report_by_period(\''.$_SESSION['config']['businessappurl'].'reports/get_report_by_period_val.php\');" /></td>'; + $content .='</tr>'; + $content .='</table>'; + $content .='</form>'; +$content .='</div>'; +$content .='<div id="result_period_report"></div>'; +$js ='valid_report_by_period(\''.$_SESSION['config']['businessappurl'].'reports/get_report_by_period_val.php\');'; + +echo "{content : '".addslashes($content)."', exec_js : '".addslashes($js)."'}"; +exit(); diff --git a/maarch_entreprise/trunk/reports/select_user_report.php b/maarch_entreprise/trunk/reports/select_user_report.php new file mode 100644 index 0000000000000000000000000000000000000000..d5f5146dac311a61b4ad6c76f30606bb7f465aa4 --- /dev/null +++ b/maarch_entreprise/trunk/reports/select_user_report.php @@ -0,0 +1,131 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); + +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_list_show.php"); +$func = new functions(); + +$what = "all"; +$where = ""; +$_SESSION['chosen_user'] = ''; +if(isset($_GET['what']) && !empty($_GET['what'])) +{ + if($_GET['what'] == "all") + { + $what = "all"; + + } + else + { + $what = addslashes($func->wash($_GET['what'], "no", "", "no")); + $where = "(".$_SESSION['tablename']['users'].".lastname like '".strtolower($what)."%' or ".$_SESSION['tablename']['users'].".lastname like '".strtoupper($what)."%') "; + } +} + $db = new dbquery(); + $db->connect(); + + $select[$_SESSION['tablename']['users']] = array(); + array_push($select[$_SESSION['tablename']['users']],"user_id","lastname","firstname" ); + + $req = new request(); + + $list=new list_show(); + $order = 'asc'; + if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) + { + $order = trim($_REQUEST['order']); + } + $field = 'lastname'; + if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) + { + $field = trim($_REQUEST['order_field']); + } + + $orderstr = $list->define_order($order, $field); + + $tab = $req->select($select, $where, $orderstr, $_SESSION['config']['databasetype'], $limit="500",false); + + for ($i=0;$i<count($tab);$i++) + { + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]== "user_id" ) + { + $tab[$i][$j]["user_id"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='user_id'; + } + + if($tab[$i][$j][$value]=='lastname') + { + $tab[$i][$j]['value']= $req->show_string($tab[$i][$j]['value']); + $tab[$i][$j]['lastname']= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_LASTNAME; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='lastname'; + } + if($tab[$i][$j][$value]=="firstname") + { + $tab[$i][$j]['value']= $req->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["info"]= $tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_FIRSTNAME; + $tab[$i][$j]["size"]="30"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='firstname'; + } + } + } + } + + if(isset($_REQUEST['field']) && !empty($_REQUEST['field'])) + { + ?> + <script language="javascript"> + var item = window.opener.$('user_id'); + if(item) + { + item.value = '<?php echo $_REQUEST['field'];?>'; + self.close(); + } + </script> + <?php + exit(); + } + +//here we loading the html +$core_tools->load_html(); +//here we building the header +$core_tools->load_header(_CHOOSE_USER2); +$time = $core_tools->get_session_time_expire(); +?> +<body onLoad="javascript:setTimeout(window.close, <?php echo $time;?>*60*1000);"> + +<?php +$nb = count($tab); + +$list->list_doc($tab, $nb, _USERS_LIST,'user_id',$name = "select_user_report",'user_id','',false,true,'get',$_SESSION['config']['businessappurl'].'reports/select_user_report.php',_CHOOSE_USER2, false, true, true,false, true, true, true, false, '', '', true, _ALL_USERS,_USER); +?> +</body> +</html> diff --git a/maarch_entreprise/trunk/reports/users_logs.php b/maarch_entreprise/trunk/reports/users_logs.php new file mode 100644 index 0000000000000000000000000000000000000000..f53c8226108eeebcca6a7c8d6bfbce8b9898e621 --- /dev/null +++ b/maarch_entreprise/trunk/reports/users_logs.php @@ -0,0 +1,25 @@ +<?php +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$content = ''; +$content .='<div id="params">'; +$content .='<form id="form" name="form" method="get" action="">'; + $content .='<table width="95%" border="0" align="center">'; + $content .= '<tr>'; + $content .= '<td width="25"> </td>'; + $content .= '<td align="left"><input type="text" name="user_id" id="user_id" value="" /> <em><label for="user_id"><a href="javascript://" onclick="window.open(\''.$_SESSION['config']['businessappurl'].'reports/select_user_report.php\',\'select_user_report\',\'width=800,height=700,resizable=yes\');" >'._CHOOSE_USER2.'</a></label></em></td>'; + $content .= '<td align="right" valign="middle"><input type="button" onclick="valid_userlogs(\''.$_SESSION['config']['businessappurl'].'reports/get_user_logs_stats_val.php\');" class="button" name="Submit1" value="'._VALIDATE.'" /></td>'; + $content .= '</tr>'; + $content .= '</table>'; +$content .= '</form>'; +$content .='</div>'; +$content .='<div id="result_userlogsstat"></div>'; +$js =''; + +echo "{content : '".addslashes($content)."', exec_js : '".addslashes($js)."'}"; +exit(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/script.php b/maarch_entreprise/trunk/script.php new file mode 100644 index 0000000000000000000000000000000000000000..98a930e72d00f6be419070c52de95cc8c93001a3 --- /dev/null +++ b/maarch_entreprise/trunk/script.php @@ -0,0 +1,22 @@ +<?php +/** +* File : script.php +* +* Maarch script link +* +* @package Maarch Framework 3.0 +* @version 3.0 +* @since 10/2005 +* @license GPL +* @author Laurent Giovannoni +*/ +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->insert_page(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/sql/data/apps.mysql.sql b/maarch_entreprise/trunk/sql/data/apps.mysql.sql new file mode 100644 index 0000000000000000000000000000000000000000..c43c19e59c317bc4b5c2f24d259a8f7bb864d4a2 --- /dev/null +++ b/maarch_entreprise/trunk/sql/data/apps.mysql.sql @@ -0,0 +1,1198 @@ +INSERT INTO doctypes_first_level VALUES (1, 'Courriers', 'Y'); + +INSERT INTO doctypes_second_level VALUES (1, 'Attribution', 1, 'Y'); +INSERT INTO doctypes_second_level VALUES (2, 'Avis', 1, 'Y'); +INSERT INTO doctypes_second_level VALUES (3, 'Décaissement', 1, 'Y'); +INSERT INTO doctypes_second_level VALUES (4, 'Divers', 1, 'Y'); +INSERT INTO doctypes_second_level VALUES (5, 'Suivi', 1, 'Y'); + +INSERT INTO `contacts` (`contact_id`, `lastname`, `firstname`, `society`, `function`, `address_num`, `address_street`, `address_complement`, `address_town`, `address_postal_code`, `address_country`, `email`, `phone`, `other_data`, `is_corporate_person`, `user_id`, `title`, `enabled`) VALUES +(1, 'Chaplin', 'Charlie', 'Maarch', 'Directeur artistique', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'khjohpuief', 'N', '', 'Monsieur', 'Y'), +(3, '', '', 'Maarch', '', '', '', '', '', '', 'France', '', '', '', 'Y', '', '', 'Y'), +(4, '', '', 'Warner', '', '', '', '', '', '', 'USA', '', '', '', 'Y', '', '', 'Y'), +(5, 'Majestrix', 'Diana', 'Warner', 'Directeur artistique', '', '', '', '', '', 'USA', '', '', '', 'N', '', 'Madame', 'Y'), +(7, '', '', 'Maarch', '', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'autre', 'Y', 'pparker', '', 'Y'), +(8, 'Carlin', 'Bruno', 'Maarch', 'Directeur Marketing', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'auykiu', 'N', 'pparker', 'Monsieur', 'Y'), +(9, '', '', 'Adorateurs du Froid', '', '43', 'rue du froid', 'fait trop chaud', 'coldcity', '11111', 'coldcountry', 'Adorateurs@froid.cold', '01010101', 'fait vraiment trop chaud', 'Y', 'pparker', '', 'Y'), +(10, '', '', 'TOTO', '', '', '', '', '', '', '', '', '', '', 'Y', 'pparker', '', 'Y'), +(11, '', '', 'fggdgg', '', '', '', '', '', '', '', '', '', '', 'Y', 'pparker', '', 'Y'), +(12, '', '', 'yuiop', '', '', '', '', '', '', '', '', '', 'dffff', 'Y', 'pparker', '', 'Y'), +(13, '', '', 'ffff', '', '', '', '', '', '', '', '', '', 'fff', 'Y', 'pparker', '', 'Y'); + +INSERT INTO `docservers` (`docserver_id`, `device_type`, `device_label`, `is_readonly`, `enabled`, `size_limit`, `actual_size`, `path_template`, `ext_docserver_info`, `chain_before`, `chain_after`, `creation_date`, `closing_date`, `coll_id`, `priority`) VALUES +('documents', NULL, NULL, 'N', 'Y', 1000000000, 17890777, '/docservers/DGGT/res_x/', NULL, NULL, NULL, '2007-11-19 11:41:22', NULL, 'coll_1', 10), +('documents_ai', NULL, NULL, 'N', 'Y', 1000000000, 17890777, '/docservers/DGGT/res_x_ai/', NULL, NULL, NULL, '2007-11-19 11:41:22', NULL, 'coll_1', 20), +('letterbox', NULL, NULL, 'N', 'Y', 100000000, 7613406, 'C:\\Maarch\\DocServer\\DGGT\\letterbox\\', NULL, NULL, NULL, '2007-11-19 11:41:22', NULL, 'letterbox_coll', 10), +('letterbox_ai', NULL, NULL, 'N', 'Y', 100000000, 3271717, 'C:\\Maarch\\DocServer\\DGGT\\letterbox_ai\\', NULL, NULL, NULL, '2007-11-19 11:41:22', NULL, 'letterbox_coll', 20); + +INSERT INTO `actions` (`id`, `keyword`, `label_action`, `id_status`, `is_system`, `enabled`, `action_page`, `history`, `origin`, `create_id`) VALUES +(2, 'to_validate', 'A valider', 'VAL', 'Y', 'N', 'confirm_status', 'N', 'apps', 'N'), +(20, '', 'Clôturer', 'END', 'N', 'Y', 'confirm_status', 'Y', 'apps', 'N'), +(21, 'indexing', 'Indexation', 'NEW', 'N', 'Y', 'index_mlb', 'Y', 'apps', 'Y'), +(18, '', 'A valider', 'NEW', 'N', 'Y', '', 'Y', 'apps', 'N'), +(19, '', 'Traiter document', 'COU', 'N', 'Y', 'process', 'Y', 'apps', 'N'), +(1, 'redirect', 'Redirection', 'NONE', 'Y', 'Y', 'redirect', 'Y', 'entities', 'N'), +(22, '', 'En attente de validation', 'VAL', 'N', 'Y', '', 'Y', 'apps', 'N'), +(23, 'indexing', 'Valider courrier', 'NEW', 'N', 'Y', 'validate_mail', 'Y', 'apps', 'N'); + +INSERT INTO `actions_groupbaskets` (`id_action`, `where_clause`, `group_id`, `basket_id`, `used_in_basketlist`, `used_in_action_page`, `default_action_list`) VALUES +(19, '', 'Recovery', 'MyBasket', 'N', 'N', 'Y'), +(23, '', 'Recovery', 'ValidationBasket', 'N', 'N', 'Y'), +(21, '', 'Recovery', 'IndexingBasket', 'N', 'N', 'Y'), +(1, '', 'Recovery', 'MyBasket', 'N', 'Y', 'N'), +(22, '', 'Recovery', 'IndexingBasket', 'N', 'Y', 'N'), +(20, '', 'Recovery', 'MyBasket', 'N', 'Y', 'N'); + +INSERT INTO `ar_batch` (`arbatch_id`, `title`, `subject`, `description`, `arbox_id`, `status`, `creation_date`, `retention_time`, `custom_t1`, `custom_n1`, `custom_f1`, `custom_d1`, `custom_t2`, `custom_n2`, `custom_f2`, `custom_d2`, `custom_t3`, `custom_n3`, `custom_f3`, `custom_d3`, `custom_t4`, `custom_n4`, `custom_f4`, `custom_d4`, `custom_t5`, `custom_n5`, `custom_f5`, `custom_d5`, `custom_t6`, `custom_t7`, `custom_t8`, `custom_t9`, `custom_t10`, `custom_t11`) VALUES +(1, '1', 'Lot 0 - Scan batch 0', 'Pas de description pour ce lot - No description for this batch', 3, 'NEW', '2008-09-22 19:31:46', NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(60, '2', 'Lot de numerisation 60 - Scan batch 60', 'Pas de description pour ce lot - No description for this batch', 3, 'NEW', '2008-09-22 19:31:46', NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(61, '3', NULL, NULL, 3, 'NEW', '2009-08-03 10:10:52', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'pparker', NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-03 10:10:52', NULL, NULL, NULL, NULL, 'LETTERBOX', NULL, NULL, NULL, NULL, NULL); + +INSERT INTO `ar_boxes` (`arbox_id`, `title`, `subject`, `description`, `entity_id`, `arcontainer_id`, `status`, `creation_date`, `retention_time`, `custom_t1`, `custom_n1`, `custom_f1`, `custom_d1`, `custom_t2`, `custom_n2`, `custom_f2`, `custom_d2`, `custom_t3`, `custom_n3`, `custom_f3`, `custom_d3`, `custom_t4`, `custom_n4`, `custom_f4`, `custom_d4`, `custom_t5`, `custom_n5`, `custom_f5`, `custom_d5`, `custom_t6`, `custom_t7`, `custom_t8`, `custom_t9`, `custom_t10`, `custom_t11`) VALUES +(3, 'Boite d archive 3 - Archive box 3', 'Divers documents - Miscellaneous docs', 'Pas de description pour cette boite - No description for this archive box', '0', 0, 'NEW', '2008-09-22 19:30:26', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + +INSERT INTO `ar_container_types` (`ctype_id`, `ctype_desc`, `size_x`, `size_y`, `size_z`) VALUES +('CAF20', 'Conteneur aere ferme 20 pieds', 6, 2.32, 2.37), +('CAF40', 'Conteneur aere ferme 40 pieds', 12, 2.32, 2.37), +('CPF20', 'Conteneur plate-forme 20 pieds', 6, 2.32, 2.37), +('SCPF40', 'Super conteneur plate-forme 20 pieds', 6, 2.32, 2.37), +('CTH40', 'Conteneur a caracteristiques thermiques 40 pieds', 12, 2.32, 2.37), +('CTH20', 'Conteneur a caracteristiques thermiques 20 pieds', 6, 2.32, 2.37); + +INSERT INTO `ar_natures` (`arnature_id`, `arnature_desc`, `arnature_retention`, `entity_id`, `enabled`) VALUES +('LIVREPAYE', 'Livre de paie', 120, 'WARNER', 'Y'), +('REGPERS', 'Registre du personnel', 120, 'WARNER', 'N'), +('DOSSACC', 'Dossiers accident', 100, 'WARNER', 'Y'), +('CCPM', 'Contrats commerciaux et pieces de marches en vue d''un recours', 30, 'LAFARGE', 'Y'), +('CC', 'Correspondances commerciales', 10, 'LAFARGE', 'Y'), +('LC', 'Livre comptable', 6, 'LAFARGE', 'Y'); + + +INSERT INTO `ar_positions` (`position_id`, `site_id`, `pos_row`, `pos_col`, `pos_level`, `pos_max_uc`, `pos_available_uc`) VALUES +(1, 'FR01', 'A', 1, 1, 4, 4), +(2, 'FR01', 'A', 1, 2, 4, 4), +(3, 'FR01', 'A', 1, 3, 4, 4), +(4, 'FR01', 'A', 2, 1, 4, 4), +(5, 'FR01', 'A', 2, 2, 4, 4), +(6, 'FR01', 'A', 2, 3, 4, 4), +(7, 'FR01', 'A', 3, 1, 4, 4), +(8, 'FR01', 'A', 3, 2, 4, 4), +(9, 'FR01', 'A', 3, 3, 4, 4), +(10, 'FR01', 'A', 4, 1, 4, 4), +(11, 'FR01', 'A', 4, 2, 4, 4), +(12, 'FR01', 'A', 4, 3, 4, 4), +(13, 'FR01', 'A', 5, 1, 4, 4), +(14, 'FR01', 'A', 5, 2, 4, 4), +(15, 'FR01', 'A', 5, 3, 4, 4), +(16, 'FR01', 'A', 6, 1, 4, 4), +(17, 'FR01', 'A', 6, 2, 4, 4), +(18, 'FR01', 'A', 6, 3, 4, 4), +(19, 'FR01', 'A', 7, 1, 4, 4), +(20, 'FR01', 'A', 7, 2, 4, 4), +(21, 'FR01', 'A', 7, 3, 4, 4), +(22, 'FR01', 'A', 8, 1, 4, 4), +(23, 'FR01', 'A', 8, 2, 4, 4), +(24, 'FR01', 'A', 8, 3, 4, 4), +(25, 'FR01', 'A', 9, 1, 4, 4), +(26, 'FR01', 'A', 9, 2, 4, 4), +(27, 'FR01', 'A', 9, 3, 4, 4), +(28, 'FR01', 'A', 10, 1, 4, 4), +(29, 'FR01', 'A', 10, 2, 4, 4), +(30, 'FR01', 'A', 10, 3, 4, 4), +(31, 'FR01', 'B', 1, 1, 4, 4), +(32, 'FR01', 'B', 1, 2, 4, 4), +(33, 'FR01', 'B', 1, 3, 4, 4), +(34, 'FR01', 'B', 2, 1, 4, 4), +(35, 'FR01', 'B', 2, 2, 4, 4), +(36, 'FR01', 'B', 2, 3, 4, 4), +(37, 'FR01', 'B', 3, 1, 4, 4), +(38, 'FR01', 'B', 3, 2, 4, 4), +(39, 'FR01', 'B', 3, 3, 4, 4), +(40, 'FR01', 'B', 4, 1, 4, 4), +(41, 'FR01', 'B', 4, 2, 4, 4), +(42, 'FR01', 'B', 4, 3, 4, 4), +(43, 'FR01', 'B', 5, 1, 4, 4), +(44, 'FR01', 'B', 5, 2, 4, 4), +(45, 'FR01', 'B', 5, 3, 4, 4), +(46, 'FR01', 'B', 6, 1, 4, 4), +(47, 'FR01', 'B', 6, 2, 4, 4), +(48, 'FR01', 'B', 6, 3, 4, 4), +(49, 'FR01', 'B', 7, 1, 4, 4), +(50, 'FR01', 'B', 7, 2, 4, 4), +(51, 'FR01', 'B', 7, 3, 4, 4), +(52, 'FR01', 'B', 8, 1, 4, 4), +(53, 'FR01', 'B', 8, 2, 4, 4), +(54, 'FR01', 'B', 8, 3, 4, 4), +(55, 'FR01', 'B', 9, 1, 4, 4), +(56, 'FR01', 'B', 9, 2, 4, 4), +(57, 'FR01', 'B', 9, 3, 4, 4), +(58, 'FR01', 'B', 10, 1, 4, 4), +(59, 'FR01', 'B', 10, 2, 4, 4), +(60, 'FR01', 'B', 10, 3, 4, 4), +(61, 'FR01', 'C', 1, 1, 4, 4), +(62, 'FR01', 'C', 1, 2, 4, 4), +(63, 'FR01', 'C', 1, 3, 4, 4), +(64, 'FR01', 'C', 2, 1, 4, 4), +(65, 'FR01', 'C', 2, 2, 4, 4), +(66, 'FR01', 'C', 2, 3, 4, 4), +(67, 'FR01', 'C', 3, 1, 4, 4), +(68, 'FR01', 'C', 3, 2, 4, 4), +(69, 'FR01', 'C', 3, 3, 4, 4), +(70, 'FR01', 'C', 4, 1, 4, 4), +(71, 'FR01', 'C', 4, 2, 4, 4), +(72, 'FR01', 'C', 4, 3, 4, 4), +(73, 'FR01', 'C', 5, 1, 4, 4), +(74, 'FR01', 'C', 5, 2, 4, 4), +(75, 'FR01', 'C', 5, 3, 4, 4), +(76, 'FR01', 'C', 6, 1, 4, 4), +(77, 'FR01', 'C', 6, 2, 4, 4), +(78, 'FR01', 'C', 6, 3, 4, 4), +(79, 'FR01', 'C', 7, 1, 4, 4), +(80, 'FR01', 'C', 7, 2, 4, 4), +(81, 'FR01', 'C', 7, 3, 4, 4), +(82, 'FR01', 'C', 8, 1, 4, 4), +(83, 'FR01', 'C', 8, 2, 4, 4), +(84, 'FR01', 'C', 8, 3, 4, 4), +(85, 'FR01', 'C', 9, 1, 4, 4), +(86, 'FR01', 'C', 9, 2, 4, 4), +(87, 'FR01', 'C', 9, 3, 4, 4), +(88, 'FR01', 'C', 10, 1, 4, 4), +(89, 'FR01', 'C', 10, 2, 4, 4), +(90, 'FR01', 'C', 10, 3, 4, 4), +(91, 'FR01', 'D', 1, 1, 4, 4), +(92, 'FR01', 'D', 1, 2, 4, 4), +(93, 'FR01', 'D', 1, 3, 4, 4), +(94, 'FR01', 'D', 2, 1, 4, 4), +(95, 'FR01', 'D', 2, 2, 4, 4), +(96, 'FR01', 'D', 2, 3, 4, 4), +(97, 'FR01', 'D', 3, 1, 4, 4), +(98, 'FR01', 'D', 3, 2, 4, 4), +(99, 'FR01', 'D', 3, 3, 4, 4), +(100, 'FR01', 'D', 4, 1, 4, 4), +(101, 'FR01', 'D', 4, 2, 4, 4), +(102, 'FR01', 'D', 4, 3, 4, 4), +(103, 'FR01', 'D', 5, 1, 4, 4), +(104, 'FR01', 'D', 5, 2, 4, 4), +(105, 'FR01', 'D', 5, 3, 4, 4), +(106, 'FR01', 'D', 6, 1, 4, 4), +(107, 'FR01', 'D', 6, 2, 4, 4), +(108, 'FR01', 'D', 6, 3, 4, 4), +(109, 'FR01', 'D', 7, 1, 4, 4), +(110, 'FR01', 'D', 7, 2, 4, 4), +(111, 'FR01', 'D', 7, 3, 4, 4), +(112, 'FR01', 'D', 8, 1, 4, 4), +(113, 'FR01', 'D', 8, 2, 4, 4), +(114, 'FR01', 'D', 8, 3, 4, 4), +(115, 'FR01', 'D', 9, 1, 4, 4), +(116, 'FR01', 'D', 9, 2, 4, 4), +(117, 'FR01', 'D', 9, 3, 4, 4), +(118, 'FR01', 'D', 10, 1, 4, 4), +(119, 'FR01', 'D', 10, 2, 4, 4), +(120, 'FR01', 'D', 10, 3, 4, 4), +(121, 'FR01', 'E', 1, 1, 4, 4), +(122, 'FR01', 'E', 1, 2, 4, 4), +(123, 'FR01', 'E', 1, 3, 4, 4), +(124, 'FR01', 'E', 2, 1, 4, 4), +(125, 'FR01', 'E', 2, 2, 4, 4), +(126, 'FR01', 'E', 2, 3, 4, 4), +(127, 'FR01', 'E', 3, 1, 4, 4), +(128, 'FR01', 'E', 3, 2, 4, 4), +(129, 'FR01', 'E', 3, 3, 4, 4), +(130, 'FR01', 'E', 4, 1, 4, 4), +(131, 'FR01', 'E', 4, 2, 4, 4), +(132, 'FR01', 'E', 4, 3, 4, 4), +(133, 'FR01', 'E', 5, 1, 4, 4), +(134, 'FR01', 'E', 5, 2, 4, 4), +(135, 'FR01', 'E', 5, 3, 4, 4), +(136, 'FR01', 'E', 6, 1, 4, 4), +(137, 'FR01', 'E', 6, 2, 4, 4), +(138, 'FR01', 'E', 6, 3, 4, 4), +(139, 'FR01', 'E', 7, 1, 4, 4), +(140, 'FR01', 'E', 7, 2, 4, 4), +(141, 'FR01', 'E', 7, 3, 4, 4), +(142, 'FR01', 'E', 8, 1, 4, 4), +(143, 'FR01', 'E', 8, 2, 4, 4), +(144, 'FR01', 'E', 8, 3, 4, 4), +(145, 'FR01', 'E', 9, 1, 4, 4), +(146, 'FR01', 'E', 9, 2, 4, 4), +(147, 'FR01', 'E', 9, 3, 4, 4), +(148, 'FR01', 'E', 10, 1, 4, 4), +(149, 'FR01', 'E', 10, 2, 4, 4), +(150, 'FR01', 'E', 10, 3, 4, 4); + + +INSERT INTO `ar_sites` (`site_id`, `site_desc`, `entity_id`) VALUES +('FR01', 'Site de Paris', 'ARCHIVECO'), +('FR02', 'Site de Nanterre', 'ARCHIVECO'), +('SN01', 'Site de Dakar', 'DAKARCHIV'), +('SN02', 'Site de Saint Louis', 'DAKARCHIV'); + +INSERT INTO `baskets` (`coll_id`, `basket_id`, `basket_name`, `basket_desc`, `basket_clause`, `is_generic`, `enabled`) VALUES +('letterbox_coll', 'IndexingBasket', 'Corbeille d\\''indexation', 'Corbeille d\\''indexation', ' ', 'N', 'Y'), +('letterbox_coll', 'ValidationBasket', 'Mes courriers à valider', 'Mes courriers à valider', 'status = ''VAL''', 'N', 'Y'), +('letterbox_coll', 'CopyMailBasket', 'Mes courriers en copie', 'Mes courriers en copie', ' ', 'N', 'Y'), +('letterbox_coll', 'LateMailBasket', 'Mes courriers en retard', 'Mes courriers en retard', '1=1', 'N', 'Y'), +('letterbox_coll', 'MyBasket', 'Mes courriers à traiter', 'Mes courriers à traiter', '(status =''NEW'' or status =''COU'') and dest_user = @user', 'N', 'Y'); + +INSERT INTO `contacts` (`contact_id`, `lastname`, `firstname`, `society`, `function`, `address_num`, `address_street`, `address_complement`, `address_town`, `address_postal_code`, `address_country`, `email`, `phone`, `other_data`, `is_corporate_person`, `user_id`, `title`, `enabled`) VALUES +(1, 'Chaplin', 'Charlie', 'Maarch', 'Directeur artistique', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'khjohpuief', 'N', '', 'Monsieur', 'Y'), +(3, '', '', 'Maarch', '', '', '', '', '', '', 'France', '', '', '', 'Y', '', '', 'Y'), +(4, '', '', 'Warner', '', '', '', '', '', '', 'USA', '', '', '', 'Y', '', '', 'Y'), +(5, 'Majestrix', 'Diana', 'Warner', 'Directeur artistique', '', '', '', '', '', 'USA', '', '', '', 'N', '', 'Madame', 'Y'), +(7, '', '', 'Maarch', '', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'autre', 'Y', 'pparker', '', 'Y'), +(8, 'Carlin', 'Bruno', 'Maarch', 'Directeur Marketing', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'auykiu', 'N', 'pparker', 'Monsieur', 'Y'), +(9, '', '', 'Adorateurs du Froid', '', '43', 'rue du froid', 'fait trop chaud', 'coldcity', '11111', 'coldcountry', 'Adorateurs@froid.cold', '01010101', 'fait vraiment trop chaud', 'Y', 'pparker', '', 'Y'), +(10, '', '', 'TOTO', '', '', '', '', '', '', '', '', '', '', 'Y', 'pparker', '', 'Y'), +(11, '', '', 'fggdgg', '', '', '', '', '', '', '', '', '', '', 'Y', 'pparker', '', 'Y'), +(12, '', '', 'yuiop', '', '', '', '', '', '', '', '', '', 'dffff', 'Y', 'pparker', '', 'Y'), +(13, '', '', 'ffff', '', '', '', '', '', '', '', '', '', 'fff', 'Y', 'pparker', '', 'Y'); + +INSERT INTO `doctypes` (`coll_id`, `type_id`, `description`, `enabled`, `doctypes_first_level_id`, `doctypes_second_level_id`, `primary_retention`, `secondary_retention`, `custom_t1`, `custom_n1`, `custom_f1`, `custom_d1`, `custom_t2`, `custom_n2`, `custom_f2`, `custom_d2`, `custom_t3`, `custom_n3`, `custom_f3`, `custom_d3`, `custom_t4`, `custom_n4`, `custom_f4`, `custom_d4`, `custom_t5`, `custom_n5`, `custom_f5`, `custom_d5`, `custom_t6`, `custom_d6`, `custom_t7`, `custom_d7`, `custom_t8`, `custom_d8`, `custom_t9`, `custom_d9`, `custom_t10`, `custom_d10`, `custom_t11`, `custom_t12`, `custom_t13`, `custom_t14`, `custom_t15`, `is_master`) VALUES +('letterbox_coll', 47, 'MAR - Marché', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 43, 'LCO - Lettre de commande', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 44, 'ATR - Attribution de marché', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 45, 'OFT - Offre Technique', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 46, 'OFI - Offre financière', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 48, 'PVO - Procès Verbal d\\''Ouverture des offres', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 49, 'PVD -Procès Verbal de Dépouillement des offres', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 50, 'PVC - Procès Verbal de Commission Centrale des Marchés et Contrat de l\\''Etat', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 51, 'OSD - Ordre de Service de Démarrage', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 52, 'DAO - Dossier d\\''Appel D\\''Offres', 'Y', 2, 2, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 53, 'AAO - Avis d\\''Appel d\\''offre', 'Y', 2, 2, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'), +('letterbox_coll', 54, 'test modèle', 'Y', 2, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); + + +INSERT INTO `doctypes_first_level` (`doctypes_first_level_id`, `doctypes_first_level_label`, `enabled`) VALUES +(1, 'Pret immobilier - Real estate loan', 'N'), +(2, 'Courriers', 'Y'), +(3, 'test', 'Y'); + + +INSERT INTO `doctypes_second_level` (`doctypes_second_level_id`, `doctypes_second_level_label`, `doctypes_first_level_id`, `enabled`) VALUES +(3, 'Décaissement', 2, 'Y'), +(2, 'Avis', 2, 'Y'), +(1, 'Attribution', 2, 'Y'), +(4, 'Divers', 2, 'Y'), +(5, 'Suivi', 2, 'Y'); + +INSERT INTO `entities` (`entity_id`, `entity_label`, `enabled`, `adrs_1`, `adrs_2`, `adrs_3`, `zipcode`, `city`, `country`, `email`, `business_id`, `parent_entity_id`, `entity_type`) VALUES +('ARCHIVECO', 'Archiveco SARL', 'Y', '1 rue du Bois', '', '', '44630', 'Villedieu la Blou�re', 'France', 'archiveco@wanadoo.fr', '9876 5432 4321', 'ECONOMBOX', 'Level1'), +('ECONOMBOX', 'EconomBox SAS', 'Y', '65 rue de la Croix', '', '', '92000', 'Nanterre', 'France', 'info@econombox.com', '1234 5678 9012', '', 'Level0'), +('WARNER', 'Warner Music France', 'Y', '29 Avenue Mac Mahon', '', '', '75017', 'Paris 17', 'France', 'arnaud.duval@warnermusic.fr', '712029370 00129', 'ARCHIVECO', 'Level1'), +('LAFARGE', 'Lafarge Ciments', 'Y', 'BP 302', '', '', '92214', 'ST CLOUD CEDEX', 'France', 'caroline.caumes@lafarge-ciments.fr', '302135561 00421', 'ARCHIVECO', 'Level1'), +('DAKARCHIV', 'Dakarchiv SA', 'Y', '49 Machallah VDN', 'BP 430', '', '', 'Dakar', 'Senegal', 'mamadou.diallo@dakarchiv.sn', '8765432543 5433', 'ECONOMBOX', 'Level1'), +('APIX', 'APIX SA', 'Y', '52-54 rue Mohammed V', 'BP 430', '', '18524', 'Dakar', 'Senegal', 'moussdiallo@apix.sn', '5432345 454 98765', 'DAKARCHIV', 'Level1'), +('test', 'test', 'Y', '', '', '', '', '', '', '', '', 'WARNER', 'Level1'); + + +INSERT INTO `folders` (`folders_system_id`, `folder_id`, `foldertype_id`, `parent_id`, `folder_name`, `subject`, `description`, `author`, `typist`, `status`, `folder_level`, `creation_date`, `folder_out_id`, `custom_t1`, `custom_n1`, `custom_f1`, `custom_d1`, `custom_t2`, `custom_n2`, `custom_f2`, `custom_d2`, `custom_t3`, `custom_n3`, `custom_f3`, `custom_d3`, `custom_t4`, `custom_n4`, `custom_f4`, `custom_d4`, `custom_t5`, `custom_n5`, `custom_f5`, `custom_d5`, `custom_t6`, `custom_d6`, `custom_t7`, `custom_d7`, `custom_t8`, `custom_d8`, `custom_t9`, `custom_d9`, `custom_t10`, `custom_d10`, `custom_t11`, `custom_d11`, `custom_t12`, `custom_d12`, `custom_t13`, `custom_d13`, `custom_t14`, `custom_d14`, `custom_t15`, `is_complete`, `is_folder_out`) VALUES +(1, 'F_000001', 1, 0, 'Eric SPRITZ', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-23 18:03:14', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(2, 'F_000002', 1, 0, 'Thomas BECK', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-23 16:55:05', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(4, 'F_000004', 1, 0, 'Tom JOBIM', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-23 17:58:15', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(9, 'F_000009', 1, 0, 'Compay SEGUNDO', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-24 16:55:39', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(7, 'F_000007', 1, 0, 'Maria BETHANIA', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-24 01:31:38', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(3, 'F_000003', 1, 0, 'Teresa CRISTINA', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-23 17:56:15', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(8, 'F_000008', 1, 0, 'Edith PIAF', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-24 16:36:55', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(6, 'F_000006', 1, 0, 'Luciano PAVAROTTI', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-23 18:02:01', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(5, 'F_000005', 1, 0, 'Joao GILBERTO', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-04-23 18:00:26', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(10, 'F_000010', 1, 0, 'Angelo BRANDUARDI', NULL, NULL, NULL, NULL, 'NEW', 1, '2008-05-22 17:26:48', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(11, 'F_000011', 1, 0, 'code_projet1', 'Projet 1', NULL, NULL, NULL, 'NEW', 1, '2008-05-22 17:27:22', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(12, 'F_000012', 1, 11, 'code_marche1', 'Marché 1', NULL, NULL, NULL, 'NEW', 2, '2008-05-19 12:07:51', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(13, 'F_000013', 1, 0, 'code_projet2', 'Projet 2', NULL, NULL, NULL, 'NEW', 1, '2008-05-19 12:07:51', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(14, 'F_000014', 1, 13, 'code_marche2', 'Marché2', NULL, NULL, NULL, 'NEW', 2, '2008-05-19 12:07:51', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(15, 'F_000015', 1, 0, 'code_projet3', 'Projet 3', NULL, NULL, NULL, 'NEW', 1, '2008-05-19 12:07:51', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'), +(16, 'F_000016', 1, 15, 'code_marche3', 'Marché 3', NULL, NULL, NULL, 'NEW', 2, '2008-06-17 11:00:28', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'N'); + +INSERT INTO `foldertypes` (`foldertype_id`, `foldertype_label`, `maarch_comment`, `retention_time`, `custom_d1`, `custom_f1`, `custom_n1`, `custom_t1`, `custom_d2`, `custom_f2`, `custom_n2`, `custom_t2`, `custom_d3`, `custom_f3`, `custom_n3`, `custom_t3`, `custom_d4`, `custom_f4`, `custom_n4`, `custom_t4`, `custom_d5`, `custom_f5`, `custom_n5`, `custom_t5`, `custom_d6`, `custom_t6`, `custom_d7`, `custom_t7`, `custom_d8`, `custom_t8`, `custom_d9`, `custom_t9`, `custom_d10`, `custom_t10`, `custom_t11`, `custom_t12`, `custom_t13`, `custom_t14`, `custom_t15`, `coll_id`) VALUES +(1, 'Projets marchés', 'Projets marchés', NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'letterbox_coll'); + +INSERT INTO `foldertypes_doctypes_level1` (`foldertype_id`, `doctypes_first_level_id`) VALUES +(1, 16), +(1, 23), +(6, 25); + +INSERT INTO `groupbasket` (`group_id`, `basket_id`, `sequence`, `redirect_basketlist`, `redirect_grouplist`, `can_redirect`, `can_delete`, `can_insert`, `result_page`) VALUES +('Recovery', 'MyBasket', 50, NULL, NULL, 'Y', 'N', 'N', 'documents_list'), +('Recovery', 'ValidationBasket', 52, NULL, NULL, 'Y', 'N', 'N', 'documents_list'), +('Recovery', 'IndexingBasket', 13, NULL, NULL, 'Y', 'N', 'N', 'redirect_to_action'), +('Recovery', 'CopyMailBasket', 3, NULL, NULL, 'Y', 'N', 'N', 'documents_list'), +('Recovery', 'LateMailBasket', 2, NULL, NULL, 'Y', 'N', 'N', 'documents_list'), +('Admin', 'MyBasket', 1, NULL, NULL, 'Y', 'N', 'N', 'documents_list'); + +INSERT INTO `groupbasket_redirect` (`system_id`, `group_id`, `basket_id`, `action_id`, `entity_id`, `keyword`, `redirect_mode`) VALUES +(13, 'Recovery', 'IndexingBasket', 21, '', 'ALL_ENTITIES', 'ENTITY'), +(82, 'Recovery', 'ValidationBasket', 23, '', 'ALL_ENTITIES', 'ENTITY'), +(81, 'Recovery', 'MyBasket', 1, '', 'ALL_ENTITIES', 'USERS'), +(80, 'Recovery', 'MyBasket', 1, '', 'ALL_ENTITIES', 'ENTITY'); + + +INSERT INTO `listinstance` (`coll_id`, `res_id`, `listinstance_type`, `sequence`, `item_id`, `item_type`, `item_mode`, `added_by_user`, `added_by_entity`) VALUES +('letterbox_coll', 1, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 1, 'DOC', 0, 'ccharles', 'user_id', 'cc', '', ''), +('letterbox_coll', 1, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 2, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 2, 'DOC', 0, 'bsaporta', 'user_id', 'cc', '', ''), +('letterbox_coll', 2, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 3, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 3, 'DOC', 0, 'bsaporta', 'user_id', 'cc', '', ''), +('letterbox_coll', 3, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 4, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 4, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 4, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 5, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 5, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 5, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 6, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 6, 'DOC', 0, 'ccharles', 'user_id', 'cc', '', ''), +('letterbox_coll', 6, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 8, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 8, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 8, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 9, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 9, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 9, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 10, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 10, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 10, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 11, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 11, 'DOC', 0, 'ccharles', 'user_id', 'cc', '', ''), +('letterbox_coll', 11, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 12, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 12, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 12, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 13, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 13, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 13, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 14, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 14, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 14, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 15, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 15, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 15, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 15, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 16, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 16, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 16, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 16, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 17, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 17, 'DOC', 0, 'ccharles', 'user_id', 'cc', '', ''), +('letterbox_coll', 17, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 18, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 18, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 18, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 18, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 19, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 19, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 19, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 20, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 20, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 20, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 21, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 21, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 21, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 21, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 22, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 22, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 22, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 22, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 23, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 23, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 23, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 23, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 24, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 24, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 24, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 24, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 25, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 25, 'DOC', 0, 'ccharles', 'user_id', 'cc', '', ''), +('letterbox_coll', 25, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 26, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 26, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 26, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 26, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 27, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 27, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 27, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 28, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 28, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 28, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 28, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 29, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 29, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 29, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 30, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 30, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 30, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 30, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 31, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 31, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 31, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 32, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 32, 'DOC', 1, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 32, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 33, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 33, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 33, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 34, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 34, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 34, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 35, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 35, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 36, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 36, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 37, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 37, 'DOC', 0, 'bsaporta', 'user_id', 'cc', '', ''), +('letterbox_coll', 37, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 38, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 38, 'DOC', 0, 'bsaporta', 'user_id', 'cc', '', ''), +('letterbox_coll', 38, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 39, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 39, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 39, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 39, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 40, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 40, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 40, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 40, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 41, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 41, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 41, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 41, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 42, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 42, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 42, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 42, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 43, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 43, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 43, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 43, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 44, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 44, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 44, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 44, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 45, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 45, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 45, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 46, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 46, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 46, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 47, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 47, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 47, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 48, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 48, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 48, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 48, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 49, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 49, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 49, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 49, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 50, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 50, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 50, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 50, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 51, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 51, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 51, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 51, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 52, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 52, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 52, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 53, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 53, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 53, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 54, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 54, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 54, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 55, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 55, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 55, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 56, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 56, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 56, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 57, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 57, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 57, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 58, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 58, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 58, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 59, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 59, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 59, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 59, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 60, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 60, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 60, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 60, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 61, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 61, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 61, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 61, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 62, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 62, 'DOC', 0, 'ccharles', 'user_id', 'cc', '', ''), +('letterbox_coll', 62, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 65, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 65, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 65, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 65, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 72, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 72, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 72, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 73, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 73, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 73, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 73, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 75, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 75, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 75, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 75, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 76, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 76, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 76, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 76, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 77, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 77, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 77, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 77, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 78, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 78, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 78, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 78, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 79, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 80, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 80, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 80, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 80, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 81, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 81, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 81, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 81, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 82, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 82, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 82, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 82, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 83, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 83, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 83, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 83, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 84, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 84, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 84, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 84, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 85, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 85, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 85, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 85, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 87, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 87, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 87, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 87, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 88, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 88, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 88, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 89, 'DOC', 0, 'ccharles', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 89, 'DOC', 2, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 90, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 90, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 102, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 91, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 91, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 92, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 92, 'DOC', 0, 'ccharles', 'user_id', 'cc', '', ''), +('letterbox_coll', 92, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 93, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 93, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 93, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 93, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 94, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 94, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 94, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 95, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 95, 'DOC', 1, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 95, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 96, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 96, 'DOC', 0, 'pparker', 'user_id', 'cc', '', ''), +('letterbox_coll', 96, 'DOC', 0, 'APIX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 96, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 97, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 97, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 97, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 98, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 98, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 98, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', '', ''), +('letterbox_coll', 99, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 99, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 99, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 100, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 100, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', '', ''), +('letterbox_coll', 100, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', '', ''), +('letterbox_coll', 101, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 101, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 101, 'DOC', 0, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 79, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 79, 'DOC', 1, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 79, 'DOC', 2, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 79, 'DOC', 3, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 79, 'DOC', 0, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 79, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 79, 'DOC', 2, 'WARNER', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 89, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 89, 'DOC', 0, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 89, 'DOC', 1, 'ARCHIVECO', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 89, 'DOC', 2, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 33, 'DOC', 0, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 33, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 32, 'DOC', 1, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 32, 'DOC', 2, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 34, 'DOC', 1, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 34, 'DOC', 2, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 9, 'DOC', 1, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 9, 'DOC', 2, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 95, 'DOC', 2, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 7, 'DOC', 0, 'ccharles', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 7, 'DOC', 1, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 7, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 7, 'DOC', 2, 'LAFARGE', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 98, 'DOC', 1, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 98, 'DOC', 2, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 97, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 97, 'DOC', 2, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 91, 'DOC', 1, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 91, 'DOC', 2, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 101, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 103, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 103, 'DOC', 0, 'bsaporta', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 103, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 105, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 105, 'DOC', 0, 'bsaporta', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 102, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 102, 'DOC', 0, 'bsaporta', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 104, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 104, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 104, 'DOC', 0, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 104, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 105, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 106, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 106, 'DOC', 0, 'ccharles', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 106, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 109, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 109, 'DOC', 0, 'pparker', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 109, 'DOC', 0, 'APIX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 109, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 110, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 110, 'DOC', 0, 'bsaporta', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 110, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 111, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 111, 'DOC', 0, 'bsaporta', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 111, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 112, 'DOC', 0, 'bsaporta', 'user_id', 'dest', '', ''), +('letterbox_coll', 112, 'DOC', 0, 'DAKARCHIV', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 112, 'DOC', 1, 'ECONOMBOX', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 113, 'DOC', 0, 'pparker', 'user_id', 'dest', '', ''), +('letterbox_coll', 113, 'DOC', 0, 'bsaporta', 'user_id', 'cc', 'pparker', 'ECONOMBOX'), +('letterbox_coll', 113, 'DOC', 0, 'ARCHIVECO', 'entity_id', 'cc', 'pparker', 'ECONOMBOX'); + + + +INSERT INTO `listmodels` (`coll_id`, `object_id`, `object_type`, `sequence`, `item_id`, `item_type`, `item_mode`, `listmodel_type`) VALUES +('letterbox_coll', 'test', 'entity_id', 0, 'bsaporta', 'user_id', 'dest', 'DOC'), +('letterbox_coll', 'test', 'entity_id', 0, 'ARCHIVECO', 'entity_id', 'cc', 'DOC'), +('letterbox_coll', 'test', 'entity_id', 1, 'DAKARCHIV', 'entity_id', 'cc', 'DOC'), +('letterbox_coll', 'ARCHIVECO', 'entity_id', 0, 'bsaporta', 'user_id', 'dest', 'DOC'), +('letterbox_coll', 'ARCHIVECO', 'entity_id', 0, 'ECONOMBOX', 'entity_id', 'cc', 'DOC'), +('letterbox_coll', 'ARCHIVECO', 'entity_id', 1, 'DAKARCHIV', 'entity_id', 'cc', 'DOC'), +('letterbox_coll', 'ECONOMBOX', 'entity_id', 0, 'pparker', 'user_id', 'dest', 'DOC'), +('letterbox_coll', 'ECONOMBOX', 'entity_id', 0, 'bsaporta', 'user_id', 'cc', 'DOC'), +('letterbox_coll', 'ECONOMBOX', 'entity_id', 0, 'ARCHIVECO', 'entity_id', 'cc', 'DOC'), +('letterbox_coll', 'APIX', 'entity_id', 0, 'APIX', 'entity_id', 'cc', 'DOC'), +('letterbox_coll', 'APIX', 'entity_id', 1, 'ECONOMBOX', 'entity_id', 'cc', 'DOC'), +('letterbox_coll', 'APIX', 'entity_id', 0, 'pparker', 'user_id', 'cc', 'DOC'), +('letterbox_coll', 'APIX', 'entity_id', 0, 'bsaporta', 'user_id', 'dest', 'DOC'), +('letterbox_coll', 'LAFARGE', 'entity_id', 0, 'bsaporta', 'user_id', 'dest', 'DOC'), +('letterbox_coll', 'LAFARGE', 'entity_id', 0, 'ccharles', 'user_id', 'cc', 'DOC'), +('letterbox_coll', 'LAFARGE', 'entity_id', 0, 'DAKARCHIV', 'entity_id', 'cc', 'DOC'); + + +INSERT INTO `mlb_coll_ext` (`res_id`, `category_id`, `exp_contact_id`, `exp_user_id`, `dest_contact_id`, `dest_user_id`, `nature_id`, `alt_identifier`, `admission_date`, `answer_type_bitmask`, `other_answer_desc`, `process_limit_date`, `process_notes`, `closing_date`, `alarm1_date`, `alarm2_date`, `flag_notif`, `flag_alarm1`, `flag_alarm2`) VALUES +(1, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(2, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '32767', 'test', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(3, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '101100', 'test', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(4, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(5, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(6, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(7, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '100000', 'tuyil', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(8, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(9, 'outgoing', NULL, NULL, NULL, NULL, 'simple_mail', '', '0000-00-00 00:00:00', '000000', '[Préciser]', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(10, 'internal', NULL, NULL, NULL, NULL, 'simple_mail', '', '0000-00-00 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(11, 'internal', NULL, NULL, NULL, NULL, 'simple_mail', '', '0000-00-00 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(12, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(13, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(14, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(15, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(16, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(17, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(18, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(19, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-20 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(20, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(21, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(22, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(23, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(24, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(25, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(26, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(27, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(28, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(29, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(30, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', 'test notes 1', NULL, NULL, NULL, 'N', 'N', 'N'), +(31, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '100000', 'test', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(32, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '000001', '[Préciser]', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(33, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '000001', '[Préciser]', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(34, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '100000', 'test lgi', '0000-00-00 00:00:00', 'ertetr', NULL, NULL, NULL, 'N', 'N', 'N'), +(35, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '000000', '[Préciser]', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(36, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(37, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '10000', '[Préciser]', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(38, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '100', '[Préciser]', '0000-00-00 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(39, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(40, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(41, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(42, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(43, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(44, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(45, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(46, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(47, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(48, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(49, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(50, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(51, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(52, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(53, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(54, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(55, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(56, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(57, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(58, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(59, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(60, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(61, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(62, 'outgoing', NULL, NULL, NULL, NULL, 'simple_mail', '', '0000-00-00 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(63, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(64, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-21 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(65, 'internal', NULL, NULL, NULL, NULL, 'simple_mail', '', '0000-00-00 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(66, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(67, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(68, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(69, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(70, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(71, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(72, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-27 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(73, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-27 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(74, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(75, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-27 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(76, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-27 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(77, 'outgoing', NULL, NULL, NULL, NULL, 'simple_mail', '', '0000-00-00 00:00:00', '', NULL, '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(78, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-27 00:00:00', '', NULL, '2009-08-25 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(79, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-07-27 00:00:00', '000000', '[Préciser]', '2009-08-25 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(80, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-08-03 00:00:00', '', NULL, '2009-09-01 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(81, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(82, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(83, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(84, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(85, 'incoming', NULL, NULL, NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(87, 'incoming', 5, NULL, NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(88, 'incoming', 3, NULL, NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(89, 'incoming', NULL, '0', NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '001000', '[Préciser]', '2009-09-04 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(90, 'incoming', NULL, '0', NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '000000', '[Préciser]', '2009-09-04 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(91, 'incoming', NULL, 'pparker', NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '000000', '[Préciser]', '2009-09-04 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(92, 'incoming', NULL, 'pparker', NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(93, 'outgoing', NULL, NULL, NULL, 'pparker', 'simple_mail', '', '0000-00-00 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(94, 'outgoing', NULL, NULL, 1, NULL, 'simple_mail', '', '0000-00-00 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(95, 'internal', NULL, NULL, NULL, 'ccharles', 'simple_mail', '', '0000-00-00 00:00:00', '000000', '[Préciser]', '2009-09-04 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(96, 'internal', NULL, NULL, 4, NULL, 'simple_mail', '', '0000-00-00 00:00:00', '', NULL, '2009-09-04 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(97, 'incoming', 9, NULL, NULL, NULL, 'simple_mail', '', '2009-08-06 00:00:00', '000000', '[Préciser]', '2009-09-04 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(98, 'incoming', 8, NULL, NULL, NULL, 'simple_mail', '', '2009-08-10 00:00:00', '000000', '[Préciser]', '2009-09-08 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(99, 'incoming', 5, NULL, NULL, NULL, 'simple_mail', '', '2009-08-10 00:00:00', '', NULL, '2009-09-08 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(100, 'incoming', 5, NULL, NULL, NULL, 'simple_mail', '', '2009-08-10 00:00:00', '', NULL, '2009-09-08 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(101, 'incoming', 1, NULL, NULL, NULL, 'simple_mail', '', '2009-08-11 00:00:00', '', NULL, '2009-09-09 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(102, 'incoming', 1, NULL, NULL, NULL, 'simple_mail', '', '2009-08-13 00:00:00', '000000', '[Préciser]', '2009-09-11 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(103, 'incoming', 5, NULL, NULL, NULL, 'simple_mail', '', '2009-08-13 00:00:00', '000000', '[Préciser]', '2009-09-11 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(104, 'incoming', 5, NULL, NULL, NULL, 'simple_mail', '', '2009-08-14 00:00:00', '000000', NULL, '2009-09-14 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(105, 'incoming', 5, NULL, NULL, NULL, 'simple_mail', '', '2009-08-18 00:00:00', '000000', '[Préciser]', '2009-09-16 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'), +(106, 'incoming', 5, NULL, NULL, NULL, 'simple_mail', '', '2009-08-18 00:00:00', '000000', NULL, '2009-09-16 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(107, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '000000', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(108, 'market_document', NULL, NULL, NULL, NULL, '', '', '0000-00-00 00:00:00', '000000', NULL, NULL, NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(109, 'incoming', 8, NULL, NULL, NULL, 'simple_mail', '', '2009-08-21 00:00:00', '000000', NULL, '2009-09-21 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(110, 'incoming', 3, NULL, NULL, NULL, 'simple_mail', '', '2009-08-28 00:00:00', '000000', NULL, '2009-09-28 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(111, 'incoming', 8, NULL, NULL, NULL, 'other', '', '2009-08-28 00:00:00', '000000', NULL, '2009-09-11 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(112, 'incoming', 8, NULL, NULL, NULL, 'simple_mail', '', '2009-08-28 00:00:00', '000000', NULL, '2009-09-28 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'), +(113, 'incoming', 8, NULL, NULL, NULL, 'simple_mail', '', '2009-08-31 00:00:00', '000000', NULL, '2009-09-29 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'); + + + +INSERT INTO `mlb_doctype_ext` (`type_id`, `process_delay`, `delay1`, `delay2`) VALUES +(44, 21, 14, 1), +(43, 21, 14, 1), +(45, 21, 14, 1), +(46, 21, 14, 1), +(47, 21, 14, 1), +(48, 21, 14, 1), +(49, 21, 14, 1), +(50, 10, 14, 1), +(51, 21, 14, 1), +(52, 21, 14, 1), +(53, 21, 14, 1), +(54, 21, 14, 1); + + +INSERT INTO `notes` (`id`, `identifier`, `tablename`, `user_id`, `date`, `note_text`, `coll_id`) VALUES +(1, 79, '', 'pparker', '2009-07-28', 'test note', 'letterbox_coll'), +(2, 3, '', 'pparker', '2009-07-28', 'test note', 'letterbox_coll'), +(3, 3, '', 'pparker', '2009-07-28', 'test 2', 'letterbox_coll'), +(4, 91, '', 'pparker', '2009-08-18', 'test note1jhyuui', 'letterbox_coll'), +(5, 102, '', 'pparker', '2009-08-18', 'âkiuzÄÂéù', 'letterbox_coll'), +(6, 89, '', 'pparker', '2009-08-20', 'hello', 'letterbox_coll'), +(7, 32, '', 'pparker', '2009-08-20', 'test2', 'letterbox_coll'), +(8, 105, '', 'pparker', '2009-08-21', 'ceci est une note', 'letterbox_coll'), +(9, 110, '', 'pparker', '2009-08-28', 'dsf sdfdsf sdf sfdsf', 'letterbox_coll'); + + +INSERT INTO `parameters` (`id`, `param_value_string`, `param_value_int`) VALUES +('workbatch_rec', '', 7), +('folder_id_increment', '', 152), +('work_batch_autoimport_id', NULL, 1), +('apa_reservation_batch', NULL, 1), +('ar_index__', NULL, 3), +('ar_index_pparker_incoming', NULL, 3), +('ar_index_pparker_outgoing', NULL, 3), +('ar_index_pparker_internal', NULL, 3), +('ar_index_pparker_market_document', NULL, 3); + + +INSERT INTO `res_attachments` (`res_id`, `title`, `subject`, `description`, `publisher`, `contributor`, `type_id`, `format`, `typist`, `creation_date`, `fulltext_result`, `ocr_result`, `author`, `author_name`, `identifier`, `source`, `doc_language`, `relation`, `coverage`, `doc_date`, `docserver_id`, `folders_system_id`, `arbox_id`, `path`, `filename`, `offset_doc`, `logical_adr`, `fingerprint`, `filesize`, `is_paper`, `page_count`, `scan_date`, `scan_user`, `scan_location`, `scan_wkstation`, `scan_batch`, `burn_batch`, `scan_postmark`, `envelop_id`, `status`, `destination`, `approver`, `validation_date`, `work_batch`, `origin`, `is_ingoing`, `priority`, `initiator`, `dest_user`, `coll_id`, `res_id_master`) VALUES +(1, 'test ', NULL, NULL, NULL, NULL, 0, 'txt', 'pparker', '2009-07-28 17:31:24', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox', NULL, NULL, '1#', '94.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox_coll', 31), +(2, 'test', NULL, NULL, NULL, NULL, 0, 'txt', 'pparker', '2009-08-03 10:14:23', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox', NULL, NULL, '1#', '96.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox_coll', 7), +(3, 'test', NULL, NULL, NULL, NULL, 0, 'PDF', 'pparker', '2009-08-20 12:14:56', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox', NULL, NULL, '1#', '150.PDF', ' ', ' ', '4eeb91472fec776be9eb6284561738f2', 354039, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox_coll', 89), +(4, 'test2', NULL, NULL, NULL, NULL, 0, 'PDF', 'pparker', '2009-08-20 12:15:57', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox', NULL, NULL, '1#', '151.PDF', ' ', ' ', '6e6bdb3b8e2f3080ca3376db357a4581', 88384, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox_coll', 32), +(5, 'test3', NULL, NULL, NULL, NULL, 0, 'PDF', 'pparker', '2009-08-20 12:16:32', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox', NULL, NULL, '1#', '152.PDF', ' ', ' ', 'ede161763ba3fcab980f6d080d433ca6', 77584, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox_coll', 33), +(6, 'test4', NULL, NULL, NULL, NULL, 0, 'PDF', 'pparker', '2009-08-20 12:17:22', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox', NULL, NULL, '1#', '153.PDF', ' ', ' ', 'ede161763ba3fcab980f6d080d433ca6', 77584, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox_coll', 34), +(7, '_test2_20082009', NULL, NULL, NULL, NULL, 0, 'maarch', 'pparker', '2009-08-20 16:07:13', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox', NULL, NULL, '1#', '154.maarch', ' ', ' ', '9fbed89d721a65f4d5e6dd311df86eaf', 163, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'letterbox_coll', 105); + + + +INSERT INTO `res_letterbox` (`res_id`, `title`, `subject`, `description`, `publisher`, `contributor`, `type_id`, `format`, `typist`, `creation_date`, `fulltext_result`, `ocr_result`, `converter_result`, `author`, `author_name`, `identifier`, `source`, `doc_language`, `relation`, `coverage`, `doc_date`, `docserver_id`, `folders_system_id`, `arbox_id`, `path`, `filename`, `offset_doc`, `logical_adr`, `fingerprint`, `filesize`, `is_paper`, `page_count`, `scan_date`, `scan_user`, `scan_location`, `scan_wkstation`, `scan_batch`, `burn_batch`, `scan_postmark`, `envelop_id`, `status`, `destination`, `approver`, `validation_date`, `work_batch`, `origin`, `is_ingoing`, `priority`, `arbatch_id`, `custom_t1`, `custom_n1`, `custom_f1`, `custom_d1`, `custom_t2`, `custom_n2`, `custom_f2`, `custom_d2`, `custom_t3`, `custom_n3`, `custom_f3`, `custom_d3`, `custom_t4`, `custom_n4`, `custom_f4`, `custom_d4`, `custom_t5`, `custom_n5`, `custom_f5`, `custom_d5`, `custom_t6`, `custom_d6`, `custom_t7`, `custom_d7`, `custom_t8`, `custom_d8`, `custom_t9`, `custom_d9`, `custom_t10`, `custom_d10`, `custom_t11`, `custom_t12`, `custom_t13`, `custom_t14`, `custom_t15`, `tablename`, `initiator`, `dest_user`, `video_batch`, `video_time`, `video_user`) VALUES +(1, NULL, 'aaaaaaaaaaaaaaa', NULL, NULL, NULL, 51, 'txt', 'pparker', '2009-07-20 17:12:02', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '9.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'LAFARGE', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(2, NULL, 'ccccccccccccccccc', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-20 17:14:59', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '10.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(3, NULL, 'ddddddddddddd\r\nkjyti\r\nkykguç thyrtio ghtyuiopp frtyuio drftgyuiojp^sdfghjkl dertyuio dsfgtyuio sdfghjkl dertyuiop^sdfghjk\r\n', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-20 17:15:59', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', 11, NULL, '1#', '11.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(4, NULL, 'eeeeeeeeeee', NULL, NULL, NULL, 49, 'txt', 'pparker', '2009-07-20 17:19:12', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '12.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(5, NULL, 'ffffffffffffffffff', NULL, NULL, NULL, 51, 'txt', 'pparker', '2009-07-20 17:20:57', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '13.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(6, NULL, 'gggggggggggg', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-20 17:23:01', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '14.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'LAFARGE', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(7, NULL, 'hhhhhhhhhhhhhhhhhhhhhhhhhhh', NULL, NULL, NULL, 49, 'txt', 'pparker', '2009-07-20 17:25:26', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', 13, NULL, '1#', '15.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(8, NULL, 'iiiiiiiiiiiiiiiiiiiiiii', NULL, NULL, NULL, 50, 'txt', 'pparker', '2009-07-20 17:28:26', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '16.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(9, NULL, 'rrrrrrrrrrrrrrrr', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-20 17:30:19', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', 11, NULL, '1#', '17.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(10, NULL, 'kkkkkkkkkkkk', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-20 17:33:23', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '18.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(11, NULL, 'lllllllllllll', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-20 17:35:35', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '19.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'LAFARGE', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(12, NULL, 'mmmmmmmmmmm', NULL, NULL, NULL, 50, 'txt', 'pparker', '2009-07-20 17:40:07', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '20.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(13, NULL, 'nnnnnnnnnnnnnn', NULL, NULL, NULL, 50, 'txt', 'pparker', '2009-07-20 17:41:14', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '21.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(14, NULL, 'oooooooooooooooooooooo', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-20 17:43:42', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '22.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(15, NULL, 'dddd', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-20 17:46:24', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '23.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(16, NULL, 'yyyyyyyyyyyyyyyyyyy', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-20 17:54:09', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '24.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(17, NULL, 'rfrrrr', NULL, NULL, NULL, 50, 'txt', 'pparker', '2009-07-20 17:55:08', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '25.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'LAFARGE', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(18, NULL, 'cccc', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-20 17:56:25', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '26.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(19, NULL, 'wwwwwwwww', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-20 17:58:23', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-20 00:00:00', 'letterbox', NULL, NULL, '1#', '27.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(20, NULL, 'ddddd', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-21 10:13:19', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '28.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(21, NULL, 'eeeeeeeeeeeee', NULL, NULL, NULL, 50, 'txt', 'pparker', '2009-07-21 10:24:43', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '29.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(22, NULL, 'sss', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 10:30:01', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '30.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(23, NULL, 'ffff', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-21 10:31:51', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '31.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(24, NULL, 'eee', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-21 10:34:33', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '32.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(25, NULL, 'rrr', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-21 10:36:31', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '33.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'LAFARGE', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(26, NULL, 'dfdd', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-21 10:40:20', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '34.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(27, NULL, 'dddd', NULL, NULL, NULL, 50, 'txt', 'pparker', '2009-07-21 10:41:12', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '35.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(28, NULL, 'ddd', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-21 10:53:20', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '36.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(29, NULL, 'eee', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-21 10:59:01', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '38.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(30, NULL, 'ddd', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:01:02', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '39.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(31, NULL, 'ddd', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:01:49', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', 11, NULL, '1#', '40.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(32, NULL, 'ss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:02:50', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', 12, NULL, '1#', '41.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'COU', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(33, NULL, 'ss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:03:38', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', 13, NULL, '1#', '42.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'DIS', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(34, NULL, 'ss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:04:43', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', 7, NULL, '1#', '43.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(35, NULL, 'ss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:05:24', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', 11, NULL, '1#', '44.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'COU', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(36, NULL, 'ss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:06:03', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '45.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(37, NULL, 'ss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:07:23', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '46.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'END', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(38, NULL, 'ss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:08:21', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '47.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'END', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(39, NULL, 'ddd', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:09:17', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '48.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(40, NULL, 'ddd', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:09:47', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '49.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(41, NULL, 'ddd', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:11:01', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '50.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(42, NULL, 'ddd', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:17:50', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '51.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(43, NULL, 'ddd', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:20:02', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '52.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(44, NULL, 'ddd', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-21 11:20:22', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '53.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(45, NULL, 'ddd', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-21 11:21:24', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '54.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(46, NULL, 'ddd', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-21 11:22:04', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '55.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(47, NULL, 'eeee', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:23:19', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '56.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(48, NULL, ';lkkk', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:24:18', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '57.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(49, NULL, ';lkkk', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:24:43', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '58.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(50, NULL, 'kjhup', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-21 11:26:20', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '59.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(51, NULL, 'fff', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-21 11:27:18', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '60.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(52, NULL, 'fgfgfggf', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:27:52', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '61.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(53, NULL, 'fgfgfggf', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:29:34', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '62.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(54, NULL, 'fgfgfggf', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:30:39', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '63.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(55, NULL, 'fgfgfggf', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:31:29', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '64.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(56, NULL, 'fgfgfggf', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:31:59', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '65.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(57, NULL, 'fgfgfggf', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:33:40', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '66.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(58, NULL, 'fgfgfggf', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 11:40:51', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '67.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(59, NULL, 'ddd', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-21 11:41:55', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '68.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(60, NULL, 'eee', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-07-21 11:48:39', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '69.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(61, NULL, 'sxsss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-21 12:20:08', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '70.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(62, NULL, 'ddddd', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-21 16:03:16', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '71.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'LAFARGE', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(63, NULL, 'ddd', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-21 16:20:42', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '72.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'DAKARCHIV', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(64, NULL, 'ddd', NULL, NULL, NULL, 51, 'txt', 'pparker', '2009-07-21 16:22:14', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '73.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'DAKARCHIV', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(65, NULL, 'dddd', NULL, NULL, NULL, 50, 'txt', 'pparker', '2009-07-21 16:29:20', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '74.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(66, NULL, 'ssss', NULL, NULL, NULL, 52, 'txt', 'pparker', '2009-07-21 16:31:40', '-2', NULL, NULL, 'toto', NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '75.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(67, NULL, 'dddd', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-21 16:33:53', '-2', NULL, NULL, 'dddd', NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '76.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(68, NULL, 'ddd', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-21 16:38:13', '-2', NULL, NULL, 'ddd', NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '77.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(69, NULL, 'ddd', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-21 17:01:59', '-2', NULL, NULL, 'ddd', NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '78.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(70, NULL, 'ttttttt', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-07-21 17:02:53', '-2', NULL, NULL, 'sddd', NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '79.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(71, NULL, 'fff', NULL, NULL, NULL, 51, 'txt', 'pparker', '2009-07-21 17:04:35', '-2', NULL, NULL, 'dff', NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-21 00:00:00', 'letterbox', NULL, NULL, '1#', '80.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(72, NULL, 'eee', NULL, NULL, NULL, 54, 'maarch', 'pparker', '2009-07-27 10:39:55', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-27 00:00:00', 'letterbox', NULL, NULL, '1#', '82.maarch', ' ', ' ', '3099e6cfc58eb0f75b7efc117495b245', 39, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(73, NULL, 'zzzz', NULL, NULL, NULL, 54, 'maarch', 'pparker', '2009-07-27 10:42:00', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-27 00:00:00', 'letterbox', NULL, NULL, '1#', '84.maarch', ' ', ' ', '3099e6cfc58eb0f75b7efc117495b245', 39, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(74, NULL, 'azzzz', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-27 11:44:35', '-2', NULL, NULL, 'cccc', NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-27 00:00:00', 'letterbox', NULL, NULL, '1#', '85.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(75, NULL, 'sss', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-07-27 15:03:28', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-27 00:00:00', 'letterbox', NULL, NULL, '1#', '88.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(76, NULL, 'ddd', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-27 15:11:43', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-27 00:00:00', 'letterbox', NULL, NULL, '1#', '89.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL); +INSERT INTO `res_letterbox` (`res_id`, `title`, `subject`, `description`, `publisher`, `contributor`, `type_id`, `format`, `typist`, `creation_date`, `fulltext_result`, `ocr_result`, `converter_result`, `author`, `author_name`, `identifier`, `source`, `doc_language`, `relation`, `coverage`, `doc_date`, `docserver_id`, `folders_system_id`, `arbox_id`, `path`, `filename`, `offset_doc`, `logical_adr`, `fingerprint`, `filesize`, `is_paper`, `page_count`, `scan_date`, `scan_user`, `scan_location`, `scan_wkstation`, `scan_batch`, `burn_batch`, `scan_postmark`, `envelop_id`, `status`, `destination`, `approver`, `validation_date`, `work_batch`, `origin`, `is_ingoing`, `priority`, `arbatch_id`, `custom_t1`, `custom_n1`, `custom_f1`, `custom_d1`, `custom_t2`, `custom_n2`, `custom_f2`, `custom_d2`, `custom_t3`, `custom_n3`, `custom_f3`, `custom_d3`, `custom_t4`, `custom_n4`, `custom_f4`, `custom_d4`, `custom_t5`, `custom_n5`, `custom_f5`, `custom_d5`, `custom_t6`, `custom_d6`, `custom_t7`, `custom_d7`, `custom_t8`, `custom_d8`, `custom_t9`, `custom_d9`, `custom_t10`, `custom_d10`, `custom_t11`, `custom_t12`, `custom_t13`, `custom_t14`, `custom_t15`, `tablename`, `initiator`, `dest_user`, `video_batch`, `video_time`, `video_user`) VALUES +(77, NULL, 'ccc', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-27 15:13:04', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-27 00:00:00', 'letterbox', NULL, NULL, '1#', '90.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(78, NULL, 'dddd', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-07-27 15:14:04', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-27 00:00:00', 'letterbox', NULL, NULL, '1#', '91.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(79, NULL, 'ddd', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-07-27 15:19:32', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-27 00:00:00', 'letterbox', 14, NULL, '1#', '93.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(80, NULL, 'ddd', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-08-03 10:10:52', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-03 00:00:00', 'letterbox', NULL, '3', '1#', '95.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(81, NULL, 'test contact arrivée', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-08-06 11:02:46', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '97.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(82, NULL, 'test contact arrivée 2', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 11:05:38', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '98.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(83, NULL, 'test contact arrivée 2', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 11:06:49', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '99.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(84, NULL, 'test contact arrivée 2', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 11:07:47', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '100.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(85, NULL, 'test contact arrivée 2', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 11:09:17', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '101.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(86, NULL, 'test contact arrivée 2', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 11:11:09', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '102.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(87, NULL, 'test contact arrivée 2', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 11:11:54', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '103.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(88, NULL, 'arrivée externe', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-08-06 11:15:02', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '104.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(89, NULL, 'arrivée interne', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-08-06 11:16:13', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', 11, '3', '1#', '105.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'DIS', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(90, NULL, 'arrivée interne', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 11:17:34', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', 16, '3', '1#', '106.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(91, NULL, 'arrivée interne', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 11:18:40', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', 12, '3', '1#', '107.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(92, NULL, 'arrivée interne', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-08-06 11:19:54', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '108.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'LAFARGE', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(93, NULL, 'depart interne', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-06 15:12:01', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '109.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(94, NULL, 'depart externe', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-08-06 15:12:57', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '110.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(95, NULL, 'interne interne', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-08-06 15:14:41', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', 13, '3', '1#', '112.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(96, NULL, 'interne externe', NULL, NULL, NULL, 45, 'txt', 'pparker', '2009-08-06 15:21:27', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', NULL, '3', '1#', '116.txt', ' ', ' ', 'bcdaabfc634c499a9ccf657a66df15a1', 1668, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(97, NULL, 'test', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-08-06 16:49:29', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-06 00:00:00', 'letterbox', 13, '3', '1#', '120.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(98, NULL, 'test folder', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-10 17:15:44', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-10 00:00:00', 'letterbox', 16, '3', '1#', '121.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(99, NULL, 'eee', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-10 17:40:09', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-10 00:00:00', 'letterbox', 15, '3', '1#', '122.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(100, NULL, 'eee', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-10 17:40:34', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-10 00:00:00', 'letterbox', 15, '3', '1#', '123.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(101, NULL, 'testyufkli', NULL, NULL, NULL, 52, 'txt', 'pparker', '2009-08-11 09:47:11', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-11 00:00:00', 'letterbox', 13, '3', '1#', '124.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(102, NULL, 'dddd', NULL, NULL, NULL, 52, 'txt', 'pparker', '2009-08-13 15:59:05', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-13 00:00:00', 'letterbox', 11, '3', '1#', '125.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(103, NULL, 'rererer', NULL, NULL, NULL, 43, 'txt', 'pparker', '2009-08-13 16:00:23', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-13 00:00:00', 'letterbox', 12, '3', '1#', '126.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 0, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(104, NULL, 'test validation', NULL, NULL, NULL, 52, 'txt', 'pparker', '2009-08-14 17:01:57', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-11 00:00:00', 'letterbox', 16, '3', '1#', '127.txt', ' ', ' ', 'e997752d4cb825b26152c804085107c9', 830, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(105, NULL, 'sddd', NULL, NULL, NULL, 46, 'txt', 'pparker', '2009-08-18 11:44:27', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-18 00:00:00', 'letterbox', 7, '3', '1#', '136.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'COU', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(106, NULL, '&é\\\\\\"\\\\\\''(-è_çà )=}{', NULL, NULL, NULL, 47, 'txt', 'pparker', '2009-08-18 11:45:34', '-2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-18 00:00:00', 'letterbox', NULL, '3', '1#', '137.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'LAFARGE', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(107, NULL, '&é\\\\\\"\\\\\\''(-è_çà )=~', NULL, NULL, NULL, 51, 'txt', 'pparker', '2009-08-18 11:48:41', '-2', NULL, NULL, 'ddd', NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-18 00:00:00', 'letterbox', 13, '3', '1#', '138.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(108, NULL, '&é\\\\\\"\\\\\\''(-è_çà )=', NULL, NULL, NULL, 44, 'txt', 'pparker', '2009-08-18 11:55:12', '-2', NULL, NULL, 'ddd', NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-18 00:00:00', 'letterbox', 13, '3', '1#', '139.txt', ' ', ' ', '8f0e2cd40e05189ec81232da84bd6e1a', 35148, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, NULL, NULL, NULL, NULL), +(109, NULL, 'test', NULL, NULL, NULL, 45, 'pdf', 'pparker', '2009-08-21 15:37:01', '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-21 00:00:00', 'letterbox', NULL, '3', '1#', '155.pdf', ' ', ' ', '0477792eceecee7adf512f4f6329796e', 247367, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'APIX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(110, NULL, 'test', NULL, NULL, NULL, 44, 'pdf', 'pparker', '2009-08-28 16:07:10', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-28 00:00:00', 'letterbox', NULL, '3', '1#', '156.pdf', ' ', ' ', '0477792eceecee7adf512f4f6329796e', 247367, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(111, NULL, 'test', NULL, NULL, NULL, 50, 'pdf', 'pparker', '2009-08-28 18:24:09', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-28 00:00:00', 'letterbox', NULL, '3', '1#', '157.pdf', ' ', ' ', '0477792eceecee7adf512f4f6329796e', 247367, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL), +(112, NULL, 'test', NULL, NULL, NULL, 47, 'pdf', 'pparker', '2009-08-28 18:25:35', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-28 00:00:00', 'letterbox', NULL, '3', '1#', '158.pdf', ' ', ' ', '0477792eceecee7adf512f4f6329796e', 247367, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ARCHIVECO', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bsaporta', NULL, NULL, NULL), +(113, NULL, 'test', NULL, NULL, NULL, 49, 'pdf', 'pparker', '2009-08-31 15:37:13', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-08-31 00:00:00', 'letterbox', 7, '3', '1#', '159.pdf', ' ', ' ', '0477792eceecee7adf512f4f6329796e', 247367, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NEW', 'ECONOMBOX', NULL, NULL, NULL, NULL, NULL, 2, '61', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'pparker', NULL, NULL, NULL); + +INSERT INTO `saved_queries` (`query_id`, `user_id`, `query_name`, `creation_date`, `created_by`, `query_type`, `query_txt`, `last_modification_date`) VALUES +(12, 'pparker', 'fulltext1', '2009-08-21 15:46:32', 'pparker', 'my_search', '{''copies'' : { ''type'' : ''radio'', ''fields'' : {''copies_false'' : [''false'']}},''subject'' : { ''type'' : ''input_text'', ''fields'' : {}},''fulltext'' : { ''type'' : ''input_text'', ''fields'' : { ''fulltext'' : [''test'']}},''numged'' : { ''type'' : ''input_text'', ''fields'' : {}},''multifield'' : { ''type'' : ''input_text'', ''fields'' : {}}}', NULL); + +INSERT INTO `security` (`group_id`, `coll_id`, `where_clause`, `maarch_comment`, `can_insert`, `can_update`, `can_delete`) VALUES +('Recovery', 'letterbox_coll', ' ', '', 'Y', 'Y', 'Y'), +('Accountants', 'coll_2', ' ', '', 'Y', 'Y', 'N'); + +INSERT INTO `status` (`id`, `label_status`, `is_system`, `img_filename`, `maarch_module`, `can_be_searched`) VALUES +('COU', 'En cours', 'Y', 'mail.gif', 'apps', 'Y'), +('NEW', 'Nouveau courrier', 'Y', 'mail_new.gif', 'apps', 'Y'), +('RSV', 'Reserve', 'N', '', 'apps', 'N'), +('DEL', 'Supprime', 'Y', NULL, 'apps', 'N'), +('END', 'Clos', 'Y', 'mail_end.gif', 'apps', 'Y'), +('VAL', 'A valider', 'Y', NULL, 'apps', 'N'), +('OUT', 'Prelevee', 'N', '', 'advanced_physical_archive', 'N'), +('POS', 'Reintegree', 'N', '', 'advanced_physical_archive', 'N'); + +INSERT INTO `templates` (`id`, `label`, `creation_date`, `template_comment`, `content`) VALUES +(1, 'test', '2009-07-02 11:34:25', 'test', '<p>qsdqsdsd [DOCTYPE]</p>\r\n<p>[NOW]</p>'), +(2, 'test2', '2009-08-20 16:01:00', 'test2', '<p>Bonjour,</p>\r\n<p> </p>\r\n<p>veuillez... [CONTACT_LASTNAME]</p>\r\n<p> </p>\r\n<p><font face=""arial">[USER_LASTNAME]</font></p>\r\n<p> </p>\r\n<p>[ADMISSION_DATE]</p>\r\n<p> </p>\r\n<p>[CHRONO][CURRENT_USER_EMAIL]</p>'); + +INSERT INTO `templates_association` (`template_id`, `what`, `value_field`, `system_id`, `maarch_module`) VALUES +(2, 'destination', 'ECONOMBOX', 1, 'entities'), +(2, 'destination', 'ARCHIVECO', 2, 'entities'), +(2, 'destination', 'WARNER', 3, 'entities'), +(2, 'destination', 'test', 4, 'entities'), +(2, 'destination', 'LAFARGE', 5, 'entities'), +(2, 'destination', 'DAKARCHIV', 6, 'entities'), +(2, 'destination', 'APIX', 7, 'entities'); + +INSERT INTO `templates_doctype_ext` (`template_id`, `type_id`, `is_generated`) VALUES +(NULL, 47, 'N'), +(NULL, 46, 'N'), +(NULL, 45, 'N'), +(NULL, 48, 'N'), +(NULL, 44, 'N'), +(NULL, 43, 'N'), +(NULL, 49, 'N'), +(NULL, 50, 'N'), +(NULL, 51, 'N'), +(NULL, 52, 'N'), +(NULL, 53, 'N'), +(1, 54, 'Y'); + +INSERT INTO `usergroups` (`group_id`, `group_desc`, `administrator`, `custom_right1`, `custom_right2`, `custom_right3`, `custom_right4`, `enabled`) VALUES +('Recovery', 'Recovery - Recouvrement', '', '', '', '', '', 'Y'), +('Admin', 'Administration', 'N', 'N', 'N', 'N', 'N', 'Y'), +('Accountants', 'Accountants - Comptables', 'N', 'N', 'N', 'N', 'N', 'Y'), +('Managers', 'Customer managers - Gestionnaires de comptes', 'N', 'N', 'N', 'N', 'N', 'Y'), +('Clients', 'Clients', '', '', '', '', '', 'Y'), +('Operator', 'Operateur - Operator', 'N', 'N', 'N', 'N', 'N', 'Y'), +('Archivists', 'Archivistes - Archivists', 'N', 'N', 'N', 'N', 'N', 'Y'); + + +INSERT INTO `usergroups_services` (`group_id`, `service_id`) VALUES +('Accountants', '_print_sep'), +('Accountants', 'admin'), +('Accountants', 'admin_architecture'), +('Accountants', 'admin_baskets'), +('Accountants', 'admin_foldertypes'), +('Accountants', 'admin_groups'), +('Accountants', 'admin_tree_autofoldering'), +('Accountants', 'admin_users'), +('Accountants', 'adv_search'), +('Accountants', 'delete_folder'), +('Accountants', 'delete_res'), +('Accountants', 'folder_search'), +('Accountants', 'indexing'), +('Accountants', 'launch_workflow'), +('Accountants', 'modify_folder'), +('Accountants', 'modify_res'), +('Accountants', 'physical_archive'), +('Accountants', 'physical_archive_box_manage'), +('Accountants', 'physical_archive_box_read'), +('Accountants', 'view_attached_files'), +('Accountants', 'view_baskets'), +('Accountants', 'view_history'), +('Accountants', 'view_trees'), +('Admin', '_print_sep'), +('Admin', 'admin'), +('Admin', 'admin_architecture'), +('Admin', 'admin_baskets'), +('Admin', 'admin_foldertypes'), +('Admin', 'admin_groups'), +('Admin', 'admin_tree_autofoldering'), +('Admin', 'admin_users'), +('Admin', 'adv_search'), +('Admin', 'create_folder'), +('Admin', 'delete_folder'), +('Admin', 'delete_res'), +('Admin', 'folder_search'), +('Admin', 'index_file'), +('Admin', 'index_file2'), +('Admin', 'indexing'), +('Admin', 'modify_folder'), +('Admin', 'modify_res'), +('Admin', 'physical_archive'), +('Admin', 'physical_archive_box_manage'), +('Admin', 'physical_archive_box_read'), +('Admin', 'physical_archive_lot_manage'), +('Admin', 'physical_archive_lot_read'), +('Admin', 'salary_sheet'), +('Admin', 'select_doctype'), +('Admin', 'select_doctype2'), +('Admin', 'select_folder'), +('Admin', 'show_contract_history'), +('Admin', 'show_history_folder'), +('Admin', 'show_missing_doc_in_folder'), +('Admin', 'use_baskets'), +('Admin', 'view_history'), +('Admin', 'view_stats'), +('Admin', 'view_trees'), +('Archivists', 'admin_apa'), +('Archivists', 'manage_apa'), +('Archivists', 'manage_entities'), +('Clients', 'reserve_apa'), +('Managers', '_print_sep'), +('Managers', 'admin'), +('Managers', 'admin_architecture'), +('Managers', 'admin_baskets'), +('Managers', 'admin_foldertypes'), +('Managers', 'admin_groups'), +('Managers', 'admin_tree_autofoldering'), +('Managers', 'admin_users'), +('Managers', 'adv_search'), +('Managers', 'delete_folder'), +('Managers', 'delete_res'), +('Managers', 'folder_search'), +('Managers', 'indexing'), +('Managers', 'modify_folder'), +('Managers', 'modify_res'), +('Managers', 'physical_archive'), +('Managers', 'physical_archive_batch_manage'), +('Managers', 'physical_archive_batch_read'), +('Managers', 'physical_archive_box_manage'), +('Managers', 'physical_archive_box_read'), +('Managers', 'view_attached_files'), +('Managers', 'view_history'), +('Managers', 'view_trees'), +('Operator', 'admin'), +('Operator', 'admin_actions'), +('Operator', 'admin_apa'), +('Operator', 'admin_architecture'), +('Operator', 'admin_baskets'), +('Operator', 'admin_groups'), +('Operator', 'admin_status'), +('Operator', 'admin_users'), +('Operator', 'adv_search'), +('Operator', 'delete_res'), +('Operator', 'indexing'), +('Operator', 'manage_apa'), +('Operator', 'manage_entities'), +('Operator', 'modify_res'), +('Operator', 'reserve_apa'), +('Operator', 'view_history'), +('Operator', 'xml_param_services'), +('Recovery', 'add_copy_in_process'), +('Recovery', 'admin'), +('Recovery', 'admin_actions'), +('Recovery', 'admin_architecture'), +('Recovery', 'admin_baskets'), +('Recovery', 'admin_contacts'), +('Recovery', 'admin_foldertypes'), +('Recovery', 'admin_groups'), +('Recovery', 'admin_status'), +('Recovery', 'admin_templates'), +('Recovery', 'admin_users'), +('Recovery', 'adv_search_mlb'), +('Recovery', 'delete_folder'), +('Recovery', 'folder_search'), +('Recovery', 'index_mlb'), +('Recovery', 'manage_entities'), +('Recovery', 'modify_folder'), +('Recovery', 'search_customer'), +('Recovery', 'view_history'); + +INSERT INTO `usergroup_content` (`user_id`, `group_id`, `primary_group`, `role`) VALUES +('pparker', 'Recovery', 'Y', 'Service manager'), +('ccharles', 'Accountants', 'Y', 'Clerck'), +('bsaporta', 'Managers', 'Y', 'Account manager'), +('ccharles', 'Archivists', 'N', 'Clerck'), +('bblier', 'Clients', 'Y', 'Archiviste client Warner'), +('ppetit', 'Clients', 'Y', 'Archiviste client Apix'), +('bsaporta', 'Archivists', 'N', 'Account manager'), +('pparker', 'Operator', 'N', 'Service manager'); + +INSERT INTO `users` (`user_id`, `password`, `firstname`, `lastname`, `phone`, `mail`, `department`, `custom_t1`, `custom_t2`, `custom_t3`, `cookie_key`, `cookie_date`, `enabled`, `change_password`, `delay`, `status`) VALUES +('pparker', 'ef9689be896dacd901cae4f13593e90d', 'Peter', 'Parker', '+33 1 47 24 51 ', 'info@maarch.org', 'Financial - DFI', '7', NULL, NULL, '53f65875519cbf89caa3d99453138b76', '2009-08-31 15:08:44', 'Y', 'N', NULL, 'OK'), +('ccharles', 'ef9689be896dacd901cae4f13593e90d', 'Charlotte', 'Charles', '+33 1 47 24 51 ', 'info@maarch.org', 'Accounting department - DFI', NULL, NULL, NULL, '2b67f8017119d7de32f300be3e97ccb4', '2008-09-10 15:09:23', 'Y', 'N', NULL, 'OK'), +('bsaporta', 'ef9689be896dacd901cae4f13593e90d', 'Barbara', 'Saporta', '+33 1 47 24 51 ', 'info@maarch.org', 'Sales - Commercial', NULL, NULL, NULL, '35286c2c7b64e9ae8dc1d88ef78814d4', '2008-09-10 15:09:23', 'Y', 'N', NULL, 'OK'), +('superadmin', '17c4520f6cfd1ab53d8745e84681eb49', 'Super', 'Admin', '', 'admin@maarch.org', 'Maarch', '1', NULL, NULL, '01d762d294e06dea731e15403b039902', '2009-08-31 14:08:04', 'Y', 'N', NULL, 'OK'), +('bblier', 'ef9689be896dacd901cae4f13593e90d', 'Bernard', 'Blier', '+33 1 47 24 51 ', 'info@maarch.org', '', NULL, NULL, NULL, '', NULL, 'Y', 'Y', NULL, 'OK'), +('ppetit', 'ef9689be896dacd901cae4f13593e90d', 'Patricia', 'Petit', '+33 1 47 24 51 ', 'info@maarch.org', '', NULL, NULL, NULL, '', NULL, 'Y', 'Y', NULL, 'OK'); + + +INSERT INTO `users_entities` (`user_id`, `entity_id`, `user_role`, `primary_entity`) VALUES +('pparker', 'ECONOMBOX', 'Manager EconomBox', 'Y'), +('ccharles', 'ARCHIVECO', 'Responsable Archiveco', 'Y'), +('bsaporta', 'DAKARCHIV', 'Responsable Dakarchiv', 'Y'); + diff --git a/maarch_entreprise/trunk/sql/data/apps.oracle.sql b/maarch_entreprise/trunk/sql/data/apps.oracle.sql new file mode 100644 index 0000000000000000000000000000000000000000..7ec97c84dd4cd32054243db0004abe12e09691f1 --- /dev/null +++ b/maarch_entreprise/trunk/sql/data/apps.oracle.sql @@ -0,0 +1,4 @@ +INSERT INTO doctypes_first_level VALUES (1, 'Pret immobilier - Real estate loan', 'Y'); +INSERT INTO doctypes_second_level VALUES (1, 'Identite - Identity', 1, 'Y'); +INSERT INTO doctypes_second_level VALUES (2, 'Revenus - Income', 1, 'Y'); +INSERT INTO doctypes_second_level VALUES (3, 'Objet du pret - Loan information', 1, 'Y'); diff --git a/maarch_entreprise/trunk/sql/data/apps.postgresql.sql b/maarch_entreprise/trunk/sql/data/apps.postgresql.sql new file mode 100644 index 0000000000000000000000000000000000000000..bb0a28815d68efe07b1e9c92faa9b29ebfb40e1c --- /dev/null +++ b/maarch_entreprise/trunk/sql/data/apps.postgresql.sql @@ -0,0 +1,726 @@ +-- Maarch LetterBox v3 sample data : Application + +-- DOCTYPES and LEVELS +INSERT INTO doctypes_first_level (doctypes_first_level_id, doctypes_first_level_label, enabled) VALUES (1, 'Courriers', 'Y'); +INSERT INTO doctypes_first_level (doctypes_first_level_id, doctypes_first_level_label, enabled) VALUES (2, 'Autres', 'Y'); +INSERT INTO doctypes_first_level (doctypes_first_level_id, doctypes_first_level_label, enabled) VALUES (10, 'C3', 'N'); + +INSERT INTO doctypes_second_level (doctypes_second_level_id, doctypes_second_level_label, doctypes_first_level_id, enabled) VALUES (1, 'Attribution', 1, 'Y'); +INSERT INTO doctypes_second_level (doctypes_second_level_id, doctypes_second_level_label, doctypes_first_level_id, enabled) VALUES (2, 'Avis', 1, 'Y'); +INSERT INTO doctypes_second_level (doctypes_second_level_id, doctypes_second_level_label, doctypes_first_level_id, enabled) VALUES (3, 'Decaissement', 1, 'Y'); +INSERT INTO doctypes_second_level (doctypes_second_level_id, doctypes_second_level_label, doctypes_first_level_id, enabled) VALUES (4, 'Divers', 1, 'Y'); +INSERT INTO doctypes_second_level (doctypes_second_level_id, doctypes_second_level_label, doctypes_first_level_id, enabled) VALUES (5, 'Suivi', 1, 'Y'); + +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 24, 'ATR - Attribution de marche', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 25, 'LCO - Lettre de commande', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 26, 'OFT - Offre Technique', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 27, 'OFI - Offre Financiere', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 29, 'PVO - Proces Verbal d Ouverture des offres', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 30, 'PVD - Proces Verbal de Depouillement des offres', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 31, 'PVC - Proces Verbal de Commission Centrale des Marches et Contrat de l Etat', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 32, 'OSD - Ordre de Service de Demarrage', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 33, 'DAO - Dossier d Appel D Offres', 'Y', 1, 2, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 34, 'AAO - Avis d Appel d offre', 'Y', 1, 2, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 35, 'FAC - Facture', 'Y', 1, 3, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 36, 'DEC - Decompte', 'Y', 1, 3, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 37, 'INF - Diverses informations', 'Y', 1, 4, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 38, 'COU - Courrier', 'Y', 1, 4, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 39, 'REC - Reception', 'Y', 1, 4, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 40, 'DES - Devis estimatif confidentiel', 'Y', 1, 4, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 41, 'TRF - Terme De Reference', 'Y', 1, 4, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 42, 'DEQ - Devis Quantitatif', 'Y', 1, 4, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 43, 'CCC - Cahier de Charge pour le Controle', 'Y', 1, 5, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 44, 'PEP - Plan d Execution du Projet', 'Y', 1, 5, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 45, 'PIO - Proces Verbal de l Implantation de l ouvrage', 'Y', 1, 5, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 46, 'PRP - Proces Verbal de Reception Provisoire', 'Y', 1, 5, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 47, 'AVE - Avenant', 'Y', 1, 5, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 48, 'RAM - Rapport mensuel', 'Y', 1, 5, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 49, 'RAP - Rapport de mission', 'Y', 1, 5, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); +INSERT INTO doctypes (coll_id, type_id, description, enabled, doctypes_first_level_id, doctypes_second_level_id, primary_retention, secondary_retention, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, is_master) VALUES ('letterbox_coll', 28, 'MAR - Marche', 'Y', 1, 1, NULL, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N'); + +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (24, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (25, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (26, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (27, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (28, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (29, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (30, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (31, 10, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (32, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (33, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (34, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (35, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (36, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (37, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (38, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (39, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (40, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (41, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (42, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (43, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (44, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (45, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (46, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (47, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (48, 21, 14, 1); +INSERT INTO mlb_doctype_ext (type_id, process_delay, delay1, delay2) VALUES (49, 21, 14, 1); + + +-- USERS, GROUPS and ENTITIES +INSERT INTO usergroups (group_id, group_desc, administrator, custom_right1, custom_right2, custom_right3, custom_right4, enabled) VALUES ('ADMINISTRATEURS', 'Administrateurs fonctionnels', ' ', ' ', ' ', ' ', ' ', 'Y'); +INSERT INTO usergroups (group_id, group_desc, administrator, custom_right1, custom_right2, custom_right3, custom_right4, enabled) VALUES ('ARCHIVISTES', 'Archivistes et operateurs de scan', ' ', ' ', ' ', ' ', ' ', 'Y'); +INSERT INTO usergroups (group_id, group_desc, administrator, custom_right1, custom_right2, custom_right3, custom_right4, enabled) VALUES ('EMPLOYES', 'Employes', ' ', ' ', ' ', ' ', ' ', 'Y'); +INSERT INTO usergroups (group_id, group_desc, administrator, custom_right1, custom_right2, custom_right3, custom_right4, enabled) VALUES ('DIRECTEURS', 'Directeurs et personnes habilitees', ' ', ' ', ' ', ' ', ' ', 'Y'); +INSERT INTO usergroups (group_id, group_desc, administrator, custom_right1, custom_right2, custom_right3, custom_right4, enabled) VALUES ('VALIDEURS', 'Valideurs de courrier', ' ', ' ', ' ', ' ', ' ', 'Y'); +INSERT INTO usergroups (group_id, group_desc, administrator, custom_right1, custom_right2, custom_right3, custom_right4, enabled) VALUES ('REDACTEURS', 'Groupe des createurs de courriers', ' ', ' ', ' ', ' ', ' ', 'Y'); +INSERT INTO usergroups (group_id, group_desc, administrator, custom_right1, custom_right2, custom_right3, custom_right4, enabled) VALUES ('CORRESPONDANTS', 'Correspondants Archive', ' ', ' ', ' ', ' ', ' ', 'Y'); + +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ccharles', 'ef9689be896dacd901cae4f13593e90d', 'Charlotte', 'CHARLES', '+33 1 47 24 51 ', 'info@maarch.org', 'Accounting department - DFI', NULL, NULL, NULL, '2b67f8017119d7de32f300be3e97ccb4', '2008-09-10 15:09:23', 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ppetit', 'ef9689be896dacd901cae4f13593e90d', 'Patricia', 'PETIT', '+33 1 47 24 51 ', 'info@maarch.org', '', NULL, NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('pparker', 'ef9689be896dacd901cae4f13593e90d', 'Peter', 'PARKER', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('eerina', 'ef9689be896dacd901cae4f13593e90d', 'Edith', 'ERINA', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ddur', 'ef9689be896dacd901cae4f13593e90d', 'Dominique', 'DUR', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('rrizzo', 'ef9689be896dacd901cae4f13593e90d', 'Rita', 'RIZZO', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('rrenaud', 'ef9689be896dacd901cae4f13593e90d', 'Robert', 'RENAUD', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('bbina', 'ef9689be896dacd901cae4f13593e90d', 'Brigitte', 'BINA', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('mmanfred', 'ef9689be896dacd901cae4f13593e90d', 'Martin', 'MANFRED', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('kkaar', 'ef9689be896dacd901cae4f13593e90d', 'Kathy', 'KAAR', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('aackermann', 'ef9689be896dacd901cae4f13593e90d', 'Amanda', 'ACKERMANN', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ttong', 'ef9689be896dacd901cae4f13593e90d', 'Tony', 'TONG', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('jjane', 'ef9689be896dacd901cae4f13593e90d', 'Jenny', 'JANE', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('bboule', 'ef9689be896dacd901cae4f13593e90d', 'Bruno', 'BOULE', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('bbain', 'ef9689be896dacd901cae4f13593e90d', 'Barbara', 'BAIN', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ccohen', 'ef9689be896dacd901cae4f13593e90d', 'Celine', 'COHEN', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('jjoubert', 'ef9689be896dacd901cae4f13593e90d', 'Jules', 'JOUBERT', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ssaporta', 'ef9689be896dacd901cae4f13593e90d', 'Sabrina', 'SAPORTA', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ssissoko', 'ef9689be896dacd901cae4f13593e90d', 'Sessime', 'SISSOKO', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ddogem', 'ef9689be896dacd901cae4f13593e90d', 'Dina', 'DOGEM', '', 'info@maarch.org', '', '0', NULL, NULL, '', NULL, 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('superadmin', '17c4520f6cfd1ab53d8745e84681eb49', 'Super', 'ADMIN', '', 'admin@maarch.org', 'Maarch', '11', NULL, NULL, '764759df274008fc4cffd89ced0449d8', '2009-09-14 10:09:52', 'Y', 'N', NULL, 'OK'); +INSERT INTO users (user_id, "password", firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('bblier', 'ef9689be896dacd901cae4f13593e90d', 'Bernard', 'BLIER', '+33 1 47 24 51 ', 'info@maarch.org', '', NULL, NULL, NULL, '053123818f126439a94ce074acf71b92', '2009-09-14 11:09:04', 'Y', 'N', NULL, 'OK'); + +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ccharles', 'EMPLOYES', 'Y', 'Responsable de service'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ppetit', 'DIRECTEURS', 'Y', 'Maire'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('pparker', 'ARCHIVISTES', 'Y', 'Archiviste'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ckesney', 'ADMINISTRATEURS', 'Y', 'Administratrice fonctionnelle'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('eerina', 'EMPLOYES', 'Y', 'Secretaire'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ddur', 'DIRECTEURS', 'Y', 'Elu'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('rrizzo', 'DIRECTEURS', 'Y', 'Elu'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('rrenaud', 'DIRECTEURS', 'Y', 'Directeur General des Services'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('bbina', 'REDACTEURS', 'Y', 'Agent'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('mmanfred', 'DIRECTEURS', 'Y', 'Directeur General Adjoint'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('kkaar', 'EMPLOYES', 'Y', 'Secretaire'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('aackermann', 'EMPLOYES', 'Y', 'Responsable de service'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ttibert', 'EMPLOYES', 'Y', 'Agent'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ttong', 'EMPLOYES', 'Y', 'Responsable de service'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('jjane', 'EMPLOYES', 'Y', 'Responsable de service'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('bboule', 'EMPLOYES', 'Y', 'Responsable de service'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('bbain', 'EMPLOYES', 'Y', 'Responsable de service'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ccohen', 'EMPLOYES', 'Y', 'Responsable de service'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('jjoubert', 'EMPLOYES', 'Y', 'Assistant'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ssaporta', 'EMPLOYES', 'Y', 'Assistante'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ssissoko', 'DIRECTEURS', 'Y', 'Directeur Informatique'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ssissoko', 'ADMINISTRATEURS', 'N', 'Directeur Informatique'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('bblier', 'REDACTEURS', 'Y', 'Responsable service Courrier'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ddogem', 'DIRECTEURS', 'N', 'Secretaire General'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ddogem', 'VALIDEURS', 'Y', 'Secretaire General'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('kkaar', 'CORRESPONDANTS', 'N', 'Correspondante Archives'); +INSERT INTO usergroup_content (user_id, group_id, primary_group, "role") VALUES ('ssaporta', 'CORRESPONDANTS', 'N', 'Correspondante Archive'); + +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_users'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_groups'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_architecture'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'view_history'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'view_history_batch'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'xml_param_services'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_status'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_actions'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_contacts'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_apa'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_baskets'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'manage_entities'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_foldertypes'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEURS', 'admin_templates'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'admin'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'admin_apa'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'manage_apa'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'view_baskets'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'physical_archive'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'physical_archive_box_read'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'physical_archive_box_manage'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'physical_archive_batch_read'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', 'physical_archive_batch_manage'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('ARCHIVISTES', '_print_sep'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'adv_search_mlb'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'search_customer'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'my_alerts'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'use_alerts_on_doc'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'use_alerts_on_folder'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'view_baskets'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'add_copy_in_process'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'folder_search'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('EMPLOYES', 'modify_folder'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'adv_search_mlb'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'search_customer'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'my_alerts'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'use_alerts_on_doc'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'use_alerts_on_folder'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'view_baskets'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'add_copy_in_process'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'folder_search'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'modify_folder'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('DIRECTEURS', 'delete_folder'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('VALIDEURS', 'view_baskets'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('REDACTEURS', 'index_mlb'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('REDACTEURS', 'my_contacts'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('REDACTEURS', 'view_baskets'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('REDACTEURS', 'add_copy_in_process'); +INSERT INTO usergroups_services (group_id, service_id) VALUES ('CORRESPONDANTS', 'reserve_apa'); + +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('OrganisationX', 'Mairie Demo s/ Seine', 'Y', '', '', '', '', '', '', '', '', '', 'Direction'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('DRH', 'Ressources Humaines', 'Y', '', '', '', '', '', '', '', '', 'PSF', 'Bureau'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('SGE', 'Secretariat General', 'Y', '', '', '', '', '', '', '', '', 'DGS', 'Bureau'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('COU', 'Service Courrier', 'Y', '', '', '', '', '', '', '', '', 'SGE', 'Bureau'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('FIN', 'Service Financier', 'Y', '', '', '', '', '', '', '', '', 'PSF', 'Bureau'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('INF', 'Service Informatique', 'Y', '', '', '', '', '', '', '', '', 'PSF', 'Bureau'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('ARC', 'Service des Archives', 'Y', '', '', '', '', '', '', '', '', 'PSF', 'Bureau'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('CAB', 'Cabinet du Maire', 'Y', '', '', '', '', '', '', '', '', 'OrganisationX', 'Direction'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('DGA', 'Direction Generale Adjointe', 'Y', '', '', '', '', '', '', '', '', 'CAB', 'Direction'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('ELUS', 'Elus', 'Y', '', '', '', '', '', '', '', '', 'OrganisationX', 'Direction'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('DGS', 'Direction Generale des Services', 'Y', '', '', '', '', '', '', '', '', 'CAB', 'Service'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('PCU', 'Pole Culturel', 'Y', '', '', '', '', '', '', '', '', 'DGS', 'Service'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('PJS', 'Pole Jeunesse et Sports', 'Y', '', '', '', '', '', '', '', '', 'DGS', 'Service'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('PSF', 'Pole Services Fonctionnels', 'Y', '', '', '', '', '', '', '', '', 'DGA', 'Service'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('PSO', 'Pole Social', 'Y', '', '', '', '', '', '', '', '', 'CAB', 'Service'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('PTE', 'Pole Technique', 'Y', '', '', '', '', '', '', '', '', 'DGS', 'Service'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('COARCDGS', 'Correspondant Archive DGS', 'Y', '', '', '', '', '', '', '', '', 'ARC', 'Service'); +INSERT INTO entities (entity_id, entity_label, enabled, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type) VALUES ('COARCDGA', 'Correspondant Archive DGA', 'Y', '', '', '', '', '', '', '', '', 'ARC', 'Service'); + +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ccharles', 'PTE', 'Responsable de service', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ppetit', 'CAB', 'Maire', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('pparker', 'ARC', 'Archiviste', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('eerina', 'CAB', 'Secretaire', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ddur', 'ELUS', 'Elu', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('rrizzo', 'ELUS', 'Elu', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('rrenaud', 'DGS', 'Directeur General des Services', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('bbina', 'COU', 'Agent', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('mmanfred', 'DGA', 'Directeur General Adjoint', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('kkaar', 'DGA', 'Secretaire', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('kkaar', 'COARCDGA', 'Correspondante Archive', 'N'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('aackermann', 'PSF', 'Responsable de service', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ttibert', 'PSF', 'Agent', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ttong', 'DRH', 'Responsable de service', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('jjane', 'FIN', 'Responsable de service', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('bboule', 'PCU', 'Responsable de service', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('bbain', 'PJS', 'Responsable de service', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ccohen', 'PSO', 'Responsable de service', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('jjoubert', 'SGE', 'Assistant', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ssaporta', 'DGS', 'Assistante', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ssaporta', 'COARCDGS', 'Correspondante Archive', 'N'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ssissoko', 'INF', 'Directeur Informatique', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('bblier', 'COU', 'Responsable de service', 'Y'); +INSERT INTO users_entities (user_id, entity_id, user_role, primary_entity) VALUES ('ddogem', 'SGE', 'Secretaire General', 'Y'); + +INSERT INTO "security" (group_id, coll_id, where_clause, maarch_comment, can_insert, can_update, can_delete) VALUES ('EMPLOYES', 'letterbox_coll', 'DESTINATION = @my_primary_entity +', '', 'Y', 'Y', 'N'); +INSERT INTO "security" (group_id, coll_id, where_clause, maarch_comment, can_insert, can_update, can_delete) VALUES ('DIRECTEURS', 'letterbox_coll', '(DESTINATION = @my_primary_entity or DESTINATION in (@subentities[@my_primary_entity])) or DESTINATION is NULL', '', 'Y', 'Y', 'Y'); +INSERT INTO "security" (group_id, coll_id, where_clause, maarch_comment, can_insert, can_update, can_delete) VALUES ('REDACTEURS', 'letterbox_coll', 'DESTINATION = @my_primary_entity or TYPIST=@user', '', 'Y', 'Y', 'Y'); +INSERT INTO "security" (group_id, coll_id, where_clause, maarch_comment, can_insert, can_update, can_delete) VALUES ('CORRESPONDANTS', 'letterbox_coll', '(DESTINATION = @my_primary_entity or DESTINATION in (@subentities[@my_primary_entity])) or DESTINATION is NULL', '', 'N', 'N', 'N'); + +-- DOCSERVERS +INSERT INTO docservers (docserver_id, device_type, device_label, is_readonly, enabled, size_limit, actual_size, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority) VALUES ('letterbox_ai', NULL, NULL, 'N', 'Y', 100000000, 3271717, 'C:\\Maarch\\Docserver\\DGGT_ai\\', NULL, NULL, NULL, '2007-11-19 11:41:22', NULL, 'letterbox_coll', 20); +INSERT INTO docservers (docserver_id, device_type, device_label, is_readonly, enabled, size_limit, actual_size, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority) VALUES ('letterbox', NULL, NULL, 'N', 'Y', 100000000, 7949134, 'C:\\Maarch\\Docserver\\DGGT\\', NULL, NULL, NULL, '2007-11-19 11:41:22', NULL, 'letterbox_coll', 10); + +-- ACTIONS and BASKETS +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (15, '', 'Prelever une archive', 'OUT', 'N', 'Y', 'confirm_status', 'Y', 'advanced_physical_archive', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (16, '', 'Reintegrer une archive', 'POS', 'N', 'Y', 'confirm_status', 'Y', 'advanced_physical_archive', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (2, 'to_validate', 'A valider', 'VAL', 'Y', 'N', 'confirm_status', 'N', 'apps', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (21, 'indexing', 'Indexation', 'NEW', 'N', 'Y', 'index_mlb', 'Y', 'apps', 'Y'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (18, '', 'A valider', 'NEW', 'N', 'Y', '', 'Y', 'apps', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (19, '', 'Traiter document', 'COU', 'N', 'Y', 'process', 'Y', 'apps', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (1, 'redirect', 'Redirection', 'NONE', 'Y', 'Y', 'redirect', 'Y', 'entities', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (22, '', 'En attente de validation', 'VAL', 'N', 'Y', '', 'Y', 'apps', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (23, 'indexing', 'Valider courrier', 'NEW', 'N', 'Y', 'validate_mail', 'Y', 'apps', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (20, '', 'Cloturer', 'END', 'N', 'Y', 'close_mail', 'Y', 'apps', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (3, '', 'Retourner au service Courrier', 'RET', 'N', 'Y', 'confirm_status', 'Y', 'apps', 'N'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin, create_id) VALUES (100, '', 'Voir le document', '', 'N', 'Y', 'view', 'N', 'apps', 'N'); + +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('OUT', 'Prelevee', 'N', '', 'advanced_physical_archive', 'N'); +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('POS', 'Reintegree', 'N', '', 'advanced_physical_archive', 'N'); +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('COU', 'En cours', 'Y', 'mail.gif', 'apps', 'Y'); +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('NEW', 'Nouveau courrier', 'Y', 'mail_new.gif', 'apps', 'Y'); +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('RSV', 'Reserve', 'N', '', 'apps', 'N'); +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('DEL', 'Supprime', 'Y', NULL, 'apps', 'N'); +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('END', 'Clos', 'Y', 'mail_end.gif', 'apps', 'Y'); +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('VAL', 'A valider', 'Y', NULL, 'apps', 'N'); +INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('RET', 'Retour courrier', 'N', '', 'apps', 'Y'); + +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('apa_coll', 'APA_reservation', 'Archives reservees', 'Corbeille des archives reservees', 'res_view_apa.status = ''RSV'' and (ORIGIN= @my_primary_entity or ORIGIN in (@subentities[@my_primary_entity]))', 'NO', 'Y'); +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('apa_coll', 'APA_picking', 'Archives prelevees', 'Corbeille des archives prelevees', 'res_view_apa.status = ''OUT'' and (ORIGIN= @my_primary_entity or ORIGIN in (@subentities[@my_primary_entity]))', 'NO', 'Y'); +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('letterbox_coll', 'CopyMailBasket', 'Mes courriers en copie', 'Mes courriers en copie', 'res_id in (select res_id from listinstance WHERE coll_id = ''letterbox_coll'' and item_type = ''user_id'' and item_id = @user and item_mode = ''cc'') or res_id in (select res_id from listinstance WHERE coll_id = ''letterbox_coll'' and item_type = ''entity_id'' and item_mode = ''cc'' and item_id in (@my_entities))', 'N', 'Y'); +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('letterbox_coll', 'LateMailBasket', 'Mes courriers en retard', 'Mes courriers en retard', '1=1', 'N', 'Y'); +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('letterbox_coll', 'RetourCourrier', 'Retours Courrier', 'Courriers retournes au service Courrier', 'STATUS=''RET'' ', 'N', 'Y'); +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('letterbox_coll', 'IndexingBasket', 'Corbeille d''indexation', 'Corbeille d''indexation', ' ', 'N', 'Y'); +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('letterbox_coll', 'MyBasket', 'Mes courriers a traiter', 'Mes courriers a traiter', '(status =''NEW'' or status =''COU'') and dest_user = @user', 'N', 'Y'); +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('letterbox_coll', 'ValidationBasket', 'Mes courriers a valider', 'Mes courriers a valider', 'status = ''VAL''', 'N', 'Y'); +INSERT INTO baskets (coll_id, basket_id, basket_name, basket_desc, basket_clause, is_generic, enabled) VALUES ('letterbox_coll', 'DepartmentBasket', 'Corbeille de supervision', 'Corbeille de supervision', 'destination in (@my_entities, @subentities[@my_primary_entity]) and (status <> ''DEL'' AND status <> ''REP'')', 'N', 'Y'); + +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('REDACTEURS', 'IndexingBasket', 2, NULL, NULL, 'redirect_to_action', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('EMPLOYES', 'MyBasket', 1, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('DIRECTEURS', 'MyBasket', 1, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('VALIDEURS', 'ValidationBasket', 1, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('VALIDEURS', 'MyBasket', 2, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('DIRECTEURS', 'DepartmentBasket', 2, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('DIRECTEURS', 'CopyMailBasket', 4, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('EMPLOYES', 'CopyMailBasket', 5, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('VALIDEURS', 'CopyMailBasket', 6, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('REDACTEURS', 'CopyMailBasket', 7, NULL, NULL, 'auth_dep', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('ARCHIVISTES', 'APA_reservation', 1, NULL, NULL, 'apa_basket_list', 'N', 'N', 'N'); +INSERT INTO groupbasket (group_id, basket_id, "sequence", redirect_basketlist, redirect_grouplist, result_page, can_redirect, can_delete, can_insert) VALUES ('ARCHIVISTES', 'APA_picking', 2, NULL, NULL, 'apa_basket_list', 'N', 'N', 'N'); + +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (22, '', 'REDACTEURS', 'IndexingBasket', 'N', 'Y', 'N'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (21, '', 'REDACTEURS', 'IndexingBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (23, '', 'VALIDEURS', 'ValidationBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (20, '', 'DIRECTEURS', 'MyBasket', 'N', 'Y', 'N'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (1, '', 'DIRECTEURS', 'MyBasket', 'N', 'Y', 'N'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (19, '', 'DIRECTEURS', 'MyBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (20, '', 'EMPLOYES', 'MyBasket', 'N', 'Y', 'N'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (1, '', 'EMPLOYES', 'MyBasket', 'N', 'Y', 'N'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (19, '', 'EMPLOYES', 'MyBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (20, '', 'VALIDEURS', 'MyBasket', 'N', 'Y', 'N'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (1, '', 'VALIDEURS', 'MyBasket', 'N', 'Y', 'N'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (19, '', 'VALIDEURS', 'MyBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (100, '', 'DIRECTEURS', 'DepartmentBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (100, '', 'DIRECTEURS', 'CopyMailBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (100, '', 'EMPLOYES', 'CopyMailBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (100, '', 'VALIDEURS', 'CopyMailBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (100, '', 'REDACTEURS', 'CopyMailBasket', 'N', 'N', 'Y'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (15, '', 'ARCHIVISTES', 'APA_reservation', 'Y', 'Y', 'N'); +INSERT INTO actions_groupbaskets (id_action, where_clause, group_id, basket_id, used_in_basketlist, used_in_action_page, default_action_list) VALUES (16, '', 'ARCHIVISTES', 'APA_picking', 'Y', 'Y', 'N'); + +INSERT INTO groupbasket_redirect (system_id, group_id, basket_id, action_id, entity_id, keyword, redirect_mode) VALUES (5, 'REDACTEURS', 'IndexingBasket', 21, '', 'ALL_ENTITIES', 'ENTITY'); +INSERT INTO groupbasket_redirect (system_id, group_id, basket_id, action_id, entity_id, keyword, redirect_mode) VALUES (2, 'DIRECTEURS', 'MyBasket', 1, '', 'ALL_ENTITIES', 'ENTITY'); +INSERT INTO groupbasket_redirect (system_id, group_id, basket_id, action_id, entity_id, keyword, redirect_mode) VALUES (3, 'EMPLOYES', 'MyBasket', 1, '', 'MY_ENTITIES', 'ENTITY'); +INSERT INTO groupbasket_redirect (system_id, group_id, basket_id, action_id, entity_id, keyword, redirect_mode) VALUES (8, 'VALIDEURS', 'ValidationBasket', 23, '', 'ALL_ENTITIES', 'ENTITY'); +INSERT INTO groupbasket_redirect (system_id, group_id, basket_id, action_id, entity_id, keyword, redirect_mode) VALUES (100, 'DIRECTEURS', 'DepartmentBasket', 1, '', 'MY_ENTITIES', 'ENTITY'); +INSERT INTO groupbasket_redirect (system_id, group_id, basket_id, action_id, entity_id, keyword, redirect_mode) VALUES (101, 'DIRECTEURS', 'DepartmentBasket', 1, '', 'MY_ENTITIES', 'USERS'); + +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'DRH', 'entity_id', 0, 'ttong', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'SGE', 'entity_id', 0, 'ddogem', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'COU', 'entity_id', 0, 'bblier', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'FIN', 'entity_id', 0, 'jjane', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'INF', 'entity_id', 0, 'ssissoko', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'ARC', 'entity_id', 0, 'pparker', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'CAB', 'entity_id', 0, 'ppetit', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'CAB', 'entity_id', 0, 'rrizzo', 'user_id', 'cc', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'DGA', 'entity_id', 0, 'mmanfred', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'DGA', 'entity_id', 0, 'ppetit', 'user_id', 'cc', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'ELUS', 'entity_id', 0, 'rrizzo', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'ELUS', 'entity_id', 0, 'ppetit', 'user_id', 'cc', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'DGS', 'entity_id', 0, 'rrenaud', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'PCU', 'entity_id', 0, 'bboule', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'PJS', 'entity_id', 0, 'bbain', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'PSF', 'entity_id', 0, 'aackermann', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'PSO', 'entity_id', 0, 'ccohen', 'user_id', 'dest', 'DOC'); +INSERT INTO listmodels (coll_id, object_id, object_type, "sequence", item_id, item_type, item_mode, listmodel_type) VALUES ('letterbox_coll', 'PTE', 'entity_id', 0, 'ccharles', 'user_id', 'dest', 'DOC'); + + + +-- OTHER +INSERT INTO contacts (contact_id, lastname, firstname, society, function, address_num, address_street, address_complement, address_town, address_postal_code, address_country, email, phone, other_data, is_corporate_person, user_id, title, enabled) VALUES +(1, 'Chaplin', 'Charlie', 'Maarch', 'Directeur artistique', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'khjohpuief', 'N', '', 'Monsieur', 'Y'), +(3, '', '', 'Maarch', '', '', '', '', '', '', 'France', '', '', '', 'Y', '', '', 'Y'), +(4, '', '', 'Warner', '', '', '', '', '', '', 'USA', '', '', '', 'Y', '', '', 'Y'), +(5, 'Majestrix', 'Diana', 'Warner', 'Directeur artistique', '', '', '', '', '', 'USA', '', '', '', 'N', '', 'Madame', 'Y'), +(7, '', '', 'Maarch', '', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'autre', 'Y', 'pparker', '', 'Y'), +(8, 'Carlin', 'Bruno', 'Maarch', 'Directeur Marketing', '65', 'rue de la croix', 'test', 'nanterre', '92000', 'France', 'test@maarch.org', '01010101', 'auykiu', 'N', 'pparker', 'Monsieur', 'Y'), +(9, '', '', 'Adorateurs du Froid', '', '43', 'rue du froid', 'fait trop chaud', 'coldcity', '11111', 'coldcountry', 'Adorateurs@froid.cold', '01010101', 'fait vraiment trop chaud', 'Y', 'pparker', '', 'Y'), +(10, '', '', 'TOTO', '', '', '', '', '', '', '', '', '', '', 'Y', 'pparker', '', 'Y'), +(11, '', '', 'fggdgg', '', '', '', '', '', '', '', '', '', '', 'Y', 'pparker', '', 'Y'), +(12, '', '', 'yuiop', '', '', '', '', '', '', '', '', '', 'dffff', 'Y', 'pparker', '', 'Y'), +(13, '', '', 'ffff', '', '', '', '', '', '', '', '', '', 'fff', 'Y', 'pparker', '', 'Y'); + +INSERT INTO parameters (id, param_value_string, param_value_int) VALUES +('workbatch_rec', '', 7), +('folder_id_increment', '', 152), +('work_batch_autoimport_id', NULL, 1), +('ar_index__', NULL, 3), +('ar_index_pparker_incoming', NULL, 3), +('ar_index_pparker_outgoing', NULL, 3), +('ar_index_pparker_internal', NULL, 3), +('ar_index_pparker_market_document', NULL, 3); + +INSERT INTO templates (id, label, creation_date, template_comment, content) VALUES (2, 'AR_MAARCH', '2009-08-20 16:01:00', 'Accusé de réception Maarch', '<p style="TEXT-ALIGN: left"><img src="img/default_maarch.gif" alt="" width="278" height="80" /> </p> +<p><em><font face="Arial Black" size="2" color="#3366ff">La gestion de courriers Open source !</font></em><br />Mail : info@maarch.org<br />Web : http://www.maarch.org</p> +<p style="TEXT-ALIGN: right"><font size="2">Nanterre, le [NOW]</font></p> +<p><font size="2">Cher [CONTACT_LASTNAME]</font></p> +<p><font size="2">Nous accusons réception de votre courrier du <strong>BLABLA</strong>, et mettons tout en oeuvre pour vous répondre dans les plus brefs délais.</font></p> +<p><font size="2">Sachez qu''en cas de besoin urgent nos bureaux sont ouverts de 8h00 à 15h00, du lundi au samedi.</font></p> +<p><font size="2">Le numéro vert où vous pouvez nous appeler est le 0800 455 24.</font></p> +<p><font size="2">Votre n° de dossier à rappeler dans toute correspondance est le : [CHRONO]</font></p> +<p> </p> +<p><font size="2"> Cordialement,</font></p> +<p><font size="2"><em> [CURRENT_USER_FIRSTNAME] [CURRENT_USER_LASTNAME]<br /> [DESTINATION]<br /> Tél : [CURRENT_USER_PHONE]<br /> Courriel : [CURRENT_USER_EMAIL]</em></font></p> +<p> </p>'); +INSERT INTO templates (id, label, creation_date, template_comment, content) VALUES (1, 'TEST', '2009-08-20 16:01:00', 'Test des mots-clés', '<h1>Liste des mots-clés utilisables dans les modèles de reponse</h1> +<p> </p> +<table border="0"> +<tbody> +<tr> +<td><font size="2">Contact externe: Civilité </font></td> +<td><strong><font size="2">[CONTACT_TITLE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe: Nom</font></td> +<td><strong><font size="2">[CONTACT_LASTNAME]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe: Prénom</font></td> +<td><strong><font size="2">[CONTACT_FIRSTNAME]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe : Organisation</font></td> +<td><strong><font size="2">[CONTACT_SOCIETY]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe : Adresse N°</font></td> +<td><strong><font size="2">[CONTACT_ADRS_NUM]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe : Adresse Rue</font></td> +<td><strong><font size="2">[CONTACT_ADRS_STREET]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe : Adresse Complement</font></td> +<td><strong><font size="2">[CONTACT_ADRS_COMP]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe : Adresse Ville</font></td> +<td><strong><font size="2">[CONTACT_ADRS_TOWN]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe : Adresse CP</font></td> +<td><strong><font size="2">[CONTACT_ADRS_PC]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact externe : Adresse Pays</font></td> +<td><strong><font size="2">[CONTACT_ADRS_COUNTRY]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact interne: Nom</font></td> +<td><strong><font size="2">[USER_LASTNAME]</font></strong></td> +</tr> +<tr> +<td><font size="2">Contact interne: Prénom</font></td> +<td><strong><font size="2">[USER_FIRSTNAME]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Service Traitant</font></td> +<td><strong><font size="2">[DESTINATION]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Type de document</font></td> +<td><strong><font size="2">[DOCTYPE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Catégorie</font></td> +<td><strong><font size="2">[CAT_ID]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Nature</font></td> +<td><strong><font size="2">[NATURE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Date d''arrivée </font></td> +<td><strong><font size="2">[ADMISSION_DATE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Date du courrier </font></td> +<td><strong><font size="2">[DOC_DATE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Date limite de traitement </font></td> +<td><strong><font size="2">[PROCESS_LIMIT_DATE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Notes de traitement </font></td> +<td><strong><font size="2">[PROCESS_NOTES]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Date de clôture </font></td> +<td><strong><font size="2">[CLOSING_DATE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Objet</font></td> +<td><strong><font size="2">[SUBJECT]</font></strong></td> +</tr> +<tr> +<td><font size="2">Courrier: Numéro chrono</font></td> +<td><strong><font size="2">[CHRONO]</font></strong></td> +</tr> +<tr> +<td><font size="2">Document: Auteur</font></td> +<td><strong><font size="2">[AUTHOR]</font></strong></td> +</tr> +<tr> +<td><font size="2">Document: Date d''enregistrement</font></td> +<td><strong><font size="2">[CREATION_DATE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Spécial: Date du jour</font></td> +<td><strong><font size="2">[NOW]</font></strong></td> +</tr> +<tr> +<td><font size="2">Spécial: Nom du destinataire traitant</font></td> +<td><strong><font size="2">[CURRENT_USER_LASTNAME]</font></strong></td> +</tr> +<tr> +<td><font size="2">Spécial: Prénom du destinataire traitant</font></td> +<td><strong><font size="2">[CURRENT_USER_FIRSTNAME]</font></strong></td> +</tr> +<tr> +<td><font size="2">Spécial: Téléphone du destinataire traitant</font></td> +<td><strong><font size="2">[CURRENT_USER_PHONE]</font></strong></td> +</tr> +<tr> +<td><font size="2">Spécial: Mail du destinataire traitant</font></td> +<td><strong><font size="2">[CURRENT_USER_EMAIL]</font></strong></td> +</tr> +</tbody> +</table> +<p><font size="2"> </font></p>'); + + +-- +-- TOC entry 2326 (class 0 OID 39180) +-- Dependencies: 1461 +-- Data for Name: templates_association; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (2, 'destination', 'PJS', 4, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'OrganisationX', 77, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'CAB', 78, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'DGA', 79, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'PSF', 80, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'DRH', 81, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'FIN', 82, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'INF', 83, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'ARC', 84, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'COARCDGS', 85, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'COARCDGA', 86, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'DGS', 87, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'SGE', 88, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'COU', 89, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'PCU', 90, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'PJS', 91, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'PTE', 92, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'PSO', 93, 'entities'); +INSERT INTO templates_association (template_id, what, value_field, system_id, maarch_module) VALUES (1, 'destination', 'ELUS', 94, 'entities'); + + +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 47, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 46, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 45, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 48, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 44, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 43, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 49, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 50, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 51, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 52, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (NULL, 53, 'N'); +INSERT INTO templates_doctype_ext (template_id, type_id, is_generated) VALUES (1, 54, 'Y'); + +-- DOCS +INSERT INTO res_letterbox (res_id, title, subject, description, publisher, contributor, type_id, format, typist, creation_date, fulltext_result, ocr_result, converter_result, author, author_name, identifier, source, doc_language, relation, coverage, doc_date, docserver_id, folders_system_id, arbox_id, path, filename, offset_doc, logical_adr, fingerprint, filesize, is_paper, page_count, scan_date, scan_user, scan_location, scan_wkstation, scan_batch, burn_batch, scan_postmark, envelop_id, status, destination, approver, validation_date, work_batch, origin, is_ingoing, priority, arbatch_id, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, tablename, initiator, dest_user, video_batch, video_time, video_user) VALUES (1, NULL, 'Demande de Formation DIF', NULL, NULL, NULL, 37, 'pdf', 'bblier', '2009-09-14 14:35:46.608', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-09-14 00:00:00', 'letterbox', 1, '3', '1#', '4.pdf', ' ', ' ', '371a976eb690e1b4a5ab4bccd763281b', 12032, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'COU', 'PJS', NULL, NULL, NULL, NULL, NULL, 2, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bbain', NULL, NULL, NULL); +INSERT INTO res_letterbox (res_id, title, subject, description, publisher, contributor, type_id, format, typist, creation_date, fulltext_result, ocr_result, converter_result, author, author_name, identifier, source, doc_language, relation, coverage, doc_date, docserver_id, folders_system_id, arbox_id, path, filename, offset_doc, logical_adr, fingerprint, filesize, is_paper, page_count, scan_date, scan_user, scan_location, scan_wkstation, scan_batch, burn_batch, scan_postmark, envelop_id, status, destination, approver, validation_date, work_batch, origin, is_ingoing, priority, arbatch_id, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, tablename, initiator, dest_user, video_batch, video_time, video_user) VALUES (2, NULL, 'Facture n°234c', NULL, NULL, NULL, 24, 'pdf', 'bblier', '2009-09-14 14:30:10.859', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-09-14 00:00:00', 'letterbox', 1, '3', '1#', '3.pdf', ' ', ' ', 'e17e86ab6f13f13abe5ce5ecced3a824', 83932, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'COU', 'PJS', NULL, NULL, NULL, NULL, NULL, 2, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'bbain', NULL, NULL, NULL); +INSERT INTO res_letterbox (res_id, title, subject, description, publisher, contributor, type_id, format, typist, creation_date, fulltext_result, ocr_result, converter_result, author, author_name, identifier, source, doc_language, relation, coverage, doc_date, docserver_id, folders_system_id, arbox_id, path, filename, offset_doc, logical_adr, fingerprint, filesize, is_paper, page_count, scan_date, scan_user, scan_location, scan_wkstation, scan_batch, burn_batch, scan_postmark, envelop_id, status, destination, approver, validation_date, work_batch, origin, is_ingoing, priority, arbatch_id, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_d6, custom_t7, custom_d7, custom_t8, custom_d8, custom_t9, custom_d9, custom_t10, custom_d10, custom_t11, custom_t12, custom_t13, custom_t14, custom_t15, tablename, initiator, dest_user, video_batch, video_time, video_user) VALUES (3, NULL, 'Demande de logement', NULL, NULL, NULL, 38, 'pdf', 'bblier', '2009-09-14 14:55:08.67', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-09-14 00:00:00', 'letterbox', NULL, '3', '1#', '5.pdf', ' ', ' ', '6c6a9a06268b3d651686162350778ff0', 111791, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'VAL', 'DRH', NULL, NULL, NULL, NULL, NULL, 2, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'res_invoices', NULL, 'ttong', NULL, NULL, NULL); + +INSERT INTO mlb_coll_ext (res_id, category_id, exp_contact_id, exp_user_id, dest_contact_id, dest_user_id, nature_id, alt_identifier, admission_date, answer_type_bitmask, other_answer_desc, process_limit_date, process_notes, closing_date, alarm1_date, alarm2_date, flag_notif, flag_alarm1, flag_alarm2) VALUES (1, 'incoming', NULL, 'bboule', NULL, NULL, 'simple_mail', 'PJS/3/37/14092009/2/2', '2009-09-14 00:00:00', '000000', '[Préciser]', '2009-09-24 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'); +INSERT INTO mlb_coll_ext (res_id, category_id, exp_contact_id, exp_user_id, dest_contact_id, dest_user_id, nature_id, alt_identifier, admission_date, answer_type_bitmask, other_answer_desc, process_limit_date, process_notes, closing_date, alarm1_date, alarm2_date, flag_notif, flag_alarm1, flag_alarm2) VALUES (2, 'incoming', NULL, 'bbain', NULL, NULL, 'simple_mail', 'PJS/3/24/14092009/1/1', '2009-09-14 00:00:00', '000000', '[Préciser]', '2009-09-24 00:00:00', '', NULL, NULL, NULL, 'N', 'N', 'N'); +INSERT INTO mlb_coll_ext (res_id, category_id, exp_contact_id, exp_user_id, dest_contact_id, dest_user_id, nature_id, alt_identifier, admission_date, answer_type_bitmask, other_answer_desc, process_limit_date, process_notes, closing_date, alarm1_date, alarm2_date, flag_notif, flag_alarm1, flag_alarm2) VALUES (3, 'incoming', NULL, 'rrizzo', NULL, NULL, 'simple_mail', 'DRH/3/38/14092009/3/1', '2009-09-14 00:00:00', NULL, NULL, '2009-09-24 00:00:00', NULL, NULL, NULL, NULL, 'N', 'N', 'N'); + +INSERT INTO listinstance (coll_id, res_id, listinstance_type, "sequence", item_id, item_type, item_mode, added_by_user, added_by_entity) VALUES ('letterbox_coll', 1, 'DOC', 0, 'bbain', 'user_id', 'dest', 'bbain', 'PJS'); +INSERT INTO listinstance (coll_id, res_id, listinstance_type, "sequence", item_id, item_type, item_mode, added_by_user, added_by_entity) VALUES ('letterbox_coll', 2, 'DOC', 0, 'bbain', 'user_id', 'dest', 'bbain', 'PJS'); +INSERT INTO listinstance (coll_id, res_id, listinstance_type, "sequence", item_id, item_type, item_mode, added_by_user, added_by_entity) VALUES ('letterbox_coll', 3, 'DOC', 0, 'ttong', 'user_id', 'dest', 'bblier', 'COU'); + + +-- PHYSICAL ARCHIVING +INSERT INTO ar_boxes (arbox_id, title, subject, description, entity_id, arcontainer_id, status, creation_date, retention_time, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_t7, custom_t8, custom_t9, custom_t10, custom_t11) VALUES (1, 'Boite ENTRANT 001', NULL, NULL, NULL, 0, 'NEW', '2009-09-16 15:59:34.436', NULL, NULL, NULL, NULL, NULL, 'PA', NULL, NULL, NULL, 'superadmin', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO ar_boxes (arbox_id, title, subject, description, entity_id, arcontainer_id, status, creation_date, retention_time, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_t7, custom_t8, custom_t9, custom_t10, custom_t11) VALUES (2, 'Boite ENTRANT 002', NULL, NULL, NULL, 0, 'NEW', '2009-09-16 15:59:54.176', NULL, NULL, NULL, NULL, NULL, 'PA', NULL, NULL, NULL, 'superadmin', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO ar_boxes (arbox_id, title, subject, description, entity_id, arcontainer_id, status, creation_date, retention_time, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_t7, custom_t8, custom_t9, custom_t10, custom_t11) VALUES (3, 'Boite SORTANT 001', NULL, NULL, NULL, 0, 'NEW', '2009-09-16 16:00:07.569', NULL, NULL, NULL, NULL, NULL, 'PA', NULL, NULL, NULL, 'superadmin', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO ar_boxes (arbox_id, title, subject, description, entity_id, arcontainer_id, status, creation_date, retention_time, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_t7, custom_t8, custom_t9, custom_t10, custom_t11) VALUES (4, 'Boite INTERNE 001', NULL, NULL, NULL, 0, 'NEW', '2009-09-16 16:00:29.896', NULL, NULL, NULL, NULL, NULL, 'PA', NULL, NULL, NULL, 'superadmin', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO ar_boxes (arbox_id, title, subject, description, entity_id, arcontainer_id, status, creation_date, retention_time, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_t7, custom_t8, custom_t9, custom_t10, custom_t11) VALUES (5, 'Boite PROJET 001', NULL, NULL, NULL, 0, 'NEW', '2009-09-16 16:01:00.765', NULL, NULL, NULL, NULL, NULL, 'PA', NULL, NULL, NULL, 'superadmin', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO ar_batch (arbatch_id, title, subject, description, arbox_id, status, creation_date, retention_time, custom_t1, custom_n1, custom_f1, custom_d1, custom_t2, custom_n2, custom_f2, custom_d2, custom_t3, custom_n3, custom_f3, custom_d3, custom_t4, custom_n4, custom_f4, custom_d4, custom_t5, custom_n5, custom_f5, custom_d5, custom_t6, custom_t7, custom_t8, custom_t9, custom_t10, custom_t11) VALUES (1, '1', NULL, NULL, 1, 'NEW', '2009-09-16 18:26:27.979', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bblier', NULL, NULL, NULL, NULL, NULL, NULL, '2009-09-16 18:26:27.979', NULL, NULL, NULL, NULL, 'LETTERBOX', NULL, NULL, NULL, NULL, NULL); + +INSERT INTO ar_container_types (ctype_id, ctype_desc, size_x, size_y, size_z) VALUES +('CAF20', 'Conteneur aere ferme 20 pieds', 6, 2.32, 2.37), +('CAF40', 'Conteneur aere ferme 40 pieds', 12, 2.32, 2.37), +('CPF20', 'Conteneur plate-forme 20 pieds', 6, 2.32, 2.37), +('SCPF40', 'Super conteneur plate-forme 20 pieds', 6, 2.32, 2.37), +('CTH40', 'Conteneur a caracteristiques thermiques 40 pieds', 12, 2.32, 2.37), +('CTH20', 'Conteneur a caracteristiques thermiques 20 pieds', 6, 2.32, 2.37); + +INSERT INTO ar_sites (site_id, site_desc, entity_id) VALUES +('FR01', 'Site de Paris', 'ARC'), +('FR02', 'Site de Nanterre', 'ARC'); + +INSERT INTO ar_natures (arnature_id, arnature_desc, arnature_retention, entity_id, enabled) VALUES ('DOSPROJ', 'Dossiers de projet DGS', 10, 'COARCDGS', 'Y'); +INSERT INTO ar_natures (arnature_id, arnature_desc, arnature_retention, entity_id, enabled) VALUES ('DOSTECH', 'Dossiers techniques DGS', 10, 'COARCDGS', 'Y'); +INSERT INTO ar_natures (arnature_id, arnature_desc, arnature_retention, entity_id, enabled) VALUES ('DOSRH', 'Dossiers RH DGA', 30, 'COARCDGA', 'Y'); +INSERT INTO ar_natures (arnature_id, arnature_desc, arnature_retention, entity_id, enabled) VALUES ('DOSCOMPTA', 'Dossiers comptables DGA', 10, 'COARCDGA', 'Y'); + +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (1, 'FR01', 'A', 1, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (2, 'FR01', 'A', 1, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (3, 'FR01', 'A', 1, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (4, 'FR01', 'A', 2, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (5, 'FR01', 'A', 2, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (6, 'FR01', 'A', 2, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (7, 'FR01', 'A', 3, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (8, 'FR01', 'A', 3, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (9, 'FR01', 'A', 3, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (10, 'FR01', 'A', 4, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (11, 'FR01', 'A', 4, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (12, 'FR01', 'A', 4, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (13, 'FR01', 'A', 5, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (14, 'FR01', 'A', 5, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (15, 'FR01', 'A', 5, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (16, 'FR01', 'A', 6, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (17, 'FR01', 'A', 6, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (18, 'FR01', 'A', 6, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (19, 'FR01', 'A', 7, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (20, 'FR01', 'A', 7, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (21, 'FR01', 'A', 7, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (22, 'FR01', 'A', 8, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (23, 'FR01', 'A', 8, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (24, 'FR01', 'A', 8, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (25, 'FR01', 'A', 9, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (26, 'FR01', 'A', 9, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (27, 'FR01', 'A', 9, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (28, 'FR01', 'A', 10, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (29, 'FR01', 'A', 10, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (30, 'FR01', 'A', 10, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (31, 'FR01', 'B', 1, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (32, 'FR01', 'B', 1, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (33, 'FR01', 'B', 1, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (34, 'FR01', 'B', 2, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (35, 'FR01', 'B', 2, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (36, 'FR01', 'B', 2, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (37, 'FR01', 'B', 3, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (38, 'FR01', 'B', 3, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (39, 'FR01', 'B', 3, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (40, 'FR01', 'B', 4, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (41, 'FR01', 'B', 4, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (42, 'FR01', 'B', 4, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (43, 'FR01', 'B', 5, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (44, 'FR01', 'B', 5, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (45, 'FR01', 'B', 5, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (46, 'FR01', 'B', 6, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (47, 'FR01', 'B', 6, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (48, 'FR01', 'B', 6, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (49, 'FR01', 'B', 7, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (50, 'FR01', 'B', 7, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (51, 'FR01', 'B', 7, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (52, 'FR01', 'B', 8, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (53, 'FR01', 'B', 8, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (54, 'FR01', 'B', 8, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (55, 'FR01', 'B', 9, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (56, 'FR01', 'B', 9, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (57, 'FR01', 'B', 9, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (58, 'FR01', 'B', 10, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (59, 'FR01', 'B', 10, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (60, 'FR01', 'B', 10, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (61, 'FR01', 'C', 1, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (62, 'FR01', 'C', 1, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (63, 'FR01', 'C', 1, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (64, 'FR01', 'C', 2, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (65, 'FR01', 'C', 2, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (66, 'FR01', 'C', 2, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (67, 'FR01', 'C', 3, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (68, 'FR01', 'C', 3, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (69, 'FR01', 'C', 3, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (70, 'FR01', 'C', 4, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (71, 'FR01', 'C', 4, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (72, 'FR01', 'C', 4, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (73, 'FR01', 'C', 5, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (74, 'FR01', 'C', 5, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (75, 'FR01', 'C', 5, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (76, 'FR01', 'C', 6, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (77, 'FR01', 'C', 6, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (78, 'FR01', 'C', 6, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (79, 'FR01', 'C', 7, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (80, 'FR01', 'C', 7, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (81, 'FR01', 'C', 7, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (82, 'FR01', 'C', 8, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (83, 'FR01', 'C', 8, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (84, 'FR01', 'C', 8, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (85, 'FR01', 'C', 9, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (86, 'FR01', 'C', 9, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (87, 'FR01', 'C', 9, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (88, 'FR01', 'C', 10, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (89, 'FR01', 'C', 10, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (90, 'FR01', 'C', 10, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (91, 'FR01', 'D', 1, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (92, 'FR01', 'D', 1, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (93, 'FR01', 'D', 1, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (94, 'FR01', 'D', 2, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (95, 'FR01', 'D', 2, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (96, 'FR01', 'D', 2, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (97, 'FR01', 'D', 3, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (98, 'FR01', 'D', 3, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (99, 'FR01', 'D', 3, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (100, 'FR01', 'D', 4, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (101, 'FR01', 'D', 4, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (102, 'FR01', 'D', 4, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (103, 'FR01', 'D', 5, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (104, 'FR01', 'D', 5, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (105, 'FR01', 'D', 5, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (106, 'FR01', 'D', 6, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (107, 'FR01', 'D', 6, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (108, 'FR01', 'D', 6, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (109, 'FR01', 'D', 7, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (110, 'FR01', 'D', 7, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (111, 'FR01', 'D', 7, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (112, 'FR01', 'D', 8, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (113, 'FR01', 'D', 8, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (114, 'FR01', 'D', 8, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (115, 'FR01', 'D', 9, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (116, 'FR01', 'D', 9, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (117, 'FR01', 'D', 9, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (118, 'FR01', 'D', 10, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (119, 'FR01', 'D', 10, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (120, 'FR01', 'D', 10, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (121, 'FR01', 'E', 1, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (122, 'FR01', 'E', 1, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (123, 'FR01', 'E', 1, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (124, 'FR01', 'E', 2, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (125, 'FR01', 'E', 2, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (126, 'FR01', 'E', 2, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (127, 'FR01', 'E', 3, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (128, 'FR01', 'E', 3, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (129, 'FR01', 'E', 3, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (130, 'FR01', 'E', 4, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (131, 'FR01', 'E', 4, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (132, 'FR01', 'E', 4, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (133, 'FR01', 'E', 5, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (134, 'FR01', 'E', 5, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (135, 'FR01', 'E', 5, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (136, 'FR01', 'E', 6, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (137, 'FR01', 'E', 6, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (138, 'FR01', 'E', 6, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (139, 'FR01', 'E', 7, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (140, 'FR01', 'E', 7, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (141, 'FR01', 'E', 7, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (142, 'FR01', 'E', 8, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (143, 'FR01', 'E', 8, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (144, 'FR01', 'E', 8, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (145, 'FR01', 'E', 9, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (146, 'FR01', 'E', 9, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (147, 'FR01', 'E', 9, 3, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (148, 'FR01', 'E', 10, 1, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (149, 'FR01', 'E', 10, 2, 4, 4); +INSERT INTO ar_positions (position_id, site_id, pos_row, pos_col, pos_level, pos_max_uc, pos_available_uc) VALUES (150, 'FR01', 'E', 10, 3, 4, 4); + + + diff --git a/maarch_entreprise/trunk/sql/structure/apps.mysql.sql b/maarch_entreprise/trunk/sql/structure/apps.mysql.sql new file mode 100644 index 0000000000000000000000000000000000000000..b3d6de0d15afa39bf910c44ad6f316552306af05 --- /dev/null +++ b/maarch_entreprise/trunk/sql/structure/apps.mysql.sql @@ -0,0 +1,341 @@ +CREATE TABLE IF NOT EXISTS doctypes_first_level ( + doctypes_first_level_id int(8) NOT NULL auto_increment, + doctypes_first_level_label varchar(255) collate utf8_unicode_ci NOT NULL, + enabled char(1) collate utf8_unicode_ci NOT NULL default 'Y', + PRIMARY KEY (doctypes_first_level_id) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +CREATE TABLE IF NOT EXISTS doctypes_second_level ( + doctypes_second_level_id int(8) NOT NULL auto_increment, + doctypes_second_level_label varchar(255) collate utf8_unicode_ci NOT NULL, + doctypes_first_level_id int(8) NOT NULL, + enabled char(1) collate utf8_unicode_ci NOT NULL default 'Y', + PRIMARY KEY (doctypes_second_level_id) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + +CREATE TABLE IF NOT EXISTS res_x ( + `res_id` int(8) NOT NULL auto_increment, + `title` varchar(255) collate utf8_unicode_ci default NULL, + `subject` text collate utf8_unicode_ci, + `description` text collate utf8_unicode_ci, + `publisher` varchar(255) collate utf8_unicode_ci default NULL, + `contributor` varchar(255) collate utf8_unicode_ci default NULL, + `type_id` int(8) NOT NULL, + `format` varchar(50) collate utf8_unicode_ci NOT NULL, + `typist` varchar(50) collate utf8_unicode_ci NOT NULL, + `creation_date` datetime NOT NULL, + fulltext_result varchar(10) DEFAULT NULL, + ocr_result varchar(10) DEFAULT NULL, + converter_result varchar(10) DEFAULT NULL, + `author` varchar(255) collate utf8_unicode_ci default NULL, + `author_name` text collate utf8_unicode_ci, + `identifier` varchar(255) collate utf8_unicode_ci default NULL, + `source` varchar(255) collate utf8_unicode_ci default NULL, + `doc_language` varchar(50) collate utf8_unicode_ci default NULL, + `relation` int(8) default NULL, + `coverage` varchar(255) collate utf8_unicode_ci default NULL, + `doc_date` datetime default NULL, + `docserver_id` varchar(32) collate utf8_unicode_ci NOT NULL, + `folders_system_id` int(8) default NULL, + `arbox_id` varchar(32) collate utf8_unicode_ci default NULL, + `path` varchar(255) collate utf8_unicode_ci default NULL, + `filename` varchar(255) collate utf8_unicode_ci default NULL, + `offset_doc` varchar(255) collate utf8_unicode_ci default NULL, + `logical_adr` varchar(255) collate utf8_unicode_ci default NULL, + `fingerprint` varchar(255) collate utf8_unicode_ci default NULL, + `filesize` int(8) default NULL, + `is_paper` char(1) collate utf8_unicode_ci default NULL, + `page_count` int(8) default NULL, + `scan_date` datetime default NULL, + `scan_user` varchar(50) collate utf8_unicode_ci default NULL, + `scan_location` varchar(255) collate utf8_unicode_ci default NULL, + `scan_wkstation` varchar(255) collate utf8_unicode_ci default NULL, + `scan_batch` varchar(50) collate utf8_unicode_ci default NULL, + `burn_batch` varchar(50) collate utf8_unicode_ci default NULL, + `scan_postmark` varchar(50) collate utf8_unicode_ci default NULL, + `envelop_id` int(8) default NULL, + `status` varchar(3) collate utf8_unicode_ci default NULL, + `destination` varchar(50) collate utf8_unicode_ci default NULL, + `approver` varchar(50) collate utf8_unicode_ci default NULL, + `validation_date` datetime default NULL, + `work_batch` int(8) default NULL, + `origin` varchar(50) collate utf8_unicode_ci default NULL, + `is_ingoing` char(1) collate utf8_unicode_ci default NULL, + `priority` smallint(6) default NULL, + `arbatch_id` varchar(32) collate utf8_unicode_ci default NULL, + `custom_t1` text collate utf8_unicode_ci, + `custom_n1` int(8) default NULL, + `custom_f1` decimal(10,0) default NULL, + `custom_d1` datetime default NULL, + `custom_t2` varchar(255) collate utf8_unicode_ci default NULL, + `custom_n2` int(8) default NULL, + `custom_f2` decimal(10,0) default NULL, + `custom_d2` datetime default NULL, + `custom_t3` varchar(255) collate utf8_unicode_ci default NULL, + `custom_n3` int(8) default NULL, + `custom_f3` decimal(10,0) default NULL, + `custom_d3` datetime default NULL, + `custom_t4` varchar(255) collate utf8_unicode_ci default NULL, + `custom_n4` int(8) default NULL, + `custom_f4` decimal(10,0) default NULL, + `custom_d4` datetime default NULL, + `custom_t5` varchar(255) collate utf8_unicode_ci default NULL, + `custom_n5` int(8) default NULL, + `custom_f5` decimal(10,0) default NULL, + `custom_d5` datetime default NULL, + `custom_t6` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d6` datetime default NULL, + `custom_t7` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d7` datetime default NULL, + `custom_t8` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d8` datetime default NULL, + `custom_t9` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d9` datetime default NULL, + `custom_t10` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d10` datetime default NULL, + `custom_t11` varchar(255) collate utf8_unicode_ci default NULL, + `custom_t12` varchar(255) collate utf8_unicode_ci default NULL, + `custom_t13` varchar(255) collate utf8_unicode_ci default NULL, + `custom_t14` varchar(255) collate utf8_unicode_ci default NULL, + `custom_t15` varchar(255) collate utf8_unicode_ci default NULL, + `tablename` varchar(32) collate utf8_unicode_ci default 'res_invoices', + `initiator` varchar(50) collate utf8_unicode_ci default NULL, + `dest_user` varchar(50) collate utf8_unicode_ci default NULL, + `video_batch` int(8) default NULL, + `video_time` int(11) default NULL, + `video_user` varchar(50) collate utf8_unicode_ci default NULL, + PRIMARY KEY (`res_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; + +CREATE TABLE IF NOT EXISTS res_letterbox ( + `res_id` int(8) NOT NULL auto_increment, + `title` varchar(255) collate utf8_unicode_ci default NULL, + `subject` text collate utf8_unicode_ci, + `description` text collate utf8_unicode_ci, + `publisher` varchar(255) collate utf8_unicode_ci default NULL, + `contributor` varchar(255) collate utf8_unicode_ci default NULL, + `type_id` int(8) NOT NULL, + `format` varchar(50) collate utf8_unicode_ci NOT NULL, + `typist` varchar(50) collate utf8_unicode_ci NOT NULL, + `creation_date` datetime NOT NULL, + fulltext_result varchar(10) DEFAULT NULL, + ocr_result varchar(10) DEFAULT NULL, + converter_result varchar(10) DEFAULT NULL, + `author` varchar(255) collate utf8_unicode_ci default NULL, + `author_name` text collate utf8_unicode_ci, + `identifier` varchar(255) collate utf8_unicode_ci default NULL, + `source` varchar(255) collate utf8_unicode_ci default NULL, + `doc_language` varchar(50) collate utf8_unicode_ci default NULL, + `relation` int(8) default NULL, + `coverage` varchar(255) collate utf8_unicode_ci default NULL, + `doc_date` datetime default NULL, + `docserver_id` varchar(32) collate utf8_unicode_ci NOT NULL, + `folders_system_id` int(8) default NULL, + `arbox_id` varchar(32) collate utf8_unicode_ci default NULL, + `path` varchar(255) collate utf8_unicode_ci default NULL, + `filename` varchar(255) collate utf8_unicode_ci default NULL, + `offset_doc` varchar(255) collate utf8_unicode_ci default NULL, + `logical_adr` varchar(255) collate utf8_unicode_ci default NULL, + `fingerprint` varchar(255) collate utf8_unicode_ci default NULL, + `filesize` int(8) default NULL, + `is_paper` char(1) collate utf8_unicode_ci default NULL, + `page_count` int(8) default NULL, + `scan_date` datetime default NULL, + `scan_user` varchar(50) collate utf8_unicode_ci default NULL, + `scan_location` varchar(255) collate utf8_unicode_ci default NULL, + `scan_wkstation` varchar(255) collate utf8_unicode_ci default NULL, + `scan_batch` varchar(50) collate utf8_unicode_ci default NULL, + `burn_batch` varchar(50) collate utf8_unicode_ci default NULL, + `scan_postmark` varchar(50) collate utf8_unicode_ci default NULL, + `envelop_id` int(8) default NULL, + `status` varchar(3) collate utf8_unicode_ci default NULL, + `destination` varchar(50) collate utf8_unicode_ci default NULL, + `approver` varchar(50) collate utf8_unicode_ci default NULL, + `validation_date` datetime default NULL, + `work_batch` int(8) default NULL, + `origin` varchar(50) collate utf8_unicode_ci default NULL, + `is_ingoing` char(1) collate utf8_unicode_ci default NULL, + `priority` smallint(6) default NULL, + `arbatch_id` varchar(32) collate utf8_unicode_ci default NULL, + `custom_t1` text collate utf8_unicode_ci, + `custom_n1` int(8) default NULL, + `custom_f1` decimal(10,0) default NULL, + `custom_d1` datetime default NULL, + `custom_t2` varchar(255) collate utf8_unicode_ci default NULL, + `custom_n2` int(8) default NULL, + `custom_f2` decimal(10,0) default NULL, + `custom_d2` datetime default NULL, + `custom_t3` varchar(255) collate utf8_unicode_ci default NULL, + `custom_n3` int(8) default NULL, + `custom_f3` decimal(10,0) default NULL, + `custom_d3` datetime default NULL, + `custom_t4` varchar(255) collate utf8_unicode_ci default NULL, + `custom_n4` int(8) default NULL, + `custom_f4` decimal(10,0) default NULL, + `custom_d4` datetime default NULL, + `custom_t5` varchar(255) collate utf8_unicode_ci default NULL, + `custom_n5` int(8) default NULL, + `custom_f5` decimal(10,0) default NULL, + `custom_d5` datetime default NULL, + `custom_t6` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d6` datetime default NULL, + `custom_t7` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d7` datetime default NULL, + `custom_t8` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d8` datetime default NULL, + `custom_t9` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d9` datetime default NULL, + `custom_t10` varchar(255) collate utf8_unicode_ci default NULL, + `custom_d10` datetime default NULL, + `custom_t11` varchar(255) collate utf8_unicode_ci default NULL, + `custom_t12` varchar(255) collate utf8_unicode_ci default NULL, + `custom_t13` varchar(255) collate utf8_unicode_ci default NULL, + `custom_t14` varchar(255) collate utf8_unicode_ci default NULL, + `custom_t15` varchar(255) collate utf8_unicode_ci default NULL, + `tablename` varchar(32) collate utf8_unicode_ci default 'res_letterbox', + `initiator` varchar(50) collate utf8_unicode_ci default NULL, + `dest_user` varchar(50) collate utf8_unicode_ci default NULL, + `video_batch` int(8) default NULL, + `video_time` int(11) default NULL, + `video_user` varchar(50) collate utf8_unicode_ci default NULL, + PRIMARY KEY (`res_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; + + + +CREATE TABLE IF NOT EXISTS `mlb_coll_ext` ( + `res_id` bigint(8) NOT NULL, + `category_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `exp_contact_id` int(11) default NULL, + `exp_user_id` varchar(52) default NULL, + `dest_contact_id` int(11) default NULL, + `dest_user_id` varchar(52) default NULL, + `nature_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `alt_identifier` varchar(255) collate utf8_unicode_ci NOT NULL, + `admission_date` datetime NOT NULL, + `answer_type_bitmask` varchar(7) default '000000', + `other_answer_desc` varchar(255) collate utf8_unicode_ci default NULL, + `process_limit_date` datetime default NULL, + `process_notes` text default NULL, + `closing_date` datetime default NULL, + `alarm1_date` datetime default NULL, + `alarm2_date` datetime default NULL, + `flag_notif` char(1) default 'N' COMMENT 'N', + `flag_alarm1` char(1) default 'N' NOT NULL COMMENT 'N', + `flag_alarm2` char(1) default 'N' NOT NULL COMMENT 'N' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + +CREATE TABLE mlb_doctype_ext ( + type_id INT NOT NULL, + process_delay INT DEFAULT 21 NOT NULL, + delay1 INT DEFAULT 14 NOT NULL, + delay2 INT DEFAULT 1 NOT NULL +); + +CREATE TABLE `saved_queries` ( + `query_id` bigint(20) NOT NULL auto_increment, + `user_id` varchar(32) collate utf8_unicode_ci default NULL, + `query_name` varchar(255) collate utf8_unicode_ci NOT NULL, + `creation_date` datetime NOT NULL, + `created_by` varchar(32) collate utf8_unicode_ci NOT NULL, + `query_type` varchar(50) collate utf8_unicode_ci NOT NULL, + `query_txt` text collate utf8_unicode_ci NOT NULL, + `last_modification_date` datetime default NULL, + PRIMARY KEY (`query_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECURITY DEFINER VIEW res_view AS select r.tablename AS tablename,r.res_id +AS res_id,r.type_id AS type_id,d.description AS type_label,d.doctypes_first_level_id AS doctypes_first_level_id, +dfl.doctypes_first_level_label AS doctypes_first_level_label,d.doctypes_second_level_id AS doctypes_second_level_id, +dsl.doctypes_second_level_label AS doctypes_second_level_label,r.format AS format,r.typist AS typist,r.creation_date AS +creation_date,r.relation AS relation,r.docserver_id AS docserver_id,r.folders_system_id AS folders_system_id,f.folder_id +AS folder_id,r.path AS path,r.filename AS filename,r.fingerprint AS fingerprint,r.filesize AS filesize,r.`status` AS `status` +,r.work_batch as work_batch, r.arbatch_id, a.arbox_id, r.page_count, r.is_paper, r.doc_date, r.scan_date, r.scan_user, + r.scan_location, r.scan_wkstation, +r.scan_batch, r.doc_language, r.description, r.source, r.custom_t1 AS doc_custom_t1,r.custom_t2 AS doc_custom_t2,r.custom_t3 AS doc_custom_t3,r.custom_t4 AS doc_custom_t4,r.custom_t5 + AS doc_custom_t5,r.custom_t6 AS doc_custom_t6,r.custom_t7 AS doc_custom_t7,r.custom_t8 AS doc_custom_t8,r.custom_t9 AS + doc_custom_t9,r.custom_t10 AS doc_custom_t10,r.custom_t11 AS doc_custom_t11,r.custom_t12 AS doc_custom_t12,r.custom_t13 + AS doc_custom_t13,r.custom_t14 AS doc_custom_t14,r.custom_t15 AS doc_custom_t15,r.custom_d1 AS doc_custom_d1,r.custom_d2 AS + doc_custom_d2,r.custom_d3 AS doc_custom_d3,r.custom_d4 AS doc_custom_d4,r.custom_d5 AS doc_custom_d5,r.custom_d6 AS + doc_custom_d6,r.custom_d7 AS doc_custom_d7,r.custom_d8 AS doc_custom_d8,r.custom_d9 AS doc_custom_d9,r.custom_d10 AS + doc_custom_d10,r.custom_n1 AS doc_custom_n1,r.custom_n2 AS doc_custom_n2,r.custom_n3 AS doc_custom_n3,r.custom_n4 AS + doc_custom_n4,r.custom_n5 AS doc_custom_n5,r.custom_f1 AS doc_custom_f1,r.custom_f2 AS doc_custom_f2,r.custom_f3 AS + doc_custom_f3,r.custom_f4 AS doc_custom_f4,r.custom_f5 AS doc_custom_f5,f.foldertype_id AS foldertype_id,ft.foldertype_label + AS foldertype_label,f.custom_t1 AS fold_custom_t1,f.custom_t2 AS fold_custom_t2,f.custom_t3 AS fold_custom_t3,f.custom_t4 AS + fold_custom_t4,f.custom_t5 AS fold_custom_t5,f.custom_t6 AS fold_custom_t6,f.custom_t7 AS fold_custom_t7,f.custom_t8 AS + fold_custom_t8,f.custom_t9 AS fold_custom_t9,f.custom_t10 AS fold_custom_t10,f.custom_t11 AS fold_custom_t11,f.custom_t12 + AS fold_custom_t12,f.custom_t13 AS fold_custom_t13,f.custom_t14 AS fold_custom_t14,f.custom_t15 AS fold_custom_t15,f.custom_d1 + AS fold_custom_d1,f.custom_d2 AS fold_custom_d2,f.custom_d3 AS fold_custom_d3,f.custom_d4 AS fold_custom_d4,f.custom_d5 AS + fold_custom_d5,f.custom_d6 AS fold_custom_d6,f.custom_d7 AS fold_custom_d7,f.custom_d8 AS fold_custom_d8,f.custom_d9 AS + fold_custom_d9,f.custom_d10 AS fold_custom_d10,f.custom_n1 AS fold_custom_n1,f.custom_n2 AS fold_custom_n2,f.custom_n3 AS + fold_custom_n3,f.custom_n4 AS fold_custom_n4,f.custom_n5 AS fold_custom_n5,f.custom_f1 AS fold_custom_f1,f.custom_f2 AS + fold_custom_f2,f.custom_f3 AS fold_custom_f3,f.custom_f4 AS fold_custom_f4,f.custom_f5 AS fold_custom_f5,f.is_complete AS + fold_complete,f.`status` AS fold_status, f.folder_name, f.creation_date as fold_creation_date, r.initiator, r.destination, r.dest_user + from (((((( res_x r join folders f) join doctypes d) + join foldertypes ft) join doctypes_first_level dfl) join doctypes_second_level dsl) join ar_batch a) where ((r.folders_system_id + = f.folders_system_id) and (r.type_id = d.type_id) and (f.foldertype_id = ft.foldertype_id) and (f.`status` <> _utf8'DEL') + and (d.doctypes_first_level_id = dfl.doctypes_first_level_id) and (d.doctypes_second_level_id = dsl.doctypes_second_level_id) + and r.arbatch_id = a.arbatch_id +); + +DROP VIEW IF EXISTS `res_view_letterbox`; + +CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECURITY DEFINER VIEW res_view_letterbox AS select r.tablename AS tablename,r.res_id +AS res_id,r.type_id AS type_id,d.description AS type_label,d.doctypes_first_level_id AS doctypes_first_level_id, +dfl.doctypes_first_level_label AS doctypes_first_level_label,d.doctypes_second_level_id AS doctypes_second_level_id, +dsl.doctypes_second_level_label AS doctypes_second_level_label,r.format AS format,r.typist AS typist,r.creation_date AS +creation_date,r.relation AS relation,r.docserver_id AS docserver_id,r.folders_system_id AS folders_system_id,f.folder_id +AS folder_id,r.path AS path,r.filename AS filename,r.fingerprint AS fingerprint,r.filesize AS filesize,r.`status` AS `status` +,r.work_batch as work_batch, r.arbatch_id, r.arbox_id, r.page_count, r.is_paper, r.doc_date, r.scan_date, r.scan_user, + r.scan_location, r.scan_wkstation, +r.scan_batch, r.doc_language, r.description, r.source, r.author, r.custom_t1 AS doc_custom_t1,r.custom_t2 AS doc_custom_t2,r.custom_t3 AS doc_custom_t3,r.custom_t4 AS doc_custom_t4,r.custom_t5 + AS doc_custom_t5,r.custom_t6 AS doc_custom_t6,r.custom_t7 AS doc_custom_t7,r.custom_t8 AS doc_custom_t8,r.custom_t9 AS + doc_custom_t9,r.custom_t10 AS doc_custom_t10,r.custom_t11 AS doc_custom_t11,r.custom_t12 AS doc_custom_t12,r.custom_t13 + AS doc_custom_t13,r.custom_t14 AS doc_custom_t14,r.custom_t15 AS doc_custom_t15,r.custom_d1 AS doc_custom_d1,r.custom_d2 AS + doc_custom_d2,r.custom_d3 AS doc_custom_d3,r.custom_d4 AS doc_custom_d4,r.custom_d5 AS doc_custom_d5,r.custom_d6 AS + doc_custom_d6,r.custom_d7 AS doc_custom_d7,r.custom_d8 AS doc_custom_d8,r.custom_d9 AS doc_custom_d9,r.custom_d10 AS + doc_custom_d10,r.custom_n1 AS doc_custom_n1,r.custom_n2 AS doc_custom_n2,r.custom_n3 AS doc_custom_n3,r.custom_n4 AS + doc_custom_n4,r.custom_n5 AS doc_custom_n5,r.custom_f1 AS doc_custom_f1,r.custom_f2 AS doc_custom_f2,r.custom_f3 AS + doc_custom_f3,r.custom_f4 AS doc_custom_f4,r.custom_f5 AS doc_custom_f5,f.foldertype_id AS foldertype_id,ft.foldertype_label + AS foldertype_label,f.custom_t1 AS fold_custom_t1,f.custom_t2 AS fold_custom_t2,f.custom_t3 AS fold_custom_t3,f.custom_t4 AS + fold_custom_t4,f.custom_t5 AS fold_custom_t5,f.custom_t6 AS fold_custom_t6,f.custom_t7 AS fold_custom_t7,f.custom_t8 AS + fold_custom_t8,f.custom_t9 AS fold_custom_t9,f.custom_t10 AS fold_custom_t10,f.custom_t11 AS fold_custom_t11,f.custom_t12 + AS fold_custom_t12,f.custom_t13 AS fold_custom_t13,f.custom_t14 AS fold_custom_t14,f.custom_t15 AS fold_custom_t15,f.custom_d1 + AS fold_custom_d1,f.custom_d2 AS fold_custom_d2,f.custom_d3 AS fold_custom_d3,f.custom_d4 AS fold_custom_d4,f.custom_d5 AS + fold_custom_d5,f.custom_d6 AS fold_custom_d6,f.custom_d7 AS fold_custom_d7,f.custom_d8 AS fold_custom_d8,f.custom_d9 AS + fold_custom_d9,f.custom_d10 AS fold_custom_d10,f.custom_n1 AS fold_custom_n1,f.custom_n2 AS fold_custom_n2,f.custom_n3 AS + fold_custom_n3,f.custom_n4 AS fold_custom_n4,f.custom_n5 AS fold_custom_n5,f.custom_f1 AS fold_custom_f1,f.custom_f2 AS + fold_custom_f2,f.custom_f3 AS fold_custom_f3,f.custom_f4 AS fold_custom_f4,f.custom_f5 AS fold_custom_f5,f.is_complete AS + fold_complete,f.`status` AS fold_status, f.subject as fold_subject, f.parent_id as fold_parent_id, f.folder_level ,f.folder_name, f.creation_date as fold_creation_date, r.initiator, r.destination, r.dest_user, mlb.category_id, mlb.exp_contact_id, mlb.exp_user_id, mlb.dest_user_id, mlb.dest_contact_id, mlb.nature_id, mlb.alt_identifier, mlb.admission_date, mlb.answer_type_bitmask, mlb.other_answer_desc, mlb.process_limit_date, mlb.closing_date, mlb.alarm1_date, mlb.alarm2_date, mlb.flag_notif, mlb.flag_alarm1, mlb.flag_alarm2, r.video_user, r.video_time, r.video_batch, r.subject, r.identifier,r.title, r.priority, mlb.process_notes + from mlb_coll_ext mlb, doctypes d, doctypes_first_level dfl, doctypes_second_level dsl, ar_batch a + right outer join res_letterbox r + on r.arbatch_id = a.arbatch_id + left outer join folders f + on r.folders_system_id = f.folders_system_id + left join foldertypes ft + on (f.foldertype_id = ft.foldertype_id) and (f.`status` <> _utf8'DEL') +where +(r.type_id = d.type_id) and (d.doctypes_first_level_id = dfl.doctypes_first_level_id) and (d.doctypes_second_level_id = dsl.doctypes_second_level_id) and mlb.res_id = r.res_id ; + +CREATE TABLE `contacts` ( +`contact_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , +`lastname` VARCHAR( 255 ) NOT NULL , +`firstname` VARCHAR( 255 ) NOT NULL , +`society` VARCHAR( 255 ) NOT NULL , +`function` VARCHAR( 255 ) NOT NULL , +`address_num` VARCHAR( 32 ) NOT NULL , +`address_street` VARCHAR( 255 ) NOT NULL , +`address_complement` VARCHAR( 255 ) NOT NULL , +`address_town` VARCHAR( 255 ) NOT NULL , +`address_postal_code` VARCHAR( 255 ) NOT NULL , +`address_country` VARCHAR( 255 ) NOT NULL , +`email` VARCHAR( 255 ) NOT NULL , +`phone` VARCHAR( 20 ) NOT NULL , +`other_data` text NOT NULL , +`is_corporate_person` CHAR( 1 ) NOT NULL DEFAULT 'Y', +`user_id` VARCHAR( 32 ) NOT NULL , +`title` VARCHAR( 255 ) NOT NULL, +`enabled` CHAR( 1 ) NOT NULL DEFAULT 'Y' +) ENGINE = MYISAM ; diff --git a/maarch_entreprise/trunk/sql/structure/apps.oracle.sql b/maarch_entreprise/trunk/sql/structure/apps.oracle.sql new file mode 100644 index 0000000000000000000000000000000000000000..0362e273ae2b46de1a8fc07ebf32df935907f274 --- /dev/null +++ b/maarch_entreprise/trunk/sql/structure/apps.oracle.sql @@ -0,0 +1,268 @@ +-------------------------------------------------------- +-- DDL for Table DOCTYPES_FIRST_LEVEL +-------------------------------------------------------- + + CREATE TABLE "DOCTYPES_FIRST_LEVEL" + ( "DOCTYPES_FIRST_LEVEL_ID" NUMBER NOT NULL ENABLE, + "DOCTYPES_FIRST_LEVEL_LABEL" VARCHAR2(255) NOT NULL ENABLE, + "ENABLED" VARCHAR2(1) DEFAULT 'Y', + PRIMARY KEY ("DOCTYPES_FIRST_LEVEL_ID") ENABLE + ) ; + +-------------------------------------------------------- +-- DDL for Table DOCTYPES_SECOND_LEVEL +-------------------------------------------------------- + + CREATE TABLE "DOCTYPES_SECOND_LEVEL" + ( "DOCTYPES_SECOND_LEVEL_ID" NUMBER NOT NULL ENABLE, + "DOCTYPES_SECOND_LEVEL_LABEL" VARCHAR2(255) NOT NULL ENABLE, + "DOCTYPES_FIRST_LEVEL_ID" NUMBER NOT NULL ENABLE, + "ENABLED" VARCHAR2(1) DEFAULT 'Y', + PRIMARY KEY ("DOCTYPES_SECOND_LEVEL_ID") ENABLE + ) ; + + +-------------------------------------------------------- +-- DDL for Table RES_X +-------------------------------------------------------- + + CREATE TABLE "RES_X" + ( "RES_ID" NUMBER, + "TITLE" VARCHAR2(255 CHAR), + "SUBJECT" VARCHAR2(4000 CHAR), + "DESCRIPTION" VARCHAR2(4000), + "PUBLISHER" VARCHAR2(255 CHAR) DEFAULT NULL, + "CONTRIBUTOR" VARCHAR2(255 CHAR) DEFAULT NULL, + "TYPE_ID" NUMBER, + "FORMAT" VARCHAR2(50 CHAR), + "TYPIST" VARCHAR2(50 CHAR), + "CREATION_DATE" DATE, + "FULLTEXT_RESULT" VARCHAR2(10 CHAR) DEFAULT NULL, + "OCR_RESULT" VARCHAR2(10 CHAR) DEFAULT NULL, + "CONVERTER_RESULT" VARCHAR2(10 CHAR) DEFAULT NULL, + "AUTHOR" VARCHAR2(255 CHAR) DEFAULT NULL, + "AUTHOR_NAME" VARCHAR2(1000 CHAR), + "IDENTIFIER" VARCHAR2(255 CHAR) DEFAULT NULL, + "SOURCE" VARCHAR2(255 CHAR) DEFAULT NULL, + "DOC_LANGUAGE" VARCHAR2(50 CHAR) DEFAULT NULL, + "RELATION" NUMBER DEFAULT NULL, + "COVERAGE" VARCHAR2(255 CHAR) DEFAULT NULL, + "DOC_DATE" DATE DEFAULT NULL, + "DOCSERVER_ID" VARCHAR2(32 CHAR), + "FOLDERS_SYSTEM_ID" NUMBER DEFAULT NULL, + "ARBOX_ID" VARCHAR2(32 CHAR) DEFAULT NULL, + "PATH" VARCHAR2(255 CHAR) DEFAULT NULL, + "FILENAME" VARCHAR2(255 CHAR) DEFAULT NULL, + "OFFSET_DOC" VARCHAR2(255 CHAR) DEFAULT NULL, + "LOGICAL_ADR" VARCHAR2(255 CHAR) DEFAULT NULL, + "FINGERPRINT" VARCHAR2(255 CHAR) DEFAULT NULL, + "FILESIZE" NUMBER DEFAULT NULL, + "IS_PAPER" VARCHAR2(1 CHAR) DEFAULT NULL, + "PAGE_COUNT" NUMBER DEFAULT NULL, + "SCAN_DATE" DATE DEFAULT NULL, + "SCAN_USER" VARCHAR2(50 CHAR) DEFAULT NULL, + "SCAN_LOCATION" VARCHAR2(255 CHAR) DEFAULT NULL, + "SCAN_WKSTATION" VARCHAR2(255 CHAR) DEFAULT NULL, + "SCAN_BATCH" VARCHAR2(50 CHAR) DEFAULT NULL, + "BURN_BATCH" VARCHAR2(50 CHAR) DEFAULT NULL, + "SCAN_POSTMARK" VARCHAR2(50 CHAR) DEFAULT NULL, + "ENVELOP_ID" NUMBER DEFAULT NULL, + "STATUS" VARCHAR2(3 CHAR) DEFAULT NULL, + "DESTINATION" VARCHAR2(50 CHAR) DEFAULT NULL, + "APPROVER" VARCHAR2(50 CHAR) DEFAULT NULL, + "VALIDATION_DATE" DATE DEFAULT NULL, + "WORK_BATCH" NUMBER DEFAULT NULL, + "ORIGIN" NUMBER DEFAULT NULL, + "IS_INGOING" VARCHAR2(1 CHAR) DEFAULT NULL, + "PRIORITY" NUMBER DEFAULT NULL, + "ARBATCH_ID" VARCHAR2(32 CHAR) DEFAULT NULL, + "CUSTOM_T1" VARCHAR2(1000 CHAR), + "CUSTOM_N1" NUMBER DEFAULT NULL, + "CUSTOM_F1" NUMBER(*,0) DEFAULT NULL, + "CUSTOM_D1" DATE DEFAULT NULL, + "CUSTOM_T2" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_N2" NUMBER DEFAULT NULL, + "CUSTOM_F2" NUMBER(*,0) DEFAULT NULL, + "CUSTOM_D2" DATE DEFAULT NULL, + "CUSTOM_T3" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_N3" NUMBER DEFAULT NULL, + "CUSTOM_F3" NUMBER(*,0) DEFAULT NULL, + "CUSTOM_D3" DATE DEFAULT NULL, + "CUSTOM_T4" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_N4" NUMBER DEFAULT NULL, + "CUSTOM_F4" NUMBER(*,0) DEFAULT NULL, + "CUSTOM_D4" DATE DEFAULT NULL, + "CUSTOM_T5" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_N5" NUMBER DEFAULT NULL, + "CUSTOM_F5" NUMBER(*,0) DEFAULT NULL, + "CUSTOM_D5" DATE DEFAULT NULL, + "CUSTOM_T6" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_D6" DATE DEFAULT NULL, + "CUSTOM_T7" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_D7" DATE DEFAULT NULL, + "CUSTOM_T8" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_D8" DATE DEFAULT NULL, + "CUSTOM_T9" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_D9" DATE DEFAULT NULL, + "CUSTOM_T10" VARCHAR2(255) DEFAULT NULL, + "CUSTOM_D10" DATE DEFAULT NULL, + "CUSTOM_T11" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_T12" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_T13" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_T14" VARCHAR2(255 CHAR) DEFAULT NULL, + "CUSTOM_T15" VARCHAR2(255 CHAR) DEFAULT NULL, + "TABLENAME" VARCHAR2(32 CHAR) DEFAULT 'res_x', + "INITIATOR" VARCHAR2(50 CHAR) DEFAULT NULL, + "DEST_USER" VARCHAR2(50 CHAR) DEFAULT NULL, + "VIDEO_BATCH" NUMBER DEFAULT NULL, + "VIDEO_TIME" NUMBER DEFAULT NULL, + "VIDEO_USER" VARCHAR2(50 CHAR) + ) ; + +-------------------------------------------------------- +-- SEQUENCES AND TRIGGERS +-------------------------------------------------------- + + CREATE SEQUENCE "SEQ_DOCTYPES_FIRST_LEVEL" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE ; + create or replace TRIGGER TRG_DOCTYPES_FIRST_LEVEL + BEFORE INSERT ON DOCTYPES_FIRST_LEVEL +FOR EACH ROW +BEGIN + SELECT SEQ_DOCTYPES_FIRST_LEVEL.NEXTVAL INTO :NEW.DOCTYPES_FIRST_LEVEL_ID FROM DUAL; +END; +/ + + CREATE SEQUENCE "SEQ_DOCTYPES_SECOND_LEVEL" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE ; + create or replace TRIGGER TRG_DOCTYPES_SECOND_LEVEL + BEFORE INSERT ON DOCTYPES_SECOND_LEVEL +FOR EACH ROW +BEGIN + SELECT SEQ_DOCTYPES_SECOND_LEVEL.NEXTVAL INTO :NEW.DOCTYPES_SECOND_LEVEL_ID FROM DUAL; +END; +/ + + CREATE SEQUENCE "SEQ_RES_X" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE ; + create or replace TRIGGER TRG_RES_X + BEFORE INSERT ON RES_X +FOR EACH ROW +BEGIN + SELECT SEQ_RES_X.NEXTVAL INTO :NEW.RES_ID FROM DUAL; +END; +/ + + + + +-------------------------------------------------------- +-- DDL for View RES_VIEW +-------------------------------------------------------- + + CREATE OR REPLACE VIEW "RES_VIEW" ("RES_ID", "TITLE", "SUBJECT", "DESCRIPTION", "PUBLISHER", "CONTRIBUTOR", "TYPE_ID", "FORMAT", "TYPIST", "CREATION_DATE", "FULLTEXT_RESULT", "OCR_RESULT", "CONVERTER_RESULT", "AUTHOR", "AUTHOR_NAME", "IDENTIFIER", "SOURCE", "DOC_LANGUAGE", "RELATION", "COVERAGE", "DOC_DATE", "DOCSERVER_ID", "FOLDERS_SYSTEM_ID", "ARBOX_ID", "PATH", "FILENAME", "OFFSET_DOC", "LOGICAL_ADR", "FINGERPRINT", "FILESIZE", "IS_PAPER", "PAGE_COUNT", "SCAN_DATE", "SCAN_USER", "SCAN_LOCATION", "SCAN_WKSTATION", "SCAN_BATCH", "BURN_BATCH", "SCAN_POSTMARK", "ENVELOP_ID", "STATUS", "DESTINATION", "APPROVER", "VALIDATION_DATE", "WORK_BATCH", "ORIGIN", "IS_INGOING", "PRIORITY", "ARBATCH_ID", "DOC_CUSTOM_T1", "DOC_CUSTOM_N1", "DOC_CUSTOM_F1", "DOC_CUSTOM_D1", "DOC_CUSTOM_T2", "DOC_CUSTOM_N2", "DOC_CUSTOM_F2", "DOC_CUSTOM_D2", "DOC_CUSTOM_T3", "DOC_CUSTOM_N3", "DOC_CUSTOM_F3", "DOC_CUSTOM_D3", "DOC_CUSTOM_T4", "DOC_CUSTOM_N4", "DOC_CUSTOM_F4", "DOC_CUSTOM_D4", "DOC_CUSTOM_T5", "DOC_CUSTOM_N5", "DOC_CUSTOM_F5", "DOC_CUSTOM_D5", "DOC_CUSTOM_T6", "DOC_CUSTOM_D6", "DOC_CUSTOM_T7", "DOC_CUSTOM_D7", "DOC_CUSTOM_T8", "DOC_CUSTOM_D8", "DOC_CUSTOM_T9", "DOC_CUSTOM_D9", "DOC_CUSTOM_T10", "DOC_CUSTOM_D10", "DOC_CUSTOM_T11", "DOC_CUSTOM_T12", "DOC_CUSTOM_T13", "DOC_CUSTOM_T14", "DOC_CUSTOM_T15", "TABLENAME", "INITIATOR", "DEST_USER", "VIDEO_BATCH", "VIDEO_TIME", "VIDEO_USER", "COLL_ID", "TYPE_LABEL", "ENABLED", "DOCTYPES_FIRST_LEVEL_ID", "DOCTYPES_SECOND_LEVEL_ID", "RETENTION") AS + SELECT + RES_X.RES_ID RES_ID, + RES_X.TITLE TITLE, + RES_X.SUBJECT SUBJECT, + RES_X.DESCRIPTION DESCRIPTION, + RES_X.PUBLISHER PUBLISHER, + RES_X.CONTRIBUTOR CONTRIBUTOR, + RES_X.TYPE_ID TYPE_ID, + RES_X.FORMAT FORMAT, + RES_X.TYPIST TYPIST, + RES_X.CREATION_DATE CREATION_DATE, + RES_X.FULLTEXT_RESULT FULLTEXT_RESULT, + RES_X.OCR_RESULT OCR_RESULT, + RES_X.CONVERTER_RESULT CONVERTER_RESULT, + RES_X.AUTHOR AUTHOR, + RES_X.AUTHOR_NAME AUTHOR_NAME, + RES_X.IDENTIFIER IDENTIFIER, + RES_X.SOURCE SOURCE, + RES_X.DOC_LANGUAGE DOC_LANGUAGE, + RES_X.RELATION RELATION, + RES_X.COVERAGE COVERAGE, + RES_X.DOC_DATE DOC_DATE, + RES_X.DOCSERVER_ID DOCSERVER_ID, + RES_X.FOLDERS_SYSTEM_ID FOLDERS_SYSTEM_ID, + RES_X.ARBOX_ID ARBOX_ID, + RES_X.PATH PATH, + RES_X.FILENAME FILENAME, + RES_X.OFFSET_DOC OFFSET_DOC, + RES_X.LOGICAL_ADR LOGICAL_ADR, + RES_X.FINGERPRINT FINGERPRINT, + RES_X.FILESIZE FILESIZE, + RES_X.IS_PAPER IS_PAPER, + RES_X.PAGE_COUNT PAGE_COUNT, + RES_X.SCAN_DATE SCAN_DATE, + RES_X.SCAN_USER SCAN_USER, + RES_X.SCAN_LOCATION SCAN_LOCATION, + RES_X.SCAN_WKSTATION SCAN_WKSTATION, + RES_X.SCAN_BATCH SCAN_BATCH, + RES_X.BURN_BATCH BURN_BATCH, + RES_X.SCAN_POSTMARK SCAN_POSTMARK, + RES_X.ENVELOP_ID ENVELOP_ID, + RES_X.STATUS STATUS, + RES_X.DESTINATION DESTINATION, + RES_X.APPROVER APPROVER, + RES_X.VALIDATION_DATE VALIDATION_DATE, + RES_X.WORK_BATCH WORK_BATCH, + RES_X.ORIGIN ORIGIN, + RES_X.IS_INGOING IS_INGOING, + RES_X.PRIORITY PRIORITY, + RES_X.ARBATCH_ID ARBATCH_ID, + RES_X.CUSTOM_T1 DOC_CUSTOM_T1, + RES_X.CUSTOM_N1 DOC_CUSTOM_N1, + RES_X.CUSTOM_F1 DOC_CUSTOM_F1, + RES_X.CUSTOM_D1 DOC_CUSTOM_D1, + RES_X.CUSTOM_T2 DOC_CUSTOM_T2, + RES_X.CUSTOM_N2 DOC_CUSTOM_N2, + RES_X.CUSTOM_F2 DOC_CUSTOM_F2, + RES_X.CUSTOM_D2 DOC_CUSTOM_D2, + RES_X.CUSTOM_T3 DOC_CUSTOM_T3, + RES_X.CUSTOM_N3 DOC_CUSTOM_N3, + RES_X.CUSTOM_F3 DOC_CUSTOM_F3, + RES_X.CUSTOM_D3 DOC_CUSTOM_D3, + RES_X.CUSTOM_T4 DOC_CUSTOM_T4, + RES_X.CUSTOM_N4 DOC_CUSTOM_N4, + RES_X.CUSTOM_F4 DOC_CUSTOM_F4, + RES_X.CUSTOM_D4 DOC_CUSTOM_D4, + RES_X.CUSTOM_T5 DOC_CUSTOM_T5, + RES_X.CUSTOM_N5 DOC_CUSTOM_N5, + RES_X.CUSTOM_F5 DOC_CUSTOM_F5, + RES_X.CUSTOM_D5 DOC_CUSTOM_D5, + RES_X.CUSTOM_T6 DOC_CUSTOM_T6, + RES_X.CUSTOM_D6 DOC_CUSTOM_D6, + RES_X.CUSTOM_T7 DOC_CUSTOM_T7, + RES_X.CUSTOM_D7 DOC_CUSTOM_D7, + RES_X.CUSTOM_T8 DOC_CUSTOM_T8, + RES_X.CUSTOM_D8 DOC_CUSTOM_D8, + RES_X.CUSTOM_T9 DOC_CUSTOM_T9, + RES_X.CUSTOM_D9 DOC_CUSTOM_D9, + RES_X.CUSTOM_T10 DOC_CUSTOM_T10, + RES_X.CUSTOM_D10 DOC_CUSTOM_D10, + RES_X.CUSTOM_T11 DOC_CUSTOM_T11, + RES_X.CUSTOM_T12 DOC_CUSTOM_T12, + RES_X.CUSTOM_T13 DOC_CUSTOM_T13, + RES_X.CUSTOM_T14 DOC_CUSTOM_T14, + RES_X.CUSTOM_T15 DOC_CUSTOM_T15, + RES_X.TABLENAME TABLENAME, + RES_X.INITIATOR INITIATOR, + RES_X.DEST_USER DEST_USER, + RES_X.VIDEO_BATCH VIDEO_BATCH, + RES_X.VIDEO_TIME VIDEO_TIME, + RES_X.VIDEO_USER VIDEO_USER, + DOCTYPES.COLL_ID COLL_ID, + DOCTYPES.DESCRIPTION TYPE_LABEL, + DOCTYPES.ENABLED ENABLED, + DOCTYPES.DOCTYPES_FIRST_LEVEL_ID DOCTYPES_FIRST_LEVEL_ID, + DOCTYPES.DOCTYPES_SECOND_LEVEL_ID DOCTYPES_SECOND_LEVEL_ID, + DOCTYPES.RETENTION RETENTION +FROM + RES_X, + DOCTYPES, + DOCTYPES_FIRST_LEVEL, + DOCTYPES_SECOND_LEVEL +WHERE + DOCTYPES.TYPE_ID = RES_X.TYPE_ID AND DOCTYPES.DOCTYPES_FIRST_LEVEL_ID = DOCTYPES_FIRST_LEVEL.DOCTYPES_FIRST_LEVEL_ID AND DOCTYPES.DOCTYPES_SECOND_LEVEL_ID = DOCTYPES_SECOND_LEVEL.DOCTYPES_SECOND_LEVEL_ID; + + + + diff --git a/maarch_entreprise/trunk/sql/structure/apps.postgresql.sql b/maarch_entreprise/trunk/sql/structure/apps.postgresql.sql new file mode 100644 index 0000000000000000000000000000000000000000..ee9cfc201687a9a2a311482d6d2f6bcac0a59d55 --- /dev/null +++ b/maarch_entreprise/trunk/sql/structure/apps.postgresql.sql @@ -0,0 +1,401 @@ +CREATE SEQUENCE contact_id_seq + INCREMENT 1 + MINVALUE 14 + MAXVALUE 9223372036854775807 + START 100 + CACHE 1; +ALTER TABLE contact_id_seq OWNER TO postgres; + +CREATE TABLE contacts ( +contact_id bigint NOT NULL DEFAULT nextval('contact_id_seq'::regclass), +lastname character varying( 255 ) , +firstname character varying( 255 ) , +society character varying( 255 ) , +function character varying( 255 ), +address_num character varying( 32 ) , +address_street character varying( 255 ) , +address_complement character varying( 255 ) , +address_town character varying( 255 ) , +address_postal_code character varying( 255 ) , +address_country character varying( 255 ) , +email character varying( 255 ) , +phone character varying( 20 ) , +other_data text , +is_corporate_person character( 1 ) NOT NULL DEFAULT 'Y'::bpchar, +user_id character varying( 32 ) , +title character varying( 255 ) , +enabled character( 1 ) NOT NULL DEFAULT 'Y'::bpchar, +CONSTRAINT contacts_pkey PRIMARY KEY (contact_id) +) WITH (OIDS=FALSE); +ALTER TABLE contacts OWNER TO postgres; + + +CREATE TABLE saved_queries ( + query_id bigserial NOT NULL , + user_id character varying(32) default NULL, + query_name character varying(255) NOT NULL, + creation_date timestamp without time zone NOT NULL, + created_by character varying(32) NOT NULL, + query_type character varying(50) NOT NULL, + query_txt text NOT NULL, + last_modification_date timestamp without time zone, + CONSTRAINT saved_queries_pkey PRIMARY KEY (query_id) +) WITH (OIDS=FALSE); +ALTER TABLE saved_queries OWNER TO postgres; + +CREATE SEQUENCE doctypes_first_level_id_seq + INCREMENT 1 + MINVALUE 1 + MAXVALUE 9223372036854775807 + START 10 + CACHE 1; +ALTER TABLE doctypes_first_level_id_seq OWNER TO postgres; + +CREATE TABLE doctypes_first_level +( + doctypes_first_level_id integer NOT NULL DEFAULT nextval('doctypes_first_level_id_seq'::regclass), + doctypes_first_level_label character varying(255) NOT NULL, + enabled character(1) NOT NULL DEFAULT 'Y'::bpchar, + CONSTRAINT doctypes_first_level_pkey PRIMARY KEY (doctypes_first_level_id) +) +WITH (OIDS=FALSE); +ALTER TABLE doctypes_first_level OWNER TO postgres; + +CREATE SEQUENCE doctypes_second_level_id_seq + INCREMENT 1 + MINVALUE 1 + MAXVALUE 9223372036854775807 + START 10 + CACHE 1; +ALTER TABLE doctypes_second_level_id_seq OWNER TO postgres; + +CREATE TABLE doctypes_second_level +( + doctypes_second_level_id integer NOT NULL DEFAULT nextval('doctypes_second_level_id_seq'::regclass), + doctypes_second_level_label character varying(255) NOT NULL, + doctypes_first_level_id integer NOT NULL, + enabled character(1) NOT NULL DEFAULT 'Y'::bpchar, + CONSTRAINT doctypes_second_level_pkey PRIMARY KEY (doctypes_second_level_id) +) +WITH (OIDS=FALSE); +ALTER TABLE doctypes_second_level OWNER TO postgres; + +CREATE SEQUENCE res_id_seq + INCREMENT 1 + MINVALUE 1 + MAXVALUE 9223372036854775807 + START 100 + CACHE 1; +ALTER TABLE res_id_seq OWNER TO postgres; + +CREATE TABLE res_x +( + res_id bigint NOT NULL DEFAULT nextval('res_id_seq'::regclass), + title character varying(255) DEFAULT NULL::character varying, + subject text, + description text, + publisher character varying(255) DEFAULT NULL::character varying, + contributor character varying(255) DEFAULT NULL::character varying, + type_id bigint NOT NULL, + format character varying(50) NOT NULL, + typist character varying(50) NOT NULL, + creation_date timestamp without time zone NOT NULL, + fulltext_result character varying(10) DEFAULT NULL, + ocr_result character varying(10) DEFAULT NULL, + converter_result character varying(10) DEFAULT NULL, + author character varying(255) DEFAULT NULL::character varying, + author_name text, + identifier character varying(255) DEFAULT NULL::character varying, + source character varying(255) DEFAULT NULL::character varying, + doc_language character varying(50) DEFAULT NULL::character varying, + relation bigint, + coverage character varying(255) DEFAULT NULL::character varying, + doc_date timestamp without time zone, + docserver_id character varying(32) NOT NULL, + folders_system_id bigint, + arbox_id character varying(32) DEFAULT NULL::character varying, + path character varying(255) DEFAULT NULL::character varying, + filename character varying(255) DEFAULT NULL::character varying, + offset_doc character varying(255) DEFAULT NULL::character varying, + logical_adr character varying(255) DEFAULT NULL::character varying, + fingerprint character varying(255) DEFAULT NULL::character varying, + filesize bigint, + is_paper character(1) DEFAULT NULL::bpchar, + page_count integer, + scan_date timestamp without time zone, + scan_user character varying(50) DEFAULT NULL::character varying, + scan_location character varying(255) DEFAULT NULL::character varying, + scan_wkstation character varying(255) DEFAULT NULL::character varying, + scan_batch character varying(50) DEFAULT NULL::character varying, + burn_batch character varying(50) DEFAULT NULL::character varying, + scan_postmark character varying(50) DEFAULT NULL::character varying, + envelop_id bigint, + status character varying(3) DEFAULT NULL::character varying, + destination character varying(50) DEFAULT NULL::character varying, + approver character varying(50) DEFAULT NULL::character varying, + validation_date timestamp without time zone, + work_batch bigint, + origin character varying(50) DEFAULT NULL::character varying, + is_ingoing character(1) DEFAULT NULL::bpchar, + priority smallint, + arbatch_id bigint DEFAULT NULL, + custom_t1 text, + custom_n1 bigint, + custom_f1 numeric, + custom_d1 timestamp without time zone, + custom_t2 character varying(255) DEFAULT NULL::character varying, + custom_n2 bigint, + custom_f2 numeric, + custom_d2 timestamp without time zone, + custom_t3 character varying(255) DEFAULT NULL::character varying, + custom_n3 bigint, + custom_f3 numeric, + custom_d3 timestamp without time zone, + custom_t4 character varying(255) DEFAULT NULL::character varying, + custom_n4 bigint, + custom_f4 numeric, + custom_d4 timestamp without time zone, + custom_t5 character varying(255) DEFAULT NULL::character varying, + custom_n5 bigint, + custom_f5 numeric, + custom_d5 timestamp without time zone, + custom_t6 character varying(255) DEFAULT NULL::character varying, + custom_d6 timestamp without time zone, + custom_t7 character varying(255) DEFAULT NULL::character varying, + custom_d7 timestamp without time zone, + custom_t8 character varying(255) DEFAULT NULL::character varying, + custom_d8 timestamp without time zone, + custom_t9 character varying(255) DEFAULT NULL::character varying, + custom_d9 timestamp without time zone, + custom_t10 character varying(255) DEFAULT NULL::character varying, + custom_d10 timestamp without time zone, + custom_t11 character varying(255) DEFAULT NULL::character varying, + custom_t12 character varying(255) DEFAULT NULL::character varying, + custom_t13 character varying(255) DEFAULT NULL::character varying, + custom_t14 character varying(255) DEFAULT NULL::character varying, + custom_t15 character varying(255) DEFAULT NULL::character varying, + tablename character varying(32) DEFAULT 'res_x'::character varying, + initiator character varying(50) DEFAULT NULL::character varying, + dest_user character varying(50) DEFAULT NULL::character varying, + video_batch integer DEFAULT NULL, + video_time integer DEFAULT NULL, + video_user character varying(50) DEFAULT NULL, + CONSTRAINT res_x_pkey PRIMARY KEY (res_id) +) +WITH (OIDS=FALSE); +ALTER TABLE res_x OWNER TO postgres; + +CREATE SEQUENCE res_id_mlb_seq + INCREMENT 1 + MINVALUE 1 + MAXVALUE 9223372036854775807 + START 100 + CACHE 1; +ALTER TABLE res_id_mlb_seq OWNER TO postgres; + +CREATE TABLE res_letterbox +( + res_id bigint NOT NULL DEFAULT nextval('res_id_mlb_seq'::regclass), + title character varying(255) DEFAULT NULL::character varying, + subject text, + description text, + publisher character varying(255) DEFAULT NULL::character varying, + contributor character varying(255) DEFAULT NULL::character varying, + type_id bigint NOT NULL, + format character varying(50) NOT NULL, + typist character varying(50) NOT NULL, + creation_date timestamp without time zone NOT NULL, + fulltext_result character varying(10) DEFAULT NULL, + ocr_result character varying(10) DEFAULT NULL, + converter_result character varying(10) DEFAULT NULL, + author character varying(255) DEFAULT NULL::character varying, + author_name text, + identifier character varying(255) DEFAULT NULL::character varying, + source character varying(255) DEFAULT NULL::character varying, + doc_language character varying(50) DEFAULT NULL::character varying, + relation bigint, + coverage character varying(255) DEFAULT NULL::character varying, + doc_date timestamp without time zone, + docserver_id character varying(32) NOT NULL, + folders_system_id bigint, + arbox_id character varying(32) DEFAULT NULL::character varying, + path character varying(255) DEFAULT NULL::character varying, + filename character varying(255) DEFAULT NULL::character varying, + offset_doc character varying(255) DEFAULT NULL::character varying, + logical_adr character varying(255) DEFAULT NULL::character varying, + fingerprint character varying(255) DEFAULT NULL::character varying, + filesize bigint, + is_paper character(1) DEFAULT NULL::bpchar, + page_count integer, + scan_date timestamp without time zone, + scan_user character varying(50) DEFAULT NULL::character varying, + scan_location character varying(255) DEFAULT NULL::character varying, + scan_wkstation character varying(255) DEFAULT NULL::character varying, + scan_batch character varying(50) DEFAULT NULL::character varying, + burn_batch character varying(50) DEFAULT NULL::character varying, + scan_postmark character varying(50) DEFAULT NULL::character varying, + envelop_id bigint, + status character varying(3) DEFAULT NULL::character varying, + destination character varying(50) DEFAULT NULL::character varying, + approver character varying(50) DEFAULT NULL::character varying, + validation_date timestamp without time zone, + work_batch bigint, + origin character varying(50) DEFAULT NULL::character varying, + is_ingoing character(1) DEFAULT NULL::bpchar, + priority smallint, + arbatch_id bigint DEFAULT NULL, + custom_t1 text, + custom_n1 bigint, + custom_f1 numeric, + custom_d1 timestamp without time zone, + custom_t2 character varying(255) DEFAULT NULL::character varying, + custom_n2 bigint, + custom_f2 numeric, + custom_d2 timestamp without time zone, + custom_t3 character varying(255) DEFAULT NULL::character varying, + custom_n3 bigint, + custom_f3 numeric, + custom_d3 timestamp without time zone, + custom_t4 character varying(255) DEFAULT NULL::character varying, + custom_n4 bigint, + custom_f4 numeric, + custom_d4 timestamp without time zone, + custom_t5 character varying(255) DEFAULT NULL::character varying, + custom_n5 bigint, + custom_f5 numeric, + custom_d5 timestamp without time zone, + custom_t6 character varying(255) DEFAULT NULL::character varying, + custom_d6 timestamp without time zone, + custom_t7 character varying(255) DEFAULT NULL::character varying, + custom_d7 timestamp without time zone, + custom_t8 character varying(255) DEFAULT NULL::character varying, + custom_d8 timestamp without time zone, + custom_t9 character varying(255) DEFAULT NULL::character varying, + custom_d9 timestamp without time zone, + custom_t10 character varying(255) DEFAULT NULL::character varying, + custom_d10 timestamp without time zone, + custom_t11 character varying(255) DEFAULT NULL::character varying, + custom_t12 character varying(255) DEFAULT NULL::character varying, + custom_t13 character varying(255) DEFAULT NULL::character varying, + custom_t14 character varying(255) DEFAULT NULL::character varying, + custom_t15 character varying(255) DEFAULT NULL::character varying, + tablename character varying(32) DEFAULT 'res_invoices'::character varying, + initiator character varying(50) DEFAULT NULL::character varying, + dest_user character varying(50) DEFAULT NULL::character varying, + video_batch integer DEFAULT NULL, + video_time integer DEFAULT NULL, + video_user character varying(50) DEFAULT NULL, + CONSTRAINT res_letterbox_pkey PRIMARY KEY (res_id) +) +WITH (OIDS=FALSE); +ALTER TABLE res_letterbox OWNER TO postgres; + + +CREATE TABLE mlb_coll_ext ( + res_id bigint NOT NULL, + category_id character varying(50) NOT NULL, + exp_contact_id integer default NULL, + exp_user_id character varying(52) default NULL, + dest_contact_id integer default NULL, + dest_user_id character varying(52) default NULL, + nature_id character varying(50), + alt_identifier character varying(255) NOT NULL, + admission_date timestamp without time zone, + answer_type_bitmask character varying(7) default NULL, + other_answer_desc character varying(255) DEFAULT NULL::character varying, + process_limit_date timestamp without time zone default NULL, + process_notes text, + closing_date timestamp without time zone default NULL, + alarm1_date timestamp without time zone default NULL, + alarm2_date timestamp without time zone default NULL, + flag_notif char(1) default 'N'::character varying , + flag_alarm1 char(1) default 'N'::character varying , + flag_alarm2 char(1) default 'N'::character varying +)WITH (OIDS=FALSE); +ALTER TABLE mlb_coll_ext OWNER TO postgres; + +CREATE OR REPLACE VIEW res_view AS + SELECT r.tablename, r.res_id, r.title, r.page_count, r.identifier, r.doc_date, r.type_id, + d.description AS type_label, d.doctypes_first_level_id, dfl.doctypes_first_level_label, d.doctypes_second_level_id, + dsl.doctypes_second_level_label, r.format, r.typist, r.creation_date, r.relation, r.docserver_id, + r.folders_system_id, f.folder_id, r.path, r.filename, r.fingerprint, r.filesize, r.status, + r.work_batch, r.arbatch_id, r.arbox_id, r.is_paper, r.scan_date, r.scan_user,r.scan_location,r.scan_wkstation, + r.scan_batch,r.doc_language,r.description,r.source,r.initiator,r.destination,r.dest_user, + r.custom_t1 AS doc_custom_t1, r.custom_t2 AS doc_custom_t2, r.custom_t3 AS doc_custom_t3, + r.custom_t4 AS doc_custom_t4, r.custom_t5 AS doc_custom_t5, r.custom_t6 AS doc_custom_t6, + r.custom_t7 AS doc_custom_t7, r.custom_t8 AS doc_custom_t8, r.custom_t9 AS doc_custom_t9, + r.custom_t10 AS doc_custom_t10, r.custom_t11 AS doc_custom_t11, r.custom_t12 AS doc_custom_t12, + r.custom_t13 AS doc_custom_t13, r.custom_t14 AS doc_custom_t14, r.custom_t15 AS doc_custom_t15, + r.custom_d1 AS doc_custom_d1, r.custom_d2 AS doc_custom_d2, r.custom_d3 AS doc_custom_d3, + r.custom_d4 AS doc_custom_d4, r.custom_d5 AS doc_custom_d5, r.custom_d6 AS doc_custom_d6, + r.custom_d7 AS doc_custom_d7, r.custom_d8 AS doc_custom_d8, r.custom_d9 AS doc_custom_d9, + r.custom_d10 AS doc_custom_d10, r.custom_n1 AS doc_custom_n1, r.custom_n2 AS doc_custom_n2, + r.custom_n3 AS doc_custom_n3, r.custom_n4 AS doc_custom_n4, r.custom_n5 AS doc_custom_n5, + r.custom_f1 AS doc_custom_f1, r.custom_f2 AS doc_custom_f2, r.custom_f3 AS doc_custom_f3, + r.custom_f4 AS doc_custom_f4, r.custom_f5 AS doc_custom_f5, + f.foldertype_id, ft.foldertype_label, f.custom_t1 AS fold_custom_t1, f.custom_t2 AS fold_custom_t2, + f.custom_t3 AS fold_custom_t3, f.custom_t4 AS fold_custom_t4, f.custom_t5 AS fold_custom_t5, + f.custom_t6 AS fold_custom_t6, f.custom_t7 AS fold_custom_t7, f.custom_t8 AS fold_custom_t8, + f.custom_t9 AS fold_custom_t9, f.custom_t10 AS fold_custom_t10, f.custom_t11 AS fold_custom_t11, + f.custom_t12 AS fold_custom_t12, f.custom_t13 AS fold_custom_t13, f.custom_t14 AS fold_custom_t14, + f.custom_t15 AS fold_custom_t15, f.custom_d1 AS fold_custom_d1, f.custom_d2 AS fold_custom_d2, + f.custom_d3 AS fold_custom_d3, f.custom_d4 AS fold_custom_d4, f.custom_d5 AS fold_custom_d5, + f.custom_d6 AS fold_custom_d6, f.custom_d7 AS fold_custom_d7, f.custom_d8 AS fold_custom_d8, + f.custom_d9 AS fold_custom_d9, f.custom_d10 AS fold_custom_d10, f.custom_n1 AS fold_custom_n1, + f.custom_n2 AS fold_custom_n2, f.custom_n3 AS fold_custom_n3, f.custom_n4 AS fold_custom_n4, + f.custom_n5 AS fold_custom_n5, f.custom_f1 AS fold_custom_f1, f.custom_f2 AS fold_custom_f2, + f.custom_f3 AS fold_custom_f3, f.custom_f4 AS fold_custom_f4, f.custom_f5 AS fold_custom_f5, + f.is_complete AS fold_complete, f.status AS fold_status, f.folder_name, f.creation_date as fold_creation_date + FROM folders f, doctypes d, foldertypes ft, doctypes_first_level dfl, doctypes_second_level dsl, res_x r + WHERE r.folders_system_id = f.folders_system_id AND r.type_id = d.type_id AND f.foldertype_id = ft.foldertype_id + AND f.status::text <> 'DEL'::text AND d.doctypes_first_level_id = dfl.doctypes_first_level_id AND + d.doctypes_second_level_id = dsl.doctypes_second_level_id ; + +ALTER TABLE res_view OWNER TO postgres; + +CREATE OR REPLACE VIEW res_view_letterbox AS + select r.tablename AS tablename,r.res_id +AS res_id,r.type_id AS type_id,d.description AS type_label,d.doctypes_first_level_id AS doctypes_first_level_id, +dfl.doctypes_first_level_label AS doctypes_first_level_label,d.doctypes_second_level_id AS doctypes_second_level_id, +dsl.doctypes_second_level_label AS doctypes_second_level_label,r.format AS format,r.typist AS typist,r.creation_date AS +creation_date,r.relation AS relation,r.docserver_id AS docserver_id,r.folders_system_id AS folders_system_id,f.folder_id +AS folder_id,r.path AS path,r.filename AS filename,r.fingerprint AS fingerprint,r.filesize AS filesize,r.status AS status +,r.work_batch as work_batch, r.arbatch_id, r.arbox_id, r.page_count, r.is_paper, r.doc_date, r.scan_date, r.scan_user, + r.scan_location, r.scan_wkstation, +r.scan_batch, r.doc_language, r.description, r.source, r.author, r.custom_t1 AS doc_custom_t1,r.custom_t2 AS doc_custom_t2,r.custom_t3 AS doc_custom_t3,r.custom_t4 AS doc_custom_t4,r.custom_t5 + AS doc_custom_t5,r.custom_t6 AS doc_custom_t6,r.custom_t7 AS doc_custom_t7,r.custom_t8 AS doc_custom_t8,r.custom_t9 AS + doc_custom_t9,r.custom_t10 AS doc_custom_t10,r.custom_t11 AS doc_custom_t11,r.custom_t12 AS doc_custom_t12,r.custom_t13 + AS doc_custom_t13,r.custom_t14 AS doc_custom_t14,r.custom_t15 AS doc_custom_t15,r.custom_d1 AS doc_custom_d1,r.custom_d2 AS + doc_custom_d2,r.custom_d3 AS doc_custom_d3,r.custom_d4 AS doc_custom_d4,r.custom_d5 AS doc_custom_d5,r.custom_d6 AS + doc_custom_d6,r.custom_d7 AS doc_custom_d7,r.custom_d8 AS doc_custom_d8,r.custom_d9 AS doc_custom_d9,r.custom_d10 AS + doc_custom_d10,r.custom_n1 AS doc_custom_n1,r.custom_n2 AS doc_custom_n2,r.custom_n3 AS doc_custom_n3,r.custom_n4 AS + doc_custom_n4,r.custom_n5 AS doc_custom_n5,r.custom_f1 AS doc_custom_f1,r.custom_f2 AS doc_custom_f2,r.custom_f3 AS + doc_custom_f3,r.custom_f4 AS doc_custom_f4,r.custom_f5 AS doc_custom_f5,f.foldertype_id AS foldertype_id,ft.foldertype_label + AS foldertype_label,f.custom_t1 AS fold_custom_t1,f.custom_t2 AS fold_custom_t2,f.custom_t3 AS fold_custom_t3,f.custom_t4 AS + fold_custom_t4,f.custom_t5 AS fold_custom_t5,f.custom_t6 AS fold_custom_t6,f.custom_t7 AS fold_custom_t7,f.custom_t8 AS + fold_custom_t8,f.custom_t9 AS fold_custom_t9,f.custom_t10 AS fold_custom_t10,f.custom_t11 AS fold_custom_t11,f.custom_t12 + AS fold_custom_t12,f.custom_t13 AS fold_custom_t13,f.custom_t14 AS fold_custom_t14,f.custom_t15 AS fold_custom_t15,f.custom_d1 + AS fold_custom_d1,f.custom_d2 AS fold_custom_d2,f.custom_d3 AS fold_custom_d3,f.custom_d4 AS fold_custom_d4,f.custom_d5 AS + fold_custom_d5,f.custom_d6 AS fold_custom_d6,f.custom_d7 AS fold_custom_d7,f.custom_d8 AS fold_custom_d8,f.custom_d9 AS + fold_custom_d9,f.custom_d10 AS fold_custom_d10,f.custom_n1 AS fold_custom_n1,f.custom_n2 AS fold_custom_n2,f.custom_n3 AS + fold_custom_n3,f.custom_n4 AS fold_custom_n4,f.custom_n5 AS fold_custom_n5,f.custom_f1 AS fold_custom_f1,f.custom_f2 AS + fold_custom_f2,f.custom_f3 AS fold_custom_f3,f.custom_f4 AS fold_custom_f4,f.custom_f5 AS fold_custom_f5,f.is_complete AS + fold_complete,f.status AS fold_status, f.subject as fold_subject, f.parent_id as fold_parent_id, f.folder_level ,f.folder_name, f.creation_date as fold_creation_date, r.initiator, r.destination, r.dest_user, mlb.category_id, mlb.exp_contact_id, mlb.exp_user_id, mlb.dest_user_id, mlb.dest_contact_id, mlb.nature_id, mlb.alt_identifier, mlb.admission_date, mlb.answer_type_bitmask, mlb.other_answer_desc, mlb.process_limit_date, mlb.closing_date, mlb.alarm1_date, mlb.alarm2_date, mlb.flag_notif, mlb.flag_alarm1, mlb.flag_alarm2, r.video_user, r.video_time, r.video_batch, r.subject, r.identifier,r.title, r.priority, mlb.process_notes + from mlb_coll_ext mlb, doctypes d, doctypes_first_level dfl, doctypes_second_level dsl, ar_batch a + right outer join res_letterbox r + on r.arbatch_id = a.arbatch_id + left outer join folders f + on r.folders_system_id = f.folders_system_id + left join foldertypes ft + on (f.foldertype_id = ft.foldertype_id) and (f.status <> 'DEL'::text) +where +(r.type_id = d.type_id) and (d.doctypes_first_level_id = dfl.doctypes_first_level_id) and (d.doctypes_second_level_id = dsl.doctypes_second_level_id) and mlb.res_id = r.res_id ; + +ALTER TABLE res_view_letterbox OWNER TO postgres; + +CREATE OR REPLACE VIEW res_view_apa AS + select * from res_apa; + +ALTER TABLE res_view_apa OWNER TO postgres; + + diff --git a/maarch_entreprise/trunk/template/document_list_extend.html b/maarch_entreprise/trunk/template/document_list_extend.html new file mode 100644 index 0000000000000000000000000000000000000000..3d5c35c21bd44f1fe68a45c167bdbec9025733e5 --- /dev/null +++ b/maarch_entreprise/trunk/template/document_list_extend.html @@ -0,0 +1,151 @@ +<!-- + +* basket_list and search_adv_list template +* +* +* @package Maarch LetterBox 3.0 +* @version 3.0 +* @since 10/2005 +* @license GPL +* @author Loïc Vinet <dev@maarch.org> +* + + + + +Parts : + ##HEAD< : Begining of the head part + ##HEAD> : End of the head part + + ##RESULT< : Begining of result list + ##RESULT> : End fo result list + +Functions : + ##load_css|arg1## : load css style - arg1= name of this class + ##css_line|coll|nonecoll## : load css style for line arg1,arg2 : switch beetwin style on line one or line two + ##css_line_reload## : reload last css style loaded by css_line + ##order_link|arg1|arg2## : reload list and change order; arg1=type; arg2=sort + + ##url_docview## : open view of document; + ##url_docdetail## : open detail of document; + ##url_download## : download document; + + ##load_img|arg1## : show loaded image; arg1= name of img file + + ##load_value|arg|##: load value in the db; arg1= column's value identifier + + + +Mods : + + ##func_bool_radio_form## : Activate bool_radio_form in class_list_show.php + ##func_bool_check_form## : Activate bool_check_form in class_list_show.php + ##func_bool_view_doc## : Activate func to view documents + ##func_bool_detail_doc## : Activate func to view documents detail's page + ##func_display_category_img## : Return icon defined in the category + +Defines : + _NAME_OF_LANG_INSTANCE : u se constant define in lang.php + + + +--> + + +#!#TABLE +<!-- -------------------------------------------------------------------------> +<table border="0" cellspacing="0" class="##load_css|listing spec zero_padding ##" id='test' style = "padding: 0px;"> + + +#!#HEAD +<!-- -------------------------------------------------------------------------> + <thead border ="1"> + <tr> + <th width="100%" colspan="2"> + <div align="center" style="border:1px solid; height:20px;margin-bottom:10px;padding-top:10px;vertical-align:middle;font-size:8px;"> + + ##define_lang|_SORT_BY## : + ##define_lang|_NUM_GED## + <a href="##order_link|res_id|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|res_id|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_TYPE## + <a href="##order_link|type_id|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|type_id|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_SUBJECT## + <a href="##order_link|subject|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|subject|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_DEST_USER## + <a href="##order_link|dest_user|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|dest_user|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_REG_DATE## + <a href="##order_link|creation_date|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|creation_date|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + ##define_lang|_PROCESS_LIMIT_DATE## + <a href="##order_link|process_limit_date|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|process_limit_date|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_ENTITY## + <a href="##order_link|destination|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|destination|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_CATEGORY## + <a href="##order_link|category_id|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|category_id|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + </div> + </th> + </tr> + </thead> + + <tbody> +#!#RESULT +<!-- -------------------------------------------------------------------------> + + <tr class="##css_line|col|white ##" > + + <td width="10%" ##func_click_form##> + <!--<div align="center"><img src="##load_img|contact_maarch.gif##" alt="##load_value|status##" title="##load_value|status##"> </div>--> + <div align="center">##load_value|status## </div> + </td> + <td width="90%" align="center" style="padding : 0px; vertical-align:top" colspan="3" ##func_click_form##> + <table width="100%" border="0" cellspacing="0" cellpadding="0" > + <tr> + <td width="68%" style="font-size:12px;"><b><!--##define_lang|_SUBJECT## :--></b><em>##load_value|subject##</em> </td> + <td width="32%"> + <table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td width="40%" style="text-align:right">##define_lang|_CONTACT## :</td><td style="text-align:right">##load_value|exp_user_id##</td> + </tr> + <tr><td> </td><td></td></tr> + <tr> + <td style="text-align:right">##define_lang|_ENTITY## :</td><td style="text-align:right">##load_value|destination##</td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class="##css_line_reload##"> + <td style="text-align:center" style="font-size:13px;"> ##func_bool_check_form##<b>##load_value|res_id##</b></td> + <td style="text-align:center" ##func_click_form##> + <table width="100%" border="0" cellspacing="0" cellpadding="0" > + <tr> + <td width ="30px" alt="##define_lang|_CATEGORY##" title="##define_lang|_CATEGORY##">##load_value|category_img##</td> + <td width ="150px">##load_value|category_id##</td> + <td width ="30px" alt="##define_lang|_ADMISSION_DATE##" title="##define_lang|_ADMISSION_DATE##"><img src="##load_img|date_arriv.gif##"> </td> + <td width ="100px">##load_value|admission_date##</td> + <td width ="30px" alt="##define_lang|_PROCESS_LIMIT_DATE##" title="##define_lang|_PROCESS_LIMIT_DATE##"><img src="##load_img|date_limit.gif##"> </td> + <td width ="100px">##load_value|process_limit_date##</td> + <td width ="30px" style="text-align:right" alt="##define_lang|_DEST_USER##" title="##define_lang|_DEST_USER##"><img src="##load_img|manage_users_entities_b_small.gif##"></td> + <td width ="110px" > ##load_value|dest_user##</td> + <td width ="30px" alt="##define_lang|_TYPE##" title="##define_lang|_TYPE##" style="text-align:right"><img src="##load_img|mini_type.gif##"> + <td style="text-align:left">##load_value|type_label##</td> + </tr> + </table> + </td> + </tr > + <tr><td colspan="6" style="background-color: white;"></td></tr> + + + + #!#FOOTER + <!-- -------------------------------------------------------------------------> + </tbody> + </table> + diff --git a/maarch_entreprise/trunk/template/search_adv.html b/maarch_entreprise/trunk/template/search_adv.html new file mode 100644 index 0000000000000000000000000000000000000000..b361b34328436020ae6fedb272f09c3eb8a832aa --- /dev/null +++ b/maarch_entreprise/trunk/template/search_adv.html @@ -0,0 +1,147 @@ +<!-- + +* basket_list and search_adv_list template +* +* +* @package Maarch LetterBox 3.0 +* @version 3.0 +* @since 10/2005 +* @license GPL +* @author Loïc Vinet <dev@maarch.org> +* + + + + +Parts : + ##HEAD< : Begining of the head part + ##HEAD> : End of the head part + + ##RESULT< : Begining of result list + ##RESULT> : End fo result list + +Functions : + ##load_css|arg1## : load css style - arg1= name of this class + ##css_line|coll|nonecoll## : load css style for line arg1,arg2 : switch beetwin style on line one or line two + ##css_line_reload## : reload last css style loaded by css_line + ##order_link|arg1|arg2## : reload list and change order; arg1=type; arg2=sort + + ##url_docview## : open view of document; + ##url_docdetail## : open detail of document; + ##url_download## : download document; + + ##load_img|arg1## : show loaded image; arg1= name of img file + + ##load_value|arg|##: load value in the db; arg1= column's value identifier + + + +Mods : + + ##func_bool_radio_form## : Activate bool_radio_form in class_list_show.php + ##func_bool_check_form## : Activate bool_check_form in class_list_show.php + ##func_bool_view_doc## : Activate func to view documents + ##func_bool_detail_doc## : Activate func to view documents detail's page + +Defines : + _NAME_OF_LANG_INSTANCE : u se constant define in lang.php + + + +--> + + +#!#TABLE +<!-- -------------------------------------------------------------------------> +<table border="0" cellspacing="0" class="##load_css|listing spec zero_padding ##" id='test' style = "padding: 0px;"> + + +#!#HEAD +<!-- -------------------------------------------------------------------------> + <thead border ="1"> + <tr> + <th width="100%" colspan="2"> + <div align="center" style="border:1px solid; height:20px;margin-bottom:10px;padding-top:10px;vertical-align:middle;"> + + ##define_lang|_SORT_BY## : + ##define_lang|_NUM_GED## + <a href="##order_link|res_id|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|res_id|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_TYPE## + <a href="##order_link|type_id|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|type_id|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_SUBJECT## + <a href="##order_link|subject|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|subject|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_DEST_USER## + <a href="##order_link|dest_user|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|dest_user|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_REG_DATE## + <a href="##order_link|creation_date|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|creation_date|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_ENTITY## + <a href="##order_link|destination|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|destination|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + + ##define_lang|_CATEGORY## + <a href="##order_link|category_id|desc##" title="##define_lang|_DESC_SORT##"><img src="##load_img|tri_down.gif##" border="0" alt="##define_lang|_DESC_SORT##" /> </a> <a href="##order_link|category_id|asc##" title="##define_lang|_ASC_SORT##"> <img src="##load_img|tri_up.gif##" border="0" alt="##define_lang|_ASC_SORT##" /></a> + </div> + </th> + </tr> + </thead> + + <tbody> +#!#RESULT +<!-- -------------------------------------------------------------------------> + + <tr class="##css_line|col|white ##" > + + <td width="10%"> + <!--<div align="center"><img src="##load_img|contact_maarch.gif##" alt="##load_value|status##" title="##load_value|status##"> </div>--> + <div align="center">##load_value|status##</div> + </td> + <td width="90%" align="center" style="padding : 0px; vertical-align:top" colspan="3" > + <table width="100%" border="0" cellspacing="0" cellpadding="0" > + <tr> + <td width="68%" style="font-size:12px;"><b><!--##define_lang|_SUBJECT## :--></b><em>##load_value|subject##</em> </td> + <td width="32%"> + <table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td width="40%" style="text-align:right">##define_lang|_CONTACT## :</td><td style="text-align:right">##load_value|exp_user_id##</td> + </tr> + <tr><td> </td><td></td></tr> + <tr> + <td style="text-align:right">##define_lang|_ENTITY## :</td><td style="text-align:right">##load_value|destination##</td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class="##css_line_reload##"> + <td style="text-align:center" style="font-size:13px;"><b>##load_value|res_id##</b></td> + <td style="text-align:center"> + <table width="100%" border="0" cellspacing="0" cellpadding="0" > + <tr> + <td width ="30px">##load_value|category_img##</td> + <td width ="170px">##load_value|category_id##</td> + <td width ="30px"><img src="##load_img|date_arriv.gif##"> </td> + <td width ="100px">##load_value|creation_date##</td> + <td width ="30px" style="text-align:right"><img src="##load_img|manage_users_entities_b_small.gif##"></td> + <td width ="190px"> ##load_value|dest_user##</td> + <td width ="30px" style="text-align:right"><img src="##load_img|mini_type.gif##"> + <td style="text-align:left">##load_value|type_label##</td> + <td width ="60px">##func_bool_view_doc## ##func_bool_detail_doc##</td> + </tr> + </table> + </td> + </tr > + <tr><td colspan="6" style="background-color: white;"></td></tr> + + + + #!#FOOTER + <!-- -------------------------------------------------------------------------> + </tbody> + </table> + diff --git a/maarch_entreprise/trunk/tools/Zend/Exception.php b/maarch_entreprise/trunk/tools/Zend/Exception.php new file mode 100644 index 0000000000000000000000000000000000000000..628e9ce7e1c3df3f918ee4b3876afbd8e87aba62 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Exception.php @@ -0,0 +1,30 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * @category Zend + * @package Zend + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Exception extends Exception +{} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Exception.php b/maarch_entreprise/trunk/tools/Zend/Search/Exception.php new file mode 100644 index 0000000000000000000000000000000000000000..4013f62836cb75828a42dd093fe7a307be28f729 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Exception.php @@ -0,0 +1,36 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * Framework base exception + */ +require_once 'Zend/Exception.php'; + + +/** + * @category Zend + * @package Zend_Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Exception extends Zend_Exception +{} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene.php new file mode 100644 index 0000000000000000000000000000000000000000..edc8256f30b0fc6574dbf8bd1ede00d471bf0068 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene.php @@ -0,0 +1,1533 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Document */ +require_once 'Zend/Search/Lucene/Document.php'; + +/** Zend_Search_Lucene_Document_Html */ +require_once 'Zend/Search/Lucene/Document/Html.php'; + +/** Zend_Search_Lucene_Document_Docx */ +require_once 'Zend/Search/Lucene/Document/Docx.php'; + +/** Zend_Search_Lucene_Document_Pptx */ +require_once 'Zend/Search/Lucene/Document/Pptx.php'; + +/** Zend_Search_Lucene_Document_Xlsx */ +require_once 'Zend/Search/Lucene/Document/Xlsx.php'; + +/** Zend_Search_Lucene_Storage_Directory_Filesystem */ +require_once 'Zend/Search/Lucene/Storage/Directory/Filesystem.php'; + +/** Zend_Search_Lucene_Storage_File_Memory */ +require_once 'Zend/Search/Lucene/Storage/File/Memory.php'; + +/** Zend_Search_Lucene_Index_Term */ +require_once 'Zend/Search/Lucene/Index/Term.php'; + +/** Zend_Search_Lucene_Index_TermInfo */ +require_once 'Zend/Search/Lucene/Index/TermInfo.php'; + +/** Zend_Search_Lucene_Index_SegmentInfo */ +require_once 'Zend/Search/Lucene/Index/SegmentInfo.php'; + +/** Zend_Search_Lucene_Index_FieldInfo */ +require_once 'Zend/Search/Lucene/Index/FieldInfo.php'; + +/** Zend_Search_Lucene_Index_Writer */ +require_once 'Zend/Search/Lucene/Index/Writer.php'; + +/** Zend_Search_Lucene_Search_QueryParser */ +require_once 'Zend/Search/Lucene/Search/QueryParser.php'; + +/** Zend_Search_Lucene_Search_QueryHit */ +require_once 'Zend/Search/Lucene/Search/QueryHit.php'; + +/** Zend_Search_Lucene_Search_Similarity */ +require_once 'Zend/Search/Lucene/Search/Similarity.php'; + +/** Zend_Search_Lucene_Index_SegmentInfoPriorityQueue */ +require_once 'Zend/Search/Lucene/Index/SegmentInfoPriorityQueue.php'; + +/** Zend_Search_Lucene_Index_DocsFilter */ +require_once 'Zend/Search/Lucene/Index/DocsFilter.php'; + +/** Zend_Search_Lucene_LockManager */ +require_once 'Zend/Search/Lucene/LockManager.php'; + + + +/** Zend_Search_Lucene_Interface */ +require_once 'Zend/Search/Lucene/Interface.php'; + +/** Zend_Search_Lucene_Proxy */ +require_once 'Zend/Search/Lucene/Proxy.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene implements Zend_Search_Lucene_Interface +{ + /** + * Default field name for search + * + * Null means search through all fields + * + * @var string + */ + private static $_defaultSearchField = null; + + /** + * Result set limit + * + * 0 means no limit + * + * @var integer + */ + private static $_resultSetLimit = 0; + + /** + * File system adapter. + * + * @var Zend_Search_Lucene_Storage_Directory + */ + private $_directory = null; + + /** + * File system adapter closing option + * + * @var boolean + */ + private $_closeDirOnExit = true; + + /** + * Writer for this index, not instantiated unless required. + * + * @var Zend_Search_Lucene_Index_Writer + */ + private $_writer = null; + + /** + * Array of Zend_Search_Lucene_Index_SegmentInfo objects for this index. + * + * @var array Zend_Search_Lucene_Index_SegmentInfo + */ + private $_segmentInfos = array(); + + /** + * Number of documents in this index. + * + * @var integer + */ + private $_docCount = 0; + + /** + * Flag for index changes + * + * @var boolean + */ + private $_hasChanges = false; + + + /** + * Signal, that index is already closed, changes are fixed and resources are cleaned up + * + * @var boolean + */ + private $_closed = false; + + /** + * Number of references to the index object + * + * @var integer + */ + private $_refCount = 0; + + /** + * Current segment generation + * + * @var integer + */ + private $_generation; + + const FORMAT_PRE_2_1 = 0; + const FORMAT_2_1 = 1; + const FORMAT_2_3 = 2; + + /** + * Index format version + * + * @var integer + */ + private $_formatVersion; + + /** + * Create index + * + * @param mixed $directory + * @return Zend_Search_Lucene_Interface + */ + public static function create($directory) + { + return new Zend_Search_Lucene_Proxy(new Zend_Search_Lucene($directory, true)); + } + + /** + * Open index + * + * @param mixed $directory + * @return Zend_Search_Lucene_Interface + */ + public static function open($directory) + { + return new Zend_Search_Lucene_Proxy(new Zend_Search_Lucene($directory, false)); + } + + /** Generation retrieving counter */ + const GENERATION_RETRIEVE_COUNT = 10; + + /** Pause between generation retrieving attempts in milliseconds */ + const GENERATION_RETRIEVE_PAUSE = 50; + + /** + * Get current generation number + * + * Returns generation number + * 0 means pre-2.1 index format + * -1 means there are no segments files. + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @return integer + * @throws Zend_Search_Lucene_Exception + */ + public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory) + { + /** + * Zend_Search_Lucene uses segments.gen file to retrieve current generation number + * + * Apache Lucene index format documentation mentions this method only as a fallback method + * + * Nevertheless we use it according to the performance considerations + * + * @todo check if we can use some modification of Apache Lucene generation determination algorithm + * without performance problems + */ + + try { + for ($count = 0; $count < self::GENERATION_RETRIEVE_COUNT; $count++) { + // Try to get generation file + $genFile = $directory->getFileObject('segments.gen', false); + + $format = $genFile->readInt(); + if ($format != (int)0xFFFFFFFE) { + throw new Zend_Search_Lucene_Exception('Wrong segments.gen file format'); + } + + $gen1 = $genFile->readLong(); + $gen2 = $genFile->readLong(); + + if ($gen1 == $gen2) { + return $gen1; + } + + usleep(self::GENERATION_RETRIEVE_PAUSE * 1000); + } + + // All passes are failed + throw new Zend_Search_Lucene_Exception('Index is under processing now'); + } catch (Zend_Search_Lucene_Exception $e) { + if (strpos($e->getMessage(), 'is not readable') !== false) { + try { + // Try to open old style segments file + $segmentsFile = $directory->getFileObject('segments', false); + + // It's pre-2.1 index + return 0; + } catch (Zend_Search_Lucene_Exception $e) { + if (strpos($e->getMessage(), 'is not readable') !== false) { + return -1; + } else { + throw $e; + } + } + } else { + throw $e; + } + } + + return -1; + } + + /** + * Get segments file name + * + * @param integer $generation + * @return string + */ + public static function getSegmentFileName($generation) + { + if ($generation == 0) { + return 'segments'; + } + + return 'segments_' . base_convert($generation, 10, 36); + } + + /** + * Get index format version + * + * @return integer + */ + public function getFormatVersion() + { + return $this->_formatVersion; + } + + /** + * Set index format version. + * Index is converted to this format at the nearest upfdate time + * + * @param int $formatVersion + * @throws Zend_Search_Lucene_Exception + */ + public function setFormatVersion($formatVersion) + { + if ($formatVersion != self::FORMAT_PRE_2_1 && + $formatVersion != self::FORMAT_2_1 && + $formatVersion != self::FORMAT_2_3) { + throw new Zend_Search_Lucene_Exception('Unsupported index format'); + } + + $this->_formatVersion = $formatVersion; + } + + /** + * Read segments file for pre-2.1 Lucene index format + * + * @throws Zend_Search_Lucene_Exception + */ + private function _readPre21SegmentsFile() + { + $segmentsFile = $this->_directory->getFileObject('segments'); + + $format = $segmentsFile->readInt(); + + if ($format != (int)0xFFFFFFFF) { + throw new Zend_Search_Lucene_Exception('Wrong segments file format'); + } + + // read version + // $segmentsFile->readLong(); + $segmentsFile->readInt(); $segmentsFile->readInt(); + + // read segment name counter + $segmentsFile->readInt(); + + $segments = $segmentsFile->readInt(); + + $this->_docCount = 0; + + // read segmentInfos + for ($count = 0; $count < $segments; $count++) { + $segName = $segmentsFile->readString(); + $segSize = $segmentsFile->readInt(); + $this->_docCount += $segSize; + + $this->_segmentInfos[$segName] = + new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, + $segName, + $segSize); + } + + // Use 2.1 as a target version. Index will be reorganized at update time. + $this->_formatVersion = self::FORMAT_2_1; + } + + /** + * Read segments file + * + * @throws Zend_Search_Lucene_Exception + */ + private function _readSegmentsFile() + { + $segmentsFile = $this->_directory->getFileObject(self::getSegmentFileName($this->_generation)); + + $format = $segmentsFile->readInt(); + + if ($format == (int)0xFFFFFFFC) { + $this->_formatVersion = self::FORMAT_2_3; + } else if ($format == (int)0xFFFFFFFD) { + $this->_formatVersion = self::FORMAT_2_1; + } else { + throw new Zend_Search_Lucene_Exception('Unsupported segments file format'); + } + + // read version + // $segmentsFile->readLong(); + $segmentsFile->readInt(); $segmentsFile->readInt(); + + // read segment name counter + $segmentsFile->readInt(); + + $segments = $segmentsFile->readInt(); + + $this->_docCount = 0; + + // read segmentInfos + for ($count = 0; $count < $segments; $count++) { + $segName = $segmentsFile->readString(); + $segSize = $segmentsFile->readInt(); + + // 2.1+ specific properties + //$delGen = $segmentsFile->readLong(); + $delGenHigh = $segmentsFile->readInt(); + $delGenLow = $segmentsFile->readInt(); + if ($delGenHigh == (int)0xFFFFFFFF && $delGenLow == (int)0xFFFFFFFF) { + $delGen = -1; // There are no deletes + } else { + $delGen = ($delGenHigh << 32) | $delGenLow; + } + + if ($this->_formatVersion == self::FORMAT_2_3) { + $docStoreOffset = $segmentsFile->readInt(); + + if ($docStoreOffset != -1) { + $docStoreSegment = $segmentsFile->readString(); + $docStoreIsCompoundFile = $segmentsFile->readByte(); + + $docStoreOptions = array('offset' => $docStoreOffset, + 'segment' => $docStoreSegment, + 'isCompound' => ($docStoreIsCompoundFile == 1)); + } else { + $docStoreOptions = null; + } + } else { + $docStoreOptions = null; + } + + $hasSingleNormFile = $segmentsFile->readByte(); + $numField = $segmentsFile->readInt(); + + $normGens = array(); + if ($numField != (int)0xFFFFFFFF) { + for ($count1 = 0; $count1 < $numField; $count1++) { + $normGens[] = $segmentsFile->readLong(); + } + + throw new Zend_Search_Lucene_Exception('Separate norm files are not supported. Optimize index to use it with Zend_Search_Lucene.'); + } + + $isCompoundByte = $segmentsFile->readByte(); + + if ($isCompoundByte == 0xFF) { + // The segment is not a compound file + $isCompound = false; + } else if ($isCompoundByte == 0x00) { + // The status is unknown + $isCompound = null; + } else if ($isCompoundByte == 0x01) { + // The segment is a compound file + $isCompound = true; + } + + $this->_docCount += $segSize; + + $this->_segmentInfos[$segName] = + new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, + $segName, + $segSize, + $delGen, + $docStoreOptions, + $hasSingleNormFile, + $isCompound); + } + } + + /** + * Opens the index. + * + * IndexReader constructor needs Directory as a parameter. It should be + * a string with a path to the index folder or a Directory object. + * + * @param mixed $directory + * @throws Zend_Search_Lucene_Exception + */ + public function __construct($directory = null, $create = false) + { + if ($directory === null) { + throw new Zend_Search_Exception('No index directory specified'); + } + + if ($directory instanceof Zend_Search_Lucene_Storage_Directory_Filesystem) { + $this->_directory = $directory; + $this->_closeDirOnExit = false; + } else { + $this->_directory = new Zend_Search_Lucene_Storage_Directory_Filesystem($directory); + $this->_closeDirOnExit = true; + } + + $this->_segmentInfos = array(); + + // Mark index as "under processing" to prevent other processes from premature index cleaning + Zend_Search_Lucene_LockManager::obtainReadLock($this->_directory); + + $this->_generation = self::getActualGeneration($this->_directory); + + if ($create) { + try { + Zend_Search_Lucene_LockManager::obtainWriteLock($this->_directory); + } catch (Zend_Search_Lucene_Exception $e) { + Zend_Search_Lucene_LockManager::releaseReadLock($this->_directory); + + if (strpos($e->getMessage(), 'Can\'t obtain exclusive index lock') === false) { + throw $e; + } else { + throw new Zend_Search_Lucene_Exception('Can\'t create index. It\'s under processing now'); + } + } + + if ($this->_generation == -1) { + // Directory doesn't contain existing index, start from 1 + $this->_generation = 1; + $nameCounter = 0; + } else { + // Directory contains existing index + $segmentsFile = $this->_directory->getFileObject(self::getSegmentFileName($this->_generation)); + $segmentsFile->seek(12); // 12 = 4 (int, file format marker) + 8 (long, index version) + + $nameCounter = $segmentsFile->readInt(); + $this->_generation++; + } + + Zend_Search_Lucene_Index_Writer::createIndex($this->_directory, $this->_generation, $nameCounter); + + Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); + } + + if ($this->_generation == -1) { + throw new Zend_Search_Lucene_Exception('Index doesn\'t exists in the specified directory.'); + } else if ($this->_generation == 0) { + $this->_readPre21SegmentsFile(); + } else { + $this->_readSegmentsFile(); + } + } + + /** + * Close current index and free resources + */ + private function _close() + { + if ($this->_closed) { + // index is already closed and resources are cleaned up + return; + } + + $this->commit(); + + // Release "under processing" flag + Zend_Search_Lucene_LockManager::releaseReadLock($this->_directory); + + if ($this->_closeDirOnExit) { + $this->_directory->close(); + } + + $this->_directory = null; + $this->_writer = null; + $this->_segmentInfos = null; + + $this->_closed = true; + } + + /** + * Add reference to the index object + * + * @internal + */ + public function addReference() + { + $this->_refCount++; + } + + /** + * Remove reference from the index object + * + * When reference count becomes zero, index is closed and resources are cleaned up + * + * @internal + */ + public function removeReference() + { + $this->_refCount--; + + if ($this->_refCount == 0) { + $this->_close(); + } + } + + /** + * Object destructor + */ + public function __destruct() + { + $this->_close(); + } + + /** + * Returns an instance of Zend_Search_Lucene_Index_Writer for the index + * + * @return Zend_Search_Lucene_Index_Writer + */ + private function _getIndexWriter() + { + if (!$this->_writer instanceof Zend_Search_Lucene_Index_Writer) { + $this->_writer = new Zend_Search_Lucene_Index_Writer($this->_directory, $this->_segmentInfos, $this->_formatVersion); + } + + return $this->_writer; + } + + + /** + * Returns the Zend_Search_Lucene_Storage_Directory instance for this index. + * + * @return Zend_Search_Lucene_Storage_Directory + */ + public function getDirectory() + { + return $this->_directory; + } + + + /** + * Returns the total number of documents in this index (including deleted documents). + * + * @return integer + */ + public function count() + { + return $this->_docCount; + } + + /** + * Returns one greater than the largest possible document number. + * This may be used to, e.g., determine how big to allocate a structure which will have + * an element for every document number in an index. + * + * @return integer + */ + public function maxDoc() + { + return $this->count(); + } + + /** + * Returns the total number of non-deleted documents in this index. + * + * @return integer + */ + public function numDocs() + { + $numDocs = 0; + + foreach ($this->_segmentInfos as $segmentInfo) { + $numDocs += $segmentInfo->numDocs(); + } + + return $numDocs; + } + + /** + * Checks, that document is deleted + * + * @param integer $id + * @return boolean + * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range + */ + public function isDeleted($id) + { + if ($id >= $this->_docCount) { + throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); + } + + $segmentStartId = 0; + foreach ($this->_segmentInfos as $segmentInfo) { + if ($segmentStartId + $segmentInfo->count() > $id) { + break; + } + + $segmentStartId += $segmentInfo->count(); + } + + return $segmentInfo->isDeleted($id - $segmentStartId); + } + + /** + * Set default search field. + * + * Null means, that search is performed through all fields by default + * + * Default value is null + * + * @param string $fieldName + */ + public static function setDefaultSearchField($fieldName) + { + self::$_defaultSearchField = $fieldName; + } + + /** + * Get default search field. + * + * Null means, that search is performed through all fields by default + * + * @return string + */ + public static function getDefaultSearchField() + { + return self::$_defaultSearchField; + } + + /** + * Set result set limit. + * + * 0 (default) means no limit + * + * @param integer $limit + */ + public static function setResultSetLimit($limit) + { + self::$_resultSetLimit = $limit; + } + + /** + * Set result set limit. + * + * 0 means no limit + * + * @return integer + */ + public static function getResultSetLimit() + { + return self::$_resultSetLimit; + } + + /** + * Retrieve index maxBufferedDocs option + * + * maxBufferedDocs is a minimal number of documents required before + * the buffered in-memory documents are written into a new Segment + * + * Default value is 10 + * + * @return integer + */ + public function getMaxBufferedDocs() + { + return $this->_getIndexWriter()->maxBufferedDocs; + } + + /** + * Set index maxBufferedDocs option + * + * maxBufferedDocs is a minimal number of documents required before + * the buffered in-memory documents are written into a new Segment + * + * Default value is 10 + * + * @param integer $maxBufferedDocs + */ + public function setMaxBufferedDocs($maxBufferedDocs) + { + $this->_getIndexWriter()->maxBufferedDocs = $maxBufferedDocs; + } + + /** + * Retrieve index maxMergeDocs option + * + * maxMergeDocs is a largest number of documents ever merged by addDocument(). + * Small values (e.g., less than 10,000) are best for interactive indexing, + * as this limits the length of pauses while indexing to a few seconds. + * Larger values are best for batched indexing and speedier searches. + * + * Default value is PHP_INT_MAX + * + * @return integer + */ + public function getMaxMergeDocs() + { + return $this->_getIndexWriter()->maxMergeDocs; + } + + /** + * Set index maxMergeDocs option + * + * maxMergeDocs is a largest number of documents ever merged by addDocument(). + * Small values (e.g., less than 10,000) are best for interactive indexing, + * as this limits the length of pauses while indexing to a few seconds. + * Larger values are best for batched indexing and speedier searches. + * + * Default value is PHP_INT_MAX + * + * @param integer $maxMergeDocs + */ + public function setMaxMergeDocs($maxMergeDocs) + { + $this->_getIndexWriter()->maxMergeDocs = $maxMergeDocs; + } + + /** + * Retrieve index mergeFactor option + * + * mergeFactor determines how often segment indices are merged by addDocument(). + * With smaller values, less RAM is used while indexing, + * and searches on unoptimized indices are faster, + * but indexing speed is slower. + * With larger values, more RAM is used during indexing, + * and while searches on unoptimized indices are slower, + * indexing is faster. + * Thus larger values (> 10) are best for batch index creation, + * and smaller values (< 10) for indices that are interactively maintained. + * + * Default value is 10 + * + * @return integer + */ + public function getMergeFactor() + { + return $this->_getIndexWriter()->mergeFactor; + } + + /** + * Set index mergeFactor option + * + * mergeFactor determines how often segment indices are merged by addDocument(). + * With smaller values, less RAM is used while indexing, + * and searches on unoptimized indices are faster, + * but indexing speed is slower. + * With larger values, more RAM is used during indexing, + * and while searches on unoptimized indices are slower, + * indexing is faster. + * Thus larger values (> 10) are best for batch index creation, + * and smaller values (< 10) for indices that are interactively maintained. + * + * Default value is 10 + * + * @param integer $maxMergeDocs + */ + public function setMergeFactor($mergeFactor) + { + $this->_getIndexWriter()->mergeFactor = $mergeFactor; + } + + /** + * Performs a query against the index and returns an array + * of Zend_Search_Lucene_Search_QueryHit objects. + * Input is a string or Zend_Search_Lucene_Search_Query. + * + * @param mixed $query + * @return array Zend_Search_Lucene_Search_QueryHit + * @throws Zend_Search_Lucene_Exception + */ + public function find($query) + { + if (is_string($query)) { + $query = Zend_Search_Lucene_Search_QueryParser::parse($query); + } + + if (!$query instanceof Zend_Search_Lucene_Search_Query) { + throw new Zend_Search_Lucene_Exception('Query must be a string or Zend_Search_Lucene_Search_Query object'); + } + + $this->commit(); + + $hits = array(); + $scores = array(); + $ids = array(); + + $query = $query->rewrite($this)->optimize($this); + + $query->execute($this); + + $topScore = 0; + + foreach ($query->matchedDocs() as $id => $num) { + $docScore = $query->score($id, $this); + if( $docScore != 0 ) { + $hit = new Zend_Search_Lucene_Search_QueryHit($this); + $hit->id = $id; + $hit->score = $docScore; + + $hits[] = $hit; + $ids[] = $id; + $scores[] = $docScore; + + if ($docScore > $topScore) { + $topScore = $docScore; + } + } + + if (self::$_resultSetLimit != 0 && count($hits) >= self::$_resultSetLimit) { + break; + } + } + + if (count($hits) == 0) { + // skip sorting, which may cause a error on empty index + return array(); + } + + if ($topScore > 1) { + foreach ($hits as $hit) { + $hit->score /= $topScore; + } + } + + if (func_num_args() == 1) { + // sort by scores + array_multisort($scores, SORT_DESC, SORT_NUMERIC, + $ids, SORT_ASC, SORT_NUMERIC, + $hits); + } else { + // sort by given field names + + $argList = func_get_args(); + $fieldNames = $this->getFieldNames(); + $sortArgs = array(); + + for ($count = 1; $count < count($argList); $count++) { + $fieldName = $argList[$count]; + + if (!is_string($fieldName)) { + throw new Zend_Search_Lucene_Exception('Field name must be a string.'); + } + + if (!in_array($fieldName, $fieldNames)) { + throw new Zend_Search_Lucene_Exception('Wrong field name.'); + } + + $valuesArray = array(); + foreach ($hits as $hit) { + try { + $value = $hit->getDocument()->getFieldValue($fieldName); + } catch (Zend_Search_Lucene_Exception $e) { + if (strpos($e->getMessage(), 'not found') === false) { + throw $e; + } else { + $value = null; + } + } + + $valuesArray[] = $value; + } + + $sortArgs[] = $valuesArray; + + if ($count + 1 < count($argList) && is_integer($argList[$count+1])) { + $count++; + $sortArgs[] = $argList[$count]; + + if ($count + 1 < count($argList) && is_integer($argList[$count+1])) { + $count++; + $sortArgs[] = $argList[$count]; + } else { + if ($argList[$count] == SORT_ASC || $argList[$count] == SORT_DESC) { + $sortArgs[] = SORT_REGULAR; + } else { + $sortArgs[] = SORT_ASC; + } + } + } else { + $sortArgs[] = SORT_ASC; + $sortArgs[] = SORT_REGULAR; + } + } + + // Sort by id's if values are equal + $sortArgs[] = $ids; + $sortArgs[] = SORT_ASC; + $sortArgs[] = SORT_NUMERIC; + + // Array to be sorted + $sortArgs[] = &$hits; + + // Do sort + call_user_func_array('array_multisort', $sortArgs); + } + + return $hits; + } + + + /** + * Returns a list of all unique field names that exist in this index. + * + * @param boolean $indexed + * @return array + */ + public function getFieldNames($indexed = false) + { + $result = array(); + foreach( $this->_segmentInfos as $segmentInfo ) { + $result = array_merge($result, $segmentInfo->getFields($indexed)); + } + return $result; + } + + + /** + * Returns a Zend_Search_Lucene_Document object for the document + * number $id in this index. + * + * @param integer|Zend_Search_Lucene_Search_QueryHit $id + * @return Zend_Search_Lucene_Document + */ + public function getDocument($id) + { + if ($id instanceof Zend_Search_Lucene_Search_QueryHit) { + /* @var $id Zend_Search_Lucene_Search_QueryHit */ + $id = $id->id; + } + + if ($id >= $this->_docCount) { + throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); + } + + $segmentStartId = 0; + foreach ($this->_segmentInfos as $segmentInfo) { + if ($segmentStartId + $segmentInfo->count() > $id) { + break; + } + + $segmentStartId += $segmentInfo->count(); + } + + $fdxFile = $segmentInfo->openCompoundFile('.fdx'); + $fdxFile->seek(($id-$segmentStartId)*8, SEEK_CUR); + $fieldValuesPosition = $fdxFile->readLong(); + + $fdtFile = $segmentInfo->openCompoundFile('.fdt'); + $fdtFile->seek($fieldValuesPosition, SEEK_CUR); + $fieldCount = $fdtFile->readVInt(); + + $doc = new Zend_Search_Lucene_Document(); + for ($count = 0; $count < $fieldCount; $count++) { + $fieldNum = $fdtFile->readVInt(); + $bits = $fdtFile->readByte(); + + $fieldInfo = $segmentInfo->getField($fieldNum); + + if (!($bits & 2)) { // Text data + $field = new Zend_Search_Lucene_Field($fieldInfo->name, + $fdtFile->readString(), + 'UTF-8', + true, + $fieldInfo->isIndexed, + $bits & 1 ); + } else { // Binary data + $field = new Zend_Search_Lucene_Field($fieldInfo->name, + $fdtFile->readBinary(), + '', + true, + $fieldInfo->isIndexed, + $bits & 1, + true ); + } + + $doc->addField($field); + } + + return $doc; + } + + + /** + * Returns true if index contain documents with specified term. + * + * Is used for query optimization. + * + * @param Zend_Search_Lucene_Index_Term $term + * @return boolean + */ + public function hasTerm(Zend_Search_Lucene_Index_Term $term) + { + foreach ($this->_segmentInfos as $segInfo) { + if ($segInfo->getTermInfo($term) instanceof Zend_Search_Lucene_Index_TermInfo) { + return true; + } + } + + return false; + } + + /** + * Returns IDs of all documents containing term. + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return array + */ + public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) + { + $subResults = array(); + $segmentStartDocId = 0; + + foreach ($this->_segmentInfos as $segmentInfo) { + $subResults[] = $segmentInfo->termDocs($term, $segmentStartDocId, $docsFilter); + + $segmentStartDocId += $segmentInfo->count(); + } + + if (count($subResults) == 0) { + return array(); + } else if (count($subResults) == 0) { + // Index is optimized (only one segment) + // Do not perform array reindexing + return reset($subResults); + } else { + $result = call_user_func_array('array_merge', $subResults); + } + + return $result; + } + + /** + * Returns documents filter for all documents containing term. + * + * It performs the same operation as termDocs, but return result as + * Zend_Search_Lucene_Index_DocsFilter object + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return Zend_Search_Lucene_Index_DocsFilter + */ + public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) + { + $segmentStartDocId = 0; + $result = new Zend_Search_Lucene_Index_DocsFilter(); + + foreach ($this->_segmentInfos as $segmentInfo) { + $subResults[] = $segmentInfo->termDocs($term, $segmentStartDocId, $docsFilter); + + $segmentStartDocId += $segmentInfo->count(); + } + + if (count($subResults) == 0) { + return array(); + } else if (count($subResults) == 0) { + // Index is optimized (only one segment) + // Do not perform array reindexing + return reset($subResults); + } else { + $result = call_user_func_array('array_merge', $subResults); + } + + return $result; + } + + + /** + * Returns an array of all term freqs. + * Result array structure: array(docId => freq, ...) + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return integer + */ + public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) + { + $result = array(); + $segmentStartDocId = 0; + foreach ($this->_segmentInfos as $segmentInfo) { + $result += $segmentInfo->termFreqs($term, $segmentStartDocId, $docsFilter); + + $segmentStartDocId += $segmentInfo->count(); + } + + return $result; + } + + /** + * Returns an array of all term positions in the documents. + * Result array structure: array(docId => array(pos1, pos2, ...), ...) + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return array + */ + public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) + { + $result = array(); + $segmentStartDocId = 0; + foreach ($this->_segmentInfos as $segmentInfo) { + $result += $segmentInfo->termPositions($term, $segmentStartDocId, $docsFilter); + + $segmentStartDocId += $segmentInfo->count(); + } + + return $result; + } + + + /** + * Returns the number of documents in this index containing the $term. + * + * @param Zend_Search_Lucene_Index_Term $term + * @return integer + */ + public function docFreq(Zend_Search_Lucene_Index_Term $term) + { + $result = 0; + foreach ($this->_segmentInfos as $segInfo) { + $termInfo = $segInfo->getTermInfo($term); + if ($termInfo !== null) { + $result += $termInfo->docFreq; + } + } + + return $result; + } + + + /** + * Retrive similarity used by index reader + * + * @return Zend_Search_Lucene_Search_Similarity + */ + public function getSimilarity() + { + return Zend_Search_Lucene_Search_Similarity::getDefault(); + } + + + /** + * Returns a normalization factor for "field, document" pair. + * + * @param integer $id + * @param string $fieldName + * @return float + */ + public function norm($id, $fieldName) + { + if ($id >= $this->_docCount) { + return null; + } + + $segmentStartId = 0; + foreach ($this->_segmentInfos as $segInfo) { + if ($segmentStartId + $segInfo->count() > $id) { + break; + } + + $segmentStartId += $segInfo->count(); + } + + if ($segInfo->isDeleted($id - $segmentStartId)) { + return 0; + } + + return $segInfo->norm($id - $segmentStartId, $fieldName); + } + + /** + * Returns true if any documents have been deleted from this index. + * + * @return boolean + */ + public function hasDeletions() + { + foreach ($this->_segmentInfos as $segmentInfo) { + if ($segmentInfo->hasDeletions()) { + return true; + } + } + + return false; + } + + + /** + * Deletes a document from the index. + * $id is an internal document id + * + * @param integer|Zend_Search_Lucene_Search_QueryHit $id + * @throws Zend_Search_Lucene_Exception + */ + public function delete($id) + { + if ($id instanceof Zend_Search_Lucene_Search_QueryHit) { + /* @var $id Zend_Search_Lucene_Search_QueryHit */ + $id = $id->id; + } + + if ($id >= $this->_docCount) { + throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); + } + + $segmentStartId = 0; + foreach ($this->_segmentInfos as $segmentInfo) { + if ($segmentStartId + $segmentInfo->count() > $id) { + break; + } + + $segmentStartId += $segmentInfo->count(); + } + $segmentInfo->delete($id - $segmentStartId); + + $this->_hasChanges = true; + } + + + + /** + * Adds a document to this index. + * + * @param Zend_Search_Lucene_Document $document + */ + public function addDocument(Zend_Search_Lucene_Document $document) + { + $this->_getIndexWriter()->addDocument($document); + $this->_docCount++; + + $this->_hasChanges = true; + } + + + /** + * Update document counter + */ + private function _updateDocCount() + { + $this->_docCount = 0; + foreach ($this->_segmentInfos as $segInfo) { + $this->_docCount += $segInfo->count(); + } + } + + /** + * Commit changes resulting from delete() or undeleteAll() operations. + * + * @todo undeleteAll processing. + */ + public function commit() + { + if ($this->_hasChanges) { + $this->_getIndexWriter()->commit(); + + $this->_updateDocCount(); + + $this->_hasChanges = false; + } + } + + + /** + * Optimize index. + * + * Merges all segments into one + */ + public function optimize() + { + // Commit changes if any changes have been made + $this->commit(); + + if (count($this->_segmentInfos) > 1 || $this->hasDeletions()) { + $this->_getIndexWriter()->optimize(); + $this->_updateDocCount(); + } + } + + + /** + * Returns an array of all terms in this index. + * + * @return array + */ + public function terms() + { + $result = array(); + + $segmentInfoQueue = new Zend_Search_Lucene_Index_SegmentInfoPriorityQueue(); + + foreach ($this->_segmentInfos as $segmentInfo) { + $segmentInfo->reset(); + + // Skip "empty" segments + if ($segmentInfo->currentTerm() !== null) { + $segmentInfoQueue->put($segmentInfo); + } + } + + while (($segmentInfo = $segmentInfoQueue->pop()) !== null) { + if ($segmentInfoQueue->top() === null || + $segmentInfoQueue->top()->currentTerm()->key() != + $segmentInfo->currentTerm()->key()) { + // We got new term + $result[] = $segmentInfo->currentTerm(); + } + + if ($segmentInfo->nextTerm() !== null) { + // Put segment back into the priority queue + $segmentInfoQueue->put($segmentInfo); + } + } + + return $result; + } + + + /** + * Terms stream queue + * + * @var Zend_Search_Lucene_Index_SegmentInfoPriorityQueue + */ + private $_termsStreamQueue = null; + + /** + * Last Term in a terms stream + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_lastTerm = null; + + /** + * Reset terms stream. + */ + public function resetTermsStream() + { + $this->_termsStreamQueue = new Zend_Search_Lucene_Index_SegmentInfoPriorityQueue(); + + foreach ($this->_segmentInfos as $segmentInfo) { + $segmentInfo->reset(); + + // Skip "empty" segments + if ($segmentInfo->currentTerm() !== null) { + $this->_termsStreamQueue->put($segmentInfo); + } + } + + $this->nextTerm(); + } + + /** + * Skip terms stream up to specified term preffix. + * + * Prefix contains fully specified field info and portion of searched term + * + * @param Zend_Search_Lucene_Index_Term $prefix + */ + public function skipTo(Zend_Search_Lucene_Index_Term $prefix) + { + $segments = array(); + + while (($segmentInfo = $this->_termsStreamQueue->pop()) !== null) { + $segments[] = $segmentInfo; + } + + foreach ($segments as $segmentInfo) { + $segmentInfo->skipTo($prefix); + + if ($segmentInfo->currentTerm() !== null) { + $this->_termsStreamQueue->put($segmentInfo); + } + } + + $this->nextTerm(); + } + + /** + * Scans terms dictionary and returns next term + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function nextTerm() + { + while (($segmentInfo = $this->_termsStreamQueue->pop()) !== null) { + if ($this->_termsStreamQueue->top() === null || + $this->_termsStreamQueue->top()->currentTerm()->key() != + $segmentInfo->currentTerm()->key()) { + // We got new term + $this->_lastTerm = $segmentInfo->currentTerm(); + + if ($segmentInfo->nextTerm() !== null) { + // Put segment back into the priority queue + $this->_termsStreamQueue->put($segmentInfo); + } + + return $this->_lastTerm; + } + + if ($segmentInfo->nextTerm() !== null) { + // Put segment back into the priority queue + $this->_termsStreamQueue->put($segmentInfo); + } + } + + // End of stream + $this->_lastTerm = null; + + return null; + } + + /** + * Returns term in current position + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function currentTerm() + { + return $this->_lastTerm; + } + + /** + * Close terms stream + * + * Should be used for resources clean up if stream is not read up to the end + */ + public function closeTermsStream() + { + while (($segmentInfo = $this->_termsStreamQueue->pop()) !== null) { + $segmentInfo->closeTermsStream(); + } + + $this->_termsStreamQueue = null; + $this->_lastTerm = null; + } + + + /************************************************************************* + @todo UNIMPLEMENTED + *************************************************************************/ + /** + * Undeletes all documents currently marked as deleted in this index. + * + * @todo Implementation + */ + public function undeleteAll() + {} +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer.php new file mode 100644 index 0000000000000000000000000000000000000000..40cb43af855a6686978f7665f7a27cc89bfc7f92 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer.php @@ -0,0 +1,176 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Token */ +require_once 'Zend/Search/Lucene/Analysis/Token.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8 */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Text */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php'; + +/** Zend_Search_Lucene_Analysis_TokenFilter_StopWords */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php'; + +/** Zend_Search_Lucene_Analysis_TokenFilter_ShortWords */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php'; + + +/** + * An Analyzer is used to analyze text. + * It thus represents a policy for extracting index terms from text. + * + * Note: + * Lucene Java implementation is oriented to streams. It provides effective work + * with a huge documents (more then 20Mb). + * But engine itself is not oriented such documents. + * Thus Zend_Search_Lucene analysis API works with data strings and sets (arrays). + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +abstract class Zend_Search_Lucene_Analysis_Analyzer +{ + /** + * The Analyzer implementation used by default. + * + * @var Zend_Search_Lucene_Analysis_Analyzer + */ + private static $_defaultImpl; + + /** + * Input string + * + * @var string + */ + protected $_input = null; + + /** + * Input string encoding + * + * @var string + */ + protected $_encoding = ''; + + /** + * Tokenize text to a terms + * Returns array of Zend_Search_Lucene_Analysis_Token objects + * + * Tokens are returned in UTF-8 (internal Zend_Search_Lucene encoding) + * + * @param string $data + * @return array + */ + public function tokenize($data, $encoding = '') + { + $this->setInput($data, $encoding); + + $tokenList = array(); + while (($nextToken = $this->nextToken()) !== null) { + $tokenList[] = $nextToken; + } + + return $tokenList; + } + + + /** + * Tokenization stream API + * Set input + * + * @param string $data + */ + public function setInput($data, $encoding = '') + { + $this->_input = $data; + $this->_encoding = $encoding; + $this->reset(); + } + + /** + * Reset token stream + */ + abstract public function reset(); + + /** + * Tokenization stream API + * Get next token + * Returns null at the end of stream + * + * Tokens are returned in UTF-8 (internal Zend_Search_Lucene encoding) + * + * @return Zend_Search_Lucene_Analysis_Token|null + */ + abstract public function nextToken(); + + + + + /** + * Set the default Analyzer implementation used by indexing code. + * + * @param Zend_Search_Lucene_Analysis_Analyzer $similarity + */ + public static function setDefault(Zend_Search_Lucene_Analysis_Analyzer $analyzer) + { + self::$_defaultImpl = $analyzer; + } + + + /** + * Return the default Analyzer implementation used by indexing code. + * + * @return Zend_Search_Lucene_Analysis_Analyzer + */ + public static function getDefault() + { + if (!self::$_defaultImpl instanceof Zend_Search_Lucene_Analysis_Analyzer) { + self::$_defaultImpl = new Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive(); + } + + return self::$_defaultImpl; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common.php new file mode 100644 index 0000000000000000000000000000000000000000..f78cbc4b4f28fb45fd6759b4561bd870eb577151 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common.php @@ -0,0 +1,80 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer.php'; + + +/** + * Common implementation of the Zend_Search_Lucene_Analysis_Analyzer interface. + * There are several standard standard subclasses provided by Zend_Search_Lucene/Analysis + * subpackage: Zend_Search_Lucene_Analysis_Analyzer_Common_Text, ZSearchHTMLAnalyzer, ZSearchXMLAnalyzer. + * + * @todo ZSearchHTMLAnalyzer and ZSearchXMLAnalyzer implementation + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Analysis_Analyzer_Common extends Zend_Search_Lucene_Analysis_Analyzer +{ + /** + * The set of Token filters applied to the Token stream. + * Array of Zend_Search_Lucene_Analysis_TokenFilter objects. + * + * @var array + */ + private $_filters = array(); + + /** + * Add Token filter to the Analyzer + * + * @param Zend_Search_Lucene_Analysis_TokenFilter $filter + */ + public function addFilter(Zend_Search_Lucene_Analysis_TokenFilter $filter) + { + $this->_filters[] = $filter; + } + + /** + * Apply filters to the token. Can return null when the token was removed. + * + * @param Zend_Search_Lucene_Analysis_Token $token + * @return Zend_Search_Lucene_Analysis_Token + */ + public function normalize(Zend_Search_Lucene_Analysis_Token $token) + { + foreach ($this->_filters as $filter) { + $token = $filter->normalize($token); + + // resulting token can be null if the filter removes it + if (is_null($token)) { + return null; + } + } + + return $token; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php new file mode 100644 index 0000000000000000000000000000000000000000..443464eded969e6dcdf362143fb77a331a475448 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php @@ -0,0 +1,95 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer_Common */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +class Zend_Search_Lucene_Analysis_Analyzer_Common_Text extends Zend_Search_Lucene_Analysis_Analyzer_Common +{ + /** + * Current position in a stream + * + * @var integer + */ + private $_position; + + /** + * Reset token stream + */ + public function reset() + { + $this->_position = 0; + + if ($this->_input === null) { + return; + } + + // convert input into ascii + if (PHP_OS != 'AIX') { + $this->_input = iconv($this->_encoding, 'ASCII//TRANSLIT', $this->_input); + } + $this->_encoding = 'ASCII'; + } + + /** + * Tokenization stream API + * Get next token + * Returns null at the end of stream + * + * @return Zend_Search_Lucene_Analysis_Token|null + */ + public function nextToken() + { + if ($this->_input === null) { + return null; + } + + + do { + if (! preg_match('/[a-zA-Z]+/', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_position)) { + // It covers both cases a) there are no matches (preg_match(...) === 0) + // b) error occured (preg_match(...) === FALSE) + return null; + } + + $str = $match[0][0]; + $pos = $match[0][1]; + $endpos = $pos + strlen($str); + + $this->_position = $endpos; + + $token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($str, $pos, $endpos)); + } while ($token === null); // try again if token is skipped + + return $token; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php new file mode 100644 index 0000000000000000000000000000000000000000..15d357da01bfdf074e9b7d604566b59616beb832 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php @@ -0,0 +1,46 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Text */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php'; + +/** Zend_Search_Lucene_Analysis_TokenFilter_LowerCase */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter/LowerCase.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +class Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive extends Zend_Search_Lucene_Analysis_Analyzer_Common_Text +{ + public function __construct() + { + $this->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_LowerCase()); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php new file mode 100644 index 0000000000000000000000000000000000000000..a34fccef65710f51db7f1dd66cdb0ce178cb662f --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php @@ -0,0 +1,94 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer_Common */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +class Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum extends Zend_Search_Lucene_Analysis_Analyzer_Common +{ + /** + * Current position in a stream + * + * @var integer + */ + private $_position; + + /** + * Reset token stream + */ + public function reset() + { + $this->_position = 0; + + if ($this->_input === null) { + return; + } + + // convert input into ascii + if (PHP_OS != 'AIX') { + $this->_input = iconv($this->_encoding, 'ASCII//TRANSLIT', $this->_input); + } + $this->_encoding = 'ASCII'; + } + + /** + * Tokenization stream API + * Get next token + * Returns null at the end of stream + * + * @return Zend_Search_Lucene_Analysis_Token|null + */ + public function nextToken() + { + if ($this->_input === null) { + return null; + } + + do { + if (! preg_match('/[a-zA-Z0-9]+/', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_position)) { + // It covers both cases a) there are no matches (preg_match(...) === 0) + // b) error occured (preg_match(...) === FALSE) + return null; + } + + $str = $match[0][0]; + $pos = $match[0][1]; + $endpos = $pos + strlen($str); + + $this->_position = $endpos; + + $token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($str, $pos, $endpos)); + } while ($token === null); // try again if token is skipped + + return $token; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php new file mode 100644 index 0000000000000000000000000000000000000000..f8f2f80f78b36b7d5856a0ddbfe58623fb91ee8f --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php @@ -0,0 +1,46 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php'; + +/** Zend_Search_Lucene_Analysis_TokenFilter_LowerCase */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter/LowerCase.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +class Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive extends Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum +{ + public function __construct() + { + $this->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_LowerCase()); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php new file mode 100644 index 0000000000000000000000000000000000000000..4c53cecc1afc07b3a9dc98d1b217617e4f4c106f --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php @@ -0,0 +1,125 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer_Common */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +class Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8 extends Zend_Search_Lucene_Analysis_Analyzer_Common +{ + /** + * Current char position in an UTF-8 stream + * + * @var integer + */ + private $_position; + + /** + * Current binary position in an UTF-8 stream + * + * @var integer + */ + private $_bytePosition; + + /** + * Object constructor + * + * @throws Zend_Search_Lucene_Exception + */ + public function __construct() + { + if (@preg_match('/\pL/u', 'a') != 1) { + // PCRE unicode support is turned off + require_once 'Zend/Search/Lucene/Exception.php'; + throw new Zend_Search_Lucene_Exception('Utf8 analyzer needs PCRE unicode support to be enabled.'); + } + } + + /** + * Reset token stream + */ + public function reset() + { + $this->_position = 0; + $this->_bytePosition = 0; + + // convert input into UTF-8 + if (strcasecmp($this->_encoding, 'utf8' ) != 0 && + strcasecmp($this->_encoding, 'utf-8') != 0 ) { + $this->_input = iconv($this->_encoding, 'UTF-8', $this->_input); + $this->_encoding = 'UTF-8'; + } + } + + /** + * Tokenization stream API + * Get next token + * Returns null at the end of stream + * + * @return Zend_Search_Lucene_Analysis_Token|null + */ + public function nextToken() + { + if ($this->_input === null) { + return null; + } + + do { + if (! preg_match('/[\p{L}]+/u', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_bytePosition)) { + // It covers both cases a) there are no matches (preg_match(...) === 0) + // b) error occured (preg_match(...) === FALSE) + return null; + } + + // matched string + $matchedWord = $match[0][0]; + + // binary position of the matched word in the input stream + $binStartPos = $match[0][1]; + + // character position of the matched word in the input stream + $startPos = $this->_position + + iconv_strlen(substr($this->_input, + $this->_bytePosition, + $binStartPos - $this->_bytePosition), + 'UTF-8'); + // character postion of the end of matched word in the input stream + $endPos = $startPos + iconv_strlen($matchedWord, 'UTF-8'); + + $this->_bytePosition = $binStartPos + strlen($matchedWord); + $this->_position = $endPos; + + $token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($matchedWord, $startPos, $endPos)); + } while ($token === null); // try again if token is skipped + + return $token; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php new file mode 100644 index 0000000000000000000000000000000000000000..bcbf1c434443ae5ba65ba0e3378268e05c4904f5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php @@ -0,0 +1,48 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8 */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php'; + +/** Zend_Search_Lucene_Analysis_TokenFilter_LowerCaseUtf8 */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +class Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive extends Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8 +{ + public function __construct() + { + parent::__construct(); + + $this->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_LowerCaseUtf8()); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php new file mode 100644 index 0000000000000000000000000000000000000000..31f9869d9631f08e99da73c33a7337e60180b3c2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php @@ -0,0 +1,125 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer_Common */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +class Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num extends Zend_Search_Lucene_Analysis_Analyzer_Common +{ + /** + * Current char position in an UTF-8 stream + * + * @var integer + */ + private $_position; + + /** + * Current binary position in an UTF-8 stream + * + * @var integer + */ + private $_bytePosition; + + /** + * Object constructor + * + * @throws Zend_Search_Lucene_Exception + */ + public function __construct() + { + if (@preg_match('/\pL/u', 'a') != 1) { + // PCRE unicode support is turned off + require_once 'Zend/Search/Lucene/Exception.php'; + throw new Zend_Search_Lucene_Exception('Utf8Num analyzer needs PCRE unicode support to be enabled.'); + } + } + + /** + * Reset token stream + */ + public function reset() + { + $this->_position = 0; + $this->_bytePosition = 0; + + // convert input into UTF-8 + if (strcasecmp($this->_encoding, 'utf8' ) != 0 && + strcasecmp($this->_encoding, 'utf-8') != 0 ) { + $this->_input = iconv($this->_encoding, 'UTF-8', $this->_input); + $this->_encoding = 'UTF-8'; + } + } + + /** + * Tokenization stream API + * Get next token + * Returns null at the end of stream + * + * @return Zend_Search_Lucene_Analysis_Token|null + */ + public function nextToken() + { + if ($this->_input === null) { + return null; + } + + do { + if (! preg_match('/[\p{L}\p{N}]+/u', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_bytePosition)) { + // It covers both cases a) there are no matches (preg_match(...) === 0) + // b) error occured (preg_match(...) === FALSE) + return null; + } + + // matched string + $matchedWord = $match[0][0]; + + // binary position of the matched word in the input stream + $binStartPos = $match[0][1]; + + // character position of the matched word in the input stream + $startPos = $this->_position + + iconv_strlen(substr($this->_input, + $this->_bytePosition, + $binStartPos - $this->_bytePosition), + 'UTF-8'); + // character postion of the end of matched word in the input stream + $endPos = $startPos + iconv_strlen($matchedWord, 'UTF-8'); + + $this->_bytePosition = $binStartPos + strlen($matchedWord); + $this->_position = $endPos; + + $token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($matchedWord, $startPos, $endPos)); + } while ($token === null); // try again if token is skipped + + return $token; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php new file mode 100644 index 0000000000000000000000000000000000000000..273bfbe5c5a9da7652267b2c42adaf493545caf7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php @@ -0,0 +1,48 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php'; + +/** Zend_Search_Lucene_Analysis_TokenFilter_LowerCaseUtf8 */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +class Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive extends Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num +{ + public function __construct() + { + parent::__construct(); + + $this->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_LowerCaseUtf8()); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Token.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Token.php new file mode 100644 index 0000000000000000000000000000000000000000..bdb5e25c3833287f77cedffcbfc853892e295fa5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/Token.php @@ -0,0 +1,153 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Analysis_Token +{ + /** + * The text of the term. + * + * @var string + */ + private $_termText; + + /** + * Start in source text. + * + * @var integer + */ + private $_startOffset; + + /** + * End in source text + * + * @var integer + */ + private $_endOffset; + + /** + * The position of this token relative to the previous Token. + * + * The default value is one. + * + * Some common uses for this are: + * Set it to zero to put multiple terms in the same position. This is + * useful if, e.g., a word has multiple stems. Searches for phrases + * including either stem will match. In this case, all but the first stem's + * increment should be set to zero: the increment of the first instance + * should be one. Repeating a token with an increment of zero can also be + * used to boost the scores of matches on that token. + * + * Set it to values greater than one to inhibit exact phrase matches. + * If, for example, one does not want phrases to match across removed stop + * words, then one could build a stop word filter that removes stop words and + * also sets the increment to the number of stop words removed before each + * non-stop word. Then exact phrase queries will only match when the terms + * occur with no intervening stop words. + * + * @var integer + */ + private $_positionIncrement; + + + /** + * Object constructor + * + * @param string $text + * @param integer $start + * @param integer $end + * @param string $type + */ + public function __construct($text, $start, $end) + { + $this->_termText = $text; + $this->_startOffset = $start; + $this->_endOffset = $end; + + $this->_positionIncrement = 1; + } + + + /** + * positionIncrement setter + * + * @param integer $positionIncrement + */ + public function setPositionIncrement($positionIncrement) + { + $this->_positionIncrement = $positionIncrement; + } + + /** + * Returns the position increment of this Token. + * + * @return integer + */ + public function getPositionIncrement() + { + return $this->_positionIncrement; + } + + /** + * Returns the Token's term text. + * + * @return string + */ + public function getTermText() + { + return $this->_termText; + } + + /** + * Returns this Token's starting offset, the position of the first character + * corresponding to this token in the source text. + * + * Note: + * The difference between getEndOffset() and getStartOffset() may not be equal + * to strlen(Zend_Search_Lucene_Analysis_Token::getTermText()), as the term text may have been altered + * by a stemmer or some other filter. + * + * @return integer + */ + public function getStartOffset() + { + return $this->_startOffset; + } + + /** + * Returns this Token's ending offset, one greater than the position of the + * last character corresponding to this token in the source text. + * + * @return integer + */ + public function getEndOffset() + { + return $this->_endOffset; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter.php new file mode 100644 index 0000000000000000000000000000000000000000..0c2bdf9c1cd5585ddc06a24330c1965b217d7fc1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter.php @@ -0,0 +1,47 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_Token */ +require_once 'Zend/Search/Lucene/Analysis/Token.php'; + + +/** + * Token filter converts (normalizes) Token ore removes it from a token stream. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +abstract class Zend_Search_Lucene_Analysis_TokenFilter +{ + /** + * Normalize Token or remove it (if null is returned) + * + * @param Zend_Search_Lucene_Analysis_Token $srcToken + * @return Zend_Search_Lucene_Analysis_Token + */ + abstract public function normalize(Zend_Search_Lucene_Analysis_Token $srcToken); +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/LowerCase.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/LowerCase.php new file mode 100644 index 0000000000000000000000000000000000000000..530fb7bedaca9c78e543201fc287d97a77e18968 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/LowerCase.php @@ -0,0 +1,57 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_TokenFilter */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter.php'; + + +/** + * Lower case Token filter. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +class Zend_Search_Lucene_Analysis_TokenFilter_LowerCase extends Zend_Search_Lucene_Analysis_TokenFilter +{ + /** + * Normalize Token or remove it (if null is returned) + * + * @param Zend_Search_Lucene_Analysis_Token $srcToken + * @return Zend_Search_Lucene_Analysis_Token + */ + public function normalize(Zend_Search_Lucene_Analysis_Token $srcToken) + { + $newToken = new Zend_Search_Lucene_Analysis_Token( + strtolower( $srcToken->getTermText() ), + $srcToken->getStartOffset(), + $srcToken->getEndOffset()); + + $newToken->setPositionIncrement($srcToken->getPositionIncrement()); + + return $newToken; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php new file mode 100644 index 0000000000000000000000000000000000000000..835934ef3c815594fe7f05b43bea2742d72ae294 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php @@ -0,0 +1,69 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_TokenFilter */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter.php'; + + +/** + * Lower case Token filter. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +class Zend_Search_Lucene_Analysis_TokenFilter_LowerCaseUtf8 extends Zend_Search_Lucene_Analysis_TokenFilter +{ + /** + * Object constructor + */ + public function __construct() + { + if (!function_exists('mb_strtolower')) { + // mbstring extension is disabled + require_once 'Zend/Search/Lucene/Exception.php'; + throw new Zend_Search_Lucene_Exception('Utf8 compatible lower case filter needs mbstring extension to be enabled.'); + } + } + + /** + * Normalize Token or remove it (if null is returned) + * + * @param Zend_Search_Lucene_Analysis_Token $srcToken + * @return Zend_Search_Lucene_Analysis_Token + */ + public function normalize(Zend_Search_Lucene_Analysis_Token $srcToken) + { + $newToken = new Zend_Search_Lucene_Analysis_Token( + mb_strtolower($srcToken->getTermText(), 'UTF-8'), + $srcToken->getStartOffset(), + $srcToken->getEndOffset()); + + $newToken->setPositionIncrement($srcToken->getPositionIncrement()); + + return $newToken; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php new file mode 100644 index 0000000000000000000000000000000000000000..fa028bb0b83f1f0965e4d3bb29dbe8e4cc88582b --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php @@ -0,0 +1,68 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_TokenFilter */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter.php'; + + +/** + * Token filter that removes short words. What is short word can be configured with constructor. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +class Zend_Search_Lucene_Analysis_TokenFilter_ShortWords extends Zend_Search_Lucene_Analysis_TokenFilter +{ + /** + * Minimum allowed term length + * @var integer + */ + private $length; + + /** + * Constructs new instance of this filter. + * + * @param integer $short minimum allowed length of term which passes this filter (default 2) + */ + public function __construct($length = 2) { + $this->length = $length; + } + + /** + * Normalize Token or remove it (if null is returned) + * + * @param Zend_Search_Lucene_Analysis_Token $srcToken + * @return Zend_Search_Lucene_Analysis_Token + */ + public function normalize(Zend_Search_Lucene_Analysis_Token $srcToken) { + if (strlen($srcToken->getTermText()) < $this->length) { + return null; + } else { + return $srcToken; + } + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php new file mode 100644 index 0000000000000000000000000000000000000000..ed2de51a155761076bed13d995998d109e457961 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php @@ -0,0 +1,100 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Analysis_TokenFilter */ +require_once 'Zend/Search/Lucene/Analysis/TokenFilter.php'; +require_once 'Zend/Search/Exception.php'; + + +/** + * Token filter that removes stop words. These words must be provided as array (set), example: + * $stopwords = array('the' => 1, 'an' => '1'); + * + * We do recommend to provide all words in lowercase and concatenate this class after the lowercase filter. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Analysis + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +class Zend_Search_Lucene_Analysis_TokenFilter_StopWords extends Zend_Search_Lucene_Analysis_TokenFilter +{ + /** + * Stop Words + * @var array + */ + private $_stopSet; + + /** + * Constructs new instance of this filter. + * + * @param array $stopwords array (set) of words that will be filtered out + */ + public function __construct($stopwords = array()) { + $this->_stopSet = array_flip($stopwords); + } + + /** + * Normalize Token or remove it (if null is returned) + * + * @param Zend_Search_Lucene_Analysis_Token $srcToken + * @return Zend_Search_Lucene_Analysis_Token + */ + public function normalize(Zend_Search_Lucene_Analysis_Token $srcToken) { + if (array_key_exists($srcToken->getTermText(), $this->_stopSet)) { + return null; + } else { + return $srcToken; + } + } + + /** + * Fills stopwords set from a text file. Each line contains one stopword, lines with '#' in the first + * column are ignored (as comments). + * + * You can call this method one or more times. New stopwords are always added to current set. + * + * @param string $filepath full path for text file with stopwords + * @throws Zend_Search_Exception When the file doesn`t exists or is not readable. + */ + public function loadFromFile($filepath = null) { + if (! $filepath || ! file_exists($filepath)) { + throw new Zend_Search_Exception('You have to provide valid file path'); + } + $fd = fopen($filepath, "r"); + if (! $fd) { + throw new Zend_Search_Exception('Cannot open file ' . $filepath); + } + while (!feof ($fd)) { + $buffer = trim(fgets($fd)); + if (strlen($buffer) > 0 && $buffer[0] != '#') { + $this->_stopSet[$buffer] = 1; + } + } + if (!fclose($fd)) { + throw new Zend_Search_Exception('Cannot close file ' . $filepath); + } + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document.php new file mode 100644 index 0000000000000000000000000000000000000000..200770c64c6dacea354bfafc203f352bf93f7e20 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document.php @@ -0,0 +1,129 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Field */ +require_once 'Zend/Search/Lucene/Field.php'; + + +/** + * A Document is a set of fields. Each field has a name and a textual value. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Document +{ + + /** + * Associative array Zend_Search_Lucene_Field objects where the keys to the + * array are the names of the fields. + * + * @var array + */ + protected $_fields = array(); + + /** + * Field boost factor + * It's not stored directly in the index, but affects on normalization factor + * + * @var float + */ + public $boost = 1.0; + + /** + * Proxy method for getFieldValue(), provides more convenient access to + * the string value of a field. + * + * @param $offset + * @return string + */ + public function __get($offset) + { + return $this->getFieldValue($offset); + } + + + /** + * Add a field object to this document. + * + * @param Zend_Search_Lucene_Field $field + * @return Zend_Search_Lucene_Document + */ + public function addField(Zend_Search_Lucene_Field $field) + { + $this->_fields[$field->name] = $field; + + return $this; + } + + + /** + * Return an array with the names of the fields in this document. + * + * @return array + */ + public function getFieldNames() + { + return array_keys($this->_fields); + } + + + /** + * Returns Zend_Search_Lucene_Field object for a named field in this document. + * + * @param string $fieldName + * @return Zend_Search_Lucene_Field + */ + public function getField($fieldName) + { + if (!array_key_exists($fieldName, $this->_fields)) { + throw new Zend_Search_Lucene_Exception("Field name \"$fieldName\" not found in document."); + } + return $this->_fields[$fieldName]; + } + + + /** + * Returns the string value of a named field in this document. + * + * @see __get() + * @return string + */ + public function getFieldValue($fieldName) + { + return $this->getField($fieldName)->value; + } + + /** + * Returns the string value of a named field in UTF-8 encoding. + * + * @see __get() + * @return string + */ + public function getFieldUtf8Value($fieldName) + { + return $this->getField($fieldName)->getUtf8Value(); + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Docx.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Docx.php new file mode 100644 index 0000000000000000000000000000000000000000..ea6e031cc6c3e355a88997ec31f073b58b978489 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Docx.php @@ -0,0 +1,122 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Search_Lucene_Document_OpenXml */ +require_once 'Zend/Search/Lucene/Document/OpenXml.php'; + +if (class_exists ( 'ZipArchive', false)) { + + /** + * Docx document. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + class Zend_Search_Lucene_Document_Docx extends Zend_Search_Lucene_Document_OpenXml { + /** + * Xml Schema - WordprocessingML + * + * @var string + */ + const SCHEMA_WORDPROCESSINGML = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'; + + /** + * Object constructor + * + * @param string $fileName + * @param boolean $storeContent + */ + private function __construct($fileName, $storeContent) { + // Document data holders + $documentBody = array ( ); + $coreProperties = array ( ); + + // Open OpenXML package + $package = new ZipArchive ( ); + $package->open ( $fileName ); + + // Read relations and search for officeDocument + $relations = simplexml_load_string ( $package->getFromName ( "_rels/.rels" ) ); + foreach ( $relations->Relationship as $rel ) { + if ($rel ["Type"] == Zend_Search_Lucene_Document_OpenXml::SCHEMA_OFFICEDOCUMENT) { + // Found office document! Read in contents... + $contents = simplexml_load_string ( $package->getFromName ( $this->absoluteZipPath ( dirname ( $rel ["Target"] ) . "/" . basename ( $rel ["Target"] ) ) ) ); + + $contents->registerXPathNamespace ( "w", Zend_Search_Lucene_Document_Docx::SCHEMA_WORDPROCESSINGML ); + $paragraphs = $contents->xpath ( '//w:body/w:p' ); + + foreach ( $paragraphs as $paragraph ) { + $runs = $paragraph->xpath ( './/w:r/w:t' ); + foreach ( $runs as $run ) { + $documentBody [] = ( string ) $run; + } + } + + // Add space after each paragraph. So they are not bound together. + $documentBody[] = ' '; + + break; + } + } + + // Read core properties + $coreProperties = $this->extractMetaData ( $package ); + + // Close file + $package->close (); + + // Store filename + $this->addField ( Zend_Search_Lucene_Field::Text ( 'filename', $fileName, 'UTF-8' ) ); + + // Store contents + if ($storeContent) { + $this->addField ( Zend_Search_Lucene_Field::Text ( 'body', implode('', $documentBody), 'UTF-8' ) ); + } else { + $this->addField ( Zend_Search_Lucene_Field::UnStored ( 'body', implode('', $documentBody), 'UTF-8' ) ); + } + + // Store meta data properties + foreach ( $coreProperties as $key => $value ) { + $this->addField ( Zend_Search_Lucene_Field::Text ( $key, $value, 'UTF-8' ) ); + } + + // Store title (if not present in meta data) + if (! isset ( $coreProperties ['title'] )) { + $this->addField ( Zend_Search_Lucene_Field::Text ( 'title', $fileName, 'UTF-8' ) ); + } + } + + /** + * Load Docx document from a file + * + * @param string $fileName + * @param boolean $storeContent + * @return Zend_Search_Lucene_Document_Docx + */ + public static function loadDocxFile($fileName, $storeContent = false) { + return new Zend_Search_Lucene_Document_Docx ( $fileName, $storeContent ); + } + } + +} // end if (class_exists('ZipArchive')) diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Html.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Html.php new file mode 100644 index 0000000000000000000000000000000000000000..45b709e587662acd4ba21e761907d258a7d1e8a0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Html.php @@ -0,0 +1,343 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Document */ +require_once 'Zend/Search/Lucene/Document.php'; + + +/** + * HTML document. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Document_Html extends Zend_Search_Lucene_Document +{ + /** + * List of document links + * + * @var array + */ + private $_links = array(); + + /** + * List of document header links + * + * @var array + */ + private $_headerLinks = array(); + + /** + * Stored DOM representation + * + * @var DOMDocument + */ + private $_doc; + + /** + * Exclud nofollow links flag + * + * If true then links with rel='nofollow' attribute are not included into + * document links. + * + * @var boolean + */ + private static $_excludeNoFollowLinks = false; + + /** + * Object constructor + * + * @param string $data + * @param boolean $isFile + * @param boolean $storeContent + */ + private function __construct($data, $isFile, $storeContent) + { + $this->_doc = new DOMDocument(); + $this->_doc->substituteEntities = true; + + if ($isFile) { + $htmlData = file_get_contents($data); + } else { + $htmlData = $data; + } + @$this->_doc->loadHTML($htmlData); + + $xpath = new DOMXPath($this->_doc); + + $docTitle = ''; + $titleNodes = $xpath->query('/html/head/title'); + foreach ($titleNodes as $titleNode) { + // title should always have only one entry, but we process all nodeset entries + $docTitle .= $titleNode->nodeValue . ' '; + } + $this->addField(Zend_Search_Lucene_Field::Text('title', $docTitle, $this->_doc->actualEncoding)); + + $metaNodes = $xpath->query('/html/head/meta[@name]'); + foreach ($metaNodes as $metaNode) { + $this->addField(Zend_Search_Lucene_Field::Text($metaNode->getAttribute('name'), + $metaNode->getAttribute('content'), + $this->_doc->actualEncoding)); + } + + $docBody = ''; + $bodyNodes = $xpath->query('/html/body'); + foreach ($bodyNodes as $bodyNode) { + // body should always have only one entry, but we process all nodeset entries + $this->_retrieveNodeText($bodyNode, $docBody); + } + if ($storeContent) { + $this->addField(Zend_Search_Lucene_Field::Text('body', $docBody, $this->_doc->actualEncoding)); + } else { + $this->addField(Zend_Search_Lucene_Field::UnStored('body', $docBody, $this->_doc->actualEncoding)); + } + + $linkNodes = $this->_doc->getElementsByTagName('a'); + foreach ($linkNodes as $linkNode) { + if (($href = $linkNode->getAttribute('href')) != '' && + (!self::$_excludeNoFollowLinks || strtolower($linkNode->getAttribute('rel')) != 'nofollow' ) + ) { + $this->_links[] = $href; + } + } + $this->_links = array_unique($this->_links); + + $linkNodes = $xpath->query('/html/head/link'); + foreach ($linkNodes as $linkNode) { + if (($href = $linkNode->getAttribute('href')) != '') { + $this->_headerLinks[] = $href; + } + } + $this->_headerLinks = array_unique($this->_headerLinks); + } + + /** + * Set exclude nofollow links flag + * + * @param boolean $newValue + */ + public static function setExcludeNoFollowLinks($newValue) + { + self::$_excludeNoFollowLinks = $newValue; + } + + /** + * Get exclude nofollow links flag + * + * @return boolean + */ + public static function getExcludeNoFollowLinks() + { + return self::$_excludeNoFollowLinks; + } + + /** + * Get node text + * + * We should exclude scripts, which may be not included into comment tags, CDATA sections, + * + * @param DOMNode $node + * @param string &$text + */ + private function _retrieveNodeText(DOMNode $node, &$text) + { + if ($node->nodeType == XML_TEXT_NODE) { + $text .= $node->nodeValue ; + $text .= ' '; + } else if ($node->nodeType == XML_ELEMENT_NODE && $node->nodeName != 'script') { + foreach ($node->childNodes as $childNode) { + $this->_retrieveNodeText($childNode, $text); + } + } + } + + /** + * Get document HREF links + * + * @return array + */ + public function getLinks() + { + return $this->_links; + } + + /** + * Get document header links + * + * @return array + */ + public function getHeaderLinks() + { + return $this->_headerLinks; + } + + /** + * Load HTML document from a string + * + * @param string $data + * @param boolean $storeContent + * @return Zend_Search_Lucene_Document_Html + */ + public static function loadHTML($data, $storeContent = false) + { + return new Zend_Search_Lucene_Document_Html($data, false, $storeContent); + } + + /** + * Load HTML document from a file + * + * @param string $file + * @param boolean $storeContent + * @return Zend_Search_Lucene_Document_Html + */ + public static function loadHTMLFile($file, $storeContent = false) + { + return new Zend_Search_Lucene_Document_Html($file, true, $storeContent); + } + + + /** + * Highlight text in text node + * + * @param DOMText $node + * @param array $wordsToHighlight + * @param string $color + */ + public function _highlightTextNode(DOMText $node, $wordsToHighlight, $color) + { + $analyzer = Zend_Search_Lucene_Analysis_Analyzer::getDefault(); + $analyzer->setInput($node->nodeValue, $this->_doc->encoding); + + $matchedTokens = array(); + + while (($token = $analyzer->nextToken()) !== null) { + if (isset($wordsToHighlight[$token->getTermText()])) { + $matchedTokens[] = $token; + } + } + + if (count($matchedTokens) == 0) { + return; + } + + $matchedTokens = array_reverse($matchedTokens); + + foreach ($matchedTokens as $token) { + // Cut text after matched token + $node->splitText($token->getEndOffset()); + + // Cut matched node + $matchedWordNode = $node->splitText($token->getStartOffset()); + + $highlightedNode = $this->_doc->createElement('b', $matchedWordNode->nodeValue); + $highlightedNode->setAttribute('style', 'color:black;background-color:' . $color); + + $node->parentNode->replaceChild($highlightedNode, $matchedWordNode); + } + } + + + /** + * highlight words in content of the specified node + * + * @param DOMNode $contextNode + * @param array $wordsToHighlight + * @param string $color + */ + public function _highlightNode(DOMNode $contextNode, $wordsToHighlight, $color) + { + $textNodes = array(); + + if (!$contextNode->hasChildNodes()) { + return; + } + + foreach ($contextNode->childNodes as $childNode) { + if ($childNode->nodeType == XML_TEXT_NODE) { + // process node later to leave childNodes structure untouched + $textNodes[] = $childNode; + } else { + // Skip script nodes + if ($childNode->nodeName != 'script') { + $this->_highlightNode($childNode, $wordsToHighlight, $color); + } + } + } + + foreach ($textNodes as $textNode) { + $this->_highlightTextNode($textNode, $wordsToHighlight, $color); + } + } + + + + /** + * Highlight text with specified color + * + * @param string|array $words + * @param string $color + * @return string + */ + public function highlight($words, $color = '#66ffff') + { + if (!is_array($words)) { + $words = array($words); + } + $wordsToHighlight = array(); + + $analyzer = Zend_Search_Lucene_Analysis_Analyzer::getDefault(); + foreach ($words as $wordString) { + $wordsToHighlight = array_merge($wordsToHighlight, $analyzer->tokenize($wordString)); + } + + if (count($wordsToHighlight) == 0) { + return $this->_doc->saveHTML(); + } + + $wordsToHighlightFlipped = array(); + foreach ($wordsToHighlight as $id => $token) { + $wordsToHighlightFlipped[$token->getTermText()] = $id; + } + + $xpath = new DOMXPath($this->_doc); + + $matchedNodes = $xpath->query("/html/body"); + foreach ($matchedNodes as $matchedNode) { + $this->_highlightNode($matchedNode, $wordsToHighlightFlipped, $color); + } + + } + + /** + * Get HTML + * + * @return string + */ + public function getHTML() + { + return $this->_doc->saveHTML(); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/OpenXml.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/OpenXml.php new file mode 100644 index 0000000000000000000000000000000000000000..96387b52d12cce1046bcaaa7cbadaf2900dbb07d --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/OpenXml.php @@ -0,0 +1,131 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Document */ +require_once 'Zend/Search/Lucene/Document.php'; + +if (class_exists('ZipArchive', false)) { + +/** + * OpenXML document. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Document_OpenXml extends Zend_Search_Lucene_Document +{ + /** + * Xml Schema - Relationships + * + * @var string + */ + const SCHEMA_RELATIONSHIP = 'http://schemas.openxmlformats.org/package/2006/relationships'; + + /** + * Xml Schema - Office document + * + * @var string + */ + const SCHEMA_OFFICEDOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'; + + /** + * Xml Schema - Core properties + * + * @var string + */ + const SCHEMA_COREPROPERTIES = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties'; + + /** + * Xml Schema - Dublin Core + * + * @var string + */ + const SCHEMA_DUBLINCORE = 'http://purl.org/dc/elements/1.1/'; + + /** + * Xml Schema - Dublin Core Terms + * + * @var string + */ + const SCHEMA_DUBLINCORETERMS = 'http://purl.org/dc/terms/'; + + /** + * Extract metadata from document + * + * @param ZipArchive $package ZipArchive OpenXML package + * @return array Key-value pairs containing document meta data + */ + protected function extractMetaData(ZipArchive $package) + { + // Data holders + $coreProperties = array(); + + // Read relations and search for core properties + $relations = simplexml_load_string($package->getFromName("_rels/.rels")); + foreach ($relations->Relationship as $rel) { + if ($rel["Type"] == Zend_Search_Lucene_Document_OpenXml::SCHEMA_COREPROPERTIES) { + // Found core properties! Read in contents... + $contents = simplexml_load_string( + $package->getFromName(dirname($rel["Target"]) . "/" . basename($rel["Target"])) + ); + + foreach ($contents->children(Zend_Search_Lucene_Document_OpenXml::SCHEMA_DUBLINCORE) as $child) { + $coreProperties[$child->getName()] = (string)$child; + } + foreach ($contents->children(Zend_Search_Lucene_Document_OpenXml::SCHEMA_COREPROPERTIES) as $child) { + $coreProperties[$child->getName()] = (string)$child; + } + foreach ($contents->children(Zend_Search_Lucene_Document_OpenXml::SCHEMA_DUBLINCORETERMS) as $child) { + $coreProperties[$child->getName()] = (string)$child; + } + } + } + + return $coreProperties; + } + + /** + * Determine absolute zip path + * + * @param string $path + * @return string + */ + protected function absoluteZipPath($path) { + $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path); + $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen'); + $absolutes = array(); + foreach ($parts as $part) { + if ('.' == $part) continue; + if ('..' == $part) { + array_pop($absolutes); + } else { + $absolutes[] = $part; + } + } + return implode('/', $absolutes); + } +} + +} // end if (class_exists('ZipArchive')) diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Pptx.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Pptx.php new file mode 100644 index 0000000000000000000000000000000000000000..88137f86369a5092fa241a94f0f3a0289bc6553e --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Pptx.php @@ -0,0 +1,192 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Document_OpenXml */ +require_once 'Zend/Search/Lucene/Document/OpenXml.php'; + +if (class_exists('ZipArchive', false)) { + +/** + * Pptx document. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Document_Pptx extends Zend_Search_Lucene_Document_OpenXml +{ + /** + * Xml Schema - PresentationML + * + * @var string + */ + const SCHEMA_PRESENTATIONML = 'http://schemas.openxmlformats.org/presentationml/2006/main'; + + /** + * Xml Schema - DrawingML + * + * @var string + */ + const SCHEMA_DRAWINGML = 'http://schemas.openxmlformats.org/drawingml/2006/main'; + + /** + * Xml Schema - Slide relation + * + * @var string + */ + const SCHEMA_SLIDERELATION = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide'; + + /** + * Xml Schema - Slide notes relation + * + * @var string + */ + const SCHEMA_SLIDENOTESRELATION = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide'; + + /** + * Object constructor + * + * @param string $fileName + * @param boolean $storeContent + */ + private function __construct($fileName, $storeContent) + { + // Document data holders + $slides = array(); + $slideNotes = array(); + $documentBody = array(); + $coreProperties = array(); + + // Open OpenXML package + $package = new ZipArchive(); + $package->open($fileName); + + // Read relations and search for officeDocument + $relations = simplexml_load_string($package->getFromName("_rels/.rels")); + foreach ($relations->Relationship as $rel) { + if ($rel["Type"] == Zend_Search_Lucene_Document_OpenXml::SCHEMA_OFFICEDOCUMENT) { + // Found office document! Search for slides... + $slideRelations = simplexml_load_string($package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/_rels/" . basename($rel["Target"]) . ".rels")) ); + foreach ($slideRelations->Relationship as $slideRel) { + if ($slideRel["Type"] == Zend_Search_Lucene_Document_Pptx::SCHEMA_SLIDERELATION) { + // Found slide! + $slides[ str_replace( 'rId', '', (string)$slideRel["Id"] ) ] = simplexml_load_string( + $package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($slideRel["Target"]) . "/" . basename($slideRel["Target"])) ) + ); + + // Search for slide notes + $slideNotesRelations = simplexml_load_string($package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($slideRel["Target"]) . "/_rels/" . basename($slideRel["Target"]) . ".rels")) ); + foreach ($slideNotesRelations->Relationship as $slideNoteRel) { + if ($slideNoteRel["Type"] == Zend_Search_Lucene_Document_Pptx::SCHEMA_SLIDENOTESRELATION) { + // Found slide notes! + $slideNotes[ str_replace( 'rId', '', (string)$slideRel["Id"] ) ] = simplexml_load_string( + $package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($slideRel["Target"]) . "/" . dirname($slideNoteRel["Target"]) . "/" . basename($slideNoteRel["Target"])) ) + ); + + break; + } + } + } + } + + break; + } + } + + // Sort slides + ksort($slides); + ksort($slideNotes); + + // Extract contents from slides + foreach ($slides as $slideKey => $slide) { + // Register namespaces + $slide->registerXPathNamespace("p", Zend_Search_Lucene_Document_Pptx::SCHEMA_PRESENTATIONML); + $slide->registerXPathNamespace("a", Zend_Search_Lucene_Document_Pptx::SCHEMA_DRAWINGML); + + // Fetch all text + $textElements = $slide->xpath('//a:t'); + foreach ($textElements as $textElement) { + $documentBody[] = (string)$textElement; + } + + // Extract contents from slide notes + if (isset($slideNotes[$slideKey])) { + // Fetch slide note + $slideNote = $slideNotes[$slideKey]; + + // Register namespaces + $slideNote->registerXPathNamespace("p", Zend_Search_Lucene_Document_Pptx::SCHEMA_PRESENTATIONML); + $slideNote->registerXPathNamespace("a", Zend_Search_Lucene_Document_Pptx::SCHEMA_DRAWINGML); + + // Fetch all text + $textElements = $slideNote->xpath('//a:t'); + foreach ($textElements as $textElement) { + $documentBody[] = (string)$textElement; + } + } + } + + // Read core properties + $coreProperties = $this->extractMetaData($package); + + // Close file + $package->close(); + + // Store filename + $this->addField(Zend_Search_Lucene_Field::Text('filename', $fileName, 'UTF-8')); + + // Store contents + if ($storeContent) { + $this->addField(Zend_Search_Lucene_Field::Text('body', implode(' ', $documentBody), 'UTF-8')); + } else { + $this->addField(Zend_Search_Lucene_Field::UnStored('body', implode(' ', $documentBody), 'UTF-8')); + } + + // Store meta data properties + foreach ($coreProperties as $key => $value) + { + $this->addField(Zend_Search_Lucene_Field::Text($key, $value, 'UTF-8')); + } + + // Store title (if not present in meta data) + if (!isset($coreProperties['title'])) + { + $this->addField(Zend_Search_Lucene_Field::Text('title', $fileName, 'UTF-8')); + } + } + + /** + * Load Pptx document from a file + * + * @param string $fileName + * @param boolean $storeContent + * @return Zend_Search_Lucene_Document_Pptx + */ + public static function loadPptxFile($fileName, $storeContent = false) + { + return new Zend_Search_Lucene_Document_Pptx($fileName, $storeContent); + } +} + +} // end if (class_exists('ZipArchive')) diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Xlsx.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Xlsx.php new file mode 100644 index 0000000000000000000000000000000000000000..a48b045c8cafabcf861c9afdf8b628793b470630 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Document/Xlsx.php @@ -0,0 +1,255 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Document_OpenXml */ +require_once 'Zend/Search/Lucene/Document/OpenXml.php'; + +if (class_exists('ZipArchive', false)) { + +/** + * Xlsx document. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Document_Xlsx extends Zend_Search_Lucene_Document_OpenXml +{ + /** + * Xml Schema - SpreadsheetML + * + * @var string + */ + const SCHEMA_SPREADSHEETML = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'; + + /** + * Xml Schema - DrawingML + * + * @var string + */ + const SCHEMA_DRAWINGML = 'http://schemas.openxmlformats.org/drawingml/2006/main'; + + /** + * Xml Schema - Shared Strings + * + * @var string + */ + const SCHEMA_SHAREDSTRINGS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings'; + + /** + * Xml Schema - Worksheet relation + * + * @var string + */ + const SCHEMA_WORKSHEETRELATION = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet'; + + /** + * Xml Schema - Slide notes relation + * + * @var string + */ + const SCHEMA_SLIDENOTESRELATION = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide'; + + /** + * Object constructor + * + * @param string $fileName + * @param boolean $storeContent + */ + private function __construct($fileName, $storeContent) + { + // Document data holders + $sharedStrings = array(); + $worksheets = array(); + $documentBody = array(); + $coreProperties = array(); + + // Open OpenXML package + $package = new ZipArchive(); + $package->open($fileName); + + // Read relations and search for officeDocument + $relations = simplexml_load_string($package->getFromName("_rels/.rels")); + foreach ($relations->Relationship as $rel) { + if ($rel["Type"] == Zend_Search_Lucene_Document_OpenXml::SCHEMA_OFFICEDOCUMENT) { + // Found office document! Read relations for workbook... + $workbookRelations = simplexml_load_string($package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/_rels/" . basename($rel["Target"]) . ".rels")) ); + $workbookRelations->registerXPathNamespace("rel", Zend_Search_Lucene_Document_OpenXml::SCHEMA_RELATIONSHIP); + + // Read shared strings + $sharedStringsPath = $workbookRelations->xpath("rel:Relationship[@Type='" . Zend_Search_Lucene_Document_Xlsx::SCHEMA_SHAREDSTRINGS . "']"); + $sharedStringsPath = (string)$sharedStringsPath[0]['Target']; + $xmlStrings = simplexml_load_string($package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . $sharedStringsPath)) ); + if (isset($xmlStrings) && isset($xmlStrings->si)) { + foreach ($xmlStrings->si as $val) { + if (isset($val->t)) { + $sharedStrings[] = (string)$val->t; + } elseif (isset($val->r)) { + $sharedStrings[] = $this->_parseRichText($val); + } + } + } + + // Loop relations for workbook and extract worksheets... + foreach ($workbookRelations->Relationship as $workbookRelation) { + if ($workbookRelation["Type"] == Zend_Search_Lucene_Document_Xlsx::SCHEMA_WORKSHEETRELATION) { + $worksheets[ str_replace( 'rId', '', (string)$workbookRelation["Id"]) ] = simplexml_load_string( + $package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($workbookRelation["Target"]) . "/" . basename($workbookRelation["Target"])) ) + ); + } + } + + break; + } + } + + // Sort worksheets + ksort($worksheets); + + // Extract contents from worksheets + foreach ($worksheets as $sheetKey => $worksheet) { + foreach ($worksheet->sheetData->row as $row) { + foreach ($row->c as $c) { + // Determine data type + $dataType = (string)$c["t"]; + switch ($dataType) { + case "s": + // Value is a shared string + if ((string)$c->v != '') { + $value = $sharedStrings[intval($c->v)]; + } else { + $value = ''; + } + + break; + + case "b": + // Value is boolean + $value = (string)$c->v; + if ($value == '0') { + $value = false; + } else if ($value == '1') { + $value = true; + } else { + $value = (bool)$c->v; + } + + break; + + case "inlineStr": + // Value is rich text inline + $value = $this->_parseRichText($c->is); + + break; + + case "e": + // Value is an error message + if ((string)$c->v != '') { + $value = (string)$c->v; + } else { + $value = ''; + } + + break; + + default: + // Value is a string + $value = (string)$c->v; + + // Check for numeric values + if (is_numeric($value) && $dataType != 's') { + if ($value == (int)$value) $value = (int)$value; + elseif ($value == (float)$value) $value = (float)$value; + elseif ($value == (double)$value) $value = (double)$value; + } + } + + $documentBody[] = $value; + } + } + } + + // Read core properties + $coreProperties = $this->extractMetaData($package); + + // Close file + $package->close(); + + // Store filename + $this->addField(Zend_Search_Lucene_Field::Text('filename', $fileName, 'UTF-8')); + + // Store contents + if ($storeContent) { + $this->addField(Zend_Search_Lucene_Field::Text('body', implode(' ', $documentBody), 'UTF-8')); + } else { + $this->addField(Zend_Search_Lucene_Field::UnStored('body', implode(' ', $documentBody), 'UTF-8')); + } + + // Store meta data properties + foreach ($coreProperties as $key => $value) + { + $this->addField(Zend_Search_Lucene_Field::Text($key, $value, 'UTF-8')); + } + + // Store title (if not present in meta data) + if (!isset($coreProperties['title'])) + { + $this->addField(Zend_Search_Lucene_Field::Text('title', $fileName, 'UTF-8')); + } + } + + /** + * Parse rich text XML + * + * @param SimpleXMLElement $is + * @return string + */ + private function _parseRichText($is = null) { + $value = array(); + + if (isset($is->t)) { + $value[] = (string)$is->t; + } else { + foreach ($is->r as $run) { + $value[] = (string)$run->t; + } + } + + return implode('', $value); + } + + /** + * Load Xlsx document from a file + * + * @param string $fileName + * @param boolean $storeContent + * @return Zend_Search_Lucene_Document_Xlsx + */ + public static function loadXlsxFile($fileName, $storeContent = false) + { + return new Zend_Search_Lucene_Document_Xlsx($fileName, $storeContent); + } +} + +} // end if (class_exists('ZipArchive')) diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Exception.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Exception.php new file mode 100644 index 0000000000000000000000000000000000000000..36cbf7286cc89dfb83325e04a227440592cff898 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Exception.php @@ -0,0 +1,36 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * Framework base exception + */ +require_once 'Zend/Search/Exception.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Exception extends Zend_Search_Exception +{} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/FSM.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/FSM.php new file mode 100644 index 0000000000000000000000000000000000000000..3d0166a18bc40f8f9fc5f0ebd132604252995586 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/FSM.php @@ -0,0 +1,433 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_FSMAction */ +require_once 'Zend/Search/Lucene/FSMAction.php'; + +/** Zend_Search_Exception */ +require_once 'Zend/Search/Exception.php'; + + +/** + * Abstract Finite State Machine + * + * Take a look on Wikipedia state machine description: http://en.wikipedia.org/wiki/Finite_state_machine + * + * Any type of Transducers (Moore machine or Mealy machine) also may be implemented by using this abstract FSM. + * process() methods invokes a specified actions which may construct FSM output. + * Actions may be also used to signal, that we have reached Accept State + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_FSM +{ + /** + * Machine States alphabet + * + * @var array + */ + private $_states = array(); + + /** + * Current state + * + * @var integer|string + */ + private $_currentState = null; + + /** + * Input alphabet + * + * @var array + */ + private $_inputAphabet = array(); + + /** + * State transition table + * + * [sourceState][input] => targetState + * + * @var array + */ + private $_rules = array(); + + /** + * List of entry actions + * Each action executes when entering the state + * + * [state] => action + * + * @var array + */ + private $_entryActions = array(); + + /** + * List of exit actions + * Each action executes when exiting the state + * + * [state] => action + * + * @var array + */ + private $_exitActions = array(); + + /** + * List of input actions + * Each action executes when entering the state + * + * [state][input] => action + * + * @var array + */ + private $_inputActions = array(); + + /** + * List of input actions + * Each action executes when entering the state + * + * [state1][state2] => action + * + * @var array + */ + private $_transitionActions = array(); + + /** + * Finite State machine constructor + * + * $states is an array of integers or strings with a list of possible machine states + * constructor treats fist list element as a sturt state (assignes it to $_current state). + * It may be reassigned by setState() call. + * States list may be empty and can be extended later by addState() or addStates() calls. + * + * $inputAphabet is the same as $states, but represents input alphabet + * it also may be extended later by addInputSymbols() or addInputSymbol() calls. + * + * $rules parameter describes FSM transitions and has a structure: + * array( array(sourseState, input, targetState[, inputAction]), + * array(sourseState, input, targetState[, inputAction]), + * array(sourseState, input, targetState[, inputAction]), + * ... + * ) + * Rules also can be added later by addRules() and addRule() calls. + * + * FSM actions are very flexible and may be defined by addEntryAction(), addExitAction(), + * addInputAction() and addTransitionAction() calls. + * + * @param array $states + * @param array $inputAphabet + * @param array $rules + */ + public function __construct($states = array(), $inputAphabet = array(), $rules = array()) + { + $this->addStates($states); + $this->addInputSymbols($inputAphabet); + $this->addRules($rules); + } + + /** + * Add states to the state machine + * + * @param array $states + */ + public function addStates($states) + { + foreach ($states as $state) { + $this->addState($state); + } + } + + /** + * Add state to the state machine + * + * @param integer|string $state + */ + public function addState($state) + { + $this->_states[$state] = $state; + + if ($this->_currentState === null) { + $this->_currentState = $state; + } + } + + /** + * Set FSM state. + * No any action is invoked + * + * @param integer|string $state + * @throws Zend_Search_Exception + */ + public function setState($state) + { + if (!isset($this->_states[$state])) { + throw new Zend_Search_Exception('State \'' . $state . '\' is not on of the possible FSM states.'); + } + + $this->_currentState = $state; + } + + /** + * Get FSM state. + * + * @return integer|string $state|null + */ + public function getState() + { + return $this->_currentState; + } + + /** + * Add symbols to the input alphabet + * + * @param array $inputAphabet + */ + public function addInputSymbols($inputAphabet) + { + foreach ($inputAphabet as $inputSymbol) { + $this->addInputSymbol($inputSymbol); + } + } + + /** + * Add symbol to the input alphabet + * + * @param integer|string $inputSymbol + */ + public function addInputSymbol($inputSymbol) + { + $this->_inputAphabet[$inputSymbol] = $inputSymbol; + } + + + /** + * Add transition rules + * + * array structure: + * array( array(sourseState, input, targetState[, inputAction]), + * array(sourseState, input, targetState[, inputAction]), + * array(sourseState, input, targetState[, inputAction]), + * ... + * ) + * + * @param array $rules + */ + public function addRules($rules) + { + foreach ($rules as $rule) { + $this->addrule($rule[0], $rule[1], $rule[2], isset($rule[3])?$rule[3]:null); + } + } + + /** + * Add symbol to the input alphabet + * + * @param integer|string $sourceState + * @param integer|string $input + * @param integer|string $targetState + * @param Zend_Search_Lucene_FSMAction|null $inputAction + * @throws Zend_Search_Exception + */ + public function addRule($sourceState, $input, $targetState, $inputAction = null) + { + if (!isset($this->_states[$sourceState])) { + throw new Zend_Search_Exception('Undefined source state (' . $sourceState . ').'); + } + if (!isset($this->_states[$targetState])) { + throw new Zend_Search_Exception('Undefined target state (' . $targetState . ').'); + } + if (!isset($this->_inputAphabet[$input])) { + throw new Zend_Search_Exception('Undefined input symbol (' . $input . ').'); + } + + if (!isset($this->_rules[$sourceState])) { + $this->_rules[$sourceState] = array(); + } + if (isset($this->_rules[$sourceState][$input])) { + throw new Zend_Search_Exception('Rule for {state,input} pair (' . $sourceState . ', '. $input . ') is already defined.'); + } + + $this->_rules[$sourceState][$input] = $targetState; + + + if ($inputAction !== null) { + $this->addInputAction($sourceState, $input, $inputAction); + } + } + + + /** + * Add state entry action. + * Several entry actions are allowed. + * Action execution order is defined by addEntryAction() calls + * + * @param integer|string $state + * @param Zend_Search_Lucene_FSMAction $action + */ + public function addEntryAction($state, Zend_Search_Lucene_FSMAction $action) + { + if (!isset($this->_states[$state])) { + throw new Zend_Search_Exception('Undefined state (' . $state. ').'); + } + + if (!isset($this->_entryActions[$state])) { + $this->_entryActions[$state] = array(); + } + + $this->_entryActions[$state][] = $action; + } + + /** + * Add state exit action. + * Several exit actions are allowed. + * Action execution order is defined by addEntryAction() calls + * + * @param integer|string $state + * @param Zend_Search_Lucene_FSMAction $action + */ + public function addExitAction($state, Zend_Search_Lucene_FSMAction $action) + { + if (!isset($this->_states[$state])) { + throw new Zend_Search_Exception('Undefined state (' . $state. ').'); + } + + if (!isset($this->_exitActions[$state])) { + $this->_exitActions[$state] = array(); + } + + $this->_exitActions[$state][] = $action; + } + + /** + * Add input action (defined by {state, input} pair). + * Several input actions are allowed. + * Action execution order is defined by addInputAction() calls + * + * @param integer|string $state + * @param integer|string $input + * @param Zend_Search_Lucene_FSMAction $action + */ + public function addInputAction($state, $inputSymbol, Zend_Search_Lucene_FSMAction $action) + { + if (!isset($this->_states[$state])) { + throw new Zend_Search_Exception('Undefined state (' . $state. ').'); + } + if (!isset($this->_inputAphabet[$inputSymbol])) { + throw new Zend_Search_Exception('Undefined input symbol (' . $inputSymbol. ').'); + } + + if (!isset($this->_inputActions[$state])) { + $this->_inputActions[$state] = array(); + } + if (!isset($this->_inputActions[$state][$inputSymbol])) { + $this->_inputActions[$state][$inputSymbol] = array(); + } + + $this->_inputActions[$state][$inputSymbol][] = $action; + } + + /** + * Add transition action (defined by {state, input} pair). + * Several transition actions are allowed. + * Action execution order is defined by addTransitionAction() calls + * + * @param integer|string $sourceState + * @param integer|string $targetState + * @param Zend_Search_Lucene_FSMAction $action + */ + public function addTransitionAction($sourceState, $targetState, Zend_Search_Lucene_FSMAction $action) + { + if (!isset($this->_states[$sourceState])) { + throw new Zend_Search_Exception('Undefined source state (' . $sourceState. ').'); + } + if (!isset($this->_states[$targetState])) { + throw new Zend_Search_Exception('Undefined source state (' . $targetState. ').'); + } + + if (!isset($this->_transitionActions[$sourceState])) { + $this->_transitionActions[$sourceState] = array(); + } + if (!isset($this->_transitionActions[$sourceState][$targetState])) { + $this->_transitionActions[$sourceState][$targetState] = array(); + } + + $this->_transitionActions[$sourceState][$targetState][] = $action; + } + + + /** + * Process an input + * + * @param mixed $input + * @throws Zend_Search_Exception + */ + public function process($input) + { + if (!isset($this->_rules[$this->_currentState])) { + throw new Zend_Search_Exception('There is no any rule for current state (' . $this->_currentState . ').'); + } + if (!isset($this->_rules[$this->_currentState][$input])) { + throw new Zend_Search_Exception('There is no any rule for {current state, input} pair (' . $this->_currentState . ', ' . $input . ').'); + } + + $sourceState = $this->_currentState; + $targetState = $this->_rules[$this->_currentState][$input]; + + if ($sourceState != $targetState && isset($this->_exitActions[$sourceState])) { + foreach ($this->_exitActions[$sourceState] as $action) { + $action->doAction(); + } + } + if (isset($this->_inputActions[$sourceState]) && + isset($this->_inputActions[$sourceState][$input])) { + foreach ($this->_inputActions[$sourceState][$input] as $action) { + $action->doAction(); + } + } + + + $this->_currentState = $targetState; + + if (isset($this->_transitionActions[$sourceState]) && + isset($this->_transitionActions[$sourceState][$targetState])) { + foreach ($this->_transitionActions[$sourceState][$targetState] as $action) { + $action->doAction(); + } + } + if ($sourceState != $targetState && isset($this->_entryActions[$targetState])) { + foreach ($this->_entryActions[$targetState] as $action) { + $action->doAction(); + } + } + } + + public function reset() + { + if (count($this->_states) == 0) { + throw new Zend_Search_Exception('There is no any state defined for FSM.'); + } + + $this->_currentState = $this->_states[0]; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/FSMAction.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/FSMAction.php new file mode 100644 index 0000000000000000000000000000000000000000..b217b47b960c22545eeb51286622db9cba0aaced --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/FSMAction.php @@ -0,0 +1,65 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * Abstract Finite State Machine + * + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_FSMAction +{ + /** + * Object reference + * + * @var object + */ + private $_object; + + /** + * Method name + * + * @var string + */ + private $_method; + + /** + * Object constructor + * + * @param object $object + * @param string $method + */ + public function __construct($object, $method) + { + $this->_object = $object; + $this->_method = $method; + } + + public function doAction() + { + $methodName = $this->_method; + $this->_object->$methodName(); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Field.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Field.php new file mode 100644 index 0000000000000000000000000000000000000000..fc56889c1ccd5c1bc429d19e01aa04c4e1e5eb97 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Field.php @@ -0,0 +1,225 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * A field is a section of a Document. Each field has two parts, + * a name and a value. Values may be free text or they may be atomic + * keywords, which are not further processed. Such keywords may + * be used to represent dates, urls, etc. Fields are optionally + * stored in the index, so that they may be returned with hits + * on the document. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Document + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Field +{ + /** + * Field name + * + * @var string + */ + public $name; + + /** + * Field value + * + * @var boolean + */ + public $value; + + /** + * Field is to be stored in the index for return with search hits. + * + * @var boolean + */ + public $isStored = false; + + /** + * Field is to be indexed, so that it may be searched on. + * + * @var boolean + */ + public $isIndexed = true; + + /** + * Field should be tokenized as text prior to indexing. + * + * @var boolean + */ + public $isTokenized = true; + /** + * Field is stored as binary. + * + * @var boolean + */ + public $isBinary = false; + + /** + * Field are stored as a term vector + * + * @var boolean + */ + public $storeTermVector = false; + + /** + * Field boost factor + * It's not stored directly in the index, but affects on normalization factor + * + * @var float + */ + public $boost = 1.0; + + /** + * Field value encoding. + * + * @var string + */ + public $encoding; + + /** + * Object constructor + * + * @param string $name + * @param string $value + * @param string $encoding + * @param boolean $isStored + * @param boolean $isIndexed + * @param boolean $isTokenized + * @param boolean $isBinary + */ + public function __construct($name, $value, $encoding, $isStored, $isIndexed, $isTokenized, $isBinary = false) + { + $this->name = $name; + $this->value = $value; + + if (!$isBinary) { + $this->encoding = $encoding; + $this->isTokenized = $isTokenized; + } else { + $this->encoding = ''; + $this->isTokenized = false; + } + + $this->isStored = $isStored; + $this->isIndexed = $isIndexed; + $this->isBinary = $isBinary; + + $this->storeTermVector = false; + $this->boost = 1.0; + } + + + /** + * Constructs a String-valued Field that is not tokenized, but is indexed + * and stored. Useful for non-text fields, e.g. date or url. + * + * @param string $name + * @param string $value + * @param string $encoding + * @return Zend_Search_Lucene_Field + */ + public static function keyword($name, $value, $encoding = '') + { + return new self($name, $value, $encoding, true, true, false); + } + + + /** + * Constructs a String-valued Field that is not tokenized nor indexed, + * but is stored in the index, for return with hits. + * + * @param string $name + * @param string $value + * @param string $encoding + * @return Zend_Search_Lucene_Field + */ + public static function unIndexed($name, $value, $encoding = '') + { + return new self($name, $value, $encoding, true, false, false); + } + + + /** + * Constructs a Binary String valued Field that is not tokenized nor indexed, + * but is stored in the index, for return with hits. + * + * @param string $name + * @param string $value + * @param string $encoding + * @return Zend_Search_Lucene_Field + */ + public static function binary($name, $value) + { + return new self($name, $value, '', true, false, false, true); + } + + /** + * Constructs a String-valued Field that is tokenized and indexed, + * and is stored in the index, for return with hits. Useful for short text + * fields, like "title" or "subject". Term vector will not be stored for this field. + * + * @param string $name + * @param string $value + * @param string $encoding + * @return Zend_Search_Lucene_Field + */ + public static function text($name, $value, $encoding = '') + { + return new self($name, $value, $encoding, true, true, true); + } + + + /** + * Constructs a String-valued Field that is tokenized and indexed, + * but that is not stored in the index. + * + * @param string $name + * @param string $value + * @param string $encoding + * @return Zend_Search_Lucene_Field + */ + public static function unStored($name, $value, $encoding = '') + { + return new self($name, $value, $encoding, false, true, true); + } + + /** + * Get field value in UTF-8 encoding + * + * @return string + */ + public function getUtf8Value() + { + if (strcasecmp($this->encoding, 'utf8' ) == 0 || + strcasecmp($this->encoding, 'utf-8') == 0 ) { + return $this->value; + } else { + + return (PHP_OS != 'AIX') ? iconv($this->encoding, 'UTF-8', $this->value) : iconv('ISO8859-1', 'UTF-8', $this->value); + } + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/DictionaryLoader.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/DictionaryLoader.php new file mode 100644 index 0000000000000000000000000000000000000000..192a79634b87678dcce708c3978caae76f559ca7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/DictionaryLoader.php @@ -0,0 +1,266 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + + +/** + * Dictionary loader + * + * It's a dummy class which is created to encapsulate non-good structured code. + * Manual "method inlining" is performed to increase dictionary index loading operation + * which is major bottelneck for search performance. + * + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_DictionaryLoader +{ + /** + * Dictionary index loader. + * + * It takes a string which is actually <segment_name>.tii index file data and + * returns two arrays - term and tremInfo lists. + * + * See Zend_Search_Lucene_Index_SegmintInfo class for details + * + * @param string $data + * @return array + * @throws Zend_Search_Lucene_Exception + */ + public static function load($data) + { + $termDictionary = array(); + $termInfos = array(); + $pos = 0; + + // $tiVersion = $tiiFile->readInt(); + $tiVersion = ord($data[0]) << 24 | ord($data[1]) << 16 | ord($data[2]) << 8 | ord($data[3]); + $pos += 4; + if ($tiVersion != (int)0xFFFFFFFE /* pre-2.1 format */ && + $tiVersion != (int)0xFFFFFFFD /* 2.1+ format */) { + throw new Zend_Search_Lucene_Exception('Wrong TermInfoIndexFile file format'); + } + + // $indexTermCount = $tiiFile->readLong(); + if (PHP_INT_SIZE > 4) { + $indexTermCount = ord($data[$pos]) << 56 | + ord($data[$pos+1]) << 48 | + ord($data[$pos+2]) << 40 | + ord($data[$pos+3]) << 32 | + ord($data[$pos+4]) << 24 | + ord($data[$pos+5]) << 16 | + ord($data[$pos+6]) << 8 | + ord($data[$pos+7]); + } else { + if ((ord($data[$pos]) != 0) || + (ord($data[$pos+1]) != 0) || + (ord($data[$pos+2]) != 0) || + (ord($data[$pos+3]) != 0) || + ((ord($data[$pos+4]) & 0x80) != 0)) { + throw new Zend_Search_Lucene_Exception('Largest supported segment size (for 32-bit mode) is 2Gb'); + } + + $indexTermCount = ord($data[$pos+4]) << 24 | + ord($data[$pos+5]) << 16 | + ord($data[$pos+6]) << 8 | + ord($data[$pos+7]); + } + $pos += 8; + + // $tiiFile->readInt(); // IndexInterval + $pos += 4; + + // $skipInterval = $tiiFile->readInt(); + $skipInterval = ord($data[$pos]) << 24 | ord($data[$pos+1]) << 16 | ord($data[$pos+2]) << 8 | ord($data[$pos+3]); + $pos += 4; + if ($indexTermCount < 1) { + throw new Zend_Search_Lucene_Exception('Wrong number of terms in a term dictionary index'); + } + + if ($tiVersion == (int)0xFFFFFFFD /* 2.1+ format */) { + /* Skip MaxSkipLevels value */ + $pos += 4; + } + + $prevTerm = ''; + $freqPointer = 0; + $proxPointer = 0; + $indexPointer = 0; + for ($count = 0; $count < $indexTermCount; $count++) { + //$termPrefixLength = $tiiFile->readVInt(); + $nbyte = ord($data[$pos++]); + $termPrefixLength = $nbyte & 0x7F; + for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { + $nbyte = ord($data[$pos++]); + $termPrefixLength |= ($nbyte & 0x7F) << $shift; + } + + // $termSuffix = $tiiFile->readString(); + $nbyte = ord($data[$pos++]); + $len = $nbyte & 0x7F; + for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { + $nbyte = ord($data[$pos++]); + $len |= ($nbyte & 0x7F) << $shift; + } + if ($len == 0) { + $termSuffix = ''; + } else { + $termSuffix = substr($data, $pos, $len); + $pos += $len; + for ($count1 = 0; $count1 < $len; $count1++ ) { + if (( ord($termSuffix[$count1]) & 0xC0 ) == 0xC0) { + $addBytes = 1; + if (ord($termSuffix[$count1]) & 0x20 ) { + $addBytes++; + + // Never used for Java Lucene created index. + // Java2 doesn't encode strings in four bytes + if (ord($termSuffix[$count1]) & 0x10 ) { + $addBytes++; + } + } + $termSuffix .= substr($data, $pos, $addBytes); + $pos += $addBytes; + $len += $addBytes; + + // Check for null character. Java2 encodes null character + // in two bytes. + if (ord($termSuffix[$count1]) == 0xC0 && + ord($termSuffix[$count1+1]) == 0x80 ) { + $termSuffix[$count1] = 0; + $termSuffix = substr($termSuffix,0,$count1+1) + . substr($termSuffix,$count1+2); + } + $count1 += $addBytes; + } + } + } + + // $termValue = Zend_Search_Lucene_Index_Term::getPrefix($prevTerm, $termPrefixLength) . $termSuffix; + $pb = 0; $pc = 0; + while ($pb < strlen($prevTerm) && $pc < $termPrefixLength) { + $charBytes = 1; + if ((ord($prevTerm[$pb]) & 0xC0) == 0xC0) { + $charBytes++; + if (ord($prevTerm[$pb]) & 0x20 ) { + $charBytes++; + if (ord($prevTerm[$pb]) & 0x10 ) { + $charBytes++; + } + } + } + + if ($pb + $charBytes > strlen($data)) { + // wrong character + break; + } + + $pc++; + $pb += $charBytes; + } + $termValue = substr($prevTerm, 0, $pb) . $termSuffix; + + // $termFieldNum = $tiiFile->readVInt(); + $nbyte = ord($data[$pos++]); + $termFieldNum = $nbyte & 0x7F; + for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { + $nbyte = ord($data[$pos++]); + $termFieldNum |= ($nbyte & 0x7F) << $shift; + } + + // $docFreq = $tiiFile->readVInt(); + $nbyte = ord($data[$pos++]); + $docFreq = $nbyte & 0x7F; + for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { + $nbyte = ord($data[$pos++]); + $docFreq |= ($nbyte & 0x7F) << $shift; + } + + // $freqPointer += $tiiFile->readVInt(); + $nbyte = ord($data[$pos++]); + $vint = $nbyte & 0x7F; + for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { + $nbyte = ord($data[$pos++]); + $vint |= ($nbyte & 0x7F) << $shift; + } + $freqPointer += $vint; + + // $proxPointer += $tiiFile->readVInt(); + $nbyte = ord($data[$pos++]); + $vint = $nbyte & 0x7F; + for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { + $nbyte = ord($data[$pos++]); + $vint |= ($nbyte & 0x7F) << $shift; + } + $proxPointer += $vint; + + if( $docFreq >= $skipInterval ) { + // $skipDelta = $tiiFile->readVInt(); + $nbyte = ord($data[$pos++]); + $vint = $nbyte & 0x7F; + for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { + $nbyte = ord($data[$pos++]); + $vint |= ($nbyte & 0x7F) << $shift; + } + $skipDelta = $vint; + } else { + $skipDelta = 0; + } + + // $indexPointer += $tiiFile->readVInt(); + $nbyte = ord($data[$pos++]); + $vint = $nbyte & 0x7F; + for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { + $nbyte = ord($data[$pos++]); + $vint |= ($nbyte & 0x7F) << $shift; + } + $indexPointer += $vint; + + + // $this->_termDictionary[] = new Zend_Search_Lucene_Index_Term($termValue, $termFieldNum); + $termDictionary[] = array($termFieldNum, $termValue); + + $termInfos[] = + // new Zend_Search_Lucene_Index_TermInfo($docFreq, $freqPointer, $proxPointer, $skipDelta, $indexPointer); + array($docFreq, $freqPointer, $proxPointer, $skipDelta, $indexPointer); + + $prevTerm = $termValue; + } + + // Check special index entry mark + if ($termDictionary[0][0] != (int)0xFFFFFFFF) { + throw new Zend_Search_Lucene_Exception('Wrong TermInfoIndexFile file format'); + } else if (PHP_INT_SIZE > 4){ + // Treat 64-bit 0xFFFFFFFF as -1 + $termDictionary[0][0] = -1; + } + + return array(&$termDictionary, &$termInfos); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/DocsFilter.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/DocsFilter.php new file mode 100644 index 0000000000000000000000000000000000000000..78df2b233c8d07f47b4818bf061e9741bc46b158 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/DocsFilter.php @@ -0,0 +1,58 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * A Zend_Search_Lucene_Index_DocsFilter is used to filter documents while searching. + * + * It may or _may_not_ be used for actual filtering, so it's just a hint that upper query limits + * search result by specified list. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_DocsFilter +{ + /** + * Set of segment filters: + * array( <segmentName> => array(<docId> => <undefined_value>, + * <docId> => <undefined_value>, + * <docId> => <undefined_value>, + * ... ), + * <segmentName> => array(<docId> => <undefined_value>, + * <docId> => <undefined_value>, + * <docId> => <undefined_value>, + * ... ), + * <segmentName> => array(<docId> => <undefined_value>, + * <docId> => <undefined_value>, + * <docId> => <undefined_value>, + * ... ), + * ... + * ) + * + * @var array + */ + public $segmentFilters = array(); +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/FieldInfo.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/FieldInfo.php new file mode 100644 index 0000000000000000000000000000000000000000..db7cafb4af9f82a353cae4c87d63f3022e50d972 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/FieldInfo.php @@ -0,0 +1,49 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_FieldInfo +{ + public $name; + public $isIndexed; + public $number; + public $storeTermVector; + public $normsOmitted; + public $payloadsStored; + + public function __construct($name, $isIndexed, $number, $storeTermVector, $normsOmitted = false, $payloadsStored = false) + { + $this->name = $name; + $this->isIndexed = $isIndexed; + $this->number = $number; + $this->storeTermVector = $storeTermVector; + $this->normsOmitted = $normsOmitted; + $this->payloadsStored = $payloadsStored; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentInfo.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentInfo.php new file mode 100644 index 0000000000000000000000000000000000000000..70f42e6b3fcaa071caa2917812f22fd3959c7988 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentInfo.php @@ -0,0 +1,2005 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Search_Lucene_Index_DictionaryLoader */ +require_once 'Zend/Search/Lucene/Index/DictionaryLoader.php'; + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_LockManager */ +require_once 'Zend/Search/Lucene/LockManager.php'; + +/** Zend_Search_Lucene_Index_DocsFilter */ +require_once 'Zend/Search/Lucene/Index/DocsFilter.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_SegmentInfo +{ + /** + * "Full scan vs fetch" boundary. + * + * If filter selectivity is less than this value, then full scan is performed + * (since term entries fetching has some additional overhead). + */ + const FULL_SCAN_VS_FETCH_BOUNDARY = 5; + + /** + * Number of docs in a segment + * + * @var integer + */ + private $_docCount; + + /** + * Segment name + * + * @var string + */ + private $_name; + + /** + * Term Dictionary Index + * + * Array of arrays (Zend_Search_Lucene_Index_Term objects are represented as arrays because + * of performance considerations) + * [0] -> $termValue + * [1] -> $termFieldNum + * + * Corresponding Zend_Search_Lucene_Index_TermInfo object stored in the $_termDictionaryInfos + * + * @var array + */ + private $_termDictionary; + + /** + * Term Dictionary Index TermInfos + * + * Array of arrays (Zend_Search_Lucene_Index_TermInfo objects are represented as arrays because + * of performance considerations) + * [0] -> $docFreq + * [1] -> $freqPointer + * [2] -> $proxPointer + * [3] -> $skipOffset + * [4] -> $indexPointer + * + * @var array + */ + private $_termDictionaryInfos; + + /** + * Segment fields. Array of Zend_Search_Lucene_Index_FieldInfo objects for this segment + * + * @var array + */ + private $_fields; + + /** + * Field positions in a dictionary. + * (Term dictionary contains filelds ordered by names) + * + * @var array + */ + private $_fieldsDicPositions; + + + /** + * Associative array where the key is the file name and the value is data offset + * in a compound segment file (.csf). + * + * @var array + */ + private $_segFiles; + + /** + * Associative array where the key is the file name and the value is file size (.csf). + * + * @var array + */ + private $_segFileSizes; + + /** + * Delete file generation number + * + * -2 means autodetect latest delete generation + * -1 means 'there is no delete file' + * 0 means pre-2.1 format delete file + * X specifies used delete file + * + * @var integer + */ + private $_delGen; + + /** + * Segment has single norms file + * + * If true then one .nrm file is used for all fields + * Otherwise .fN files are used + * + * @var boolean + */ + private $_hasSingleNormFile; + + /** + * Use compound segment file (*.cfs) to collect all other segment files + * (excluding .del files) + * + * @var boolean + */ + private $_isCompound; + + + /** + * File system adapter. + * + * @var Zend_Search_Lucene_Storage_Directory_Filesystem + */ + private $_directory; + + /** + * Normalization factors. + * An array fieldName => normVector + * normVector is a binary string. + * Each byte corresponds to an indexed document in a segment and + * encodes normalization factor (float value, encoded by + * Zend_Search_Lucene_Search_Similarity::encodeNorm()) + * + * @var array + */ + private $_norms = array(); + + /** + * List of deleted documents. + * bitset if bitset extension is loaded or array otherwise. + * + * @var mixed + */ + private $_deleted = null; + + /** + * $this->_deleted update flag + * + * @var boolean + */ + private $_deletedDirty = false; + + /** + * True if segment uses shared doc store + * + * @var boolean + */ + private $_usesSharedDocStore; + + /* + * Shared doc store options. + * It's an assotiative array with the following items: + * - 'offset' => $docStoreOffset The starting document in the shared doc store files where this segment's documents begin + * - 'segment' => $docStoreSegment The name of the segment that has the shared doc store files. + * - 'isCompound' => $docStoreIsCompoundFile True, if compound file format is used for the shared doc store files (.cfx file). + */ + private $_sharedDocStoreOptions; + + + /** + * Zend_Search_Lucene_Index_SegmentInfo constructor + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @param string $name + * @param integer $docCount + * @param integer $delGen + * @param array|null $docStoreOptions + * @param boolean $hasSingleNormFile + * @param boolean $isCompound + */ + public function __construct(Zend_Search_Lucene_Storage_Directory $directory, $name, $docCount, $delGen = 0, $docStoreOptions = null, $hasSingleNormFile = false, $isCompound = null) + { + $this->_directory = $directory; + $this->_name = $name; + $this->_docCount = $docCount; + + if ($docStoreOptions !== null) { + $this->_usesSharedDocStore = true; + $this->_sharedDocStoreOptions = $docStoreOptions; + + if ($docStoreOptions['isCompound']) { + $cfxFile = $this->_directory->getFileObject($docStoreOptions['segment'] . '.cfx'); + $cfxFilesCount = $cfxFile->readVInt(); + + $cfxFiles = array(); + $cfxFileSizes = array(); + + for ($count = 0; $count < $cfxFilesCount; $count++) { + $dataOffset = $cfxFile->readLong(); + if ($count != 0) { + $cfxFileSizes[$fileName] = $dataOffset - end($cfxFiles); + } + $fileName = $cfxFile->readString(); + $cfxFiles[$fileName] = $dataOffset; + } + if ($count != 0) { + $cfxFileSizes[$fileName] = $this->_directory->fileLength($docStoreOptions['segment'] . '.cfx') - $dataOffset; + } + + $this->_sharedDocStoreOptions['files'] = $cfxFiles; + $this->_sharedDocStoreOptions['fileSizes'] = $cfxFileSizes; + } + } + + $this->_hasSingleNormFile = $hasSingleNormFile; + $this->_delGen = $delGen; + $this->_termDictionary = null; + + + if ($isCompound !== null) { + $this->_isCompound = $isCompound; + } else { + // It's a pre-2.1 segment or isCompound is set to 'unknown' + // Detect if segment uses compound file + try { + // Try to open compound file + $this->_directory->getFileObject($name . '.cfs'); + + // Compound file is found + $this->_isCompound = true; + } catch (Zend_Search_Lucene_Exception $e) { + if (strpos($e->getMessage(), 'is not readable') !== false) { + // Compound file is not found or is not readable + $this->_isCompound = false; + } else { + throw $e; + } + } + } + + $this->_segFiles = array(); + if ($this->_isCompound) { + $cfsFile = $this->_directory->getFileObject($name . '.cfs'); + $segFilesCount = $cfsFile->readVInt(); + + for ($count = 0; $count < $segFilesCount; $count++) { + $dataOffset = $cfsFile->readLong(); + if ($count != 0) { + $this->_segFileSizes[$fileName] = $dataOffset - end($this->_segFiles); + } + $fileName = $cfsFile->readString(); + $this->_segFiles[$fileName] = $dataOffset; + } + if ($count != 0) { + $this->_segFileSizes[$fileName] = $this->_directory->fileLength($name . '.cfs') - $dataOffset; + } + } + + $fnmFile = $this->openCompoundFile('.fnm'); + $fieldsCount = $fnmFile->readVInt(); + $fieldNames = array(); + $fieldNums = array(); + $this->_fields = array(); + for ($count=0; $count < $fieldsCount; $count++) { + $fieldName = $fnmFile->readString(); + $fieldBits = $fnmFile->readByte(); + $this->_fields[$count] = new Zend_Search_Lucene_Index_FieldInfo($fieldName, + $fieldBits & 0x01 /* field is indexed */, + $count, + $fieldBits & 0x02 /* termvectors are stored */, + $fieldBits & 0x10 /* norms are omitted */, + $fieldBits & 0x20 /* payloads are stored */); + if ($fieldBits & 0x10) { + // norms are omitted for the indexed field + $this->_norms[$count] = str_repeat(chr(Zend_Search_Lucene_Search_Similarity::encodeNorm(1.0)), $docCount); + } + + $fieldNums[$count] = $count; + $fieldNames[$count] = $fieldName; + } + array_multisort($fieldNames, SORT_ASC, SORT_REGULAR, $fieldNums); + $this->_fieldsDicPositions = array_flip($fieldNums); + + if ($this->_delGen == -2) { + $this->_detectLatestDelGen(); + } + + if ($this->_delGen == -1) { + // There is no delete file for this segment + // Do nothing + } else if ($this->_delGen == 0) { + // It's a segment with pre-2.1 format delete file + // Try to find delete file + try { + // '.del' files always stored in a separate file + // Segment compound is not used + $delFile = $this->_directory->getFileObject($this->_name . '.del'); + + $byteCount = $delFile->readInt(); + $byteCount = ceil($byteCount/8); + $bitCount = $delFile->readInt(); + + if ($bitCount == 0) { + $delBytes = ''; + } else { + $delBytes = $delFile->readBytes($byteCount); + } + + if (extension_loaded('bitset')) { + $this->_deleted = $delBytes; + } else { + $this->_deleted = array(); + for ($count = 0; $count < $byteCount; $count++) { + $byte = ord($delBytes[$count]); + for ($bit = 0; $bit < 8; $bit++) { + if ($byte & (1<<$bit)) { + $this->_deleted[$count*8 + $bit] = 1; + } + } + } + } + } catch(Zend_Search_Exception $e) { + if (strpos($e->getMessage(), 'is not readable') === false ) { + throw $e; + } + // There is no delete file + // Do nothing + } + } else { + // It's 2.1+ format delete file + $delFile = $this->_directory->getFileObject($this->_name . '_' . base_convert($this->_delGen, 10, 36) . '.del'); + + $format = $delFile->readInt(); + + if ($format == (int)0xFFFFFFFF) { + if (extension_loaded('bitset')) { + $this->_deleted = bitset_empty(); + } else { + $this->_deleted = array(); + } + + $byteCount = $delFile->readInt(); + $bitCount = $delFile->readInt(); + + $delFileSize = $this->_directory->fileLength($this->_name . '_' . base_convert($this->_delGen, 10, 36) . '.del'); + $byteNum = 0; + + do { + $dgap = $delFile->readVInt(); + $nonZeroByte = $delFile->readByte(); + + $byteNum += $dgap; + + for ($bit = 0; $bit < 8; $bit++) { + if ($nonZeroByte & (1<<$bit)) { + if (extension_loaded('bitset')) { + bitset_incl($this->_deleted, $byteNum*8 + $bit); + } else { + $this->_deleted[$byteNum*8 + $bit] = 1; + } + } + } + } while ($delFile->tell() < $delFileSize); + + } else { + // $format is actually byte count + $byteCount = ceil($format/8); + $bitCount = $delFile->readInt(); + + if ($bitCount == 0) { + $delBytes = ''; + } else { + $delBytes = $delFile->readBytes($byteCount); + } + + if (extension_loaded('bitset')) { + $this->_deleted = $delBytes; + } else { + $this->_deleted = array(); + for ($count = 0; $count < $byteCount; $count++) { + $byte = ord($delBytes[$count]); + for ($bit = 0; $bit < 8; $bit++) { + if ($byte & (1<<$bit)) { + $this->_deleted[$count*8 + $bit] = 1; + } + } + } + } + } + } + } + + /** + * Opens index file stoted within compound index file + * + * @param string $extension + * @param boolean $shareHandler + * @throws Zend_Search_Lucene_Exception + * @return Zend_Search_Lucene_Storage_File + */ + public function openCompoundFile($extension, $shareHandler = true) + { + if (($extension == '.fdx' || $extension == '.fdt') && $this->_usesSharedDocStore) { + $fdxFName = $this->_sharedDocStoreOptions['segment'] . '.fdx'; + $fdtFName = $this->_sharedDocStoreOptions['segment'] . '.fdt'; + + if (!$this->_sharedDocStoreOptions['isCompound']) { + $fdxFile = $this->_directory->getFileObject($fdxFName, $shareHandler); + $fdxFile->seek($this->_sharedDocStoreOptions['offset']*8, SEEK_CUR); + + if ($extension == '.fdx') { + // '.fdx' file is requested + return $fdxFile; + } else { + // '.fdt' file is requested + $fdtStartOffset = $fdxFile->readLong(); + + $fdtFile = $this->_directory->getFileObject($fdtFName, $shareHandler); + $fdtFile->seek($fdtStartOffset, SEEK_CUR); + + return $fdtFile; + } + } + + if( !isset($this->_sharedDocStoreOptions['files'][$fdxFName]) ) { + throw new Zend_Search_Lucene_Exception('Shared doc storage segment compound file doesn\'t contain ' + . $fdxFName . ' file.' ); + } + if( !isset($this->_sharedDocStoreOptions['files'][$fdtFName]) ) { + throw new Zend_Search_Lucene_Exception('Shared doc storage segment compound file doesn\'t contain ' + . $fdtFName . ' file.' ); + } + + // Open shared docstore segment file + $cfxFile = $this->_directory->getFileObject($this->_sharedDocStoreOptions['segment'] . '.cfx', $shareHandler); + // Seek to the start of '.fdx' file within compound file + $cfxFile->seek($this->_sharedDocStoreOptions['files'][$fdxFName]); + // Seek to the start of current segment documents section + $cfxFile->seek($this->_sharedDocStoreOptions['offset']*8, SEEK_CUR); + + if ($extension == '.fdx') { + // '.fdx' file is requested + return $cfxFile; + } else { + // '.fdt' file is requested + $fdtStartOffset = $cfxFile->readLong(); + + // Seek to the start of '.fdt' file within compound file + $cfxFile->seek($this->_sharedDocStoreOptions['files'][$fdtFName]); + // Seek to the start of current segment documents section + $cfxFile->seek($fdtStartOffset, SEEK_CUR); + + return $fdtFile; + } + } + + $filename = $this->_name . $extension; + + if (!$this->_isCompound) { + return $this->_directory->getFileObject($filename, $shareHandler); + } + + if( !isset($this->_segFiles[$filename]) ) { + throw new Zend_Search_Lucene_Exception('Segment compound file doesn\'t contain ' + . $filename . ' file.' ); + } + + $file = $this->_directory->getFileObject($this->_name . '.cfs', $shareHandler); + $file->seek($this->_segFiles[$filename]); + return $file; + } + + /** + * Get compound file length + * + * @param string $extension + * @return integer + */ + public function compoundFileLength($extension) + { + if (($extension == '.fdx' || $extension == '.fdt') && $this->_usesSharedDocStore) { + $filename = $this->_sharedDocStoreOptions['segment'] . $extension; + + if (!$this->_sharedDocStoreOptions['isCompound']) { + return $this->_directory->fileLength($filename); + } + + if( !isset($this->_sharedDocStoreOptions['fileSizes'][$filename]) ) { + throw new Zend_Search_Lucene_Exception('Shared doc store compound file doesn\'t contain ' + . $filename . ' file.' ); + } + + return $this->_sharedDocStoreOptions['fileSizes'][$filename]; + } + + + $filename = $this->_name . $extension; + + // Try to get common file first + if ($this->_directory->fileExists($filename)) { + return $this->_directory->fileLength($filename); + } + + if( !isset($this->_segFileSizes[$filename]) ) { + throw new Zend_Search_Lucene_Exception('Index compound file doesn\'t contain ' + . $filename . ' file.' ); + } + + return $this->_segFileSizes[$filename]; + } + + /** + * Returns field index or -1 if field is not found + * + * @param string $fieldName + * @return integer + */ + public function getFieldNum($fieldName) + { + foreach( $this->_fields as $field ) { + if( $field->name == $fieldName ) { + return $field->number; + } + } + + return -1; + } + + /** + * Returns field info for specified field + * + * @param integer $fieldNum + * @return Zend_Search_Lucene_Index_FieldInfo + */ + public function getField($fieldNum) + { + return $this->_fields[$fieldNum]; + } + + /** + * Returns array of fields. + * if $indexed parameter is true, then returns only indexed fields. + * + * @param boolean $indexed + * @return array + */ + public function getFields($indexed = false) + { + $result = array(); + foreach( $this->_fields as $field ) { + if( (!$indexed) || $field->isIndexed ) { + $result[ $field->name ] = $field->name; + } + } + return $result; + } + + /** + * Returns array of FieldInfo objects. + * + * @return array + */ + public function getFieldInfos() + { + return $this->_fields; + } + + /** + * Returns actual deletions file generation number. + * + * @return integer + */ + public function getDelGen() + { + return $this->_delGen; + } + + /** + * Returns the total number of documents in this segment (including deleted documents). + * + * @return integer + */ + public function count() + { + return $this->_docCount; + } + + /** + * Returns number of deleted documents. + * + * @return integer + */ + private function _deletedCount() + { + if ($this->_deleted === null) { + return 0; + } + + if (extension_loaded('bitset')) { + return count(bitset_to_array($this->_deleted)); + } else { + return count($this->_deleted); + } + } + + /** + * Returns the total number of non-deleted documents in this segment. + * + * @return integer + */ + public function numDocs() + { + if ($this->hasDeletions()) { + return $this->_docCount - $this->_deletedCount(); + } else { + return $this->_docCount; + } + } + + /** + * Get field position in a fields dictionary + * + * @param integer $fieldNum + * @return integer + */ + private function _getFieldPosition($fieldNum) { + // Treat values which are not in a translation table as a 'direct value' + return isset($this->_fieldsDicPositions[$fieldNum]) ? + $this->_fieldsDicPositions[$fieldNum] : $fieldNum; + } + + /** + * Return segment name + * + * @return string + */ + public function getName() + { + return $this->_name; + } + + + /** + * TermInfo cache + * + * Size is 1024. + * Numbers are used instead of class constants because of performance considerations + * + * @var array + */ + private $_termInfoCache = array(); + + private function _cleanUpTermInfoCache() + { + // Clean 256 term infos + foreach ($this->_termInfoCache as $key => $termInfo) { + unset($this->_termInfoCache[$key]); + + // leave 768 last used term infos + if (count($this->_termInfoCache) == 768) { + break; + } + } + } + + /** + * Load terms dictionary index + * + * @throws Zend_Search_Lucene_Exception + */ + private function _loadDictionaryIndex() + { + // Check, if index is already serialized + if ($this->_directory->fileExists($this->_name . '.sti')) { + // Load serialized dictionary index data + $stiFile = $this->_directory->getFileObject($this->_name . '.sti'); + $stiFileData = $stiFile->readBytes($this->_directory->fileLength($this->_name . '.sti')); + + // Load dictionary index data + if (($unserializedData = @unserialize($stiFileData)) !== false) { + list($this->_termDictionary, $this->_termDictionaryInfos) = $unserializedData; + return; + } + } + + // Load data from .tii file and generate .sti file + + // Prefetch dictionary index data + $tiiFile = $this->openCompoundFile('.tii'); + $tiiFileData = $tiiFile->readBytes($this->compoundFileLength('.tii')); + + // Load dictionary index data + list($this->_termDictionary, $this->_termDictionaryInfos) = + Zend_Search_Lucene_Index_DictionaryLoader::load($tiiFileData); + + $stiFileData = serialize(array($this->_termDictionary, $this->_termDictionaryInfos)); + $stiFile = $this->_directory->createFile($this->_name . '.sti'); + $stiFile->writeBytes($stiFileData); + } + + /** + * Scans terms dictionary and returns term info + * + * @param Zend_Search_Lucene_Index_Term $term + * @return Zend_Search_Lucene_Index_TermInfo + */ + public function getTermInfo(Zend_Search_Lucene_Index_Term $term) + { + $termKey = $term->key(); + if (isset($this->_termInfoCache[$termKey])) { + $termInfo = $this->_termInfoCache[$termKey]; + + // Move termInfo to the end of cache + unset($this->_termInfoCache[$termKey]); + $this->_termInfoCache[$termKey] = $termInfo; + + return $termInfo; + } + + + if ($this->_termDictionary === null) { + $this->_loadDictionaryIndex(); + } + + $searchField = $this->getFieldNum($term->field); + + if ($searchField == -1) { + return null; + } + $searchDicField = $this->_getFieldPosition($searchField); + + // search for appropriate value in dictionary + $lowIndex = 0; + $highIndex = count($this->_termDictionary)-1; + while ($highIndex >= $lowIndex) { + // $mid = ($highIndex - $lowIndex)/2; + $mid = ($highIndex + $lowIndex) >> 1; + $midTerm = $this->_termDictionary[$mid]; + + $fieldNum = $this->_getFieldPosition($midTerm[0] /* field */); + $delta = $searchDicField - $fieldNum; + if ($delta == 0) { + $delta = strcmp($term->text, $midTerm[1] /* text */); + } + + if ($delta < 0) { + $highIndex = $mid-1; + } elseif ($delta > 0) { + $lowIndex = $mid+1; + } else { + // return $this->_termDictionaryInfos[$mid]; // We got it! + $a = $this->_termDictionaryInfos[$mid]; + $termInfo = new Zend_Search_Lucene_Index_TermInfo($a[0], $a[1], $a[2], $a[3], $a[4]); + + // Put loaded termInfo into cache + $this->_termInfoCache[$termKey] = $termInfo; + + return $termInfo; + } + } + + if ($highIndex == -1) { + // Term is out of the dictionary range + return null; + } + + $prevPosition = $highIndex; + $prevTerm = $this->_termDictionary[$prevPosition]; + $prevTermInfo = $this->_termDictionaryInfos[$prevPosition]; + + $tisFile = $this->openCompoundFile('.tis'); + $tiVersion = $tisFile->readInt(); + if ($tiVersion != (int)0xFFFFFFFE /* pre-2.1 format */ && + $tiVersion != (int)0xFFFFFFFD /* 2.1+ format */) { + throw new Zend_Search_Lucene_Exception('Wrong TermInfoFile file format'); + } + + $termCount = $tisFile->readLong(); + $indexInterval = $tisFile->readInt(); + $skipInterval = $tisFile->readInt(); + if ($tiVersion == (int)0xFFFFFFFD /* 2.1+ format */) { + $maxSkipLevels = $tisFile->readInt(); + } + + $tisFile->seek($prevTermInfo[4] /* indexPointer */ - (($tiVersion == (int)0xFFFFFFFD)? 24 : 20) /* header size*/, SEEK_CUR); + + $termValue = $prevTerm[1] /* text */; + $termFieldNum = $prevTerm[0] /* field */; + $freqPointer = $prevTermInfo[1] /* freqPointer */; + $proxPointer = $prevTermInfo[2] /* proxPointer */; + for ($count = $prevPosition*$indexInterval + 1; + $count <= $termCount && + ( $this->_getFieldPosition($termFieldNum) < $searchDicField || + ($this->_getFieldPosition($termFieldNum) == $searchDicField && + strcmp($termValue, $term->text) < 0) ); + $count++) { + $termPrefixLength = $tisFile->readVInt(); + $termSuffix = $tisFile->readString(); + $termFieldNum = $tisFile->readVInt(); + $termValue = Zend_Search_Lucene_Index_Term::getPrefix($termValue, $termPrefixLength) . $termSuffix; + + $docFreq = $tisFile->readVInt(); + $freqPointer += $tisFile->readVInt(); + $proxPointer += $tisFile->readVInt(); + if( $docFreq >= $skipInterval ) { + $skipOffset = $tisFile->readVInt(); + } else { + $skipOffset = 0; + } + } + + if ($termFieldNum == $searchField && $termValue == $term->text) { + $termInfo = new Zend_Search_Lucene_Index_TermInfo($docFreq, $freqPointer, $proxPointer, $skipOffset); + } else { + $termInfo = null; + } + + // Put loaded termInfo into cache + $this->_termInfoCache[$termKey] = $termInfo; + + if (count($this->_termInfoCache) == 1024) { + $this->_cleanUpTermInfoCache(); + } + + return $termInfo; + } + + /** + * Returns IDs of all the documents containing term. + * + * @param Zend_Search_Lucene_Index_Term $term + * @param integer $shift + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return array + */ + public function termDocs(Zend_Search_Lucene_Index_Term $term, $shift = 0, $docsFilter = null) + { + $termInfo = $this->getTermInfo($term); + + if (!$termInfo instanceof Zend_Search_Lucene_Index_TermInfo) { + if ($docsFilter !== null && $docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { + $docsFilter->segmentFilters[$this->_name] = array(); + } + return array(); + } + + $frqFile = $this->openCompoundFile('.frq'); + $frqFile->seek($termInfo->freqPointer,SEEK_CUR); + $docId = 0; + $result = array(); + + if ($docsFilter !== null) { + if (!$docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { + throw new Zend_Search_Lucene_Exception('Documents filter must be an instance of Zend_Search_Lucene_Index_DocsFilter or null.'); + } + + if (isset($docsFilter->segmentFilters[$this->_name])) { + // Filter already has some data for the current segment + + // Make short name for the filter (which doesn't need additional dereferencing) + $filter = &$docsFilter->segmentFilters[$this->_name]; + + // Check if filter is not empty + if (count($filter) == 0) { + return array(); + } + + if ($this->_docCount/count($filter) < self::FULL_SCAN_VS_FETCH_BOUNDARY) { + // Perform fetching +// --------------------------------------------------------------- + $updatedFilterData = array(); + + for( $count=0; $count < $termInfo->docFreq; $count++ ) { + $docDelta = $frqFile->readVInt(); + if( $docDelta % 2 == 1 ) { + $docId += ($docDelta-1)/2; + } else { + $docId += $docDelta/2; + // read freq + $frqFile->readVInt(); + } + + if (isset($filter[$docId])) { + $result[] = $shift + $docId; + $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + } + } + $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; +// --------------------------------------------------------------- + } else { + // Perform full scan + $updatedFilterData = array(); + + for( $count=0; $count < $termInfo->docFreq; $count++ ) { + $docDelta = $frqFile->readVInt(); + if( $docDelta % 2 == 1 ) { + $docId += ($docDelta-1)/2; + } else { + $docId += $docDelta/2; + // read freq + $frqFile->readVInt(); + } + + if (isset($filter[$docId])) { + $result[] = $shift + $docId; + $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + } + } + $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; + } + } else { + // Filter is present, but doesn't has data for the current segment yet + $filterData = array(); + for( $count=0; $count < $termInfo->docFreq; $count++ ) { + $docDelta = $frqFile->readVInt(); + if( $docDelta % 2 == 1 ) { + $docId += ($docDelta-1)/2; + } else { + $docId += $docDelta/2; + // read freq + $frqFile->readVInt(); + } + + $result[] = $shift + $docId; + $filterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + } + $docsFilter->segmentFilters[$this->_name] = $filterData; + } + } else { + for( $count=0; $count < $termInfo->docFreq; $count++ ) { + $docDelta = $frqFile->readVInt(); + if( $docDelta % 2 == 1 ) { + $docId += ($docDelta-1)/2; + } else { + $docId += $docDelta/2; + // read freq + $frqFile->readVInt(); + } + + $result[] = $shift + $docId; + } + } + + return $result; + } + + /** + * Returns term freqs array. + * Result array structure: array(docId => freq, ...) + * + * @param Zend_Search_Lucene_Index_Term $term + * @param integer $shift + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return Zend_Search_Lucene_Index_TermInfo + */ + public function termFreqs(Zend_Search_Lucene_Index_Term $term, $shift = 0, $docsFilter = null) + { + $termInfo = $this->getTermInfo($term); + + if (!$termInfo instanceof Zend_Search_Lucene_Index_TermInfo) { + if ($docsFilter !== null && $docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { + $docsFilter->segmentFilters[$this->_name] = array(); + } + return array(); + } + + $frqFile = $this->openCompoundFile('.frq'); + $frqFile->seek($termInfo->freqPointer,SEEK_CUR); + $result = array(); + $docId = 0; + + $result = array(); + + if ($docsFilter !== null) { + if (!$docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { + throw new Zend_Search_Lucene_Exception('Documents filter must be an instance of Zend_Search_Lucene_Index_DocsFilter or null.'); + } + + if (isset($docsFilter->segmentFilters[$this->_name])) { + // Filter already has some data for the current segment + + // Make short name for the filter (which doesn't need additional dereferencing) + $filter = &$docsFilter->segmentFilters[$this->_name]; + + // Check if filter is not empty + if (count($filter) == 0) { + return array(); + } + + + if ($this->_docCount/count($filter) < self::FULL_SCAN_VS_FETCH_BOUNDARY) { + // Perform fetching +// --------------------------------------------------------------- + $updatedFilterData = array(); + + for ($count = 0; $count < $termInfo->docFreq; $count++) { + $docDelta = $frqFile->readVInt(); + if ($docDelta % 2 == 1) { + $docId += ($docDelta-1)/2; + if (isset($filter[$docId])) { + $result[$shift + $docId] = 1; + $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + } + } else { + $docId += $docDelta/2; + if (isset($filter[$docId])) { + $result[$shift + $docId] = $frqFile->readVInt(); + $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + } + } + } + $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; +// --------------------------------------------------------------- + } else { + // Perform full scan + $updatedFilterData = array(); + + for ($count = 0; $count < $termInfo->docFreq; $count++) { + $docDelta = $frqFile->readVInt(); + if ($docDelta % 2 == 1) { + $docId += ($docDelta-1)/2; + if (isset($filter[$docId])) { + $result[$shift + $docId] = 1; + $updatedFilterData[$docId] = 1; // 1 is just some constant value, so we don't need additional var dereference here + } + } else { + $docId += $docDelta/2; + if (isset($filter[$docId])) { + $result[$shift + $docId] = $frqFile->readVInt(); + $updatedFilterData[$docId] = 1; // 1 is just some constant value, so we don't need additional var dereference here + } + } + } + $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; + } + } else { + // Filter doesn't has data for current segment + $filterData = array(); + + for ($count = 0; $count < $termInfo->docFreq; $count++) { + $docDelta = $frqFile->readVInt(); + if ($docDelta % 2 == 1) { + $docId += ($docDelta-1)/2; + $result[$shift + $docId] = 1; + $filterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + } else { + $docId += $docDelta/2; + $result[$shift + $docId] = $frqFile->readVInt(); + $filterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + } + } + + $docsFilter->segmentFilters[$this->_name] = $filterData; + } + } else { + for ($count = 0; $count < $termInfo->docFreq; $count++) { + $docDelta = $frqFile->readVInt(); + if ($docDelta % 2 == 1) { + $docId += ($docDelta-1)/2; + $result[$shift + $docId] = 1; + } else { + $docId += $docDelta/2; + $result[$shift + $docId] = $frqFile->readVInt(); + } + } + } + + return $result; + } + + /** + * Returns term positions array. + * Result array structure: array(docId => array(pos1, pos2, ...), ...) + * + * @param Zend_Search_Lucene_Index_Term $term + * @param integer $shift + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return Zend_Search_Lucene_Index_TermInfo + */ + public function termPositions(Zend_Search_Lucene_Index_Term $term, $shift = 0, $docsFilter = null) + { + $termInfo = $this->getTermInfo($term); + + if (!$termInfo instanceof Zend_Search_Lucene_Index_TermInfo) { + if ($docsFilter !== null && $docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { + $docsFilter->segmentFilters[$this->_name] = array(); + } + return array(); + } + + $frqFile = $this->openCompoundFile('.frq'); + $frqFile->seek($termInfo->freqPointer,SEEK_CUR); + + $docId = 0; + $freqs = array(); + + + if ($docsFilter !== null) { + if (!$docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { + throw new Zend_Search_Lucene_Exception('Documents filter must be an instance of Zend_Search_Lucene_Index_DocsFilter or null.'); + } + + if (isset($docsFilter->segmentFilters[$this->_name])) { + // Filter already has some data for the current segment + + // Make short name for the filter (which doesn't need additional dereferencing) + $filter = &$docsFilter->segmentFilters[$this->_name]; + + // Check if filter is not empty + if (count($filter) == 0) { + return array(); + } + + if ($this->_docCount/count($filter) < self::FULL_SCAN_VS_FETCH_BOUNDARY) { + // Perform fetching +// --------------------------------------------------------------- + for ($count = 0; $count < $termInfo->docFreq; $count++) { + $docDelta = $frqFile->readVInt(); + if ($docDelta % 2 == 1) { + $docId += ($docDelta-1)/2; + $freqs[$docId] = 1; + } else { + $docId += $docDelta/2; + $freqs[$docId] = $frqFile->readVInt(); + } + } + + $updatedFilterData = array(); + $result = array(); + $prxFile = $this->openCompoundFile('.prx'); + $prxFile->seek($termInfo->proxPointer, SEEK_CUR); + foreach ($freqs as $docId => $freq) { + $termPosition = 0; + $positions = array(); + + // we have to read .prx file to get right position for next doc + // even filter doesn't match current document + for ($count = 0; $count < $freq; $count++ ) { + $termPosition += $prxFile->readVInt(); + $positions[] = $termPosition; + } + + // Include into updated filter and into result only if doc is matched by filter + if (isset($filter[$docId])) { + $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + $result[$shift + $docId] = $positions; + } + } + + $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; +// --------------------------------------------------------------- + } else { + // Perform full scan + for ($count = 0; $count < $termInfo->docFreq; $count++) { + $docDelta = $frqFile->readVInt(); + if ($docDelta % 2 == 1) { + $docId += ($docDelta-1)/2; + $freqs[$docId] = 1; + } else { + $docId += $docDelta/2; + $freqs[$docId] = $frqFile->readVInt(); + } + } + + $updatedFilterData = array(); + $result = array(); + $prxFile = $this->openCompoundFile('.prx'); + $prxFile->seek($termInfo->proxPointer, SEEK_CUR); + foreach ($freqs as $docId => $freq) { + $termPosition = 0; + $positions = array(); + + // we have to read .prx file to get right position for next doc + // even filter doesn't match current document + for ($count = 0; $count < $freq; $count++ ) { + $termPosition += $prxFile->readVInt(); + $positions[] = $termPosition; + } + + // Include into updated filter and into result only if doc is matched by filter + if (isset($filter[$docId])) { + $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + $result[$shift + $docId] = $positions; + } + } + + $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; + } + } else { + // Filter doesn't has data for current segment + for ($count = 0; $count < $termInfo->docFreq; $count++) { + $docDelta = $frqFile->readVInt(); + if ($docDelta % 2 == 1) { + $docId += ($docDelta-1)/2; + $freqs[$docId] = 1; + } else { + $docId += $docDelta/2; + $freqs[$docId] = $frqFile->readVInt(); + } + } + + $filterData = array(); + $result = array(); + $prxFile = $this->openCompoundFile('.prx'); + $prxFile->seek($termInfo->proxPointer, SEEK_CUR); + foreach ($freqs as $docId => $freq) { + $filterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here + + $termPosition = 0; + $positions = array(); + + for ($count = 0; $count < $freq; $count++ ) { + $termPosition += $prxFile->readVInt(); + $positions[] = $termPosition; + } + + $result[$shift + $docId] = $positions; + } + + $docsFilter->segmentFilters[$this->_name] = $filterData; + } + } else { + for ($count = 0; $count < $termInfo->docFreq; $count++) { + $docDelta = $frqFile->readVInt(); + if ($docDelta % 2 == 1) { + $docId += ($docDelta-1)/2; + $freqs[$docId] = 1; + } else { + $docId += $docDelta/2; + $freqs[$docId] = $frqFile->readVInt(); + } + } + + $result = array(); + $prxFile = $this->openCompoundFile('.prx'); + $prxFile->seek($termInfo->proxPointer, SEEK_CUR); + foreach ($freqs as $docId => $freq) { + $termPosition = 0; + $positions = array(); + + for ($count = 0; $count < $freq; $count++ ) { + $termPosition += $prxFile->readVInt(); + $positions[] = $termPosition; + } + + $result[$shift + $docId] = $positions; + } + } + + return $result; + } + + /** + * Load normalizatin factors from an index file + * + * @param integer $fieldNum + * @throws Zend_Search_Lucene_Exception + */ + private function _loadNorm($fieldNum) + { + if ($this->_hasSingleNormFile) { + $normfFile = $this->openCompoundFile('.nrm'); + + $header = $normfFile->readBytes(3); + $headerFormatVersion = $normfFile->readByte(); + + if ($header != 'NRM' || $headerFormatVersion != (int)0xFF) { + throw new Zend_Search_Lucene_Exception('Wrong norms file format.'); + } + + foreach ($this->_fields as $fNum => $fieldInfo) { + if ($fieldInfo->isIndexed) { + $this->_norms[$fNum] = $normfFile->readBytes($this->_docCount); + } + } + } else { + $fFile = $this->openCompoundFile('.f' . $fieldNum); + $this->_norms[$fieldNum] = $fFile->readBytes($this->_docCount); + } + } + + /** + * Returns normalization factor for specified documents + * + * @param integer $id + * @param string $fieldName + * @return float + */ + public function norm($id, $fieldName) + { + $fieldNum = $this->getFieldNum($fieldName); + + if ( !($this->_fields[$fieldNum]->isIndexed) ) { + return null; + } + + if (!isset($this->_norms[$fieldNum])) { + $this->_loadNorm($fieldNum); + } + + return Zend_Search_Lucene_Search_Similarity::decodeNorm( ord($this->_norms[$fieldNum][$id]) ); + } + + /** + * Returns norm vector, encoded in a byte string + * + * @param string $fieldName + * @return string + */ + public function normVector($fieldName) + { + $fieldNum = $this->getFieldNum($fieldName); + + if ($fieldNum == -1 || !($this->_fields[$fieldNum]->isIndexed)) { + $similarity = Zend_Search_Lucene_Search_Similarity::getDefault(); + + return str_repeat(chr($similarity->encodeNorm( $similarity->lengthNorm($fieldName, 0) )), + $this->_docCount); + } + + if (!isset($this->_norms[$fieldNum])) { + $this->_loadNorm($fieldNum); + } + + return $this->_norms[$fieldNum]; + } + + + /** + * Returns true if any documents have been deleted from this index segment. + * + * @return boolean + */ + public function hasDeletions() + { + return $this->_deleted !== null; + } + + + /** + * Returns true if segment has single norms file. + * + * @return boolean + */ + public function hasSingleNormFile() + { + return $this->_hasSingleNormFile ? true : false; + } + + /** + * Returns true if segment is stored using compound segment file. + * + * @return boolean + */ + public function isCompound() + { + return $this->_isCompound; + } + + /** + * Deletes a document from the index segment. + * $id is an internal document id + * + * @param integer + */ + public function delete($id) + { + $this->_deletedDirty = true; + + if (extension_loaded('bitset')) { + if ($this->_deleted === null) { + $this->_deleted = bitset_empty($id); + } + bitset_incl($this->_deleted, $id); + } else { + if ($this->_deleted === null) { + $this->_deleted = array(); + } + + $this->_deleted[$id] = 1; + } + } + + /** + * Checks, that document is deleted + * + * @param integer + * @return boolean + */ + public function isDeleted($id) + { + if ($this->_deleted === null) { + return false; + } + + if (extension_loaded('bitset')) { + return bitset_in($this->_deleted, $id); + } else { + return isset($this->_deleted[$id]); + } + } + + + /** + * Detect latest delete generation + * + * Is actualy used from writeChanges() method or from the constructor if it's invoked from + * Index writer. In both cases index write lock is already obtained, so we shouldn't care + * about it + */ + private function _detectLatestDelGen() + { + $delFileList = array(); + foreach ($this->_directory->fileList() as $file) { + if ($file == $this->_name . '.del') { + // Matches <segment_name>.del file name + $delFileList[] = 0; + } else if (preg_match('/^' . $this->_name . '_([a-zA-Z0-9]+)\.del$/i', $file, $matches)) { + // Matches <segment_name>_NNN.del file names + $delFileList[] = (int)base_convert($matches[1], 36, 10); + } + } + + if (count($delFileList) == 0) { + // There is no deletions file for current segment in the directory + // Set detetions file generation number to 1 + $this->_delGen = -1; + } else { + // There are some deletions files for current segment in the directory + // Set deletions file generation number to the highest nuber + $this->_delGen = max($delFileList); + } + } + + /** + * Write changes if it's necessary. + * + * This method must be invoked only from the Writer _updateSegments() method, + * so index Write lock has to be already obtained. + * + * @internal + */ + public function writeChanges() + { + if (!$this->_deletedDirty) { + return; + } + + if (extension_loaded('bitset')) { + $delBytes = $this->_deleted; + $bitCount = count(bitset_to_array($delBytes)); + } else { + $byteCount = floor($this->_docCount/8)+1; + $delBytes = str_repeat(chr(0), $byteCount); + for ($count = 0; $count < $byteCount; $count++) { + $byte = 0; + for ($bit = 0; $bit < 8; $bit++) { + if (isset($this->_deleted[$count*8 + $bit])) { + $byte |= (1<<$bit); + } + } + $delBytes[$count] = chr($byte); + } + $bitCount = count($this->_deleted); + } + + + // Get new generation number + $this->_detectLatestDelGen(); + + if ($this->_delGen == -1) { + // Set delete file generation number to 1 + $this->_delGen = 1; + } else { + // Increase delete file generation number by 1 + $this->_delGen++; + } + + $delFile = $this->_directory->createFile($this->_name . '_' . base_convert($this->_delGen, 10, 36) . '.del'); + $delFile->writeInt($this->_docCount); + $delFile->writeInt($bitCount); + $delFile->writeBytes($delBytes); + + $this->_deletedDirty = false; + } + + + + /** + * Term Dictionary File object for stream like terms reading + * + * @var Zend_Search_Lucene_Storage_File + */ + private $_tisFile = null; + + /** + * Actual offset of the .tis file data + * + * @var integer + */ + private $_tisFileOffset; + + /** + * Frequencies File object for stream like terms reading + * + * @var Zend_Search_Lucene_Storage_File + */ + private $_frqFile = null; + + /** + * Actual offset of the .frq file data + * + * @var integer + */ + private $_frqFileOffset; + + /** + * Positions File object for stream like terms reading + * + * @var Zend_Search_Lucene_Storage_File + */ + private $_prxFile = null; + + /** + * Actual offset of the .prx file in the compound file + * + * @var integer + */ + private $_prxFileOffset; + + + /** + * Actual number of terms in term stream + * + * @var integer + */ + private $_termCount = 0; + + /** + * Overall number of terms in term stream + * + * @var integer + */ + private $_termNum = 0; + + /** + * Segment index interval + * + * @var integer + */ + private $_indexInterval; + + /** + * Segment skip interval + * + * @var integer + */ + private $_skipInterval; + + /** + * Last TermInfo in a terms stream + * + * @var Zend_Search_Lucene_Index_TermInfo + */ + private $_lastTermInfo = null; + + /** + * Last Term in a terms stream + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_lastTerm = null; + + /** + * Map of the document IDs + * Used to get new docID after removing deleted documents. + * It's not very effective from memory usage point of view, + * but much more faster, then other methods + * + * @var array|null + */ + private $_docMap = null; + + /** + * An array of all term positions in the documents. + * Array structure: array( docId => array( pos1, pos2, ...), ...) + * + * Is set to null if term positions loading has to be skipped + * + * @var array|null + */ + private $_lastTermPositions; + + + /** + * Terms scan mode + * + * Values: + * + * self::SM_TERMS_ONLY - terms are scanned, no additional info is retrieved + * self::SM_FULL_INFO - terms are scanned, frequency and position info is retrieved + * self::SM_MERGE_INFO - terms are scanned, frequency and position info is retrieved + * document numbers are compacted (shifted if segment has deleted documents) + * + * @var integer + */ + private $_termsScanMode; + + /** Scan modes */ + const SM_TERMS_ONLY = 0; // terms are scanned, no additional info is retrieved + const SM_FULL_INFO = 1; // terms are scanned, frequency and position info is retrieved + const SM_MERGE_INFO = 2; // terms are scanned, frequency and position info is retrieved + // document numbers are compacted (shifted if segment contains deleted documents) + + /** + * Reset terms stream + * + * $startId - id for the fist document + * $compact - remove deleted documents + * + * Returns start document id for the next segment + * + * @param integer $startId + * @param integer $mode + * @throws Zend_Search_Lucene_Exception + * @return integer + */ + public function reset($startId = 0, $mode = self::SM_TERMS_ONLY) + { + if ($this->_tisFile !== null) { + $this->_tisFile = null; + } + + $this->_tisFile = $this->openCompoundFile('.tis', false); + $this->_tisFileOffset = $this->_tisFile->tell(); + + $tiVersion = $this->_tisFile->readInt(); + if ($tiVersion != (int)0xFFFFFFFE /* pre-2.1 format */ && + $tiVersion != (int)0xFFFFFFFD /* 2.1+ format */) { + throw new Zend_Search_Lucene_Exception('Wrong TermInfoFile file format'); + } + + $this->_termCount = + $this->_termNum = $this->_tisFile->readLong(); // Read terms count + $this->_indexInterval = $this->_tisFile->readInt(); // Read Index interval + $this->_skipInterval = $this->_tisFile->readInt(); // Read skip interval + if ($tiVersion == (int)0xFFFFFFFD /* 2.1+ format */) { + $maxSkipLevels = $this->_tisFile->readInt(); + } + + if ($this->_frqFile !== null) { + $this->_frqFile = null; + } + if ($this->_prxFile !== null) { + $this->_prxFile = null; + } + $this->_docMap = array(); + + $this->_lastTerm = new Zend_Search_Lucene_Index_Term('', -1); + $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo(0, 0, 0, 0); + $this->_lastTermPositions = null; + + $this->_termsScanMode = $mode; + + switch ($mode) { + case self::SM_TERMS_ONLY: + // Do nothing + break; + + case self::SM_FULL_INFO: + // break intentionally omitted + case self::SM_MERGE_INFO: + $this->_frqFile = $this->openCompoundFile('.frq', false); + $this->_frqFileOffset = $this->_frqFile->tell(); + + $this->_prxFile = $this->openCompoundFile('.prx', false); + $this->_prxFileOffset = $this->_prxFile->tell(); + + for ($count = 0; $count < $this->_docCount; $count++) { + if (!$this->isDeleted($count)) { + $this->_docMap[$count] = $startId + (($mode == self::SM_MERGE_INFO) ? count($this->_docMap) : $count); + } + } + break; + + default: + throw new Zend_Search_Lucene_Exception('Wrong terms scaning mode specified.'); + break; + } + + + $this->nextTerm(); + return $startId + (($mode == self::SM_MERGE_INFO) ? count($this->_docMap) : $this->_docCount); + } + + + /** + * Skip terms stream up to specified term preffix. + * + * Prefix contains fully specified field info and portion of searched term + * + * @param Zend_Search_Lucene_Index_Term $prefix + * @throws Zend_Search_Lucene_Exception + */ + public function skipTo(Zend_Search_Lucene_Index_Term $prefix) + { + if ($this->_termDictionary === null) { + $this->_loadDictionaryIndex(); + } + + $searchField = $this->getFieldNum($prefix->field); + + if ($searchField == -1) { + /** + * Field is not presented in this segment + * Go to the end of dictionary + */ + $this->_tisFile = null; + $this->_frqFile = null; + $this->_prxFile = null; + + $this->_lastTerm = null; + $this->_lastTermInfo = null; + $this->_lastTermPositions = null; + + return; + } + $searchDicField = $this->_getFieldPosition($searchField); + + // search for appropriate value in dictionary + $lowIndex = 0; + $highIndex = count($this->_termDictionary)-1; + while ($highIndex >= $lowIndex) { + // $mid = ($highIndex - $lowIndex)/2; + $mid = ($highIndex + $lowIndex) >> 1; + $midTerm = $this->_termDictionary[$mid]; + + $fieldNum = $this->_getFieldPosition($midTerm[0] /* field */); + $delta = $searchDicField - $fieldNum; + if ($delta == 0) { + $delta = strcmp($prefix->text, $midTerm[1] /* text */); + } + + if ($delta < 0) { + $highIndex = $mid-1; + } elseif ($delta > 0) { + $lowIndex = $mid+1; + } else { + // We have reached term we are looking for + break; + } + } + + if ($highIndex == -1) { + // Term is out of the dictionary range + $this->_tisFile = null; + $this->_frqFile = null; + $this->_prxFile = null; + + $this->_lastTerm = null; + $this->_lastTermInfo = null; + $this->_lastTermPositions = null; + + return; + } + + $prevPosition = $highIndex; + $prevTerm = $this->_termDictionary[$prevPosition]; + $prevTermInfo = $this->_termDictionaryInfos[$prevPosition]; + + if ($this->_tisFile === null) { + // The end of terms stream is reached and terms dictionary file is closed + // Perform mini-reset operation + $this->_tisFile = $this->openCompoundFile('.tis', false); + + if ($this->_termsScanMode == self::SM_FULL_INFO || $this->_termsScanMode == self::SM_MERGE_INFO) { + $this->_frqFile = $this->openCompoundFile('.frq', false); + $this->_prxFile = $this->openCompoundFile('.prx', false); + } + } + $this->_tisFile->seek($this->_tisFileOffset + $prevTermInfo[4], SEEK_SET); + + $this->_lastTerm = new Zend_Search_Lucene_Index_Term($prevTerm[1] /* text */, + ($prevTerm[0] == -1) ? '' : $this->_fields[$prevTerm[0] /* field */]->name); + $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo($prevTermInfo[0] /* docFreq */, + $prevTermInfo[1] /* freqPointer */, + $prevTermInfo[2] /* proxPointer */, + $prevTermInfo[3] /* skipOffset */); + $this->_termCount = $this->_termNum - $prevPosition*$this->_indexInterval; + + if ($highIndex == 0) { + // skip start entry + $this->nextTerm(); + } else if ($prefix->field == $this->_lastTerm->field && $prefix->text == $this->_lastTerm->text) { + // We got exact match in the dictionary index + + if ($this->_termsScanMode == self::SM_FULL_INFO || $this->_termsScanMode == self::SM_MERGE_INFO) { + $this->_lastTermPositions = array(); + + $this->_frqFile->seek($this->_lastTermInfo->freqPointer + $this->_frqFileOffset, SEEK_SET); + $freqs = array(); $docId = 0; + for( $count = 0; $count < $this->_lastTermInfo->docFreq; $count++ ) { + $docDelta = $this->_frqFile->readVInt(); + if( $docDelta % 2 == 1 ) { + $docId += ($docDelta-1)/2; + $freqs[ $docId ] = 1; + } else { + $docId += $docDelta/2; + $freqs[ $docId ] = $this->_frqFile->readVInt(); + } + } + + $this->_prxFile->seek($this->_lastTermInfo->proxPointer + $this->_prxFileOffset, SEEK_SET); + foreach ($freqs as $docId => $freq) { + $termPosition = 0; $positions = array(); + + for ($count = 0; $count < $freq; $count++ ) { + $termPosition += $this->_prxFile->readVInt(); + $positions[] = $termPosition; + } + + if (isset($this->_docMap[$docId])) { + $this->_lastTermPositions[$this->_docMap[$docId]] = $positions; + } + } + } + + return; + } + + // Search term matching specified prefix + while ($this->_lastTerm !== null) { + if ( strcmp($this->_lastTerm->field, $prefix->field) > 0 || + ($prefix->field == $this->_lastTerm->field && strcmp($this->_lastTerm->text, $prefix->text) >= 0) ) { + // Current term matches or greate than the pattern + return; + } + + $this->nextTerm(); + } + } + + + /** + * Scans terms dictionary and returns next term + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function nextTerm() + { + if ($this->_tisFile === null || $this->_termCount == 0) { + $this->_lastTerm = null; + $this->_lastTermInfo = null; + $this->_lastTermPositions = null; + $this->_docMap = null; + + // may be necessary for "empty" segment + $this->_tisFile = null; + $this->_frqFile = null; + $this->_prxFile = null; + + return null; + } + + $termPrefixLength = $this->_tisFile->readVInt(); + $termSuffix = $this->_tisFile->readString(); + $termFieldNum = $this->_tisFile->readVInt(); + $termValue = Zend_Search_Lucene_Index_Term::getPrefix($this->_lastTerm->text, $termPrefixLength) . $termSuffix; + + $this->_lastTerm = new Zend_Search_Lucene_Index_Term($termValue, $this->_fields[$termFieldNum]->name); + + $docFreq = $this->_tisFile->readVInt(); + $freqPointer = $this->_lastTermInfo->freqPointer + $this->_tisFile->readVInt(); + $proxPointer = $this->_lastTermInfo->proxPointer + $this->_tisFile->readVInt(); + if ($docFreq >= $this->_skipInterval) { + $skipOffset = $this->_tisFile->readVInt(); + } else { + $skipOffset = 0; + } + + $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo($docFreq, $freqPointer, $proxPointer, $skipOffset); + + + if ($this->_termsScanMode == self::SM_FULL_INFO || $this->_termsScanMode == self::SM_MERGE_INFO) { + $this->_lastTermPositions = array(); + + $this->_frqFile->seek($this->_lastTermInfo->freqPointer + $this->_frqFileOffset, SEEK_SET); + $freqs = array(); $docId = 0; + for( $count = 0; $count < $this->_lastTermInfo->docFreq; $count++ ) { + $docDelta = $this->_frqFile->readVInt(); + if( $docDelta % 2 == 1 ) { + $docId += ($docDelta-1)/2; + $freqs[ $docId ] = 1; + } else { + $docId += $docDelta/2; + $freqs[ $docId ] = $this->_frqFile->readVInt(); + } + } + + $this->_prxFile->seek($this->_lastTermInfo->proxPointer + $this->_prxFileOffset, SEEK_SET); + foreach ($freqs as $docId => $freq) { + $termPosition = 0; $positions = array(); + + for ($count = 0; $count < $freq; $count++ ) { + $termPosition += $this->_prxFile->readVInt(); + $positions[] = $termPosition; + } + + if (isset($this->_docMap[$docId])) { + $this->_lastTermPositions[$this->_docMap[$docId]] = $positions; + } + } + } + + $this->_termCount--; + if ($this->_termCount == 0) { + $this->_tisFile = null; + $this->_frqFile = null; + $this->_prxFile = null; + } + + return $this->_lastTerm; + } + + /** + * Close terms stream + * + * Should be used for resources clean up if stream is not read up to the end + */ + public function closeTermsStream() + { + $this->_tisFile = null; + $this->_frqFile = null; + $this->_prxFile = null; + + $this->_lastTerm = null; + $this->_lastTermInfo = null; + $this->_lastTermPositions = null; + + $this->_docMap = null; + } + + + /** + * Returns term in current position + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function currentTerm() + { + return $this->_lastTerm; + } + + + /** + * Returns an array of all term positions in the documents. + * Return array structure: array( docId => array( pos1, pos2, ...), ...) + * + * @return array + */ + public function currentTermPositions() + { + return $this->_lastTermPositions; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentInfoPriorityQueue.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentInfoPriorityQueue.php new file mode 100644 index 0000000000000000000000000000000000000000..e478bdbb3a78e674a48001b6e4cb271f281bcac3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentInfoPriorityQueue.php @@ -0,0 +1,53 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene */ +require_once 'Zend/Search/Lucene/PriorityQueue.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_SegmentInfoPriorityQueue extends Zend_Search_Lucene_PriorityQueue +{ + /** + * Compare elements + * + * Returns true, if $el1 is less than $el2; else otherwise + * + * @param mixed $segmentInfo1 + * @param mixed $segmentInfo2 + * @return boolean + */ + protected function _less($segmentInfo1, $segmentInfo2) + { + return strcmp($segmentInfo1->currentTerm()->key(), $segmentInfo2->currentTerm()->key()) < 0; + } + +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentMerger.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentMerger.php new file mode 100644 index 0000000000000000000000000000000000000000..6aa0a5627bc3bcabffdf9007ad5680f1df932e36 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentMerger.php @@ -0,0 +1,273 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Index_SegmentInfo */ +require_once 'Zend/Search/Lucene/Index/SegmentInfo.php'; + +/** Zend_Search_Lucene_Index_SegmentWriter_StreamWriter */ +require_once 'Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php'; + +/** Zend_Search_Lucene_Index_SegmentInfoPriorityQueue */ +require_once 'Zend/Search/Lucene/Index/SegmentInfoPriorityQueue.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_SegmentMerger +{ + /** + * Target segment writer + * + * @var Zend_Search_Lucene_Index_SegmentWriter_StreamWriter + */ + private $_writer; + + /** + * Number of docs in a new segment + * + * @var integer + */ + private $_docCount; + + /** + * A set of segments to be merged + * + * @var array Zend_Search_Lucene_Index_SegmentInfo + */ + private $_segmentInfos = array(); + + /** + * Flag to signal, that merge is already done + * + * @var boolean + */ + private $_mergeDone = false; + + /** + * Field map + * [<segment_name>][<field_number>] => <target_field_number> + * + * @var array + */ + private $_fieldsMap = array(); + + + + /** + * Object constructor. + * + * Creates new segment merger with $directory as target to merge segments into + * and $name as a name of new segment + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @param string $name + */ + public function __construct($directory, $name) + { + $this->_writer = new Zend_Search_Lucene_Index_SegmentWriter_StreamWriter($directory, $name); + } + + + /** + * Add segmnet to a collection of segments to be merged + * + * @param Zend_Search_Lucene_Index_SegmentInfo $segment + */ + public function addSource(Zend_Search_Lucene_Index_SegmentInfo $segmentInfo) + { + $this->_segmentInfos[$segmentInfo->getName()] = $segmentInfo; + } + + + /** + * Do merge. + * + * Returns number of documents in newly created segment + * + * @return Zend_Search_Lucene_Index_SegmentInfo + * @throws Zend_Search_Lucene_Exception + */ + public function merge() + { + if ($this->_mergeDone) { + throw new Zend_Search_Lucene_Exception('Merge is already done.'); + } + + if (count($this->_segmentInfos) < 1) { + throw new Zend_Search_Lucene_Exception('Wrong number of segments to be merged (' + . count($this->_segmentInfos) + . ').'); + } + + $this->_mergeFields(); + $this->_mergeNorms(); + $this->_mergeStoredFields(); + $this->_mergeTerms(); + + $this->_mergeDone = true; + + return $this->_writer->close(); + } + + + /** + * Merge fields information + */ + private function _mergeFields() + { + foreach ($this->_segmentInfos as $segName => $segmentInfo) { + foreach ($segmentInfo->getFieldInfos() as $fieldInfo) { + $this->_fieldsMap[$segName][$fieldInfo->number] = $this->_writer->addFieldInfo($fieldInfo); + } + } + } + + /** + * Merge field's normalization factors + */ + private function _mergeNorms() + { + foreach ($this->_writer->getFieldInfos() as $fieldInfo) { + if ($fieldInfo->isIndexed) { + foreach ($this->_segmentInfos as $segName => $segmentInfo) { + if ($segmentInfo->hasDeletions()) { + $srcNorm = $segmentInfo->normVector($fieldInfo->name); + $norm = ''; + $docs = $segmentInfo->count(); + for ($count = 0; $count < $docs; $count++) { + if (!$segmentInfo->isDeleted($count)) { + $norm .= $srcNorm[$count]; + } + } + $this->_writer->addNorm($fieldInfo->name, $norm); + } else { + $this->_writer->addNorm($fieldInfo->name, $segmentInfo->normVector($fieldInfo->name)); + } + } + } + } + } + + /** + * Merge fields information + */ + private function _mergeStoredFields() + { + $this->_docCount = 0; + + foreach ($this->_segmentInfos as $segName => $segmentInfo) { + $fdtFile = $segmentInfo->openCompoundFile('.fdt'); + + for ($count = 0; $count < $segmentInfo->count(); $count++) { + $fieldCount = $fdtFile->readVInt(); + $storedFields = array(); + + for ($count2 = 0; $count2 < $fieldCount; $count2++) { + $fieldNum = $fdtFile->readVInt(); + $bits = $fdtFile->readByte(); + $fieldInfo = $segmentInfo->getField($fieldNum); + + if (!($bits & 2)) { // Text data + $storedFields[] = + new Zend_Search_Lucene_Field($fieldInfo->name, + $fdtFile->readString(), + 'UTF-8', + true, + $fieldInfo->isIndexed, + $bits & 1 ); + } else { // Binary data + $storedFields[] = + new Zend_Search_Lucene_Field($fieldInfo->name, + $fdtFile->readBinary(), + '', + true, + $fieldInfo->isIndexed, + $bits & 1, + true); + } + } + + if (!$segmentInfo->isDeleted($count)) { + $this->_docCount++; + $this->_writer->addStoredFields($storedFields); + } + } + } + } + + + /** + * Merge fields information + */ + private function _mergeTerms() + { + $segmentInfoQueue = new Zend_Search_Lucene_Index_SegmentInfoPriorityQueue(); + + $segmentStartId = 0; + foreach ($this->_segmentInfos as $segName => $segmentInfo) { + $segmentStartId = $segmentInfo->reset($segmentStartId, Zend_Search_Lucene_Index_SegmentInfo::SM_MERGE_INFO); + + // Skip "empty" segments + if ($segmentInfo->currentTerm() !== null) { + $segmentInfoQueue->put($segmentInfo); + } + } + + $this->_writer->initializeDictionaryFiles(); + + $termDocs = array(); + while (($segmentInfo = $segmentInfoQueue->pop()) !== null) { + // Merge positions array + $termDocs += $segmentInfo->currentTermPositions(); + + if ($segmentInfoQueue->top() === null || + $segmentInfoQueue->top()->currentTerm()->key() != + $segmentInfo->currentTerm()->key()) { + // We got new term + ksort($termDocs, SORT_NUMERIC); + + // Add term if it's contained in any document + if (count($termDocs) > 0) { + $this->_writer->addTerm($segmentInfo->currentTerm(), $termDocs); + } + $termDocs = array(); + } + + $segmentInfo->nextTerm(); + // check, if segment dictionary is finished + if ($segmentInfo->currentTerm() !== null) { + // Put segment back into the priority queue + $segmentInfoQueue->put($segmentInfo); + } + } + + $this->_writer->closeDictionaryFiles(); + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter.php new file mode 100644 index 0000000000000000000000000000000000000000..5ad964985656315c04c28a463eb3f13dd04b28d1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter.php @@ -0,0 +1,631 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Index_SegmentInfo */ +require_once 'Zend/Search/Lucene/Index/SegmentInfo.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Index_SegmentWriter +{ + /** + * Expert: The fraction of terms in the "dictionary" which should be stored + * in RAM. Smaller values use more memory, but make searching slightly + * faster, while larger values use less memory and make searching slightly + * slower. Searching is typically not dominated by dictionary lookup, so + * tweaking this is rarely useful. + * + * @var integer + */ + public static $indexInterval = 128; + + /** + * Expert: The fraction of TermDocs entries stored in skip tables. + * Larger values result in smaller indexes, greater acceleration, but fewer + * accelerable cases, while smaller values result in bigger indexes, + * less acceleration and more + * accelerable cases. More detailed experiments would be useful here. + * + * 0x7FFFFFFF indicates that we don't use skip data + * + * Note: not used in current implementation + * + * @var integer + */ + public static $skipInterval = 0x7FFFFFFF; + + /** + * Expert: The maximum number of skip levels. Smaller values result in + * slightly smaller indexes, but slower skipping in big posting lists. + * + * 0 indicates that we don't use skip data + * + * Note: not used in current implementation + * + * @var integer + */ + public static $maxSkipLevels = 0; + + /** + * Number of docs in a segment + * + * @var integer + */ + protected $_docCount = 0; + + /** + * Segment name + * + * @var string + */ + protected $_name; + + /** + * File system adapter. + * + * @var Zend_Search_Lucene_Storage_Directory + */ + protected $_directory; + + /** + * List of the index files. + * Used for automatic compound file generation + * + * @var unknown_type + */ + protected $_files = array(); + + /** + * Segment fields. Array of Zend_Search_Lucene_Index_FieldInfo objects for this segment + * + * @var array + */ + protected $_fields = array(); + + /** + * Normalization factors. + * An array fieldName => normVector + * normVector is a binary string. + * Each byte corresponds to an indexed document in a segment and + * encodes normalization factor (float value, encoded by + * Zend_Search_Lucene_Search_Similarity::encodeNorm()) + * + * @var array + */ + protected $_norms = array(); + + + /** + * '.fdx' file - Stored Fields, the field index. + * + * @var Zend_Search_Lucene_Storage_File + */ + protected $_fdxFile = null; + + /** + * '.fdt' file - Stored Fields, the field data. + * + * @var Zend_Search_Lucene_Storage_File + */ + protected $_fdtFile = null; + + + /** + * Object constructor. + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @param string $name + */ + public function __construct(Zend_Search_Lucene_Storage_Directory $directory, $name) + { + $this->_directory = $directory; + $this->_name = $name; + } + + + /** + * Add field to the segment + * + * Returns actual field number + * + * @param Zend_Search_Lucene_Field $field + * @return integer + */ + public function addField(Zend_Search_Lucene_Field $field) + { + if (!isset($this->_fields[$field->name])) { + $fieldNumber = count($this->_fields); + $this->_fields[$field->name] = + new Zend_Search_Lucene_Index_FieldInfo($field->name, + $field->isIndexed, + $fieldNumber, + $field->storeTermVector); + + return $fieldNumber; + } else { + $this->_fields[$field->name]->isIndexed |= $field->isIndexed; + $this->_fields[$field->name]->storeTermVector |= $field->storeTermVector; + + return $this->_fields[$field->name]->number; + } + } + + /** + * Add fieldInfo to the segment + * + * Returns actual field number + * + * @param Zend_Search_Lucene_Index_FieldInfo $fieldInfo + * @return integer + */ + public function addFieldInfo(Zend_Search_Lucene_Index_FieldInfo $fieldInfo) + { + if (!isset($this->_fields[$fieldInfo->name])) { + $fieldNumber = count($this->_fields); + $this->_fields[$fieldInfo->name] = + new Zend_Search_Lucene_Index_FieldInfo($fieldInfo->name, + $fieldInfo->isIndexed, + $fieldNumber, + $fieldInfo->storeTermVector); + + return $fieldNumber; + } else { + $this->_fields[$fieldInfo->name]->isIndexed |= $fieldInfo->isIndexed; + $this->_fields[$fieldInfo->name]->storeTermVector |= $fieldInfo->storeTermVector; + + return $this->_fields[$fieldInfo->name]->number; + } + } + + /** + * Returns array of FieldInfo objects. + * + * @return array + */ + public function getFieldInfos() + { + return $this->_fields; + } + + /** + * Add stored fields information + * + * @param array $storedFields array of Zend_Search_Lucene_Field objects + */ + public function addStoredFields($storedFields) + { + if (!isset($this->_fdxFile)) { + $this->_fdxFile = $this->_directory->createFile($this->_name . '.fdx'); + $this->_fdtFile = $this->_directory->createFile($this->_name . '.fdt'); + + $this->_files[] = $this->_name . '.fdx'; + $this->_files[] = $this->_name . '.fdt'; + } + + $this->_fdxFile->writeLong($this->_fdtFile->tell()); + $this->_fdtFile->writeVInt(count($storedFields)); + foreach ($storedFields as $field) { + $this->_fdtFile->writeVInt($this->_fields[$field->name]->number); + $fieldBits = ($field->isTokenized ? 0x01 : 0x00) | + ($field->isBinary ? 0x02 : 0x00) | + 0x00; /* 0x04 - third bit, compressed (ZLIB) */ + $this->_fdtFile->writeByte($fieldBits); + if ($field->isBinary) { + $this->_fdtFile->writeVInt(strlen($field->value)); + $this->_fdtFile->writeBytes($field->value); + } else { + $this->_fdtFile->writeString($field->getUtf8Value()); + } + } + + $this->_docCount++; + } + + /** + * Returns the total number of documents in this segment. + * + * @return integer + */ + public function count() + { + return $this->_docCount; + } + + /** + * Return segment name + * + * @return string + */ + public function getName() + { + return $this->_name; + } + + /** + * Dump Field Info (.fnm) segment file + */ + protected function _dumpFNM() + { + $fnmFile = $this->_directory->createFile($this->_name . '.fnm'); + $fnmFile->writeVInt(count($this->_fields)); + + $nrmFile = $this->_directory->createFile($this->_name . '.nrm'); + // Write header + $nrmFile->writeBytes('NRM'); + // Write format specifier + $nrmFile->writeByte((int)0xFF); + + foreach ($this->_fields as $field) { + $fnmFile->writeString($field->name); + $fnmFile->writeByte(($field->isIndexed ? 0x01 : 0x00) | + ($field->storeTermVector ? 0x02 : 0x00) +// not supported yet 0x04 /* term positions are stored with the term vectors */ | +// not supported yet 0x08 /* term offsets are stored with the term vectors */ | + ); + + if ($field->isIndexed) { + // pre-2.1 index mode (not used now) + // $normFileName = $this->_name . '.f' . $field->number; + // $fFile = $this->_directory->createFile($normFileName); + // $fFile->writeBytes($this->_norms[$field->name]); + // $this->_files[] = $normFileName; + + $nrmFile->writeBytes($this->_norms[$field->name]); + } + } + + $this->_files[] = $this->_name . '.fnm'; + $this->_files[] = $this->_name . '.nrm'; + } + + + + /** + * Term Dictionary file + * + * @var Zend_Search_Lucene_Storage_File + */ + private $_tisFile = null; + + /** + * Term Dictionary index file + * + * @var Zend_Search_Lucene_Storage_File + */ + private $_tiiFile = null; + + /** + * Frequencies file + * + * @var Zend_Search_Lucene_Storage_File + */ + private $_frqFile = null; + + /** + * Positions file + * + * @var Zend_Search_Lucene_Storage_File + */ + private $_prxFile = null; + + /** + * Number of written terms + * + * @var integer + */ + private $_termCount; + + + /** + * Last saved term + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_prevTerm; + + /** + * Last saved term info + * + * @var Zend_Search_Lucene_Index_TermInfo + */ + private $_prevTermInfo; + + /** + * Last saved index term + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_prevIndexTerm; + + /** + * Last saved index term info + * + * @var Zend_Search_Lucene_Index_TermInfo + */ + private $_prevIndexTermInfo; + + /** + * Last term dictionary file position + * + * @var integer + */ + private $_lastIndexPosition; + + /** + * Create dicrionary, frequency and positions files and write necessary headers + */ + public function initializeDictionaryFiles() + { + $this->_tisFile = $this->_directory->createFile($this->_name . '.tis'); + $this->_tisFile->writeInt((int)0xFFFFFFFD); + $this->_tisFile->writeLong(0 /* dummy data for terms count */); + $this->_tisFile->writeInt(self::$indexInterval); + $this->_tisFile->writeInt(self::$skipInterval); + $this->_tisFile->writeInt(self::$maxSkipLevels); + + $this->_tiiFile = $this->_directory->createFile($this->_name . '.tii'); + $this->_tiiFile->writeInt((int)0xFFFFFFFD); + $this->_tiiFile->writeLong(0 /* dummy data for terms count */); + $this->_tiiFile->writeInt(self::$indexInterval); + $this->_tiiFile->writeInt(self::$skipInterval); + $this->_tiiFile->writeInt(self::$maxSkipLevels); + + /** Dump dictionary header */ + $this->_tiiFile->writeVInt(0); // preffix length + $this->_tiiFile->writeString(''); // suffix + $this->_tiiFile->writeInt((int)0xFFFFFFFF); // field number + $this->_tiiFile->writeByte((int)0x0F); + $this->_tiiFile->writeVInt(0); // DocFreq + $this->_tiiFile->writeVInt(0); // FreqDelta + $this->_tiiFile->writeVInt(0); // ProxDelta + $this->_tiiFile->writeVInt(24); // IndexDelta + + $this->_frqFile = $this->_directory->createFile($this->_name . '.frq'); + $this->_prxFile = $this->_directory->createFile($this->_name . '.prx'); + + $this->_files[] = $this->_name . '.tis'; + $this->_files[] = $this->_name . '.tii'; + $this->_files[] = $this->_name . '.frq'; + $this->_files[] = $this->_name . '.prx'; + + $this->_prevTerm = null; + $this->_prevTermInfo = null; + $this->_prevIndexTerm = null; + $this->_prevIndexTermInfo = null; + $this->_lastIndexPosition = 24; + $this->_termCount = 0; + + } + + /** + * Add term + * + * Term positions is an array( docId => array(pos1, pos2, pos3, ...), ... ) + * + * @param Zend_Search_Lucene_Index_Term $termEntry + * @param array $termDocs + */ + public function addTerm($termEntry, $termDocs) + { + $freqPointer = $this->_frqFile->tell(); + $proxPointer = $this->_prxFile->tell(); + + $prevDoc = 0; + foreach ($termDocs as $docId => $termPositions) { + $docDelta = ($docId - $prevDoc)*2; + $prevDoc = $docId; + if (count($termPositions) > 1) { + $this->_frqFile->writeVInt($docDelta); + $this->_frqFile->writeVInt(count($termPositions)); + } else { + $this->_frqFile->writeVInt($docDelta + 1); + } + + $prevPosition = 0; + foreach ($termPositions as $position) { + $this->_prxFile->writeVInt($position - $prevPosition); + $prevPosition = $position; + } + } + + if (count($termDocs) >= self::$skipInterval) { + /** + * @todo Write Skip Data to a freq file. + * It's not used now, but make index more optimal + */ + $skipOffset = $this->_frqFile->tell() - $freqPointer; + } else { + $skipOffset = 0; + } + + $term = new Zend_Search_Lucene_Index_Term($termEntry->text, + $this->_fields[$termEntry->field]->number); + $termInfo = new Zend_Search_Lucene_Index_TermInfo(count($termDocs), + $freqPointer, $proxPointer, $skipOffset); + + $this->_dumpTermDictEntry($this->_tisFile, $this->_prevTerm, $term, $this->_prevTermInfo, $termInfo); + + if (($this->_termCount + 1) % self::$indexInterval == 0) { + $this->_dumpTermDictEntry($this->_tiiFile, $this->_prevIndexTerm, $term, $this->_prevIndexTermInfo, $termInfo); + + $indexPosition = $this->_tisFile->tell(); + $this->_tiiFile->writeVInt($indexPosition - $this->_lastIndexPosition); + $this->_lastIndexPosition = $indexPosition; + + } + $this->_termCount++; + } + + /** + * Close dictionary + */ + public function closeDictionaryFiles() + { + $this->_tisFile->seek(4); + $this->_tisFile->writeLong($this->_termCount); + + $this->_tiiFile->seek(4); + // + 1 is used to count an additional special index entry (empty term at the start of the list) + $this->_tiiFile->writeLong(($this->_termCount - $this->_termCount % self::$indexInterval)/self::$indexInterval + 1); + } + + + /** + * Dump Term Dictionary segment file entry. + * Used to write entry to .tis or .tii files + * + * @param Zend_Search_Lucene_Storage_File $dicFile + * @param Zend_Search_Lucene_Index_Term $prevTerm + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_TermInfo $prevTermInfo + * @param Zend_Search_Lucene_Index_TermInfo $termInfo + */ + protected function _dumpTermDictEntry(Zend_Search_Lucene_Storage_File $dicFile, + &$prevTerm, Zend_Search_Lucene_Index_Term $term, + &$prevTermInfo, Zend_Search_Lucene_Index_TermInfo $termInfo) + { + if (isset($prevTerm) && $prevTerm->field == $term->field) { + $matchedBytes = 0; + $maxBytes = min(strlen($prevTerm->text), strlen($term->text)); + while ($matchedBytes < $maxBytes && + $prevTerm->text[$matchedBytes] == $term->text[$matchedBytes]) { + $matchedBytes++; + } + + // Calculate actual matched UTF-8 pattern + $prefixBytes = 0; + $prefixChars = 0; + while ($prefixBytes < $matchedBytes) { + $charBytes = 1; + if ((ord($term->text[$prefixBytes]) & 0xC0) == 0xC0) { + $charBytes++; + if (ord($term->text[$prefixBytes]) & 0x20 ) { + $charBytes++; + if (ord($term->text[$prefixBytes]) & 0x10 ) { + $charBytes++; + } + } + } + + if ($prefixBytes + $charBytes > $matchedBytes) { + // char crosses matched bytes boundary + // skip char + break; + } + + $prefixChars++; + $prefixBytes += $charBytes; + } + + // Write preffix length + $dicFile->writeVInt($prefixChars); + // Write suffix + $dicFile->writeString(substr($term->text, $prefixBytes)); + } else { + // Write preffix length + $dicFile->writeVInt(0); + // Write suffix + $dicFile->writeString($term->text); + } + // Write field number + $dicFile->writeVInt($term->field); + // DocFreq (the count of documents which contain the term) + $dicFile->writeVInt($termInfo->docFreq); + + $prevTerm = $term; + + if (!isset($prevTermInfo)) { + // Write FreqDelta + $dicFile->writeVInt($termInfo->freqPointer); + // Write ProxDelta + $dicFile->writeVInt($termInfo->proxPointer); + } else { + // Write FreqDelta + $dicFile->writeVInt($termInfo->freqPointer - $prevTermInfo->freqPointer); + // Write ProxDelta + $dicFile->writeVInt($termInfo->proxPointer - $prevTermInfo->proxPointer); + } + // Write SkipOffset - it's not 0 when $termInfo->docFreq > self::$skipInterval + if ($termInfo->skipOffset != 0) { + $dicFile->writeVInt($termInfo->skipOffset); + } + + $prevTermInfo = $termInfo; + } + + + /** + * Generate compound index file + */ + protected function _generateCFS() + { + $cfsFile = $this->_directory->createFile($this->_name . '.cfs'); + $cfsFile->writeVInt(count($this->_files)); + + $dataOffsetPointers = array(); + foreach ($this->_files as $fileName) { + $dataOffsetPointers[$fileName] = $cfsFile->tell(); + $cfsFile->writeLong(0); // write dummy data + $cfsFile->writeString($fileName); + } + + foreach ($this->_files as $fileName) { + // Get actual data offset + $dataOffset = $cfsFile->tell(); + // Seek to the data offset pointer + $cfsFile->seek($dataOffsetPointers[$fileName]); + // Write actual data offset value + $cfsFile->writeLong($dataOffset); + // Seek back to the end of file + $cfsFile->seek($dataOffset); + + $dataFile = $this->_directory->getFileObject($fileName); + + $byteCount = $this->_directory->fileLength($fileName); + while ($byteCount > 0) { + $data = $dataFile->readBytes(min($byteCount, 131072 /*128Kb*/)); + $byteCount -= strlen($data); + $cfsFile->writeBytes($data); + } + + $this->_directory->deleteFile($fileName); + } + } + + + /** + * Close segment, write it to disk and return segment info + * + * @return Zend_Search_Lucene_Index_SegmentInfo + */ + abstract public function close(); +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php new file mode 100644 index 0000000000000000000000000000000000000000..73eac8c7d18de89d095ccf88c99c22a69ccc1982 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php @@ -0,0 +1,217 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer.php'; + +/** Zend_Search_Lucene_Index_SegmentWriter */ +require_once 'Zend/Search/Lucene/Index/SegmentWriter.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter extends Zend_Search_Lucene_Index_SegmentWriter +{ + /** + * Term Dictionary + * Array of the Zend_Search_Lucene_Index_Term objects + * Corresponding Zend_Search_Lucene_Index_TermInfo object stored in the $_termDictionaryInfos + * + * @var array + */ + protected $_termDictionary; + + /** + * Documents, which contain the term + * + * @var array + */ + protected $_termDocs; + + /** + * Object constructor. + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @param string $name + */ + public function __construct(Zend_Search_Lucene_Storage_Directory $directory, $name) + { + parent::__construct($directory, $name); + + $this->_termDocs = array(); + $this->_termDictionary = array(); + } + + + /** + * Adds a document to this segment. + * + * @param Zend_Search_Lucene_Document $document + * @throws Zend_Search_Lucene_Exception + */ + public function addDocument(Zend_Search_Lucene_Document $document) + { + $storedFields = array(); + $docNorms = array(); + $similarity = Zend_Search_Lucene_Search_Similarity::getDefault(); + + foreach ($document->getFieldNames() as $fieldName) { + $field = $document->getField($fieldName); + $this->addField($field); + + if ($field->storeTermVector) { + /** + * @todo term vector storing support + */ + throw new Zend_Search_Lucene_Exception('Store term vector functionality is not supported yet.'); + } + + if ($field->isIndexed) { + if ($field->isTokenized) { + $analyzer = Zend_Search_Lucene_Analysis_Analyzer::getDefault(); + $analyzer->setInput($field->value, $field->encoding); + + $position = 0; + $tokenCounter = 0; + while (($token = $analyzer->nextToken()) !== null) { + $tokenCounter++; + + $term = new Zend_Search_Lucene_Index_Term($token->getTermText(), $field->name); + $termKey = $term->key(); + + if (!isset($this->_termDictionary[$termKey])) { + // New term + $this->_termDictionary[$termKey] = $term; + $this->_termDocs[$termKey] = array(); + $this->_termDocs[$termKey][$this->_docCount] = array(); + } else if (!isset($this->_termDocs[$termKey][$this->_docCount])) { + // Existing term, but new term entry + $this->_termDocs[$termKey][$this->_docCount] = array(); + } + $position += $token->getPositionIncrement(); + $this->_termDocs[$termKey][$this->_docCount][] = $position; + } + + $docNorms[$field->name] = chr($similarity->encodeNorm( $similarity->lengthNorm($field->name, + $tokenCounter)* + $document->boost* + $field->boost )); + } else { + $term = new Zend_Search_Lucene_Index_Term($field->getUtf8Value(), $field->name); + $termKey = $term->key(); + + if (!isset($this->_termDictionary[$termKey])) { + // New term + $this->_termDictionary[$termKey] = $term; + $this->_termDocs[$termKey] = array(); + $this->_termDocs[$termKey][$this->_docCount] = array(); + } else if (!isset($this->_termDocs[$termKey][$this->_docCount])) { + // Existing term, but new term entry + $this->_termDocs[$termKey][$this->_docCount] = array(); + } + $this->_termDocs[$termKey][$this->_docCount][] = 0; // position + + $docNorms[$field->name] = chr($similarity->encodeNorm( $similarity->lengthNorm($field->name, 1)* + $document->boost* + $field->boost )); + } + } + + if ($field->isStored) { + $storedFields[] = $field; + } + } + + + foreach ($this->_fields as $fieldName => $field) { + if (!$field->isIndexed) { + continue; + } + + if (!isset($this->_norms[$fieldName])) { + $this->_norms[$fieldName] = str_repeat(chr($similarity->encodeNorm( $similarity->lengthNorm($fieldName, 0) )), + $this->_docCount); + } + + if (isset($docNorms[$fieldName])){ + $this->_norms[$fieldName] .= $docNorms[$fieldName]; + } else { + $this->_norms[$fieldName] .= chr($similarity->encodeNorm( $similarity->lengthNorm($fieldName, 0) )); + } + } + + $this->addStoredFields($storedFields); + } + + + /** + * Dump Term Dictionary (.tis) and Term Dictionary Index (.tii) segment files + */ + protected function _dumpDictionary() + { + ksort($this->_termDictionary, SORT_STRING); + + $this->initializeDictionaryFiles(); + + foreach ($this->_termDictionary as $termId => $term) { + $this->addTerm($term, $this->_termDocs[$termId]); + } + + $this->closeDictionaryFiles(); + } + + + /** + * Close segment, write it to disk and return segment info + * + * @return Zend_Search_Lucene_Index_SegmentInfo + */ + public function close() + { + if ($this->_docCount == 0) { + return null; + } + + $this->_dumpFNM(); + $this->_dumpDictionary(); + + $this->_generateCFS(); + + return new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, + $this->_name, + $this->_docCount, + -1, + null, + true, + true); + } + +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php new file mode 100644 index 0000000000000000000000000000000000000000..5308bda911b98829b79ea4b29fee034df8a390bf --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php @@ -0,0 +1,98 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Index_SegmentInfo */ +require_once 'Zend/Search/Lucene/Index/SegmentInfo.php'; + +/** Zend_Search_Lucene_Index_SegmentWriter */ +require_once 'Zend/Search/Lucene/Index/SegmentWriter.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_SegmentWriter_StreamWriter extends Zend_Search_Lucene_Index_SegmentWriter +{ + /** + * Object constructor. + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @param string $name + */ + public function __construct(Zend_Search_Lucene_Storage_Directory $directory, $name) + { + parent::__construct($directory, $name); + } + + + /** + * Create stored fields files and open them for write + */ + public function createStoredFieldsFiles() + { + $this->_fdxFile = $this->_directory->createFile($this->_name . '.fdx'); + $this->_fdtFile = $this->_directory->createFile($this->_name . '.fdt'); + + $this->_files[] = $this->_name . '.fdx'; + $this->_files[] = $this->_name . '.fdt'; + } + + public function addNorm($fieldName, $normVector) + { + if (isset($this->_norms[$fieldName])) { + $this->_norms[$fieldName] .= $normVector; + } else { + $this->_norms[$fieldName] = $normVector; + } + } + + /** + * Close segment, write it to disk and return segment info + * + * @return Zend_Search_Lucene_Index_SegmentInfo + */ + public function close() + { + if ($this->_docCount == 0) { + return null; + } + + $this->_dumpFNM(); + $this->_generateCFS(); + + return new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, + $this->_name, + $this->_docCount, + -1, + null, + true, + true); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/Term.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/Term.php new file mode 100644 index 0000000000000000000000000000000000000000..00116a391479f8fd071d987f54ea4fb39847f52a --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/Term.php @@ -0,0 +1,143 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * A Term represents a word from text. This is the unit of search. It is + * composed of two elements, the text of the word, as a string, and the name of + * the field that the text occured in, an interned string. + * + * Note that terms may represent more than words from text fields, but also + * things like dates, email addresses, urls, etc. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_Term +{ + /** + * Field name or field number (depending from context) + * + * @var mixed + */ + public $field; + + /** + * Term value + * + * @var string + */ + public $text; + + + /** + * Object constructor + */ + public function __construct($text, $field = null) + { + $this->field = ($field === null)? Zend_Search_Lucene::getDefaultSearchField() : $field; + $this->text = $text; + } + + + /** + * Returns term key + * + * @return string + */ + public function key() + { + return $this->field . chr(0) . $this->text; + } + + /** + * Get term prefix + * + * @param string $str + * @param integer $length + * @return string + */ + public static function getPrefix($str, $length) + { + $prefixBytes = 0; + $prefixChars = 0; + while ($prefixBytes < strlen($str) && $prefixChars < $length) { + $charBytes = 1; + if ((ord($str[$prefixBytes]) & 0xC0) == 0xC0) { + $charBytes++; + if (ord($str[$prefixBytes]) & 0x20 ) { + $charBytes++; + if (ord($str[$prefixBytes]) & 0x10 ) { + $charBytes++; + } + } + } + + if ($prefixBytes + $charBytes > strlen($str)) { + // wrong character + break; + } + + $prefixChars++; + $prefixBytes += $charBytes; + } + + return substr($str, 0, $prefixBytes); + } + + /** + * Get UTF-8 string length + * + * @param string $str + * @return string + */ + public static function getLength($str) + { + $bytes = 0; + $chars = 0; + while ($bytes < strlen($str)) { + $charBytes = 1; + if ((ord($str[$bytes]) & 0xC0) == 0xC0) { + $charBytes++; + if (ord($str[$bytes]) & 0x20 ) { + $charBytes++; + if (ord($str[$bytes]) & 0x10 ) { + $charBytes++; + } + } + } + + if ($bytes + $charBytes > strlen($str)) { + // wrong character + break; + } + + $chars++; + $bytes += $charBytes; + } + + return $chars; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/TermInfo.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/TermInfo.php new file mode 100644 index 0000000000000000000000000000000000000000..6591f8d801896dd82611fa214227745c23a6d869 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/TermInfo.php @@ -0,0 +1,79 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * A Zend_Search_Lucene_Index_TermInfo represents a record of information stored for a term. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_TermInfo +{ + /** + * The number of documents which contain the term. + * + * @var integer + */ + public $docFreq; + + /** + * Data offset in a Frequencies file. + * + * @var integer + */ + public $freqPointer; + + /** + * Data offset in a Positions file. + * + * @var integer + */ + public $proxPointer; + + /** + * ScipData offset in a Frequencies file. + * + * @var integer + */ + public $skipOffset; + + /** + * Term offset of the _next_ term in a TermDictionary file. + * Used only for Term Index + * + * @var integer + */ + public $indexPointer; + + public function __construct($docFreq, $freqPointer, $proxPointer, $skipOffset, $indexPointer = null) + { + $this->docFreq = $docFreq; + $this->freqPointer = $freqPointer; + $this->proxPointer = $proxPointer; + $this->skipOffset = $skipOffset; + $this->indexPointer = $indexPointer; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/Writer.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/Writer.php new file mode 100644 index 0000000000000000000000000000000000000000..d739c48b1a04d774661468317a07483ba1b1cbc1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Index/Writer.php @@ -0,0 +1,879 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter */ +require_once 'Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php'; + +/** Zend_Search_Lucene_Index_SegmentInfo */ +require_once 'Zend/Search/Lucene/Index/SegmentInfo.php'; + +/** Zend_Search_Lucene_Index_SegmentMerger */ +require_once 'Zend/Search/Lucene/Index/SegmentMerger.php'; + +/** Zend_Search_Lucene_LockManager */ +require_once 'Zend/Search/Lucene/LockManager.php'; + + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Index + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Index_Writer +{ + /** + * @todo Implement Analyzer substitution + * @todo Implement Zend_Search_Lucene_Storage_DirectoryRAM and Zend_Search_Lucene_Storage_FileRAM to use it for + * temporary index files + * @todo Directory lock processing + */ + + /** + * Number of documents required before the buffered in-memory + * documents are written into a new Segment + * + * Default value is 10 + * + * @var integer + */ + public $maxBufferedDocs = 10; + + /** + * Largest number of documents ever merged by addDocument(). + * Small values (e.g., less than 10,000) are best for interactive indexing, + * as this limits the length of pauses while indexing to a few seconds. + * Larger values are best for batched indexing and speedier searches. + * + * Default value is PHP_INT_MAX + * + * @var integer + */ + public $maxMergeDocs = PHP_INT_MAX; + + /** + * Determines how often segment indices are merged by addDocument(). + * + * With smaller values, less RAM is used while indexing, + * and searches on unoptimized indices are faster, + * but indexing speed is slower. + * + * With larger values, more RAM is used during indexing, + * and while searches on unoptimized indices are slower, + * indexing is faster. + * + * Thus larger values (> 10) are best for batch index creation, + * and smaller values (< 10) for indices that are interactively maintained. + * + * Default value is 10 + * + * @var integer + */ + public $mergeFactor = 10; + + /** + * File system adapter. + * + * @var Zend_Search_Lucene_Storage_Directory + */ + private $_directory = null; + + + /** + * Changes counter. + * + * @var integer + */ + private $_versionUpdate = 0; + + /** + * List of the segments, created by index writer + * Array of Zend_Search_Lucene_Index_SegmentInfo objects + * + * @var array + */ + private $_newSegments = array(); + + /** + * List of segments to be deleted on commit + * + * @var array + */ + private $_segmentsToDelete = array(); + + /** + * Current segment to add documents + * + * @var Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter + */ + private $_currentSegment = null; + + /** + * Array of Zend_Search_Lucene_Index_SegmentInfo objects for this index. + * + * It's a reference to the corresponding Zend_Search_Lucene::$_segmentInfos array + * + * @var array Zend_Search_Lucene_Index_SegmentInfo + */ + private $_segmentInfos; + + /** + * Index target format version + * + * @var integer + */ + private $_targetFormatVersion; + + /** + * List of indexfiles extensions + * + * @var array + */ + private static $_indexExtensions = array('.cfs' => '.cfs', + '.cfx' => '.cfx', + '.fnm' => '.fnm', + '.fdx' => '.fdx', + '.fdt' => '.fdt', + '.tis' => '.tis', + '.tii' => '.tii', + '.frq' => '.frq', + '.prx' => '.prx', + '.tvx' => '.tvx', + '.tvd' => '.tvd', + '.tvf' => '.tvf', + '.del' => '.del', + '.sti' => '.sti' ); + + + /** + * Create empty index + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @param integer $generation + * @param integer $nameCount + */ + public static function createIndex(Zend_Search_Lucene_Storage_Directory $directory, $generation, $nameCount) + { + if ($generation == 0) { + // Create index in pre-2.1 mode + foreach ($directory->fileList() as $file) { + if ($file == 'deletable' || + $file == 'segments' || + isset(self::$_indexExtensions[ substr($file, strlen($file)-4)]) || + preg_match('/\.f\d+$/i', $file) /* matches <segment_name>.f<decimal_nmber> file names */) { + $directory->deleteFile($file); + } + } + + $segmentsFile = $directory->createFile('segments'); + $segmentsFile->writeInt((int)0xFFFFFFFF); + + // write version (is initialized by current time + // $segmentsFile->writeLong((int)microtime(true)); + $version = microtime(true); + $segmentsFile->writeInt((int)($version/((double)0xFFFFFFFF + 1))); + $segmentsFile->writeInt((int)($version & 0xFFFFFFFF)); + + // write name counter + $segmentsFile->writeInt($nameCount); + // write segment counter + $segmentsFile->writeInt(0); + + $deletableFile = $directory->createFile('deletable'); + // write counter + $deletableFile->writeInt(0); + } else { + $genFile = $directory->createFile('segments.gen'); + + $genFile->writeInt((int)0xFFFFFFFE); + // Write generation two times + $genFile->writeLong($generation); + $genFile->writeLong($generation); + + $segmentsFile = $directory->createFile(Zend_Search_Lucene::getSegmentFileName($generation)); + $segmentsFile->writeInt((int)0xFFFFFFFD); + + // write version (is initialized by current time + // $segmentsFile->writeLong((int)microtime(true)); + $version = microtime(true); + $segmentsFile->writeInt((int)($version/((double)0xFFFFFFFF + 1))); + $segmentsFile->writeInt((int)($version & 0xFFFFFFFF)); + + // write name counter + $segmentsFile->writeInt($nameCount); + // write segment counter + $segmentsFile->writeInt(0); + } + } + + /** + * Open the index for writing + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @param array $segmentInfos + * @param integer $targetFormatVersion + * @param Zend_Search_Lucene_Storage_File $cleanUpLock + */ + public function __construct(Zend_Search_Lucene_Storage_Directory $directory, &$segmentInfos, $targetFormatVersion) + { + $this->_directory = $directory; + $this->_segmentInfos = &$segmentInfos; + $this->_targetFormatVersion = $targetFormatVersion; + } + + /** + * Adds a document to this index. + * + * @param Zend_Search_Lucene_Document $document + */ + public function addDocument(Zend_Search_Lucene_Document $document) + { + if ($this->_currentSegment === null) { + $this->_currentSegment = + new Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter($this->_directory, $this->_newSegmentName()); + } + $this->_currentSegment->addDocument($document); + + if ($this->_currentSegment->count() >= $this->maxBufferedDocs) { + $this->commit(); + } + + $this->_maybeMergeSegments(); + + $this->_versionUpdate++; + } + + + /** + * Check if we have anything to merge + * + * @return boolean + */ + private function _hasAnythingToMerge() + { + $segmentSizes = array(); + foreach ($this->_segmentInfos as $segName => $segmentInfo) { + $segmentSizes[$segName] = $segmentInfo->count(); + } + + $mergePool = array(); + $poolSize = 0; + $sizeToMerge = $this->maxBufferedDocs; + asort($segmentSizes, SORT_NUMERIC); + foreach ($segmentSizes as $segName => $size) { + // Check, if segment comes into a new merging block + while ($size >= $sizeToMerge) { + // Merge previous block if it's large enough + if ($poolSize >= $sizeToMerge) { + return true; + } + $mergePool = array(); + $poolSize = 0; + + $sizeToMerge *= $this->mergeFactor; + + if ($sizeToMerge > $this->maxMergeDocs) { + return false; + } + } + + $mergePool[] = $this->_segmentInfos[$segName]; + $poolSize += $size; + } + + if ($poolSize >= $sizeToMerge) { + return true; + } + + return false; + } + + /** + * Merge segments if necessary + */ + private function _maybeMergeSegments() + { + if (Zend_Search_Lucene_LockManager::obtainOptimizationLock($this->_directory) === false) { + return; + } + + if (!$this->_hasAnythingToMerge()) { + Zend_Search_Lucene_LockManager::releaseOptimizationLock($this->_directory); + return; + } + + // Update segments list to be sure all segments are not merged yet by another process + // + // Segment merging functionality is concentrated in this class and surrounded + // by optimization lock obtaining/releasing. + // _updateSegments() refreshes segments list from the latest index generation. + // So only new segments can be added to the index while we are merging some already existing + // segments. + // Newly added segments will be also included into the index by the _updateSegments() call + // either by another process or by the current process with the commit() call at the end of _mergeSegments() method. + // That's guaranteed by the serialisation of _updateSegments() execution using exclusive locks. + $this->_updateSegments(); + + // Perform standard auto-optimization procedure + $segmentSizes = array(); + foreach ($this->_segmentInfos as $segName => $segmentInfo) { + $segmentSizes[$segName] = $segmentInfo->count(); + } + + $mergePool = array(); + $poolSize = 0; + $sizeToMerge = $this->maxBufferedDocs; + asort($segmentSizes, SORT_NUMERIC); + foreach ($segmentSizes as $segName => $size) { + // Check, if segment comes into a new merging block + while ($size >= $sizeToMerge) { + // Merge previous block if it's large enough + if ($poolSize >= $sizeToMerge) { + $this->_mergeSegments($mergePool); + } + $mergePool = array(); + $poolSize = 0; + + $sizeToMerge *= $this->mergeFactor; + + if ($sizeToMerge > $this->maxMergeDocs) { + Zend_Search_Lucene_LockManager::releaseOptimizationLock($this->_directory); + return; + } + } + + $mergePool[] = $this->_segmentInfos[$segName]; + $poolSize += $size; + } + + if ($poolSize >= $sizeToMerge) { + $this->_mergeSegments($mergePool); + } + + Zend_Search_Lucene_LockManager::releaseOptimizationLock($this->_directory); + } + + /** + * Merge specified segments + * + * $segments is an array of SegmentInfo objects + * + * @param array $segments + */ + private function _mergeSegments($segments) + { + $newName = $this->_newSegmentName(); + $merger = new Zend_Search_Lucene_Index_SegmentMerger($this->_directory, + $newName); + foreach ($segments as $segmentInfo) { + $merger->addSource($segmentInfo); + $this->_segmentsToDelete[$segmentInfo->getName()] = $segmentInfo->getName(); + } + + $newSegment = $merger->merge(); + if ($newSegment !== null) { + $this->_newSegments[$newSegment->getName()] = $newSegment; + } + + $this->commit(); + } + + /** + * Update segments file by adding current segment to a list + * + * @throws Zend_Search_Lucene_Exception + */ + private function _updateSegments() + { + // Get an exclusive index lock + Zend_Search_Lucene_LockManager::obtainWriteLock($this->_directory); + + // Write down changes for the segments + foreach ($this->_segmentInfos as $segInfo) { + $segInfo->writeChanges(); + } + + + $generation = Zend_Search_Lucene::getActualGeneration($this->_directory); + $segmentsFile = $this->_directory->getFileObject(Zend_Search_Lucene::getSegmentFileName($generation), false); + $newSegmentFile = $this->_directory->createFile(Zend_Search_Lucene::getSegmentFileName(++$generation), false); + + try { + $genFile = $this->_directory->getFileObject('segments.gen', false); + } catch (Zend_Search_Lucene_Exception $e) { + if (strpos($e->getMessage(), 'is not readable') !== false) { + $genFile = $this->_directory->createFile('segments.gen'); + } else { + throw $e; + } + } + + $genFile->writeInt((int)0xFFFFFFFE); + // Write generation (first copy) + $genFile->writeLong($generation); + + try { + // Write format marker + if ($this->_targetFormatVersion == Zend_Search_lucene::FORMAT_2_1) { + $newSegmentFile->writeInt((int)0xFFFFFFFD); + } else if ($this->_targetFormatVersion == Zend_Search_lucene::FORMAT_2_3) { + $newSegmentFile->writeInt((int)0xFFFFFFFC); + } + + // Read src file format identifier + $format = $segmentsFile->readInt(); + if ($format == (int)0xFFFFFFFF) { + $srcFormat = Zend_Search_Lucene::FORMAT_PRE_2_1; + } else if ($format == (int)0xFFFFFFFD) { + $srcFormat = Zend_Search_Lucene::FORMAT_2_1; + } else if ($format == (int)0xFFFFFFFC) { + $srcFormat = Zend_Search_Lucene::FORMAT_2_3; + } else { + throw new Zend_Search_Lucene_Exception('Unsupported segments file format'); + } + + // $version = $segmentsFile->readLong() + $this->_versionUpdate; + // Process version on 32-bit platforms + $versionHigh = $segmentsFile->readInt(); + $versionLow = $segmentsFile->readInt(); + $version = $versionHigh * ((double)0xFFFFFFFF + 1) + + (($versionLow < 0)? (double)0xFFFFFFFF - (-1 - $versionLow) : $versionLow); + $version += $this->_versionUpdate; + $this->_versionUpdate = 0; + $newSegmentFile->writeInt((int)($version/((double)0xFFFFFFFF + 1))); + $newSegmentFile->writeInt((int)($version & 0xFFFFFFFF)); + + // Write segment name counter + $newSegmentFile->writeInt($segmentsFile->readInt()); + + // Get number of segments offset + $numOfSegmentsOffset = $newSegmentFile->tell(); + // Write dummy data (segment counter) + $newSegmentFile->writeInt(0); + + // Read number of segemnts + $segmentsCount = $segmentsFile->readInt(); + + $segments = array(); + for ($count = 0; $count < $segmentsCount; $count++) { + $segName = $segmentsFile->readString(); + $segSize = $segmentsFile->readInt(); + + if ($srcFormat == Zend_Search_Lucene::FORMAT_PRE_2_1) { + // pre-2.1 index format + $delGenHigh = 0; + $delGenLow = 0; + $hasSingleNormFile = false; + $numField = (int)0xFFFFFFFF; + $isCompoundByte = 0; + $docStoreOptions = null; + } else { + //$delGen = $segmentsFile->readLong(); + $delGenHigh = $segmentsFile->readInt(); + $delGenLow = $segmentsFile->readInt(); + + if ($srcFormat == Zend_Search_Lucene::FORMAT_2_3) { + $docStoreOffset = $segmentsFile->readInt(); + + if ($docStoreOffset != -1) { + $docStoreSegment = $segmentsFile->readString(); + $docStoreIsCompoundFile = $segmentsFile->readByte(); + + $docStoreOptions = array('offset' => $docStoreOffset, + 'segment' => $docStoreSegment, + 'isCompound' => ($docStoreIsCompoundFile == 1)); + } else { + $docStoreOptions = null; + } + } else { + $docStoreOptions = null; + } + + $hasSingleNormFile = $segmentsFile->readByte(); + $numField = $segmentsFile->readInt(); + + $normGens = array(); + if ($numField != (int)0xFFFFFFFF) { + for ($count1 = 0; $count1 < $numField; $count1++) { + $normGens[] = $segmentsFile->readLong(); + } + } + $isCompoundByte = $segmentsFile->readByte(); + } + + if (!in_array($segName, $this->_segmentsToDelete)) { + // Load segment if necessary + if (!isset($this->_segmentInfos[$segName])) { + if (PHP_INT_SIZE > 4) { + // 64-bit system + $delGen = $delGenHigh << 32 | + $delGenLow; + } else { + $delGen = $delGenHigh * ((double)0xFFFFFFFF + 1) + + (($delGenLow < 0)? (double)0xFFFFFFFF - (-1 - $delGenLow) : $delGenLow); + } + if ($isCompoundByte == 0xFF) { + // The segment is not a compound file + $isCompound = false; + } else if ($isCompoundByte == 0x00) { + // The status is unknown + $isCompound = null; + } else if ($isCompoundByte == 0x01) { + // The segment is a compound file + $isCompound = true; + } + + $this->_segmentInfos[$segName] = + new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, + $segName, + $segSize, + $delGen, + $docStoreOptions, + $hasSingleNormFile, + $isCompound); + } else { + // Retrieve actual deletions file generation number + $delGen = $this->_segmentInfos[$segName]->getDelGen(); + + if ($delGen >= 0) { + if (PHP_INT_SIZE > 4) { + // 64-bit system + $delGenHigh = $delGen >> 32 & 0xFFFFFFFF; + $delGenLow = $delGen & 0xFFFFFFFF; + } else { + $delGenHigh = (int)($delGen/((double)0xFFFFFFFF + 1)); + $delGenLow =(int)($delGen & 0xFFFFFFFF); + } + } else { + $delGenHigh = $delGenLow = (int)0xFFFFFFFF; + } + } + + $newSegmentFile->writeString($segName); + $newSegmentFile->writeInt($segSize); + $newSegmentFile->writeInt($delGenHigh); + $newSegmentFile->writeInt($delGenLow); + if ($this->_targetFormatVersion == Zend_Search_Lucene::FORMAT_2_3) { + if ($docStoreOptions !== null) { + $newSegmentFile->writeInt($docStoreOffset); + $newSegmentFile->writeString($docStoreSegment); + $newSegmentFile->writeByte($docStoreIsCompoundFile); + } else { + // Set DocStoreOffset to -1 + $newSegmentFile->writeInt((int)0xFFFFFFFF); + } + } else if ($docStoreOptions !== null) { + // Release index write lock + Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); + + throw new Zend_Search_Lucene_Exception('Index conversion to lower format version is not supported.'); + } + + $newSegmentFile->writeByte($hasSingleNormFile); + $newSegmentFile->writeInt($numField); + if ($numField != (int)0xFFFFFFFF) { + foreach ($normGens as $normGen) { + $newSegmentFile->writeLong($normGen); + } + } + $newSegmentFile->writeByte($isCompoundByte); + + $segments[$segName] = $segSize; + } + } + $segmentsFile->close(); + + $segmentsCount = count($segments) + count($this->_newSegments); + + foreach ($this->_newSegments as $segName => $segmentInfo) { + $newSegmentFile->writeString($segName); + $newSegmentFile->writeInt($segmentInfo->count()); + + // delete file generation: -1 (there is no delete file yet) + $newSegmentFile->writeInt((int)0xFFFFFFFF);$newSegmentFile->writeInt((int)0xFFFFFFFF); + if ($this->_targetFormatVersion == Zend_Search_Lucene::FORMAT_2_3) { + // docStoreOffset: -1 (segment doesn't use shared doc store) + $newSegmentFile->writeInt((int)0xFFFFFFFF); + } + // HasSingleNormFile + $newSegmentFile->writeByte($segmentInfo->hasSingleNormFile()); + // NumField + $newSegmentFile->writeInt((int)0xFFFFFFFF); + // IsCompoundFile + $newSegmentFile->writeByte($segmentInfo->isCompound() ? 1 : -1); + + $segments[$segmentInfo->getName()] = $segmentInfo->count(); + $this->_segmentInfos[$segName] = $segmentInfo; + } + $this->_newSegments = array(); + + $newSegmentFile->seek($numOfSegmentsOffset); + $newSegmentFile->writeInt($segmentsCount); // Update segments count + $newSegmentFile->close(); + } catch (Exception $e) { + /** Restore previous index generation */ + $generation--; + $genFile->seek(4, SEEK_SET); + // Write generation number twice + $genFile->writeLong($generation); $genFile->writeLong($generation); + + // Release index write lock + Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); + + // Throw the exception + throw $e; + } + + // Write generation (second copy) + $genFile->writeLong($generation); + + + // Check if another update or read process is not running now + // If yes, skip clean-up procedure + if (Zend_Search_Lucene_LockManager::escalateReadLock($this->_directory)) { + /** + * Clean-up directory + */ + $filesToDelete = array(); + $filesTypes = array(); + $filesNumbers = array(); + + // list of .del files of currently used segments + // each segment can have several generations of .del files + // only last should not be deleted + $delFiles = array(); + + foreach ($this->_directory->fileList() as $file) { + if ($file == 'deletable') { + // 'deletable' file + $filesToDelete[] = $file; + $filesTypes[] = 0; // delete this file first, since it's not used starting from Lucene v2.1 + $filesNumbers[] = 0; + } else if ($file == 'segments') { + // 'segments' file + $filesToDelete[] = $file; + $filesTypes[] = 1; // second file to be deleted "zero" version of segments file (Lucene pre-2.1) + $filesNumbers[] = 0; + } else if (preg_match('/^segments_[a-zA-Z0-9]+$/i', $file)) { + // 'segments_xxx' file + // Check if it's not a just created generation file + if ($file != Zend_Search_Lucene::getSegmentFileName($generation)) { + $filesToDelete[] = $file; + $filesTypes[] = 2; // first group of files for deletions + $filesNumbers[] = (int)base_convert(substr($file, 9), 36, 10); // ordered by segment generation numbers + } + } else if (preg_match('/(^_([a-zA-Z0-9]+))\.f\d+$/i', $file, $matches)) { + // one of per segment files ('<segment_name>.f<decimal_number>') + // Check if it's not one of the segments in the current segments set + if (!isset($segments[$matches[1]])) { + $filesToDelete[] = $file; + $filesTypes[] = 3; // second group of files for deletions + $filesNumbers[] = (int)base_convert($matches[2], 36, 10); // order by segment number + } + } else if (preg_match('/(^_([a-zA-Z0-9]+))(_([a-zA-Z0-9]+))\.del$/i', $file, $matches)) { + // one of per segment files ('<segment_name>_<del_generation>.del' where <segment_name> is '_<segment_number>') + // Check if it's not one of the segments in the current segments set + if (!isset($segments[$matches[1]])) { + $filesToDelete[] = $file; + $filesTypes[] = 3; // second group of files for deletions + $filesNumbers[] = (int)base_convert($matches[2], 36, 10); // order by segment number + } else { + $segmentNumber = (int)base_convert($matches[2], 36, 10); + $delGeneration = (int)base_convert($matches[4], 36, 10); + if (!isset($delFiles[$segmentNumber])) { + $delFiles[$segmentNumber] = array(); + } + $delFiles[$segmentNumber][$delGeneration] = $file; + } + } else if (isset(self::$_indexExtensions[substr($file, strlen($file)-4)])) { + // one of per segment files ('<segment_name>.<ext>') + $segmentName = substr($file, 0, strlen($file) - 4); + // Check if it's not one of the segments in the current segments set + if (!isset($segments[$segmentName]) && + ($this->_currentSegment === null || $this->_currentSegment->getName() != $segmentName)) { + $filesToDelete[] = $file; + $filesTypes[] = 3; // second group of files for deletions + $filesNumbers[] = (int)base_convert(substr($file, 1 /* skip '_' */, strlen($file)-5), 36, 10); // order by segment number + } + } + } + + $maxGenNumber = 0; + // process .del files of currently used segments + foreach ($delFiles as $segmentNumber => $segmentDelFiles) { + ksort($delFiles[$segmentNumber], SORT_NUMERIC); + array_pop($delFiles[$segmentNumber]); // remove last delete file generation from candidates for deleting + + end($delFiles[$segmentNumber]); + $lastGenNumber = key($delFiles[$segmentNumber]); + if ($lastGenNumber > $maxGenNumber) { + $maxGenNumber = $lastGenNumber; + } + } + foreach ($delFiles as $segmentNumber => $segmentDelFiles) { + foreach ($segmentDelFiles as $delGeneration => $file) { + $filesToDelete[] = $file; + $filesTypes[] = 4; // third group of files for deletions + $filesNumbers[] = $segmentNumber*$maxGenNumber + $delGeneration; // order by <segment_number>,<del_generation> pair + } + } + + // Reorder files for deleting + array_multisort($filesTypes, SORT_ASC, SORT_NUMERIC, + $filesNumbers, SORT_ASC, SORT_NUMERIC, + $filesToDelete, SORT_ASC, SORT_STRING); + + foreach ($filesToDelete as $file) { + try { + /** Skip shared docstore segments deleting */ + /** @todo Process '.cfx' files to check if them are already unused */ + if (substr($file, strlen($file)-4) != '.cfx') { + $this->_directory->deleteFile($file); + } + } catch (Zend_Search_Lucene_Exception $e) { + if (strpos($e->getMessage(), 'Can\'t delete file') === false) { + // That's not "file is under processing or already deleted" exception + // Pass it through + throw $e; + } + } + } + + // Return read lock into the previous state + Zend_Search_Lucene_LockManager::deEscalateReadLock($this->_directory); + } else { + // Only release resources if another index reader is running now + foreach ($this->_segmentsToDelete as $segName) { + foreach (self::$_indexExtensions as $ext) { + $this->_directory->purgeFile($segName . $ext); + } + } + } + + // Clean-up _segmentsToDelete container + $this->_segmentsToDelete = array(); + + + // Release index write lock + Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); + + // Remove unused segments from segments list + foreach ($this->_segmentInfos as $segName => $segmentInfo) { + if (!isset($segments[$segName])) { + unset($this->_segmentInfos[$segName]); + } + } + } + + /** + * Commit current changes + */ + public function commit() + { + if ($this->_currentSegment !== null) { + $newSegment = $this->_currentSegment->close(); + if ($newSegment !== null) { + $this->_newSegments[$newSegment->getName()] = $newSegment; + } + $this->_currentSegment = null; + } + + $this->_updateSegments(); + } + + + /** + * Merges the provided indexes into this index. + * + * @param array $readers + * @return void + */ + public function addIndexes($readers) + { + /** + * @todo implementation + */ + } + + /** + * Merges all segments together into new one + * + * Returns true on success and false if another optimization or auto-optimization process + * is running now + * + * @return boolean + */ + public function optimize() + { + if (Zend_Search_Lucene_LockManager::obtainOptimizationLock($this->_directory) === false) { + return false; + } + + // Update segments list to be sure all segments are not merged yet by another process + // + // Segment merging functionality is concentrated in this class and surrounded + // by optimization lock obtaining/releasing. + // _updateSegments() refreshes segments list from the latest index generation. + // So only new segments can be added to the index while we are merging some already existing + // segments. + // Newly added segments will be also included into the index by the _updateSegments() call + // either by another process or by the current process with the commit() call at the end of _mergeSegments() method. + // That's guaranteed by the serialisation of _updateSegments() execution using exclusive locks. + $this->_updateSegments(); + + $this->_mergeSegments($this->_segmentInfos); + + Zend_Search_Lucene_LockManager::releaseOptimizationLock($this->_directory); + + return true; + } + + /** + * Get name for new segment + * + * @return string + */ + private function _newSegmentName() + { + Zend_Search_Lucene_LockManager::obtainWriteLock($this->_directory); + + $generation = Zend_Search_Lucene::getActualGeneration($this->_directory); + $segmentsFile = $this->_directory->getFileObject(Zend_Search_Lucene::getSegmentFileName($generation), false); + + $segmentsFile->seek(12); // 12 = 4 (int, file format marker) + 8 (long, index version) + $segmentNameCounter = $segmentsFile->readInt(); + + $segmentsFile->seek(12); // 12 = 4 (int, file format marker) + 8 (long, index version) + $segmentsFile->writeInt($segmentNameCounter + 1); + + // Flash output to guarantee that wrong value will not be loaded between unlock and + // return (which calls $segmentsFile destructor) + $segmentsFile->flush(); + + Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); + + return '_' . base_convert($segmentNameCounter, 10, 36); + } + +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Interface.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Interface.php new file mode 100644 index 0000000000000000000000000000000000000000..a5e08d36092fcb93744e381d92433c6d0fd66c17 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Interface.php @@ -0,0 +1,437 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +interface Zend_Search_Lucene_Interface +{ + /** + * Get current generation number + * + * Returns generation number + * 0 means pre-2.1 index format + * -1 means there are no segments files. + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @return integer + * @throws Zend_Search_Lucene_Exception + */ + public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory); + + /** + * Get segments file name + * + * @param integer $generation + * @return string + */ + public static function getSegmentFileName($generation); + + /** + * Get index format version + * + * @return integer + */ + public function getFormatVersion(); + + /** + * Set index format version. + * Index is converted to this format at the nearest upfdate time + * + * @param int $formatVersion + * @throws Zend_Search_Lucene_Exception + */ + public function setFormatVersion($formatVersion); + + /** + * Returns the Zend_Search_Lucene_Storage_Directory instance for this index. + * + * @return Zend_Search_Lucene_Storage_Directory + */ + public function getDirectory(); + + /** + * Returns the total number of documents in this index (including deleted documents). + * + * @return integer + */ + public function count(); + + /** + * Returns one greater than the largest possible document number. + * This may be used to, e.g., determine how big to allocate a structure which will have + * an element for every document number in an index. + * + * @return integer + */ + public function maxDoc(); + + /** + * Returns the total number of non-deleted documents in this index. + * + * @return integer + */ + public function numDocs(); + + /** + * Checks, that document is deleted + * + * @param integer $id + * @return boolean + * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range + */ + public function isDeleted($id); + + /** + * Set default search field. + * + * Null means, that search is performed through all fields by default + * + * Default value is null + * + * @param string $fieldName + */ + public static function setDefaultSearchField($fieldName); + + /** + * Get default search field. + * + * Null means, that search is performed through all fields by default + * + * @return string + */ + public static function getDefaultSearchField(); + + /** + * Set result set limit. + * + * 0 (default) means no limit + * + * @param integer $limit + */ + public static function setResultSetLimit($limit); + + /** + * Set result set limit. + * + * 0 means no limit + * + * @return integer + */ + public static function getResultSetLimit(); + + /** + * Retrieve index maxBufferedDocs option + * + * maxBufferedDocs is a minimal number of documents required before + * the buffered in-memory documents are written into a new Segment + * + * Default value is 10 + * + * @return integer + */ + public function getMaxBufferedDocs(); + + /** + * Set index maxBufferedDocs option + * + * maxBufferedDocs is a minimal number of documents required before + * the buffered in-memory documents are written into a new Segment + * + * Default value is 10 + * + * @param integer $maxBufferedDocs + */ + public function setMaxBufferedDocs($maxBufferedDocs); + + /** + * Retrieve index maxMergeDocs option + * + * maxMergeDocs is a largest number of documents ever merged by addDocument(). + * Small values (e.g., less than 10,000) are best for interactive indexing, + * as this limits the length of pauses while indexing to a few seconds. + * Larger values are best for batched indexing and speedier searches. + * + * Default value is PHP_INT_MAX + * + * @return integer + */ + public function getMaxMergeDocs(); + + /** + * Set index maxMergeDocs option + * + * maxMergeDocs is a largest number of documents ever merged by addDocument(). + * Small values (e.g., less than 10,000) are best for interactive indexing, + * as this limits the length of pauses while indexing to a few seconds. + * Larger values are best for batched indexing and speedier searches. + * + * Default value is PHP_INT_MAX + * + * @param integer $maxMergeDocs + */ + public function setMaxMergeDocs($maxMergeDocs); + + /** + * Retrieve index mergeFactor option + * + * mergeFactor determines how often segment indices are merged by addDocument(). + * With smaller values, less RAM is used while indexing, + * and searches on unoptimized indices are faster, + * but indexing speed is slower. + * With larger values, more RAM is used during indexing, + * and while searches on unoptimized indices are slower, + * indexing is faster. + * Thus larger values (> 10) are best for batch index creation, + * and smaller values (< 10) for indices that are interactively maintained. + * + * Default value is 10 + * + * @return integer + */ + public function getMergeFactor(); + + /** + * Set index mergeFactor option + * + * mergeFactor determines how often segment indices are merged by addDocument(). + * With smaller values, less RAM is used while indexing, + * and searches on unoptimized indices are faster, + * but indexing speed is slower. + * With larger values, more RAM is used during indexing, + * and while searches on unoptimized indices are slower, + * indexing is faster. + * Thus larger values (> 10) are best for batch index creation, + * and smaller values (< 10) for indices that are interactively maintained. + * + * Default value is 10 + * + * @param integer $maxMergeDocs + */ + public function setMergeFactor($mergeFactor); + + /** + * Performs a query against the index and returns an array + * of Zend_Search_Lucene_Search_QueryHit objects. + * Input is a string or Zend_Search_Lucene_Search_Query. + * + * @param mixed $query + * @return array Zend_Search_Lucene_Search_QueryHit + * @throws Zend_Search_Lucene_Exception + */ + public function find($query); + + /** + * Returns a list of all unique field names that exist in this index. + * + * @param boolean $indexed + * @return array + */ + public function getFieldNames($indexed = false); + + /** + * Returns a Zend_Search_Lucene_Document object for the document + * number $id in this index. + * + * @param integer|Zend_Search_Lucene_Search_QueryHit $id + * @return Zend_Search_Lucene_Document + */ + public function getDocument($id); + + /** + * Returns true if index contain documents with specified term. + * + * Is used for query optimization. + * + * @param Zend_Search_Lucene_Index_Term $term + * @return boolean + */ + public function hasTerm(Zend_Search_Lucene_Index_Term $term); + + /** + * Returns IDs of all the documents containing term. + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return array + */ + public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null); + + /** + * Returns documents filter for all documents containing term. + * + * It performs the same operation as termDocs, but return result as + * Zend_Search_Lucene_Index_DocsFilter object + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return Zend_Search_Lucene_Index_DocsFilter + */ + public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null); + + /** + * Returns an array of all term freqs. + * Return array structure: array( docId => freq, ...) + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return integer + */ + public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null); + + /** + * Returns an array of all term positions in the documents. + * Return array structure: array( docId => array( pos1, pos2, ...), ...) + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return array + */ + public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null); + + /** + * Returns the number of documents in this index containing the $term. + * + * @param Zend_Search_Lucene_Index_Term $term + * @return integer + */ + public function docFreq(Zend_Search_Lucene_Index_Term $term); + + /** + * Retrive similarity used by index reader + * + * @return Zend_Search_Lucene_Search_Similarity + */ + public function getSimilarity(); + + /** + * Returns a normalization factor for "field, document" pair. + * + * @param integer $id + * @param string $fieldName + * @return float + */ + public function norm($id, $fieldName); + + /** + * Returns true if any documents have been deleted from this index. + * + * @return boolean + */ + public function hasDeletions(); + + /** + * Deletes a document from the index. + * $id is an internal document id + * + * @param integer|Zend_Search_Lucene_Search_QueryHit $id + * @throws Zend_Search_Lucene_Exception + */ + public function delete($id); + + /** + * Adds a document to this index. + * + * @param Zend_Search_Lucene_Document $document + */ + public function addDocument(Zend_Search_Lucene_Document $document); + + /** + * Commit changes resulting from delete() or undeleteAll() operations. + */ + public function commit(); + + /** + * Optimize index. + * + * Merges all segments into one + */ + public function optimize(); + + /** + * Returns an array of all terms in this index. + * + * @return array + */ + public function terms(); + + + /** + * Reset terms stream. + */ + public function resetTermsStream(); + + /** + * Skip terms stream up to specified term preffix. + * + * Prefix contains fully specified field info and portion of searched term + * + * @param Zend_Search_Lucene_Index_Term $prefix + */ + public function skipTo(Zend_Search_Lucene_Index_Term $prefix); + + /** + * Scans terms dictionary and returns next term + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function nextTerm(); + + /** + * Returns term in current position + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function currentTerm(); + + /** + * Close terms stream + * + * Should be used for resources clean up if stream is not read up to the end + */ + public function closeTermsStream(); + + + /** + * Undeletes all documents currently marked as deleted in this index. + */ + public function undeleteAll(); + + + /** + * Add reference to the index object + * + * @internal + */ + public function addReference(); + + /** + * Remove reference from the index object + * + * When reference count becomes zero, index is closed and resources are cleaned up + * + * @internal + */ + public function removeReference(); +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/LockManager.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/LockManager.php new file mode 100644 index 0000000000000000000000000000000000000000..361144311c4d5f9bcbfc0dd4e93da540e85f4ecf --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/LockManager.php @@ -0,0 +1,240 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Storage_Directory */ +require_once 'Zend/Search/Lucene/Storage/Directory.php'; + +/** Zend_Search_Lucene_Storage_File */ +require_once 'Zend/Search/Lucene/Storage/File.php'; + + + +/** + * This is an utility class which provides index locks processing functionality + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_LockManager +{ + /** + * consts for name of file to show lock status + */ + const WRITE_LOCK_FILE = 'write.lock.file'; + const READ_LOCK_FILE = 'read.lock.file'; + const READ_LOCK_PROCESSING_LOCK_FILE = 'read-lock-processing.lock.file'; + const OPTIMIZATION_LOCK_FILE = 'optimization.lock.file'; + + /** + * Obtain exclusive write lock on the index + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + * @return Zend_Search_Lucene_Storage_File + * @throws Zend_Search_Lucene_Exception + */ + public static function obtainWriteLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->createFile(self::WRITE_LOCK_FILE); + if (!$lock->lock(LOCK_EX)) { + throw new Zend_Search_Lucene_Exception('Can\'t obtain exclusive index lock'); + } + return $lock; + } + + /** + * Release exclusive write lock + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + */ + public static function releaseWriteLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->getFileObject(self::WRITE_LOCK_FILE); + $lock->unlock(); + } + + /** + * Obtain the exclusive "read escalation/de-escalation" lock + * + * Required to protect the escalate/de-escalate read lock process + * on GFS (and potentially other) mounted filesystems. + * + * Why we need this: + * While GFS supports cluster-wide locking via flock(), it's + * implementation isn't quite what it should be. The locking + * semantics that work consistently on a local filesystem tend to + * fail on GFS mounted filesystems. This appears to be a design defect + * in the implementation of GFS. How this manifests itself is that + * conditional promotion of a shared lock to exclusive will always + * fail, lock release requests are honored but not immediately + * processed (causing erratic failures of subsequent conditional + * requests) and the releasing of the exclusive lock before the + * shared lock is set when a lock is demoted (which can open a window + * of opportunity for another process to gain an exclusive lock when + * it shoudln't be allowed to). + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + * @return Zend_Search_Lucene_Storage_File + * @throws Zend_Search_Lucene_Exception + */ + + private static function _startReadLockProcessing(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->createFile(self::READ_LOCK_PROCESSING_LOCK_FILE); + if (!$lock->lock(LOCK_EX)) { + throw new Zend_Search_Lucene_Exception('Can\'t obtain exclusive lock for the read lock processing file'); + } + return $lock; + } + + /** + * Release the exclusive "read escalation/de-escalation" lock + * + * Required to protect the escalate/de-escalate read lock process + * on GFS (and potentially other) mounted filesystems. + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + */ + private static function _stopReadLockProcessing(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->getFileObject(self::READ_LOCK_PROCESSING_LOCK_FILE); + $lock->unlock(); + } + + + /** + * Obtain shared read lock on the index + * + * It doesn't block other read or update processes, but prevent index from the premature cleaning-up + * + * @param Zend_Search_Lucene_Storage_Directory $defaultLockDirectory + * @return Zend_Search_Lucene_Storage_File + * @throws Zend_Search_Lucene_Exception + */ + public static function obtainReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->createFile(self::READ_LOCK_FILE); + if (!$lock->lock(LOCK_SH)) { + self::_stopReadLockProcessing($lockDirectory); + throw new Zend_Search_Lucene_Exception('Can\'t obtain shared reading index lock'); + } + return $lock; + } + + /** + * Release shared read lock + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + */ + public static function releaseReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->getFileObject(self::READ_LOCK_FILE); + $lock->unlock(); + } + + /** + * Escalate Read lock to exclusive level + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + * @return boolean + */ + public static function escalateReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + self::_startReadLockProcessing($lockDirectory); + + $lock = $lockDirectory->getFileObject(self::READ_LOCK_FILE); + + // First, release the shared lock for the benefit of GFS since + // it will fail the conditional request to promote the lock to + // "exclusive" while the shared lock is held (even when we are + // the only holder). + $lock->unlock(); + + // GFS is really poor. While the above "unlock" returns, GFS + // doesn't clean up it's tables right away (which will potentially + // cause the conditional locking for the "exclusive" lock to fail. + // We will retry the conditional lock request several times on a + // failure to get past this. The performance hit is negligible + // in the grand scheme of things and only will occur with GFS + // filesystems or if another local process has the shared lock + // on local filesystems. + for ($retries = 0; $retries < 10; $retries++) { + if ($lock->lock(LOCK_EX, true)) { + // Exclusive lock is obtained! + self::_stopReadLockProcessing($lockDirectory); + return true; + } + + // wait 1 microsecond + usleep(1); + } + + // Restore lock state + $lock->lock(LOCK_SH); + + self::_stopReadLockProcessing($lockDirectory); + return false; + } + + /** + * De-escalate Read lock to shared level + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + */ + public static function deEscalateReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->getFileObject(self::READ_LOCK_FILE); + $lock->lock(LOCK_SH); + } + + /** + * Obtain exclusive optimization lock on the index + * + * Returns lock object on success and false otherwise (doesn't block execution) + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + * @return mixed + */ + public static function obtainOptimizationLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->createFile(self::OPTIMIZATION_LOCK_FILE); + if (!$lock->lock(LOCK_EX, true)) { + return false; + } + return $lock; + } + + /** + * Release exclusive optimization lock + * + * @param Zend_Search_Lucene_Storage_Directory $lockDirectory + */ + public static function releaseOptimizationLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) + { + $lock = $lockDirectory->getFileObject(self::OPTIMIZATION_LOCK_FILE); + $lock->unlock(); + } + +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/PriorityQueue.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/PriorityQueue.php new file mode 100644 index 0000000000000000000000000000000000000000..42c0b9ab67a35f0cd760422ab26415faae7ea490 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/PriorityQueue.php @@ -0,0 +1,170 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * Abstract Priority Queue + * + * It implements a priority queue. + * Please go to "Data Structures and Algorithms", + * Aho, Hopcroft, and Ullman, Addison-Wesley, 1983 (corrected 1987 edition), + * for implementation details. + * + * It provides O(log(N)) time of put/pop operations, where N is a size of queue + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_PriorityQueue +{ + /** + * Queue heap + * + * Heap contains balanced partial ordered binary tree represented in array + * [0] - top of the tree + * [1] - first child of [0] + * [2] - second child of [0] + * ... + * [2*n + 1] - first child of [n] + * [2*n + 2] - second child of [n] + * + * @var array + */ + private $_heap = array(); + + + /** + * Add element to the queue + * + * O(log(N)) time + * + * @param mixed $element + */ + public function put($element) + { + $nodeId = count($this->_heap); + $parentId = ($nodeId-1) >> 1; // floor( ($nodeId-1)/2 ) + + while ($nodeId != 0 && $this->_less($element, $this->_heap[$parentId])) { + // Move parent node down + $this->_heap[$nodeId] = $this->_heap[$parentId]; + + // Move pointer to the next level of tree + $nodeId = $parentId; + $parentId = ($nodeId-1) >> 1; // floor( ($nodeId-1)/2 ) + } + + // Put new node into the tree + $this->_heap[$nodeId] = $element; + } + + + /** + * Return least element of the queue + * + * Constant time + * + * @return mixed + */ + public function top() + { + if (count($this->_heap) == 0) { + return null; + } + + return $this->_heap[0]; + } + + + /** + * Removes and return least element of the queue + * + * O(log(N)) time + * + * @return mixed + */ + public function pop() + { + if (count($this->_heap) == 0) { + return null; + } + + $top = $this->_heap[0]; + $lastId = count($this->_heap) - 1; + + /** + * Find appropriate position for last node + */ + $nodeId = 0; // Start from a top + $childId = 1; // First child + + // Choose smaller child + if ($lastId > 2 && $this->_less($this->_heap[2], $this->_heap[1])) { + $childId = 2; + } + + while ($childId < $lastId && + $this->_less($this->_heap[$childId], $this->_heap[$lastId]) + ) { + // Move child node up + $this->_heap[$nodeId] = $this->_heap[$childId]; + + $nodeId = $childId; // Go down + $childId = ($nodeId << 1) + 1; // First child + + // Choose smaller child + if (($childId+1) < $lastId && + $this->_less($this->_heap[$childId+1], $this->_heap[$childId]) + ) { + $childId++; + } + } + + // Move last element to the new position + $this->_heap[$nodeId] = $this->_heap[$lastId]; + unset($this->_heap[$lastId]); + + return $top; + } + + + /** + * Clear queue + */ + public function clear() + { + $this->_heap = array(); + } + + + /** + * Compare elements + * + * Returns true, if $el1 is less than $el2; else otherwise + * + * @param mixed $el1 + * @param mixed $el2 + * @return boolean + */ + abstract protected function _less($el1, $el2); +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Proxy.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Proxy.php new file mode 100644 index 0000000000000000000000000000000000000000..98b7e51dfd3d194598d88d3950d504d181621f80 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Proxy.php @@ -0,0 +1,611 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Search_Lucene_Interface */ +require_once 'Zend/Search/Lucene/Interface.php'; + + +/** + * Proxy class intended to be used in userland. + * + * It tracks, when index object goes out of scope and forces ndex closing + * + * @category Zend + * @package Zend_Search_Lucene + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Proxy implements Zend_Search_Lucene_Interface +{ + /** + * Index object + * + * @var Zend_Search_Lucene_Interface + */ + private $_index; + + /** + * Object constructor + * + * @param Zend_Search_Lucene_Interface $index + */ + public function __construct(Zend_Search_Lucene_Interface $index) + { + $this->_index = $index; + $this->_index->addReference(); + } + + /** + * Object destructor + */ + public function __destruct() + { + if ($this->_index !== null) { + // This code is invoked if Zend_Search_Lucene_Interface object constructor throws an exception + $this->_index->removeReference(); + } + $this->_index = null; + } + + /** + * Get current generation number + * + * Returns generation number + * 0 means pre-2.1 index format + * -1 means there are no segments files. + * + * @param Zend_Search_Lucene_Storage_Directory $directory + * @return integer + * @throws Zend_Search_Lucene_Exception + */ + public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory) + { + Zend_Search_Lucene::getActualGeneration($directory); + } + + /** + * Get segments file name + * + * @param integer $generation + * @return string + */ + public static function getSegmentFileName($generation) + { + Zend_Search_Lucene::getSegmentFileName($generation); + } + + /** + * Get index format version + * + * @return integer + */ + public function getFormatVersion() + { + return $this->_index->getFormatVersion(); + } + + /** + * Set index format version. + * Index is converted to this format at the nearest upfdate time + * + * @param int $formatVersion + * @throws Zend_Search_Lucene_Exception + */ + public function setFormatVersion($formatVersion) + { + $this->_index->setFormatVersion($formatVersion); + } + + /** + * Returns the Zend_Search_Lucene_Storage_Directory instance for this index. + * + * @return Zend_Search_Lucene_Storage_Directory + */ + public function getDirectory() + { + return $this->_index->getDirectory(); + } + + /** + * Returns the total number of documents in this index (including deleted documents). + * + * @return integer + */ + public function count() + { + return $this->_index->count(); + } + + /** + * Returns one greater than the largest possible document number. + * This may be used to, e.g., determine how big to allocate a structure which will have + * an element for every document number in an index. + * + * @return integer + */ + public function maxDoc() + { + return $this->_index->maxDoc(); + } + + /** + * Returns the total number of non-deleted documents in this index. + * + * @return integer + */ + public function numDocs() + { + return $this->_index->numDocs(); + } + + /** + * Checks, that document is deleted + * + * @param integer $id + * @return boolean + * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range + */ + public function isDeleted($id) + { + return $this->_index->isDeleted($id); + } + + /** + * Set default search field. + * + * Null means, that search is performed through all fields by default + * + * Default value is null + * + * @param string $fieldName + */ + public static function setDefaultSearchField($fieldName) + { + Zend_Search_Lucene::setDefaultSearchField($fieldName); + } + + /** + * Get default search field. + * + * Null means, that search is performed through all fields by default + * + * @return string + */ + public static function getDefaultSearchField() + { + return Zend_Search_Lucene::getDefaultSearchField(); + } + + /** + * Set result set limit. + * + * 0 (default) means no limit + * + * @param integer $limit + */ + public static function setResultSetLimit($limit) + { + Zend_Search_Lucene::setResultSetLimit($limit); + } + + /** + * Set result set limit. + * + * 0 means no limit + * + * @return integer + */ + public static function getResultSetLimit() + { + return Zend_Search_Lucene::getResultSetLimit(); + } + + /** + * Retrieve index maxBufferedDocs option + * + * maxBufferedDocs is a minimal number of documents required before + * the buffered in-memory documents are written into a new Segment + * + * Default value is 10 + * + * @return integer + */ + public function getMaxBufferedDocs() + { + return $this->_index->getMaxBufferedDocs(); + } + + /** + * Set index maxBufferedDocs option + * + * maxBufferedDocs is a minimal number of documents required before + * the buffered in-memory documents are written into a new Segment + * + * Default value is 10 + * + * @param integer $maxBufferedDocs + */ + public function setMaxBufferedDocs($maxBufferedDocs) + { + $this->_index->setMaxBufferedDocs($maxBufferedDocs); + } + + + /** + * Retrieve index maxMergeDocs option + * + * maxMergeDocs is a largest number of documents ever merged by addDocument(). + * Small values (e.g., less than 10,000) are best for interactive indexing, + * as this limits the length of pauses while indexing to a few seconds. + * Larger values are best for batched indexing and speedier searches. + * + * Default value is PHP_INT_MAX + * + * @return integer + */ + public function getMaxMergeDocs() + { + return $this->_index->getMaxMergeDocs(); + } + + /** + * Set index maxMergeDocs option + * + * maxMergeDocs is a largest number of documents ever merged by addDocument(). + * Small values (e.g., less than 10,000) are best for interactive indexing, + * as this limits the length of pauses while indexing to a few seconds. + * Larger values are best for batched indexing and speedier searches. + * + * Default value is PHP_INT_MAX + * + * @param integer $maxMergeDocs + */ + public function setMaxMergeDocs($maxMergeDocs) + { + $this->_index->setMaxMergeDocs($maxMergeDocs); + } + + + /** + * Retrieve index mergeFactor option + * + * mergeFactor determines how often segment indices are merged by addDocument(). + * With smaller values, less RAM is used while indexing, + * and searches on unoptimized indices are faster, + * but indexing speed is slower. + * With larger values, more RAM is used during indexing, + * and while searches on unoptimized indices are slower, + * indexing is faster. + * Thus larger values (> 10) are best for batch index creation, + * and smaller values (< 10) for indices that are interactively maintained. + * + * Default value is 10 + * + * @return integer + */ + public function getMergeFactor() + { + return $this->_index->getMergeFactor(); + } + + /** + * Set index mergeFactor option + * + * mergeFactor determines how often segment indices are merged by addDocument(). + * With smaller values, less RAM is used while indexing, + * and searches on unoptimized indices are faster, + * but indexing speed is slower. + * With larger values, more RAM is used during indexing, + * and while searches on unoptimized indices are slower, + * indexing is faster. + * Thus larger values (> 10) are best for batch index creation, + * and smaller values (< 10) for indices that are interactively maintained. + * + * Default value is 10 + * + * @param integer $maxMergeDocs + */ + public function setMergeFactor($mergeFactor) + { + $this->_index->setMergeFactor($mergeFactor); + } + + /** + * Performs a query against the index and returns an array + * of Zend_Search_Lucene_Search_QueryHit objects. + * Input is a string or Zend_Search_Lucene_Search_Query. + * + * @param mixed $query + * @return array Zend_Search_Lucene_Search_QueryHit + * @throws Zend_Search_Lucene_Exception + */ + public function find($query) + { + // actual parameter list + $parameters = func_get_args(); + + // invoke $this->_index->find() method with specified parameters + return call_user_func_array(array(&$this->_index, 'find'), $parameters); + } + + /** + * Returns a list of all unique field names that exist in this index. + * + * @param boolean $indexed + * @return array + */ + public function getFieldNames($indexed = false) + { + return $this->_index->getFieldNames($indexed); + } + + /** + * Returns a Zend_Search_Lucene_Document object for the document + * number $id in this index. + * + * @param integer|Zend_Search_Lucene_Search_QueryHit $id + * @return Zend_Search_Lucene_Document + */ + public function getDocument($id) + { + return $this->_index->getDocument($id); + } + + /** + * Returns true if index contain documents with specified term. + * + * Is used for query optimization. + * + * @param Zend_Search_Lucene_Index_Term $term + * @return boolean + */ + public function hasTerm(Zend_Search_Lucene_Index_Term $term) + { + return $this->_index->hasTerm($term); + } + + /** + * Returns IDs of all the documents containing term. + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return array + */ + public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) + { + return $this->_index->termDocs($term, $docsFilter); + } + + /** + * Returns documents filter for all documents containing term. + * + * It performs the same operation as termDocs, but return result as + * Zend_Search_Lucene_Index_DocsFilter object + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return Zend_Search_Lucene_Index_DocsFilter + */ + public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) + { + return $this->_index->termDocsFilter($term, $docsFilter); + } + + /** + * Returns an array of all term freqs. + * Return array structure: array( docId => freq, ...) + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return integer + */ + public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) + { + return $this->_index->termFreqs($term, $docsFilter); + } + + /** + * Returns an array of all term positions in the documents. + * Return array structure: array( docId => array( pos1, pos2, ...), ...) + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @return array + */ + public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) + { + return $this->_index->termPositions($term, $docsFilter); + } + + /** + * Returns the number of documents in this index containing the $term. + * + * @param Zend_Search_Lucene_Index_Term $term + * @return integer + */ + public function docFreq(Zend_Search_Lucene_Index_Term $term) + { + return $this->_index->docFreq($term); + } + + /** + * Retrive similarity used by index reader + * + * @return Zend_Search_Lucene_Search_Similarity + */ + public function getSimilarity() + { + return $this->_index->getSimilarity(); + } + + /** + * Returns a normalization factor for "field, document" pair. + * + * @param integer $id + * @param string $fieldName + * @return float + */ + public function norm($id, $fieldName) + { + return $this->_index->norm($id, $fieldName); + } + + /** + * Returns true if any documents have been deleted from this index. + * + * @return boolean + */ + public function hasDeletions() + { + return $this->_index->hasDeletions(); + } + + /** + * Deletes a document from the index. + * $id is an internal document id + * + * @param integer|Zend_Search_Lucene_Search_QueryHit $id + * @throws Zend_Search_Lucene_Exception + */ + public function delete($id) + { + return $this->_index->delete($id); + } + + /** + * Adds a document to this index. + * + * @param Zend_Search_Lucene_Document $document + */ + public function addDocument(Zend_Search_Lucene_Document $document) + { + $this->_index->addDocument($document); + } + + /** + * Commit changes resulting from delete() or undeleteAll() operations. + */ + public function commit() + { + $this->_index->commit(); + } + + /** + * Optimize index. + * + * Merges all segments into one + */ + public function optimize() + { + $this->_index->optimize(); + } + + /** + * Returns an array of all terms in this index. + * + * @return array + */ + public function terms() + { + return $this->_index->terms(); + } + + + /** + * Reset terms stream. + */ + public function resetTermsStream() + { + $this->_index->resetTermsStream(); + } + + /** + * Skip terms stream up to specified term preffix. + * + * Prefix contains fully specified field info and portion of searched term + * + * @param Zend_Search_Lucene_Index_Term $prefix + */ + public function skipTo(Zend_Search_Lucene_Index_Term $prefix) + { + return $this->_index->skipTo($prefix); + } + + /** + * Scans terms dictionary and returns next term + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function nextTerm() + { + return $this->_index->nextTerm(); + } + + /** + * Returns term in current position + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function currentTerm() + { + return $this->_index->currentTerm(); + } + + /** + * Close terms stream + * + * Should be used for resources clean up if stream is not read up to the end + */ + public function closeTermsStream() + { + $this->_index->closeTermsStream(); + } + + + /** + * Undeletes all documents currently marked as deleted in this index. + */ + public function undeleteAll() + { + return $this->_index->undeleteAll(); + } + + /** + * Add reference to the index object + * + * @internal + */ + public function addReference() + { + return $this->_index->addReference(); + } + + /** + * Remove reference from the index object + * + * When reference count becomes zero, index is closed and resources are cleaned up + * + * @internal + */ + public function removeReference() + { + return $this->_index->removeReference(); + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php new file mode 100644 index 0000000000000000000000000000000000000000..8d78e456a34ed72baadc5bdef87ee32444775d59 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php @@ -0,0 +1,280 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_FSM */ +require_once 'Zend/Search/Lucene/FSM.php'; + +/** Zend_Search_Lucene_Search_QueryToken */ +require_once 'Zend/Search/Lucene/Search/QueryToken.php'; + +/** Zend_Search_Lucene_Search_QueryParser */ +require_once 'Zend/Search/Lucene/Search/QueryParser.php'; + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_BooleanExpressionRecognizer extends Zend_Search_Lucene_FSM +{ + /** State Machine states */ + const ST_START = 0; + const ST_LITERAL = 1; + const ST_NOT_OPERATOR = 2; + const ST_AND_OPERATOR = 3; + const ST_OR_OPERATOR = 4; + + /** Input symbols */ + const IN_LITERAL = 0; + const IN_NOT_OPERATOR = 1; + const IN_AND_OPERATOR = 2; + const IN_OR_OPERATOR = 3; + + + /** + * NOT operator signal + * + * @var boolean + */ + private $_negativeLiteral = false; + + /** + * Current literal + * + * @var mixed + */ + private $_literal; + + + /** + * Set of boolean query conjunctions + * + * Each conjunction is an array of conjunction elements + * Each conjunction element is presented with two-elements array: + * array(<literal>, <is_negative>) + * + * So, it has a structure: + * array( array( array(<literal>, <is_negative>), // first literal of first conjuction + * array(<literal>, <is_negative>), // second literal of first conjuction + * ... + * array(<literal>, <is_negative>) + * ), // end of first conjuction + * array( array(<literal>, <is_negative>), // first literal of second conjuction + * array(<literal>, <is_negative>), // second literal of second conjuction + * ... + * array(<literal>, <is_negative>) + * ), // end of second conjuction + * ... + * ) // end of structure + * + * @var array + */ + private $_conjunctions = array(); + + /** + * Current conjuction + * + * @var array + */ + private $_currentConjunction = array(); + + + /** + * Object constructor + */ + public function __construct() + { + parent::__construct( array(self::ST_START, + self::ST_LITERAL, + self::ST_NOT_OPERATOR, + self::ST_AND_OPERATOR, + self::ST_OR_OPERATOR), + array(self::IN_LITERAL, + self::IN_NOT_OPERATOR, + self::IN_AND_OPERATOR, + self::IN_OR_OPERATOR)); + + $emptyOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'emptyOperatorAction'); + $emptyNotOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'emptyNotOperatorAction'); + + $this->addRules(array( array(self::ST_START, self::IN_LITERAL, self::ST_LITERAL), + array(self::ST_START, self::IN_NOT_OPERATOR, self::ST_NOT_OPERATOR), + + array(self::ST_LITERAL, self::IN_AND_OPERATOR, self::ST_AND_OPERATOR), + array(self::ST_LITERAL, self::IN_OR_OPERATOR, self::ST_OR_OPERATOR), + array(self::ST_LITERAL, self::IN_LITERAL, self::ST_LITERAL, $emptyOperatorAction), + array(self::ST_LITERAL, self::IN_NOT_OPERATOR, self::ST_NOT_OPERATOR, $emptyNotOperatorAction), + + array(self::ST_NOT_OPERATOR, self::IN_LITERAL, self::ST_LITERAL), + + array(self::ST_AND_OPERATOR, self::IN_LITERAL, self::ST_LITERAL), + array(self::ST_AND_OPERATOR, self::IN_NOT_OPERATOR, self::ST_NOT_OPERATOR), + + array(self::ST_OR_OPERATOR, self::IN_LITERAL, self::ST_LITERAL), + array(self::ST_OR_OPERATOR, self::IN_NOT_OPERATOR, self::ST_NOT_OPERATOR), + )); + + $notOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'notOperatorAction'); + $orOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'orOperatorAction'); + $literalAction = new Zend_Search_Lucene_FSMAction($this, 'literalAction'); + + + $this->addEntryAction(self::ST_NOT_OPERATOR, $notOperatorAction); + $this->addEntryAction(self::ST_OR_OPERATOR, $orOperatorAction); + $this->addEntryAction(self::ST_LITERAL, $literalAction); + } + + + /** + * Process next operator. + * + * Operators are defined by class constants: IN_AND_OPERATOR, IN_OR_OPERATOR and IN_NOT_OPERATOR + * + * @param integer $operator + */ + public function processOperator($operator) + { + $this->process($operator); + } + + /** + * Process expression literal. + * + * @param integer $operator + */ + public function processLiteral($literal) + { + $this->_literal = $literal; + + $this->process(self::IN_LITERAL); + } + + /** + * Finish an expression and return result + * + * Result is a set of boolean query conjunctions + * + * Each conjunction is an array of conjunction elements + * Each conjunction element is presented with two-elements array: + * array(<literal>, <is_negative>) + * + * So, it has a structure: + * array( array( array(<literal>, <is_negative>), // first literal of first conjuction + * array(<literal>, <is_negative>), // second literal of first conjuction + * ... + * array(<literal>, <is_negative>) + * ), // end of first conjuction + * array( array(<literal>, <is_negative>), // first literal of second conjuction + * array(<literal>, <is_negative>), // second literal of second conjuction + * ... + * array(<literal>, <is_negative>) + * ), // end of second conjuction + * ... + * ) // end of structure + * + * @return array + * @throws Zend_Search_Lucene_Exception + */ + public function finishExpression() + { + if ($this->getState() != self::ST_LITERAL) { + throw new Zend_Search_Lucene_Exception('Literal expected.'); + } + + $this->_conjunctions[] = $this->_currentConjunction; + + return $this->_conjunctions; + } + + + + /********************************************************************* + * Actions implementation + *********************************************************************/ + + /** + * default (omitted) operator processing + */ + public function emptyOperatorAction() + { + if (Zend_Search_Lucene_Search_QueryParser::getDefaultOperator() == Zend_Search_Lucene_Search_QueryParser::B_AND) { + // Do nothing + } else { + $this->orOperatorAction(); + } + + // Process literal + $this->literalAction(); + } + + /** + * default (omitted) + NOT operator processing + */ + public function emptyNotOperatorAction() + { + if (Zend_Search_Lucene_Search_QueryParser::getDefaultOperator() == Zend_Search_Lucene_Search_QueryParser::B_AND) { + // Do nothing + } else { + $this->orOperatorAction(); + } + + // Process NOT operator + $this->notOperatorAction(); + } + + + /** + * NOT operator processing + */ + public function notOperatorAction() + { + $this->_negativeLiteral = true; + } + + /** + * OR operator processing + * Close current conjunction + */ + public function orOperatorAction() + { + $this->_conjunctions[] = $this->_currentConjunction; + $this->_currentConjunction = array(); + } + + /** + * Literal processing + */ + public function literalAction() + { + // Add literal to the current conjunction + $this->_currentConjunction[] = array($this->_literal, !$this->_negativeLiteral); + + // Switch off negative signal + $this->_negativeLiteral = false; + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query.php new file mode 100644 index 0000000000000000000000000000000000000000..20122389298697af40d174a62394ff15b8afcf4a --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query.php @@ -0,0 +1,227 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Search_Lucene_Document_Html */ +require_once 'Zend/Search/Lucene/Document/Html.php'; + +/** Zend_Search_Lucene_Index_DocsFilter */ +require_once 'Zend/Search/Lucene/Index/DocsFilter.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Search_Query +{ + + /** + * query boost factor + * + * @var float + */ + private $_boost = 1; + + /** + * Query weight + * + * @var Zend_Search_Lucene_Search_Weight + */ + protected $_weight = null; + + /** + * Current highlight color + * + * @var integer + */ + private $_currentColorIndex = 0; + + /** + * List of colors for text highlighting + * + * @var array + */ + private $_highlightColors = array('#66ffff', '#ff66ff', '#ffff66', + '#ff8888', '#88ff88', '#8888ff', + '#88dddd', '#dd88dd', '#dddd88', + '#aaddff', '#aaffdd', '#ddaaff', '#ddffaa', '#ffaadd', '#ffddaa'); + + + /** + * Gets the boost for this clause. Documents matching + * this clause will (in addition to the normal weightings) have their score + * multiplied by boost. The boost is 1.0 by default. + * + * @return float + */ + public function getBoost() + { + return $this->_boost; + } + + /** + * Sets the boost for this query clause to $boost. + * + * @param float $boost + */ + public function setBoost($boost) + { + $this->_boost = $boost; + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + abstract public function score($docId, Zend_Search_Lucene_Interface $reader); + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + */ + abstract public function matchedDocs(); + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * Query specific implementation + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + */ + abstract public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null); + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + */ + abstract public function createWeight(Zend_Search_Lucene_Interface $reader); + + /** + * Constructs an initializes a Weight for a _top-level_query_. + * + * @param Zend_Search_Lucene_Interface $reader + */ + protected function _initWeight(Zend_Search_Lucene_Interface $reader) + { + // Check, that it's a top-level query and query weight is not initialized yet. + if ($this->_weight !== null) { + return $this->_weight; + } + + $this->createWeight($reader); + $sum = $this->_weight->sumOfSquaredWeights(); + $queryNorm = $reader->getSimilarity()->queryNorm($sum); + $this->_weight->normalize($queryNorm); + } + + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + abstract public function rewrite(Zend_Search_Lucene_Interface $index); + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + abstract public function optimize(Zend_Search_Lucene_Interface $index); + + /** + * Reset query, so it can be reused within other queries or + * with other indeces + */ + public function reset() + { + $this->_weight = null; + } + + + /** + * Print a query + * + * @return string + */ + abstract public function __toString(); + + /** + * Return query terms + * + * @return array + */ + abstract public function getQueryTerms(); + + /** + * Get highlight color and shift to next + * + * @param integer &$colorIndex + * @return string + */ + protected function _getHighlightColor(&$colorIndex) + { + $color = $this->_highlightColors[$colorIndex++]; + + $colorIndex %= count($this->_highlightColors); + + return $color; + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + abstract public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex); + + /** + * Highlight matches in $inputHTML + * + * @param string $inputHTML + * @return string + */ + public function highlightMatches($inputHTML) + { + $doc = Zend_Search_Lucene_Document_Html::loadHTML($inputHTML); + + $colorIndex = 0; + $this->highlightMatchesDOM($doc, $colorIndex); + + return $doc->getHTML(); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Boolean.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Boolean.php new file mode 100644 index 0000000000000000000000000000000000000000..31a209684faa46811757cda6c17b0d9dea3f0577 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Boolean.php @@ -0,0 +1,806 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Query */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** Zend_Search_Lucene_Search_Weight_Boolean */ +require_once 'Zend/Search/Lucene/Search/Weight/Boolean.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_Boolean extends Zend_Search_Lucene_Search_Query +{ + + /** + * Subqueries + * Array of Zend_Search_Lucene_Search_Query + * + * @var array + */ + private $_subqueries = array(); + + /** + * Subqueries signs. + * If true then subquery is required. + * If false then subquery is prohibited. + * If null then subquery is neither prohibited, nor required + * + * If array is null then all subqueries are required + * + * @var array + */ + private $_signs = array(); + + /** + * Result vector. + * + * @var array + */ + private $_resVector = null; + + /** + * A score factor based on the fraction of all query subqueries + * that a document contains. + * float for conjunction queries + * array of float for non conjunction queries + * + * @var mixed + */ + private $_coord = null; + + + /** + * Class constructor. Create a new Boolean query object. + * + * if $signs array is omitted then all subqueries are required + * it differs from addSubquery() behavior, but should never be used + * + * @param array $subqueries Array of Zend_Search_Search_Query objects + * @param array $signs Array of signs. Sign is boolean|null. + * @return void + */ + public function __construct($subqueries = null, $signs = null) + { + if (is_array($subqueries)) { + $this->_subqueries = $subqueries; + + $this->_signs = null; + // Check if all subqueries are required + if (is_array($signs)) { + foreach ($signs as $sign ) { + if ($sign !== true) { + $this->_signs = $signs; + break; + } + } + } + } + } + + + /** + * Add a $subquery (Zend_Search_Lucene_Search_Query) to this query. + * + * The sign is specified as: + * TRUE - subquery is required + * FALSE - subquery is prohibited + * NULL - subquery is neither prohibited, nor required + * + * @param Zend_Search_Lucene_Search_Query $subquery + * @param boolean|null $sign + * @return void + */ + public function addSubquery(Zend_Search_Lucene_Search_Query $subquery, $sign=null) { + if ($sign !== true || $this->_signs !== null) { // Skip, if all subqueries are required + if ($this->_signs === null) { // Check, If all previous subqueries are required + $this->_signs = array(); + foreach ($this->_subqueries as $prevSubquery) { + $this->_signs[] = true; + } + } + $this->_signs[] = $sign; + } + + $this->_subqueries[] = $subquery; + } + + /** + * Re-write queries into primitive queries + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + $query = new Zend_Search_Lucene_Search_Query_Boolean(); + $query->setBoost($this->getBoost()); + + foreach ($this->_subqueries as $subqueryId => $subquery) { + $query->addSubquery($subquery->rewrite($index), + ($this->_signs === null)? true : $this->_signs[$subqueryId]); + } + + return $query; + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + $subqueries = array(); + $signs = array(); + + // Optimize all subqueries + foreach ($this->_subqueries as $id => $subquery) { + $subqueries[] = $subquery->optimize($index); + $signs[] = ($this->_signs === null)? true : $this->_signs[$id]; + } + + // Remove insignificant subqueries + foreach ($subqueries as $id => $subquery) { + if ($subquery instanceof Zend_Search_Lucene_Search_Query_Insignificant) { + // Insignificant subquery has to be removed anyway + unset($subqueries[$id]); + unset($signs[$id]); + } + } + if (count($subqueries) == 0) { + // Boolean query doesn't has non-insignificant subqueries + return new Zend_Search_Lucene_Search_Query_Insignificant(); + } + // Check if all non-insignificant subqueries are prohibited + $allProhibited = true; + foreach ($signs as $sign) { + if ($sign !== false) { + $allProhibited = false; + break; + } + } + if ($allProhibited) { + return new Zend_Search_Lucene_Search_Query_Insignificant(); + } + + + // Check for empty subqueries + foreach ($subqueries as $id => $subquery) { + if ($subquery instanceof Zend_Search_Lucene_Search_Query_Empty) { + if ($signs[$id] === true) { + // Matching is required, but is actually empty + return new Zend_Search_Lucene_Search_Query_Empty(); + } else { + // Matching is optional or prohibited, but is empty + // Remove it from subqueries and signs list + unset($subqueries[$id]); + unset($signs[$id]); + } + } + } + + // Check, if reduced subqueries list is empty + if (count($subqueries) == 0) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } + + // Check if all non-empty subqueries are prohibited + $allProhibited = true; + foreach ($signs as $sign) { + if ($sign !== false) { + $allProhibited = false; + break; + } + } + if ($allProhibited) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } + + + // Check, if reduced subqueries list has only one entry + if (count($subqueries) == 1) { + // It's a query with only one required or optional clause + // (it's already checked, that it's not a prohibited clause) + + if ($this->getBoost() == 1) { + return reset($subqueries); + } + + $optimizedQuery = clone reset($subqueries); + $optimizedQuery->setBoost($optimizedQuery->getBoost()*$this->getBoost()); + + return $optimizedQuery; + } + + + // Prepare first candidate for optimized query + $optimizedQuery = new Zend_Search_Lucene_Search_Query_Boolean($subqueries, $signs); + $optimizedQuery->setBoost($this->getBoost()); + + + $terms = array(); + $tsigns = array(); + $boostFactors = array(); + + // Try to decompose term and multi-term subqueries + foreach ($subqueries as $id => $subquery) { + if ($subquery instanceof Zend_Search_Lucene_Search_Query_Term) { + $terms[] = $subquery->getTerm(); + $tsigns[] = $signs[$id]; + $boostFactors[] = $subquery->getBoost(); + + // remove subquery from a subqueries list + unset($subqueries[$id]); + unset($signs[$id]); + } else if ($subquery instanceof Zend_Search_Lucene_Search_Query_MultiTerm) { + $subTerms = $subquery->getTerms(); + $subSigns = $subquery->getSigns(); + + if ($signs[$id] === true) { + // It's a required multi-term subquery. + // Something like '... +(+term1 -term2 term3 ...) ...' + + // Multi-term required subquery can be decomposed only if it contains + // required terms and doesn't contain prohibited terms: + // ... +(+term1 term2 ...) ... => ... +term1 term2 ... + // + // Check this + $hasRequired = false; + $hasProhibited = false; + if ($subSigns === null) { + // All subterms are required + $hasRequired = true; + } else { + foreach ($subSigns as $sign) { + if ($sign === true) { + $hasRequired = true; + } else if ($sign === false) { + $hasProhibited = true; + break; + } + } + } + // Continue if subquery has prohibited terms or doesn't have required terms + if ($hasProhibited || !$hasRequired) { + continue; + } + + foreach ($subTerms as $termId => $term) { + $terms[] = $term; + $tsigns[] = ($subSigns === null)? true : $subSigns[$termId]; + $boostFactors[] = $subquery->getBoost(); + } + + // remove subquery from a subqueries list + unset($subqueries[$id]); + unset($signs[$id]); + + } else { // $signs[$id] === null || $signs[$id] === false + // It's an optional or prohibited multi-term subquery. + // Something like '... (+term1 -term2 term3 ...) ...' + // or + // something like '... -(+term1 -term2 term3 ...) ...' + + // Multi-term optional and required subqueries can be decomposed + // only if all terms are optional. + // + // Check if all terms are optional. + $onlyOptional = true; + if ($subSigns === null) { + // All subterms are required + $onlyOptional = false; + } else { + foreach ($subSigns as $sign) { + if ($sign !== null) { + $onlyOptional = false; + break; + } + } + } + + // Continue if non-optional terms are presented in this multi-term subquery + if (!$onlyOptional) { + continue; + } + + foreach ($subTerms as $termId => $term) { + $terms[] = $term; + $tsigns[] = ($signs[$id] === null)? null /* optional */ : + false /* prohibited */; + $boostFactors[] = $subquery->getBoost(); + } + + // remove subquery from a subqueries list + unset($subqueries[$id]); + unset($signs[$id]); + } + } + } + + + // Check, if there are no decomposed subqueries + if (count($terms) == 0 ) { + // return prepared candidate + return $optimizedQuery; + } + + + // Check, if all subqueries have been decomposed and all terms has the same boost factor + if (count($subqueries) == 0 && count(array_unique($boostFactors)) == 1) { + $optimizedQuery = new Zend_Search_Lucene_Search_Query_MultiTerm($terms, $tsigns); + $optimizedQuery->setBoost(reset($boostFactors)*$this->getBoost()); + + return $optimizedQuery; + } + + + // This boolean query can't be transformed to Term/MultiTerm query and still contains + // several subqueries + + // Separate prohibited terms + $prohibitedTerms = array(); + foreach ($terms as $id => $term) { + if ($tsigns[$id] === false) { + $prohibitedTerms[] = $term; + + unset($terms[$id]); + unset($tsigns[$id]); + unset($boostFactors[$id]); + } + } + + if (count($terms) == 1) { + $clause = new Zend_Search_Lucene_Search_Query_Term(reset($terms)); + $clause->setBoost(reset($boostFactors)); + + $subqueries[] = $clause; + $signs[] = reset($tsigns); + + // Clear terms list + $terms = array(); + } else if (count($terms) > 1 && count(array_unique($boostFactors)) == 1) { + $clause = new Zend_Search_Lucene_Search_Query_MultiTerm($terms, $tsigns); + $clause->setBoost(reset($boostFactors)); + + $subqueries[] = $clause; + // Clause sign is 'required' if clause contains required terms. 'Optional' otherwise. + $signs[] = (in_array(true, $tsigns))? true : null; + + // Clear terms list + $terms = array(); + } + + if (count($prohibitedTerms) == 1) { + // (boost factors are not significant for prohibited clauses) + $subqueries[] = new Zend_Search_Lucene_Search_Query_Term(reset($prohibitedTerms)); + $signs[] = false; + + // Clear prohibited terms list + $prohibitedTerms = array(); + } else if (count($prohibitedTerms) > 1) { + // prepare signs array + $prohibitedSigns = array(); + foreach ($prohibitedTerms as $id => $term) { + // all prohibited term are grouped as optional into multi-term query + $prohibitedSigns[$id] = null; + } + + // (boost factors are not significant for prohibited clauses) + $subqueries[] = new Zend_Search_Lucene_Search_Query_MultiTerm($prohibitedTerms, $prohibitedSigns); + // Clause sign is 'prohibited' + $signs[] = false; + + // Clear terms list + $prohibitedTerms = array(); + } + + /** @todo Group terms with the same boost factors together */ + + // Check, that all terms are processed + // Replace candidate for optimized query + if (count($terms) == 0 && count($prohibitedTerms) == 0) { + $optimizedQuery = new Zend_Search_Lucene_Search_Query_Boolean($subqueries, $signs); + $optimizedQuery->setBoost($this->getBoost()); + } + + return $optimizedQuery; + } + + /** + * Returns subqueries + * + * @return array + */ + public function getSubqueries() + { + return $this->_subqueries; + } + + + /** + * Return subqueries signs + * + * @return array + */ + public function getSigns() + { + return $this->_signs; + } + + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + $this->_weight = new Zend_Search_Lucene_Search_Weight_Boolean($this, $reader); + return $this->_weight; + } + + + /** + * Calculate result vector for Conjunction query + * (like '<subquery1> AND <subquery2> AND <subquery3>') + */ + private function _calculateConjunctionResult() + { + $this->_resVector = null; + + if (count($this->_subqueries) == 0) { + $this->_resVector = array(); + } + + $resVectors = array(); + $resVectorsSizes = array(); + $resVectorsIds = array(); // is used to prevent arrays comparison + foreach ($this->_subqueries as $subqueryId => $subquery) { + $resVectors[] = $subquery->matchedDocs(); + $resVectorsSizes[] = count(end($resVectors)); + $resVectorsIds[] = $subqueryId; + } + // sort resvectors in order of subquery cardinality increasing + array_multisort($resVectorsSizes, SORT_ASC, SORT_NUMERIC, + $resVectorsIds, SORT_ASC, SORT_NUMERIC, + $resVectors); + + foreach ($resVectors as $nextResVector) { + if($this->_resVector === null) { + $this->_resVector = $nextResVector; + } else { + //$this->_resVector = array_intersect_key($this->_resVector, $nextResVector); + + /** + * This code is used as workaround for array_intersect_key() slowness problem. + */ + $updatedVector = array(); + foreach ($this->_resVector as $id => $value) { + if (isset($nextResVector[$id])) { + $updatedVector[$id] = $value; + } + } + $this->_resVector = $updatedVector; + } + + if (count($this->_resVector) == 0) { + // Empty result set, we don't need to check other terms + break; + } + } + + // ksort($this->_resVector, SORT_NUMERIC); + // Used algorithm doesn't change elements order + } + + + /** + * Calculate result vector for non Conjunction query + * (like '<subquery1> AND <subquery2> AND NOT <subquery3> OR <subquery4>') + */ + private function _calculateNonConjunctionResult() + { + $requiredVectors = array(); + $requiredVectorsSizes = array(); + $requiredVectorsIds = array(); // is used to prevent arrays comparison + + $optional = array(); + + foreach ($this->_subqueries as $subqueryId => $subquery) { + if ($this->_signs[$subqueryId] === true) { + // required + $requiredVectors[] = $subquery->matchedDocs(); + $requiredVectorsSizes[] = count(end($requiredVectors)); + $requiredVectorsIds[] = $subqueryId; + } elseif ($this->_signs[$subqueryId] === false) { + // prohibited + // Do nothing. matchedDocs() may include non-matching id's + // Calculating prohibited vector may take significant time, but do not affect the result + // Skipped. + } else { + // neither required, nor prohibited + // array union + $optional += $subquery->matchedDocs(); + } + } + + // sort resvectors in order of subquery cardinality increasing + array_multisort($requiredVectorsSizes, SORT_ASC, SORT_NUMERIC, + $requiredVectorsIds, SORT_ASC, SORT_NUMERIC, + $requiredVectors); + + $required = null; + foreach ($requiredVectors as $nextResVector) { + if($required === null) { + $required = $nextResVector; + } else { + //$required = array_intersect_key($required, $nextResVector); + + /** + * This code is used as workaround for array_intersect_key() slowness problem. + */ + $updatedVector = array(); + foreach ($required as $id => $value) { + if (isset($nextResVector[$id])) { + $updatedVector[$id] = $value; + } + } + $required = $updatedVector; + } + + if (count($required) == 0) { + // Empty result set, we don't need to check other terms + break; + } + } + + + if ($required !== null) { + $this->_resVector = &$required; + } else { + $this->_resVector = &$optional; + } + + ksort($this->_resVector, SORT_NUMERIC); + } + + + /** + * Score calculator for conjunction queries (all subqueries are required) + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function _conjunctionScore($docId, Zend_Search_Lucene_Interface $reader) + { + if ($this->_coord === null) { + $this->_coord = $reader->getSimilarity()->coord(count($this->_subqueries), + count($this->_subqueries) ); + } + + $score = 0; + + foreach ($this->_subqueries as $subquery) { + $subscore = $subquery->score($docId, $reader); + + if ($subscore == 0) { + return 0; + } + + $score += $subquery->score($docId, $reader) * $this->_coord; + } + + return $score * $this->_coord * $this->getBoost(); + } + + + /** + * Score calculator for non conjunction queries (not all subqueries are required) + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function _nonConjunctionScore($docId, Zend_Search_Lucene_Interface $reader) + { + if ($this->_coord === null) { + $this->_coord = array(); + + $maxCoord = 0; + foreach ($this->_signs as $sign) { + if ($sign !== false /* not prohibited */) { + $maxCoord++; + } + } + + for ($count = 0; $count <= $maxCoord; $count++) { + $this->_coord[$count] = $reader->getSimilarity()->coord($count, $maxCoord); + } + } + + $score = 0; + $matchedSubqueries = 0; + foreach ($this->_subqueries as $subqueryId => $subquery) { + $subscore = $subquery->score($docId, $reader); + + // Prohibited + if ($this->_signs[$subqueryId] === false && $subscore != 0) { + return 0; + } + + // is required, but doen't match + if ($this->_signs[$subqueryId] === true && $subscore == 0) { + return 0; + } + + if ($subscore != 0) { + $matchedSubqueries++; + $score += $subscore; + } + } + + return $score * $this->_coord[$matchedSubqueries] * $this->getBoost(); + } + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + // Initialize weight if it's not done yet + $this->_initWeight($reader); + + if ($docsFilter === null) { + // Create local documents filter if it's not provided by upper query + $docsFilter = new Zend_Search_Lucene_Index_DocsFilter(); + } + + foreach ($this->_subqueries as $subqueryId => $subquery) { + if ($this->_signs == null || $this->_signs[$subqueryId] === true) { + // Subquery is required + $subquery->execute($reader, $docsFilter); + } else { + $subquery->execute($reader); + } + } + + if ($this->_signs === null) { + $this->_calculateConjunctionResult(); + } else { + $this->_calculateNonConjunctionResult(); + } + } + + + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + */ + public function matchedDocs() + { + return $this->_resVector; + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + if (isset($this->_resVector[$docId])) { + if ($this->_signs === null) { + return $this->_conjunctionScore($docId, $reader); + } else { + return $this->_nonConjunctionScore($docId, $reader); + } + } else { + return 0; + } + } + + /** + * Return query terms + * + * @return array + */ + public function getQueryTerms() + { + $terms = array(); + + foreach ($this->_subqueries as $id => $subquery) { + if ($this->_signs === null || $this->_signs[$id] !== false) { + $terms = array_merge($terms, $subquery->getQueryTerms()); + } + } + + return $terms; + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + foreach ($this->_subqueries as $id => $subquery) { + if ($this->_signs === null || $this->_signs[$id] !== false) { + $subquery->highlightMatchesDOM($doc, $colorIndex); + } + } + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + // It's used only for query visualisation, so we don't care about characters escaping + + $query = ''; + + foreach ($this->_subqueries as $id => $subquery) { + if ($id != 0) { + $query .= ' '; + } + + if ($this->_signs === null || $this->_signs[$id] === true) { + $query .= '+'; + } else if ($this->_signs[$id] === false) { + $query .= '-'; + } + + $query .= '(' . $subquery->__toString() . ')'; + + if ($subquery->getBoost() != 1) { + $query .= '^' . round($subquery->getBoost(), 4); + } + } + + return $query; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Empty.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Empty.php new file mode 100644 index 0000000000000000000000000000000000000000..2c5623053a59203b9dbe72b7439b15f4b0af0ceb --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Empty.php @@ -0,0 +1,140 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Query */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** Zend_Search_Lucene_Search_Weight_Empty */ +require_once 'Zend/Search/Lucene/Search/Weight/Empty.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_Empty extends Zend_Search_Lucene_Search_Query +{ + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + return $this; + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + // "Empty" query is a primitive query and don't need to be optimized + return $this; + } + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + return new Zend_Search_Lucene_Search_Weight_Empty(); + } + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + // Do nothing + } + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + */ + public function matchedDocs() + { + return array(); + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + return 0; + } + + /** + * Return query terms + * + * @return array + */ + public function getQueryTerms() + { + return array(); + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + // Do nothing + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + return '<EmptyQuery>'; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Fuzzy.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Fuzzy.php new file mode 100644 index 0000000000000000000000000000000000000000..f72c6e0be0df96a33ba08e688568371a0e64c3d6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Fuzzy.php @@ -0,0 +1,391 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Query */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** Zend_Search_Lucene_Search_Query_MultiTerm */ +require_once 'Zend/Search/Lucene/Search/Query/MultiTerm.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_Fuzzy extends Zend_Search_Lucene_Search_Query +{ + /** Default minimum similarity */ + const DEFAULT_MIN_SIMILARITY = 0.5; + + /** + * Maximum number of matched terms. + * Apache Lucene defines this limitation as boolean query maximum number of clauses: + * org.apache.lucene.search.BooleanQuery.getMaxClauseCount() + */ + const MAX_CLAUSE_COUNT = 1024; + + /** + * Array of precalculated max distances + * + * keys are integers representing a word size + */ + private $_maxDistances = array(); + + /** + * Base searching term. + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_term; + + /** + * A value between 0 and 1 to set the required similarity + * between the query term and the matching terms. For example, for a + * _minimumSimilarity of 0.5 a term of the same length + * as the query term is considered similar to the query term if the edit distance + * between both terms is less than length(term)*0.5 + * + * @var float + */ + private $_minimumSimilarity; + + /** + * The length of common (non-fuzzy) prefix + * + * @var integer + */ + private $_prefixLength; + + /** + * Matched terms. + * + * Matched terms list. + * It's filled during the search (rewrite operation) and may be used for search result + * post-processing + * + * Array of Zend_Search_Lucene_Index_Term objects + * + * @var array + */ + private $_matches = null; + + /** + * Matched terms scores + * + * @var array + */ + private $_scores = null; + + /** + * Array of the term keys. + * Used to sort terms in alphabetical order if terms have the same socres + * + * @var array + */ + private $_termKeys = null; + + /** + * Zend_Search_Lucene_Search_Query_Wildcard constructor. + * + * @param Zend_Search_Lucene_Index_Term $pattern + * @throws Zend_Search_Lucene_Exception + */ + public function __construct(Zend_Search_Lucene_Index_Term $term, $minimumSimilarity = self::DEFAULT_MIN_SIMILARITY, $prefixLength = 0) + { + if ($minimumSimilarity < 0) { + throw new Zend_Search_Lucene_Exception('minimumSimilarity cannot be less than 0'); + } + if ($minimumSimilarity >= 1) { + throw new Zend_Search_Lucene_Exception('minimumSimilarity cannot be greater than or equal to 1'); + } + if ($prefixLength < 0) { + throw new Zend_Search_Lucene_Exception('prefixLength cannot be less than 0'); + } + + $this->_term = $term; + $this->_minimumSimilarity = $minimumSimilarity; + $this->_prefixLength = $prefixLength; + } + + /** + * Calculate maximum distance for specified word length + * + * @param integer $prefixLength + * @param integer $termLength + * @param integer $length + * @return integer + */ + private function _calculateMaxDistance($prefixLength, $termLength, $length) + { + $this->_maxDistances[$length] = (int) ((1 - $this->_minimumSimilarity)*(min($termLength, $length) + $prefixLength)); + return $this->_maxDistances[$length]; + } + + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + $this->_matches = array(); + $this->_scores = array(); + $this->_termKeys = array(); + + if ($this->_term->field === null) { + // Search through all fields + $fields = $index->getFieldNames(true /* indexed fields list */); + } else { + $fields = array($this->_term->field); + } + + $prefix = Zend_Search_Lucene_Index_Term::getPrefix($this->_term->text, $this->_prefixLength); + $prefixByteLength = strlen($prefix); + $prefixUtf8Length = Zend_Search_Lucene_Index_Term::getLength($prefix); + + $termLength = Zend_Search_Lucene_Index_Term::getLength($this->_term->text); + + $termRest = substr($this->_term->text, $prefixByteLength); + // we calculate length of the rest in bytes since levenshtein() is not UTF-8 compatible + $termRestLength = strlen($termRest); + + $scaleFactor = 1/(1 - $this->_minimumSimilarity); + + foreach ($fields as $field) { + $index->resetTermsStream(); + + if ($prefix != '') { + $index->skipTo(new Zend_Search_Lucene_Index_Term($prefix, $field)); + + while ($index->currentTerm() !== null && + $index->currentTerm()->field == $field && + substr($index->currentTerm()->text, 0, $prefixByteLength) == $prefix) { + // Calculate similarity + $target = substr($index->currentTerm()->text, $prefixByteLength); + + $maxDistance = isset($this->_maxDistances[strlen($target)])? + $this->_maxDistances[strlen($target)] : + $this->_calculateMaxDistance($prefixUtf8Length, $termRestLength, strlen($target)); + + if ($termRestLength == 0) { + // we don't have anything to compare. That means if we just add + // the letters for current term we get the new word + $similarity = (($prefixUtf8Length == 0)? 0 : 1 - strlen($target)/$prefixUtf8Length); + } else if (strlen($target) == 0) { + $similarity = (($prefixUtf8Length == 0)? 0 : 1 - $termRestLength/$prefixUtf8Length); + } else if ($maxDistance < abs($termRestLength - strlen($target))){ + //just adding the characters of term to target or vice-versa results in too many edits + //for example "pre" length is 3 and "prefixes" length is 8. We can see that + //given this optimal circumstance, the edit distance cannot be less than 5. + //which is 8-3 or more precisesly abs(3-8). + //if our maximum edit distance is 4, then we can discard this word + //without looking at it. + $similarity = 0; + } else { + $similarity = 1 - levenshtein($termRest, $target)/($prefixUtf8Length + min($termRestLength, strlen($target))); + } + + if ($similarity > $this->_minimumSimilarity) { + $this->_matches[] = $index->currentTerm(); + $this->_termKeys[] = $index->currentTerm()->key(); + $this->_scores[] = ($similarity - $this->_minimumSimilarity)*$scaleFactor; + } + + $index->nextTerm(); + } + } else { + $index->skipTo(new Zend_Search_Lucene_Index_Term('', $field)); + + while ($index->currentTerm() !== null && $index->currentTerm()->field == $field) { + // Calculate similarity + $target = $index->currentTerm()->text; + + $maxDistance = isset($this->_maxDistances[strlen($target)])? + $this->_maxDistances[strlen($target)] : + $this->_calculateMaxDistance(0, $termRestLength, strlen($target)); + + if ($maxDistance < abs($termRestLength - strlen($target))){ + //just adding the characters of term to target or vice-versa results in too many edits + //for example "pre" length is 3 and "prefixes" length is 8. We can see that + //given this optimal circumstance, the edit distance cannot be less than 5. + //which is 8-3 or more precisesly abs(3-8). + //if our maximum edit distance is 4, then we can discard this word + //without looking at it. + $similarity = 0; + } else { + $similarity = 1 - levenshtein($termRest, $target)/min($termRestLength, strlen($target)); + } + + if ($similarity > $this->_minimumSimilarity) { + $this->_matches[] = $index->currentTerm(); + $this->_termKeys[] = $index->currentTerm()->key(); + $this->_scores[] = ($similarity - $this->_minimumSimilarity)*$scaleFactor; + } + + $index->nextTerm(); + } + } + + $index->closeTermsStream(); + } + + if (count($this->_matches) == 0) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } else if (count($this->_matches) == 1) { + return new Zend_Search_Lucene_Search_Query_Term(reset($this->_matches)); + } else { + $rewrittenQuery = new Zend_Search_Lucene_Search_Query_Boolean(); + + array_multisort($this->_scores, SORT_DESC, SORT_NUMERIC, + $this->_termKeys, SORT_ASC, SORT_STRING, + $this->_matches); + + $termCount = 0; + foreach ($this->_matches as $id => $matchedTerm) { + $subquery = new Zend_Search_Lucene_Search_Query_Term($matchedTerm); + $subquery->setBoost($this->_scores[$id]); + + $rewrittenQuery->addSubquery($subquery); + + $termCount++; + if ($termCount >= self::MAX_CLAUSE_COUNT) { + break; + } + } + + return $rewrittenQuery; + } + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Return query terms + * + * @return array + * @throws Zend_Search_Lucene_Exception + */ + public function getQueryTerms() + { + if ($this->_matches === null) { + throw new Zend_Search_Lucene_Exception('Search has to be performed first to get matched terms'); + } + + return $this->_matches; + } + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + * @throws Zend_Search_Lucene_Exception + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @throws Zend_Search_Lucene_Exception + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + * @throws Zend_Search_Lucene_Exception + */ + public function matchedDocs() + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + * @throws Zend_Search_Lucene_Exception + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + $words = array(); + + foreach ($this->_matches as $term) { + $words[] = $term->text; + } + + $doc->highlight($words, $this->_getHighlightColor($colorIndex)); + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + // It's used only for query visualisation, so we don't care about characters escaping + return (($this->_term->field === null)? '' : $this->_term->field . ':') + . $this->_term->text . '~' + . (($this->_minimumSimilarity != self::DEFAULT_MIN_SIMILARITY)? round($this->_minimumSimilarity, 4) : ''); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Insignificant.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Insignificant.php new file mode 100644 index 0000000000000000000000000000000000000000..54706190ebc07cd916fbf3cc6c463c31c1fe1a06 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Insignificant.php @@ -0,0 +1,141 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Query */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** Zend_Search_Lucene_Search_Weight_Empty */ +require_once 'Zend/Search/Lucene/Search/Weight/Empty.php'; + + +/** + * The insignificant query returns empty result, but doesn't limit result set as a part of other queries + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_Insignificant extends Zend_Search_Lucene_Search_Query +{ + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + return $this; + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + return $this; + } + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + return new Zend_Search_Lucene_Search_Weight_Empty(); + } + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + // Do nothing + } + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + */ + public function matchedDocs() + { + return array(); + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + return 0; + } + + /** + * Return query terms + * + * @return array + */ + public function getQueryTerms() + { + return array(); + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + // Do nothing + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + return '<InsignificantQuery>'; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/MultiTerm.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/MultiTerm.php new file mode 100644 index 0000000000000000000000000000000000000000..74b27159f4926b65b14f8ef34629d81f55537c7f --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/MultiTerm.php @@ -0,0 +1,656 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Query */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** Zend_Search_Lucene_Search_Weight_MultiTerm */ +require_once 'Zend/Search/Lucene/Search/Weight/MultiTerm.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_MultiTerm extends Zend_Search_Lucene_Search_Query +{ + + /** + * Terms to find. + * Array of Zend_Search_Lucene_Index_Term + * + * @var array + */ + private $_terms = array(); + + /** + * Term signs. + * If true then term is required. + * If false then term is prohibited. + * If null then term is neither prohibited, nor required + * + * If array is null then all terms are required + * + * @var array + */ + private $_signs; + + /** + * Result vector. + * + * @var array + */ + private $_resVector = null; + + /** + * Terms positions vectors. + * Array of Arrays: + * term1Id => (docId => freq, ...) + * term2Id => (docId => freq, ...) + * + * @var array + */ + private $_termsFreqs = array(); + + + /** + * A score factor based on the fraction of all query terms + * that a document contains. + * float for conjunction queries + * array of float for non conjunction queries + * + * @var mixed + */ + private $_coord = null; + + + /** + * Terms weights + * array of Zend_Search_Lucene_Search_Weight + * + * @var array + */ + private $_weights = array(); + + + /** + * Class constructor. Create a new multi-term query object. + * + * if $signs array is omitted then all terms are required + * it differs from addTerm() behavior, but should never be used + * + * @param array $terms Array of Zend_Search_Lucene_Index_Term objects + * @param array $signs Array of signs. Sign is boolean|null. + */ + public function __construct($terms = null, $signs = null) + { + if (is_array($terms)) { + $this->_terms = $terms; + + $this->_signs = null; + // Check if all terms are required + if (is_array($signs)) { + foreach ($signs as $sign ) { + if ($sign !== true) { + $this->_signs = $signs; + break; + } + } + } + } + } + + + /** + * Add a $term (Zend_Search_Lucene_Index_Term) to this query. + * + * The sign is specified as: + * TRUE - term is required + * FALSE - term is prohibited + * NULL - term is neither prohibited, nor required + * + * @param Zend_Search_Lucene_Index_Term $term + * @param boolean|null $sign + * @return void + */ + public function addTerm(Zend_Search_Lucene_Index_Term $term, $sign = null) { + if ($sign !== true || $this->_signs !== null) { // Skip, if all terms are required + if ($this->_signs === null) { // Check, If all previous terms are required + $this->_signs = array(); + foreach ($this->_terms as $prevTerm) { + $this->_signs[] = true; + } + } + $this->_signs[] = $sign; + } + + $this->_terms[] = $term; + } + + + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + if (count($this->_terms) == 0) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } + + // Check, that all fields are qualified + $allQualified = true; + foreach ($this->_terms as $term) { + if ($term->field === null) { + $allQualified = false; + break; + } + } + + if ($allQualified) { + return $this; + } else { + /** transform multiterm query to boolean and apply rewrite() method to subqueries. */ + $query = new Zend_Search_Lucene_Search_Query_Boolean(); + $query->setBoost($this->getBoost()); + + foreach ($this->_terms as $termId => $term) { + $subquery = new Zend_Search_Lucene_Search_Query_Term($term); + + $query->addSubquery($subquery->rewrite($index), + ($this->_signs === null)? true : $this->_signs[$termId]); + } + + return $query; + } + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + $terms = $this->_terms; + $signs = $this->_signs; + + foreach ($terms as $id => $term) { + if (!$index->hasTerm($term)) { + if ($signs === null || $signs[$id] === true) { + // Term is required + return new Zend_Search_Lucene_Search_Query_Empty(); + } else { + // Term is optional or prohibited + // Remove it from terms and signs list + unset($terms[$id]); + unset($signs[$id]); + } + } + } + + // Check if all presented terms are prohibited + $allProhibited = true; + if ($signs === null) { + $allProhibited = false; + } else { + foreach ($signs as $sign) { + if ($sign !== false) { + $allProhibited = false; + break; + } + } + } + if ($allProhibited) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } + + /** + * @todo make an optimization for repeated terms + * (they may have different signs) + */ + + if (count($terms) == 1) { + // It's already checked, that it's not a prohibited term + + // It's one term query with one required or optional element + $optimizedQuery = new Zend_Search_Lucene_Search_Query_Term(reset($terms)); + $optimizedQuery->setBoost($this->getBoost()); + + return $optimizedQuery; + } + + if (count($terms) == 0) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } + + $optimizedQuery = new Zend_Search_Lucene_Search_Query_MultiTerm($terms, $signs); + $optimizedQuery->setBoost($this->getBoost()); + return $optimizedQuery; + } + + + /** + * Returns query term + * + * @return array + */ + public function getTerms() + { + return $this->_terms; + } + + + /** + * Return terms signs + * + * @return array + */ + public function getSigns() + { + return $this->_signs; + } + + + /** + * Set weight for specified term + * + * @param integer $num + * @param Zend_Search_Lucene_Search_Weight_Term $weight + */ + public function setWeight($num, $weight) + { + $this->_weights[$num] = $weight; + } + + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + $this->_weight = new Zend_Search_Lucene_Search_Weight_MultiTerm($this, $reader); + return $this->_weight; + } + + + /** + * Calculate result vector for Conjunction query + * (like '+something +another') + * + * @param Zend_Search_Lucene_Interface $reader + */ + private function _calculateConjunctionResult(Zend_Search_Lucene_Interface $reader) + { + $this->_resVector = null; + + if (count($this->_terms) == 0) { + $this->_resVector = array(); + } + + // Order terms by selectivity + $docFreqs = array(); + $ids = array(); + foreach ($this->_terms as $id => $term) { + $docFreqs[] = $reader->docFreq($term); + $ids[] = $id; // Used to keep original order for terms with the same selectivity and omit terms comparison + } + array_multisort($docFreqs, SORT_ASC, SORT_NUMERIC, + $ids, SORT_ASC, SORT_NUMERIC, + $this->_terms); + + $docsFilter = new Zend_Search_Lucene_Index_DocsFilter(); + foreach ($this->_terms as $termId => $term) { + $termDocs = $reader->termDocs($term, $docsFilter); + } + // Treat last retrieved docs vector as a result set + // (filter collects data for other terms) + $this->_resVector = array_flip($termDocs); + + foreach ($this->_terms as $termId => $term) { + $this->_termsFreqs[$termId] = $reader->termFreqs($term, $docsFilter); + } + + // ksort($this->_resVector, SORT_NUMERIC); + // Docs are returned ordered. Used algorithms doesn't change elements order. + } + + + /** + * Calculate result vector for non Conjunction query + * (like '+something -another') + * + * @param Zend_Search_Lucene_Interface $reader + */ + private function _calculateNonConjunctionResult(Zend_Search_Lucene_Interface $reader) + { + $requiredVectors = array(); + $requiredVectorsSizes = array(); + $requiredVectorsIds = array(); // is used to prevent arrays comparison + + $optional = array(); + $prohibited = array(); + + foreach ($this->_terms as $termId => $term) { + $termDocs = array_flip($reader->termDocs($term)); + + if ($this->_signs[$termId] === true) { + // required + $requiredVectors[] = $termDocs; + $requiredVectorsSizes[] = count($termDocs); + $requiredVectorsIds[] = $termId; + } elseif ($this->_signs[$termId] === false) { + // prohibited + // array union + $prohibited += $termDocs; + } else { + // neither required, nor prohibited + // array union + $optional += $termDocs; + } + + $this->_termsFreqs[$termId] = $reader->termFreqs($term); + } + + // sort resvectors in order of subquery cardinality increasing + array_multisort($requiredVectorsSizes, SORT_ASC, SORT_NUMERIC, + $requiredVectorsIds, SORT_ASC, SORT_NUMERIC, + $requiredVectors); + + $required = null; + foreach ($requiredVectors as $nextResVector) { + if($required === null) { + $required = $nextResVector; + } else { + //$required = array_intersect_key($required, $nextResVector); + + /** + * This code is used as workaround for array_intersect_key() slowness problem. + */ + $updatedVector = array(); + foreach ($required as $id => $value) { + if (isset($nextResVector[$id])) { + $updatedVector[$id] = $value; + } + } + $required = $updatedVector; + } + + if (count($required) == 0) { + // Empty result set, we don't need to check other terms + break; + } + } + + if ($required !== null) { + $this->_resVector = $required; + } else { + $this->_resVector = $optional; + } + + if (count($prohibited) != 0) { + // $this->_resVector = array_diff_key($this->_resVector, $prohibited); + + /** + * This code is used as workaround for array_diff_key() slowness problem. + */ + if (count($this->_resVector) < count($prohibited)) { + $updatedVector = $this->_resVector; + foreach ($this->_resVector as $id => $value) { + if (isset($prohibited[$id])) { + unset($updatedVector[$id]); + } + } + $this->_resVector = $updatedVector; + } else { + $updatedVector = $this->_resVector; + foreach ($prohibited as $id => $value) { + unset($updatedVector[$id]); + } + $this->_resVector = $updatedVector; + } + } + + ksort($this->_resVector, SORT_NUMERIC); + } + + + /** + * Score calculator for conjunction queries (all terms are required) + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function _conjunctionScore($docId, Zend_Search_Lucene_Interface $reader) + { + if ($this->_coord === null) { + $this->_coord = $reader->getSimilarity()->coord(count($this->_terms), + count($this->_terms) ); + } + + $score = 0.0; + + foreach ($this->_terms as $termId => $term) { + /** + * We don't need to check that term freq is not 0 + * Score calculation is performed only for matched docs + */ + $score += $reader->getSimilarity()->tf($this->_termsFreqs[$termId][$docId]) * + $this->_weights[$termId]->getValue() * + $reader->norm($docId, $term->field); + } + + return $score * $this->_coord * $this->getBoost(); + } + + + /** + * Score calculator for non conjunction queries (not all terms are required) + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function _nonConjunctionScore($docId, $reader) + { + if ($this->_coord === null) { + $this->_coord = array(); + + $maxCoord = 0; + foreach ($this->_signs as $sign) { + if ($sign !== false /* not prohibited */) { + $maxCoord++; + } + } + + for ($count = 0; $count <= $maxCoord; $count++) { + $this->_coord[$count] = $reader->getSimilarity()->coord($count, $maxCoord); + } + } + + $score = 0.0; + $matchedTerms = 0; + foreach ($this->_terms as $termId=>$term) { + // Check if term is + if ($this->_signs[$termId] !== false && // not prohibited + isset($this->_termsFreqs[$termId][$docId]) // matched + ) { + $matchedTerms++; + + /** + * We don't need to check that term freq is not 0 + * Score calculation is performed only for matched docs + */ + $score += + $reader->getSimilarity()->tf($this->_termsFreqs[$termId][$docId]) * + $this->_weights[$termId]->getValue() * + $reader->norm($docId, $term->field); + } + } + + return $score * $this->_coord[$matchedTerms] * $this->getBoost(); + } + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + if ($this->_signs === null) { + $this->_calculateConjunctionResult($reader); + } else { + $this->_calculateNonConjunctionResult($reader); + } + + // Initialize weight if it's not done yet + $this->_initWeight($reader); + } + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + */ + public function matchedDocs() + { + return $this->_resVector; + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + if (isset($this->_resVector[$docId])) { + if ($this->_signs === null) { + return $this->_conjunctionScore($docId, $reader); + } else { + return $this->_nonConjunctionScore($docId, $reader); + } + } else { + return 0; + } + } + + /** + * Return query terms + * + * @return array + */ + public function getQueryTerms() + { + if ($this->_signs === null) { + return $this->_terms; + } + + $terms = array(); + + foreach ($this->_signs as $id => $sign) { + if ($sign !== false) { + $terms[] = $this->_terms[$id]; + } + } + + return $terms; + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + $words = array(); + + if ($this->_signs === null) { + foreach ($this->_terms as $term) { + $words[] = $term->text; + } + } else { + foreach ($this->_signs as $id => $sign) { + if ($sign !== false) { + $words[] = $this->_terms[$id]->text; + } + } + } + + $doc->highlight($words, $this->_getHighlightColor($colorIndex)); + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + // It's used only for query visualisation, so we don't care about characters escaping + + $query = ''; + + foreach ($this->_terms as $id => $term) { + if ($id != 0) { + $query .= ' '; + } + + if ($this->_signs === null || $this->_signs[$id] === true) { + $query .= '+'; + } else if ($this->_signs[$id] === false) { + $query .= '-'; + } + + if ($term->field !== null) { + $query .= $term->field . ':'; + } + $query .= $term->text; + } + + if ($this->getBoost() != 1) { + $query = '(' . $query . ')^' . $this->getBoost(); + } + + return $query; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Phrase.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Phrase.php new file mode 100644 index 0000000000000000000000000000000000000000..a5bce0cdabe45f8a434609047034db7eb07edbb6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Phrase.php @@ -0,0 +1,568 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * Zend_Search_Lucene_Search_Query + */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** + * Zend_Search_Lucene_Search_Weight_MultiTerm + */ +require_once 'Zend/Search/Lucene/Search/Weight/Phrase.php'; + + +/** + * A Query that matches documents containing a particular sequence of terms. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_Phrase extends Zend_Search_Lucene_Search_Query +{ + /** + * Terms to find. + * Array of Zend_Search_Lucene_Index_Term objects. + * + * @var array + */ + private $_terms; + + /** + * Term positions (relative positions of terms within the phrase). + * Array of integers + * + * @var array + */ + private $_offsets; + + /** + * Sets the number of other words permitted between words in query phrase. + * If zero, then this is an exact phrase search. For larger values this works + * like a WITHIN or NEAR operator. + * + * The slop is in fact an edit-distance, where the units correspond to + * moves of terms in the query phrase out of position. For example, to switch + * the order of two words requires two moves (the first move places the words + * atop one another), so to permit re-orderings of phrases, the slop must be + * at least two. + * More exact matches are scored higher than sloppier matches, thus search + * results are sorted by exactness. + * + * The slop is zero by default, requiring exact matches. + * + * @var integer + */ + private $_slop; + + /** + * Result vector. + * + * @var array + */ + private $_resVector = null; + + /** + * Terms positions vectors. + * Array of Arrays: + * term1Id => (docId => array( pos1, pos2, ... ), ...) + * term2Id => (docId => array( pos1, pos2, ... ), ...) + * + * @var array + */ + private $_termsPositions = array(); + + /** + * Class constructor. Create a new prase query. + * + * @param string $field Field to search. + * @param array $terms Terms to search Array of strings. + * @param array $offsets Relative term positions. Array of integers. + * @throws Zend_Search_Lucene_Exception + */ + public function __construct($terms = null, $offsets = null, $field = null) + { + $this->_slop = 0; + + if (is_array($terms)) { + $this->_terms = array(); + foreach ($terms as $termId => $termText) { + $this->_terms[$termId] = ($field !== null)? new Zend_Search_Lucene_Index_Term($termText, $field): + new Zend_Search_Lucene_Index_Term($termText); + } + } else if ($terms === null) { + $this->_terms = array(); + } else { + throw new Zend_Search_Lucene_Exception('terms argument must be array of strings or null'); + } + + if (is_array($offsets)) { + if (count($this->_terms) != count($offsets)) { + throw new Zend_Search_Lucene_Exception('terms and offsets arguments must have the same size.'); + } + $this->_offsets = $offsets; + } else if ($offsets === null) { + $this->_offsets = array(); + foreach ($this->_terms as $termId => $term) { + $position = count($this->_offsets); + $this->_offsets[$termId] = $position; + } + } else { + throw new Zend_Search_Lucene_Exception('offsets argument must be array of strings or null'); + } + } + + /** + * Set slop + * + * @param integer $slop + */ + public function setSlop($slop) + { + $this->_slop = $slop; + } + + + /** + * Get slop + * + * @return integer + */ + public function getSlop() + { + return $this->_slop; + } + + + /** + * Adds a term to the end of the query phrase. + * The relative position of the term is specified explicitly or the one immediately + * after the last term added. + * + * @param Zend_Search_Lucene_Index_Term $term + * @param integer $position + */ + public function addTerm(Zend_Search_Lucene_Index_Term $term, $position = null) { + if ((count($this->_terms) != 0)&&(end($this->_terms)->field != $term->field)) { + throw new Zend_Search_Lucene_Exception('All phrase terms must be in the same field: ' . + $term->field . ':' . $term->text); + } + + $this->_terms[] = $term; + if ($position !== null) { + $this->_offsets[] = $position; + } else if (count($this->_offsets) != 0) { + $this->_offsets[] = end($this->_offsets) + 1; + } else { + $this->_offsets[] = 0; + } + } + + + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + if (count($this->_terms) == 0) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } else if ($this->_terms[0]->field !== null) { + return $this; + } else { + $query = new Zend_Search_Lucene_Search_Query_Boolean(); + $query->setBoost($this->getBoost()); + + foreach ($index->getFieldNames(true) as $fieldName) { + $subquery = new Zend_Search_Lucene_Search_Query_Phrase(); + $subquery->setSlop($this->getSlop()); + + foreach ($this->_terms as $termId => $term) { + $qualifiedTerm = new Zend_Search_Lucene_Index_Term($term->text, $fieldName); + + $subquery->addTerm($qualifiedTerm, $this->_offsets[$termId]); + } + + $query->addSubquery($subquery); + } + + return $query; + } + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + // Check, that index contains all phrase terms + foreach ($this->_terms as $term) { + if (!$index->hasTerm($term)) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } + } + + if (count($this->_terms) == 1) { + // It's one term query + $optimizedQuery = new Zend_Search_Lucene_Search_Query_Term(reset($this->_terms)); + $optimizedQuery->setBoost($this->getBoost()); + + return $optimizedQuery; + } + + if (count($this->_terms) == 0) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } + + + return $this; + } + + /** + * Returns query term + * + * @return array + */ + public function getTerms() + { + return $this->_terms; + } + + + /** + * Set weight for specified term + * + * @param integer $num + * @param Zend_Search_Lucene_Search_Weight_Term $weight + */ + public function setWeight($num, $weight) + { + $this->_weights[$num] = $weight; + } + + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + $this->_weight = new Zend_Search_Lucene_Search_Weight_Phrase($this, $reader); + return $this->_weight; + } + + + /** + * Score calculator for exact phrase queries (terms sequence is fixed) + * + * @param integer $docId + * @return float + */ + public function _exactPhraseFreq($docId) + { + $freq = 0; + + // Term Id with lowest cardinality + $lowCardTermId = null; + + // Calculate $lowCardTermId + foreach ($this->_terms as $termId => $term) { + if ($lowCardTermId === null || + count($this->_termsPositions[$termId][$docId]) < + count($this->_termsPositions[$lowCardTermId][$docId]) ) { + $lowCardTermId = $termId; + } + } + + // Walk through positions of the term with lowest cardinality + foreach ($this->_termsPositions[$lowCardTermId][$docId] as $lowCardPos) { + // We expect phrase to be found + $freq++; + + // Walk through other terms + foreach ($this->_terms as $termId => $term) { + if ($termId != $lowCardTermId) { + $expectedPosition = $lowCardPos + + ($this->_offsets[$termId] - + $this->_offsets[$lowCardTermId]); + + if (!in_array($expectedPosition, $this->_termsPositions[$termId][$docId])) { + $freq--; // Phrase wasn't found. + break; + } + } + } + } + + return $freq; + } + + /** + * Score calculator for sloppy phrase queries (terms sequence is fixed) + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function _sloppyPhraseFreq($docId, Zend_Search_Lucene_Interface $reader) + { + $freq = 0; + + $phraseQueue = array(); + $phraseQueue[0] = array(); // empty phrase + $lastTerm = null; + + // Walk through the terms to create phrases. + foreach ($this->_terms as $termId => $term) { + $queueSize = count($phraseQueue); + $firstPass = true; + + // Walk through the term positions. + // Each term position produces a set of phrases. + foreach ($this->_termsPositions[$termId][$docId] as $termPosition ) { + if ($firstPass) { + for ($count = 0; $count < $queueSize; $count++) { + $phraseQueue[$count][$termId] = $termPosition; + } + } else { + for ($count = 0; $count < $queueSize; $count++) { + if ($lastTerm !== null && + abs( $termPosition - $phraseQueue[$count][$lastTerm] - + ($this->_offsets[$termId] - $this->_offsets[$lastTerm])) > $this->_slop) { + continue; + } + + $newPhraseId = count($phraseQueue); + $phraseQueue[$newPhraseId] = $phraseQueue[$count]; + $phraseQueue[$newPhraseId][$termId] = $termPosition; + } + + } + + $firstPass = false; + } + $lastTerm = $termId; + } + + + foreach ($phraseQueue as $phrasePos) { + $minDistance = null; + + for ($shift = -$this->_slop; $shift <= $this->_slop; $shift++) { + $distance = 0; + $start = reset($phrasePos) - reset($this->_offsets) + $shift; + + foreach ($this->_terms as $termId => $term) { + $distance += abs($phrasePos[$termId] - $this->_offsets[$termId] - $start); + + if($distance > $this->_slop) { + break; + } + } + + if ($minDistance === null || $distance < $minDistance) { + $minDistance = $distance; + } + } + + if ($minDistance <= $this->_slop) { + $freq += $reader->getSimilarity()->sloppyFreq($minDistance); + } + } + + return $freq; + } + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + $this->_resVector = null; + + if (count($this->_terms) == 0) { + $this->_resVector = array(); + } + + $resVectors = array(); + $resVectorsSizes = array(); + $resVectorsIds = array(); // is used to prevent arrays comparison + foreach ($this->_terms as $termId => $term) { + $resVectors[] = array_flip($reader->termDocs($term)); + $resVectorsSizes[] = count(end($resVectors)); + $resVectorsIds[] = $termId; + + $this->_termsPositions[$termId] = $reader->termPositions($term); + } + // sort resvectors in order of subquery cardinality increasing + array_multisort($resVectorsSizes, SORT_ASC, SORT_NUMERIC, + $resVectorsIds, SORT_ASC, SORT_NUMERIC, + $resVectors); + + foreach ($resVectors as $nextResVector) { + if($this->_resVector === null) { + $this->_resVector = $nextResVector; + } else { + //$this->_resVector = array_intersect_key($this->_resVector, $nextResVector); + + /** + * This code is used as workaround for array_intersect_key() slowness problem. + */ + $updatedVector = array(); + foreach ($this->_resVector as $id => $value) { + if (isset($nextResVector[$id])) { + $updatedVector[$id] = $value; + } + } + $this->_resVector = $updatedVector; + } + + if (count($this->_resVector) == 0) { + // Empty result set, we don't need to check other terms + break; + } + } + + // ksort($this->_resVector, SORT_NUMERIC); + // Docs are returned ordered. Used algorithm doesn't change elements order. + + // Initialize weight if it's not done yet + $this->_initWeight($reader); + } + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + */ + public function matchedDocs() + { + return $this->_resVector; + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + if (isset($this->_resVector[$docId])) { + if ($this->_slop == 0) { + $freq = $this->_exactPhraseFreq($docId); + } else { + $freq = $this->_sloppyPhraseFreq($docId, $reader); + } + + if ($freq != 0) { + $tf = $reader->getSimilarity()->tf($freq); + $weight = $this->_weight->getValue(); + $norm = $reader->norm($docId, reset($this->_terms)->field); + + return $tf * $weight * $norm * $this->getBoost(); + } + + // Included in result, but culculated freq is zero + return 0; + } else { + return 0; + } + } + + /** + * Return query terms + * + * @return array + */ + public function getQueryTerms() + { + return $this->_terms; + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + $words = array(); + foreach ($this->_terms as $term) { + $words[] = $term->text; + } + + $doc->highlight($words, $this->_getHighlightColor($colorIndex)); + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + // It's used only for query visualisation, so we don't care about characters escaping + + $query = ''; + + if (isset($this->_terms[0]) && $this->_terms[0]->field !== null) { + $query .= $this->_terms[0]->field . ':'; + } + + $query .= '"'; + + foreach ($this->_terms as $id => $term) { + if ($id != 0) { + $query .= ' '; + } + $query .= $term->text; + } + + $query .= '"'; + + if ($this->_slop != 0) { + $query .= '~' . $this->_slop; + } + + return $query; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Range.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Range.php new file mode 100644 index 0000000000000000000000000000000000000000..0274da8e826379e31f72ad232a6a89d2d4bc65d5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Range.php @@ -0,0 +1,332 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Query */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** Zend_Search_Lucene_Search_Query_MultiTerm */ +require_once 'Zend/Search/Lucene/Search/Query/MultiTerm.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_Range extends Zend_Search_Lucene_Search_Query +{ + /** + * Lower term. + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_lowerTerm; + + /** + * Upper term. + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_upperTerm; + + + /** + * Search field + * + * @var string + */ + private $_field; + + /** + * Inclusive + * + * @var boolean + */ + private $_inclusive; + + /** + * Matched terms. + * + * Matched terms list. + * It's filled during the search (rewrite operation) and may be used for search result + * post-processing + * + * Array of Zend_Search_Lucene_Index_Term objects + * + * @var array + */ + private $_matches; + + + /** + * Zend_Search_Lucene_Search_Query_Range constructor. + * + * @param Zend_Search_Lucene_Index_Term|null $lowerTerm + * @param Zend_Search_Lucene_Index_Term|null $upperTerm + * @param boolean $inclusive + * @throws Zend_Search_Lucene_Exception + */ + public function __construct($lowerTerm, $upperTerm, $inclusive) + { + if ($lowerTerm === null && $upperTerm === null) { + throw new Zend_Search_Lucene_Exception('At least one term must be non-null'); + } + if ($lowerTerm !== null && $upperTerm !== null && $lowerTerm->field != $upperTerm->field) { + throw new Zend_Search_Lucene_Exception('Both terms must be for the same field'); + } + + $this->_field = ($lowerTerm !== null)? $lowerTerm->field : $upperTerm->field; + $this->_lowerTerm = $lowerTerm; + $this->_upperTerm = $upperTerm; + $this->_inclusive = $inclusive; + } + + /** + * Get query field name + * + * @return string|null + */ + public function getField() + { + return $this->_field; + } + + /** + * Get lower term + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function getLowerTerm() + { + return $this->_lowerTerm; + } + + /** + * Get upper term + * + * @return Zend_Search_Lucene_Index_Term|null + */ + public function getUpperTerm() + { + return $this->_upperTerm; + } + + /** + * Get upper term + * + * @return boolean + */ + public function isInclusive() + { + return $this->_inclusive; + } + + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + $this->_matches = array(); + + if ($this->_field === null) { + // Search through all fields + $fields = $index->getFieldNames(true /* indexed fields list */); + } else { + $fields = array($this->_field); + } + + foreach ($fields as $field) { + $index->resetTermsStream(); + + if ($this->_lowerTerm !== null) { + $lowerTerm = new Zend_Search_Lucene_Index_Term($this->_lowerTerm->text, $field); + + $index->skipTo($lowerTerm); + + if (!$this->_inclusive && + $index->currentTerm() == $lowerTerm) { + // Skip lower term + $index->nextTerm(); + } + } else { + $index->skipTo(new Zend_Search_Lucene_Index_Term('', $field)); + } + + + if ($this->_upperTerm !== null) { + // Walk up to the upper term + $upperTerm = new Zend_Search_Lucene_Index_Term($this->_upperTerm->text, $field); + + while ($index->currentTerm() !== null && + $index->currentTerm()->field == $field && + $index->currentTerm()->text < $upperTerm->text) { + $this->_matches[] = $index->currentTerm(); + $index->nextTerm(); + } + + if ($this->_inclusive && $index->currentTerm() == $upperTerm) { + // Include upper term into result + $this->_matches[] = $upperTerm; + } + } else { + // Walk up to the end of field data + while ($index->currentTerm() !== null && $index->currentTerm()->field == $field) { + $this->_matches[] = $index->currentTerm(); + $index->nextTerm(); + } + } + + $index->closeTermsStream(); + } + + if (count($this->_matches) == 0) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } else if (count($this->_matches) == 1) { + return new Zend_Search_Lucene_Search_Query_Term(reset($this->_matches)); + } else { + $rewrittenQuery = new Zend_Search_Lucene_Search_Query_MultiTerm(); + + foreach ($this->_matches as $matchedTerm) { + $rewrittenQuery->addTerm($matchedTerm); + } + + return $rewrittenQuery; + } + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Return query terms + * + * @return array + * @throws Zend_Search_Lucene_Exception + */ + public function getQueryTerms() + { + if ($this->_matches === null) { + throw new Zend_Search_Lucene_Exception('Search has to be performed first to get matched terms'); + } + + return $this->_matches; + } + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + * @throws Zend_Search_Lucene_Exception + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); + } + + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @throws Zend_Search_Lucene_Exception + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + * @throws Zend_Search_Lucene_Exception + */ + public function matchedDocs() + { + throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + * @throws Zend_Search_Lucene_Exception + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + $words = array(); + + foreach ($this->_matches as $term) { + $words[] = $term->text; + } + + $doc->highlight($words, $this->_getHighlightColor($colorIndex)); + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + // It's used only for query visualisation, so we don't care about characters escaping + return (($this->_field === null)? '' : $this->_field . ':') + . (($this->_inclusive)? '[' : '{') + . (($this->_lowerTerm !== null)? $this->_lowerTerm->text : 'null') + . ' TO ' + . (($this->_upperTerm !== null)? $this->_upperTerm->text : 'null') + . (($this->_inclusive)? ']' : '}'); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Term.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Term.php new file mode 100644 index 0000000000000000000000000000000000000000..07c5065d0ec1616a8a9b628d760e5e01ae3f56c0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Term.php @@ -0,0 +1,225 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Query */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** Zend_Search_Lucene_Search_Weight_Term */ +require_once 'Zend/Search/Lucene/Search/Weight/Term.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_Term extends Zend_Search_Lucene_Search_Query +{ + /** + * Term to find. + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_term; + + /** + * Documents vector. + * + * @var array + */ + private $_docVector = null; + + /** + * Term freqs vector. + * array(docId => freq, ...) + * + * @var array + */ + private $_termFreqs; + + + /** + * Zend_Search_Lucene_Search_Query_Term constructor + * + * @param Zend_Search_Lucene_Index_Term $term + * @param boolean $sign + */ + public function __construct(Zend_Search_Lucene_Index_Term $term) + { + $this->_term = $term; + } + + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + if ($this->_term->field != null) { + return $this; + } else { + $query = new Zend_Search_Lucene_Search_Query_MultiTerm(); + $query->setBoost($this->getBoost()); + + foreach ($index->getFieldNames(true) as $fieldName) { + $term = new Zend_Search_Lucene_Index_Term($this->_term->text, $fieldName); + + $query->addTerm($term); + } + + return $query->rewrite($index); + } + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + // Check, that index contains specified term + if (!$index->hasTerm($this->_term)) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } + + return $this; + } + + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + $this->_weight = new Zend_Search_Lucene_Search_Weight_Term($this->_term, $this, $reader); + return $this->_weight; + } + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + $this->_docVector = array_flip($reader->termDocs($this->_term, $docsFilter)); + $this->_termFreqs = $reader->termFreqs($this->_term, $docsFilter); + + // Initialize weight if it's not done yet + $this->_initWeight($reader); + } + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + */ + public function matchedDocs() + { + return $this->_docVector; + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + if (isset($this->_docVector[$docId])) { + return $reader->getSimilarity()->tf($this->_termFreqs[$docId]) * + $this->_weight->getValue() * + $reader->norm($docId, $this->_term->field) * + $this->getBoost(); + } else { + return 0; + } + } + + /** + * Return query terms + * + * @return array + */ + public function getQueryTerms() + { + return array($this->_term); + } + + /** + * Return query term + * + * @return Zend_Search_Lucene_Index_Term + */ + public function getTerm() + { + return $this->_term; + } + + /** + * Returns query term + * + * @return array + */ + public function getTerms() + { + return $this->_terms; + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + $doc->highlight($this->_term->text, $this->_getHighlightColor($colorIndex)); + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + // It's used only for query visualisation, so we don't care about characters escaping + return (($this->_term->field === null)? '':$this->_term->field . ':') . $this->_term->text; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Wildcard.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Wildcard.php new file mode 100644 index 0000000000000000000000000000000000000000..97decfff3efdabff8e950ee18b9393284a207a9b --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Query/Wildcard.php @@ -0,0 +1,298 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Query */ +require_once 'Zend/Search/Lucene/Search/Query.php'; + +/** Zend_Search_Lucene_Search_Query_MultiTerm */ +require_once 'Zend/Search/Lucene/Search/Query/MultiTerm.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Query_Wildcard extends Zend_Search_Lucene_Search_Query +{ + /** + * Search pattern. + * + * Field has to be fully specified or has to be null + * Text may contain '*' or '?' symbols + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_pattern; + + /** + * Matched terms. + * + * Matched terms list. + * It's filled during the search (rewrite operation) and may be used for search result + * post-processing + * + * Array of Zend_Search_Lucene_Index_Term objects + * + * @var array + */ + private $_matches = null; + + /** + * Zend_Search_Lucene_Search_Query_Wildcard constructor. + * + * @param Zend_Search_Lucene_Index_Term $pattern + */ + public function __construct(Zend_Search_Lucene_Index_Term $pattern) + { + $this->_pattern = $pattern; + } + + /** + * Get terms prefix + * + * @param string $word + * @return string + */ + private static function _getPrefix($word) + { + $questionMarkPosition = strpos($word, '?'); + $astrericPosition = strpos($word, '*'); + + if ($questionMarkPosition !== false) { + if ($astrericPosition !== false) { + return substr($word, 0, min($questionMarkPosition, $astrericPosition)); + } + + return substr($word, 0, $questionMarkPosition); + } else if ($astrericPosition !== false) { + return substr($word, 0, $astrericPosition); + } + + return $word; + } + + /** + * Re-write query into primitive queries in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function rewrite(Zend_Search_Lucene_Interface $index) + { + $this->_matches = array(); + + if ($this->_pattern->field === null) { + // Search through all fields + $fields = $index->getFieldNames(true /* indexed fields list */); + } else { + $fields = array($this->_pattern->field); + } + + $prefix = self::_getPrefix($this->_pattern->text); + $prefixLength = strlen($prefix); + $matchExpression = '/^' . str_replace(array('\\?', '\\*'), array('.', '.*') , preg_quote($this->_pattern->text, '/')) . '$/'; + + /** @todo check for PCRE unicode support may be performed through Zend_Environment in some future */ + if (@preg_match('/\pL/u', 'a') == 1) { + // PCRE unicode support is turned on + // add Unicode modifier to the match expression + $matchExpression .= 'u'; + } + + + foreach ($fields as $field) { + $index->resetTermsStream(); + + if ($prefix != '') { + $index->skipTo(new Zend_Search_Lucene_Index_Term($prefix, $field)); + + while ($index->currentTerm() !== null && + $index->currentTerm()->field == $field && + substr($index->currentTerm()->text, 0, $prefixLength) == $prefix) { + if (preg_match($matchExpression, $index->currentTerm()->text) === 1) { + $this->_matches[] = $index->currentTerm(); + } + + $index->nextTerm(); + } + } else { + $index->skipTo(new Zend_Search_Lucene_Index_Term('', $field)); + + while ($index->currentTerm() !== null && $index->currentTerm()->field == $field) { + if (preg_match($matchExpression, $index->currentTerm()->text) === 1) { + $this->_matches[] = $index->currentTerm(); + } + + $index->nextTerm(); + } + } + + $index->closeTermsStream(); + } + + if (count($this->_matches) == 0) { + return new Zend_Search_Lucene_Search_Query_Empty(); + } else if (count($this->_matches) == 1) { + return new Zend_Search_Lucene_Search_Query_Term(reset($this->_matches)); + } else { + $rewrittenQuery = new Zend_Search_Lucene_Search_Query_MultiTerm(); + + foreach ($this->_matches as $matchedTerm) { + $rewrittenQuery->addTerm($matchedTerm); + } + + return $rewrittenQuery; + } + } + + /** + * Optimize query in the context of specified index + * + * @param Zend_Search_Lucene_Interface $index + * @return Zend_Search_Lucene_Search_Query + */ + public function optimize(Zend_Search_Lucene_Interface $index) + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + + /** + * Returns query pattern + * + * @return Zend_Search_Lucene_Index_Term + */ + public function getPattern() + { + return $this->_pattern; + } + + + /** + * Return query terms + * + * @return array + * @throws Zend_Search_Lucene_Exception + */ + public function getQueryTerms() + { + if ($this->_matches === null) { + throw new Zend_Search_Lucene_Exception('Search has to be performed first to get matched terms'); + } + + return $this->_matches; + } + + /** + * Constructs an appropriate Weight implementation for this query. + * + * @param Zend_Search_Lucene_Interface $reader + * @return Zend_Search_Lucene_Search_Weight + * @throws Zend_Search_Lucene_Exception + */ + public function createWeight(Zend_Search_Lucene_Interface $reader) + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + + /** + * Execute query in context of index reader + * It also initializes necessary internal structures + * + * @param Zend_Search_Lucene_Interface $reader + * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter + * @throws Zend_Search_Lucene_Exception + */ + public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Get document ids likely matching the query + * + * It's an array with document ids as keys (performance considerations) + * + * @return array + * @throws Zend_Search_Lucene_Exception + */ + public function matchedDocs() + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Score specified document + * + * @param integer $docId + * @param Zend_Search_Lucene_Interface $reader + * @return float + * @throws Zend_Search_Lucene_Exception + */ + public function score($docId, Zend_Search_Lucene_Interface $reader) + { + throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); + } + + /** + * Highlight query terms + * + * @param integer &$colorIndex + * @param Zend_Search_Lucene_Document_Html $doc + */ + public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex) + { + $words = array(); + + $matchExpression = '/^' . str_replace(array('\\?', '\\*'), array('.', '.*') , preg_quote($this->_pattern->text, '/')) . '$/'; + if (@preg_match('/\pL/u', 'a') == 1) { + // PCRE unicode support is turned on + // add Unicode modifier to the match expression + $matchExpression .= 'u'; + } + + $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($doc->getFieldUtf8Value('body'), 'UTF-8'); + foreach ($tokens as $token) { + if (preg_match($matchExpression, $token->getTermText()) === 1) { + $words[] = $token->getTermText(); + } + } + + $doc->highlight($words, $this->_getHighlightColor($colorIndex)); + } + + /** + * Print a query + * + * @return string + */ + public function __toString() + { + // It's used only for query visualisation, so we don't care about characters escaping + return (($this->_pattern->field === null)? '' : $this->_pattern->field . ':') . $this->_pattern->text; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry.php new file mode 100644 index 0000000000000000000000000000000000000000..bba9ffa41ba26221f312d5070dcf1c801713e151 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry.php @@ -0,0 +1,87 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Index_Term */ +require_once 'Zend/Search/Lucene/Index/Term.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Search_QueryEntry_Term */ +require_once 'Zend/Search/Lucene/Search/QueryEntry/Term.php'; + +/** Zend_Search_Lucene_Search_QueryEntry_Phrase */ +require_once 'Zend/Search/Lucene/Search/QueryEntry/Phrase.php'; + +/** Zend_Search_Lucene_Search_QueryEntry_Subquery */ +require_once 'Zend/Search/Lucene/Search/QueryEntry/Subquery.php'; + + +/** Zend_Search_Lucene_Search_QueryParserException */ +require_once 'Zend/Search/Lucene/Search/QueryParserException.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Search_QueryEntry +{ + /** + * Query entry boost factor + * + * @var float + */ + protected $_boost = 1.0; + + + /** + * Process modifier ('~') + * + * @param mixed $parameter + */ + abstract public function processFuzzyProximityModifier($parameter = null); + + + /** + * Transform entry to a subquery + * + * @param string $encoding + * @return Zend_Search_Lucene_Search_Query + */ + abstract public function getQuery($encoding); + + /** + * Boost query entry + * + * @param float $boostFactor + */ + public function boost($boostFactor) + { + $this->_boost *= $boostFactor; + } + + +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Phrase.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Phrase.php new file mode 100644 index 0000000000000000000000000000000000000000..cbecbe548f88420222368b31142d40036411e5dd --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Phrase.php @@ -0,0 +1,149 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Index_Term */ +require_once 'Zend/Search/Lucene/Index/Term.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Search_QueryEntry */ +require_once 'Zend/Search/Lucene/Search/QueryEntry.php'; + +/** Zend_Search_Lucene_Search_QueryParserException */ +require_once 'Zend/Search/Lucene/Search/QueryParserException.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer.php'; + + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_QueryEntry_Phrase extends Zend_Search_Lucene_Search_QueryEntry +{ + /** + * Phrase value + * + * @var string + */ + private $_phrase; + + /** + * Field + * + * @var string|null + */ + private $_field; + + + /** + * Proximity phrase query + * + * @var boolean + */ + private $_proximityQuery = false; + + /** + * Words distance, used for proximiti queries + * + * @var integer + */ + private $_wordsDistance = 0; + + + /** + * Object constractor + * + * @param string $phrase + * @param string $field + */ + public function __construct($phrase, $field) + { + $this->_phrase = $phrase; + $this->_field = $field; + } + + /** + * Process modifier ('~') + * + * @param mixed $parameter + */ + public function processFuzzyProximityModifier($parameter = null) + { + $this->_proximityQuery = true; + + if ($parameter !== null) { + $this->_wordsDistance = $parameter; + } + } + + /** + * Transform entry to a subquery + * + * @param string $encoding + * @return Zend_Search_Lucene_Search_Query + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public function getQuery($encoding) + { + if (strpos($this->_phrase, '?') !== false || strpos($this->_phrase, '*') !== false) { + throw new Zend_Search_Lucene_Search_QueryParserException('Wildcards are only allowed in a single terms.'); + } + + $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_phrase, $encoding); + + if (count($tokens) == 0) { + return new Zend_Search_Lucene_Search_Query_Insignificant(); + } + + if (count($tokens) == 1) { + $term = new Zend_Search_Lucene_Index_Term($tokens[0]->getTermText(), $this->_field); + $query = new Zend_Search_Lucene_Search_Query_Term($term); + $query->setBoost($this->_boost); + + return $query; + } + + //It's not empty or one term query + $position = -1; + $query = new Zend_Search_Lucene_Search_Query_Phrase(); + foreach ($tokens as $token) { + $position += $token->getPositionIncrement(); + $term = new Zend_Search_Lucene_Index_Term($token->getTermText(), $this->_field); + $query->addTerm($term, $position); + } + + if ($this->_proximityQuery) { + $query->setSlop($this->_wordsDistance); + } + + $query->setBoost($this->_boost); + + return $query; + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Subquery.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Subquery.php new file mode 100644 index 0000000000000000000000000000000000000000..1422fdc110b0510d26adc36c64309dd9e5245a48 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Subquery.php @@ -0,0 +1,86 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Index_Term */ +require_once 'Zend/Search/Lucene/Index/Term.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Search_QueryEntry */ +require_once 'Zend/Search/Lucene/Search/QueryEntry.php'; + +/** Zend_Search_Lucene_Search_QueryParserException */ +require_once 'Zend/Search/Lucene/Search/QueryParserException.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_QueryEntry_Subquery extends Zend_Search_Lucene_Search_QueryEntry +{ + /** + * Query + * + * @var Zend_Search_Lucene_Search_Query + */ + private $_query; + + /** + * Object constractor + * + * @param Zend_Search_Lucene_Search_Query $query + */ + public function __construct(Zend_Search_Lucene_Search_Query $query) + { + $this->_query = $query; + } + + /** + * Process modifier ('~') + * + * @param mixed $parameter + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public function processFuzzyProximityModifier($parameter = null) + { + throw new Zend_Search_Lucene_Search_QueryParserException('\'~\' sign must follow term or phrase'); + } + + + /** + * Transform entry to a subquery + * + * @param string $encoding + * @return Zend_Search_Lucene_Search_Query + */ + public function getQuery($encoding) + { + $this->_query->setBoost($this->_boost); + + return $this->_query; + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Term.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Term.php new file mode 100644 index 0000000000000000000000000000000000000000..9f244be5a2f63d5cc03392399567c8ed2ffb513e --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryEntry/Term.php @@ -0,0 +1,203 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Index_Term */ +require_once 'Zend/Search/Lucene/Index/Term.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Search_QueryEntry */ +require_once 'Zend/Search/Lucene/Search/QueryEntry.php'; + +/** Zend_Search_Lucene_Search_QueryParserException */ +require_once 'Zend/Search/Lucene/Search/QueryParserException.php'; + +/** Zend_Search_Lucene_Analysis_Analyzer */ +require_once 'Zend/Search/Lucene/Analysis/Analyzer.php'; + + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_QueryEntry_Term extends Zend_Search_Lucene_Search_QueryEntry +{ + /** + * Term value + * + * @var string + */ + private $_term; + + /** + * Field + * + * @var string|null + */ + private $_field; + + + /** + * Fuzzy search query + * + * @var boolean + */ + private $_fuzzyQuery = false; + + /** + * Similarity + * + * @var float + */ + private $_similarity = 1.; + + + /** + * Object constractor + * + * @param string $term + * @param string $field + */ + public function __construct($term, $field) + { + $this->_term = $term; + $this->_field = $field; + } + + /** + * Process modifier ('~') + * + * @param mixed $parameter + */ + public function processFuzzyProximityModifier($parameter = null) + { + $this->_fuzzyQuery = true; + + if ($parameter !== null) { + $this->_similarity = $parameter; + } else { + $this->_similarity = Zend_Search_Lucene_Search_Query_Fuzzy::DEFAULT_MIN_SIMILARITY; + } + } + + /** + * Transform entry to a subquery + * + * @param string $encoding + * @return Zend_Search_Lucene_Search_Query + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public function getQuery($encoding) + { + if (strpos($this->_term, '?') !== false || strpos($this->_term, '*') !== false) { + if ($this->_fuzzyQuery) { + throw new Zend_Search_Lucene_Search_QueryParserException('Fuzzy search is not supported for terms with wildcards.'); + } + + $pattern = ''; + + $subPatterns = explode('*', $this->_term); + + $astericFirstPass = true; + foreach ($subPatterns as $subPattern) { + if (!$astericFirstPass) { + $pattern .= '*'; + } else { + $astericFirstPass = false; + } + + $subPatternsL2 = explode('?', $subPattern); + + $qMarkFirstPass = true; + foreach ($subPatternsL2 as $subPatternL2) { + if (!$qMarkFirstPass) { + $pattern .= '?'; + } else { + $qMarkFirstPass = false; + } + + $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($subPatternL2, $encoding); + if (count($tokens) > 1) { + throw new Zend_Search_Lucene_Search_QueryParserException('Wildcard search is supported only for non-multiple word terms'); + } + + foreach ($tokens as $token) { + $pattern .= $token->getTermText(); + } + } + } + + $term = new Zend_Search_Lucene_Index_Term($pattern, $this->_field); + $query = new Zend_Search_Lucene_Search_Query_Wildcard($term); + $query->setBoost($this->_boost); + + return $query; + } + + $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_term, $encoding); + + if (count($tokens) == 0) { + return new Zend_Search_Lucene_Search_Query_Insignificant(); + } + + if (count($tokens) == 1 && !$this->_fuzzyQuery) { + $term = new Zend_Search_Lucene_Index_Term($tokens[0]->getTermText(), $this->_field); + $query = new Zend_Search_Lucene_Search_Query_Term($term); + $query->setBoost($this->_boost); + + return $query; + } + + if (count($tokens) == 1 && $this->_fuzzyQuery) { + $term = new Zend_Search_Lucene_Index_Term($tokens[0]->getTermText(), $this->_field); + $query = new Zend_Search_Lucene_Search_Query_Fuzzy($term, $this->_similarity); + $query->setBoost($this->_boost); + + return $query; + } + + if ($this->_fuzzyQuery) { + throw new Zend_Search_Lucene_Search_QueryParserException('Fuzzy search is supported only for non-multiple word terms'); + } + + //It's not empty or one term query + $query = new Zend_Search_Lucene_Search_Query_MultiTerm(); + + /** + * @todo Process $token->getPositionIncrement() to support stemming, synonyms and other + * analizer design features + */ + foreach ($tokens as $token) { + $term = new Zend_Search_Lucene_Index_Term($token->getTermText(), $this->_field); + $query->addTerm($term, true); // all subterms are required + } + + $query->setBoost($this->_boost); + + return $query; + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryHit.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryHit.php new file mode 100644 index 0000000000000000000000000000000000000000..1460b743a5b14b4a8441774ff0af15788f140bcf --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryHit.php @@ -0,0 +1,108 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_QueryHit +{ + /** + * Object handle of the index + * @var Zend_Search_Lucene_Interface + */ + protected $_index = null; + + /** + * Object handle of the document associated with this hit + * @var Zend_Search_Lucene_Document + */ + protected $_document = null; + + /** + * Number of the document in the index + * @var integer + */ + public $id; + + /** + * Score of the hit + * @var float + */ + public $score; + + + /** + * Constructor - pass object handle of Zend_Search_Lucene_Interface index that produced + * the hit so the document can be retrieved easily from the hit. + * + * @param Zend_Search_Lucene_Interface $index + */ + + public function __construct(Zend_Search_Lucene_Interface $index) + { + $this->_index = new Zend_Search_Lucene_Proxy($index); + } + + + /** + * Convenience function for getting fields from the document + * associated with this hit. + * + * @param string $offset + * @return string + */ + public function __get($offset) + { + return $this->getDocument()->getFieldValue($offset); + } + + + /** + * Return the document object for this hit + * + * @return Zend_Search_Lucene_Document + */ + public function getDocument() + { + if (!$this->_document instanceof Zend_Search_Lucene_Document) { + $this->_document = $this->_index->getDocument($this->id); + } + + return $this->_document; + } + + + /** + * Return the index object for this hit + * + * @return Zend_Search_Lucene_Interface + */ + public function getIndex() + { + return $this->_index; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryLexer.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryLexer.php new file mode 100644 index 0000000000000000000000000000000000000000..760901a4eb292e480630a6b2ef1d41e10b798674 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryLexer.php @@ -0,0 +1,511 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_FSM */ +require_once 'Zend/Search/Lucene/FSM.php'; + +/** Zend_Search_Lucene_Search_QueryParser */ +require_once 'Zend/Search/Lucene/Search/QueryToken.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Search_QueryParserException */ +require_once 'Zend/Search/Lucene/Search/QueryParserException.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_QueryLexer extends Zend_Search_Lucene_FSM +{ + /** State Machine states */ + const ST_WHITE_SPACE = 0; + const ST_SYNT_LEXEME = 1; + const ST_LEXEME = 2; + const ST_QUOTED_LEXEME = 3; + const ST_ESCAPED_CHAR = 4; + const ST_ESCAPED_QCHAR = 5; + const ST_LEXEME_MODIFIER = 6; + const ST_NUMBER = 7; + const ST_MANTISSA = 8; + const ST_ERROR = 9; + + /** Input symbols */ + const IN_WHITE_SPACE = 0; + const IN_SYNT_CHAR = 1; + const IN_LEXEME_MODIFIER = 2; + const IN_ESCAPE_CHAR = 3; + const IN_QUOTE = 4; + const IN_DECIMAL_POINT = 5; + const IN_ASCII_DIGIT = 6; + const IN_CHAR = 7; + const IN_MUTABLE_CHAR = 8; + + const QUERY_WHITE_SPACE_CHARS = " \n\r\t"; + const QUERY_SYNT_CHARS = ':()[]{}!|&'; + const QUERY_MUTABLE_CHARS = '+-'; + const QUERY_DOUBLECHARLEXEME_CHARS = '|&'; + const QUERY_LEXEMEMODIFIER_CHARS = '~^'; + const QUERY_ASCIIDIGITS_CHARS = '0123456789'; + + /** + * List of recognized lexemes + * + * @var array + */ + private $_lexemes; + + /** + * Query string (array of single- or non single-byte characters) + * + * @var array + */ + private $_queryString; + + /** + * Current position within a query string + * Used to create appropriate error messages + * + * @var integer + */ + private $_queryStringPosition; + + /** + * Recognized part of current lexeme + * + * @var string + */ + private $_currentLexeme; + + public function __construct() + { + parent::__construct( array(self::ST_WHITE_SPACE, + self::ST_SYNT_LEXEME, + self::ST_LEXEME, + self::ST_QUOTED_LEXEME, + self::ST_ESCAPED_CHAR, + self::ST_ESCAPED_QCHAR, + self::ST_LEXEME_MODIFIER, + self::ST_NUMBER, + self::ST_MANTISSA, + self::ST_ERROR), + array(self::IN_WHITE_SPACE, + self::IN_SYNT_CHAR, + self::IN_MUTABLE_CHAR, + self::IN_LEXEME_MODIFIER, + self::IN_ESCAPE_CHAR, + self::IN_QUOTE, + self::IN_DECIMAL_POINT, + self::IN_ASCII_DIGIT, + self::IN_CHAR)); + + + $lexemeModifierErrorAction = new Zend_Search_Lucene_FSMAction($this, 'lexModifierErrException'); + $quoteWithinLexemeErrorAction = new Zend_Search_Lucene_FSMAction($this, 'quoteWithinLexemeErrException'); + $wrongNumberErrorAction = new Zend_Search_Lucene_FSMAction($this, 'wrongNumberErrException'); + + + + $this->addRules(array( array(self::ST_WHITE_SPACE, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), + array(self::ST_WHITE_SPACE, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_WHITE_SPACE, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_WHITE_SPACE, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), + array(self::ST_WHITE_SPACE, self::IN_ESCAPE_CHAR, self::ST_ESCAPED_CHAR), + array(self::ST_WHITE_SPACE, self::IN_QUOTE, self::ST_QUOTED_LEXEME), + array(self::ST_WHITE_SPACE, self::IN_DECIMAL_POINT, self::ST_LEXEME), + array(self::ST_WHITE_SPACE, self::IN_ASCII_DIGIT, self::ST_LEXEME), + array(self::ST_WHITE_SPACE, self::IN_CHAR, self::ST_LEXEME) + )); + $this->addRules(array( array(self::ST_SYNT_LEXEME, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), + array(self::ST_SYNT_LEXEME, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_SYNT_LEXEME, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_SYNT_LEXEME, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), + array(self::ST_SYNT_LEXEME, self::IN_ESCAPE_CHAR, self::ST_ESCAPED_CHAR), + array(self::ST_SYNT_LEXEME, self::IN_QUOTE, self::ST_QUOTED_LEXEME), + array(self::ST_SYNT_LEXEME, self::IN_DECIMAL_POINT, self::ST_LEXEME), + array(self::ST_SYNT_LEXEME, self::IN_ASCII_DIGIT, self::ST_LEXEME), + array(self::ST_SYNT_LEXEME, self::IN_CHAR, self::ST_LEXEME) + )); + $this->addRules(array( array(self::ST_LEXEME, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), + array(self::ST_LEXEME, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_LEXEME, self::IN_MUTABLE_CHAR, self::ST_LEXEME), + array(self::ST_LEXEME, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), + array(self::ST_LEXEME, self::IN_ESCAPE_CHAR, self::ST_ESCAPED_CHAR), + + // IN_QUOTE not allowed + array(self::ST_LEXEME, self::IN_QUOTE, self::ST_ERROR, $quoteWithinLexemeErrorAction), + + array(self::ST_LEXEME, self::IN_DECIMAL_POINT, self::ST_LEXEME), + array(self::ST_LEXEME, self::IN_ASCII_DIGIT, self::ST_LEXEME), + array(self::ST_LEXEME, self::IN_CHAR, self::ST_LEXEME) + )); + $this->addRules(array( array(self::ST_QUOTED_LEXEME, self::IN_WHITE_SPACE, self::ST_QUOTED_LEXEME), + array(self::ST_QUOTED_LEXEME, self::IN_SYNT_CHAR, self::ST_QUOTED_LEXEME), + array(self::ST_QUOTED_LEXEME, self::IN_MUTABLE_CHAR, self::ST_QUOTED_LEXEME), + array(self::ST_QUOTED_LEXEME, self::IN_LEXEME_MODIFIER, self::ST_QUOTED_LEXEME), + array(self::ST_QUOTED_LEXEME, self::IN_ESCAPE_CHAR, self::ST_ESCAPED_QCHAR), + array(self::ST_QUOTED_LEXEME, self::IN_QUOTE, self::ST_WHITE_SPACE), + array(self::ST_QUOTED_LEXEME, self::IN_DECIMAL_POINT, self::ST_QUOTED_LEXEME), + array(self::ST_QUOTED_LEXEME, self::IN_ASCII_DIGIT, self::ST_QUOTED_LEXEME), + array(self::ST_QUOTED_LEXEME, self::IN_CHAR, self::ST_QUOTED_LEXEME) + )); + $this->addRules(array( array(self::ST_ESCAPED_CHAR, self::IN_WHITE_SPACE, self::ST_LEXEME), + array(self::ST_ESCAPED_CHAR, self::IN_SYNT_CHAR, self::ST_LEXEME), + array(self::ST_ESCAPED_CHAR, self::IN_MUTABLE_CHAR, self::ST_LEXEME), + array(self::ST_ESCAPED_CHAR, self::IN_LEXEME_MODIFIER, self::ST_LEXEME), + array(self::ST_ESCAPED_CHAR, self::IN_ESCAPE_CHAR, self::ST_LEXEME), + array(self::ST_ESCAPED_CHAR, self::IN_QUOTE, self::ST_LEXEME), + array(self::ST_ESCAPED_CHAR, self::IN_DECIMAL_POINT, self::ST_LEXEME), + array(self::ST_ESCAPED_CHAR, self::IN_ASCII_DIGIT, self::ST_LEXEME), + array(self::ST_ESCAPED_CHAR, self::IN_CHAR, self::ST_LEXEME) + )); + $this->addRules(array( array(self::ST_ESCAPED_QCHAR, self::IN_WHITE_SPACE, self::ST_QUOTED_LEXEME), + array(self::ST_ESCAPED_QCHAR, self::IN_SYNT_CHAR, self::ST_QUOTED_LEXEME), + array(self::ST_ESCAPED_QCHAR, self::IN_MUTABLE_CHAR, self::ST_QUOTED_LEXEME), + array(self::ST_ESCAPED_QCHAR, self::IN_LEXEME_MODIFIER, self::ST_QUOTED_LEXEME), + array(self::ST_ESCAPED_QCHAR, self::IN_ESCAPE_CHAR, self::ST_QUOTED_LEXEME), + array(self::ST_ESCAPED_QCHAR, self::IN_QUOTE, self::ST_QUOTED_LEXEME), + array(self::ST_ESCAPED_QCHAR, self::IN_DECIMAL_POINT, self::ST_QUOTED_LEXEME), + array(self::ST_ESCAPED_QCHAR, self::IN_ASCII_DIGIT, self::ST_QUOTED_LEXEME), + array(self::ST_ESCAPED_QCHAR, self::IN_CHAR, self::ST_QUOTED_LEXEME) + )); + $this->addRules(array( array(self::ST_LEXEME_MODIFIER, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), + array(self::ST_LEXEME_MODIFIER, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_LEXEME_MODIFIER, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_LEXEME_MODIFIER, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), + + // IN_ESCAPE_CHAR not allowed + array(self::ST_LEXEME_MODIFIER, self::IN_ESCAPE_CHAR, self::ST_ERROR, $lexemeModifierErrorAction), + + // IN_QUOTE not allowed + array(self::ST_LEXEME_MODIFIER, self::IN_QUOTE, self::ST_ERROR, $lexemeModifierErrorAction), + + + array(self::ST_LEXEME_MODIFIER, self::IN_DECIMAL_POINT, self::ST_MANTISSA), + array(self::ST_LEXEME_MODIFIER, self::IN_ASCII_DIGIT, self::ST_NUMBER), + + // IN_CHAR not allowed + array(self::ST_LEXEME_MODIFIER, self::IN_CHAR, self::ST_ERROR, $lexemeModifierErrorAction), + )); + $this->addRules(array( array(self::ST_NUMBER, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), + array(self::ST_NUMBER, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_NUMBER, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_NUMBER, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), + + // IN_ESCAPE_CHAR not allowed + array(self::ST_NUMBER, self::IN_ESCAPE_CHAR, self::ST_ERROR, $wrongNumberErrorAction), + + // IN_QUOTE not allowed + array(self::ST_NUMBER, self::IN_QUOTE, self::ST_ERROR, $wrongNumberErrorAction), + + array(self::ST_NUMBER, self::IN_DECIMAL_POINT, self::ST_MANTISSA), + array(self::ST_NUMBER, self::IN_ASCII_DIGIT, self::ST_NUMBER), + + // IN_CHAR not allowed + array(self::ST_NUMBER, self::IN_CHAR, self::ST_ERROR, $wrongNumberErrorAction), + )); + $this->addRules(array( array(self::ST_MANTISSA, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), + array(self::ST_MANTISSA, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_MANTISSA, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), + array(self::ST_MANTISSA, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), + + // IN_ESCAPE_CHAR not allowed + array(self::ST_MANTISSA, self::IN_ESCAPE_CHAR, self::ST_ERROR, $wrongNumberErrorAction), + + // IN_QUOTE not allowed + array(self::ST_MANTISSA, self::IN_QUOTE, self::ST_ERROR, $wrongNumberErrorAction), + + // IN_DECIMAL_POINT not allowed + array(self::ST_MANTISSA, self::IN_DECIMAL_POINT, self::ST_ERROR, $wrongNumberErrorAction), + + array(self::ST_MANTISSA, self::IN_ASCII_DIGIT, self::ST_MANTISSA), + + // IN_CHAR not allowed + array(self::ST_MANTISSA, self::IN_CHAR, self::ST_ERROR, $wrongNumberErrorAction), + )); + + + /** Actions */ + $syntaxLexemeAction = new Zend_Search_Lucene_FSMAction($this, 'addQuerySyntaxLexeme'); + $lexemeModifierAction = new Zend_Search_Lucene_FSMAction($this, 'addLexemeModifier'); + $addLexemeAction = new Zend_Search_Lucene_FSMAction($this, 'addLexeme'); + $addQuotedLexemeAction = new Zend_Search_Lucene_FSMAction($this, 'addQuotedLexeme'); + $addNumberLexemeAction = new Zend_Search_Lucene_FSMAction($this, 'addNumberLexeme'); + $addLexemeCharAction = new Zend_Search_Lucene_FSMAction($this, 'addLexemeChar'); + + + /** Syntax lexeme */ + $this->addEntryAction(self::ST_SYNT_LEXEME, $syntaxLexemeAction); + // Two lexemes in succession + $this->addTransitionAction(self::ST_SYNT_LEXEME, self::ST_SYNT_LEXEME, $syntaxLexemeAction); + + + /** Lexeme */ + $this->addEntryAction(self::ST_LEXEME, $addLexemeCharAction); + $this->addTransitionAction(self::ST_LEXEME, self::ST_LEXEME, $addLexemeCharAction); + // ST_ESCAPED_CHAR => ST_LEXEME transition is covered by ST_LEXEME entry action + + $this->addTransitionAction(self::ST_LEXEME, self::ST_WHITE_SPACE, $addLexemeAction); + $this->addTransitionAction(self::ST_LEXEME, self::ST_SYNT_LEXEME, $addLexemeAction); + $this->addTransitionAction(self::ST_LEXEME, self::ST_QUOTED_LEXEME, $addLexemeAction); + $this->addTransitionAction(self::ST_LEXEME, self::ST_LEXEME_MODIFIER, $addLexemeAction); + $this->addTransitionAction(self::ST_LEXEME, self::ST_NUMBER, $addLexemeAction); + $this->addTransitionAction(self::ST_LEXEME, self::ST_MANTISSA, $addLexemeAction); + + + /** Quoted lexeme */ + // We don't need entry action (skeep quote) + $this->addTransitionAction(self::ST_QUOTED_LEXEME, self::ST_QUOTED_LEXEME, $addLexemeCharAction); + $this->addTransitionAction(self::ST_ESCAPED_QCHAR, self::ST_QUOTED_LEXEME, $addLexemeCharAction); + // Closing quote changes state to the ST_WHITE_SPACE other states are not used + $this->addTransitionAction(self::ST_QUOTED_LEXEME, self::ST_WHITE_SPACE, $addQuotedLexemeAction); + + + /** Lexeme modifier */ + $this->addEntryAction(self::ST_LEXEME_MODIFIER, $lexemeModifierAction); + + + /** Number */ + $this->addEntryAction(self::ST_NUMBER, $addLexemeCharAction); + $this->addEntryAction(self::ST_MANTISSA, $addLexemeCharAction); + $this->addTransitionAction(self::ST_NUMBER, self::ST_NUMBER, $addLexemeCharAction); + // ST_NUMBER => ST_MANTISSA transition is covered by ST_MANTISSA entry action + $this->addTransitionAction(self::ST_MANTISSA, self::ST_MANTISSA, $addLexemeCharAction); + + $this->addTransitionAction(self::ST_NUMBER, self::ST_WHITE_SPACE, $addNumberLexemeAction); + $this->addTransitionAction(self::ST_NUMBER, self::ST_SYNT_LEXEME, $addNumberLexemeAction); + $this->addTransitionAction(self::ST_NUMBER, self::ST_LEXEME_MODIFIER, $addNumberLexemeAction); + $this->addTransitionAction(self::ST_MANTISSA, self::ST_WHITE_SPACE, $addNumberLexemeAction); + $this->addTransitionAction(self::ST_MANTISSA, self::ST_SYNT_LEXEME, $addNumberLexemeAction); + $this->addTransitionAction(self::ST_MANTISSA, self::ST_LEXEME_MODIFIER, $addNumberLexemeAction); + } + + + + + /** + * Translate input char to an input symbol of state machine + * + * @param string $char + * @return integer + */ + private function _translateInput($char) + { + if (strpos(self::QUERY_WHITE_SPACE_CHARS, $char) !== false) { return self::IN_WHITE_SPACE; + } else if (strpos(self::QUERY_SYNT_CHARS, $char) !== false) { return self::IN_SYNT_CHAR; + } else if (strpos(self::QUERY_MUTABLE_CHARS, $char) !== false) { return self::IN_MUTABLE_CHAR; + } else if (strpos(self::QUERY_LEXEMEMODIFIER_CHARS, $char) !== false) { return self::IN_LEXEME_MODIFIER; + } else if (strpos(self::QUERY_ASCIIDIGITS_CHARS, $char) !== false) { return self::IN_ASCII_DIGIT; + } else if ($char === '"' ) { return self::IN_QUOTE; + } else if ($char === '.' ) { return self::IN_DECIMAL_POINT; + } else if ($char === '\\') { return self::IN_ESCAPE_CHAR; + } else { return self::IN_CHAR; + } + } + + + /** + * This method is used to tokenize query string into lexemes + * + * @param string $inputString + * @param string $encoding + * @return array + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public function tokenize($inputString, $encoding) + { + $this->reset(); + + $this->_lexemes = array(); + $this->_queryString = array(); + + if (PHP_OS == 'AIX' && $encoding == '') { + $encoding = 'ISO8859-1'; + } + $strLength = iconv_strlen($inputString, $encoding); + + // Workaround for iconv_substr bug + $inputString .= ' '; + + for ($count = 0; $count < $strLength; $count++) { + $this->_queryString[$count] = iconv_substr($inputString, $count, 1, $encoding); + } + + for ($this->_queryStringPosition = 0; + $this->_queryStringPosition < count($this->_queryString); + $this->_queryStringPosition++) { + $this->process($this->_translateInput($this->_queryString[$this->_queryStringPosition])); + } + + $this->process(self::IN_WHITE_SPACE); + + if ($this->getState() != self::ST_WHITE_SPACE) { + throw new Zend_Search_Lucene_Search_QueryParserException('Unexpected end of query'); + } + + $this->_queryString = null; + + return $this->_lexemes; + } + + + + /********************************************************************* + * Actions implementation + * + * Actions affect on recognized lexemes list + *********************************************************************/ + + /** + * Add query syntax lexeme + * + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public function addQuerySyntaxLexeme() + { + $lexeme = $this->_queryString[$this->_queryStringPosition]; + + // Process two char lexemes + if (strpos(self::QUERY_DOUBLECHARLEXEME_CHARS, $lexeme) !== false) { + // increase current position in a query string + $this->_queryStringPosition++; + + // check, + if ($this->_queryStringPosition == count($this->_queryString) || + $this->_queryString[$this->_queryStringPosition] != $lexeme) { + throw new Zend_Search_Lucene_Search_QueryParserException('Two chars lexeme expected. ' . $this->_positionMsg()); + } + + // duplicate character + $lexeme .= $lexeme; + } + + $token = new Zend_Search_Lucene_Search_QueryToken( + Zend_Search_Lucene_Search_QueryToken::TC_SYNTAX_ELEMENT, + $lexeme, + $this->_queryStringPosition); + + // Skip this lexeme if it's a field indicator ':' and treat previous as 'field' instead of 'word' + if ($token->type == Zend_Search_Lucene_Search_QueryToken::TT_FIELD_INDICATOR) { + $token = array_pop($this->_lexemes); + if ($token === null || $token->type != Zend_Search_Lucene_Search_QueryToken::TT_WORD) { + throw new Zend_Search_Lucene_Search_QueryParserException('Field mark \':\' must follow field name. ' . $this->_positionMsg()); + } + + $token->type = Zend_Search_Lucene_Search_QueryToken::TT_FIELD; + } + + $this->_lexemes[] = $token; + } + + /** + * Add lexeme modifier + */ + public function addLexemeModifier() + { + $this->_lexemes[] = new Zend_Search_Lucene_Search_QueryToken( + Zend_Search_Lucene_Search_QueryToken::TC_SYNTAX_ELEMENT, + $this->_queryString[$this->_queryStringPosition], + $this->_queryStringPosition); + } + + + /** + * Add lexeme + */ + public function addLexeme() + { + $this->_lexemes[] = new Zend_Search_Lucene_Search_QueryToken( + Zend_Search_Lucene_Search_QueryToken::TC_WORD, + $this->_currentLexeme, + $this->_queryStringPosition - 1); + + $this->_currentLexeme = ''; + } + + /** + * Add quoted lexeme + */ + public function addQuotedLexeme() + { + $this->_lexemes[] = new Zend_Search_Lucene_Search_QueryToken( + Zend_Search_Lucene_Search_QueryToken::TC_PHRASE, + $this->_currentLexeme, + $this->_queryStringPosition); + + $this->_currentLexeme = ''; + } + + /** + * Add number lexeme + */ + public function addNumberLexeme() + { + $this->_lexemes[] = new Zend_Search_Lucene_Search_QueryToken( + Zend_Search_Lucene_Search_QueryToken::TC_NUMBER, + $this->_currentLexeme, + $this->_queryStringPosition - 1); + $this->_currentLexeme = ''; + } + + /** + * Extend lexeme by one char + */ + public function addLexemeChar() + { + $this->_currentLexeme .= $this->_queryString[$this->_queryStringPosition]; + } + + + /** + * Position message + * + * @return string + */ + private function _positionMsg() + { + return 'Position is ' . $this->_queryStringPosition . '.'; + } + + + /********************************************************************* + * Syntax errors actions + *********************************************************************/ + public function lexModifierErrException() + { + throw new Zend_Search_Lucene_Search_QueryParserException('Lexeme modifier character can be followed only by number, white space or query syntax element. ' . $this->_positionMsg()); + } + public function quoteWithinLexemeErrException() + { + throw new Zend_Search_Lucene_Search_QueryParserException('Quote within lexeme must be escaped by \'\\\' char. ' . $this->_positionMsg()); + } + public function wrongNumberErrException() + { + throw new Zend_Search_Lucene_Search_QueryParserException('Wrong number syntax.' . $this->_positionMsg()); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParser.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParser.php new file mode 100644 index 0000000000000000000000000000000000000000..2cfee728144891aedf827bae28df711c3e697ccb --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParser.php @@ -0,0 +1,630 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Index_Term */ +require_once 'Zend/Search/Lucene/Index/Term.php'; + +/** Zend_Search_Lucene_Search_Query_Term */ +require_once 'Zend/Search/Lucene/Search/Query/Term.php'; + +/** Zend_Search_Lucene_Search_Query_MultiTerm */ +require_once 'Zend/Search/Lucene/Search/Query/MultiTerm.php'; + +/** Zend_Search_Lucene_Search_Query_Boolean */ +require_once 'Zend/Search/Lucene/Search/Query/Boolean.php'; + +/** Zend_Search_Lucene_Search_Query_Phrase */ +require_once 'Zend/Search/Lucene/Search/Query/Phrase.php'; + +/** Zend_Search_Lucene_Search_Query_Wildcard */ +require_once 'Zend/Search/Lucene/Search/Query/Wildcard.php'; + +/** Zend_Search_Lucene_Search_Query_Range */ +require_once 'Zend/Search/Lucene/Search/Query/Range.php'; + +/** Zend_Search_Lucene_Search_Query_Fuzzy */ +require_once 'Zend/Search/Lucene/Search/Query/Fuzzy.php'; + +/** Zend_Search_Lucene_Search_Query_Empty */ +require_once 'Zend/Search/Lucene/Search/Query/Empty.php'; + +/** Zend_Search_Lucene_Search_Query_Insignificant */ +require_once 'Zend/Search/Lucene/Search/Query/Insignificant.php'; + + +/** Zend_Search_Lucene_Search_QueryLexer */ +require_once 'Zend/Search/Lucene/Search/QueryLexer.php'; + +/** Zend_Search_Lucene_Search_QueryParserContext */ +require_once 'Zend/Search/Lucene/Search/QueryParserContext.php'; + + +/** Zend_Search_Lucene_FSM */ +require_once 'Zend/Search/Lucene/FSM.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Search_QueryParserException */ +require_once 'Zend/Search/Lucene/Search/QueryParserException.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_QueryParser extends Zend_Search_Lucene_FSM +{ + /** + * Parser instance + * + * @var Zend_Search_Lucene_Search_QueryParser + */ + private static $_instance = null; + + + /** + * Query lexer + * + * @var Zend_Search_Lucene_Search_QueryLexer + */ + private $_lexer; + + /** + * Tokens list + * Array of Zend_Search_Lucene_Search_QueryToken objects + * + * @var array + */ + private $_tokens; + + /** + * Current token + * + * @var integer|string + */ + private $_currentToken; + + /** + * Last token + * + * It can be processed within FSM states, but this addirional state simplifies FSM + * + * @var Zend_Search_Lucene_Search_QueryToken + */ + private $_lastToken = null; + + /** + * Range query first term + * + * @var string + */ + private $_rqFirstTerm = null; + + /** + * Current query parser context + * + * @var Zend_Search_Lucene_Search_QueryParserContext + */ + private $_context; + + /** + * Context stack + * + * @var array + */ + private $_contextStack; + + /** + * Query string encoding + * + * @var string + */ + private $_encoding; + + /** + * Query string default encoding + * + * @var string + */ + private $_defaultEncoding = ''; + + /** + * Defines query parsing mode. + * + * If this option is turned on, then query parser suppress query parser exceptions + * and constructs multi-term query using all words from a query. + * + * That helps to avoid exceptions caused by queries, which don't conform to query language, + * but limits possibilities to check, that query entered by user has some inconsistencies. + * + * + * Default is true. + * + * Use {@link Zend_Search_Lucene::suppressQueryParsingExceptions()}, + * {@link Zend_Search_Lucene::dontSuppressQueryParsingExceptions()} and + * {@link Zend_Search_Lucene::checkQueryParsingExceptionsSuppressMode()} to operate + * with this setting. + * + * @var boolean + */ + private $_suppressQueryParsingExceptions = true; + + /** + * Boolean operators constants + */ + const B_OR = 0; + const B_AND = 1; + + /** + * Default boolean queries operator + * + * @var integer + */ + private $_defaultOperator = self::B_OR; + + + /** Query parser State Machine states */ + const ST_COMMON_QUERY_ELEMENT = 0; // Terms, phrases, operators + const ST_CLOSEDINT_RQ_START = 1; // Range query start (closed interval) - '[' + const ST_CLOSEDINT_RQ_FIRST_TERM = 2; // First term in '[term1 to term2]' construction + const ST_CLOSEDINT_RQ_TO_TERM = 3; // 'TO' lexeme in '[term1 to term2]' construction + const ST_CLOSEDINT_RQ_LAST_TERM = 4; // Second term in '[term1 to term2]' construction + const ST_CLOSEDINT_RQ_END = 5; // Range query end (closed interval) - ']' + const ST_OPENEDINT_RQ_START = 6; // Range query start (opened interval) - '{' + const ST_OPENEDINT_RQ_FIRST_TERM = 7; // First term in '{term1 to term2}' construction + const ST_OPENEDINT_RQ_TO_TERM = 8; // 'TO' lexeme in '{term1 to term2}' construction + const ST_OPENEDINT_RQ_LAST_TERM = 9; // Second term in '{term1 to term2}' construction + const ST_OPENEDINT_RQ_END = 10; // Range query end (opened interval) - '}' + + /** + * Parser constructor + */ + public function __construct() + { + parent::__construct(array(self::ST_COMMON_QUERY_ELEMENT, + self::ST_CLOSEDINT_RQ_START, + self::ST_CLOSEDINT_RQ_FIRST_TERM, + self::ST_CLOSEDINT_RQ_TO_TERM, + self::ST_CLOSEDINT_RQ_LAST_TERM, + self::ST_CLOSEDINT_RQ_END, + self::ST_OPENEDINT_RQ_START, + self::ST_OPENEDINT_RQ_FIRST_TERM, + self::ST_OPENEDINT_RQ_TO_TERM, + self::ST_OPENEDINT_RQ_LAST_TERM, + self::ST_OPENEDINT_RQ_END + ), + Zend_Search_Lucene_Search_QueryToken::getTypes()); + + $this->addRules( + array(array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_PHRASE, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_FIELD, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_REQUIRED, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_PROHIBITED, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_FUZZY_PROX_MARK, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_BOOSTING_MARK, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_RANGE_INCL_START, self::ST_CLOSEDINT_RQ_START), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_RANGE_EXCL_START, self::ST_OPENEDINT_RQ_START), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_SUBQUERY_START, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_SUBQUERY_END, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_AND_LEXEME, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_OR_LEXEME, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_NOT_LEXEME, self::ST_COMMON_QUERY_ELEMENT), + array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_NUMBER, self::ST_COMMON_QUERY_ELEMENT) + )); + $this->addRules( + array(array(self::ST_CLOSEDINT_RQ_START, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_CLOSEDINT_RQ_FIRST_TERM), + array(self::ST_CLOSEDINT_RQ_FIRST_TERM, Zend_Search_Lucene_Search_QueryToken::TT_TO_LEXEME, self::ST_CLOSEDINT_RQ_TO_TERM), + array(self::ST_CLOSEDINT_RQ_TO_TERM, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_CLOSEDINT_RQ_LAST_TERM), + array(self::ST_CLOSEDINT_RQ_LAST_TERM, Zend_Search_Lucene_Search_QueryToken::TT_RANGE_INCL_END, self::ST_COMMON_QUERY_ELEMENT) + )); + $this->addRules( + array(array(self::ST_OPENEDINT_RQ_START, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_OPENEDINT_RQ_FIRST_TERM), + array(self::ST_OPENEDINT_RQ_FIRST_TERM, Zend_Search_Lucene_Search_QueryToken::TT_TO_LEXEME, self::ST_OPENEDINT_RQ_TO_TERM), + array(self::ST_OPENEDINT_RQ_TO_TERM, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_OPENEDINT_RQ_LAST_TERM), + array(self::ST_OPENEDINT_RQ_LAST_TERM, Zend_Search_Lucene_Search_QueryToken::TT_RANGE_EXCL_END, self::ST_COMMON_QUERY_ELEMENT) + )); + + + + $addTermEntryAction = new Zend_Search_Lucene_FSMAction($this, 'addTermEntry'); + $addPhraseEntryAction = new Zend_Search_Lucene_FSMAction($this, 'addPhraseEntry'); + $setFieldAction = new Zend_Search_Lucene_FSMAction($this, 'setField'); + $setSignAction = new Zend_Search_Lucene_FSMAction($this, 'setSign'); + $setFuzzyProxAction = new Zend_Search_Lucene_FSMAction($this, 'processFuzzyProximityModifier'); + $processModifierParameterAction = new Zend_Search_Lucene_FSMAction($this, 'processModifierParameter'); + $subqueryStartAction = new Zend_Search_Lucene_FSMAction($this, 'subqueryStart'); + $subqueryEndAction = new Zend_Search_Lucene_FSMAction($this, 'subqueryEnd'); + $logicalOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'logicalOperator'); + $openedRQFirstTermAction = new Zend_Search_Lucene_FSMAction($this, 'openedRQFirstTerm'); + $openedRQLastTermAction = new Zend_Search_Lucene_FSMAction($this, 'openedRQLastTerm'); + $closedRQFirstTermAction = new Zend_Search_Lucene_FSMAction($this, 'closedRQFirstTerm'); + $closedRQLastTermAction = new Zend_Search_Lucene_FSMAction($this, 'closedRQLastTerm'); + + + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_WORD, $addTermEntryAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_PHRASE, $addPhraseEntryAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_FIELD, $setFieldAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_REQUIRED, $setSignAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_PROHIBITED, $setSignAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_FUZZY_PROX_MARK, $setFuzzyProxAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_NUMBER, $processModifierParameterAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_SUBQUERY_START, $subqueryStartAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_SUBQUERY_END, $subqueryEndAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_AND_LEXEME, $logicalOperatorAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_OR_LEXEME, $logicalOperatorAction); + $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_NOT_LEXEME, $logicalOperatorAction); + + $this->addEntryAction(self::ST_OPENEDINT_RQ_FIRST_TERM, $openedRQFirstTermAction); + $this->addEntryAction(self::ST_OPENEDINT_RQ_LAST_TERM, $openedRQLastTermAction); + $this->addEntryAction(self::ST_CLOSEDINT_RQ_FIRST_TERM, $closedRQFirstTermAction); + $this->addEntryAction(self::ST_CLOSEDINT_RQ_LAST_TERM, $closedRQLastTermAction); + + + + $this->_lexer = new Zend_Search_Lucene_Search_QueryLexer(); + } + + /** + * Get query parser instance + * + * @return Zend_Search_Lucene_Search_QueryParser + */ + private static function _getInstance() + { + if (self::$_instance === null) { + self::$_instance = new self(); + } + return self::$_instance; + } + + /** + * Set query string default encoding + * + * @param string $encoding + */ + public static function setDefaultEncoding($encoding) + { + self::_getInstance()->_defaultEncoding = $encoding; + } + + /** + * Get query string default encoding + * + * @return string + */ + public static function getDefaultEncoding() + { + return self::_getInstance()->_defaultEncoding; + } + + /** + * Set default boolean operator + * + * @param integer $operator + */ + public static function setDefaultOperator($operator) + { + self::_getInstance()->_defaultOperator = $operator; + } + + /** + * Get default boolean operator + * + * @return integer + */ + public static function getDefaultOperator() + { + return self::_getInstance()->_defaultOperator; + } + + /** + * Turn on 'suppress query parser exceptions' mode. + */ + public static function suppressQueryParsingExceptions() + { + self::_getInstance()->_suppressQueryParsingExceptions = true; + } + /** + * Turn off 'suppress query parser exceptions' mode. + */ + public static function dontSuppressQueryParsingExceptions() + { + self::_getInstance()->_suppressQueryParsingExceptions = false; + } + /** + * Check 'suppress query parser exceptions' mode. + * @return boolean + */ + public static function queryParsingExceptionsSuppressed() + { + return self::_getInstance()->_suppressQueryParsingExceptions; + } + + + + /** + * Parses a query string + * + * @param string $strQuery + * @param string $encoding + * @return Zend_Search_Lucene_Search_Query + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public static function parse($strQuery, $encoding = null) + { + self::_getInstance(); + + // Reset FSM if previous parse operation didn't return it into a correct state + self::$_instance->reset(); + + try { + self::$_instance->_encoding = ($encoding !== null) ? $encoding : self::$_instance->_defaultEncoding; + self::$_instance->_lastToken = null; + self::$_instance->_context = new Zend_Search_Lucene_Search_QueryParserContext(self::$_instance->_encoding); + self::$_instance->_contextStack = array(); + self::$_instance->_tokens = self::$_instance->_lexer->tokenize($strQuery, self::$_instance->_encoding); + + // Empty query + if (count(self::$_instance->_tokens) == 0) { + return new Zend_Search_Lucene_Search_Query_Insignificant(); + } + + + foreach (self::$_instance->_tokens as $token) { + try { + self::$_instance->_currentToken = $token; + self::$_instance->process($token->type); + + self::$_instance->_lastToken = $token; + } catch (Exception $e) { + if (strpos($e->getMessage(), 'There is no any rule for') !== false) { + throw new Zend_Search_Lucene_Search_QueryParserException( 'Syntax error at char position ' . $token->position . '.' ); + } + + throw $e; + } + } + + if (count(self::$_instance->_contextStack) != 0) { + throw new Zend_Search_Lucene_Search_QueryParserException('Syntax Error: mismatched parentheses, every opening must have closing.' ); + } + + return self::$_instance->_context->getQuery(); + } catch (Zend_Search_Lucene_Search_QueryParserException $e) { + if (self::$_instance->_suppressQueryParsingExceptions) { + $queryTokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($strQuery, self::$_instance->_encoding); + + $query = new Zend_Search_Lucene_Search_Query_MultiTerm(); + $termsSign = (self::$_instance->_defaultOperator == self::B_AND) ? true /* required term */ : + null /* optional term */; + + foreach ($queryTokens as $token) { + $query->addTerm(new Zend_Search_Lucene_Index_Term($token->getTermText()), $termsSign); + } + + + return $query; + } else { + throw $e; + } + } + } + + + /********************************************************************* + * Actions implementation + * + * Actions affect on recognized lexemes list + *********************************************************************/ + + /** + * Add term to a query + */ + public function addTermEntry() + { + $entry = new Zend_Search_Lucene_Search_QueryEntry_Term($this->_currentToken->text, $this->_context->getField()); + $this->_context->addEntry($entry); + } + + /** + * Add phrase to a query + */ + public function addPhraseEntry() + { + $entry = new Zend_Search_Lucene_Search_QueryEntry_Phrase($this->_currentToken->text, $this->_context->getField()); + $this->_context->addEntry($entry); + } + + /** + * Set entry field + */ + public function setField() + { + $this->_context->setNextEntryField($this->_currentToken->text); + } + + /** + * Set entry sign + */ + public function setSign() + { + $this->_context->setNextEntrySign($this->_currentToken->type); + } + + + /** + * Process fuzzy search/proximity modifier - '~' + */ + public function processFuzzyProximityModifier() + { + $this->_context->processFuzzyProximityModifier(); + } + + /** + * Process modifier parameter + * + * @throws Zend_Search_Lucene_Exception + */ + public function processModifierParameter() + { + if ($this->_lastToken === null) { + throw new Zend_Search_Lucene_Search_QueryParserException('Lexeme modifier parameter must follow lexeme modifier. Char position 0.' ); + } + + switch ($this->_lastToken->type) { + case Zend_Search_Lucene_Search_QueryToken::TT_FUZZY_PROX_MARK: + $this->_context->processFuzzyProximityModifier($this->_currentToken->text); + break; + + case Zend_Search_Lucene_Search_QueryToken::TT_BOOSTING_MARK: + $this->_context->boost($this->_currentToken->text); + break; + + default: + // It's not a user input exception + throw new Zend_Search_Lucene_Exception('Lexeme modifier parameter must follow lexeme modifier. Char position 0.' ); + } + } + + + /** + * Start subquery + */ + public function subqueryStart() + { + $this->_contextStack[] = $this->_context; + $this->_context = new Zend_Search_Lucene_Search_QueryParserContext($this->_encoding, $this->_context->getField()); + } + + /** + * End subquery + */ + public function subqueryEnd() + { + if (count($this->_contextStack) == 0) { + throw new Zend_Search_Lucene_Search_QueryParserException('Syntax Error: mismatched parentheses, every opening must have closing. Char position ' . $this->_currentToken->position . '.' ); + } + + $query = $this->_context->getQuery(); + $this->_context = array_pop($this->_contextStack); + + $this->_context->addEntry(new Zend_Search_Lucene_Search_QueryEntry_Subquery($query)); + } + + /** + * Process logical operator + */ + public function logicalOperator() + { + $this->_context->addLogicalOperator($this->_currentToken->type); + } + + /** + * Process first range query term (opened interval) + */ + public function openedRQFirstTerm() + { + $this->_rqFirstTerm = $this->_currentToken->text; + } + + /** + * Process last range query term (opened interval) + * + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public function openedRQLastTerm() + { + $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_rqFirstTerm, $this->_encoding); + if (count($tokens) > 1) { + throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); + } else if (count($tokens) == 1) { + $from = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); + } else { + $from = null; + } + + $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_currentToken->text, $this->_encoding); + if (count($tokens) > 1) { + throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); + } else if (count($tokens) == 1) { + $to = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); + } else { + $to = null; + } + + if ($from === null && $to === null) { + throw new Zend_Search_Lucene_Search_QueryParserException('At least one range query boundary term must be non-empty term'); + } + + $rangeQuery = new Zend_Search_Lucene_Search_Query_Range($from, $to, false); + $entry = new Zend_Search_Lucene_Search_QueryEntry_Subquery($rangeQuery); + $this->_context->addEntry($entry); + } + + /** + * Process first range query term (closed interval) + */ + public function closedRQFirstTerm() + { + $this->_rqFirstTerm = $this->_currentToken->text; + } + + /** + * Process last range query term (closed interval) + * + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public function closedRQLastTerm() + { + $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_rqFirstTerm, $this->_encoding); + if (count($tokens) > 1) { + throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); + } else if (count($tokens) == 1) { + $from = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); + } else { + $from = null; + } + + $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_currentToken->text, $this->_encoding); + if (count($tokens) > 1) { + throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); + } else if (count($tokens) == 1) { + $to = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); + } else { + $to = null; + } + + if ($from === null && $to === null) { + throw new Zend_Search_Lucene_Search_QueryParserException('At least one range query boundary term must be non-empty term'); + } + + $rangeQuery = new Zend_Search_Lucene_Search_Query_Range($from, $to, true); + $entry = new Zend_Search_Lucene_Search_QueryEntry_Subquery($rangeQuery); + $this->_context->addEntry($entry); + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParserContext.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParserContext.php new file mode 100644 index 0000000000000000000000000000000000000000..5e33cd380e5cb7ce7e7b4bd286949a0bd27cca4a --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParserContext.php @@ -0,0 +1,416 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Search_Lucene_FSM */ +require_once 'Zend/Search/Lucene/FSM.php'; + + +/** Zend_Search_Lucene_Index_Term */ +require_once 'Zend/Search/Lucene/Index/Term.php'; + +/** Zend_Search_Lucene_Search_QueryToken */ +require_once 'Zend/Search/Lucene/Search/QueryToken.php'; + +/** Zend_Search_Lucene_Search_Query_Term */ +require_once 'Zend/Search/Lucene/Search/Query/Term.php'; + +/** Zend_Search_Lucene_Search_Query_MultiTerm */ +require_once 'Zend/Search/Lucene/Search/Query/MultiTerm.php'; + +/** Zend_Search_Lucene_Search_Query_Boolean */ +require_once 'Zend/Search/Lucene/Search/Query/Boolean.php'; + +/** Zend_Search_Lucene_Search_Query_Phrase */ +require_once 'Zend/Search/Lucene/Search/Query/Phrase.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + +/** Zend_Search_Lucene_Search_QueryParserException */ +require_once 'Zend/Search/Lucene/Search/QueryParserException.php'; + +/** Zend_Search_Lucene_Search_BooleanExpressionRecognizer */ +require_once 'Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php'; + +/** Zend_Search_Lucene_Search_QueryEntry */ +require_once 'Zend/Search/Lucene/Search/QueryEntry.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_QueryParserContext +{ + /** + * Default field for the context. + * + * null means, that term should be searched through all fields + * Zend_Search_Lucene_Search_Query::rewriteQuery($index) transletes such queries to several + * + * @var string|null + */ + private $_defaultField; + + /** + * Field specified for next entry + * + * @var string + */ + private $_nextEntryField = null; + + /** + * True means, that term is required. + * False means, that term is prohibited. + * null means, that term is neither prohibited, nor required + * + * @var boolean + */ + private $_nextEntrySign = null; + + + /** + * Entries grouping mode + */ + const GM_SIGNS = 0; // Signs mode: '+term1 term2 -term3 +(subquery1) -(subquery2)' + const GM_BOOLEAN = 1; // Boolean operators mode: 'term1 and term2 or (subquery1) and not (subquery2)' + + /** + * Grouping mode + * + * @var integer + */ + private $_mode = null; + + /** + * Entries signs. + * Used in GM_SIGNS grouping mode + * + * @var arrays + */ + private $_signs = array(); + + /** + * Query entries + * Each entry is a Zend_Search_Lucene_Search_QueryEntry object or + * boolean operator (Zend_Search_Lucene_Search_QueryToken class constant) + * + * @var array + */ + private $_entries = array(); + + /** + * Query string encoding + * + * @var string + */ + private $_encoding; + + + /** + * Context object constructor + * + * @param string $encoding + * @param string|null $defaultField + */ + public function __construct($encoding, $defaultField = null) + { + $this->_encoding = $encoding; + $this->_defaultField = $defaultField; + } + + + /** + * Get context default field + * + * @return string|null + */ + public function getField() + { + return ($this->_nextEntryField !== null) ? $this->_nextEntryField : $this->_defaultField; + } + + /** + * Set field for next entry + * + * @param string $field + */ + public function setNextEntryField($field) + { + $this->_nextEntryField = $field; + } + + + /** + * Set sign for next entry + * + * @param integer $sign + * @throws Zend_Search_Lucene_Exception + */ + public function setNextEntrySign($sign) + { + if ($this->_mode === self::GM_BOOLEAN) { + throw new Zend_Search_Lucene_Search_QueryParserException('It\'s not allowed to mix boolean and signs styles in the same subquery.'); + } + + $this->_mode = self::GM_SIGNS; + + if ($sign == Zend_Search_Lucene_Search_QueryToken::TT_REQUIRED) { + $this->_nextEntrySign = true; + } else if ($sign == Zend_Search_Lucene_Search_QueryToken::TT_PROHIBITED) { + $this->_nextEntrySign = false; + } else { + throw new Zend_Search_Lucene_Exception('Unrecognized sign type.'); + } + } + + + /** + * Add entry to a query + * + * @param Zend_Search_Lucene_Search_QueryEntry $entry + */ + public function addEntry(Zend_Search_Lucene_Search_QueryEntry $entry) + { + if ($this->_mode !== self::GM_BOOLEAN) { + $this->_signs[] = $this->_nextEntrySign; + } + + $this->_entries[] = $entry; + + $this->_nextEntryField = null; + $this->_nextEntrySign = null; + } + + + /** + * Process fuzzy search or proximity search modifier + * + * @throws Zend_Search_Lucene_Search_QueryParserException + */ + public function processFuzzyProximityModifier($parameter = null) + { + // Check, that modifier has came just after word or phrase + if ($this->_nextEntryField !== null || $this->_nextEntrySign !== null) { + throw new Zend_Search_Lucene_Search_QueryParserException('\'~\' modifier must follow word or phrase.'); + } + + $lastEntry = array_pop($this->_entries); + + if (!$lastEntry instanceof Zend_Search_Lucene_Search_QueryEntry) { + // there are no entries or last entry is boolean operator + throw new Zend_Search_Lucene_Search_QueryParserException('\'~\' modifier must follow word or phrase.'); + } + + $lastEntry->processFuzzyProximityModifier($parameter); + + $this->_entries[] = $lastEntry; + } + + /** + * Set boost factor to the entry + * + * @param float $boostFactor + */ + public function boost($boostFactor) + { + // Check, that modifier has came just after word or phrase + if ($this->_nextEntryField !== null || $this->_nextEntrySign !== null) { + throw new Zend_Search_Lucene_Search_QueryParserException('\'^\' modifier must follow word, phrase or subquery.'); + } + + $lastEntry = array_pop($this->_entries); + + if (!$lastEntry instanceof Zend_Search_Lucene_Search_QueryEntry) { + // there are no entries or last entry is boolean operator + throw new Zend_Search_Lucene_Search_QueryParserException('\'^\' modifier must follow word, phrase or subquery.'); + } + + $lastEntry->boost($boostFactor); + + $this->_entries[] = $lastEntry; + } + + /** + * Process logical operator + * + * @param integer $operator + */ + public function addLogicalOperator($operator) + { + if ($this->_mode === self::GM_SIGNS) { + throw new Zend_Search_Lucene_Search_QueryParserException('It\'s not allowed to mix boolean and signs styles in the same subquery.'); + } + + $this->_mode = self::GM_BOOLEAN; + + $this->_entries[] = $operator; + } + + + /** + * Generate 'signs style' query from the context + * '+term1 term2 -term3 +(<subquery1>) ...' + * + * @return Zend_Search_Lucene_Search_Query + */ + public function _signStyleExpressionQuery() + { + $query = new Zend_Search_Lucene_Search_Query_Boolean(); + + if (Zend_Search_Lucene_Search_QueryParser::getDefaultOperator() == Zend_Search_Lucene_Search_QueryParser::B_AND) { + $defaultSign = true; // required + } else { + // Zend_Search_Lucene_Search_QueryParser::B_OR + $defaultSign = null; // optional + } + + foreach ($this->_entries as $entryId => $entry) { + $sign = ($this->_signs[$entryId] !== null) ? $this->_signs[$entryId] : $defaultSign; + $query->addSubquery($entry->getQuery($this->_encoding), $sign); + } + + return $query; + } + + + /** + * Generate 'boolean style' query from the context + * 'term1 and term2 or term3 and (<subquery1>) and not (<subquery2>)' + * + * @return Zend_Search_Lucene_Search_Query + * @throws Zend_Search_Lucene + */ + private function _booleanExpressionQuery() + { + /** + * We treat each level of an expression as a boolean expression in + * a Disjunctive Normal Form + * + * AND operator has higher precedence than OR + * + * Thus logical query is a disjunction of one or more conjunctions of + * one or more query entries + */ + + $expressionRecognizer = new Zend_Search_Lucene_Search_BooleanExpressionRecognizer(); + + try { + foreach ($this->_entries as $entry) { + if ($entry instanceof Zend_Search_Lucene_Search_QueryEntry) { + $expressionRecognizer->processLiteral($entry); + } else { + switch ($entry) { + case Zend_Search_Lucene_Search_QueryToken::TT_AND_LEXEME: + $expressionRecognizer->processOperator(Zend_Search_Lucene_Search_BooleanExpressionRecognizer::IN_AND_OPERATOR); + break; + + case Zend_Search_Lucene_Search_QueryToken::TT_OR_LEXEME: + $expressionRecognizer->processOperator(Zend_Search_Lucene_Search_BooleanExpressionRecognizer::IN_OR_OPERATOR); + break; + + case Zend_Search_Lucene_Search_QueryToken::TT_NOT_LEXEME: + $expressionRecognizer->processOperator(Zend_Search_Lucene_Search_BooleanExpressionRecognizer::IN_NOT_OPERATOR); + break; + + default: + throw new Zend_Search_Lucene('Boolean expression error. Unknown operator type.'); + } + } + } + + $conjuctions = $expressionRecognizer->finishExpression(); + } catch (Zend_Search_Exception $e) { + // throw new Zend_Search_Lucene_Search_QueryParserException('Boolean expression error. Error message: \'' . + // $e->getMessage() . '\'.' ); + // It's query syntax error message and it should be user friendly. So FSM message is omitted + throw new Zend_Search_Lucene_Search_QueryParserException('Boolean expression error.'); + } + + // Remove 'only negative' conjunctions + foreach ($conjuctions as $conjuctionId => $conjuction) { + $nonNegativeEntryFound = false; + + foreach ($conjuction as $conjuctionEntry) { + if ($conjuctionEntry[1]) { + $nonNegativeEntryFound = true; + break; + } + } + + if (!$nonNegativeEntryFound) { + unset($conjuctions[$conjuctionId]); + } + } + + + $subqueries = array(); + foreach ($conjuctions as $conjuction) { + // Check, if it's a one term conjuction + if (count($conjuction) == 1) { + $subqueries[] = $conjuction[0][0]->getQuery($this->_encoding); + } else { + $subquery = new Zend_Search_Lucene_Search_Query_Boolean(); + + foreach ($conjuction as $conjuctionEntry) { + $subquery->addSubquery($conjuctionEntry[0]->getQuery($this->_encoding), $conjuctionEntry[1]); + } + + $subqueries[] = $subquery; + } + } + + if (count($subqueries) == 0) { + return new Zend_Search_Lucene_Search_Query_Insignificant(); + } + + if (count($subqueries) == 1) { + return $subqueries[0]; + } + + + $query = new Zend_Search_Lucene_Search_Query_Boolean(); + + foreach ($subqueries as $subquery) { + // Non-requirered entry/subquery + $query->addSubquery($subquery); + } + + return $query; + } + + /** + * Generate query from current context + * + * @return Zend_Search_Lucene_Search_Query + */ + public function getQuery() + { + if ($this->_mode === self::GM_BOOLEAN) { + return $this->_booleanExpressionQuery(); + } else { + return $this->_signStyleExpressionQuery(); + } + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParserException.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParserException.php new file mode 100644 index 0000000000000000000000000000000000000000..c1078d4a733a287025805f56ac0676a7b2029443 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryParserException.php @@ -0,0 +1,40 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * Zend_Search_Lucene base exception + */ +require_once 'Zend/Search/Lucene/Exception.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * + * Special exception type, which may be used to intercept wrong user input + */ +class Zend_Search_Lucene_Search_QueryParserException extends Zend_Search_Lucene_Exception +{} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryToken.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryToken.php new file mode 100644 index 0000000000000000000000000000000000000000..e429b0c77a784f0ceda8091dfacdb29ccd1d8eb5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/QueryToken.php @@ -0,0 +1,228 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_QueryToken +{ + /** + * Token types. + */ + const TT_WORD = 0; // Word + const TT_PHRASE = 1; // Phrase (one or several quoted words) + const TT_FIELD = 2; // Field name in 'field:word', field:<phrase> or field:(<subquery>) pairs + const TT_FIELD_INDICATOR = 3; // ':' + const TT_REQUIRED = 4; // '+' + const TT_PROHIBITED = 5; // '-' + const TT_FUZZY_PROX_MARK = 6; // '~' + const TT_BOOSTING_MARK = 7; // '^' + const TT_RANGE_INCL_START = 8; // '[' + const TT_RANGE_INCL_END = 9; // ']' + const TT_RANGE_EXCL_START = 10; // '{' + const TT_RANGE_EXCL_END = 11; // '}' + const TT_SUBQUERY_START = 12; // '(' + const TT_SUBQUERY_END = 13; // ')' + const TT_AND_LEXEME = 14; // 'AND' or 'and' + const TT_OR_LEXEME = 15; // 'OR' or 'or' + const TT_NOT_LEXEME = 16; // 'NOT' or 'not' + const TT_TO_LEXEME = 17; // 'TO' or 'to' + const TT_NUMBER = 18; // Number, like: 10, 0.8, .64, .... + + + /** + * Returns all possible lexeme types. + * It's used for syntax analyzer state machine initialization + * + * @return array + */ + public static function getTypes() + { + return array( self::TT_WORD, + self::TT_PHRASE, + self::TT_FIELD, + self::TT_FIELD_INDICATOR, + self::TT_REQUIRED, + self::TT_PROHIBITED, + self::TT_FUZZY_PROX_MARK, + self::TT_BOOSTING_MARK, + self::TT_RANGE_INCL_START, + self::TT_RANGE_INCL_END, + self::TT_RANGE_EXCL_START, + self::TT_RANGE_EXCL_END, + self::TT_SUBQUERY_START, + self::TT_SUBQUERY_END, + self::TT_AND_LEXEME, + self::TT_OR_LEXEME, + self::TT_NOT_LEXEME, + self::TT_TO_LEXEME, + self::TT_NUMBER + ); + } + + + /** + * TokenCategories + */ + const TC_WORD = 0; // Word + const TC_PHRASE = 1; // Phrase (one or several quoted words) + const TC_NUMBER = 2; // Nubers, which are used with syntax elements. Ex. roam~0.8 + const TC_SYNTAX_ELEMENT = 3; // + - ( ) [ ] { } ! || && ~ ^ + + + /** + * Token type. + * + * @var integer + */ + public $type; + + /** + * Token text. + * + * @var integer + */ + public $text; + + /** + * Token position within query. + * + * @var integer + */ + public $position; + + + /** + * IndexReader constructor needs token type and token text as a parameters. + * + * @param integer $tokenCategory + * @param string $tokText + * @param integer $position + */ + public function __construct($tokenCategory, $tokenText, $position) + { + $this->text = $tokenText; + $this->position = $position + 1; // Start from 1 + + switch ($tokenCategory) { + case self::TC_WORD: + if ( strtolower($tokenText) == 'and') { + $this->type = self::TT_AND_LEXEME; + } else if (strtolower($tokenText) == 'or') { + $this->type = self::TT_OR_LEXEME; + } else if (strtolower($tokenText) == 'not') { + $this->type = self::TT_NOT_LEXEME; + } else if (strtolower($tokenText) == 'to') { + $this->type = self::TT_TO_LEXEME; + } else { + $this->type = self::TT_WORD; + } + break; + + case self::TC_PHRASE: + $this->type = self::TT_PHRASE; + break; + + case self::TC_NUMBER: + $this->type = self::TT_NUMBER; + break; + + case self::TC_SYNTAX_ELEMENT: + switch ($tokenText) { + case ':': + $this->type = self::TT_FIELD_INDICATOR; + break; + + case '+': + $this->type = self::TT_REQUIRED; + break; + + case '-': + $this->type = self::TT_PROHIBITED; + break; + + case '~': + $this->type = self::TT_FUZZY_PROX_MARK; + break; + + case '^': + $this->type = self::TT_BOOSTING_MARK; + break; + + case '[': + $this->type = self::TT_RANGE_INCL_START; + break; + + case ']': + $this->type = self::TT_RANGE_INCL_END; + break; + + case '{': + $this->type = self::TT_RANGE_EXCL_START; + break; + + case '}': + $this->type = self::TT_RANGE_EXCL_END; + break; + + case '(': + $this->type = self::TT_SUBQUERY_START; + break; + + case ')': + $this->type = self::TT_SUBQUERY_END; + break; + + case '!': + $this->type = self::TT_NOT_LEXEME; + break; + + case '&&': + $this->type = self::TT_AND_LEXEME; + break; + + case '||': + $this->type = self::TT_OR_LEXEME; + break; + + default: + throw new Zend_Search_Lucene_Exception('Unrecognized query syntax lexeme: \'' . $tokenText . '\''); + } + break; + + case self::TC_NUMBER: + $this->type = self::TT_NUMBER; + + default: + throw new Zend_Search_Lucene_Exception('Unrecognized lexeme type: \'' . $tokenCategory . '\''); + } + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Similarity.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Similarity.php new file mode 100644 index 0000000000000000000000000000000000000000..f8076b26fd492634df8126fa440bff8cc3c52b08 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Similarity.php @@ -0,0 +1,553 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Similarity_Default */ +require_once 'Zend/Search/Lucene/Search/Similarity/Default.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Search_Similarity +{ + /** + * The Similarity implementation used by default. + * + * @var Zend_Search_Lucene_Search_Similarity + */ + private static $_defaultImpl; + + /** + * Cache of decoded bytes. + * Array of floats + * + * @var array + */ + private static $_normTable = array( 0 => 0.0, + 1 => 5.820766E-10, + 2 => 6.9849193E-10, + 3 => 8.1490725E-10, + 4 => 9.313226E-10, + 5 => 1.1641532E-9, + 6 => 1.3969839E-9, + 7 => 1.6298145E-9, + 8 => 1.8626451E-9, + 9 => 2.3283064E-9, + 10 => 2.7939677E-9, + 11 => 3.259629E-9, + 12 => 3.7252903E-9, + 13 => 4.656613E-9, + 14 => 5.5879354E-9, + 15 => 6.519258E-9, + 16 => 7.4505806E-9, + 17 => 9.313226E-9, + 18 => 1.1175871E-8, + 19 => 1.3038516E-8, + 20 => 1.4901161E-8, + 21 => 1.8626451E-8, + 22 => 2.2351742E-8, + 23 => 2.6077032E-8, + 24 => 2.9802322E-8, + 25 => 3.7252903E-8, + 26 => 4.4703484E-8, + 27 => 5.2154064E-8, + 28 => 5.9604645E-8, + 29 => 7.4505806E-8, + 30 => 8.940697E-8, + 31 => 1.0430813E-7, + 32 => 1.1920929E-7, + 33 => 1.4901161E-7, + 34 => 1.7881393E-7, + 35 => 2.0861626E-7, + 36 => 2.3841858E-7, + 37 => 2.9802322E-7, + 38 => 3.5762787E-7, + 39 => 4.172325E-7, + 40 => 4.7683716E-7, + 41 => 5.9604645E-7, + 42 => 7.1525574E-7, + 43 => 8.34465E-7, + 44 => 9.536743E-7, + 45 => 1.1920929E-6, + 46 => 1.4305115E-6, + 47 => 1.66893E-6, + 48 => 1.9073486E-6, + 49 => 2.3841858E-6, + 50 => 2.861023E-6, + 51 => 3.33786E-6, + 52 => 3.8146973E-6, + 53 => 4.7683716E-6, + 54 => 5.722046E-6, + 55 => 6.67572E-6, + 56 => 7.6293945E-6, + 57 => 9.536743E-6, + 58 => 1.1444092E-5, + 59 => 1.335144E-5, + 60 => 1.5258789E-5, + 61 => 1.9073486E-5, + 62 => 2.2888184E-5, + 63 => 2.670288E-5, + 64 => 3.0517578E-5, + 65 => 3.8146973E-5, + 66 => 4.5776367E-5, + 67 => 5.340576E-5, + 68 => 6.1035156E-5, + 69 => 7.6293945E-5, + 70 => 9.1552734E-5, + 71 => 1.0681152E-4, + 72 => 1.2207031E-4, + 73 => 1.5258789E-4, + 74 => 1.8310547E-4, + 75 => 2.1362305E-4, + 76 => 2.4414062E-4, + 77 => 3.0517578E-4, + 78 => 3.6621094E-4, + 79 => 4.272461E-4, + 80 => 4.8828125E-4, + 81 => 6.1035156E-4, + 82 => 7.324219E-4, + 83 => 8.544922E-4, + 84 => 9.765625E-4, + 85 => 0.0012207031, + 86 => 0.0014648438, + 87 => 0.0017089844, + 88 => 0.001953125, + 89 => 0.0024414062, + 90 => 0.0029296875, + 91 => 0.0034179688, + 92 => 0.00390625, + 93 => 0.0048828125, + 94 => 0.005859375, + 95 => 0.0068359375, + 96 => 0.0078125, + 97 => 0.009765625, + 98 => 0.01171875, + 99 => 0.013671875, + 100 => 0.015625, + 101 => 0.01953125, + 102 => 0.0234375, + 103 => 0.02734375, + 104 => 0.03125, + 105 => 0.0390625, + 106 => 0.046875, + 107 => 0.0546875, + 108 => 0.0625, + 109 => 0.078125, + 110 => 0.09375, + 111 => 0.109375, + 112 => 0.125, + 113 => 0.15625, + 114 => 0.1875, + 115 => 0.21875, + 116 => 0.25, + 117 => 0.3125, + 118 => 0.375, + 119 => 0.4375, + 120 => 0.5, + 121 => 0.625, + 122 => 0.75, + 123 => 0.875, + 124 => 1.0, + 125 => 1.25, + 126 => 1.5, + 127 => 1.75, + 128 => 2.0, + 129 => 2.5, + 130 => 3.0, + 131 => 3.5, + 132 => 4.0, + 133 => 5.0, + 134 => 6.0, + 135 => 7.0, + 136 => 8.0, + 137 => 10.0, + 138 => 12.0, + 139 => 14.0, + 140 => 16.0, + 141 => 20.0, + 142 => 24.0, + 143 => 28.0, + 144 => 32.0, + 145 => 40.0, + 146 => 48.0, + 147 => 56.0, + 148 => 64.0, + 149 => 80.0, + 150 => 96.0, + 151 => 112.0, + 152 => 128.0, + 153 => 160.0, + 154 => 192.0, + 155 => 224.0, + 156 => 256.0, + 157 => 320.0, + 158 => 384.0, + 159 => 448.0, + 160 => 512.0, + 161 => 640.0, + 162 => 768.0, + 163 => 896.0, + 164 => 1024.0, + 165 => 1280.0, + 166 => 1536.0, + 167 => 1792.0, + 168 => 2048.0, + 169 => 2560.0, + 170 => 3072.0, + 171 => 3584.0, + 172 => 4096.0, + 173 => 5120.0, + 174 => 6144.0, + 175 => 7168.0, + 176 => 8192.0, + 177 => 10240.0, + 178 => 12288.0, + 179 => 14336.0, + 180 => 16384.0, + 181 => 20480.0, + 182 => 24576.0, + 183 => 28672.0, + 184 => 32768.0, + 185 => 40960.0, + 186 => 49152.0, + 187 => 57344.0, + 188 => 65536.0, + 189 => 81920.0, + 190 => 98304.0, + 191 => 114688.0, + 192 => 131072.0, + 193 => 163840.0, + 194 => 196608.0, + 195 => 229376.0, + 196 => 262144.0, + 197 => 327680.0, + 198 => 393216.0, + 199 => 458752.0, + 200 => 524288.0, + 201 => 655360.0, + 202 => 786432.0, + 203 => 917504.0, + 204 => 1048576.0, + 205 => 1310720.0, + 206 => 1572864.0, + 207 => 1835008.0, + 208 => 2097152.0, + 209 => 2621440.0, + 210 => 3145728.0, + 211 => 3670016.0, + 212 => 4194304.0, + 213 => 5242880.0, + 214 => 6291456.0, + 215 => 7340032.0, + 216 => 8388608.0, + 217 => 1.048576E7, + 218 => 1.2582912E7, + 219 => 1.4680064E7, + 220 => 1.6777216E7, + 221 => 2.097152E7, + 222 => 2.5165824E7, + 223 => 2.9360128E7, + 224 => 3.3554432E7, + 225 => 4.194304E7, + 226 => 5.0331648E7, + 227 => 5.8720256E7, + 228 => 6.7108864E7, + 229 => 8.388608E7, + 230 => 1.00663296E8, + 231 => 1.17440512E8, + 232 => 1.34217728E8, + 233 => 1.6777216E8, + 234 => 2.01326592E8, + 235 => 2.34881024E8, + 236 => 2.68435456E8, + 237 => 3.3554432E8, + 238 => 4.02653184E8, + 239 => 4.69762048E8, + 240 => 5.3687091E8, + 241 => 6.7108864E8, + 242 => 8.0530637E8, + 243 => 9.395241E8, + 244 => 1.07374182E9, + 245 => 1.34217728E9, + 246 => 1.61061274E9, + 247 => 1.87904819E9, + 248 => 2.14748365E9, + 249 => 2.68435456E9, + 250 => 3.22122547E9, + 251 => 3.75809638E9, + 252 => 4.2949673E9, + 253 => 5.3687091E9, + 254 => 6.4424509E9, + 255 => 7.5161928E9 ); + + + /** + * Set the default Similarity implementation used by indexing and search + * code. + * + * @param Zend_Search_Lucene_Search_Similarity $similarity + */ + public static function setDefault(Zend_Search_Lucene_Search_Similarity $similarity) + { + self::$_defaultImpl = $similarity; + } + + + /** + * Return the default Similarity implementation used by indexing and search + * code. + * + * @return Zend_Search_Lucene_Search_Similarity + */ + public static function getDefault() + { + if (!self::$_defaultImpl instanceof Zend_Search_Lucene_Search_Similarity) { + self::$_defaultImpl = new Zend_Search_Lucene_Search_Similarity_Default(); + } + + return self::$_defaultImpl; + } + + + /** + * Computes the normalization value for a field given the total number of + * terms contained in a field. These values, together with field boosts, are + * stored in an index and multipled into scores for hits on each field by the + * search code. + * + * Matches in longer fields are less precise, so implemenations of this + * method usually return smaller values when 'numTokens' is large, + * and larger values when 'numTokens' is small. + * + * That these values are computed under + * IndexWriter::addDocument(Document) and stored then using + * encodeNorm(float). Thus they have limited precision, and documents + * must be re-indexed if this method is altered. + * + * fieldName - name of field + * numTokens - the total number of tokens contained in fields named + * 'fieldName' of 'doc'. + * Returns a normalization factor for hits on this field of this document + * + * @param string $fieldName + * @param integer $numTokens + * @return float + */ + abstract public function lengthNorm($fieldName, $numTokens); + + /** + * Computes the normalization value for a query given the sum of the squared + * weights of each of the query terms. This value is then multipled into the + * weight of each query term. + * + * This does not affect ranking, but rather just attempts to make scores + * from different queries comparable. + * + * sumOfSquaredWeights - the sum of the squares of query term weights + * Returns a normalization factor for query weights + * + * @param float $sumOfSquaredWeights + * @return float + */ + abstract public function queryNorm($sumOfSquaredWeights); + + + /** + * Decodes a normalization factor stored in an index. + * + * @param integer $byte + * @return float + */ + public static function decodeNorm($byte) + { + return self::$_normTable[$byte & 0xFF]; + } + + + /** + * Encodes a normalization factor for storage in an index. + * + * The encoding uses a five-bit exponent and three-bit mantissa, thus + * representing values from around 7x10^9 to 2x10^-9 with about one + * significant decimal digit of accuracy. Zero is also represented. + * Negative numbers are rounded up to zero. Values too large to represent + * are rounded down to the largest representable value. Positive values too + * small to represent are rounded up to the smallest positive representable + * value. + * + * @param float $f + * @return integer + */ + static function encodeNorm($f) + { + return self::_floatToByte($f); + } + + /** + * Float to byte conversion + * + * @param integer $b + * @return float + */ + private static function _floatToByte($f) + { + // round negatives up to zero + if ($f <= 0.0) { + return 0; + } + + // search for appropriate value + $lowIndex = 0; + $highIndex = 255; + while ($highIndex >= $lowIndex) { + // $mid = ($highIndex - $lowIndex)/2; + $mid = ($highIndex + $lowIndex) >> 1; + $delta = $f - self::$_normTable[$mid]; + + if ($delta < 0) { + $highIndex = $mid-1; + } elseif ($delta > 0) { + $lowIndex = $mid+1; + } else { + return $mid; // We got it! + } + } + + // round to closest value + if ($highIndex != 255 && + $f - self::$_normTable[$highIndex] > self::$_normTable[$highIndex+1] - $f ) { + return $highIndex + 1; + } else { + return $highIndex; + } + } + + + /** + * Computes a score factor based on a term or phrase's frequency in a + * document. This value is multiplied by the idf(Term, Searcher) + * factor for each term in the query and these products are then summed to + * form the initial score for a document. + * + * Terms and phrases repeated in a document indicate the topic of the + * document, so implementations of this method usually return larger values + * when 'freq' is large, and smaller values when 'freq' + * is small. + * + * freq - the frequency of a term within a document + * Returns a score factor based on a term's within-document frequency + * + * @param float $freq + * @return float + */ + abstract public function tf($freq); + + /** + * Computes the amount of a sloppy phrase match, based on an edit distance. + * This value is summed for each sloppy phrase match in a document to form + * the frequency that is passed to tf(float). + * + * A phrase match with a small edit distance to a document passage more + * closely matches the document, so implementations of this method usually + * return larger values when the edit distance is small and smaller values + * when it is large. + * + * distance - the edit distance of this sloppy phrase match + * Returns the frequency increment for this match + * + * @param integer $distance + * @return float + */ + abstract public function sloppyFreq($distance); + + + /** + * Computes a score factor for a simple term or a phrase. + * + * The default implementation is: + * return idfFreq(searcher.docFreq(term), searcher.maxDoc()); + * + * input - the term in question or array of terms + * reader - reader the document collection being searched + * Returns a score factor for the term + * + * @param mixed $input + * @param Zend_Search_Lucene_Interface $reader + * @return a score factor for the term + */ + public function idf($input, Zend_Search_Lucene_Interface $reader) + { + if (!is_array($input)) { + return $this->idfFreq($reader->docFreq($input), $reader->count()); + } else { + $idf = 0.0; + foreach ($input as $term) { + $idf += $this->idfFreq($reader->docFreq($term), $reader->count()); + } + return $idf; + } + } + + /** + * Computes a score factor based on a term's document frequency (the number + * of documents which contain the term). This value is multiplied by the + * tf(int) factor for each term in the query and these products are + * then summed to form the initial score for a document. + * + * Terms that occur in fewer documents are better indicators of topic, so + * implemenations of this method usually return larger values for rare terms, + * and smaller values for common terms. + * + * docFreq - the number of documents which contain the term + * numDocs - the total number of documents in the collection + * Returns a score factor based on the term's document frequency + * + * @param integer $docFreq + * @param integer $numDocs + * @return float + */ + abstract public function idfFreq($docFreq, $numDocs); + + /** + * Computes a score factor based on the fraction of all query terms that a + * document contains. This value is multiplied into scores. + * + * The presence of a large portion of the query terms indicates a better + * match with the query, so implemenations of this method usually return + * larger values when the ratio between these parameters is large and smaller + * values when the ratio between them is small. + * + * overlap - the number of query terms matched in the document + * maxOverlap - the total number of terms in the query + * Returns a score factor based on term overlap with the query + * + * @param integer $overlap + * @param integer $maxOverlap + * @return float + */ + abstract public function coord($overlap, $maxOverlap); +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Similarity/Default.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Similarity/Default.php new file mode 100644 index 0000000000000000000000000000000000000000..1c01cb1b2659bf6578bb27477001158d8e2e1306 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Similarity/Default.php @@ -0,0 +1,109 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Similarity */ +require_once 'Zend/Search/Lucene/Search/Similarity.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Similarity_Default extends Zend_Search_Lucene_Search_Similarity +{ + + /** + * Implemented as '1/sqrt(numTerms)'. + * + * @param string $fieldName + * @param integer $numTerms + * @return float + */ + public function lengthNorm($fieldName, $numTerms) + { + if ($numTerms == 0) { + return 1E10; + } + + return 1.0/sqrt($numTerms); + } + + /** + * Implemented as '1/sqrt(sumOfSquaredWeights)'. + * + * @param float $sumOfSquaredWeights + * @return float + */ + public function queryNorm($sumOfSquaredWeights) + { + return 1.0/sqrt($sumOfSquaredWeights); + } + + /** + * Implemented as 'sqrt(freq)'. + * + * @param float $freq + * @return float + */ + public function tf($freq) + { + return sqrt($freq); + } + + /** + * Implemented as '1/(distance + 1)'. + * + * @param integer $distance + * @return float + */ + public function sloppyFreq($distance) + { + return 1.0/($distance + 1); + } + + /** + * Implemented as 'log(numDocs/(docFreq+1)) + 1'. + * + * @param integer $docFreq + * @param integer $numDocs + * @return float + */ + public function idfFreq($docFreq, $numDocs) + { + return log($numDocs/(float)($docFreq+1)) + 1.0; + } + + /** + * Implemented as 'overlap/maxOverlap'. + * + * @param integer $overlap + * @param integer $maxOverlap + * @return float + */ + public function coord($overlap, $maxOverlap) + { + return $overlap/(float)$maxOverlap; + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight.php new file mode 100644 index 0000000000000000000000000000000000000000..bf5e41fcd0e396300f932062ff77eb739f299cbc --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight.php @@ -0,0 +1,84 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * Calculate query weights and build query scorers. + * + * A Weight is constructed by a query Query->createWeight(). + * The sumOfSquaredWeights() method is then called on the top-level + * query to compute the query normalization factor Similarity->queryNorm(float). + * This factor is then passed to normalize(float). At this point the weighting + * is complete. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Search_Weight +{ + /** + * Normalization factor. + * This value is stored only for query expanation purpose and not used in any other place + * + * @var float + */ + protected $_queryNorm; + + /** + * Weight value + * + * Weight value may be initialized in sumOfSquaredWeights() or normalize() + * because they both are invoked either in Query::_initWeight (for top-level query) or + * in corresponding methods of parent query's weights + * + * @var float + */ + protected $_value; + + + /** + * The weight for this query. + * + * @return float + */ + public function getValue() + { + return $this->_value; + } + + /** + * The sum of squared weights of contained query clauses. + * + * @return float + */ + abstract public function sumOfSquaredWeights(); + + /** + * Assigns the query normalization factor to this. + * + * @param $norm + */ + abstract public function normalize($norm); +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Boolean.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Boolean.php new file mode 100644 index 0000000000000000000000000000000000000000..276af640dd1c3378655f82dc83f776498f54f6ed --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Boolean.php @@ -0,0 +1,136 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Weight */ +require_once 'Zend/Search/Lucene/Search/Weight.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Weight_Boolean extends Zend_Search_Lucene_Search_Weight +{ + /** + * IndexReader. + * + * @var Zend_Search_Lucene_Interface + */ + private $_reader; + + /** + * The query that this concerns. + * + * @var Zend_Search_Lucene_Search_Query + */ + private $_query; + + /** + * Queries weights + * Array of Zend_Search_Lucene_Search_Weight + * + * @var array + */ + private $_weights; + + + /** + * Zend_Search_Lucene_Search_Weight_Boolean constructor + * query - the query that this concerns. + * reader - index reader + * + * @param Zend_Search_Lucene_Search_Query $query + * @param Zend_Search_Lucene_Interface $reader + */ + public function __construct(Zend_Search_Lucene_Search_Query $query, + Zend_Search_Lucene_Interface $reader) + { + $this->_query = $query; + $this->_reader = $reader; + $this->_weights = array(); + + $signs = $query->getSigns(); + + foreach ($query->getSubqueries() as $num => $subquery) { + if ($signs === null || $signs[$num] === null || $signs[$num]) { + $this->_weights[$num] = $subquery->createWeight($reader); + } + } + } + + + /** + * The weight for this query + * Standard Weight::$_value is not used for boolean queries + * + * @return float + */ + public function getValue() + { + return $this->_query->getBoost(); + } + + + /** + * The sum of squared weights of contained query clauses. + * + * @return float + */ + public function sumOfSquaredWeights() + { + $sum = 0; + foreach ($this->_weights as $weight) { + // sum sub weights + $sum += $weight->sumOfSquaredWeights(); + } + + // boost each sub-weight + $sum *= $this->_query->getBoost() * $this->_query->getBoost(); + + // check for empty query (like '-something -another') + if ($sum == 0) { + $sum = 1.0; + } + return $sum; + } + + + /** + * Assigns the query normalization factor to this. + * + * @param float $queryNorm + */ + public function normalize($queryNorm) + { + // incorporate boost + $queryNorm *= $this->_query->getBoost(); + + foreach ($this->_weights as $weight) { + $weight->normalize($queryNorm); + } + } +} + + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Empty.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Empty.php new file mode 100644 index 0000000000000000000000000000000000000000..3e193660ea43979c5e43aaa9dc1550755ad7a310 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Empty.php @@ -0,0 +1,56 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Weight */ +require_once 'Zend/Search/Lucene/Search/Weight.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Weight_Empty extends Zend_Search_Lucene_Search_Weight +{ + /** + * The sum of squared weights of contained query clauses. + * + * @return float + */ + public function sumOfSquaredWeights() + { + return 1; + } + + + /** + * Assigns the query normalization factor to this. + * + * @param float $queryNorm + */ + public function normalize($queryNorm) + { + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/MultiTerm.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/MultiTerm.php new file mode 100644 index 0000000000000000000000000000000000000000..b1645ce5e7c5bdc0d2753aa73ce8009ffedaddbe --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/MultiTerm.php @@ -0,0 +1,137 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Weight */ +require_once 'Zend/Search/Lucene/Search/Weight.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Weight_MultiTerm extends Zend_Search_Lucene_Search_Weight +{ + /** + * IndexReader. + * + * @var Zend_Search_Lucene_Interface + */ + private $_reader; + + /** + * The query that this concerns. + * + * @var Zend_Search_Lucene_Search_Query + */ + private $_query; + + /** + * Query terms weights + * Array of Zend_Search_Lucene_Search_Weight_Term + * + * @var array + */ + private $_weights; + + + /** + * Zend_Search_Lucene_Search_Weight_MultiTerm constructor + * query - the query that this concerns. + * reader - index reader + * + * @param Zend_Search_Lucene_Search_Query $query + * @param Zend_Search_Lucene_Interface $reader + */ + public function __construct(Zend_Search_Lucene_Search_Query $query, + Zend_Search_Lucene_Interface $reader) + { + $this->_query = $query; + $this->_reader = $reader; + $this->_weights = array(); + + $signs = $query->getSigns(); + + foreach ($query->getTerms() as $id => $term) { + if ($signs === null || $signs[$id] === null || $signs[$id]) { + $this->_weights[$id] = new Zend_Search_Lucene_Search_Weight_Term($term, $query, $reader); + $query->setWeight($id, $this->_weights[$id]); + } + } + } + + + /** + * The weight for this query + * Standard Weight::$_value is not used for boolean queries + * + * @return float + */ + public function getValue() + { + return $this->_query->getBoost(); + } + + + /** + * The sum of squared weights of contained query clauses. + * + * @return float + */ + public function sumOfSquaredWeights() + { + $sum = 0; + foreach ($this->_weights as $weight) { + // sum sub weights + $sum += $weight->sumOfSquaredWeights(); + } + + // boost each sub-weight + $sum *= $this->_query->getBoost() * $this->_query->getBoost(); + + // check for empty query (like '-something -another') + if ($sum == 0) { + $sum = 1.0; + } + return $sum; + } + + + /** + * Assigns the query normalization factor to this. + * + * @param float $queryNorm + */ + public function normalize($queryNorm) + { + // incorporate boost + $queryNorm *= $this->_query->getBoost(); + + foreach ($this->_weights as $weight) { + $weight->normalize($queryNorm); + } + } +} + + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Phrase.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Phrase.php new file mode 100644 index 0000000000000000000000000000000000000000..385d6bf405126b5f9a9dcc9ab04be3c5528677f3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Phrase.php @@ -0,0 +1,107 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * Zend_Search_Lucene_Search_Weight + */ +require_once 'Zend/Search/Lucene/Search/Weight.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Weight_Phrase extends Zend_Search_Lucene_Search_Weight +{ + /** + * IndexReader. + * + * @var Zend_Search_Lucene_Interface + */ + private $_reader; + + /** + * The query that this concerns. + * + * @var Zend_Search_Lucene_Search_Query_Phrase + */ + private $_query; + + /** + * Score factor + * + * @var float + */ + private $_idf; + + /** + * Zend_Search_Lucene_Search_Weight_Phrase constructor + * + * @param Zend_Search_Lucene_Search_Query_Phrase $query + * @param Zend_Search_Lucene_Interface $reader + */ + public function __construct(Zend_Search_Lucene_Search_Query_Phrase $query, + Zend_Search_Lucene_Interface $reader) + { + $this->_query = $query; + $this->_reader = $reader; + } + + /** + * The sum of squared weights of contained query clauses. + * + * @return float + */ + public function sumOfSquaredWeights() + { + // compute idf + $this->_idf = $this->_reader->getSimilarity()->idf($this->_query->getTerms(), $this->_reader); + + // compute query weight + $this->_queryWeight = $this->_idf * $this->_query->getBoost(); + + // square it + return $this->_queryWeight * $this->_queryWeight; + } + + + /** + * Assigns the query normalization factor to this. + * + * @param float $queryNorm + */ + public function normalize($queryNorm) + { + $this->_queryNorm = $queryNorm; + + // normalize query weight + $this->_queryWeight *= $queryNorm; + + // idf for documents + $this->_value = $this->_queryWeight * $this->_idf; + } +} + + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Term.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Term.php new file mode 100644 index 0000000000000000000000000000000000000000..a852f9f5797dba879d27ccadab6205ce3295f4c7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Search/Weight/Term.php @@ -0,0 +1,124 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Search_Weight */ +require_once 'Zend/Search/Lucene/Search/Weight.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Search + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Search_Weight_Term extends Zend_Search_Lucene_Search_Weight +{ + /** + * IndexReader. + * + * @var Zend_Search_Lucene_Interface + */ + private $_reader; + + /** + * Term + * + * @var Zend_Search_Lucene_Index_Term + */ + private $_term; + + /** + * The query that this concerns. + * + * @var Zend_Search_Lucene_Search_Query + */ + private $_query; + + /** + * Score factor + * + * @var float + */ + private $_idf; + + /** + * Query weight + * + * @var float + */ + private $_queryWeight; + + + /** + * Zend_Search_Lucene_Search_Weight_Term constructor + * reader - index reader + * + * @param Zend_Search_Lucene_Index_Term $term + * @param Zend_Search_Lucene_Search_Query $query + * @param Zend_Search_Lucene_Interface $reader + */ + public function __construct(Zend_Search_Lucene_Index_Term $term, + Zend_Search_Lucene_Search_Query $query, + Zend_Search_Lucene_Interface $reader) + { + $this->_term = $term; + $this->_query = $query; + $this->_reader = $reader; + } + + + /** + * The sum of squared weights of contained query clauses. + * + * @return float + */ + public function sumOfSquaredWeights() + { + // compute idf + $this->_idf = $this->_reader->getSimilarity()->idf($this->_term, $this->_reader); + + // compute query weight + $this->_queryWeight = $this->_idf * $this->_query->getBoost(); + + // square it + return $this->_queryWeight * $this->_queryWeight; + } + + + /** + * Assigns the query normalization factor to this. + * + * @param float $queryNorm + */ + public function normalize($queryNorm) + { + $this->_queryNorm = $queryNorm; + + // normalize query weight + $this->_queryWeight *= $queryNorm; + + // idf for documents + $this->_value = $this->_queryWeight * $this->_idf; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/Directory.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/Directory.php new file mode 100644 index 0000000000000000000000000000000000000000..f4e16ea702bfbd65253ecca0f5873a7c353775ea --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/Directory.php @@ -0,0 +1,135 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Storage_Directory +{ + + /** + * Closes the store. + * + * @return void + */ + abstract public function close(); + + /** + * Returns an array of strings, one for each file in the directory. + * + * @return array + */ + abstract public function fileList(); + + /** + * Creates a new, empty file in the directory with the given $filename. + * + * @param string $filename + * @return Zend_Search_Lucene_Storage_File + */ + abstract public function createFile($filename); + + + /** + * Removes an existing $filename in the directory. + * + * @param string $filename + * @return void + */ + abstract public function deleteFile($filename); + + /** + * Purge file if it's cached by directory object + * + * Method is used to prevent 'too many open files' error + * + * @param string $filename + * @return void + */ + abstract public function purgeFile($filename); + + /** + * Returns true if a file with the given $filename exists. + * + * @param string $filename + * @return boolean + */ + abstract public function fileExists($filename); + + + /** + * Returns the length of a $filename in the directory. + * + * @param string $filename + * @return integer + */ + abstract public function fileLength($filename); + + + /** + * Returns the UNIX timestamp $filename was last modified. + * + * @param string $filename + * @return integer + */ + abstract public function fileModified($filename); + + + /** + * Renames an existing file in the directory. + * + * @param string $from + * @param string $to + * @return void + */ + abstract public function renameFile($from, $to); + + + /** + * Sets the modified time of $filename to now. + * + * @param string $filename + * @return void + */ + abstract public function touchFile($filename); + + + /** + * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory. + * + * If $shareHandler option is true, then file handler can be shared between File Object + * requests. It speed-ups performance, but makes problems with file position. + * Shared handler are good for short atomic requests. + * Non-shared handlers are useful for stream file reading (especial for compound files). + * + * @param string $filename + * @param boolean $shareHandler + * @return Zend_Search_Lucene_Storage_File + */ + abstract public function getFileObject($filename, $shareHandler = true); + +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/Directory/Filesystem.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/Directory/Filesystem.php new file mode 100644 index 0000000000000000000000000000000000000000..ef94d16986cfa6dcaf792702d98162d718a71ac8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/Directory/Filesystem.php @@ -0,0 +1,362 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Storage_Directory */ +require_once 'Zend/Search/Lucene/Storage/Directory.php'; + +/** Zend_Search_Lucene_Storage_File_Filesystem */ +require_once 'Zend/Search/Lucene/Storage/File/Filesystem.php'; + + +/** + * FileSystem implementation of Directory abstraction. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Storage_Directory_Filesystem extends Zend_Search_Lucene_Storage_Directory +{ + /** + * Filesystem path to the directory + * + * @var string + */ + protected $_dirPath = null; + + /** + * Cache for Zend_Search_Lucene_Storage_File_Filesystem objects + * Array: filename => Zend_Search_Lucene_Storage_File object + * + * @var array + * @throws Zend_Search_Lucene_Exception + */ + protected $_fileHandlers; + + /** + * Default file permissions + * + * @var integer + */ + protected static $_defaultFilePermissions = 0666; + + + /** + * Get default file permissions + * + * @return integer + */ + public static function getDefaultFilePermissions() + { + return self::$_defaultFilePermissions; + } + + /** + * Set default file permissions + * + * @param integer $mode + */ + public static function setDefaultFilePermissions($mode) + { + self::$_defaultFilePermissions = $mode; + } + + + /** + * Utility function to recursive directory creation + * + * @param string $dir + * @param integer $mode + * @param boolean $recursive + * @return boolean + */ + + public static function mkdirs($dir, $mode = 0777, $recursive = true) + { + if (is_null($dir) || $dir === '') { + return false; + } + if (is_dir($dir) || $dir === '/') { + return true; + } + if (self::mkdirs(dirname($dir), $mode, $recursive)) { + return mkdir($dir, $mode); + } + return false; + } + + + /** + * Object constructor + * Checks if $path is a directory or tries to create it. + * + * @param string $path + * @throws Zend_Search_Lucene_Exception + */ + public function __construct($path) + { + if (!is_dir($path)) { + if (file_exists($path)) { + require_once 'Zend/Search/Lucene/Exception.php'; + throw new Zend_Search_Lucene_Exception('Path exists, but it\'s not a directory'); + } else { + if (!self::mkdirs($path)) { + require_once 'Zend/Search/Lucene/Exception.php'; + throw new Zend_Search_Lucene_Exception("Can't create directory '$path'."); + } + } + } + $this->_dirPath = $path; + $this->_fileHandlers = array(); + } + + + /** + * Closes the store. + * + * @return void + */ + public function close() + { + foreach ($this->_fileHandlers as $fileObject) { + $fileObject->close(); + } + + $this->_fileHandlers = array(); + } + + + /** + * Returns an array of strings, one for each file in the directory. + * + * @return array + */ + public function fileList() + { + $result = array(); + + $dirContent = opendir( $this->_dirPath ); + while (($file = readdir($dirContent)) !== false) { + if (($file == '..')||($file == '.')) continue; + + if( !is_dir($this->_dirPath . '/' . $file) ) { + $result[] = $file; + } + } + closedir($dirContent); + + return $result; + } + + /** + * Creates a new, empty file in the directory with the given $filename. + * + * @param string $filename + * @return Zend_Search_Lucene_Storage_File + * @throws Zend_Search_Lucene_Exception + */ + public function createFile($filename) + { + if (isset($this->_fileHandlers[$filename])) { + $this->_fileHandlers[$filename]->close(); + } + unset($this->_fileHandlers[$filename]); + $this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'w+b'); + + // Set file permissions, but don't care about any possible failures, since file may be already + // created by anther user which has to care about right permissions + @chmod($this->_dirPath . '/' . $filename, self::$_defaultFilePermissions); + + return $this->_fileHandlers[$filename]; + } + + + /** + * Removes an existing $filename in the directory. + * + * @param string $filename + * @return void + * @throws Zend_Search_Lucene_Exception + */ + public function deleteFile($filename) + { + if (isset($this->_fileHandlers[$filename])) { + $this->_fileHandlers[$filename]->close(); + } + unset($this->_fileHandlers[$filename]); + + global $php_errormsg; + $trackErrors = ini_get('track_errors'); ini_set('track_errors', '1'); + if (!@unlink($this->_dirPath . '/' . $filename)) { + ini_set('track_errors', $trackErrors); + require_once 'Zend/Search/Lucene/Exception.php'; + throw new Zend_Search_Lucene_Exception('Can\'t delete file: ' . $php_errormsg); + } + ini_set('track_errors', $trackErrors); + } + + /** + * Purge file if it's cached by directory object + * + * Method is used to prevent 'too many open files' error + * + * @param string $filename + * @return void + */ + public function purgeFile($filename) + { + if (isset($this->_fileHandlers[$filename])) { + $this->_fileHandlers[$filename]->close(); + } + unset($this->_fileHandlers[$filename]); + } + + + /** + * Returns true if a file with the given $filename exists. + * + * @param string $filename + * @return boolean + */ + public function fileExists($filename) + { + return isset($this->_fileHandlers[$filename]) || + file_exists($this->_dirPath . '/' . $filename); + } + + + /** + * Returns the length of a $filename in the directory. + * + * @param string $filename + * @return integer + */ + public function fileLength($filename) + { + if (isset( $this->_fileHandlers[$filename] )) { + return $this->_fileHandlers[$filename]->size(); + } + return filesize($this->_dirPath .'/'. $filename); + } + + + /** + * Returns the UNIX timestamp $filename was last modified. + * + * @param string $filename + * @return integer + */ + public function fileModified($filename) + { + return filemtime($this->_dirPath .'/'. $filename); + } + + + /** + * Renames an existing file in the directory. + * + * @param string $from + * @param string $to + * @return void + * @throws Zend_Search_Lucene_Exception + */ + public function renameFile($from, $to) + { + global $php_errormsg; + + if (isset($this->_fileHandlers[$from])) { + $this->_fileHandlers[$from]->close(); + } + unset($this->_fileHandlers[$from]); + + if (isset($this->_fileHandlers[$to])) { + $this->_fileHandlers[$to]->close(); + } + unset($this->_fileHandlers[$to]); + + if (file_exists($this->_dirPath . '/' . $to)) { + if (!unlink($this->_dirPath . '/' . $to)) { + require_once 'Zend/Search/Lucene/Exception.php'; + throw new Zend_Search_Lucene_Exception('Delete operation failed'); + } + } + + $trackErrors = ini_get('track_errors'); + ini_set('track_errors', '1'); + + $success = @rename($this->_dirPath . '/' . $from, $this->_dirPath . '/' . $to); + if (!$success) { + ini_set('track_errors', $trackErrors); + require_once 'Zend/Search/Lucene/Exception.php'; + throw new Zend_Search_Lucene_Exception($php_errormsg); + } + + ini_set('track_errors', $trackErrors); + + return $success; + } + + + /** + * Sets the modified time of $filename to now. + * + * @param string $filename + * @return void + */ + public function touchFile($filename) + { + return touch($this->_dirPath .'/'. $filename); + } + + + /** + * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory. + * + * If $shareHandler option is true, then file handler can be shared between File Object + * requests. It speed-ups performance, but makes problems with file position. + * Shared handler are good for short atomic requests. + * Non-shared handlers are useful for stream file reading (especial for compound files). + * + * @param string $filename + * @param boolean $shareHandler + * @return Zend_Search_Lucene_Storage_File + */ + public function getFileObject($filename, $shareHandler = true) + { + $fullFilename = $this->_dirPath . '/' . $filename; + + if (!$shareHandler) { + return new Zend_Search_Lucene_Storage_File_Filesystem($fullFilename); + } + + if (isset( $this->_fileHandlers[$filename] )) { + $this->_fileHandlers[$filename]->seek(0); + return $this->_fileHandlers[$filename]; + } + + $this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($fullFilename); + return $this->_fileHandlers[$filename]; + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File.php new file mode 100644 index 0000000000000000000000000000000000000000..3a200e46fa4dd3786625210d30bda9e736751381 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File.php @@ -0,0 +1,427 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Search_Lucene_Storage_File +{ + /** + * Reads $length number of bytes at the current position in the + * file and advances the file pointer. + * + * @param integer $length + * @return string + */ + abstract protected function _fread($length=1); + + + /** + * Sets the file position indicator and advances the file pointer. + * The new position, measured in bytes from the beginning of the file, + * is obtained by adding offset to the position specified by whence, + * whose values are defined as follows: + * SEEK_SET - Set position equal to offset bytes. + * SEEK_CUR - Set position to current location plus offset. + * SEEK_END - Set position to end-of-file plus offset. (To move to + * a position before the end-of-file, you need to pass a negative value + * in offset.) + * Upon success, returns 0; otherwise, returns -1 + * + * @param integer $offset + * @param integer $whence + * @return integer + */ + abstract public function seek($offset, $whence=SEEK_SET); + + /** + * Get file position. + * + * @return integer + */ + abstract public function tell(); + + /** + * Flush output. + * + * Returns true on success or false on failure. + * + * @return boolean + */ + abstract public function flush(); + + /** + * Writes $length number of bytes (all, if $length===null) to the end + * of the file. + * + * @param string $data + * @param integer $length + */ + abstract protected function _fwrite($data, $length=null); + + /** + * Lock file + * + * Lock type may be a LOCK_SH (shared lock) or a LOCK_EX (exclusive lock) + * + * @param integer $lockType + * @return boolean + */ + abstract public function lock($lockType, $nonBlockinLock = false); + + /** + * Unlock file + */ + abstract public function unlock(); + + /** + * Reads a byte from the current position in the file + * and advances the file pointer. + * + * @return integer + */ + public function readByte() + { + return ord($this->_fread(1)); + } + + /** + * Writes a byte to the end of the file. + * + * @param integer $byte + */ + public function writeByte($byte) + { + return $this->_fwrite(chr($byte), 1); + } + + /** + * Read num bytes from the current position in the file + * and advances the file pointer. + * + * @param integer $num + * @return string + */ + public function readBytes($num) + { + return $this->_fread($num); + } + + /** + * Writes num bytes of data (all, if $num===null) to the end + * of the string. + * + * @param string $data + * @param integer $num + */ + public function writeBytes($data, $num=null) + { + $this->_fwrite($data, $num); + } + + + /** + * Reads an integer from the current position in the file + * and advances the file pointer. + * + * @return integer + */ + public function readInt() + { + $str = $this->_fread(4); + + return ord($str[0]) << 24 | + ord($str[1]) << 16 | + ord($str[2]) << 8 | + ord($str[3]); + } + + + /** + * Writes an integer to the end of file. + * + * @param integer $value + */ + public function writeInt($value) + { + settype($value, 'integer'); + $this->_fwrite( chr($value>>24 & 0xFF) . + chr($value>>16 & 0xFF) . + chr($value>>8 & 0xFF) . + chr($value & 0xFF), 4 ); + } + + + /** + * Returns a long integer from the current position in the file + * and advances the file pointer. + * + * @return integer + * @throws Zend_Search_Lucene_Exception + */ + public function readLong() + { + $str = $this->_fread(8); + + /** + * Check, that we work in 64-bit mode. + * fseek() uses long for offset. Thus, largest index segment file size in 32bit mode is 2Gb + */ + if (PHP_INT_SIZE > 4) { + return ord($str[0]) << 56 | + ord($str[1]) << 48 | + ord($str[2]) << 40 | + ord($str[3]) << 32 | + ord($str[4]) << 24 | + ord($str[5]) << 16 | + ord($str[6]) << 8 | + ord($str[7]); + } else { + if ((ord($str[0]) != 0) || + (ord($str[1]) != 0) || + (ord($str[2]) != 0) || + (ord($str[3]) != 0) || + ((ord($str[0]) & 0x80) != 0)) { + throw new Zend_Search_Lucene_Exception('Largest supported segment size (for 32-bit mode) is 2Gb'); + } + + return ord($str[4]) << 24 | + ord($str[5]) << 16 | + ord($str[6]) << 8 | + ord($str[7]); + } + } + + /** + * Writes long integer to the end of file + * + * @param integer $value + * @throws Zend_Search_Lucene_Exception + */ + public function writeLong($value) + { + /** + * Check, that we work in 64-bit mode. + * fseek() and ftell() use long for offset. Thus, largest index segment file size in 32bit mode is 2Gb + */ + if (PHP_INT_SIZE > 4) { + settype($value, 'integer'); + $this->_fwrite( chr($value>>56 & 0xFF) . + chr($value>>48 & 0xFF) . + chr($value>>40 & 0xFF) . + chr($value>>32 & 0xFF) . + chr($value>>24 & 0xFF) . + chr($value>>16 & 0xFF) . + chr($value>>8 & 0xFF) . + chr($value & 0xFF), 8 ); + } else { + if ($value > 0x7FFFFFFF) { + throw new Zend_Search_Lucene_Exception('Largest supported segment size (for 32-bit mode) is 2Gb'); + } + + $this->_fwrite( "\x00\x00\x00\x00" . + chr($value>>24 & 0xFF) . + chr($value>>16 & 0xFF) . + chr($value>>8 & 0xFF) . + chr($value & 0xFF), 8 ); + } + } + + + + /** + * Returns a variable-length integer from the current + * position in the file and advances the file pointer. + * + * @return integer + */ + public function readVInt() + { + $nextByte = ord($this->_fread(1)); + $val = $nextByte & 0x7F; + + for ($shift=7; ($nextByte & 0x80) != 0; $shift += 7) { + $nextByte = ord($this->_fread(1)); + $val |= ($nextByte & 0x7F) << $shift; + } + return $val; + } + + /** + * Writes a variable-length integer to the end of file. + * + * @param integer $value + */ + public function writeVInt($value) + { + settype($value, 'integer'); + while ($value > 0x7F) { + $this->_fwrite(chr( ($value & 0x7F)|0x80 )); + $value >>= 7; + } + $this->_fwrite(chr($value)); + } + + + /** + * Reads a string from the current position in the file + * and advances the file pointer. + * + * @return string + */ + public function readString() + { + $strlen = $this->readVInt(); + if ($strlen == 0) { + return ''; + } else { + /** + * This implementation supports only Basic Multilingual Plane + * (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support + * "supplementary characters" (characters whose code points are + * greater than 0xFFFF) + * Java 2 represents these characters as a pair of char (16-bit) + * values, the first from the high-surrogates range (0xD800-0xDBFF), + * the second from the low-surrogates range (0xDC00-0xDFFF). Then + * they are encoded as usual UTF-8 characters in six bytes. + * Standard UTF-8 representation uses four bytes for supplementary + * characters. + */ + + $str_val = $this->_fread($strlen); + + for ($count = 0; $count < $strlen; $count++ ) { + if (( ord($str_val[$count]) & 0xC0 ) == 0xC0) { + $addBytes = 1; + if (ord($str_val[$count]) & 0x20 ) { + $addBytes++; + + // Never used. Java2 doesn't encode strings in four bytes + if (ord($str_val[$count]) & 0x10 ) { + $addBytes++; + } + } + $str_val .= $this->_fread($addBytes); + $strlen += $addBytes; + + // Check for null character. Java2 encodes null character + // in two bytes. + if (ord($str_val[$count]) == 0xC0 && + ord($str_val[$count+1]) == 0x80 ) { + $str_val[$count] = 0; + $str_val = substr($str_val,0,$count+1) + . substr($str_val,$count+2); + } + $count += $addBytes; + } + } + + return $str_val; + } + } + + /** + * Writes a string to the end of file. + * + * @param string $str + * @throws Zend_Search_Lucene_Exception + */ + public function writeString($str) + { + /** + * This implementation supports only Basic Multilingual Plane + * (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support + * "supplementary characters" (characters whose code points are + * greater than 0xFFFF) + * Java 2 represents these characters as a pair of char (16-bit) + * values, the first from the high-surrogates range (0xD800-0xDBFF), + * the second from the low-surrogates range (0xDC00-0xDFFF). Then + * they are encoded as usual UTF-8 characters in six bytes. + * Standard UTF-8 representation uses four bytes for supplementary + * characters. + */ + + // convert input to a string before iterating string characters + settype($str, 'string'); + + $chars = $strlen = strlen($str); + $containNullChars = false; + + for ($count = 0; $count < $strlen; $count++ ) { + /** + * String is already in Java 2 representation. + * We should only calculate actual string length and replace + * \x00 by \xC0\x80 + */ + if ((ord($str[$count]) & 0xC0) == 0xC0) { + $addBytes = 1; + if (ord($str[$count]) & 0x20 ) { + $addBytes++; + + // Never used. Java2 doesn't encode strings in four bytes + // and we dont't support non-BMP characters + if (ord($str[$count]) & 0x10 ) { + $addBytes++; + } + } + $chars -= $addBytes; + + if (ord($str[$count]) == 0 ) { + $containNullChars = true; + } + $count += $addBytes; + } + } + + if ($chars < 0) { + throw new Zend_Search_Lucene_Exception('Invalid UTF-8 string'); + } + + $this->writeVInt($chars); + if ($containNullChars) { + $this->_fwrite(str_replace($str, "\x00", "\xC0\x80")); + } else { + $this->_fwrite($str); + } + } + + + /** + * Reads binary data from the current position in the file + * and advances the file pointer. + * + * @return string + */ + public function readBinary() + { + return $this->_fread($this->readVInt()); + } +} diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File/Filesystem.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File/Filesystem.php new file mode 100644 index 0000000000000000000000000000000000000000..23ebddff3a5d8996c95c5283c84d6520cc07b9e1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File/Filesystem.php @@ -0,0 +1,222 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Storage_File */ +require_once 'Zend/Search/Lucene/Storage/File.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Storage_File_Filesystem extends Zend_Search_Lucene_Storage_File +{ + /** + * Resource of the open file + * + * @var resource + */ + protected $_fileHandle; + + + /** + * Class constructor. Open the file. + * + * @param string $filename + * @param string $mode + */ + public function __construct($filename, $mode='r+b') + { + global $php_errormsg; + + if (strpos($mode, 'w') === false && !is_readable($filename)) { + // opening for reading non-readable file + throw new Zend_Search_Lucene_Exception('File \'' . $filename . '\' is not readable.'); + } + + $trackErrors = ini_get('track_errors'); + ini_set('track_errors', '1'); + + $this->_fileHandle = @fopen($filename, $mode); + + if ($this->_fileHandle === false) { + ini_set('track_errors', $trackErrors); + throw new Zend_Search_Lucene_Exception($php_errormsg); + } + + ini_set('track_errors', $trackErrors); + } + + /** + * Sets the file position indicator and advances the file pointer. + * The new position, measured in bytes from the beginning of the file, + * is obtained by adding offset to the position specified by whence, + * whose values are defined as follows: + * SEEK_SET - Set position equal to offset bytes. + * SEEK_CUR - Set position to current location plus offset. + * SEEK_END - Set position to end-of-file plus offset. (To move to + * a position before the end-of-file, you need to pass a negative value + * in offset.) + * SEEK_CUR is the only supported offset type for compound files + * + * Upon success, returns 0; otherwise, returns -1 + * + * @param integer $offset + * @param integer $whence + * @return integer + */ + public function seek($offset, $whence=SEEK_SET) + { + return fseek($this->_fileHandle, $offset, $whence); + } + + + /** + * Get file position. + * + * @return integer + */ + public function tell() + { + return ftell($this->_fileHandle); + } + + /** + * Flush output. + * + * Returns true on success or false on failure. + * + * @return boolean + */ + public function flush() + { + return fflush($this->_fileHandle); + } + + /** + * Close File object + */ + public function close() + { + if ($this->_fileHandle !== null ) { + @fclose($this->_fileHandle); + $this->_fileHandle = null; + } + } + + /** + * Get the size of the already opened file + * + * @return integer + */ + public function size() + { + $position = ftell($this->_fileHandle); + fseek($this->_fileHandle, 0, SEEK_END); + $size = ftell($this->_fileHandle); + fseek($this->_fileHandle,$position); + + return $size; + } + + /** + * Read a $length bytes from the file and advance the file pointer. + * + * @param integer $length + * @return string + */ + protected function _fread($length=1) + { + if ($length == 0) { + return ''; + } + + if ($length < 1024) { + return fread($this->_fileHandle, $length); + } + + $data = ''; + while ( $length > 0 && ($nextBlock = fread($this->_fileHandle, $length)) != false ) { + $data .= $nextBlock; + $length -= strlen($nextBlock); + } + return $data; + } + + + /** + * Writes $length number of bytes (all, if $length===null) to the end + * of the file. + * + * @param string $data + * @param integer $length + */ + protected function _fwrite($data, $length=null) + { + if ($length === null ) { + fwrite($this->_fileHandle, $data); + } else { + fwrite($this->_fileHandle, $data, $length); + } + } + + /** + * Lock file + * + * Lock type may be a LOCK_SH (shared lock) or a LOCK_EX (exclusive lock) + * + * @param integer $lockType + * @param boolean $nonBlockingLock + * @return boolean + */ + public function lock($lockType, $nonBlockingLock = false) + { + if ($nonBlockingLock) { + return flock($this->_fileHandle, $lockType | LOCK_NB); + } else { + return flock($this->_fileHandle, $lockType); + } + } + + /** + * Unlock file + * + * Returns true on success + * + * @return boolean + */ + public function unlock() + { + if ($this->_fileHandle !== null ) { + return flock($this->_fileHandle, LOCK_UN); + } else { + return true; + } + } +} + diff --git a/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File/Memory.php b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File/Memory.php new file mode 100644 index 0000000000000000000000000000000000000000..c28901c58f295cbdf6b158abc06d68fc0996c94c --- /dev/null +++ b/maarch_entreprise/trunk/tools/Zend/Search/Lucene/Storage/File/Memory.php @@ -0,0 +1,555 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + + +/** Zend_Search_Lucene_Storage_File */ +require_once 'Zend/Search/Lucene/Storage/File.php'; + +/** Zend_Search_Lucene_Exception */ +require_once 'Zend/Search/Lucene/Exception.php'; + + +/** + * @category Zend + * @package Zend_Search_Lucene + * @subpackage Storage + * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Search_Lucene_Storage_File_Memory extends Zend_Search_Lucene_Storage_File +{ + /** + * FileData + * + * @var string + */ + private $_data; + + /** + * File Position + * + * @var integer + */ + private $_position = 0; + + + /** + * Object constractor + * + * @param string $data + */ + public function __construct($data) + { + $this->_data = $data; + } + + /** + * Reads $length number of bytes at the current position in the + * file and advances the file pointer. + * + * @param integer $length + * @return string + */ + protected function _fread($length = 1) + { + $returnValue = substr($this->_data, $this->_position, $length); + $this->_position += $length; + return $returnValue; + } + + + /** + * Sets the file position indicator and advances the file pointer. + * The new position, measured in bytes from the beginning of the file, + * is obtained by adding offset to the position specified by whence, + * whose values are defined as follows: + * SEEK_SET - Set position equal to offset bytes. + * SEEK_CUR - Set position to current location plus offset. + * SEEK_END - Set position to end-of-file plus offset. (To move to + * a position before the end-of-file, you need to pass a negative value + * in offset.) + * Upon success, returns 0; otherwise, returns -1 + * + * @param integer $offset + * @param integer $whence + * @return integer + */ + public function seek($offset, $whence=SEEK_SET) + { + switch ($whence) { + case SEEK_SET: + $this->_position = $offset; + break; + + case SEEK_CUR: + $this->_position += $offset; + break; + + case SEEK_END: + $this->_position = strlen($this->_data); + $this->_position += $offset; + break; + + default: + break; + } + } + + /** + * Get file position. + * + * @return integer + */ + public function tell() + { + return $this->_position; + } + + /** + * Flush output. + * + * Returns true on success or false on failure. + * + * @return boolean + */ + public function flush() + { + // Do nothing + + return true; + } + + /** + * Writes $length number of bytes (all, if $length===null) to the end + * of the file. + * + * @param string $data + * @param integer $length + */ + protected function _fwrite($data, $length=null) + { + // We do not need to check if file position points to the end of "file". + // Only append operation is supported now + + if ($length !== null) { + $this->_data .= substr($data, 0, $length); + } else { + $this->_data .= $data; + } + + $this->_position = strlen($this->_data); + } + + /** + * Lock file + * + * Lock type may be a LOCK_SH (shared lock) or a LOCK_EX (exclusive lock) + * + * @param integer $lockType + * @return boolean + */ + public function lock($lockType, $nonBlockinLock = false) + { + // Memory files can't be shared + // do nothing + + return true; + } + + /** + * Unlock file + */ + public function unlock() + { + // Memory files can't be shared + // do nothing + } + + /** + * Reads a byte from the current position in the file + * and advances the file pointer. + * + * @return integer + */ + public function readByte() + { + return ord($this->_data[$this->_position++]); + } + + /** + * Writes a byte to the end of the file. + * + * @param integer $byte + */ + public function writeByte($byte) + { + // We do not need to check if file position points to the end of "file". + // Only append operation is supported now + + $this->_data .= chr($byte); + $this->_position = strlen($this->_data); + + return 1; + } + + /** + * Read num bytes from the current position in the file + * and advances the file pointer. + * + * @param integer $num + * @return string + */ + public function readBytes($num) + { + $returnValue = substr($this->_data, $this->_position, $num); + $this->_position += $num; + + return $returnValue; + } + + /** + * Writes num bytes of data (all, if $num===null) to the end + * of the string. + * + * @param string $data + * @param integer $num + */ + public function writeBytes($data, $num=null) + { + // We do not need to check if file position points to the end of "file". + // Only append operation is supported now + + if ($num !== null) { + $this->_data .= substr($data, 0, $num); + } else { + $this->_data .= $data; + } + + $this->_position = strlen($this->_data); + } + + + /** + * Reads an integer from the current position in the file + * and advances the file pointer. + * + * @return integer + */ + public function readInt() + { + $str = substr($this->_data, $this->_position, 4); + $this->_position += 4; + + return ord($str[0]) << 24 | + ord($str[1]) << 16 | + ord($str[2]) << 8 | + ord($str[3]); + } + + + /** + * Writes an integer to the end of file. + * + * @param integer $value + */ + public function writeInt($value) + { + // We do not need to check if file position points to the end of "file". + // Only append operation is supported now + + settype($value, 'integer'); + $this->_data .= chr($value>>24 & 0xFF) . + chr($value>>16 & 0xFF) . + chr($value>>8 & 0xFF) . + chr($value & 0xFF); + + $this->_position = strlen($this->_data); + } + + + /** + * Returns a long integer from the current position in the file + * and advances the file pointer. + * + * @return integer + * @throws Zend_Search_Lucene_Exception + */ + public function readLong() + { + $str = substr($this->_data, $this->_position, 8); + $this->_position += 8; + + /** + * Check, that we work in 64-bit mode. + * fseek() uses long for offset. Thus, largest index segment file size in 32bit mode is 2Gb + */ + if (PHP_INT_SIZE > 4) { + return ord($str[0]) << 56 | + ord($str[1]) << 48 | + ord($str[2]) << 40 | + ord($str[3]) << 32 | + ord($str[4]) << 24 | + ord($str[5]) << 16 | + ord($str[6]) << 8 | + ord($str[7]); + } else { + if ((ord($str[0]) != 0) || + (ord($str[1]) != 0) || + (ord($str[2]) != 0) || + (ord($str[3]) != 0) || + ((ord($str[0]) & 0x80) != 0)) { + throw new Zend_Search_Lucene_Exception('Largest supported segment size (for 32-bit mode) is 2Gb'); + } + + return ord($str[4]) << 24 | + ord($str[5]) << 16 | + ord($str[6]) << 8 | + ord($str[7]); + } + } + + /** + * Writes long integer to the end of file + * + * @param integer $value + * @throws Zend_Search_Lucene_Exception + */ + public function writeLong($value) + { + // We do not need to check if file position points to the end of "file". + // Only append operation is supported now + + /** + * Check, that we work in 64-bit mode. + * fseek() and ftell() use long for offset. Thus, largest index segment file size in 32bit mode is 2Gb + */ + if (PHP_INT_SIZE > 4) { + settype($value, 'integer'); + $this->_data .= chr($value>>56 & 0xFF) . + chr($value>>48 & 0xFF) . + chr($value>>40 & 0xFF) . + chr($value>>32 & 0xFF) . + chr($value>>24 & 0xFF) . + chr($value>>16 & 0xFF) . + chr($value>>8 & 0xFF) . + chr($value & 0xFF); + } else { + if ($value > 0x7FFFFFFF) { + throw new Zend_Search_Lucene_Exception('Largest supported segment size (for 32-bit mode) is 2Gb'); + } + + $this->_data .= chr(0) . chr(0) . chr(0) . chr(0) . + chr($value>>24 & 0xFF) . + chr($value>>16 & 0xFF) . + chr($value>>8 & 0xFF) . + chr($value & 0xFF); + } + + $this->_position = strlen($this->_data); + } + + + + /** + * Returns a variable-length integer from the current + * position in the file and advances the file pointer. + * + * @return integer + */ + public function readVInt() + { + $nextByte = ord($this->_data[$this->_position++]); + $val = $nextByte & 0x7F; + + for ($shift=7; ($nextByte & 0x80) != 0; $shift += 7) { + $nextByte = ord($this->_data[$this->_position++]); + $val |= ($nextByte & 0x7F) << $shift; + } + return $val; + } + + /** + * Writes a variable-length integer to the end of file. + * + * @param integer $value + */ + public function writeVInt($value) + { + // We do not need to check if file position points to the end of "file". + // Only append operation is supported now + + settype($value, 'integer'); + while ($value > 0x7F) { + $this->_data .= chr( ($value & 0x7F)|0x80 ); + $value >>= 7; + } + $this->_data .= chr($value); + + $this->_position = strlen($this->_data); + } + + + /** + * Reads a string from the current position in the file + * and advances the file pointer. + * + * @return string + */ + public function readString() + { + $strlen = $this->readVInt(); + if ($strlen == 0) { + return ''; + } else { + /** + * This implementation supports only Basic Multilingual Plane + * (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support + * "supplementary characters" (characters whose code points are + * greater than 0xFFFF) + * Java 2 represents these characters as a pair of char (16-bit) + * values, the first from the high-surrogates range (0xD800-0xDBFF), + * the second from the low-surrogates range (0xDC00-0xDFFF). Then + * they are encoded as usual UTF-8 characters in six bytes. + * Standard UTF-8 representation uses four bytes for supplementary + * characters. + */ + + $str_val = substr($this->_data, $this->_position, $strlen); + $this->_position += $strlen; + + for ($count = 0; $count < $strlen; $count++ ) { + if (( ord($str_val[$count]) & 0xC0 ) == 0xC0) { + $addBytes = 1; + if (ord($str_val[$count]) & 0x20 ) { + $addBytes++; + + // Never used. Java2 doesn't encode strings in four bytes + if (ord($str_val[$count]) & 0x10 ) { + $addBytes++; + } + } + $str_val .= substr($this->_data, $this->_position, $addBytes); + $this->_position += $addBytes; + $strlen += $addBytes; + + // Check for null character. Java2 encodes null character + // in two bytes. + if (ord($str_val[$count]) == 0xC0 && + ord($str_val[$count+1]) == 0x80 ) { + $str_val[$count] = 0; + $str_val = substr($str_val,0,$count+1) + . substr($str_val,$count+2); + } + $count += $addBytes; + } + } + + return $str_val; + } + } + + /** + * Writes a string to the end of file. + * + * @param string $str + * @throws Zend_Search_Lucene_Exception + */ + public function writeString($str) + { + /** + * This implementation supports only Basic Multilingual Plane + * (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support + * "supplementary characters" (characters whose code points are + * greater than 0xFFFF) + * Java 2 represents these characters as a pair of char (16-bit) + * values, the first from the high-surrogates range (0xD800-0xDBFF), + * the second from the low-surrogates range (0xDC00-0xDFFF). Then + * they are encoded as usual UTF-8 characters in six bytes. + * Standard UTF-8 representation uses four bytes for supplementary + * characters. + */ + + // We do not need to check if file position points to the end of "file". + // Only append operation is supported now + + // convert input to a string before iterating string characters + settype($str, 'string'); + + $chars = $strlen = strlen($str); + $containNullChars = false; + + for ($count = 0; $count < $strlen; $count++ ) { + /** + * String is already in Java 2 representation. + * We should only calculate actual string length and replace + * \x00 by \xC0\x80 + */ + if ((ord($str[$count]) & 0xC0) == 0xC0) { + $addBytes = 1; + if (ord($str[$count]) & 0x20 ) { + $addBytes++; + + // Never used. Java2 doesn't encode strings in four bytes + // and we dont't support non-BMP characters + if (ord($str[$count]) & 0x10 ) { + $addBytes++; + } + } + $chars -= $addBytes; + + if (ord($str[$count]) == 0 ) { + $containNullChars = true; + } + $count += $addBytes; + } + } + + if ($chars < 0) { + throw new Zend_Search_Lucene_Exception('Invalid UTF-8 string'); + } + + $this->writeVInt($chars); + if ($containNullChars) { + $this->_data .= str_replace($str, "\x00", "\xC0\x80"); + + } else { + $this->_data .= $str; + } + + $this->_position = strlen($this->_data); + } + + + /** + * Reads binary data from the current position in the file + * and advances the file pointer. + * + * @return string + */ + public function readBinary() + { + $length = $this->readVInt(); + $returnValue = substr($this->_data, $this->_position, $length); + $this->_position += $length; + return $returnValue; + } +} + diff --git a/maarch_entreprise/trunk/tools/graphic_lib/AntiSpam.class.php b/maarch_entreprise/trunk/tools/graphic_lib/AntiSpam.class.php new file mode 100644 index 0000000000000000000000000000000000000000..6015cf63ca0abf46153ef77658f3784fa87e90cd --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/AntiSpam.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/AntiSpam.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/Artichow.cfg.php b/maarch_entreprise/trunk/tools/graphic_lib/Artichow.cfg.php new file mode 100644 index 0000000000000000000000000000000000000000..d596fe0aa1dd883843c1ac2456fc1512251ea6c9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/Artichow.cfg.php @@ -0,0 +1,65 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* + * Path to Artichow + */ + +define('ARTICHOW', dirname(__FILE__).DIRECTORY_SEPARATOR.'php'.substr(phpversion(), 0, 1)); + + +/* + * Path to TrueType fonts + * Don't change the value of the constant ARTICHOW_FONT, only the value of $path (due to a PHP bug) + */ + +define('ARTICHOW_FONT', ARTICHOW.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'font'); + + +/* + * Patterns directory + */ + +define('ARTICHOW_PATTERN', ARTICHOW.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'patterns'); + + +/* + * Images directory + */ + +define('ARTICHOW_IMAGE', ARTICHOW.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'images'); + + +/* + * Enable/disable cache support + */ +define('ARTICHOW_CACHE', TRUE); + +/* + * Prefix for class names + * No prefix by default + */ +define('ARTICHOW_PREFIX', ''); + +/* + * Trigger errors when use of a deprecated feature + */ +define('ARTICHOW_DEPRECATED', TRUE); + +/* + * Fonts to use + */ +$fonts = array( + 'Tuffy', + 'TuffyBold', + 'TuffyBoldItalic', + 'TuffyItalic' +); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/BarPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/BarPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..ffdc61e8aa7d6f258d628e49bd919680be627d7f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/BarPlot.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/BarPlot.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/ChangeLog b/maarch_entreprise/trunk/tools/graphic_lib/ChangeLog new file mode 100644 index 0000000000000000000000000000000000000000..6085b27b010ae0f4043a82b6ca8f403055bf60d9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/ChangeLog @@ -0,0 +1,113 @@ +Artichow 1.0.6 + +- Add method Plot::setYAxisZero() +- Add auto-scaling for axis +- Add constant ARTICHOW_CACHE to enable/disable the cache +- Improve prefix for classes + +Artichow 1.0.5 + +- Add constant ARTICHOW_PREFIX to prefix Artichow's classes (bug #000002) +- Add methods Shadow::hide() and Shadow::show() +- Add method Plot::reduce() +- It is now possible to save its charts in a file +- Fix a bug in PlotGroup (setYMin() / setYMax() did not work) +- Fix an incoherent behaviour if some values in $datay are not numeric (LinePlot, BarPlot, ScatterPlot) +- Fix an inclusion bug in Pattern +- Fix a bug for PHP 5.1.0 + +Artichow 1.0.4 + +- Add support for GIF images +- Add patterns (Pattern.class.php) +- Add titles on axis +- Rename Artichow.class.php to Graph.class.php (break backward compatibility) +- Add a README file +- Add support for ScatterPlot +- Merge setBackgroundColor() and setBackgroundGradient() into setFill() in class Mark (break backward compatibility) +- Add an optional argument $size to Mark::setType() +- Grid background in now default to white in class Plot +- Change class Polygon to accept NULL values +- Add a new legend type (Legend::MARKONLY) +- Add method Legend::show() +- Add methods Mark::move(), Mark::hide() and Mark::show() +- Add new marks (star, book, ...) +- Add methods Label::setBackground() and Legend::setBackground() +- Add methods Plot::setXMax(), Plot::setXMin(), PlotGroup::setXMax() and PlotGroup::setXMin() +- Add new colors to default theme in Pie +- Remove methods Drawer::setBackground*() +- Tests have been removed from the archive +- Move methods Component::addLabel() and Component::addAbsLabel() to class Graph +- Modes LinePlot::MIDDLE and LinePlot::BAR have been merged into LinePlot::MIDDLE (break backward compatibility) +- Fix a bug in Artichow.cfg.php (unable to use some ttf fonts) +- Fix a bug in Legend (position of marks was sometimes broken) +- Fix a bug in Pie (pies can now take only a single value) +- Fix some bugs in Plot / LinePlot +- Fix a bug in Font::draw() (call to undefined function trigger__error) + +Artichow 1.0.3 (beta) + +- Add EXPERIMENTAL support for PHP 4 +- Change class BarPlot so it now uses class Border instead of setBorderThickness() and setBorderColor() +- Change class Legend so it now uses class Border instead of setBorderSize() and setBorderColor() +- Change class Mark so it now uses class Border instead of setBorderSize() and setBorderColor() +- Change class Text so it now uses class Border instead of setBorderColor() +- Change class Label so it now uses class Border instead of setBorderColor() +- Drawer::drawRectangle() and Drawer::drawFilledRectangle() now take a line as second argument +- Add styles to rectangles and polygons +- BarPlot::setBarPadding() takes now values in per-cent instead of pixels +- Merge drawFilledRectangleColor() and drawFilledRectangleGradient() into drawFilledRectangle() in class Drawer +- Merge drawFilledPolygonColor() and drawFilledPolygonGradient() into drawFilledPolygon() in class Drawer +- Merge drawFilledEllipseColor() and drawFilledEllipseGradient() into drawFilledEllipse() in class Drawer +- Add method BarPlot::setBarWidth() +- Add an optional border to the class Image +- Add a new class Border +- Add support for MathPlot +- LinePlot::STEP has been removed +- Merge classes Paragraph and Label (no changes in the API) +- Method Plot::setLabelCenter() is obsolete and has been removed +- Rewrite Axis (add a new class Tick) (break backward compatibility) +- Remove draw*Triangle* from class Drawer (use polygons instead) +- Remove prefix draw in each method of class Drawer +- Rename LinePlot::setLineType() into LinePlot::setStyle() +- Rename LinePlot::setLineThickness() into LinePlot::setThickness() +- Rename LinePlot::setLineColor() into LinePlot::setColor() +- Rename LinePlot::setLineBackgroundColor() to LinePlot::setFillColor() +- Rename LinePlot::setLineBackgroundGradient() to LinePlot::setFillGradient() +- Rename Line::setType() to Line::setStyle() +- Add methods Label::get(), Label::setFormat() and change method Label::setFont() +- Add a parameter $smooth in Shadow::setSize(); +- Add filled areas in LinePlot +- Add lots of new features in Math.class.php +- Fix a bug in Math::isVertical() and Math::isHorizontal() +- Fix a bug in Legend (shadow is now well-positioned is there is no border on the legend) +- Lots of minor changes + +Artichow 1.0.2 (beta) + +- Add support for pies (2D & 3D) +- Move shadow from class Component to class Image +- X Axis are now centered on 0 by default on bar and line plots +- Add title to Graphs +- Add 4 named fonts +- Add 50 named colors +- Add shadow to legends +- Add method Image::setBackgroundGradient() +- Add methods Label::setCallbackFunction() and Label::hide() +- Add method Legend::hide() +- Add methods Drawer::copyResizeImage(), Drawer::drawArc() and Drawer::drawFilledArcColor() +- Rename Positionable::setHorizontalAlign() and Positionable::setVerticalAlign() to Positionable::setAlign() +- API for ellipses has changed +- Title is now a property instead of a method in Component +- Remove old code, that fixes a bug in the grid +- Fix a bug that affects position of bars in some cases +- Fix wrong size of shadow +- Fix a bug in Plot::setYMin() and Plot::setYMax() + +Artichow 1.0.1 (alpha) + +- Add anti-spam images + +Artichow 1.0.0 (alpha) + +- Initial release diff --git a/maarch_entreprise/trunk/tools/graphic_lib/Graph.class.php b/maarch_entreprise/trunk/tools/graphic_lib/Graph.class.php new file mode 100644 index 0000000000000000000000000000000000000000..95401a4970c73240205e7524186af08038a05fcc --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/Graph.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/Graph.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/Image.class.php b/maarch_entreprise/trunk/tools/graphic_lib/Image.class.php new file mode 100644 index 0000000000000000000000000000000000000000..677dcdec76acc5c84e05e551731e98c75e1637b7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/Image.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/Image.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/LinePlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/LinePlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..78efc7bb5c3adf2dd07a99984611964dd405db4b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/LinePlot.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/LinePlot.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/MathPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/MathPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..0466112607851e83cf4b8cf46a22c11309c6c7ac --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/MathPlot.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/MathPlot.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/Pattern.class.php b/maarch_entreprise/trunk/tools/graphic_lib/Pattern.class.php new file mode 100644 index 0000000000000000000000000000000000000000..36d7301b18fc9b2f439135684ed861e020417878 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/Pattern.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/Pattern.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/Pie.class.php b/maarch_entreprise/trunk/tools/graphic_lib/Pie.class.php new file mode 100644 index 0000000000000000000000000000000000000000..f494f7b5229bf9e771cf21699e8d93a4787667a0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/Pie.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/Pie.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/Plot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/Plot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..51bc20801310fcf2770e01178cf36ad81b9645e2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/Plot.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/Plot.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/ScatterPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/ScatterPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..250fc45141c800a7d6d846407bccfe9d2d99c56a --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/ScatterPlot.class.php @@ -0,0 +1,4 @@ +<?php +require_once dirname(__FILE__).'/Artichow.cfg.php'; +require_once ARTICHOW.'/ScatterPlot.class.php'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/AntiSpam.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/AntiSpam.html new file mode 100644 index 0000000000000000000000000000000000000000..d75260f44eb0eff1fab6bcff89e36ff78f8f5bb8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/AntiSpam.html @@ -0,0 +1,137 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class AntiSpam</h2><div class="extends"><ul> +<li><a href="Image.html">Image</a></li> +<ul><li>AntiSpam</li></ul> +</ul></div><div class="description"> + <p> + La classe <a href="AntiSpam.html">AntiSpam</a> permet de créer des images pour interdire des requêtes automatisées sur certaines pages. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">protected</span> <span class="TYPE">string</span> <a href="AntiSpam.html#property.string">$string</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">int</span> <a href="AntiSpam.html#property.noise">$noise</a> := <span class="default">0</span> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="AntiSpam.html#method.__construct">__construct</a>(<span class="TYPE">string</span> <span class="argument">$string</span> = <span class="default">''</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">string</span> <a href="AntiSpam.html#method.setRand">setRand</a>(<span class="TYPE">int</span> <span class="argument">$length</span>) + </li> +<li> +<span class="access">public</span> <a href="AntiSpam.html#method.setNoise">setNoise</a>(<span class="TYPE">int</span> <span class="argument">$noise</span>) + </li> +<li> +<span class="access">public</span> <a href="AntiSpam.html#method.save">save</a>(<span class="TYPE">string</span> <span class="argument">$qName</span>) + </li> +<li> +<span class="access">public</span> <a href="AntiSpam.html#method.check">check</a>(<span class="TYPE">string</span> <span class="argument">$qName</span>, <span class="TYPE">string</span> <span class="argument">$value</span>, <span class="TYPE">bool</span> <span class="argument">$case</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="AntiSpam.html#method.draw">draw</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.string"></a><span class="access">protected</span> <span class="TYPE">string</span> <a href="AntiSpam.html#property.string">$string</a><div class="description"> + La chaîne de caractère que devra retaper l'utilisateur. + </div> +<div class="description-bottom"><a href="AntiSpam.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.noise"></a><span class="access">protected</span> <span class="TYPE">int</span> <a href="AntiSpam.html#property.noise">$noise</a> := <span class="default">0</span><div class="description"> + Degré de bruit à afficher sur l'image (entre 0 et 10). + </div> +<div class="description-bottom"><a href="AntiSpam.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="AntiSpam.html#method.__construct">__construct</a>(<span class="TYPE">string</span> <span class="argument">$string</span> = <span class="default">''</span>) + <div class="description"> + Construit une image anti-spam. Vous pouvez définir la chaîne de caractères à afficher sur l'image avec $string. + Si vous ne donnez aucune chaîne de caractères, voyez <a href="AntiSpam.html#method.setRand">AntiSpam::setRand()</a> pour générer une valeur aléatoire. + </div> +<div class="description-bottom"><a href="AntiSpam.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setRand"></a><span class="access">public</span> <span class="TYPE">string</span> <a href="AntiSpam.html#method.setRand">setRand</a>(<span class="TYPE">int</span> <span class="argument">$length</span>) + <div class="description"> + Génère une chaîne de caractère aléatoire de taille $length pour l'image anti-spam. + La chaîne de caractère ainsi créée est ensuite retournée. + </div> +<div class="description-bottom"><a href="AntiSpam.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setNoise"></a><span class="access">public</span> <a href="AntiSpam.html#method.setNoise">setNoise</a>(<span class="TYPE">int</span> <span class="argument">$noise</span>) + <div class="description"> + Ajoute du bruit sur l'image. + Les valeurs possibles sont de 0 à 10, avec 0 pour ne pas afficher de bruit et 10 pour afficher un bruit maximal. + </div> +<div class="description-bottom"><a href="AntiSpam.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.save"></a><span class="access">public</span> <a href="AntiSpam.html#method.save">save</a>(<span class="TYPE">string</span> <span class="argument">$qName</span>) + <div class="description"> + Enregistre la valeur de l'image anti-spam dans la session de l'utilisateur sous le nom $qName. + Cette méthode doit être utilisée en combinaison avec <a href="AntiSpam.html#method.check">AntiSpam::check()</a>. + </div> +<div class="description-bottom"><a href="AntiSpam.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.check"></a><span class="access">public</span> <a href="AntiSpam.html#method.check">check</a>(<span class="TYPE">string</span> <span class="argument">$qName</span>, <span class="TYPE">string</span> <span class="argument">$value</span>, <span class="TYPE">bool</span> <span class="argument">$case</span> = <span class="default">TRUE</span>) + <div class="description"> + Vérifie que la valeur $value correspond à la valeur enregistrée sous le nom $qName avec <a href="AntiSpam.html#method.save">AntiSpam::save()</a>. + Si $case est mis à TRUE, alors la vérification NE sera PAS sensible à la casse, elle le sera à FALSE. + Cette méthode doit être utilisée en combinaison avec <a href="AntiSpam.html#method.save">AntiSpam::save()</a>. + </div> +<div class="description-bottom"><a href="AntiSpam.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="AntiSpam.html#method.draw">draw</a>() + <div class="description"> + Affiche l'image anti-spam à l'écran. +<pre> + +<?php + +require_once "AntiSpam.class.php"; + +$object = new <a href="AntiSpam.html">AntiSpam</a>(); +$object-><a href="AntiSpam.html#method.setRand">setRand</a>(5); +$object-><a href="AntiSpam.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="AntiSpam.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Axis.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Axis.html new file mode 100644 index 0000000000000000000000000000000000000000..51325c0fa44d1347810c0cce6acb92a11a3203f9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Axis.html @@ -0,0 +1,385 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Axis</h2><div class="description"> + <p> + La classe <a href="Axis.html">Axis</a> permet de manipuler des axes. + Un axe permet à un utilisateur de répérer les points et leurs valeurs sur un graphique. + </p> + <p> + De nombreuses méthodes de la classe <a href="Axis.html">Axis</a> ne sont pas documentées, + car elles ne sont utilisées qu'en interne par Artichow. + Néanmoins, si vous développez Artichow, vous aurez besoin de ces méthodes. + N'hésitez donc pas à parcourir le code source de cette classe. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="Axis.html#property.title">$title</a> +</li> +<li> +<span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="Axis.html#property.label">$label</a> +</li> +<li> +<span class="access">public</span> <a href="Line.html"><span class="TYPE">Line</span></a> <a href="Axis.html#property.line">$line</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Axis.html#property.auto">$auto</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Axis.html#method.__construct">__construct</a>(<span class="TYPE">float</span> <span class="argument">$min</span>, <span class="TYPE">float</span> <span class="argument">$max</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.auto">auto</a>(<span class="TYPE">bool</span> <span class="argument">$auto</span>) + </li> +<li> +<span class="access">public</span> <a href="true.html"><span class="TYPE">true</span></a> <a href="Axis.html#method.isAuto">isAuto</a>() + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.addTick">addTick</a>(<span class="TYPE">string</span> <span class="argument">$name</span>, <a href="Tick.html"><span class="TYPE">Tick</span></a> <span class="argument">$tick</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html"><span class="TYPE">Tick</span></a> <a href="Axis.html#method.tick">tick</a>(<span class="TYPE">string</span> <span class="argument">$name</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.deleteTick">deleteTick</a>(<span class="TYPE">string</span> <span class="argument">$name</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.hideTicks">hideTicks</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setTickStyle">setTickStyle</a>(<span class="TYPE">int</span> <span class="argument">$style</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.reverseTickStyle">reverseTickStyle</a>() + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setTickInterval">setTickInterval</a>(<span class="TYPE">int</span> <span class="argument">$interval</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setNumberByTick">setNumberByTick</a>(<span class="TYPE">string</span> <span class="argument">$to</span>, <span class="TYPE">string</span> <span class="argument">$from</span>, <span class="TYPE">float</span> <span class="argument">$number</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setLabelInterval">setLabelInterval</a>(<span class="TYPE">int</span> <span class="argument">$interval</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setLabelNumber">setLabelNumber</a>(<span class="TYPE">int</span> <span class="argument">$number</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Axis.html#method.getLabelNumber">getLabelNumber</a>() + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setLabelPrecision">setLabelPrecision</a>(<span class="TYPE">int</span> <span class="argument">$precision</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setLabelText">setLabelText</a>(<span class="TYPE">array</span> <span class="argument">$texts</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setTitleAlignment">setTitleAlignment</a>(<span class="TYPE">int</span> <span class="argument">$alignment</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setTitlePosition">setTitlePosition</a>(<span class="TYPE">float</span> <span class="argument">$postion</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setColor">setColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Axis.html#method.setPadding">setPadding</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>) + </li> +<li> +<span class="access">public</span> <a href="Side.html"><span class="TYPE">Side</span></a> <a href="Axis.html#method.getPadding">getPadding</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.title"></a><span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="Axis.html#property.title">$title</a><div class="description"> + Représente le titre de l'axe. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.label"></a><span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="Axis.html#property.label">$label</a><div class="description"> + Représente les étiquettes qui portent les valeurs affichées sur l'axe. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.line"></a><span class="access">public</span> <a href="Line.html"><span class="TYPE">Line</span></a> <a href="Axis.html#property.line">$line</a><div class="description"> + Représente la ligne de l'axe. + Vous pouvez modifier le style et l'épaisseur de cette ligne, pas ses coordonnées. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.auto"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Axis.html#property.auto">$auto</a><div class="description"> + Précise si la gestion de l'axe doit être automatique ou non. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Axis.html#method.__construct">__construct</a>(<span class="TYPE">float</span> <span class="argument">$min</span>, <span class="TYPE">float</span> <span class="argument">$max</span>) + <div class="description"> + Déclare un nouvel axe. + Les variables $min et $max représentent respectivement la valeurs minimales et maximales associées à l'axe. + Par exemple, choisir $min = -12 et $max = 42 signifie tout simplement que l'axe ira de -12 à 42. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.auto"></a><span class="access">public</span> <a href="Axis.html#method.auto">auto</a>(<span class="TYPE">bool</span> <span class="argument">$auto</span>) + <div class="description"> + Active/désactive la gestion automatique de l'axe. + La gestion automatique est automatiquement désactivée en cas d'appel aux méthodes suivantes : <a href="Axis.html#method.setLabelNumber">Axis::setLabelNumber()</a>, <a href="Axis.html#method.setLabelInterval">Axis::setLabelInterval()</a>, <a href="Axis.html#method.setLabelPrecision">Axis::setLabelPrecision()</a> et <a href="Axis.html#method.setLabelText">Axis::setLabelText()</a>. + Lorsqu'un axe est sous gestion automatique, l'échelle est le nombre de valeurs à afficher sur l'axe sont automatiquement calculés. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.isAuto"></a><span class="access">public</span> <a href="true.html"><span class="TYPE">true</span></a> <a href="Axis.html#method.isAuto">isAuto</a>() + <div class="description"> + Retourne TRUE si l'axe est gérée automatiquement, FALSE sinon. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Axis.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + <div class="description"> + Cache ou non l'axe. Le paramètre $hide est par défaut à TRUE (ce qui signifie que l'axe ne sera pas dessiné). + S'il est mis à FALSE, l'axe sera dessiné. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.addTick"></a><span class="access">public</span> <a href="Axis.html#method.addTick">addTick</a>(<span class="TYPE">string</span> <span class="argument">$name</span>, <a href="Tick.html"><span class="TYPE">Tick</span></a> <span class="argument">$tick</span>) + <div class="description"> + Associe un objet <a href="Tick.html">Tick</a> $tick à l'axe. + Cet objet sera reconnu par le nom $name au sein de la classe <a href="Axis.html">Axis</a>. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.tick"></a><span class="access">public</span> <a href="Tick.html"><span class="TYPE">Tick</span></a> <a href="Axis.html#method.tick">tick</a>(<span class="TYPE">string</span> <span class="argument">$name</span>) + <div class="description"> + Récupère un objet <a href="Tick.html">Tick</a> en fonction de son nom. + Cet objet doit avoir été précédemment ajouté avec la méthode <a href="Axis.html#method.addTick">Axis::addTick()</a>. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.deleteTick"></a><span class="access">public</span> <a href="Axis.html#method.deleteTick">deleteTick</a>(<span class="TYPE">string</span> <span class="argument">$name</span>) + <div class="description"> + Supprime l'objet <a href="Tick.html">Tick</a> de nom $name associé à l'axe. + Pour pouvoir être supprimé, cet objet doit avoir été précédemment ajouté avec la méthode <a href="Axis.html#method.addTick">Axis::addTick()</a>. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideTicks"></a><span class="access">public</span> <a href="Axis.html#method.hideTicks">hideTicks</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + <div class="description"> + Cache ou non tous les ticks qui ont été associés à cet axe. + <div class="see"> + Voir aussi : + <ul><li><a href="Axis.html#method.addTick">Axis::addTick()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setTickStyle"></a><span class="access">public</span> <a href="Axis.html#method.setTickStyle">setTickStyle</a>(<span class="TYPE">int</span> <span class="argument">$style</span>) + <div class="description"> + Change le style de tous les ticks associés à l'axe pour $style. + <div class="see"> + Voir aussi : + <ul><li><a href="Tick.html#method.setStyle">Tick::setStyle()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.reverseTickStyle"></a><span class="access">public</span> <a href="Axis.html#method.reverseTickStyle">reverseTickStyle</a>() + <div class="description"> + Inverse le style de tous les ticks associés à l'axe pour $style. + Si les ticks étaient tournés vers l'extérieur, ils seront désormais tournés vers l'intérieur. + Et vice-versa. + <div class="see"> + Voir aussi : + <ul><li><a href="Tick.html#method.setStyle">Tick::setStyle()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setTickInterval"></a><span class="access">public</span> <a href="Axis.html#method.setTickInterval">setTickInterval</a>(<span class="TYPE">int</span> <span class="argument">$interval</span>) + <div class="description"> + Change l'intervalle d'affichage de tous les ticks associés à l'axe pour $interval. + Cette méthode permet d'espacer l'affichage des ticks par rapport aux valeurs de l'axe. + <div class="see"> + Voir aussi : + <ul><li><a href="Tick.html#method.setStyle">Tick::setStyle()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setNumberByTick"></a><span class="access">public</span> <a href="Axis.html#method.setNumberByTick">setNumberByTick</a>(<span class="TYPE">string</span> <span class="argument">$to</span>, <span class="TYPE">string</span> <span class="argument">$from</span>, <span class="TYPE">float</span> <span class="argument">$number</span>) + <div class="description"> + Cette méthode permet de modifier la fréquence d'affichage d'un objet <a href="Tick.html">Tick</a> par rapport à un autre. + $to représente l'objet dont la fréquence d'affichage doit être modifiée et $from l'objet auquel on se réfère. + A chaque fois qu'un tick $from sera affiché, on affichera $number ticks $to. + Si $number vaut 2, cela signifie que deux ticks $to seront affichés pour un tick $from. + Cette méthode prend tout son sens donc le cadre des <a href="Plot.html">Plot</a> par exemple : +<pre> + +<?php + +require_once 'LinePlot.class.php'; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +$plot = new <a href="LinePlot.html">LinePlot</a>(array(1, 2, 3)); + +// Pour chaque tick major affiché, +// on affichera 10 ticks minor +$plot->xAxis->setNumberByTick('minor', 'major', 10); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + Cela donne 10 ticks mineurs par tick majeur : + <div class="image"> + <img src="doc/image/ticks.png" alt="10 ticks mineurs par tick majeur"> + </div> + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLabelInterval"></a><span class="access">public</span> <a href="Axis.html#method.setLabelInterval">setLabelInterval</a>(<span class="TYPE">int</span> <span class="argument">$interval</span>) + <div class="description"> + Change l'intervalle d'affichage des étiquettes sur l'axe pour $interval. + Par défaut, cet intervalle est égal à 1. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLabelNumber"></a><span class="access">public</span> <a href="Axis.html#method.setLabelNumber">setLabelNumber</a>(<span class="TYPE">int</span> <span class="argument">$number</span>) + <div class="description"> + Change le nombre d'étiquettes à afficher sur l'axe pour $number. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getLabelNumber"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Axis.html#method.getLabelNumber">getLabelNumber</a>() + <div class="description"> + Retourne le nombre d'étiquettes qui seront affichées sur l'axe. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLabelPrecision"></a><span class="access">public</span> <a href="Axis.html#method.setLabelPrecision">setLabelPrecision</a>(<span class="TYPE">int</span> <span class="argument">$precision</span>) + <div class="description"> + Change la précision des valeurs affichées sur chaque étiquette de l'axe. + $number représente le nombre de chiffres après la virgule qui doivent être affiché. + Par défaut, $precision vaut 0. + <div class="see"> + Voir aussi : + <ul> +<li><a href="Axis.html#method.setLabelText">Axis::setLabelText()</a></li> +<li><a href="Label.html#method.setCallbackFunction">Label::setCallbackFunction()</a></li> +</ul> +</div> +</div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLabelText"></a><span class="access">public</span> <a href="Axis.html#method.setLabelText">setLabelText</a>(<span class="TYPE">array</span> <span class="argument">$texts</span>) + <div class="description"> + Cette méthode permet d'afficher des valeurs arbitraires plutôt que des valeurs numériques sur les étiquettes de l'axe. + $texts est un tableau comportant autant d'entrées que d'étiquettes et qui contient les nouvelles valeurs à afficher. + <div class="see"> + Voir aussi : + <ul> +<li><a href="Axis.html#method.setLabelPrecision">Axis::setLabelPrecision()</a></li> +<li><a href="Label.html#method.setCallbackFunction">Label::setCallbackFunction()</a></li> +</ul> +</div> +</div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setTitleAlignment"></a><span class="access">public</span> <a href="Axis.html#method.setTitleAlignment">setTitleAlignment</a>(<span class="TYPE">int</span> <span class="argument">$alignment</span>) + <div class="description"> + Change l'alignement du titre de l'axe sur l'axe. + Les valeurs possibles sont <a href="Label.html#constant.LEFT">Label::LEFT</a>, <a href="Label.html#constant.RIGHT">Label::RIGHT</a>, <a href="Label.html#constant.TOP">Label::TOP</a> et <a href="Label.html#constant.BOTTOM">Label::BOTTOM</a>. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setTitlePosition"></a><span class="access">public</span> <a href="Axis.html#method.setTitlePosition">setTitlePosition</a>(<span class="TYPE">float</span> <span class="argument">$postion</span>) + <div class="description"> + Change la position du titre sur l'axe. + $position est une fraction de la taille de l'axe. + Par exemple, si $position est placé à 0.5, le titre sera affiché au milieu de l'axe. + Si $position vaut 0.25, alors le titre sera affiché sur le premier quart de l'axe. + Pour aligner le titre par rapport à cette position, utilisez la méthode <a href="Axis.html#method.setTitleAlignment">Axis::setTitleAlignment()</a>. + <div class="see"> + Voir aussi : + <ul><li><a href="Axis.html#method.setTitleAlignment">Axis::setTitleAlignment()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="Axis.html#method.setColor">setColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de l'axe et de son titre pour $color. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setPadding"></a><span class="access">public</span> <a href="Axis.html#method.setPadding">setPadding</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>) + <div class="description"> + Change l'espace interne à gauche et à droite de l'axe. + Gauche et droite n'ont de sens que pour les axes verticaux. + Pour les axes plus horizontaux, préférez haut à gauche et bas à droite. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getPadding"></a><span class="access">public</span> <a href="Side.html"><span class="TYPE">Side</span></a> <a href="Axis.html#method.getPadding">getPadding</a>() + <div class="description"> + Retourne l'espace interne associé à l'axe. + </div> +<div class="description-bottom"><a href="Axis.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/BarPlot.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/BarPlot.html new file mode 100644 index 0000000000000000000000000000000000000000..207356436a3640769ab0c7e61821448f3c5d3c96 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/BarPlot.html @@ -0,0 +1,199 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class BarPlot</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul> +<li><a href="Plot.html">Plot</a></li> +<ul><li>BarPlot <span class="interface">implements</span> <a href="Legendable.html">Legendable</a> +</li></ul> +</ul> +</ul></div><div class="description"> + <p> + Cette classe permet de dessiner des histogrammes. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="BarPlot.html#property.label">$label</a> +</li> +<li> +<span class="access">public</span> <a href="Shadow.html"><span class="TYPE">Shadow</span></a> <a href="BarPlot.html#property.barShadow">$barShadow</a> +</li> +<li> +<span class="access">public</span> <a href="Border.html"><span class="TYPE">Border</span></a> <a href="BarPlot.html#property.barBorder">$barBorder</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="BarPlot.html#method.__construct">__construct</a>(<span class="TYPE">array</span> <span class="argument">$values</span>, <span class="TYPE">int</span> <span class="argument">$identifier</span> = <span class="default">1</span>, <span class="TYPE">int</span> <span class="argument">$number</span> = <span class="default">1</span>, <span class="TYPE">int</span> <span class="argument">$depth</span> = <span class="default">0</span>) + </li> +<li> +<span class="access">public</span> <a href="BarPlot.html#method.setBarPadding">setBarPadding</a>(<span class="TYPE">float</span> <span class="argument">$left</span> = <span class="default">NULL</span>, <span class="TYPE">float</span> <span class="argument">$right</span> = <span class="default">NULL</span>) + </li> +<li> +<span class="access">public</span> <a href="BarPlot.html#method.setBarSize">setBarSize</a>(<span class="TYPE">float</span> <span class="argument">$size</span>) + </li> +<li> +<span class="access">public</span> <a href="BarPlot.html#method.setBarSpace">setBarSpace</a>(<span class="TYPE">int</span> <span class="argument">$space</span>) + </li> +<li> +<span class="access">public</span> <a href="BarPlot.html#method.setBarColor">setBarColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="BarPlot.html#method.setBarGradient">setBarGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + </li> +<li> +<span class="access">public</span> <a href="BarPlot.html#method.move">move</a>(<span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.label"></a><span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="BarPlot.html#property.label">$label</a><div class="description"> + Représente les étiquettes affichées au-dessus de chaque barre de l'histogramme. + Ces étiquettes contiennent la valeur de chaque barre. + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.barShadow"></a><span class="access">public</span> <a href="Shadow.html"><span class="TYPE">Shadow</span></a> <a href="BarPlot.html#property.barShadow">$barShadow</a><div class="description"> + Représente l'ombre associée à chaque barre de l'histogramme. + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.barBorder"></a><span class="access">public</span> <a href="Border.html"><span class="TYPE">Border</span></a> <a href="BarPlot.html#property.barBorder">$barBorder</a><div class="description"> + La bordure à afficher autour de chaque barre de l'histogramme. + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="BarPlot.html#method.__construct">__construct</a>(<span class="TYPE">array</span> <span class="argument">$values</span>, <span class="TYPE">int</span> <span class="argument">$identifier</span> = <span class="default">1</span>, <span class="TYPE">int</span> <span class="argument">$number</span> = <span class="default">1</span>, <span class="TYPE">int</span> <span class="argument">$depth</span> = <span class="default">0</span>) + <div class="description"> + Créé un nouvel histogramme avec les valeurs présentes dans $values. + $number représente le nombre d'histogrammes affichés en parallèle tandis que $identifier permet de spécifier où se situe l'histogramme courant. + $depth représente la profondeur de l'histogramme en pixels. + Le tableau $values doit être une liste de valeurs dans un tableau incrémental, c'est-à -dire dont les clés valent de 0 à n - 1 (où n est la taille du tableau). +<pre> + +<?php + +require_once "BarPlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +// Tableau de valeurs +$x = array(-19, 42, 31); + +$plot = new <a href="BarPlot.html">BarPlot</a>($x); +$plot-><a href="Plot.html#method.setXAxisZero">setXAxisZero</a>(TRUE); +$plot-><a href="BarPlot.html#method.setBarColor">setBarColor</a>( + new <a href="Color.html">Color</a>(240, 185, 130, 20) +); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBarPadding"></a><span class="access">public</span> <a href="BarPlot.html#method.setBarPadding">setBarPadding</a>(<span class="TYPE">float</span> <span class="argument">$left</span> = <span class="default">NULL</span>, <span class="TYPE">float</span> <span class="argument">$right</span> = <span class="default">NULL</span>) + <div class="description"> + Change l'espace interne de gauche et de droite sur chaque barre. + Laisser $left ou $right à NULL permet de ne pas modifier l'ancienne valeur. + Les valeurs données doivent être comprises entre 0 et 1 et représentent une fraction de l'espace réservé à chaque barre. + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBarSize"></a><span class="access">public</span> <a href="BarPlot.html#method.setBarSize">setBarSize</a>(<span class="TYPE">float</span> <span class="argument">$size</span>) + <div class="description"> + Change la taille de chaque barre pour $size. + Les valeurs données doivent être comprises entre 0 et 1 et représentent une fraction de l'espace réservé à chaque barre. + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBarSpace"></a><span class="access">public</span> <a href="BarPlot.html#method.setBarSpace">setBarSpace</a>(<span class="TYPE">int</span> <span class="argument">$space</span>) + <div class="description"> + Change l'espace entre les histogrammes affichés en parallèle pour $space. + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBarColor"></a><span class="access">public</span> <a href="BarPlot.html#method.setBarColor">setBarColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur des barres de l'histogrammes. + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBarGradient"></a><span class="access">public</span> <a href="BarPlot.html#method.setBarGradient">setBarGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + <div class="description"> + Change le dégradé de fond des barres de l'histogramme. + Le dégradé de fond remplit le polygone définit par tous les points de la ligne additionés des points extrêmes de l'axe des abscisses. +<pre> + +<?php + +require_once "BarPlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +$x = array(19, 30, 31, -42, 11); + +$plot = new <a href="BarPlot.html">BarPlot</a>($x); +$plot-><a href="BarPlot.html#method.setBarGradient">setBarGradient</a>( + new <a href="LinearGradient.html">LinearGradient</a>( + new <a href="Color.html">Color</a>(255, 20, 20, 30), + new <a href="Color.html">Color</a>(20, 255, 20, 30), + 90 + ) +); + +$plot-><a href="Plot.html#method.setYMin">setYMin</a>(-100); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.move"></a><span class="access">public</span> <a href="BarPlot.html#method.move">move</a>(<span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + <div class="description"> + Déplace chaque barre de $x pixels sur l'horizontale et $y pixels sur la vertical avant le dessin. + </div> +<div class="description-bottom"><a href="BarPlot.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/BilinearGradient.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/BilinearGradient.html new file mode 100644 index 0000000000000000000000000000000000000000..b53e67629fae7ef2515698fb68c92fb7b4c0d5b7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/BilinearGradient.html @@ -0,0 +1,61 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class BilinearGradient</h2><div class="extends"><ul> +<li><a href="Gradient.html">Gradient</a></li> +<ul> +<li><a href="LinearGradient.html">LinearGradient</a></li> +<ul><li>BilinearGradient</li></ul> +</ul> +</ul></div><div class="description"> + <p> + Cette classe permet de décrire un dégradé bilinéaire. Un dégradé bilinéaire à ceci de particulier par rapport au dégradé linéaire que son centre peut être décalé. + </p> + <p style="font-weight: bold"> + ATTENTION, les dégradés bilinéaires sont en cours de développement et ne sont pas encore disponibles sur Artichow. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"><li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="BilinearGradient.html#property.center">$center</a> +</li></ul><ul class="methods"><li> +<span class="access">public</span> <a href="BilinearGradient.html#method.__construct">__construct</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$from</span>, <a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$to</span>, <span class="TYPE">int</span> <span class="argument">$angle</span>, <span class="TYPE">float</span> <span class="argument">$center</span> = <span class="default">0.5</span>) + </li></ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.center"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="BilinearGradient.html#property.center">$center</a><div class="description"> + Décrit la position du centre du dégradé. Cette valeur doit être comprise entre 0 et 1. + </div> +<div class="description-bottom"><a href="BilinearGradient.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="BilinearGradient.html#method.__construct">__construct</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$from</span>, <a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$to</span>, <span class="TYPE">int</span> <span class="argument">$angle</span>, <span class="TYPE">float</span> <span class="argument">$center</span> = <span class="default">0.5</span>) + <div class="description"> + Construit une nouveu dégradé. Cette méthode doit être appelée par toutes les classes qui dérivent de celle-ci. Le paramètre $from décrit la couleur de départ du dégradé et le paramètre $to celle de fin. Le troisième paramètre $angle décrit l'angle du dégradé. Ce peut être un dégradé horizontal (angle de 0°) ou un dégradé vertical (angle de 90°). Le dernier paramètre doit être compris entre 0 et 1 permet de spécifier le centre du dégradé. Une valeur de 0.5 signifie que le dégradé sera symétrique. + </div> +<div class="description-bottom"><a href="BilinearGradient.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Border.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Border.html new file mode 100644 index 0000000000000000000000000000000000000000..e00a5e35fbd731661379cec782278584af39e026 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Border.html @@ -0,0 +1,142 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Border</h2><div class="description"> + <p>La classe <a href="Border.html">Border</a> permet de centraliser la gestion des bordures sur Artichow.</p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">protected</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Border.html#property.color">$color</a> := <span class="default">new Black</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">int</span> <a href="Border.html#property.style">$style</a> := <span class="default">Line::SOLID</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Border.html#property.hide">$hide</a> := <span class="default">FALSE</span> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Border.html#method.__construct">__construct</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span> = <span class="default">new Black</span>, <span class="TYPE">int</span> <span class="argument">$style</span> = <span class="default">Line::SOLID</span>) + </li> +<li> +<span class="access">public</span> <a href="Border.html#method.setColor">setColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Border.html#method.setStyle">setStyle</a>(<span class="TYPE">int</span> <span class="argument">$style</span>) + </li> +<li> +<span class="access">public</span> <a href="Border.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Border.html#method.show">show</a>(<span class="TYPE">bool</span> <span class="argument">$show</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">bool</span> <a href="Border.html#method.visible">visible</a>() + </li> +<li> +<span class="access">public</span> <a href="Border.html#method.rectangle">rectangle</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p2</span>) + </li> +<li> +<span class="access">public</span> <a href="Border.html#method.ellipse">ellipse</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.color"></a><span class="access">protected</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Border.html#property.color">$color</a> := <span class="default">new Black</span><div class="description"> + La couleur de la bordure + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.style"></a><span class="access">protected</span> <span class="TYPE">int</span> <a href="Border.html#property.style">$style</a> := <span class="default">Line::SOLID</span><div class="description"> + Style de la ligne qui compose la bordure. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.hide"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Border.html#property.hide">$hide</a> := <span class="default">FALSE</span><div class="description"> + Est-ce que la bordure doit être cachée ? + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Border.html#method.__construct">__construct</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span> = <span class="default">new Black</span>, <span class="TYPE">int</span> <span class="argument">$style</span> = <span class="default">Line::SOLID</span>) + <div class="description"> + Déclare une nouvelle bordure de couleur $color et avec pour style $style. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="Border.html#method.setColor">setColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de la bordure pour $color. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setStyle"></a><span class="access">public</span> <a href="Border.html#method.setStyle">setStyle</a>(<span class="TYPE">int</span> <span class="argument">$style</span>) + <div class="description"> + Change le style de la bordure pour $style. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Border.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + <div class="description"> + Détermine si la bordure doit être cachée ou non. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.show"></a><span class="access">public</span> <a href="Border.html#method.show">show</a>(<span class="TYPE">bool</span> <span class="argument">$show</span> = <span class="default">TRUE</span>) + <div class="description"> + Détermine si la bordure doit être affichée ou non. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.visible"></a><span class="access">public</span> <span class="TYPE">bool</span> <a href="Border.html#method.visible">visible</a>() + <div class="description"> + Retourne TRUE si la bordure doit être affichée, FALSE sinon. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.rectangle"></a><span class="access">public</span> <a href="Border.html#method.rectangle">rectangle</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p2</span>) + <div class="description"> + Dessine la bordure sous la forme d'un rectangle dont la diagonale s'étend des points $p1 à $p2. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.ellipse"></a><span class="access">public</span> <a href="Border.html#method.ellipse">ellipse</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + <div class="description"> + Dessine la bordure sous la forme d'une ellipse de centre $center et de largeur et hauteur respectives $width et $height. + </div> +<div class="description-bottom"><a href="Border.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Color.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Color.html new file mode 100644 index 0000000000000000000000000000000000000000..6514b75bf278451c9efc498d23f9a8c2c8940551 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Color.html @@ -0,0 +1,167 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Color</h2><div class="description"> + <p> + La classe <a href="Color.html">Color</a> permet de gérer les couleurs de manière uniforme sur Artichow. + </p> + <p> + Afin de simplifier l'utilisation de cette classe, plusieurs couleurs sont déjà prédéfinies sur Artichow. + Chacune de ces couleurs est une classe qui dérive de <a href="Color.html">Color</a> et dont le constructeur ne prend qu'un paramètre, le degré de transparence. Voici les couleurs prédéfinies triées par ton : + </p> + <ul> + <li> +<em>Gris :</em> Black, AlmostBlack, VeryDarkGray, DarkGray, MidGray, LightGray, VeryLightGray, White</li> + <li> +<em>Rouge :</em> VeryDarkRed, DarkRed, MidRed, Red, LightRed</li> + <li> +<em>Vert :</em> VeryDarkGreen, DarkGreen, MidGreen, Green, LightGreen</li> + <li> +<em>Bleu :</em> VeryDarkBlue, DarkBlue, MidBlue, Blue, LightBlue</li> + <li> +<em>Jaune :</em> VeryDarkYellow, DarkYellow, MidYellow, Yellow, LightYellow</li> + <li> +<em>Cyan :</em> VeryDarkCyan, DarkCyan, MidCyan, Cyan, LightCyan</li> + <li> +<em>Magenta :</em> VeryDarkMagenta, DarkMagenta, MidMagenta, Magenta, LightMagenta</li> + <li> +<em>Orange :</em> DarkOrange, Orange, LightOrange, VeryLightOrange</li> + <li> +<em>Rose :</em> DarkPink, Pink, LightPink, VeryLightPink</li> + <li> +<em>Violet :</em> DarkPurple, Purple, LightPurple, VeryLightPurple</li> + </ul> + <p> + Voici un exemple d'utilisation pour les couleurs prédéfinies : +<pre> + +<?php + +// On créé un bleu foncé +$blue = new DarkBlue; // Equivalent à new <a href="Color.html">Color</a>(0, 0, 128); + +// On créé de l'orange transparent à 50 % +$orange = new Orange(50); // Equivalent à new <a href="Color.html">Color</a>(255, 128, 0, 50); + +?> + +</pre> + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#property.red">$red</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#property.green">$green</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#property.blue">$blue</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#property.alpha">$alpha</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Color.html#method.__construct">__construct</a>(<span class="TYPE">int</span> <span class="argument">$red</span>, <span class="TYPE">int</span> <span class="argument">$green</span>, <span class="TYPE">int</span> <span class="argument">$blue</span>, <span class="TYPE">int</span> <span class="argument">$alpha</span> = <span class="default">0</span>) + </li> +<li> +<span class="access">public</span> <a href="Color.html#method.brightness">brightness</a>(<span class="TYPE">int</span> <span class="argument">$brightness</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#method.getColor">getColor</a>(<span class="TYPE">resource</span> <span class="argument">$resource</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">array</span> <a href="Color.html#method.rgba">rgba</a>() + </li> +<li> +<span class="access">public</span> <a href="Color.html#method.free">free</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.red"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#property.red">$red</a><div class="description"> + Intensité en rouge de la couleur (entre 0 et 255) + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.green"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#property.green">$green</a><div class="description"> + Intensité en vert de la couleur (entre 0 et 255) + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.blue"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#property.blue">$blue</a><div class="description"> + Intensité en blue de la couleur (entre 0 et 255) + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.alpha"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#property.alpha">$alpha</a><div class="description"> + Degré de transparence de la couleur (entre 0 et 100) + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Color.html#method.__construct">__construct</a>(<span class="TYPE">int</span> <span class="argument">$red</span>, <span class="TYPE">int</span> <span class="argument">$green</span>, <span class="TYPE">int</span> <span class="argument">$blue</span>, <span class="TYPE">int</span> <span class="argument">$alpha</span> = <span class="default">0</span>) + <div class="description"> + Construit une nouvelle couleur. Les trois premiers paramètres représentent l'intensité en rouge, vert et bleu pour cette couleur. L'intensité de chaque couleur est un nombre compris entre 0 et 255 (du foncé vers le clair). Le paramètre $alpha représente le dégré de transparence de la couleur, et doit être compris entre 0 et 100. + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.brightness"></a><span class="access">public</span> <a href="Color.html#method.brightness">brightness</a>(<span class="TYPE">int</span> <span class="argument">$brightness</span>) + <div class="description"> + Change la luminosité de la couleur, en ajoutant la valeur $brightness à chaque composante (rouge, vert, bleu) de cette couleur. + $brightness peut prendre des valeurs comprises entre -255 et +255. + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getColor"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Color.html#method.getColor">getColor</a>(<span class="TYPE">resource</span> <span class="argument">$resource</span>) + <div class="description"> + Retourne la couleur créée sous la forme d'un entier numérique, utilisable ensuite avec les fonctions GD de PHP. + Une fois que vous n'avez plus besoin de la couleur, vous pouvez libérer la mémoire utilisée avec <a href="Color.html#method.free">free()</a>. + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.rgba"></a><span class="access">public</span> <span class="TYPE">array</span> <a href="Color.html#method.rgba">rgba</a>() + <div class="description"> + Retourne un tableau de quatre valeurs qui représentent l'intensité en rouge, vert et bleu ainsi que le degré de transparence de la couleur. + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.free"></a><span class="access">public</span> <a href="Color.html#method.free">free</a>() + <div class="description"> + Libère les ressources allouées lors de l'appel à <a href="Color.html#method.getColor">getColor()</a>. + </div> +<div class="description-bottom"><a href="Color.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Component.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Component.html new file mode 100644 index 0000000000000000000000000000000000000000..d2b466436dd01697465f3385788d7c5de9eda840 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Component.html @@ -0,0 +1,464 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> +<small>abstract</small> Class Component</h2><div class="description"> + <p> + Un composant est un objet qui peut être ajouté à une <a href="Image.html">Image</a>. Les composants sont indépendants les uns des autres. La classe <a href="Component.html">Component</a> est une classe abstraite, dont doivent dériver tous les objets qui vont pouvoir être ajoutés sur une image. + </p> + <p> + Sur un composant, l'axe des abscisses rejoint l'axe des ordonnées sur le coin haut-gauche. Le coin haut-gauche du composant a donc pour coordonnées (0, 0) et le coin bas-droite (largeur, hauteur). Par exemple, sur une image de largeur 100 et de hauteur 50, un point à 50 sur l'axe des abscisses et 25 sur l'axe des ordonnées sera au centre de l'image. + </p> + </div><div class="inherit"> + Les classes suivantes dérivent de Component : + <ul> +<li><a href="ComponentGroup.html">ComponentGroup</a></li> +<li><a href="MathPlot.html">MathPlot</a></li> +<li><a href="Pie.html">Pie</a></li> +<li><a href="Plot.html">Plot</a></li> +</ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">protected</span> <a href="Drawer.html"><span class="TYPE">Drawer</span></a> <a href="Component.html#property.drawer">$drawer</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">float</span> <a href="Component.html#property.width">$width</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">float</span> <a href="Component.html#property.height">$height</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">float</span> <a href="Component.html#property.x">$x</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">float</span> <a href="Component.html#property.y">$y</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Component.html#property.w">$w</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Component.html#property.h">$h</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Component.html#property.top">$top</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Component.html#property.left">$left</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">mixed</span> <a href="Component.html#property.background">$background</a> +</li> +<li> +<span class="access">public</span> <a href="Side.html"><span class="TYPE">Side</span></a> <a href="Component.html#property.padding">$padding</a> +</li> +<li> +<span class="access">public</span> <a href="Side.html"><span class="TYPE">Side</span></a> <a href="Component.html#property.space">$space</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Component.html#property.auto">$auto</a> +</li> +<li> +<span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="Component.html#property.title">$title</a> +</li> +<li> +<span class="access">public</span> <a href="Legend.html"><span class="TYPE">Legend</span></a> <a href="Component.html#property.legend">$legend</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Component.html#method.__construct">__construct</a>() + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.auto">auto</a>(<span class="TYPE">bool</span> <span class="argument">$auto</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setSize">setSize</a>(<span class="TYPE">float</span> <span class="argument">$width</span>, <span class="TYPE">float</span> <span class="argument">$height</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setAbsSize">setAbsSize</a>(<span class="TYPE">int</span> <span class="argument">$w</span>, <span class="TYPE">int</span> <span class="argument">$h</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setBackgroundImage">setBackgroundImage</a>(<a href="Image.html"><span class="TYPE">Image</span></a> <span class="argument">$image</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">mixed</span> <a href="Component.html#method.getBackground">getBackground</a>(<span class="TYPE">int</span> <span class="argument">$type</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setPadding">setPadding</a>(<span class="TYPE">int</span> <span class="argument">$left</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$right</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$top</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span> = <span class="default">NULL</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setSpace">setSpace</a>(<span class="TYPE">int</span> <span class="argument">$left</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$right</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$top</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span> = <span class="default">NULL</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setCenter">setCenter</a>(<span class="TYPE">float</span> <span class="argument">$x</span>, <span class="TYPE">float</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.setAbsPosition">setAbsPosition</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$top</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.init">init</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + </li> +<li> +<span class="access">public</span> <a href="Component.html#method.finalize">finalize</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + </li> +<li> +<span class="access">abstract public</span> <span class="TYPE">array</span> <a href="Component.html#method.getPosition">getPosition</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + </li> +<li> +<span class="access">abstract public</span> <a href="Component.html#method.drawEnvelope">drawEnvelope</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + </li> +<li> +<span class="access">abstract public</span> <a href="Component.html#method.drawComponent">drawComponent</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <span class="TYPE">int</span> <span class="argument">$x1</span>, <span class="TYPE">int</span> <span class="argument">$y1</span>, <span class="TYPE">int</span> <span class="argument">$x2</span>, <span class="TYPE">int</span> <span class="argument">$y2</span>, <span class="TYPE">bool</span> <span class="argument">$aliasing</span>) + </li> +<li> +<span class="access">protected</span> <a href="Component.html#method.getSpace">getSpace</a>(<span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.drawer"></a><span class="access">protected</span> <a href="Drawer.html"><span class="TYPE">Drawer</span></a> <a href="Component.html#property.drawer">$drawer</a><div class="description"> + Un objet <a href="Drawer.html">Drawer</a> pour dessiner sur l'image. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.width"></a><span class="access">public</span> <span class="TYPE">float</span> <a href="Component.html#property.width">$width</a><div class="description"> + Largeur du composant entre 0 et 1. Représente une fraction de la largeur de l'image. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.height"></a><span class="access">public</span> <span class="TYPE">float</span> <a href="Component.html#property.height">$height</a><div class="description"> + Hauteur du composant entre 0 et 1. Représente une fraction de la hauteur de l'image. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.x"></a><span class="access">public</span> <span class="TYPE">float</span> <a href="Component.html#property.x">$x</a><div class="description"> + Position du composant sur l'axe des abscisses entre 0 et 1. Représente une fraction de la largeur de l'image. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.y"></a><span class="access">public</span> <span class="TYPE">float</span> <a href="Component.html#property.y">$y</a><div class="description"> + Position du composant sur l'axe des ordonnées entre 0 et 1. Représente une fraction de la hauteur de l'image. + Attention, la position 0 correspond au haut de l'image. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.w"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Component.html#property.w">$w</a><div class="description"> + Largeur du composant en pixels. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.h"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Component.html#property.h">$h</a><div class="description"> + Hauteur du composant en pixels. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.top"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Component.html#property.top">$top</a><div class="description"> + Position du composant sur l'axe des ordonnées en pixels. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.left"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Component.html#property.left">$left</a><div class="description"> + Position du composant sur l'axe des abscisses en pixels. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.background"></a><span class="access">protected</span> <span class="TYPE">mixed</span> <a href="Component.html#property.background">$background</a><div class="description"> + Fond du composant. Peut être une <a href="Color.html">couleur</a>, un <a href="Gradient.html">dégradé</a> ou peut être laissé à NULL pour ne spécifier aucune couleur de fond. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.padding"></a><span class="access">public</span> <a href="Side.html"><span class="TYPE">Side</span></a> <a href="Component.html#property.padding">$padding</a><div class="description"> + Espace interne du composant. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.space"></a><span class="access">public</span> <a href="Side.html"><span class="TYPE">Side</span></a> <a href="Component.html#property.space">$space</a><div class="description"> + Espace interne dans la zone de dessin effective du composant. Les valeurs doivent être données en pourcentage de la taille de la zone de dessin. + Le zone de dessin est la zone dans laquelle est dessiné le composant, c'est-à -dire la zone du composant amputée des axes et de l'<a href="Component.html#property.padding">espace interne</a>. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.auto"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Component.html#property.auto">$auto</a><div class="description"> + Doit-on ajuster automatiquement le composant ? + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.title"></a><span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="Component.html#property.title">$title</a><div class="description"> + Le titre du composant. + Si un titre est spécifié, il sera affiché sur l'image. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.legend"></a><span class="access">public</span> <a href="Legend.html"><span class="TYPE">Legend</span></a> <a href="Component.html#property.legend">$legend</a><div class="description"> + La légende associée au composant. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Component.html#method.__construct">__construct</a>() + <div class="description"> + Construit le composant en lui affectant une taille égale à celle de l'image et en le positionnant au centre de cette image. + Le composant remplit donc toute la surface de l'image. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.auto"></a><span class="access">public</span> <a href="Component.html#method.auto">auto</a>(<span class="TYPE">bool</span> <span class="argument">$auto</span>) + <div class="description"> + TRUE si le composant doit être automatiquement ajusté, FALSE sinon. + La notion d'ajustage automatique est propre à chaque classe qui dérive de celle-ci. + Par exemple, sur les histogrammes, si le composant n'est pas automatiquement ajusté, alors les barres ne seront pas centrées sur zéro mais sur leur valeur minimum. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSize"></a><span class="access">public</span> <a href="Component.html#method.setSize">setSize</a>(<span class="TYPE">float</span> <span class="argument">$width</span>, <span class="TYPE">float</span> <span class="argument">$height</span>) + <div class="description"> + Change la largeur $width et la hauteur $height du composant. + Les nouvelles valeurs doivent être comprises entre 0 et 1 et correspondent à une fraction des largeur et hauteur de l'image à laquelle le composant appartient. +<pre> + +<?php + +require_once "LinePlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +// LinePLot dérive de Component +$plot = new <a href="LinePlot.html">LinePlot</a>(array(1, 2, 3)); + +// Le taille du composant sera 1 / 3 de celle de l'image, soit 133x133 pixels +$plot-><a href="Component.html#method.setSize">setSize</a>(1 / 3, 1 / 3); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAbsSize"></a><span class="access">public</span> <a href="Component.html#method.setAbsSize">setAbsSize</a>(<span class="TYPE">int</span> <span class="argument">$w</span>, <span class="TYPE">int</span> <span class="argument">$h</span>) + <div class="description"> + Donne une taille absolue au composant. + La largeur $width et la hauteur $height doivent être données en pixels. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundColor"></a><span class="access">public</span> <a href="Component.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de fond du composant. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundGradient"></a><span class="access">public</span> <a href="Component.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + <div class="description"> + Change le dégradé de fond du composant. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundImage"></a><span class="access">public</span> <a href="Component.html#method.setBackgroundImage">setBackgroundImage</a>(<a href="Image.html"><span class="TYPE">Image</span></a> <span class="argument">$image</span>) + <div class="description"> + Change l'image de fond du composant. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getBackground"></a><span class="access">public</span> <span class="TYPE">mixed</span> <a href="Component.html#method.getBackground">getBackground</a>(<span class="TYPE">int</span> <span class="argument">$type</span>) + <div class="description"> + Retourne le fond de l'image. Cela peut être une <a href="Color.html">couleur</a>, un <a href="Gradient.html">dégradé</a> ou encore une <a href="Image.html">image</a>. Si aucun fond n'a été spécifié, cette méthode retourne NULL. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setPadding"></a><span class="access">public</span> <a href="Component.html#method.setPadding">setPadding</a>(<span class="TYPE">int</span> <span class="argument">$left</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$right</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$top</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span> = <span class="default">NULL</span>) + <div class="description"> + Change l'espace interne du composant. + Les valeurs doivent être données en pixels. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSpace"></a><span class="access">public</span> <a href="Component.html#method.setSpace">setSpace</a>(<span class="TYPE">int</span> <span class="argument">$left</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$right</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$top</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span> = <span class="default">NULL</span>) + <div class="description"> + Change l'espace interne dans la zone de dessin effective du composant. Les valeurs doivent être données en pourcentage de la taille de la zone de dessin. + Le zone de dessin est la zone dans laquelle est dessiné le composant, c'est-à -dire la zone du composant amputée des axes et de l'<a href="Component.html#property.padding">espace interne</a>. +<pre> + +<?php + +require_once "LinePlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +$plot = new <a href="LinePlot.html">LinePlot</a>(array(43, 23, 65, 37)); +$plot-><a href="Component.html#method.setSpace">setSpace</a>(10, 10, 20, 20); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setCenter"></a><span class="access">public</span> <a href="Component.html#method.setCenter">setCenter</a>(<span class="TYPE">float</span> <span class="argument">$x</span>, <span class="TYPE">float</span> <span class="argument">$y</span>) + <div class="description"> + Change la position du centre du composant sur l'image. + Les nouvelles positions $x et $y représentent une fraction des largeur et hauteur de l'image. + Attention, la position 0 pour $y place le centre du composant en haut de l'image. La position 1 le place en bas de l'image. +<pre> + +<?php + +require_once "LinePlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +// LinePLot dérive de Component +$plot = new <a href="LinePlot.html">LinePlot</a>(array(1, 2, 3)); + +// Le taille du composant sera 1 / 3 de celle de l'image, soit 133x133 pixels +$plot-><a href="Component.html#method.setSize">setSize</a>(1 / 3, 1 / 3); +// Place le composant en haut à gauche +$plot-><a href="Component.html#method.setCenter">setCenter</a>(1 / 6, 1 / 6); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAbsPosition"></a><span class="access">public</span> <a href="Component.html#method.setAbsPosition">setAbsPosition</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$top</span>) + <div class="description"> + Change la position du composant sur l'image. + Contrairement à <a href="Component.html#method.setCenter">setCenter()</a>, cette méthode ne place pas le composant par rapport à son centre, mais par rapport à son coin haut-gauche. Les positions $left à gauche et $top pour la hauteur doivent être données en pixels. + Attention, la position 0 pour $top place le composant en haut de l'image. +<pre> + +<?php + +require_once "LinePlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +// LinePLot dérive de Component +$plot = new <a href="LinePlot.html">LinePlot</a>(array(1, 2, 3)); + +// Le taille du composant sera 1 / 3 de celle de l'image, soit 133x133 pixels +$plot-><a href="Component.html#method.setSize">setSize</a>(1 / 3, 1 / 3); +// Place le composant en haut à gauche +$plot-><a href="Component.html#method.setAbsPosition">setAbsPosition</a>(0, 0); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.init"></a><span class="access">public</span> <a href="Component.html#method.init">init</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + <div class="description"> + Initialise le composant avant son affichage. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.finalize"></a><span class="access">public</span> <a href="Component.html#method.finalize">finalize</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + <div class="description"> + Finalize l'affichage du composant. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getPosition"></a><span class="access">abstract public</span> <span class="TYPE">array</span> <a href="Component.html#method.getPosition">getPosition</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + <div class="description"> + Retourne la position de la zone de dessin effective du composant. + Les coordonnées doivent être retournées sous la forme d'un tableau de quatre valeurs. + Les première et deuxième valeurs sont les positions en abscisse et en ordonnée du coin haut-gauche de la zone de dessin. + Les troisième et quatrième valeurs sont les positions en abscisse et en ordonnée du coin bas-droit de la zone de dessin. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.drawEnvelope"></a><span class="access">abstract public</span> <a href="Component.html#method.drawEnvelope">drawEnvelope</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + <div class="description"> + Dessine l'enveloppe autour de la zone de dessin effective du composant. + Cette enveloppe comprend généralement les axes et la grille du composant. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.drawComponent"></a><span class="access">abstract public</span> <a href="Component.html#method.drawComponent">drawComponent</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <span class="TYPE">int</span> <span class="argument">$x1</span>, <span class="TYPE">int</span> <span class="argument">$y1</span>, <span class="TYPE">int</span> <span class="argument">$x2</span>, <span class="TYPE">int</span> <span class="argument">$y2</span>, <span class="TYPE">bool</span> <span class="argument">$aliasing</span>) + <div class="description"> + Dessine effectivement le composant, c'est-à -dire le graphique. + Le paramètre $aliasing est à TRUE si l'anti-aliasing est activé, FALSE sinon. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getSpace"></a><span class="access">protected</span> <a href="Component.html#method.getSpace">getSpace</a>(<span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + <div class="description"> + Convertit l'espace interne du composant de pourcentages en pixels, en fonction de la taille $width et de la hauteur $height, exprimées en pixels. + </div> +<div class="description-bottom"><a href="Component.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/ComponentGroup.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/ComponentGroup.html new file mode 100644 index 0000000000000000000000000000000000000000..3f4c5053d3eb37e5ad25012098313e2247c7c40f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/ComponentGroup.html @@ -0,0 +1,72 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> +<small>abstract</small> Class ComponentGroup</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul><li>ComponentGroup</li></ul> +</ul></div><div class="description"> + <p> + Un groupe de composant permet de gérer plusieurs <a href="Component.html">composants</a>. + Cette classe est abstraite et doit être redéfinit pour être utilisée avec les composants que vous aurez choisis. + </p> + </div><div class="inherit"> + Les classes suivantes dérivent de ComponentGroup : + <ul><li><a href="PlotGroup.html">PlotGroup</a></li></ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"><li> +<span class="access">protected</span> <span class="TYPE">array</span> <a href="ComponentGroup.html#property.components">$components</a> +</li></ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="ComponentGroup.html#method.__construct">__construct</a>() + </li> +<li> +<span class="access">public</span> <a href="ComponentGroup.html#method.add">add</a>(<a href="Component.html"><span class="TYPE">Component</span></a> <span class="argument">$component</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.components"></a><span class="access">protected</span> <span class="TYPE">array</span> <a href="ComponentGroup.html#property.components">$components</a><div class="description"> + Les <a href="Component.html">composants</a> gérés par ce groupe de composants. + </div> +<div class="description-bottom"><a href="ComponentGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="ComponentGroup.html#method.__construct">__construct</a>() + <div class="description"> + Construit le groupe de composants. + </div> +<div class="description-bottom"><a href="ComponentGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.add"></a><span class="access">public</span> <a href="ComponentGroup.html#method.add">add</a>(<a href="Component.html"><span class="TYPE">Component</span></a> <span class="argument">$component</span>) + <div class="description"> + Ajoute le composant $component au groupe. + </div> +<div class="description-bottom"><a href="ComponentGroup.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Drawer.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Drawer.html new file mode 100644 index 0000000000000000000000000000000000000000..819718e20135c8e4082b54e9927199eb581d0e36 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Drawer.html @@ -0,0 +1,339 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Drawer</h2><div class="description"> + <p> + La classe <a href="Drawer.html">Drawer</a> est une couche d'abstraction à GD et permet de dessiner toutes sortes de formes géométriques sur une <a href="Image.html">Image</a>. + </p> + <p> + Sur une image, l'axe des abscisses rejoint l'axe des ordonnées sur le coin haut-gauche. Le coin haut-gauche de l'image a donc pour coordonnées (0, 0) et le coin bas-droite (largeur, hauteur). Par exemple, sur une image de largeur 100 et de hauteur 50, un point à 50 sur l'axe des abscisses et 25 sur l'axe des ordonnées sera au centre de l'image. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <span class="TYPE">resource</span> <a href="Drawer.html#property.resource">$resource</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Drawer.html#property.width">$width</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Drawer.html#property.height">$height</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Drawer.html#method.__construct">__construct</a>(<span class="TYPE">resource</span> <span class="argument">$resource</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.setImageSize">setImageSize</a>(<span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.setPosition">setPosition</a>(<span class="TYPE">float</span> <span class="argument">$x</span>, <span class="TYPE">float</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.movePosition">movePosition</a>(<span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.setAbsPosition">setAbsPosition</a>(<span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.setSize">setSize</a>(<span class="TYPE">float</span> <span class="argument">$w</span>, <span class="TYPE">float</span> <span class="argument">$h</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.setAbsSize">setAbsSize</a>(<span class="TYPE">int</span> <span class="argument">$w</span>, <span class="TYPE">int</span> <span class="argument">$h</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">array</span> <a href="Drawer.html#method.getSize">getSize</a>() + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.copyImage">copyImage</a>(<a href="Image.html"><span class="TYPE">Image</span></a> <span class="argument">$image</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p2</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.copyResizeImage">copyResizeImage</a>(<a href="Image.html"><span class="TYPE">Image</span></a> <span class="argument">$image</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$d1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$d2</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$s1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$s2</span>, <span class="TYPE">bool</span> <span class="argument">$resampled</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.string">string</a>(<a href="Text.html"><span class="TYPE">Text</span></a> <span class="argument">$text</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$point</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.point">point</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$point</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.line">line</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Line.html"><span class="TYPE">Line</span></a> <span class="argument">$line</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.arc">arc</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>, <span class="TYPE">float</span> <span class="argument">$from</span>, <span class="TYPE">float</span> <span class="argument">$to</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.filledArc">filledArc</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>, <span class="TYPE">float</span> <span class="argument">$from</span>, <span class="TYPE">float</span> <span class="argument">$to</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.ellipse">ellipse</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.filledEllipse">filledEllipse</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.rectangle">rectangle</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p2</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.filledRectangle">filledRectangle</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p2</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.polygon">polygon</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Polygon.html"><span class="TYPE">Polygon</span></a> <span class="argument">$polygon</span>) + </li> +<li> +<span class="access">public</span> <a href="Drawer.html#method.filledPolygon">filledPolygon</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>, <a href="Polygon.html"><span class="TYPE">Polygon</span></a> <span class="argument">$polygon</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.resource"></a><span class="access">public</span> <span class="TYPE">resource</span> <a href="Drawer.html#property.resource">$resource</a><div class="description"> + La ressource GD utilisée par le dessinateur. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.width"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Drawer.html#property.width">$width</a><div class="description"> + La largeur de l'image gérée par le dessinateur. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.height"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Drawer.html#property.height">$height</a><div class="description"> + La hauteur de l'image gérée par le dessinateur. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Drawer.html#method.__construct">__construct</a>(<span class="TYPE">resource</span> <span class="argument">$resource</span>) + <div class="description"> + Construit le dessinateur avec la ressource GD $resource. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setImageSize"></a><span class="access">public</span> <a href="Drawer.html#method.setImageSize">setImageSize</a>(<span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + <div class="description"> + Change la taille de l'image gérée par le dessinateur pour la largeur $width et la hauteur $height. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setPosition"></a><span class="access">public</span> <a href="Drawer.html#method.setPosition">setPosition</a>(<span class="TYPE">float</span> <span class="argument">$x</span>, <span class="TYPE">float</span> <span class="argument">$y</span>) + <div class="description"> + Informe le dessinateur de la position de la sous-image sur l'image. + Les positions X et Y sont données via les paramètres $x et $y, qui représentent une fraction de la taille de l'image. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.movePosition"></a><span class="access">public</span> <a href="Drawer.html#method.movePosition">movePosition</a>(<span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + <div class="description"> + Demande au dessinateur de déplacer la position de la sous-image sur l'image. + $x et $y représentent respectivement les déplacements latéral et vertical de la position en pixels. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAbsPosition"></a><span class="access">public</span> <a href="Drawer.html#method.setAbsPosition">setAbsPosition</a>(<span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + <div class="description"> + Informe le dessinateur de la position de la sous-image sur l'image. + Les positions X et Y sont données via les paramètres $x et $y, dont l'unité est le pixel. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSize"></a><span class="access">public</span> <a href="Drawer.html#method.setSize">setSize</a>(<span class="TYPE">float</span> <span class="argument">$w</span>, <span class="TYPE">float</span> <span class="argument">$h</span>) + <div class="description"> + Informe le dessinateur de la taille de la sous-image sur l'image. + Les largeur et hauteur de la sous-image sont données via les paramètres $w et $h, qui représentent une fraction de la taille de l'image. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAbsSize"></a><span class="access">public</span> <a href="Drawer.html#method.setAbsSize">setAbsSize</a>(<span class="TYPE">int</span> <span class="argument">$w</span>, <span class="TYPE">int</span> <span class="argument">$h</span>) + <div class="description"> + Informe le dessinateur de la taille de la sous-image sur l'image. + Les largeur et hauteur de la sous-image sont données via les paramètres $w et $h, dont l'unité est le pixel. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getSize"></a><span class="access">public</span> <span class="TYPE">array</span> <a href="Drawer.html#method.getSize">getSize</a>() + <div class="description"> + Retourne la taille de la sous-image en pixels. + Les valeurs sont retournées sous la forme d'un tableau, de la forme array(largeur, hauteur). + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.copyImage"></a><span class="access">public</span> <a href="Drawer.html#method.copyImage">copyImage</a>(<a href="Image.html"><span class="TYPE">Image</span></a> <span class="argument">$image</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p2</span>) + <div class="description"> + Copie l'image $image vers la sous-image courante. + L'image sera copiée sur la sous-image du point $p1 (coin haut-gauche) ou point $p2 (coin bas-droit). + Les coordonnées de $p1 et $p2 doivent être relatives à celles de la sous-image. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.copyResizeImage"></a><span class="access">public</span> <a href="Drawer.html#method.copyResizeImage">copyResizeImage</a>(<a href="Image.html"><span class="TYPE">Image</span></a> <span class="argument">$image</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$d1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$d2</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$s1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$s2</span>, <span class="TYPE">bool</span> <span class="argument">$resampled</span>) + <div class="description"> + Copie l'image $image vers l'image courante. + L'image $image sera copiée des points $s1 (coin haut-gauche) et $s2 (coin bas-droit) vers les points $d1 (coin haut-gauche) et $d2 (coin bas-droit) de l'image courante. + Si $resampled est placé à TRUE, l'image sera rééchantillonée. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.string"></a><span class="access">public</span> <a href="Drawer.html#method.string">string</a>(<a href="Text.html"><span class="TYPE">Text</span></a> <span class="argument">$text</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$point</span>) + <div class="description"> + Dessine la chaîne de caractères $text à partir du point $point. + Les coordonnées de $point doivent être relatives à celles de la sous-image. + <div class="see"> + Voir aussi : + <ul> +<li><a href="Drawer.html#method.getTextHeight">Drawer::getTextHeight()</a></li> +<li><a href="Drawer.html#method.getTextWidth">Drawer::getTextWidth()</a></li> +</ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.point"></a><span class="access">public</span> <a href="Drawer.html#method.point">point</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$point</span>) + <div class="description"> + Dessine un pixel de couleur $color au point $point. + Les coordonnées de $point doivent être relatives à celles de la sous-image. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.line"></a><span class="access">public</span> <a href="Drawer.html#method.line">line</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Line.html"><span class="TYPE">Line</span></a> <span class="argument">$line</span>) + <div class="description"> + Dessine la ligne $line de couleur $color. + Les coordonnées de la ligne doivent être relatives à celles de la sous-image. + </div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.arc"></a><span class="access">public</span> <a href="Drawer.html#method.arc">arc</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>, <span class="TYPE">float</span> <span class="argument">$from</span>, <span class="TYPE">float</span> <span class="argument">$to</span>) + <div class="description"> + Dessine un arc d'ellipse de couleur $color dont les deux extrémités sont reliées au centre de l'ellipse. + L'ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. + L'angle de départ pour l'arc est $from et l'angle d'arrivée $to. + <div class="see"> + Voir aussi : + <ul><li><a href="Drawer.html#method.filledArc">Drawer::filledArc()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.filledArc"></a><span class="access">public</span> <a href="Drawer.html#method.filledArc">filledArc</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>, <span class="TYPE">float</span> <span class="argument">$from</span>, <span class="TYPE">float</span> <span class="argument">$to</span>) + <div class="description"> + Dessine un arc d'ellipse dont les deux extrémités sont reliées au centre de l'ellipse et le remplit avec la couleur ou le dégradé $background. + L'ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. + L'angle de départ pour l'arc est $from et l'angle d'arrivée $to. + <div class="see"> + Voir aussi : + <ul><li><a href="Drawer.html#method.arc">Drawer::arc()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.ellipse"></a><span class="access">public</span> <a href="Drawer.html#method.ellipse">ellipse</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + <div class="description"> + Dessine une ellipse de couleur $color, ayant pour centre $center et de largeur et hauteur respectives $width et $height. + Les coordonnées de l'ellipse doivent être relatives à celles de la sous-image. + <div class="see"> + Voir aussi : + <ul><li><a href="Drawer.html#method.filledEllipse">Drawer::filledEllipse()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.filledEllipse"></a><span class="access">public</span> <a href="Drawer.html#method.filledEllipse">filledEllipse</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$center</span>, <span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + <div class="description"> + Dessine et remplit une ellipse avec la couleur ou le dégradé $background. Cette ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. + Les coordonnées de l'ellipse doivent être relatives à celles de la sous-image. + <div class="see"> + Voir aussi : + <ul><li><a href="Drawer.html#method.ellipse">Drawer::ellipse()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.rectangle"></a><span class="access">public</span> <a href="Drawer.html#method.rectangle">rectangle</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p2</span>) + <div class="description"> + Dessine un rectangle de couleur $color des points $p1 à $p2 (le segment qui relie ces points représente la diagonale du rectangle). + Les coordonnées du rectangle doivent être relatives à celles de la sous-image. + <div class="see"> + Voir aussi : + <ul><li><a href="Drawer.html#method.filledRectangle">Drawer::filledRectangle()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.filledRectangle"></a><span class="access">public</span> <a href="Drawer.html#method.filledRectangle">filledRectangle</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p2</span>) + <div class="description"> + Dessine et remplit un rectangle avec la couleur ou le dégradé $background des points $p1 à $p2 (le segment qui relie ces points représente la diagonale du rectangle). + Les coordonnées du rectangle doivent être relatives à celles de la sous-image. + <div class="see"> + Voir aussi : + <ul><li><a href="Drawer.html#method.rectangle">Drawer::rectangle()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.polygon"></a><span class="access">public</span> <a href="Drawer.html#method.polygon">polygon</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>, <a href="Polygon.html"><span class="TYPE">Polygon</span></a> <span class="argument">$polygon</span>) + <div class="description"> + Dessine le polygone $polygon de couleur $color. + Les coordonnées de chaque point du polygone doivent être relatives à celles de la sous-image. + <div class="see"> + Voir aussi : + <ul><li><a href="Drawer.html#method.filledPolygon">Drawer::filledPolygon()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.filledPolygon"></a><span class="access">public</span> <a href="Drawer.html#method.filledPolygon">filledPolygon</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>, <a href="Polygon.html"><span class="TYPE">Polygon</span></a> <span class="argument">$polygon</span>) + <div class="description"> + Dessine et remplit le polygone $polygon avec la couleur ou le dégradé $background. + Les coordonnées de chaque point du polygone doivent être relatives à celles de la sous-image. + <div class="see"> + Voir aussi : + <ul><li><a href="Drawer.html#method.polygon">Drawer::polygon()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Drawer.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/FileImage.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/FileImage.html new file mode 100644 index 0000000000000000000000000000000000000000..ce21af988ceef4d2661b4f00d3912b8347269d91 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/FileImage.html @@ -0,0 +1,45 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class FileImage</h2><div class="extends"><ul> +<li><a href="Image.html">Image</a></li> +<ul><li>FileImage</li></ul> +</ul></div><div class="description"> + <p> + La classe <a href="FileImage.html">FileImage</a> permet de charger une image existante à partir d'un fichier. L'image ainsi créée peut être utilisée avec un <a href="Drawer.html">Drawer</a> pour être copiée sur une autre image par exemple. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="methods"><li> +<span class="access">public</span> <a href="FileImage.html#method.__construct">__construct</a>(<span class="TYPE">string</span> <span class="argument">$file</span>) + </li></ul><h2>Documentation</h2><ul class="doc"><li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="FileImage.html#method.__construct">__construct</a>(<span class="TYPE">string</span> <span class="argument">$file</span>) + <div class="description"> + Construit l'image à partir de l'image contenue dans le fichier $file. + </div> +<div class="description-bottom"><a href="FileImage.html#top">Remonter</a></div> +</li></ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Font.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Font.html new file mode 100644 index 0000000000000000000000000000000000000000..9fd4d64ca0be59c3017e1b1f54813647918afaa8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Font.html @@ -0,0 +1,133 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Font</h2><div class="description"> + <p> + La classe <a href="Font.html">Font</a> permet de manipuler des polices de manière uniforme sur Artichow. + </p> + </div><div class="inherit"> + Les classes suivantes dérivent de Font : + <ul><li><a href="TTFFont.html">TTFFont</a></li></ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_1">FONT_1</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_2">FONT_2</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_3">FONT_3</a> := <span class="default">3</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_4">FONT_4</a> := <span class="default">4</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_5">FONT_5</a> := <span class="default">5</span> +</li> +</ul><ul class="properties"><li> +<span class="access">public</span> <span class="TYPE">mixed</span> <a href="Font.html#property.font">$font</a> +</li></ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Font.html#method.__construct">__construct</a>(<a href="Font.html"><span class="TYPE">Font</span></a> <span class="argument">$font</span>) + </li> +<li> +<span class="access">public</span> <a href="Font.html#method.draw">draw</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p</span>, <a href="Text.html"><span class="TYPE">Text</span></a> <span class="argument">$text</span>) + </li> +<li> +<span class="access">public</span> <a href="Font.html#method.getTextWidth">getTextWidth</a>(<a href="Text.html"><span class="TYPE">Text</span></a> <span class="argument">$text</span>) + </li> +<li> +<span class="access">public</span> <a href="Font.html#method.getTextHeight">getTextHeight</a>(<a href="Text.html"><span class="TYPE">Text</span></a> <span class="argument">$text</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.FONT_1"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_1">FONT_1</a> := <span class="default">1</span><div class="description">Décrit la police 1 fournie avec PHP.</div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.FONT_2"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_2">FONT_2</a> := <span class="default">2</span><div class="description">Décrit la police 2 fournie avec PHP.</div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.FONT_3"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_3">FONT_3</a> := <span class="default">3</span><div class="description">Décrit la police 3 fournie avec PHP.</div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.FONT_4"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_4">FONT_4</a> := <span class="default">4</span><div class="description">Décrit la police 4 fournie avec PHP.</div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.FONT_5"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Font.html#constant.FONT_5">FONT_5</a> := <span class="default">5</span><div class="description">Décrit la police 5 fournie avec PHP.</div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.font"></a><span class="access">public</span> <span class="TYPE">mixed</span> <a href="Font.html#property.font">$font</a><div class="description"> + La police courante. + </div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Font.html#method.__construct">__construct</a>(<a href="Font.html"><span class="TYPE">Font</span></a> <span class="argument">$font</span>) + <div class="description"> + Construit la police $font. + Si vous souhaitez utiliser une police fournie avec PHP, $font peut contenir <a href="Font.html#constant.FONT_1">Font::FONT_1</a>, <a href="Font.html#constant.FONT_2">Font::FONT_2</a>, <a href="Font.html#constant.FONT_3">Font::FONT_3</a>, <a href="Font.html#constant.FONT_4">Font::FONT_4</a> et <a href="Font.html#constant.FONT_5">Font::FONT_5</a>. + </div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="Font.html#method.draw">draw</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$p</span>, <a href="Text.html"><span class="TYPE">Text</span></a> <span class="argument">$text</span>) + <div class="description"> + Dessine avec la police courante le texte $text. + Le dessinateur $drawer sera utilisé pour le dessin tandis que le texte sera positionné au point $p. + </div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getTextWidth"></a><span class="access">public</span> <a href="Font.html#method.getTextWidth">getTextWidth</a>(<a href="Text.html"><span class="TYPE">Text</span></a> <span class="argument">$text</span>) + <div class="description"> + Retourne la largeur en pixels occupée par l'objet <a href="Text.html">Text</a> $text. + <div class="see"> + Voir aussi : + <ul><li><a href="Font.html#method.getTextHeight">Font::getTextHeight()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getTextHeight"></a><span class="access">public</span> <a href="Font.html#method.getTextHeight">getTextHeight</a>(<a href="Text.html"><span class="TYPE">Text</span></a> <span class="argument">$text</span>) + <div class="description"> + Retourne la hauteur en pixels occupée par l'objet <a href="Text.html">Text</a> $text. + <div class="see"> + Voir aussi : + <ul><li><a href="Font.html#method.getTextWidth">Font::getTextWidth()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Font.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Gradient.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Gradient.html new file mode 100644 index 0000000000000000000000000000000000000000..8d806d09137f51abab73bb1fe3744b2ce2d41f55 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Gradient.html @@ -0,0 +1,82 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> +<small>abstract</small> Class Gradient</h2><div class="description"> + <p> + Toutes les classes qui décrivent un dégradé dérivent de cette classe abstraite. + </p> + </div><div class="inherit"> + Les classes suivantes dérivent de Gradient : + <ul> +<li><a href="LinearGradient.html">LinearGradient</a></li> +<li><a href="RadialGradient.html">RadialGradient</a></li> +</ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Gradient.html#property.from">$from</a> +</li> +<li> +<span class="access">public</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Gradient.html#property.to">$to</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Gradient.html#method.__construct">__construct</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$from</span>, <a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$to</span>) + </li> +<li> +<span class="access">public</span> <a href="Gradient.html#method.free">free</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.from"></a><span class="access">public</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Gradient.html#property.from">$from</a><div class="description"> + La couleur de départ pour le dégradé + </div> +<div class="description-bottom"><a href="Gradient.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.to"></a><span class="access">public</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Gradient.html#property.to">$to</a><div class="description"> + La couleur d'arrivée pour le dégradé + </div> +<div class="description-bottom"><a href="Gradient.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Gradient.html#method.__construct">__construct</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$from</span>, <a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$to</span>) + <div class="description"> + Construit une nouveu dégradé. Cette méthode doit être appelée par toutes les classes qui dérivent de celle-ci. Le paramètre $from décrit la couleur de départ du dégradé et le paramètre $to celle de fin. + </div> +<div class="description-bottom"><a href="Gradient.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.free"></a><span class="access">public</span> <a href="Gradient.html#method.free">free</a>() + <div class="description"> + Libère les ressources allouées lors de la création du dégradé. + </div> +<div class="description-bottom"><a href="Gradient.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Graph.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Graph.html new file mode 100644 index 0000000000000000000000000000000000000000..fe4d3042306cb35049cae353b067e0ef96273f04 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Graph.html @@ -0,0 +1,173 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Graph</h2><div class="extends"><ul> +<li><a href="Image.html">Image</a></li> +<ul><li>Graph</li></ul> +</ul></div><div class="description"> + <p> + La classe <a href="Graph.html">Graph</a> permet de générer des graphiques, de les mettre éventuellement en cache et d'afficher le temps de génération de l'image. Il est possible de dessiner plusieurs <a href="Component.html">composants</a> sur une <a href="Image.html">image</a> de type <a href="Graph.html">Graph</a>. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">protected</span> <span class="TYPE">string</span> <a href="Graph.html#property.name">$name</a> := <span class="default">NULL</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">int</span> <a href="Graph.html#property.timeout">$timeout</a> := <span class="default">0</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Graph.html#property.timing">$timing</a> := <span class="default">FALSE</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">array</span> <a href="Graph.html#property.labels">$labels</a> +</li> +<li> +<span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="Graph.html#property.title">$title</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Graph.html#method.__construct">__construct</a>(<span class="TYPE">int</span> <span class="argument">$width</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$height</span> = <span class="default">NULL</span>, <span class="TYPE">string</span> <span class="argument">$name</span> = <span class="default">NULL</span>, <span class="TYPE">string</span> <span class="argument">$timeout</span> = <span class="default">0</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">bool</span> <a href="Graph.html#method.deleteFromCache">deleteFromCache</a>(<span class="TYPE">string</span> <span class="argument">$name</span>) + </li> +<li> +<span class="access">public</span> <a href="Graph.html#method.deleteAllCache">deleteAllCache</a>() + </li> +<li> +<span class="access">public</span> <a href="Graph.html#method.setTiming">setTiming</a>(<span class="TYPE">bool</span> <span class="argument">$timing</span>) + </li> +<li> +<span class="access">public</span> <a href="Graph.html#method.add">add</a>(<a href="Component.html"><span class="TYPE">Component</span></a> <span class="argument">$component</span>) + </li> +<li> +<span class="access">public</span> <a href="Graph.html#method.addLabel">addLabel</a>(<a href="Label.html"><span class="TYPE">Label</span></a> <span class="argument">$label</span>, <span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Graph.html#method.addAbsLabel">addAbsLabel</a>(<a href="Label.html"><span class="TYPE">Label</span></a> <span class="argument">$label</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$point</span>) + </li> +<li> +<span class="access">public</span> <a href="Graph.html#method.draw">draw</a>(<span class="TYPE">string</span> <span class="argument">$file</span> = <span class="default">NULL</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.name"></a><span class="access">protected</span> <span class="TYPE">string</span> <a href="Graph.html#property.name">$name</a> := <span class="default">NULL</span><div class="description"> + Nom du graphique. + Peut être laissé à NULL pour ne donner aucun nom au graphique. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.timeout"></a><span class="access">protected</span> <span class="TYPE">int</span> <a href="Graph.html#property.timeout">$timeout</a> := <span class="default">0</span><div class="description"> + Peut prendre comme valeur 0 pour ne pas utiliser la mise en cache, ou spécifier un timestamp comme date d'expiration de l'image dans le cache. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.timing"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Graph.html#property.timing">$timing</a> := <span class="default">FALSE</span><div class="description"> + Activer l'affichage du temps de génération de l'image ? + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.labels"></a><span class="access">protected</span> <span class="TYPE">array</span> <a href="Graph.html#property.labels">$labels</a><div class="description"> + Une liste de <a href="Label.html">Label</a> qui seront affichés sur le graphique. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.title"></a><span class="access">public</span> <a href="Label.html"><span class="TYPE">Label</span></a> <a href="Graph.html#property.title">$title</a><div class="description"> + Permet de donner un titre au graphique. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Graph.html#method.__construct">__construct</a>(<span class="TYPE">int</span> <span class="argument">$width</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$height</span> = <span class="default">NULL</span>, <span class="TYPE">string</span> <span class="argument">$name</span> = <span class="default">NULL</span>, <span class="TYPE">string</span> <span class="argument">$timeout</span> = <span class="default">0</span>) + <div class="description"> + Construit une image de largeur $width et de hauteur $height au nom $name (ce nom peut être laissé à NULL) et qui expirera dans le cache au timestamp $timeout. Si vous ne souhaitez pas utiliser le cache, vous pouvez laisser ce timestamp à 0. + $name ne représente pas le titre du graphique, c'est uniquement un moyen d'identification pour le cache. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.deleteFromCache"></a><span class="access">public</span> <span class="TYPE">bool</span> <a href="Graph.html#method.deleteFromCache">deleteFromCache</a>(<span class="TYPE">string</span> <span class="argument">$name</span>) + <div class="description"> + Supprime manuellement l'image au nom $name du cache. + Cette méthode retourne TRUE si une image a été effectivement supprimée, FALSE sinon. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.deleteAllCache"></a><span class="access">public</span> <a href="Graph.html#method.deleteAllCache">deleteAllCache</a>() + <div class="description"> + Supprime toutes les images mises en cache par Artichow. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setTiming"></a><span class="access">public</span> <a href="Graph.html#method.setTiming">setTiming</a>(<span class="TYPE">bool</span> <span class="argument">$timing</span>) + <div class="description"> + Active/désactive l'affichage du temps de génération de l'image sur l'image elle-même. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.add"></a><span class="access">public</span> <a href="Graph.html#method.add">add</a>(<a href="Component.html"><span class="TYPE">Component</span></a> <span class="argument">$component</span>) + <div class="description"> + Ajoute un <a href="Component.html">composant</a> à dessiner sur l'image. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.addLabel"></a><span class="access">public</span> <a href="Graph.html#method.addLabel">addLabel</a>(<a href="Label.html"><span class="TYPE">Label</span></a> <span class="argument">$label</span>, <span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + <div class="description"> + Ajoute une étiquette $label aux positions $x et $y. + Les nouvelles positions $x et $y représentent une fraction des largeur et hauteur du graphique. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.addAbsLabel"></a><span class="access">public</span> <a href="Graph.html#method.addAbsLabel">addAbsLabel</a>(<a href="Label.html"><span class="TYPE">Label</span></a> <span class="argument">$label</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$point</span>) + <div class="description"> + Ajoute une étiquette $label en position absolue sur le graphique aux coordonnées X et Y spécifiées par le point $point. + Le point (0, 0) se situe sur le coin haut-gauche du graphique. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="Graph.html#method.draw">draw</a>(<span class="TYPE">string</span> <span class="argument">$file</span> = <span class="default">NULL</span>) + <div class="description"> + Créé et affiche l'image à l'utilisateur. Tous les composants précédemment ajoutés avec <a href="Graph.html#method.add">add()</a> sont dessinés sur l'image. + Cette méthode appelle successivement <a href="Image.html#method.create">create()</a>, <a href="Image.html#method.drawComponent">drawComponent()</a> autant de fois que de composants ont été ajoutés et <a href="Image.html#method.send">send()</a>. + Si vous souhaitez enregistrer l'image dans un fichier plutôt qu'à l'écran, indiquez un nom de fichier destination pour le paramètre $file. + Ce paramètre est optionnel, et si il n'est pas rempli, alors l'image sera affichée à l'écran. + </div> +<div class="description-bottom"><a href="Graph.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Grid.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Grid.html new file mode 100644 index 0000000000000000000000000000000000000000..9fd0a8f45858d22b1a6192c25644823a163e2058 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Grid.html @@ -0,0 +1,157 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Grid</h2><div class="description"> + <p> + La classe <a href="Grid.html">Grid</a> permet de manipuler des grilles de fond sur les <a href="Plot.html">Plot</a> ou <a href="PlotGroup.html">groupes de Plot</a>. + Une grille facilite la lecture des données pour l'utilisateur. + Un exemple de grille est montré ci-dessous. + </p> + <div class="image"> + <img src="image/grid.png"> + </div> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="methods"> +<li> +<span class="access">public</span> <a href="Grid.html#method.__construct">__construct</a>() + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.hideHorizontal">hideHorizontal</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.hideVertical">hideVertical</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.setColor">setColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.setType">setType</a>(<span class="TYPE">int</span> <span class="argument">$type</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.setInterval">setInterval</a>(<span class="TYPE">int</span> <span class="argument">$hInterval</span>, <span class="TYPE">int</span> <span class="argument">$vInterval</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.setSpace">setSpace</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>, <span class="TYPE">int</span> <span class="argument">$top</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.setGrid">setGrid</a>(<span class="TYPE">array</span> <span class="argument">$xgrid</span>, <span class="TYPE">array</span> <span class="argument">$ygrid</span>) + </li> +<li> +<span class="access">public</span> <a href="Grid.html#method.draw">draw</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <span class="TYPE">int</span> <span class="argument">$x1</span>, <span class="TYPE">int</span> <span class="argument">$y1</span>, <span class="TYPE">int</span> <span class="argument">$x2</span>, <span class="TYPE">int</span> <span class="argument">$y2</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Grid.html#method.__construct">__construct</a>() + <div class="description"> + Construit et initialise une grille. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Grid.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + <div class="description"> + Cache ou affiche la grille sur le composant. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideHorizontal"></a><span class="access">public</span> <a href="Grid.html#method.hideHorizontal">hideHorizontal</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + <div class="description"> + Cache ou affiche les lignes horizontales de la grille sur le composant. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideVertical"></a><span class="access">public</span> <a href="Grid.html#method.hideVertical">hideVertical</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + <div class="description"> + Cache ou affiche les lignes verticales de la grille sur le composant. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="Grid.html#method.setColor">setColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de la grille pour la couleur $color. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundColor"></a><span class="access">public</span> <a href="Grid.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de fond de la grille pour la couleur $color. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setType"></a><span class="access">public</span> <a href="Grid.html#method.setType">setType</a>(<span class="TYPE">int</span> <span class="argument">$type</span>) + <div class="description"> + Change le type de ligne à utiliser sur la grille. $type peut être <a href="Line.html#constant.SOLID">Line::SOLID</a> pour une ligne continue, <a href="Line.html#constant.DOTTED">Line::DOTTED</a> pour une ligne pointillée ou encore <a href="Line.html#constant.DASHED">Line::DASHED</a>. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setInterval"></a><span class="access">public</span> <a href="Grid.html#method.setInterval">setInterval</a>(<span class="TYPE">int</span> <span class="argument">$hInterval</span>, <span class="TYPE">int</span> <span class="argument">$vInterval</span>) + <div class="description"> + Change l'interval d'affichage des lignes horizontales de la grille avec $hInterval et verticales avec $vInterval. + Par défaut, cet interval est à 1 et toutes les lignes sont affichées. + Si vous choisissez un interval de 2 par exemple, une ligne sur deux sera affichée sur la grille. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSpace"></a><span class="access">public</span> <a href="Grid.html#method.setSpace">setSpace</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>, <span class="TYPE">int</span> <span class="argument">$top</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span>) + <div class="description"> + Change l'espace interne de la grille. + Les valeurs $left, $right, $top et $bottom représentent respectivement les nouvelles valeurs pour l'espace gauche, droit, haut et bas de la grille. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setGrid"></a><span class="access">public</span> <a href="Grid.html#method.setGrid">setGrid</a>(<span class="TYPE">array</span> <span class="argument">$xgrid</span>, <span class="TYPE">array</span> <span class="argument">$ygrid</span>) + <div class="description"> + Précise la position sur la grille des lignes horizontales avec $ygrid et verticales avec $xgrid. + Ces deux paramètres sont des tableaux qui contiennent des entiers entre 0 et 1. Chaque valeur représente la position d'une ligne comme une fraction de la taille de la grille. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="Grid.html#method.draw">draw</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <span class="TYPE">int</span> <span class="argument">$x1</span>, <span class="TYPE">int</span> <span class="argument">$y1</span>, <span class="TYPE">int</span> <span class="argument">$x2</span>, <span class="TYPE">int</span> <span class="argument">$y2</span>) + <div class="description"> + Dessine la grille avec le dessinateur $drawer. + La grille sera dessinée dans un rectangle dont la diagonale est le segment qui relie les points ($x1, $y1) et ($x2, $y2). + Les lignes dessinées auront été préalablement précisées avec <a href="Grid.html#method.setGrid">setGrid()</a>. + </div> +<div class="description-bottom"><a href="Grid.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Image.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Image.html new file mode 100644 index 0000000000000000000000000000000000000000..c4118b08e36930879b691e9ed1300897d02f9a49 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Image.html @@ -0,0 +1,251 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> +<small>abstract</small> Class Image</h2><div class="description"> + <p> + La classe <a href="Image.html">Image</a> est une classe abstraite à la base de toutes les images sur Artichow. Une image peut être copiée sur d'autres images et chaque image peut être générée soit au format PNG, soit au format JPEG. + </p> + </div><div class="inherit"> + Les classes suivantes dérivent de Image : + <ul> +<li><a href="Graph.html">Graph</a></li> +<li><a href="FileImage.html">FileImage</a></li> +</ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Image.html#constant.JPEG">JPEG</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Image.html#constant.PNG">PNG</a> := <span class="default">2</span> +</li> +</ul><ul class="properties"> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Image.html#property.width">$width</a> +</li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Image.html#property.height">$height</a> +</li> +<li> +<span class="access">public</span> <a href="Shadow.html"><span class="TYPE">Shadow</span></a> <a href="Image.html#property.shadow">$shadow</a> +</li> +<li> +<span class="access">public</span> <a href="Border.html"><span class="TYPE">Border</span></a> <a href="Image.html#property.border">$border</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">int</span> <a href="Image.html#property.format">$format</a> := <span class="default">Image::PNG</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Image.html#property.antiAliasing">$antiAliasing</a> := <span class="default">FALSE</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">resource</span> <a href="Image.html#property.resource">$resource</a> +</li> +<li> +<span class="access">protected</span> <a href="Drawer.html"><span class="TYPE">Drawer</span></a> <a href="Image.html#property.drawer">$drawer</a> +</li> +<li> +<span class="access">protected</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Image.html#property.background">$background</a> := <span class="default">new Color(255, 255, 255)</span> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Image.html#method.__construct">__construct</a>() + </li> +<li> +<span class="access">public</span> <a href="Drawer.html"><span class="TYPE">Drawer</span></a> <a href="Image.html#method.getDrawer">getDrawer</a>(<span class="TYPE">int</span> <span class="argument">$w</span> = <span class="default">1</span>, <span class="TYPE">int</span> <span class="argument">$h</span> = <span class="default">1</span>, <span class="TYPE">int</span> <span class="argument">$x</span> = <span class="default">0.5</span>, <span class="TYPE">int</span> <span class="argument">$y</span> = <span class="default">0.5</span>) + </li> +<li> +<span class="access">public</span> <a href="Image.html#method.setSize">setSize</a>(<span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + </li> +<li> +<span class="access">public</span> <a href="Image.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Image.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + </li> +<li> +<span class="access">public</span> <a href="Image.html#method.setAntiAliasing">setAntiAliasing</a>(<span class="TYPE">bool</span> <span class="argument">$bool</span>) + </li> +<li> +<span class="access">public</span> <a href="Image.html#method.setFormat">setFormat</a>(<span class="TYPE">int</span> <span class="argument">$format</span>) + </li> +<li> +<span class="access">public</span> <a href="Image.html#method.create">create</a>() + </li> +<li> +<span class="access">public</span> <a href="Image.html#method.drawComponent">drawComponent</a>(<a href="Component.html"><span class="TYPE">Component</span></a> <span class="argument">$component</span>) + </li> +<li> +<span class="access">public</span> <a href="Image.html#method.send">send</a>(<span class="TYPE">string</span> <span class="argument">$file</span> = <span class="default">NULL</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.JPEG"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Image.html#constant.JPEG">JPEG</a> := <span class="default">1</span><div class="description"> + Indique que l'image est au format JPEG. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.PNG"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Image.html#constant.PNG">PNG</a> := <span class="default">2</span><div class="description"> + Indique que l'image est au format PNG. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.width"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Image.html#property.width">$width</a><div class="description"> + La largeur de l'image en pixels. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.height"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Image.html#property.height">$height</a><div class="description"> + La hauteur de l'image en pixels. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.shadow"></a><span class="access">public</span> <a href="Shadow.html"><span class="TYPE">Shadow</span></a> <a href="Image.html#property.shadow">$shadow</a><div class="description"> + L'ombre associée à l'image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.border"></a><span class="access">public</span> <a href="Border.html"><span class="TYPE">Border</span></a> <a href="Image.html#property.border">$border</a><div class="description"> + La bordure associée à l'image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.format"></a><span class="access">protected</span> <span class="TYPE">int</span> <a href="Image.html#property.format">$format</a> := <span class="default">Image::PNG</span><div class="description"> + Le format de l'image. Cela peut être <a href="Image.html#constant.PNG">Image::PNG</a> ou <a href="Image.html#constant.JPEG">Image::JPEG</a>. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.antiAliasing"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Image.html#property.antiAliasing">$antiAliasing</a> := <span class="default">FALSE</span><div class="description"> + Doit-on utiliser l'anti aliasing sur cette image ? + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.resource"></a><span class="access">protected</span> <span class="TYPE">resource</span> <a href="Image.html#property.resource">$resource</a><div class="description"> + La ressource GD créée par PHP pour gérer l'image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.drawer"></a><span class="access">protected</span> <a href="Drawer.html"><span class="TYPE">Drawer</span></a> <a href="Image.html#property.drawer">$drawer</a><div class="description"> + Représente un objet de la classe <a href="Drawer.html">Drawer</a> qui sera utilisé pour dessiner toutes sortes de données sur cette image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.background"></a><span class="access">protected</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Image.html#property.background">$background</a> := <span class="default">new Color(255, 255, 255)</span><div class="description"> + La couleur de fond de l'image. Par défaut, le fond d'une image est blanc. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Image.html#method.__construct">__construct</a>() + <div class="description"> + Construit l'image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getDrawer"></a><span class="access">public</span> <a href="Drawer.html"><span class="TYPE">Drawer</span></a> <a href="Image.html#method.getDrawer">getDrawer</a>(<span class="TYPE">int</span> <span class="argument">$w</span> = <span class="default">1</span>, <span class="TYPE">int</span> <span class="argument">$h</span> = <span class="default">1</span>, <span class="TYPE">int</span> <span class="argument">$x</span> = <span class="default">0.5</span>, <span class="TYPE">int</span> <span class="argument">$y</span> = <span class="default">0.5</span>) + <div class="description"> + Retourne un objet de type <a href="Drawer.html">Drawer</a> qui permet de dessiner sur l'image. + Le <a href="Drawer.html">Drawer</a> aura une largeur $w et une hauteur $h, et son centre sera positionné au point ($x, $y). + La largeur doit être comprise entre 0 et 1 et représente une fraction de la taille réelle de l'image. + La position doit être elle aussi comprise entre 0 et 1. + Les paramètres par défaut centrent le dessinateur au milieu de l'image et lui donnent la taille de l'image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSize"></a><span class="access">public</span> <a href="Image.html#method.setSize">setSize</a>(<span class="TYPE">int</span> <span class="argument">$width</span>, <span class="TYPE">int</span> <span class="argument">$height</span>) + <div class="description"> + Permet de déterminer la taille de l'image à une largeur $width et une hauteur $height. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundColor"></a><span class="access">public</span> <a href="Image.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de fond de l'image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundGradient"></a><span class="access">public</span> <a href="Image.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + <div class="description"> + Change le dégradé de fond de l'image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAntiAliasing"></a><span class="access">public</span> <a href="Image.html#method.setAntiAliasing">setAntiAliasing</a>(<span class="TYPE">bool</span> <span class="argument">$bool</span>) + <div class="description"> + Active ou désactive l'anti-aliasing sur l'image. + L'anti-aliasing permet d'avoir des graphiques plus propres mais demande plus de ressources. + L'anti-aliasing n'est pas activé par défaut. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setFormat"></a><span class="access">public</span> <a href="Image.html#method.setFormat">setFormat</a>(<span class="TYPE">int</span> <span class="argument">$format</span>) + <div class="description"> + Change le format de l'image. La nouvelle valeur peut être <a href="Image.html#constant.PNG">Image::PNG</a> ou <a href="Image.html#constant.JPEG">Image::JPEG</a>. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.create"></a><span class="access">public</span> <a href="Image.html#method.create">create</a>() + <div class="description"> + Créé l'image en vue d'y ajouter des composants. + Il n'est possible de créer une image qu'après lui avoir affecté une taille avec <a href="Image.html#method.setSize">setSize()</a>. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.drawComponent"></a><span class="access">public</span> <a href="Image.html#method.drawComponent">drawComponent</a>(<a href="Component.html"><span class="TYPE">Component</span></a> <span class="argument">$component</span>) + <div class="description"> + Dessine le composant $component sur l'image. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.send"></a><span class="access">public</span> <a href="Image.html#method.send">send</a>(<span class="TYPE">string</span> <span class="argument">$file</span> = <span class="default">NULL</span>) + <div class="description"> + Construit l'image et l'envoie au navigateur de l'utilisateur, ou l'écrit dans le fichier $file si une valeur est spécifiée pour ce paramètre. + </div> +<div class="description-bottom"><a href="Image.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Label.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Label.html new file mode 100644 index 0000000000000000000000000000000000000000..21ee49efab0349aa2fa1d5228c69a8ee5dec3fcc --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Label.html @@ -0,0 +1,423 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Label</h2><div class="description"> + <p> + La classe <a href="Label.html">Label</a> permet de créer et d'afficher des étiquettes de texte sur des images. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Border.html"><span class="TYPE">Border</span></a> <a href="Label.html#property.border">$border</a> := <span class="default">new Border</span> +</li> +<li> +<span class="access">protected</span> <a href="Font.html"><span class="TYPE">Font</span></a> <a href="Label.html#property.font">$font</a> := <span class="default">new Font(Font::FONT_2)</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">int</span> <a href="Label.html#property.angle">$angle</a> := <span class="default">0</span> +</li> +<li> +<span class="access">protected</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Label.html#property.color">$color</a> := <span class="default">new Color(0, 0, 0)</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Label.html#property.hide">$hide</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Label.html#property.hideFirst">$hideFirst</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Label.html#property.hideLast">$hideLast</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">int</span> <a href="Label.html#property.interval">$interval</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">int</span> <a href="Label.html#property.hAlign">$hAlign</a> := <span class="default">Label::CENTER</span> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">int</span> <a href="Label.html#property.vAlign">$vAlign</a> := <span class="default">Label::MIDDLE</span> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Label.html#method.__construct">__construct</a>(<span class="TYPE">string</span> <span class="argument">$label</span> = <span class="default">NULL</span>, <a href="Font.html"><span class="TYPE">Font</span></a> <span class="argument">$font</span> = <span class="default">new Font(Text::FONT_2)</span>, <a href="color.html"><span class="TYPE">color</span></a> <span class="argument">$color</span> = <span class="default">new Color(0, 0, 0)</span>, <span class="TYPE">int</span> <span class="argument">$angle</span> = <span class="default">0</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">mixed</span> <a href="Label.html#method.get">get</a>(<span class="TYPE">int</span> <span class="argument">$key</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">mixed</span> <a href="Label.html#method.all">all</a>() + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.set">set</a>(<span class="TYPE">mixed</span> <span class="argument">$labels</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Label.html#method.count">count</a>() + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setCallbackFunction">setCallbackFunction</a>(<span class="TYPE">string</span> <span class="argument">$function</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">string</span> <a href="Label.html#method.getCallbackFunction">getCallbackFunction</a>() + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setFormat">setFormat</a>(<span class="TYPE">string</span> <span class="argument">$format</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setFont">setFont</a>(<a href="Font.html"><span class="TYPE">Font</span></a> <span class="argument">$font</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setAngle">setAngle</a>(<span class="TYPE">int</span> <span class="argument">$angle</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setColor">setColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setBackground">setBackground</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setPadding">setPadding</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>, <span class="TYPE">int</span> <span class="argument">$top</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.show">show</a>(<span class="TYPE">bool</span> <span class="argument">$show</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.hideKey">hideKey</a>(<span class="TYPE">int</span> <span class="argument">$key</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.hideFirst">hideFirst</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.hideLast">hideLast</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setInterval">setInterval</a>(<span class="TYPE">int</span> <span class="argument">$interval</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.move">move</a>(<span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.setAlign">setAlign</a>(<span class="TYPE">int</span> <span class="argument">$h</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$v</span> = <span class="default">NULL</span>) + </li> +<li> +<span class="access">public</span> <a href="Text.html"><span class="TYPE">Text</span></a> <a href="Label.html#method.getText">getText</a>(<span class="TYPE">int</span> <span class="argument">$key</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Label.html#method.getMaxWidth">getMaxWidth</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Label.html#method.getMaxHeight">getMaxHeight</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + </li> +<li> +<span class="access">public</span> <a href="Label.html#method.draw">draw</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$point</span>, <span class="TYPE">int</span> <span class="argument">$key</span> = <span class="default">0</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.border"></a><span class="access">public</span> <a href="Border.html"><span class="TYPE">Border</span></a> <a href="Label.html#property.border">$border</a> := <span class="default">new Border</span><div class="description"> + La bordure associée à l'étiquette. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.font"></a><span class="access">protected</span> <a href="Font.html"><span class="TYPE">Font</span></a> <a href="Label.html#property.font">$font</a> := <span class="default">new Font(Font::FONT_2)</span><div class="description"> + La police utilisée pour ce paragraphe. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.angle"></a><span class="access">protected</span> <span class="TYPE">int</span> <a href="Label.html#property.angle">$angle</a> := <span class="default">0</span><div class="description"> + L'angle du texte du paragraphe. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.color"></a><span class="access">protected</span> <a href="Color.html"><span class="TYPE">Color</span></a> <a href="Label.html#property.color">$color</a> := <span class="default">new Color(0, 0, 0)</span><div class="description"> + La couleur du texte du paragraphe. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.hide"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Label.html#property.hide">$hide</a><div class="description"> + Détermine si les étiquettes doivent être cachées. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.hideFirst"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Label.html#property.hideFirst">$hideFirst</a><div class="description"> + Détermine si la première étiquette doit être cachée. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.hideLast"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Label.html#property.hideLast">$hideLast</a><div class="description"> + Détermine si la dernière étiquette doit être cachée. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.interval"></a><span class="access">protected</span> <span class="TYPE">int</span> <a href="Label.html#property.interval">$interval</a><div class="description"> + L'interval d'affichage des étiquettes. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.hAlign"></a><span class="access">protected</span> <span class="TYPE">int</span> <a href="Label.html#property.hAlign">$hAlign</a> := <span class="default">Label::CENTER</span><div class="description"> + L'alignement horizontal des étiquettes. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.vAlign"></a><span class="access">protected</span> <span class="TYPE">int</span> <a href="Label.html#property.vAlign">$vAlign</a> := <span class="default">Label::MIDDLE</span><div class="description"> + L'alignement vertical des étiquettes. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Label.html#method.__construct">__construct</a>(<span class="TYPE">string</span> <span class="argument">$label</span> = <span class="default">NULL</span>, <a href="Font.html"><span class="TYPE">Font</span></a> <span class="argument">$font</span> = <span class="default">new Font(Text::FONT_2)</span>, <a href="color.html"><span class="TYPE">color</span></a> <span class="argument">$color</span> = <span class="default">new Color(0, 0, 0)</span>, <span class="TYPE">int</span> <span class="argument">$angle</span> = <span class="default">0</span>) + <div class="description"> + Construit un nouvel objet qui permettra l'affichage d'étiquettes sur une image. + $label est un chaîne de caractères qui représente la première étiquette (peut être laissée à NULL). + $font est la police à utiliser pour l'étiquette tandis que $color sera utilisé pour la couleur du texte. + Enfin, l'angle du texte prendra la valeur de $angle. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.get"></a><span class="access">public</span> <span class="TYPE">mixed</span> <a href="Label.html#method.get">get</a>(<span class="TYPE">int</span> <span class="argument">$key</span>) + <div class="description"> + Retourne la valeur de l'élément de l'étiquette dont la clé vaut $key. + Si la clé n'est associée à aucune valeur, alors cette méthode retourne NULL. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.all"></a><span class="access">public</span> <span class="TYPE">mixed</span> <a href="Label.html#method.all">all</a>() + <div class="description"> + Retourne toutes la valeur de toutes les étiquettes sous la forme d'un tableau. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.set"></a><span class="access">public</span> <a href="Label.html#method.set">set</a>(<span class="TYPE">mixed</span> <span class="argument">$labels</span>) + <div class="description"> + Change le texte des étiquettes à afficher sur l'image. + $labels peut être une chaîne de caractères si vous n'avez besoin que d'une étiquette, ou un tableau de chaînes de caractères si vous avez besoin de plusieurs étiquettes. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.count"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Label.html#method.count">count</a>() + <div class="description"> + Retourne le nombre de textes dans le paragraphe. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setCallbackFunction"></a><span class="access">public</span> <a href="Label.html#method.setCallbackFunction">setCallbackFunction</a>(<span class="TYPE">string</span> <span class="argument">$function</span>) + <div class="description"> + Change le nom de la fonction de callback qui sera appelé lors du dessin des textes du paragraphe. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getCallbackFunction"></a><span class="access">public</span> <span class="TYPE">string</span> <a href="Label.html#method.getCallbackFunction">getCallbackFunction</a>() + <div class="description"> + Retourne le nom de la fonction de callback actuellement utilisée. + Si aucune fonction de callback n'a été spécifiée, alors NULL sera retourné. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setFormat"></a><span class="access">public</span> <a href="Label.html#method.setFormat">setFormat</a>(<span class="TYPE">string</span> <span class="argument">$format</span>) + <div class="description"> + Formate le texte de chaque étiquette selon $format. + $format est du même format que les fonctions printf ou sprintf. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setFont"></a><span class="access">public</span> <a href="Label.html#method.setFont">setFont</a>(<a href="Font.html"><span class="TYPE">Font</span></a> <span class="argument">$font</span>) + <div class="description"> + Change la police utilisée pour le texte de l'étiquette. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAngle"></a><span class="access">public</span> <a href="Label.html#method.setAngle">setAngle</a>(<span class="TYPE">int</span> <span class="argument">$angle</span>) + <div class="description"> + Change l'angle du texte de l'étiquette. Les valeurs possibles sont 0 ou 90°. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="Label.html#method.setColor">setColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur du texte de l'étiquette. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackground"></a><span class="access">public</span> <a href="Label.html#method.setBackground">setBackground</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>) + <div class="description"> + Change le fond du texte de l'étiquette. + $background peut être soit une couleur, soit un dégradé; + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundColor"></a><span class="access">public</span> <a href="Label.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de fond du texte de l'étiquette. + <div class="see"> + Voir aussi : + <ul><li><a href="Label.html#method.setBackground">Label::setBackground()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundGradient"></a><span class="access">public</span> <a href="Label.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + <div class="description"> + Change le dégradé de fond du texte de l'étiquette. + <div class="see"> + Voir aussi : + <ul><li><a href="Label.html#method.setBackground">Label::setBackground()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setPadding"></a><span class="access">public</span> <a href="Label.html#method.setPadding">setPadding</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>, <span class="TYPE">int</span> <span class="argument">$top</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span>) + <div class="description"> + Change la valeur de l'espace qui entoure le texte par rapport à sa bordure. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Label.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span>) + <div class="description"> + Détermine si toutes les étiquettes doivent être cachées ou non. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.show"></a><span class="access">public</span> <a href="Label.html#method.show">show</a>(<span class="TYPE">bool</span> <span class="argument">$show</span>) + <div class="description"> + Détermine si toutes les étiquettes doivent être affichées ou non. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideKey"></a><span class="access">public</span> <a href="Label.html#method.hideKey">hideKey</a>(<span class="TYPE">int</span> <span class="argument">$key</span>) + <div class="description"> + Détermine si l'étiquette de clé $key doit être cachée ou non. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideFirst"></a><span class="access">public</span> <a href="Label.html#method.hideFirst">hideFirst</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span>) + <div class="description"> + Détermine si la première étiquette doit être cachée ou non. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideLast"></a><span class="access">public</span> <a href="Label.html#method.hideLast">hideLast</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span>) + <div class="description"> + Détermine si la dernière étiquette doit être cachée ou non. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setInterval"></a><span class="access">public</span> <a href="Label.html#method.setInterval">setInterval</a>(<span class="TYPE">int</span> <span class="argument">$interval</span>) + <div class="description"> + Change l'interval d'affichage des étiquettes. + L'interval est à 1 par défaut, ce qui signifie que toutes les étiquettes sont affichées. + Si cet interval est placé à 2 par exemple, alors la méthode <a href="Label.html#method.draw">draw()</a> n'affichera qu'une étiquette sur 2. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.move"></a><span class="access">public</span> <a href="Label.html#method.move">move</a>(<span class="TYPE">int</span> <span class="argument">$x</span>, <span class="TYPE">int</span> <span class="argument">$y</span>) + <div class="description"> + Déplace l'affichage de l'étiquette de $x pixels sur l'axe des abscisses et de $y pixels sur l'axe des ordonnées. + Les appels à <a href="Label.html#method.move">move()</a> sont cumulés, c'est-à -dire qu'un appel avec de nouvelles valeurs additionnera ces valeurs avec les anciennes. + Par défaut, $x et $y sont à 0. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAlign"></a><span class="access">public</span> <a href="Label.html#method.setAlign">setAlign</a>(<span class="TYPE">int</span> <span class="argument">$h</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$v</span> = <span class="default">NULL</span>) + <div class="description"> + Change l'alignement de l'étiquette par rapport au point où elle sera affichée. + $h correspond à l'alignement horizontal (<a href="Label.html#constant.LEFT">Positionable::LEFT</a>, <a href="Label.html#constant.RIGHT">Positionable::RIGHT</a> ou <a href="Label.html#constant.CENTER">Positionable::CENTER</a>) et $v à l'alignement vertical (<a href="Label.html#constant.TOP">Positionable::TOP</a>, <a href="Label.html#constant.BOTTOM">Positionable::BOTTOM</a> ou <a href="Label.html#constant.MIDDLE">Positionable::MIDDLE</a>). + Si vous ne souhaitez pas modifier une des deux valeurs, vous pouvez passer NULL. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getText"></a><span class="access">public</span> <a href="Text.html"><span class="TYPE">Text</span></a> <a href="Label.html#method.getText">getText</a>(<span class="TYPE">int</span> <span class="argument">$key</span>) + <div class="description"> + Retourne un objet de type <a href="Text.html">Text</a> qui correspond à la valeur du tableau de textes passé au constructeur ou à <a href="Label.html#method.set">Label::set()</a> pour la clé $key. + Cette object <a href="Text.html">Text</a> se verra attribué toutes les propriétés (couleur, police, angle, etc.) définies pour le paragraphe. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getMaxWidth"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Label.html#method.getMaxWidth">getMaxWidth</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + <div class="description"> + Essaie de déterminer la longueur maximale des étiquettes. Cette méthode a besoin d'un <a href="Drawer.html">Drawer</a> pour établir la taille de chaque texte. + La longueur maximale trouvée est déterminée et rétournée en pixels. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getMaxHeight"></a><span class="access">public</span> <span class="TYPE">int</span> <a href="Label.html#method.getMaxHeight">getMaxHeight</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + <div class="description"> + Essaie de déterminer la hauteur maximale des étiquettes. Cette méthode a besoin d'un <a href="Drawer.html">Drawer</a> pour établir la taille de chaque texte. + La hauteur maximale trouvée est déterminée et rétournée en pixels. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="Label.html#method.draw">draw</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="TYPE">Point</span></a> <span class="argument">$point</span>, <span class="TYPE">int</span> <span class="argument">$key</span> = <span class="default">0</span>) + <div class="description"> + Dessine l'étiquette identifiée par $key avec le dessinateur $drawer. L'étiquette sera placée au point $point décalé des valeurs successivement passées à <a href="Label.html#method.move">move()</a>, et alignée par rapport à ce point selon les valeurs passées à <a href="Label.html#method.setHorizontalAlignment">setHorizontalAlignment()</a> et <a href="Label.html#method.setVerticalAlignment">setVerticalAlignment()</a>. + L'étiquette ne sera pas affichée si sa clé $key n'est pas dans l'interval d'affichage donné avec <a href="Label.html#method.setInterval">setInterval()</a>. + </div> +<div class="description-bottom"><a href="Label.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Legend.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Legend.html new file mode 100644 index 0000000000000000000000000000000000000000..34389d35ae6d56ca2d8027078fbe4d38cd9196ce --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Legend.html @@ -0,0 +1,442 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Legend</h2><div class="description"> + <p> + La classe <a href="Legend.html">Legend</a> permet de manipuler des légendes. + Un objet de la classe <a href="Legend.html">Legend</a> est disponible sur tous les <a href="Component.html">composants</a>. + N'importe quel objet peut être légendé à condition qu'il implémente l'interface <a href="Legendable.html">Legendable</a>. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.LINE">LINE</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.BACKGROUND">BACKGROUND</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MARK">MARK</a> := <span class="default">3</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MARKONLY">MARKONLY</a> := <span class="default">4</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MODEL_RIGHT">MODEL_RIGHT</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MODEL_BOTTOM">MODEL_BOTTOM</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.LEFT">LEFT</a> := <span class="default">0</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.RIGHT">RIGHT</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.CENTER">CENTER</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.TOP">TOP</a> := <span class="default">3</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.BOTTOM">BOTTOM</a> := <span class="default">4</span> +</li> +<li> +<span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MIDDLE">MIDDLE</a> := <span class="default">5</span> +</li> +</ul><ul class="properties"> +<li> +<span class="access">public</span> <a href="Shadow.html"><span class="TYPE">Shadow</span></a> <a href="Legend.html#property.shadow">$shadow</a> +</li> +<li> +<span class="access">protected</span> <span class="TYPE">bool</span> <a href="Legend.html#property.hide">$hide</a> +</li> +<li> +<span class="access">protected</span> <a href="ArrayOject.html"><span class="TYPE">ArrayOject</span></a> <a href="Legend.html#property.legends">$legends</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Legend.html#method.__construct">__construct</a>(<span class="TYPE">int</span> <span class="argument">$model</span> = <span class="default">Legend::MODEL_RIGHT</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.show">show</a>(<span class="TYPE">bool</span> <span class="argument">$show</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setModel">setModel</a>(<span class="TYPE">int</span> <span class="argument">$model</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.add">add</a>(<a href="Legendable.html"><span class="TYPE">Legendable</span></a> <span class="argument">$legendable</span>, <span class="TYPE">string</span> <span class="argument">$title</span>, <span class="TYPE">int</span> <span class="argument">$type</span> = <span class="default">Legend::LINE</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setPadding">setPadding</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>, <span class="TYPE">int</span> <span class="argument">$top</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setSpace">setSpace</a>(<span class="TYPE">int</span> <span class="argument">$space</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setAlign">setAlign</a>(<span class="TYPE">int</span> <span class="argument">$h</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$v</span> = <span class="default">NULL</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setColumns">setColumns</a>(<span class="TYPE">int</span> <span class="argument">$columns</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setRows">setRows</a>(<span class="TYPE">int</span> <span class="argument">$rows</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setPosition">setPosition</a>(<span class="TYPE">float</span> <span class="argument">$x</span> = <span class="default">NULL</span>, <span class="TYPE">float</span> <span class="argument">$y</span> = <span class="default">NULL</span>) + </li> +<li> +<span class="access">public</span> <a href="Point.html"><span class="TYPE">Point</span></a> <a href="Legend.html#method.getPosition">getPosition</a>() + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setTextFont">setTextFont</a>(<a href="Font.html"><span class="TYPE">Font</span></a> <span class="argument">$font</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setTextMargin">setTextMargin</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setTextColor">setTextColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setBackground">setBackground</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setBorderSize">setBorderSize</a>(<span class="TYPE">int</span> <span class="argument">$size</span>) + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.setBorderColor">setBorderColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <span class="TYPE">int</span> <a href="Legend.html#method.count">count</a>() + </li> +<li> +<span class="access">public</span> <a href="Legend.html#method.draw">draw</a>(<a href="Drawer.html"><span class="TYPE">Drawer</span></a> <span class="argument">$drawer</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.LINE"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.LINE">LINE</a> := <span class="default">1</span><div class="description"> + Utilise une couleur de ligne pour identifier un objet dans la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.BACKGROUND"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.BACKGROUND">BACKGROUND</a> := <span class="default">2</span><div class="description"> + Utilise une couleur de fond pour identifier un objet dans la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.MARK"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MARK">MARK</a> := <span class="default">3</span><div class="description"> + Utilise un objet Mark et une ligne pour identifier un objet dans la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.MARKONLY"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MARKONLY">MARKONLY</a> := <span class="default">4</span><div class="description"> + Utilise un objet Mark seulement pour identifier un objet dans la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.MODEL_RIGHT"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MODEL_RIGHT">MODEL_RIGHT</a> := <span class="default">1</span><div class="description"> + Modèle prédéfini qui place la légende à droite. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.MODEL_BOTTOM"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MODEL_BOTTOM">MODEL_BOTTOM</a> := <span class="default">2</span><div class="description"> + Modèle prédéfini qui place la légende en bas. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.LEFT"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.LEFT">LEFT</a> := <span class="default">0</span><div class="description"> + Aligne horizontalement la légende à gauche. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.RIGHT"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.RIGHT">RIGHT</a> := <span class="default">1</span><div class="description"> + Aligne horizontalement la légende à droite. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.CENTER"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.CENTER">CENTER</a> := <span class="default">2</span><div class="description"> + Centre la légende horizontalement. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.TOP"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.TOP">TOP</a> := <span class="default">3</span><div class="description"> + Aligne verticalement la légende en haut. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.BOTTOM"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.BOTTOM">BOTTOM</a> := <span class="default">4</span><div class="description"> + Aligne verticalement la légende en bas. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.MIDDLE"></a><span class="access">const</span> <span class="TYPE">int</span> <a href="Legend.html#constant.MIDDLE">MIDDLE</a> := <span class="default">5</span><div class="description"> + Aligne verticalement la légende au milieu. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.shadow"></a><span class="access">public</span> <a href="Shadow.html"><span class="TYPE">Shadow</span></a> <a href="Legend.html#property.shadow">$shadow</a><div class="description"> + Cette propriété permet de manipuler l'ombre associée éventuellement avec la légende. + Par défaut, aucune ombre n'est affichée. Si vous souhaitez afficher une ombre, il vous suffit de lui donner une taille : +<pre> + +<?php + +require_once "Tools.class.php"; + +$legend = new <a href="Legend.html">Legend</a>(); + +// On associe une ombre de 4 pixels à la légende +$legend->shadow-><a href="Legend.html#method.setSize">setSize</a>(4); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.hide"></a><span class="access">protected</span> <span class="TYPE">bool</span> <a href="Legend.html#property.hide">$hide</a><div class="description"> + Détermine si la légende doit être cachée ou non. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.legends"></a><span class="access">protected</span> <a href="ArrayOject.html"><span class="TYPE">ArrayOject</span></a> <a href="Legend.html#property.legends">$legends</a><div class="description"> + Les objets <a href="Legendable.html">Legendable</a> à afficher sur la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Legend.html#method.__construct">__construct</a>(<span class="TYPE">int</span> <span class="argument">$model</span> = <span class="default">Legend::MODEL_RIGHT</span>) + <div class="description"> + Construit une nouvelle légende avec le modèle $model. + Les valeurs possibles pour $model sont <a href="Legend.html#constant.MODEL_BOTTOM">Legend::MODEL_BOTTOM</a> et <a href="Legend.html#constant.MODEL_RIGHT">Legend::MODEL_RIGHT</a>. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Legend.html#method.hide">hide</a>(<span class="TYPE">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + <div class="description"> + Permet de cacher (par défaut) ou d'afficher la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.show"></a><span class="access">public</span> <a href="Legend.html#method.show">show</a>(<span class="TYPE">bool</span> <span class="argument">$show</span> = <span class="default">TRUE</span>) + <div class="description"> + Permet d'afficher (par défaut) ou de cacher la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setModel"></a><span class="access">public</span> <a href="Legend.html#method.setModel">setModel</a>(<span class="TYPE">int</span> <span class="argument">$model</span>) + <div class="description"> + Change le modèle de légende pour $model. + L'appel à cette méthode peut écraser les valeurs passées à d'autres méthodes comme <a href="Legend.html#method.setPadding">setPadding()</a> ou <a href="Legend.html#method.setHorizontalAlign">setHorizontalAlign()</a> par exemple (liste non exhaustive). + Les valeurs possibles pour $model sont <a href="Legend.html#constant.MODEL_BOTTOM">Legend::MODEL_BOTTOM</a> et <a href="Legend.html#constant.MODEL_RIGHT">Legend::MODEL_RIGHT</a>. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.add"></a><span class="access">public</span> <a href="Legend.html#method.add">add</a>(<a href="Legendable.html"><span class="TYPE">Legendable</span></a> <span class="argument">$legendable</span>, <span class="TYPE">string</span> <span class="argument">$title</span>, <span class="TYPE">int</span> <span class="argument">$type</span> = <span class="default">Legend::LINE</span>) + <div class="description"> + Ajoute un nouvel objet <a href="Legendable.html">légendable</a> avec pour titre $title à cette légende. + $type permet de spécifier le type de légende, qui peut être <a href="Legend.html#constant.LINE">Legend::LINE</a>, <a href="Legend.html#constant.BACKGROUND">Legend::BACKGROUND</a>, <a href="Legend.html#constant.MARK">Legend::MARK</a> ou encore <a href="Legend.html#constant.MARKONLY">Legend::MARKONLY</a>. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setPadding"></a><span class="access">public</span> <a href="Legend.html#method.setPadding">setPadding</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>, <span class="TYPE">int</span> <span class="argument">$top</span>, <span class="TYPE">int</span> <span class="argument">$bottom</span>) + <div class="description"> + Change l'espace interne de la légende. + Les nouvelles valeurs doivent être données en pixels. + Laissez les paramètres dont vous ne souhaitez pas modifier la valeur à NULL. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSpace"></a><span class="access">public</span> <a href="Legend.html#method.setSpace">setSpace</a>(<span class="TYPE">int</span> <span class="argument">$space</span>) + <div class="description"> + Change l'espace entre chaque valeur. + Cet espace doit être donné en pixels. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAlign"></a><span class="access">public</span> <a href="Legend.html#method.setAlign">setAlign</a>(<span class="TYPE">int</span> <span class="argument">$h</span> = <span class="default">NULL</span>, <span class="TYPE">int</span> <span class="argument">$v</span> = <span class="default">NULL</span>) + <div class="description"> + Change l'alignement de la légende par rapport au point où elle sera affichée. + $h correspond à l'alignement horizontal (<a href="Legend.html#constant.LEFT">Legend::LEFT</a>, <a href="Legend.html#constant.RIGHT">Legend::RIGHT</a> ou <a href="Legend.html#constant.CENTER">Legend::CENTER</a>) et $v à l'alignement vertical (<a href="Legend.html#constant.TOP">Legend::TOP</a>, <a href="Legend.html#constant.BOTTOM">Legend::BOTTOM</a> ou <a href="Legend.html#constant.MIDDLE">Legend::MIDDLE</a>). + Si vous ne souhaitez pas modifier une des deux valeurs, vous pouvez passer NULL. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColumns"></a><span class="access">public</span> <a href="Legend.html#method.setColumns">setColumns</a>(<span class="TYPE">int</span> <span class="argument">$columns</span>) + <div class="description"> + Change le nombre de colonnes qui seront affichées dans la légende pour $columns. + Cette méthode est incompatible avec <a href="Legend.html#method.setRows">setRows()</a>. + <div class="see"> + Voir aussi : + <ul><li><a href="Legend.html#method.setColumns">Legend::setColumns()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setRows"></a><span class="access">public</span> <a href="Legend.html#method.setRows">setRows</a>(<span class="TYPE">int</span> <span class="argument">$rows</span>) + <div class="description"> + Change le nombre de lignes qui seront affichées dans la légende pour $rows. + Cette méthode est incompatible avec <a href="Legend.html#method.setColumns">setColumns()</a>. + <div class="see"> + Voir aussi : + <ul><li><a href="Legend.html#method.setRows">Legend::setRows()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setPosition"></a><span class="access">public</span> <a href="Legend.html#method.setPosition">setPosition</a>(<span class="TYPE">float</span> <span class="argument">$x</span> = <span class="default">NULL</span>, <span class="TYPE">float</span> <span class="argument">$y</span> = <span class="default">NULL</span>) + <div class="description"> + Change la position de la légende sur l'objet légendé. + Les positions $x et $y sont des fractions des largeur et hauteur de l'objet légendé. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getPosition"></a><span class="access">public</span> <a href="Point.html"><span class="TYPE">Point</span></a> <a href="Legend.html#method.getPosition">getPosition</a>() + <div class="description"> + Retourne la position courante de la légende sur l'objet légendé sous la forme d'un <a href="Point.html">point</a>. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setTextFont"></a><span class="access">public</span> <a href="Legend.html#method.setTextFont">setTextFont</a>(<a href="Font.html"><span class="TYPE">Font</span></a> <span class="argument">$font</span>) + <div class="description"> + Change la police à utiliser sur la légende. + Voir la classe <a href="Font.html">Font</a> pour une liste des polices disponibles. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setTextMargin"></a><span class="access">public</span> <a href="Legend.html#method.setTextMargin">setTextMargin</a>(<span class="TYPE">int</span> <span class="argument">$left</span>, <span class="TYPE">int</span> <span class="argument">$right</span>) + <div class="description"> + Change la marge gauche et droite autour du texte des légendes. + $left et $right sont à donner en pixels. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setTextColor"></a><span class="access">public</span> <a href="Legend.html#method.setTextColor">setTextColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur du texte de la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackground"></a><span class="access">public</span> <a href="Legend.html#method.setBackground">setBackground</a>(<span class="TYPE">mixed</span> <span class="argument">$background</span>) + <div class="description"> + Change le fond de la légende. + $background peut être soit une couleur, soit un dégradé. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundColor"></a><span class="access">public</span> <a href="Legend.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de fond de la légende. + <div class="see"> + Voir aussi : + <ul><li><a href="Legend.html#method.setBackground">Legend::setBackground()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundGradient"></a><span class="access">public</span> <a href="Legend.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="TYPE">Gradient</span></a> <span class="argument">$gradient</span>) + <div class="description"> + Change le dégradé de fond de la légende. + <div class="see"> + Voir aussi : + <ul><li><a href="Legend.html#method.setBackground">Legend::setBackground()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBorderSize"></a><span class="access">public</span> <a href="Legend.html#method.setBorderSize">setBorderSize</a>(<span class="TYPE">int</span> <span class="argument">$size</span>) + <div class="description"> + Change la taille de la bordure qui entoure la légende. + Les valeurs possibles sont 0 et 1. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBorderColor"></a><span class="access">public</span> <a href="Legend.html#method.setBorderColor">setBorderColor</a>(<a href="Color.html"><span class="TYPE">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de la bordure qui entoure la légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.count"></a><span class="access">public</span> <span class="type">int</span> <a href="Legend.html#method.count">count</a>() + <div class="description"> + Retourne le nombre d'objets <a href="Legendable.html">légendable</a> qui ont été ajoutés à cette légende. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="Legend.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>) + <div class="description"> + Dessine la légende avec le dessinateur $drawer. + </div> +<div class="description-bottom"><a href="Legend.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Legendable.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Legendable.html new file mode 100644 index 0000000000000000000000000000000000000000..320036c04f34ff2145a67bc4c0158cba61bdf8b5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Legendable.html @@ -0,0 +1,86 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Legendable</h2><div class="description"> + <p> + <a href="Legendable.html">Legendable</a> est une <span style="text-decoration: underline">interface</span> que doivent implémenter toutes les classes qui veulent profiter des possibilités offertes par la classe <a href="Legend.html">Legend</a>. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="methods"> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Legendable.html#method.getLegendLineStyle">getLegendLineStyle</a>() + </li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Legendable.html#method.getLegendLineThickness">getLegendLineThickness</a>() + </li> +<li> +<span class="access">public</span> <a href="Color.html"><span class="type">Color</span></a> <a href="Legendable.html#method.getLegendLineColor">getLegendLineColor</a>() + </li> +<li> +<span class="access">public</span> <span class="type">mixed</span> <a href="Legendable.html#method.getLegendBackground">getLegendBackground</a>() + </li> +<li> +<span class="access">public</span> <a href="Mark.html"><span class="type">Mark</span></a> <a href="Legendable.html#method.getLegendMark">getLegendMark</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="method"> +<a id="method.getLegendLineStyle"></a><span class="access">public</span> <span class="type">int</span> <a href="Legendable.html#method.getLegendLineStyle">getLegendLineStyle</a>() + <div class="description"> + Retourne le type de ligne utilisé (<a href="Line.html#constant.SOLID">Line::SOLID</a>, <a href="Line.html#constant.DOTTED">Line::DOTTED</a> ou <a href="Line.html#constant.DASHED">Line::DASHED</a>). + </div> +<div class="description-bottom"><a href="Legendable.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getLegendLineThickness"></a><span class="access">public</span> <span class="type">int</span> <a href="Legendable.html#method.getLegendLineThickness">getLegendLineThickness</a>() + <div class="description"> + Retourne une épaisseur de ligne pour la légende. + </div> +<div class="description-bottom"><a href="Legendable.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getLegendLineColor"></a><span class="access">public</span> <a href="Color.html"><span class="type">Color</span></a> <a href="Legendable.html#method.getLegendLineColor">getLegendLineColor</a>() + <div class="description"> + Retourne une couleur de ligne pour la légende. + </div> +<div class="description-bottom"><a href="Legendable.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getLegendBackground"></a><span class="access">public</span> <span class="type">mixed</span> <a href="Legendable.html#method.getLegendBackground">getLegendBackground</a>() + <div class="description"> + Retourne une couleur de fond pour la légende. + </div> +<div class="description-bottom"><a href="Legendable.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getLegendMark"></a><span class="access">public</span> <a href="Mark.html"><span class="type">Mark</span></a> <a href="Legendable.html#method.getLegendMark">getLegendMark</a>() + <div class="description"> + Retourne l'objet qui gère les marques affichées sur les éléments représentatifs de la classe qui implémente cette interface. + </div> +<div class="description-bottom"><a href="Legendable.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Line.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Line.html new file mode 100644 index 0000000000000000000000000000000000000000..7b46a33b32dbb5527d14f88b26d470c94825e6f2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Line.html @@ -0,0 +1,171 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Line</h2><div class="extends"><ul> +<li><a href="Shape.html">Shape</a></li> +<ul><li>Line</li></ul> +</ul></div><div class="description"> + <p> + La classe <a href="Line.html">Line</a> permet de manipuler des lignes de manière uniforme sur Artichow. Une ligne est composée de deux Point. + </p> + </div><div class="inherit"> + Les classes suivantes dérivent de Line : + <ul><li><a href="Vector.html">Vector</a></li></ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Line.html#property.p1">$p1</a> +</li> +<li> +<span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Line.html#property.p2">$p2</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Line.html#method.__construct">__construct</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>, <span class="type">int</span> <span class="argument">$style</span> = <span class="default">Line::SOLID</span>, <span class="type">int</span> <span class="argument">$thickness</span> = <span class="default">1</span>) + </li> +<li> +<span class="access">public static</span> <a href="Line.html#method.build">build</a>(<span class="type">int</span> <span class="argument">$x1</span>, <span class="type">int</span> <span class="argument">$y1</span>, <span class="type">int</span> <span class="argument">$x2</span>, <span class="type">int</span> <span class="argument">$y2</span>) + </li> +<li> +<span class="access">public</span> <a href="Line.html#method.setX">setX</a>(<span class="type">int</span> <span class="argument">$x1</span>, <span class="type">int</span> <span class="argument">$x2</span>) + </li> +<li> +<span class="access">public</span> <a href="Line.html#method.setY">setY</a>(<span class="type">int</span> <span class="argument">$y1</span>, <span class="type">int</span> <span class="argument">$y2</span>) + </li> +<li> +<span class="access">public</span> <a href="Line.html#method.setLocation">setLocation</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>) + </li> +<li> +<span class="access">public</span> <span class="type">array</span> <a href="Line.html#method.getLocation">getLocation</a>() + </li> +<li> +<span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getSize">getSize</a>() + </li> +<li> +<span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isPoint">isPoint</a>() + </li> +<li> +<span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isHorizontal">isHorizontal</a>() + </li> +<li> +<span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isVertical">isVertical</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.p1"></a><span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Line.html#property.p1">$p1</a><div class="description"> + Le premier point de la ligne. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.p2"></a><span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Line.html#property.p2">$p2</a><div class="description"> + Le second point de la ligne. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Line.html#method.__construct">__construct</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>, <span class="type">int</span> <span class="argument">$style</span> = <span class="default">Line::SOLID</span>, <span class="type">int</span> <span class="argument">$thickness</span> = <span class="default">1</span>) + <div class="description"> + Déclare une nouvelle ligne des points $p1 à $p2. La ligne est de style $style (<a href="Line.html#constant.SOLID">Line::SOLID</a> pour une ligne continue, <a href="Line.html#constant.DOTTED">Line::DOTTED</a> pour une ligne pointillée ou encore <a href="Line.html#constant.DASHED">Line::DASHED</a>) et d'épaisseur $thickness. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.build"></a><span class="access">public static</span> <a href="Line.html#method.build">build</a>(<span class="type">int</span> <span class="argument">$x1</span>, <span class="type">int</span> <span class="argument">$y1</span>, <span class="type">int</span> <span class="argument">$x2</span>, <span class="type">int</span> <span class="argument">$y2</span>) + <div class="description"> + Construit une ligne à partir des coordonnées ($x1, $y1) et ($x2, $y2) + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setX"></a><span class="access">public</span> <a href="Line.html#method.setX">setX</a>(<span class="type">int</span> <span class="argument">$x1</span>, <span class="type">int</span> <span class="argument">$x2</span>) + <div class="description"> + Change les coordonnées X des deux points de la ligne pour $x1 et $x2. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setY"></a><span class="access">public</span> <a href="Line.html#method.setY">setY</a>(<span class="type">int</span> <span class="argument">$y1</span>, <span class="type">int</span> <span class="argument">$y2</span>) + <div class="description"> + Change les coordonnées Y des deux points de la ligne pour $y1 et $y2. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLocation"></a><span class="access">public</span> <a href="Line.html#method.setLocation">setLocation</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>) + <div class="description"> + Change l'emplacement de la ligne pour les points $p1 et $p2 passés en paramètre. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getLocation"></a><span class="access">public</span> <span class="type">array</span> <a href="Line.html#method.getLocation">getLocation</a>() + <div class="description"> + Retourne la position de la ligne dans un tableau à deux valeurs. +<pre> + +<?php +$line = new Line(new Point(1, 2), new Point(3, 4)); +list($p1, $p2) = $line->getLocation(); +// $p1 == new Point(1, 2) +// $p2 == new Point(3, 4) +?> + +</pre> + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getSize"></a><span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getSize">getSize</a>() + <div class="description"> + Retourne la taille de la ligne en pixels. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.isPoint"></a><span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isPoint">isPoint</a>() + <div class="description"> + Retourne TRUE si la ligne peut être considérée comme un point, FALSE sinon. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.isHorizontal"></a><span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isHorizontal">isHorizontal</a>() + <div class="description"> + Retourne TRUE si la ligne est horizontale, FALSE sinon. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.isVertical"></a><span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isVertical">isVertical</a>() + <div class="description"> + Retourne TRUE si la ligne est verticale, FALSE sinon. + </div> +<div class="description-bottom"><a href="Line.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/LinePlot.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/LinePlot.html new file mode 100644 index 0000000000000000000000000000000000000000..792a0213aee5fe3f61674ca4aee07e60c00069ca --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/LinePlot.html @@ -0,0 +1,230 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class LinePlot</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul> +<li><a href="Plot.html">Plot</a></li> +<ul><li>LinePlot <span class="interface">implements</span> <a href="Legendable.html">Legendable</a> +</li></ul> +</ul> +</ul></div><div class="description"> + <p> + Cette classe permet de dessiner des courbes. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="LinePlot.html#constant.LINE">LINE</a> := <span class="default">0</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="LinePlot.html#constant.MIDDLE">MIDDLE</a> := <span class="default">1</span> +</li> +</ul><ul class="properties"> +<li> +<span class="access">public</span> <a href="Mark.html"><span class="type">Mark</span></a> <a href="LinePlot.html#property.mark">$mark</a> +</li> +<li> +<span class="access">public</span> <a href="Label.html"><span class="type">Label</span></a> <a href="LinePlot.html#property.label">$label</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="LinePlot.html#method.__construct">__construct</a>(<span class="type">array</span> <span class="argument">$values</span>, <span class="type">int</span> <span class="argument">$mode</span> = <span class="default">LinePlor::LINE</span>) + </li> +<li> +<span class="access">public</span> <a href="LinePlot.html#method.hideLine">hideLine</a>(<span class="type">bool</span> <span class="argument">$hide</span>) + </li> +<li> +<span class="access">public</span> <a href="LinePlot.html#method.setFilledArea">setFilledArea</a>(<span class="type">int</span> <span class="argument">$start</span>, <span class="type">int</span> <span class="argument">$stop</span>, <span class="type">mixed</span> <span class="argument">$background</span>) + </li> +<li> +<span class="access">public</span> <a href="LinePlot.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="LinePlot.html#method.setStyle">setStyle</a>(<span class="type">int</span> <span class="argument">$style</span>) + </li> +<li> +<span class="access">public</span> <a href="LinePlot.html#method.setThickness">setThickness</a>(<span class="type">int</span> <span class="argument">$thickness</span>) + </li> +<li> +<span class="access">public</span> <a href="LinePlot.html#method.setFillColor">setFillColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="LinePlot.html#method.setFillGradient">setFillGradient</a>(<a href="Gradient.html"><span class="type">Gradient</span></a> <span class="argument">$gradient</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.LINE"></a><span class="access">const</span> <span class="type">int</span> <a href="LinePlot.html#constant.LINE">LINE</a> := <span class="default">0</span><div class="description"> + Dessine une courbe. + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.MIDDLE"></a><span class="access">const</span> <span class="type">int</span> <a href="LinePlot.html#constant.MIDDLE">MIDDLE</a> := <span class="default">1</span><div class="description"> + Dessine une courbe dont les pics sont centrés sur l'axe des X (idéal pour cumuler courbe et histogramme). + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.mark"></a><span class="access">public</span> <a href="Mark.html"><span class="type">Mark</span></a> <a href="LinePlot.html#property.mark">$mark</a><div class="description"> + Représente les marques affichées sur chaque pointe de la courbe. + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.label"></a><span class="access">public</span> <a href="Label.html"><span class="type">Label</span></a> <a href="LinePlot.html#property.label">$label</a><div class="description"> + Représente les étiquettes affichées au-dessus de chaque pointe de la courbe. + Ces étiquettes contiennent la valeur de chaque pointe. + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="LinePlot.html#method.__construct">__construct</a>(<span class="type">array</span> <span class="argument">$values</span>, <span class="type">int</span> <span class="argument">$mode</span> = <span class="default">LinePlor::LINE</span>) + <div class="description"> + Créé une nouvelle courbe de type $mode avec les valeurs présentes dans $values. + Le tableau $values doit être une liste de valeurs dans un tableau incrémental, c'est-à -dire dont les clés valent de 0 à n - 1 (où n est la taille du tableau). +<pre> + +<?php + +require_once "LinePlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +// Tableau de valeurs +$x = array(1, 4, 3); + +$plot = new <a href="LinePlot.html">LinePlot</a>($x); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideLine"></a><span class="access">public</span> <a href="LinePlot.html#method.hideLine">hideLine</a>(<span class="type">bool</span> <span class="argument">$hide</span>) + <div class="description"> + Cache ou ne cache pas la ligne qui relie les valeurs de la courbe. + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setFilledArea"></a><span class="access">public</span> <a href="LinePlot.html#method.setFilledArea">setFilledArea</a>(<span class="type">int</span> <span class="argument">$start</span>, <span class="type">int</span> <span class="argument">$stop</span>, <span class="type">mixed</span> <span class="argument">$background</span>) + <div class="description"> + Permet de remplir une aire sous la courbe des points $start à $stop. + L'aire sera remplie avec la couleur ou le dégradé $background. + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="LinePlot.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de la ligne qui relie les valeurs de la courbe. + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setStyle"></a><span class="access">public</span> <a href="LinePlot.html#method.setStyle">setStyle</a>(<span class="type">int</span> <span class="argument">$style</span>) + <div class="description"> + Change le style de ligne (<a href="Line.html#constant.SOLID">Line::SOLID</a>, <a href="Line.html#constant.DOTTED">Line::DOTTED</a> ou <a href="Line.html#constant.DASHED">Line::DASHED</a>). + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setThickness"></a><span class="access">public</span> <a href="LinePlot.html#method.setThickness">setThickness</a>(<span class="type">int</span> <span class="argument">$thickness</span>) + <div class="description"> + Change l'épaisseur de la ligne. + L'épaisseur de la ligne doit être toujours positive. + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setFillColor"></a><span class="access">public</span> <a href="LinePlot.html#method.setFillColor">setFillColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de fond de la ligne qui relie les valeurs de la courbe. + La couleur de fond remplit le polygone définit par tous les points de la ligne additionés des points extrêmes de l'axe des abscisses. +<pre> + +<?php + +require_once "LinePlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +$x = array(1, 10, 3, -4, 1); + +$plot = new <a href="LinePlot.html">LinePlot</a>($x); +$plot-><a href="LinePlot.html#method.setFillColor">setFillColor</a>(new <a href="Color.html">Color</a>(255, 20, 20, 30)); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setFillGradient"></a><span class="access">public</span> <a href="LinePlot.html#method.setFillGradient">setFillGradient</a>(<a href="Gradient.html"><span class="type">Gradient</span></a> <span class="argument">$gradient</span>) + <div class="description"> + Change le dégradé de fond de la ligne qui relie les valeurs de la courbe. + Le dégradé de fond remplit le polygone définit par tous les points de la ligne additionés des points extrêmes de l'axe des abscisses. +<pre> + +<?php + +require_once "LinePlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +$x = array(1, 10, 3, -4, 1); + +$plot = new <a href="LinePlot.html">LinePlot</a>($x); +$plot-><a href="LinePlot.html#method.setFillGradient">setFillGradient</a>( + new <a href="LinearGradient.html">LinearGradient</a>( + new <a href="Color.html">Color</a>(255, 20, 20, 30), + new <a href="Color.html">Color</a>(20, 255, 20, 30), + 90 + ) +); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="LinePlot.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/LinearGradient.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/LinearGradient.html new file mode 100644 index 0000000000000000000000000000000000000000..02b221e5a0e02cfda37312670095f5dbe6a5cc32 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/LinearGradient.html @@ -0,0 +1,58 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class LinearGradient</h2><div class="extends"><ul> +<li><a href="Gradient.html">Gradient</a></li> +<ul><li>LinearGradient</li></ul> +</ul></div><div class="description"> + <p> + Cette classe permet de décrire un dégradé linéaire. + </p> + </div><div class="inherit"> + Les classes suivantes dérivent de LinearGradient : + <ul><li><a href="BilinearGradient.html">BilinearGradient</a></li></ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"><li> +<span class="access">public</span> <span class="type">int</span> <a href="LinearGradient.html#property.angle">$angle</a> +</li></ul><ul class="methods"><li> +<span class="access">public</span> <a href="LinearGradient.html#method.__construct">__construct</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$from</span>, <a href="Color.html"><span class="type">Color</span></a> <span class="argument">$to</span>, <span class="type">int</span> <span class="argument">$angle</span>) + </li></ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.angle"></a><span class="access">public</span> <span class="type">int</span> <a href="LinearGradient.html#property.angle">$angle</a><div class="description"> + Décrit l'angle du dégradé. Les valeurs possibles sont 0 et 90°. + </div> +<div class="description-bottom"><a href="LinearGradient.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="LinearGradient.html#method.__construct">__construct</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$from</span>, <a href="Color.html"><span class="type">Color</span></a> <span class="argument">$to</span>, <span class="type">int</span> <span class="argument">$angle</span>) + <div class="description"> + Construit une nouveu dégradé. Cette méthode doit être appelée par toutes les classes qui dérivent de celle-ci. Le paramètre $from décrit la couleur de départ du dégradé et le paramètre $to celle de fin. Le troisième paramètre $angle décrit l'angle du dégradé. Ce peut être un dégradé horizontal (angle de 0°) ou un dégradé vertical (angle de 90°). + </div> +<div class="description-bottom"><a href="LinearGradient.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Mark.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Mark.html new file mode 100644 index 0000000000000000000000000000000000000000..ead8ae9288cb9774c0a8a237ad822b455e9e2d1a --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Mark.html @@ -0,0 +1,220 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Mark</h2><div class="description"> + <p> + La classe <a href="Mark.html">Mark</a> permet de créer des marques, qui peuvent être affichées n'importe où sur une image. + Typiquement, les marques sont affichées sur les courbes pour mettre en valeur chaque point. + </p> + <div class="image"> + <img src="doc/image/marks.png"> + </div> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.CIRCLE">CIRCLE</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.SQUARE">SQUARE</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.IMAGE">IMAGE</a> := <span class="default">3</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.STAR">STAR</a> := <span class="default">4</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.PAPERCLIP">PAPERCLIP</a> := <span class="default">5</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.BOOK">BOOK</a> := <span class="default">6</span> +</li> +</ul><ul class="properties"> +<li> +<span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Mark.html#property.move">$move</a> +</li> +<li> +<span class="access">public</span> <a href="Border.html"><span class="type">Border</span></a> <a href="Mark.html#property.border">$border</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Mark.html#method.__construct">__construct</a>() + </li> +<li> +<span class="access">public</span> <a href="Mark.html#method.move">move</a>(<span class="type">int</span> <span class="argument">$x</span>, <span class="type">int</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Mark.html#method.hide">hide</a>(<span class="type">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Mark.html#method.show">show</a>(<span class="type">bool</span> <span class="argument">$show</span> = <span class="default">TRUE</span>) + </li> +<li> +<span class="access">public</span> <a href="Mark.html#method.setSize">setSize</a>(<span class="type">int</span> <span class="argument">$size</span>) + </li> +<li> +<span class="access">public</span> <a href="Mark.html#method.setType">setType</a>(<span class="type">int</span> <span class="argument">$type</span>, <span class="type">int</span> <span class="argument">$size</span> = <span class="default">NULL</span>) + </li> +<li> +<span class="access">public</span> <a href="Mark.html#method.setFill">setFill</a>(<span class="type">mixed</span> <span class="argument">$fill</span>) + </li> +<li> +<span class="access">public</span> <a href="Mark.html#method.setImage">setImage</a>(<a href="Image.html"><span class="type">Image</span></a> <span class="argument">$image</span>) + </li> +<li> +<span class="access">public</span> <a href="Mark.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$point</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.CIRCLE"></a><span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.CIRCLE">CIRCLE</a> := <span class="default">1</span><div class="description"> + Pour les marques de la forme d'un cercle. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.SQUARE"></a><span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.SQUARE">SQUARE</a> := <span class="default">2</span><div class="description"> + Pour les marques de la forme d'un carré. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.IMAGE"></a><span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.IMAGE">IMAGE</a> := <span class="default">3</span><div class="description"> + Pour les marques de type image. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.STAR"></a><span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.STAR">STAR</a> := <span class="default">4</span><div class="description"> + Représente une marque de type étoile. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.PAPERCLIP"></a><span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.PAPERCLIP">PAPERCLIP</a> := <span class="default">5</span><div class="description"> + Représente une marque de type trombonne. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.BOOK"></a><span class="access">const</span> <span class="type">int</span> <a href="Mark.html#constant.BOOK">BOOK</a> := <span class="default">6</span><div class="description"> + Représente une marque de type livre. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.move"></a><span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Mark.html#property.move">$move</a><div class="description"> + Le déplacement de la marque défini par l'utilisateur. + <div class="see"> + Voir aussi : + <ul><li><a href="Mark.html#method.move">Mark::move()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.border"></a><span class="access">public</span> <a href="Border.html"><span class="type">Border</span></a> <a href="Mark.html#property.border">$border</a><div class="description"> + La bordure qui entoure la marque. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Mark.html#method.__construct">__construct</a>() + <div class="description"> + Construit un nouvel objet qui permettra l'affichage de marques sur une image. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.move"></a><span class="access">public</span> <a href="Mark.html#method.move">move</a>(<span class="type">int</span> <span class="argument">$x</span>, <span class="type">int</span> <span class="argument">$y</span>) + <div class="description"> + Déplace l'affichage des marques de $x pixels sur l'axe des abscisses et de $y pixels sur l'axe des ordonnées. + Les appels à <a href="Mark.html#method.move">move()</a> sont cumulés, c'est-à -dire qu'un appel avec de nouvelles valeurs additionnera ces valeurs avec les anciennes. + Par défaut, $x et $y sont à 0 pixel. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Mark.html#method.hide">hide</a>(<span class="type">bool</span> <span class="argument">$hide</span> = <span class="default">TRUE</span>) + <div class="description"> + Permet de cacher (par défaut) ou d'afficher les marques. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.show"></a><span class="access">public</span> <a href="Mark.html#method.show">show</a>(<span class="type">bool</span> <span class="argument">$show</span> = <span class="default">TRUE</span>) + <div class="description"> + Permet d'afficher (par défaut) ou de cacher les marques. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSize"></a><span class="access">public</span> <a href="Mark.html#method.setSize">setSize</a>(<span class="type">int</span> <span class="argument">$size</span>) + <div class="description"> + Change la taille des marques pour $size. Cette méthode n'a aucun effet pour les marques de type <a href="Mark.html#constant.IMAGE"></a>, <a href="Mark.html#constant.STAR"></a>, <a href="Mark.html#constant.PAPERCLIP"></a> ou <a href="Mark.html#constant.BOOK"></a>. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setType"></a><span class="access">public</span> <a href="Mark.html#method.setType">setType</a>(<span class="type">int</span> <span class="argument">$type</span>, <span class="type">int</span> <span class="argument">$size</span> = <span class="default">NULL</span>) + <div class="description"> + Change le type de marque à utiliser. + Les valeurs possibles sont <a href="Mark.html#constant.CIRCLE"></a>, <a href="Mark.html#constant.SQUARE"></a>, <a href="Mark.html#constant.IMAGE"></a>, <a href="Mark.html#constant.STAR"></a>, <a href="Mark.html#constant.PAPERCLIP"></a> ou encore <a href="Mark.html#constant.BOOK"></a>. + L'argument optionnel $size permet de déterminer la taille de la marque et n'a aucun effet sur <a href="Mark.html#constant.IMAGE"></a>, <a href="Mark.html#constant.PAPERCLIP"></a> et <a href="Mark.html#constant.BOOK"></a>. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setFill"></a><span class="access">public</span> <a href="Mark.html#method.setFill">setFill</a>(<span class="type">mixed</span> <span class="argument">$fill</span>) + <div class="description"> + Remplit la marque avec la couleur ou le dégradé $fill. Cette méthode n'a aucun effet pour les marques de type <a href="Mark.html#constant.IMAGE">Mark::IMAGE</a>. + <div class="see"> + Voir aussi : + <ul><li><a href="Mark.html#method.setType">Mark::setType()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setImage"></a><span class="access">public</span> <a href="Mark.html#method.setImage">setImage</a>(<a href="Image.html"><span class="type">Image</span></a> <span class="argument">$image</span>) + <div class="description"> + Change l'image à afficher sur la marque. Cette méthode n'a de sens que pour les marques de type <a href="Mark.html#constant.IMAGE">Mark::IMAGE</a>. + <div class="see"> + Voir aussi : + <ul><li><a href="Mark.html#method.setType">Mark::setType()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="Mark.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$point</span>) + <div class="description"> + Dessine la marque avec le dessinateur $drawer. Le centre de la marque sera sur le point $point. + </div> +<div class="description-bottom"><a href="Mark.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/MathFunction.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/MathFunction.html new file mode 100644 index 0000000000000000000000000000000000000000..3e6318a46804b1424ac3efeca57a8e5c63686b9a --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/MathFunction.html @@ -0,0 +1,87 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class MathFunction</h2><div class="description"> + <p> + Cette classe permet de représenter une fonction mathématique f(x) à afficher sur un graphique de type <a href="MathPlot.html">MathPlot</a>. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Line.html"><span class="type">Line</span></a> <a href="MathFunction.html#property.line">$line</a> +</li> +<li> +<span class="access">public</span> <a href="Mark.html"><span class="type">Mark</span></a> <a href="MathFunction.html#property.mark">$mark</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="MathFunction.html#method.__construct">__construct</a>(<span class="type">string</span> <span class="argument">$f</span>, <span class="type">float</span> <span class="argument">$fromX</span>, <span class="type">float</span> <span class="argument">$toX</span>) + </li> +<li> +<span class="access">public</span> <a href="MathFunction.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Color.html"><span class="type">Color</span></a> <a href="MathFunction.html#method.getColor">getColor</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.line"></a><span class="access">public</span> <a href="Line.html"><span class="type">Line</span></a> <a href="MathFunction.html#property.line">$line</a><div class="description"> + La ligne qui sera utilisée pour représenter la fonction. + </div> +<div class="description-bottom"><a href="MathFunction.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.mark"></a><span class="access">public</span> <a href="Mark.html"><span class="type">Mark</span></a> <a href="MathFunction.html#property.mark">$mark</a><div class="description"> + Les marques qui seront affichés sur chaque point calculé. + </div> +<div class="description-bottom"><a href="MathFunction.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="MathFunction.html#method.__construct">__construct</a>(<span class="type">string</span> <span class="argument">$f</span>, <span class="type">float</span> <span class="argument">$fromX</span>, <span class="type">float</span> <span class="argument">$toX</span>) + <div class="description"> + Créé un objet <a href="MathFunction.html">MathFunction</a> avec la fonction $f. + $f est une fonction qui prend un paramètre $x en paramètre et qui doit retourner une valeur $y. + Les valeurs $fromX et $toX représentent les valeurs de X à partir desquelles commencer et terminer le calcul de la courbe représentative de la fonction. + </div> +<div class="description-bottom"><a href="MathFunction.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="MathFunction.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de la courbe représentative de la fonction pour $color. + </div> +<div class="description-bottom"><a href="MathFunction.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getColor"></a><span class="access">public</span> <a href="Color.html"><span class="type">Color</span></a> <a href="MathFunction.html#method.getColor">getColor</a>() + <div class="description"> + Retourne la couleur de la courbe représentative de la fonction. + </div> +<div class="description-bottom"><a href="MathFunction.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/MathPlot.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/MathPlot.html new file mode 100644 index 0000000000000000000000000000000000000000..6a4b9f4b385d55e618022e8e180abff0c0e3cca5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/MathPlot.html @@ -0,0 +1,124 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class MathPlot</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul><li>MathPlot</li></ul> +</ul></div><div class="description"> + <p> + Cette classe permet de représenter simplement des fonctions f(x) sur un graphique. + L'archive de Artichow contient plusieurs exemples pour vous aider dans la conception de ces graphiques. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Grid.html"><span class="type">Grid</span></a> <a href="MathPlot.html#property.grid">$grid</a> +</li> +<li> +<span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="MathPlot.html#property.xAxis">$xAxis</a> +</li> +<li> +<span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="MathPlot.html#property.yAxis">$yAxis</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="MathPlot.html#method.__construct">__construct</a>(<span class="type">float</span> <span class="argument">$xMin</span>, <span class="type">float</span> <span class="argument">$xMax</span>, <span class="type">float</span> <span class="argument">$yMax</span>, <span class="type">float</span> <span class="argument">$yMin</span>) + </li> +<li> +<span class="access">public</span> <a href="MathPlot.html#method.setInterval">setInterval</a>(<span class="type">int</span> <span class="argument">$interval</span>) + </li> +<li> +<span class="access">public</span> <a href="MathPlot.html#method.add">add</a>(<a href="MathFunction.html"><span class="type">MathFunction</span></a> <span class="argument">$function</span>, <span class="type">string</span> <span class="argument">$name</span> = <span class="default">NULL</span>, <span class="type">int</span> <span class="argument">$type</span> = <span class="default">Legend::LINE</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.grid"></a><span class="access">public</span> <a href="Grid.html"><span class="type">Grid</span></a> <a href="MathPlot.html#property.grid">$grid</a><div class="description"> + Représente la grille de fond du graphique. + </div> +<div class="description-bottom"><a href="MathPlot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.xAxis"></a><span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="MathPlot.html#property.xAxis">$xAxis</a><div class="description"> + Représente l'axe des abscisses. + </div> +<div class="description-bottom"><a href="MathPlot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.yAxis"></a><span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="MathPlot.html#property.yAxis">$yAxis</a><div class="description"> + Représente l'axe des ordonnées. + </div> +<div class="description-bottom"><a href="MathPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="MathPlot.html#method.__construct">__construct</a>(<span class="type">float</span> <span class="argument">$xMin</span>, <span class="type">float</span> <span class="argument">$xMax</span>, <span class="type">float</span> <span class="argument">$yMax</span>, <span class="type">float</span> <span class="argument">$yMin</span>) + <div class="description"> + Construit le graphique. + L'axe des X va des valeurs $xMin à $xMax tandis que l'axe de Y va des valeurs $yMin à $yMax. +<pre> + +<?php + +require_once "MathPlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(300, 300); + + +$plot = new <a href="MathPlot.html">MathPlot</a>(-3, 3, 3, -3); +$plot-><a href="MathPlot.html#method.setInterval">setInterval</a>(0.1); + +// On dessine cos(x) +$function = new <a href="MathFunction.html">MathFunction</a>('cos'); +$plot-><a href="MathPlot.html#method.add">add</a>($function); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="MathPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setInterval"></a><span class="access">public</span> <a href="MathPlot.html#method.setInterval">setInterval</a>(<span class="type">int</span> <span class="argument">$interval</span>) + <div class="description"> + Change l'interval sur lequel sont calculées les valeurs affichées sur le graphique. + Par défaut, cet interval est de 1, c'est-à -dire que Artichow calcule f(x) pour toutes les valeurs entières de x. + </div> +<div class="description-bottom"><a href="MathPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.add"></a><span class="access">public</span> <a href="MathPlot.html#method.add">add</a>(<a href="MathFunction.html"><span class="type">MathFunction</span></a> <span class="argument">$function</span>, <span class="type">string</span> <span class="argument">$name</span> = <span class="default">NULL</span>, <span class="type">int</span> <span class="argument">$type</span> = <span class="default">Legend::LINE</span>) + <div class="description"> + Ajoute une fonction mathématique au graphique. + Sur la légende, la fonction aura pour nom $name et le type de légende utilisé sera $type (<a href="Legend.html#constant.LINE">Legend::LINE</a>, <a href="Legend.html#constant.BACKGROUND">Legend::BACKGROUND</a> ou encore <a href="Legend.html#constant.MARK">Legend::MARK</a>). + Si vous ne souhaitez pas associer de légende à cette fonction, laissez l'argument $name à NULL. + </div> +<div class="description-bottom"><a href="MathPlot.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Pattern.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Pattern.html new file mode 100644 index 0000000000000000000000000000000000000000..65c5d0962c3558888418fd57941bcd8244d033ce --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Pattern.html @@ -0,0 +1,40 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Pattern</h2><div class="description"> + <p> + La classe <a href="Pattern.html">Pattern</a> simplifie la création de graphiques avec Artichow. + </p> + <p style="color: red; font-weight: bold"> + Cette partie de la documentation est encore en cours de réalisation. + Pour obtenir la liste des méthodes de cette classe, voyez le fichier Pattern.class.php. + Pour savoir comment utiliser cette classe, n'hésitez pas à aller jeter un coup d'oeil aux exemples (examples/pattern-*.php) + fournis avec l'archive de Artichow. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><h2>Documentation</h2><ul class="doc"></ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Pie.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Pie.html new file mode 100644 index 0000000000000000000000000000000000000000..08515626a3a33c24d31d3db9d435924529716138 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Pie.html @@ -0,0 +1,204 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Pie</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul><li>Pie</li></ul> +</ul></div><div class="description"> + <p> + La classe <a href="Pie.html">Pie</a> permet de générer des camemberts en deux ou trois dimensions. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Pie.html#constant.DARK">DARK</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Pie.html#constant.COLORED">COLORED</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Pie.html#constant.AQUA">AQUA</a> := <span class="default">3</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Pie.html#constant.EARTH">EARTH</a> := <span class="default">4</span> +</li> +</ul><ul class="properties"> +<li> +<span class="access">public</span> <a href="Border.html"><span class="type">Border</span></a> <a href="Pie.html#property.border">$border</a> +</li> +<li> +<span class="access">public</span> <span class="type">array</span> <a href="Pie.html#property.values">$values</a> +</li> +<li> +<span class="access">public</span> <span class="type">array</span> <a href="Pie.html#property.colors">$colors</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Pie.html#method.__construct">__construct</a>(<span class="type">array</span> <span class="argument">$values</span>, <span class="type">mixed</span> <span class="argument">$colors</span> = <span class="default">Pie::COLORED</span>) + </li> +<li> +<span class="access">public</span> <a href="Pie.html#method.setLegend">setLegend</a>(<span class="type">array</span> <span class="argument">$legend</span>) + </li> +<li> +<span class="access">public</span> <a href="Pie.html#method.set3D">set3D</a>(<span class="type">int</span> <span class="argument">$size</span>) + </li> +<li> +<span class="access">public</span> <a href="Pie.html#method.setStartAngle">setStartAngle</a>(<span class="type">int</span> <span class="argument">$angle</span>) + </li> +<li> +<span class="access">public</span> <a href="Pie.html#method.setLabelPrecision">setLabelPrecision</a>(<span class="type">int</span> <span class="argument">$precision</span>) + </li> +<li> +<span class="access">public</span> <a href="Pie.html#method.setLabelPosition">setLabelPosition</a>(<span class="type">int</span> <span class="argument">$position</span>) + </li> +<li> +<span class="access">public</span> <a href="Pie.html#method.setLabelNumber">setLabelNumber</a>(<span class="type">int</span> <span class="argument">$number</span>) + </li> +<li> +<span class="access">public</span> <a href="Pie.html#method.setLabelMinimum">setLabelMinimum</a>(<span class="type">int</span> <span class="argument">$minimum</span>) + </li> +<li> +<span class="access">public</span> <a href="Pie.html#method.explode">explode</a>(<span class="type">array</span> <span class="argument">$explode</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.DARK"></a><span class="access">const</span> <span class="type">int</span> <a href="Pie.html#constant.DARK">DARK</a> := <span class="default">1</span><div class="description"> + Un thème sombre pour les camemberts. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.COLORED"></a><span class="access">const</span> <span class="type">int</span> <a href="Pie.html#constant.COLORED">COLORED</a> := <span class="default">2</span><div class="description"> + Un thème coloré pour les camemberts (thème par défaut). + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.AQUA"></a><span class="access">const</span> <span class="type">int</span> <a href="Pie.html#constant.AQUA">AQUA</a> := <span class="default">3</span><div class="description"> + Un thème plutôt bleu pour les camemberts. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.EARTH"></a><span class="access">const</span> <span class="type">int</span> <a href="Pie.html#constant.EARTH">EARTH</a> := <span class="default">4</span><div class="description"> + Un thème aux couleurs de la Terre pour les camemberts. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.border"></a><span class="access">public</span> <a href="Border.html"><span class="type">Border</span></a> <a href="Pie.html#property.border">$border</a><div class="description"> + La bordure qui entoure chaque part du camembert. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.values"></a><span class="access">public</span> <span class="type">array</span> <a href="Pie.html#property.values">$values</a><div class="description"> + Les valeurs du camembert. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.colors"></a><span class="access">public</span> <span class="type">array</span> <a href="Pie.html#property.colors">$colors</a><div class="description"> + Les couleurs des parts du camembert. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Pie.html#method.__construct">__construct</a>(<span class="type">array</span> <span class="argument">$values</span>, <span class="type">mixed</span> <span class="argument">$colors</span> = <span class="default">Pie::COLORED</span>) + <div class="description"> + Construit un nouveau camembert avec comme valeurs $values. + Le paramètre $colors peut soit être un tableau de couleurs, soit un thème prédéfini (<a href="Pie.html#constant.DARK">Pie::DARK</a>, <a href="Pie.html#constant.COLORED">Pie::COLORED</a>, <a href="Pie.html#constant.AQUA">Pie::AQUA</a> ou <a href="Pie.html#constant.EARTH">Pie::EARTH</a>). + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLegend"></a><span class="access">public</span> <a href="Pie.html#method.setLegend">setLegend</a>(<span class="type">array</span> <span class="argument">$legend</span>) + <div class="description"> + Change les valeurs de la légende associée au camembert. + $legend est un tableau qui contient autant d'entrées que de valeurs présentes sur le camembert. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.set3D"></a><span class="access">public</span> <a href="Pie.html#method.set3D">set3D</a>(<span class="type">int</span> <span class="argument">$size</span>) + <div class="description"> + Associe au camembert à un effet 3D de taille $size (à spécifier en pixels). + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setStartAngle"></a><span class="access">public</span> <a href="Pie.html#method.setStartAngle">setStartAngle</a>(<span class="type">int</span> <span class="argument">$angle</span>) + <div class="description"> + Angle initial en degrés pour commencer le dessin du camembert. + La valeur par défaut est de 0°. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLabelPrecision"></a><span class="access">public</span> <a href="Pie.html#method.setLabelPrecision">setLabelPrecision</a>(<span class="type">int</span> <span class="argument">$precision</span>) + <div class="description"> + Change la précision des étiquettes associées à chaque part du camembert. + Par défaut à 0, cette précision donne le nombre de chiffres après la virgule à afficher. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLabelPosition"></a><span class="access">public</span> <a href="Pie.html#method.setLabelPosition">setLabelPosition</a>(<span class="type">int</span> <span class="argument">$position</span>) + <div class="description"> + Change la distance des étiquettes par rapport au camembert. + La valeur est à donner en pixels et vaut par défaut 15 pixels. + Elle peut également être négative. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLabelNumber"></a><span class="access">public</span> <a href="Pie.html#method.setLabelNumber">setLabelNumber</a>(<span class="type">int</span> <span class="argument">$number</span>) + <div class="description"> + Permet de choisir le nombre maximale d'étiquettes à afficher autour du camembert. + Par défaut, toutes les étiquettes sont affichées. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLabelMinimum"></a><span class="access">public</span> <a href="Pie.html#method.setLabelMinimum">setLabelMinimum</a>(<span class="type">int</span> <span class="argument">$minimum</span>) + <div class="description"> + Permet de choisir une valeur minimum pour l'affichage des étiquettes. + Tout part dont le pourcentage sera inférieur à $minimum n'aura aucune étiquette associée. + Par défaut, il n'y a aucun minimum. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.explode"></a><span class="access">public</span> <a href="Pie.html#method.explode">explode</a>(<span class="type">array</span> <span class="argument">$explode</span>) + <div class="description"> + Cette méthode permet de séparer une ou plusieurs parts du camembert. + Le paramètre $explode est un tableau dont les clés représente les numéros des parts à séparer et les valeurs la distance de séparation. + </div> +<div class="description-bottom"><a href="Pie.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Plot.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Plot.html new file mode 100644 index 0000000000000000000000000000000000000000..c595db2de83cc25026bc58641ff86fa08a18562e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Plot.html @@ -0,0 +1,269 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Plot</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul><li>Plot</li></ul> +</ul></div><div class="description"> + <p> + Cette classe est la base des <a href="LinePlot.html">courbes</a> et <a href="BarPlot.html">histogrammes</a> sur Artichow. + </p> + </div><div class="inherit"> + Les classes suivantes dérivent de Plot : + <ul> +<li><a href="LinePlot.html">LinePlot</a></li> +<li><a href="BarPlot.html">BarPlot</a></li> +</ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <span class="type">array</span> <a href="Plot.html#property.datay">$datay</a> +</li> +<li> +<span class="access">public</span> <span class="type">array</span> <a href="Plot.html#property.datax">$datax</a> +</li> +<li> +<span class="access">public</span> <a href="Grid.html"><span class="type">Grid</span></a> <a href="Plot.html#property.grid">$grid</a> +</li> +<li> +<span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="Plot.html#property.xAxis">$xAxis</a> +</li> +<li> +<span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="Plot.html#property.yAxis">$yAxis</a> +</li> +<li> +<span class="access">protected</span> <span class="type">bool</span> <a href="Plot.html#property.xAxisZero">$xAxisZero</a> := <span class="default">TRUE</span> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Plot.html#method.__construct">__construct</a>() + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.reduce">reduce</a>(<a href="number.html"><span class="type">number</span></a> <span class="argument">$number</span>) + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.setXAxis">setXAxis</a>(<span class="type">string</span> <span class="argument">$axis</span>) + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.setYAxis">setYAxis</a>(<span class="type">string</span> <span class="argument">$axis</span>) + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.setXAxisZero">setXAxisZero</a>(<span class="type">bool</span> <span class="argument">$zero</span>) + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.setYAxisZero">setYAxisZero</a>(<span class="type">bool</span> <span class="argument">$zero</span>) + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.setYMin">setYMin</a>(<span class="type">float</span> <span class="argument">$value</span>) + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.setYMax">setYMax</a>(<span class="type">float</span> <span class="argument">$value</span>) + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.setXMin">setXMin</a>(<span class="type">float</span> <span class="argument">$value</span>) + </li> +<li> +<span class="access">public</span> <a href="Plot.html#method.setXMax">setXMax</a>(<span class="type">float</span> <span class="argument">$value</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.datay"></a><span class="access">public</span> <span class="type">array</span> <a href="Plot.html#property.datay">$datay</a><div class="description"> + Les valeurs de l'axe des Y. + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.datax"></a><span class="access">public</span> <span class="type">array</span> <a href="Plot.html#property.datax">$datax</a><div class="description"> + Les valeurs de l'axe des X. + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.grid"></a><span class="access">public</span> <a href="Grid.html"><span class="type">Grid</span></a> <a href="Plot.html#property.grid">$grid</a><div class="description"> + Représente la grille de fond du composant. + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.xAxis"></a><span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="Plot.html#property.xAxis">$xAxis</a><div class="description"> + L'axe des abscisses + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.yAxis"></a><span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="Plot.html#property.yAxis">$yAxis</a><div class="description"> + L'axe des ordonnées + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.xAxisZero"></a><span class="access">protected</span> <span class="type">bool</span> <a href="Plot.html#property.xAxisZero">$xAxisZero</a> := <span class="default">TRUE</span><div class="description"> + Est-ce le ou les axes des abscisses doivent être centrés sur zéro ? + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Plot.html#method.__construct">__construct</a>() + <div class="description"> + Construit le composant. + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.reduce"></a><span class="access">public</span> <a href="Plot.html#method.reduce">reduce</a>(<a href="number.html"><span class="type">number</span></a> <span class="argument">$number</span>) + <div class="description"> + Réduit le nombre de valeurs à afficher sur le composant à $number.<br/> + Cette fonctionnalité est utile dans le cas où vous souhaitez afficher plus de 400 ou 500 valeurs sur un graphique. + En effet, au delà d'un certain nombre de valeurs, toutes ne seront pas affichées et le temps de création du graphique sera très élevé. + La solution est de réduire le nombre de valeurs sur votre graphique, ce que permet cette fonction. + Le processus de réduction se fait à travers un système de moyennes, afin de garder une courbe identique à celle que vous auriez eu en affichant toutes les valeurs. + Le nombre $number que vous spécifiez en paramètre est un nombre maximal. Pas plus de $number valeurs seront affichées sur le graphique. En revanche, dans certains cas, il est possible qu'un nombre inférieur de valeurs soient affichées. + Voici un exemple d'utilisation de cette fonctionnalité : +<pre> + +<?php + +require_once "LinePlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +$datay = array(); +$datax = array(); + +// On créé un tableau avec 3000 valeurs +for($i = 1; $i <= 3000; $i++) { + $datay[] = log($i); + $datax[] = $i; +} + +$plot = new <a href="LinePlot.html">LinePlot</a>($datay); +$plot->xAxis-><a href="Axis.html#method.setLabelText">setLabelText</a>($datax); +$plot->xAxis->label-><a href="Label.html#method.setAngle">setAngle</a>(90); + +// On réduit le nombre de valeurs à afficher sur le graphique à 30, +// soit 100 fois moins +$plot-><a href="Plot.html#method.reduce">reduce</a>(30); + +// On affiche le graphique +// Les valeurs de l'axe des X ont été automatiquement mises à jour +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +// Finalement, la courbe représentative de log(x) apparaît très correctement + +?> + +</pre> + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setXAxis"></a><span class="access">public</span> <a href="Plot.html#method.setXAxis">setXAxis</a>(<span class="type">string</span> <span class="argument">$axis</span>) + <div class="description"> + Change l'axe de abscisses qui sera affiché sur l'image. + Cela peut être <a href="Axis.html#constant.TOP">Axis::TOP</a>, <a href="Axis.html#constant.BOTTOM">Axis::BOTTOM</a> ou <a href="Axis.html#constant.BOTH">Axis::BOTH</a>. + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setYAxis"></a><span class="access">public</span> <a href="Plot.html#method.setYAxis">setYAxis</a>(<span class="type">string</span> <span class="argument">$axis</span>) + <div class="description"> + Change l'axe de ordonnées qui sera affiché sur l'image. + Cela peut être <a href="Axis.html#constant.LEFT">Axis::LEFT</a>, <a href="Axis.html#constant.RIGHT">Axis::RIGHT</a> ou <a href="Axis.html#constant.BOTH">Axis::BOTH</a>. + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setXAxisZero"></a><span class="access">public</span> <a href="Plot.html#method.setXAxisZero">setXAxisZero</a>(<span class="type">bool</span> <span class="argument">$zero</span>) + <div class="description"> + Précise si le ou les axes des abscisses doivent être centrés sur le zéro de l'axe des ordonnées. + Comme il peut y avoir plus axes des ordonnées, l'axe de gauche est choisi en premier pour sélectionner la valeur du zéro. S'il n'existe pas, alors on utilise l'axe de droite. + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setYAxisZero"></a><span class="access">public</span> <a href="Plot.html#method.setYAxisZero">setYAxisZero</a>(<span class="type">bool</span> <span class="argument">$zero</span>) + <div class="description"> + Précise si le ou les axes des ordonnées doivent être centrés sur le zéro de l'axe des abscisses. + Comme il peut y avoir plus axes des abscisses, l'axe du bas est choisi en premier pour sélectionner la valeur du zéro. S'il n'existe pas, alors on utilise l'axe du haut. + </div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setYMin"></a><span class="access">public</span> <a href="Plot.html#method.setYMin">setYMin</a>(<span class="type">float</span> <span class="argument">$value</span>) + <div class="description"> + Force la valeur minimale de l'axe des ordonnées à $value. + L'appel à cette méthode désactive la gestion automatique de l'axe des ordonnées. + <div class="see"> + Voir aussi : + <ul> +<li><a href="Plot.html#method.setYMax">Plot::setYMax()</a></li> +<li><a href="Axis.html#method.auto">Axis::auto()</a></li> +</ul> +</div> +</div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setYMax"></a><span class="access">public</span> <a href="Plot.html#method.setYMax">setYMax</a>(<span class="type">float</span> <span class="argument">$value</span>) + <div class="description"> + Force la valeur maximale de l'axe des ordonnées à $value. + L'appel à cette méthode désactive la gestion automatique de l'axe des ordonnées. + <div class="see"> + Voir aussi : + <ul> +<li><a href="Plot.html#method.setYMin">Plot::setYMin()</a></li> +<li><a href="Axis.html#method.auto">Axis::auto()</a></li> +</ul> +</div> +</div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setXMin"></a><span class="access">public</span> <a href="Plot.html#method.setXMin">setXMin</a>(<span class="type">float</span> <span class="argument">$value</span>) + <div class="description"> + Force la valeur minimale de l'axe des abscisses à $value. + <div class="see"> + Voir aussi : + <ul><li><a href="Plot.html#method.setXMax">Plot::setXMax()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setXMax"></a><span class="access">public</span> <a href="Plot.html#method.setXMax">setXMax</a>(<span class="type">float</span> <span class="argument">$value</span>) + <div class="description"> + Force la valeur maximale de l'axe des abscisses à $value. + <div class="see"> + Voir aussi : + <ul><li><a href="Plot.html#method.setXMin">Plot::setXMin()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Plot.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/PlotAxis.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/PlotAxis.html new file mode 100644 index 0000000000000000000000000000000000000000..3ce5d380627712e608abfd26170c41f3014d1a4e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/PlotAxis.html @@ -0,0 +1,79 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class PlotAxis</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul> +<li><a href="ComponentGroup.html">ComponentGroup</a></li> +<ul><li>PlotAxis</li></ul> +</ul> +</ul></div><div class="description"> + <p> + La classe <a href="PlotAxis.html">PlotAxis</a> permet d'utiliser des axes sur les <a href="PlotGroup.html">PlotGroup</a>. + Quatre axes sont disponibles (gauche, bas, droite et haut). + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="PlotAxis.html#property.left">$left</a> +</li> +<li> +<span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="PlotAxis.html#property.right">$right</a> +</li> +<li> +<span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="PlotAxis.html#property.top">$top</a> +</li> +<li> +<span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="PlotAxis.html#property.bottom">$bottom</a> +</li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.left"></a><span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="PlotAxis.html#property.left">$left</a><div class="description"> + L'axe de gauche + </div> +<div class="description-bottom"><a href="PlotAxis.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.right"></a><span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="PlotAxis.html#property.right">$right</a><div class="description"> + L'axe de droite + </div> +<div class="description-bottom"><a href="PlotAxis.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.top"></a><span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="PlotAxis.html#property.top">$top</a><div class="description"> + L'axe du haut + </div> +<div class="description-bottom"><a href="PlotAxis.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.bottom"></a><span class="access">public</span> <a href="Axis.html"><span class="type">Axis</span></a> <a href="PlotAxis.html#property.bottom">$bottom</a><div class="description"> + L'axe du bas + </div> +<div class="description-bottom"><a href="PlotAxis.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/PlotGroup.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/PlotGroup.html new file mode 100644 index 0000000000000000000000000000000000000000..3d1aa12616f381c47f14e9b86380466c6f23b4d8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/PlotGroup.html @@ -0,0 +1,156 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class PlotGroup</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul> +<li><a href="ComponentGroup.html">ComponentGroup</a></li> +<ul><li>PlotGroup</li></ul> +</ul> +</ul></div><div class="description"> + <p> + Cette classe permet de gérer plusieurs objets <a href="Plot.html">Plot</a> sur le même graphique. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Grid.html"><span class="type">Grid</span></a> <a href="PlotGroup.html#property.grid">$grid</a> +</li> +<li> +<span class="access">public</span> <a href="PlotAxis.html"><span class="type">PlotAxis</span></a> <a href="PlotGroup.html#property.axis">$axis</a> +</li> +<li> +<span class="access">protected</span> <span class="type">bool</span> <a href="PlotGroup.html#property.xAxisZero">$xAxisZero</a> := <span class="default">TRUE</span> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="PlotGroup.html#method.__construct">__construct</a>() + </li> +<li> +<span class="access">public</span> <a href="PlotGroup.html#method.setXAxisZero">setXAxisZero</a>(<span class="type">bool</span> <span class="argument">$zero</span>) + </li> +<li> +<span class="access">public</span> <a href="PlotGroup.html#method.setYAxisZero">setYAxisZero</a>(<span class="type">bool</span> <span class="argument">$zero</span>) + </li> +<li> +<span class="access">public</span> <a href="PlotGroup.html#method.setYMin">setYMin</a>(<span class="type">float</span> <span class="argument">$value</span>) + </li> +<li> +<span class="access">public</span> <a href="PlotGroup.html#method.setYMax">setYMax</a>(<span class="type">float</span> <span class="argument">$value</span>) + </li> +<li> +<span class="access">public</span> <a href="PlotGroup.html#method.setXMin">setXMin</a>(<span class="type">float</span> <span class="argument">$value</span>) + </li> +<li> +<span class="access">public</span> <a href="PlotGroup.html#method.setXMax">setXMax</a>(<span class="type">float</span> <span class="argument">$value</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.grid"></a><span class="access">public</span> <a href="Grid.html"><span class="type">Grid</span></a> <a href="PlotGroup.html#property.grid">$grid</a><div class="description"> + Représente la grille de fond du groupe de <a href="Plot.html">Plot</a>. + </div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.axis"></a><span class="access">public</span> <a href="PlotAxis.html"><span class="type">PlotAxis</span></a> <a href="PlotGroup.html#property.axis">$axis</a><div class="description"> + Représente les axes de gauche, droite, du haut et du bas du groupe de <a href="Plot.html">Plot</a>. + </div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.xAxisZero"></a><span class="access">protected</span> <span class="type">bool</span> <a href="PlotGroup.html#property.xAxisZero">$xAxisZero</a> := <span class="default">TRUE</span><div class="description"> + Est-ce le ou les axes des abscisses doivent être centrés sur zéro ? + </div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="PlotGroup.html#method.__construct">__construct</a>() + <div class="description"> + Construit le groupe de <a href="Plot.html">Plot</a>. + </div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setXAxisZero"></a><span class="access">public</span> <a href="PlotGroup.html#method.setXAxisZero">setXAxisZero</a>(<span class="type">bool</span> <span class="argument">$zero</span>) + <div class="description"> + Précise si le ou les axes des abscisses doivent être centrés sur le zéro de l'axe des ordonnées. + </div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setYAxisZero"></a><span class="access">public</span> <a href="PlotGroup.html#method.setYAxisZero">setYAxisZero</a>(<span class="type">bool</span> <span class="argument">$zero</span>) + <div class="description"> + Précise si le ou les axes des ordonnées doivent être centrés sur le zéro de l'axe des abscisses. + </div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setYMin"></a><span class="access">public</span> <a href="PlotGroup.html#method.setYMin">setYMin</a>(<span class="type">float</span> <span class="argument">$value</span>) + <div class="description"> + Force la valeur minimale de l'axe des ordonnées à $value. + <div class="see"> + Voir aussi : + <ul><li><a href="PlotGroup.html#method.setYMax">PlotGroup::setYMax()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setYMax"></a><span class="access">public</span> <a href="PlotGroup.html#method.setYMax">setYMax</a>(<span class="type">float</span> <span class="argument">$value</span>) + <div class="description"> + Force la valeur maximale de l'axe des ordonnées à $value. + <div class="see"> + Voir aussi : + <ul><li><a href="PlotGroup.html#method.setYMin">PlotGroup::setYMin()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setXMin"></a><span class="access">public</span> <a href="PlotGroup.html#method.setXMin">setXMin</a>(<span class="type">float</span> <span class="argument">$value</span>) + <div class="description"> + Force la valeur minimale de l'axe des abscisses à $value. + <div class="see"> + Voir aussi : + <ul><li><a href="PlotGroup.html#method.setXMax">PlotGroup::setXMax()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setXMax"></a><span class="access">public</span> <a href="PlotGroup.html#method.setXMax">setXMax</a>(<span class="type">float</span> <span class="argument">$value</span>) + <div class="description"> + Force la valeur maximale de l'axe des abscisses à $value. + <div class="see"> + Voir aussi : + <ul><li><a href="PlotGroup.html#method.setXMin">PlotGroup::setXMin()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="PlotGroup.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Point.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Point.html new file mode 100644 index 0000000000000000000000000000000000000000..3c8c106aa2004f700ef25e0681e3d74fea2b420a --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Point.html @@ -0,0 +1,134 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Point</h2><div class="extends"><ul> +<li><a href="Shape.html">Shape</a></li> +<ul><li>Point</li></ul> +</ul></div><div class="description"> + <p>La classe <a href="Point.html">Point</a> permet de manipuler des points dans un espace de deux dimensions.</p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <span class="type">float</span> <a href="Point.html#property.x">$x</a> +</li> +<li> +<span class="access">public</span> <span class="type">float</span> <a href="Point.html#property.y">$y</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Point.html#method.__construct">__construct</a>(<span class="type">float</span> <span class="argument">$x</span>, <span class="type">float</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Point.html#method.setX">setX</a>(<span class="type">float</span> <span class="argument">$x</span>) + </li> +<li> +<span class="access">public</span> <a href="Point.html#method.setY">setY</a>(<span class="type">float</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Point.html#method.setLocation">setLocation</a>(<span class="type">float</span> <span class="argument">$x</span>, <span class="type">float</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <span class="type">array</span> <a href="Point.html#method.getLocation">getLocation</a>() + </li> +<li> +<span class="access">public</span> <span class="type">float</span> <a href="Point.html#method.getDistance">getDistance</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p</span>) + </li> +<li> +<span class="access">public</span> <a href="Point.html#method.move">move</a>(<span class="type">float</span> <span class="argument">$x</span>, <span class="type">float</span> <span class="argument">$y</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.x"></a><span class="access">public</span> <span class="type">float</span> <a href="Point.html#property.x">$x</a><div class="description"> + La position du point sur l'axe des abscisses. + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.y"></a><span class="access">public</span> <span class="type">float</span> <a href="Point.html#property.y">$y</a><div class="description"> + La position du point sur l'axe des ordonnées. + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Point.html#method.__construct">__construct</a>(<span class="type">float</span> <span class="argument">$x</span>, <span class="type">float</span> <span class="argument">$y</span>) + <div class="description"> + Déclare un nouveau point avec des coordonnées x et y. + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setX"></a><span class="access">public</span> <a href="Point.html#method.setX">setX</a>(<span class="type">float</span> <span class="argument">$x</span>) + <div class="description"> + Change la position X du point. + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setY"></a><span class="access">public</span> <a href="Point.html#method.setY">setY</a>(<span class="type">float</span> <span class="argument">$y</span>) + <div class="description"> + Change la position Y du point. + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setLocation"></a><span class="access">public</span> <a href="Point.html#method.setLocation">setLocation</a>(<span class="type">float</span> <span class="argument">$x</span>, <span class="type">float</span> <span class="argument">$y</span>) + <div class="description"> + Change la position du point pour les valeurs x et y passées en paramètre. + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getLocation"></a><span class="access">public</span> <span class="type">array</span> <a href="Point.html#method.getLocation">getLocation</a>() + <div class="description"> + Retourne la position du point dans un tableau à deux valeurs. +<pre> + +<?php +$p = new Point(3, 7); +list($x, $y) = $p->getLocation(); // array(3, 7) +?> + +</pre> + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getDistance"></a><span class="access">public</span> <span class="type">float</span> <a href="Point.html#method.getDistance">getDistance</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p</span>) + <div class="description"> + Retourne la distance entre le point et le point $p. + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.move"></a><span class="access">public</span> <a href="Point.html#method.move">move</a>(<span class="type">float</span> <span class="argument">$x</span>, <span class="type">float</span> <span class="argument">$y</span>) + <div class="description"> + Change la position du point en ajoutant à ses coordonnées actuelles les valeurs x et y passées en paramètre. + </div> +<div class="description-bottom"><a href="Point.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Polygon.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Polygon.html new file mode 100644 index 0000000000000000000000000000000000000000..d9e1a7105727c099e77956550662943376d7761e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Polygon.html @@ -0,0 +1,99 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Polygon</h2><div class="extends"><ul> +<li><a href="Shape.html">Shape</a></li> +<ul><li>Polygon</li></ul> +</ul></div><div class="description"> + <p> + Un polygone est une succcession de points. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"><li> +<span class="access">protected</span> <span class="type">array</span> <a href="Polygon.html#property.points">$points</a> +</li></ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Polygon.html#method.set">set</a>(<span class="type">int</span> <span class="argument">$pos</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$point</span>) + </li> +<li> +<span class="access">public</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Polygon.html#method.get">get</a>(<span class="type">int</span> <span class="argument">$pos</span>) + </li> +<li> +<span class="access">public</span> <a href="Polygon.html#method.append">append</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$point</span>) + </li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Polygon.html#method.count">count</a>() + </li> +<li> +<span class="access">public</span> <span class="type">array</span> <a href="Polygon.html#method.all">all</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.points"></a><span class="access">protected</span> <span class="type">array</span> <a href="Polygon.html#property.points">$points</a><div class="description"> + Stocke tous les points du polygone. + </div> +<div class="description-bottom"><a href="Polygon.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.set"></a><span class="access">public</span> <a href="Polygon.html#method.set">set</a>(<span class="type">int</span> <span class="argument">$pos</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$point</span>) + <div class="description"> + Ajoute ou remplace un point $point dans le polygon à la position $pos. + Cette méthode accepte la valeur NULL pour spécifier que ce point doit être ignoré. + </div> +<div class="description-bottom"><a href="Polygon.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.get"></a><span class="access">public</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Polygon.html#method.get">get</a>(<span class="type">int</span> <span class="argument">$pos</span>) + <div class="description"> + Retourne le point du polygone à la position $pos. + </div> +<div class="description-bottom"><a href="Polygon.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.append"></a><span class="access">public</span> <a href="Polygon.html#method.append">append</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$point</span>) + <div class="description"> + Ajoute un point $point à la fin du polygone. + Cette méthode accepte la valeur NULL pour spécifier que ce point doit être ignoré. + </div> +<div class="description-bottom"><a href="Polygon.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.count"></a><span class="access">public</span> <span class="type">int</span> <a href="Polygon.html#method.count">count</a>() + <div class="description"> + Retourne le nombre de points contenus dans le polygone. + </div> +<div class="description-bottom"><a href="Polygon.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.all"></a><span class="access">public</span> <span class="type">array</span> <a href="Polygon.html#method.all">all</a>() + <div class="description"> + Permet de récupérer tous les points du polygone. + </div> +<div class="description-bottom"><a href="Polygon.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Positionable.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Positionable.html new file mode 100644 index 0000000000000000000000000000000000000000..fc8714b821c7486ade54222d1d6d64d4a92ad197 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Positionable.html @@ -0,0 +1,101 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Positionable</h2><div class="description"> + <p> + <a href="Positionable.html">Positionable</a> est une <span style="text-decoration: underline">interface</span> que doivent implémenter les classes peuvent être positionnées par rapport à un <a href="Point.html">Point</a>. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.LEFT">LEFT</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.RIGHT">RIGHT</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.CENTER">CENTER</a> := <span class="default">3</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.TOP">TOP</a> := <span class="default">4</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.BOTTOM">BOTTOM</a> := <span class="default">5</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.MIDDLE">MIDDLE</a> := <span class="default">6</span> +</li> +</ul><ul class="methods"><li> +<span class="access">public</span> <a href="Positionable.html#method.setAlign">setAlign</a>(<span class="type">int</span> <span class="argument">$h</span> = <span class="default">NULL</span>, <span class="type">int</span> <span class="argument">$v</span> = <span class="default">NULL</span>) + </li></ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.LEFT"></a><span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.LEFT">LEFT</a> := <span class="default">1</span><div class="description"> + Désigne un alignement à gauche. + </div> +<div class="description-bottom"><a href="Positionable.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.RIGHT"></a><span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.RIGHT">RIGHT</a> := <span class="default">2</span><div class="description"> + Désigne un alignement à droite. + </div> +<div class="description-bottom"><a href="Positionable.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.CENTER"></a><span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.CENTER">CENTER</a> := <span class="default">3</span><div class="description"> + Désigne un alignement au centre. + </div> +<div class="description-bottom"><a href="Positionable.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.TOP"></a><span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.TOP">TOP</a> := <span class="default">4</span><div class="description"> + Désigne un alignement en haut. + </div> +<div class="description-bottom"><a href="Positionable.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.BOTTOM"></a><span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.BOTTOM">BOTTOM</a> := <span class="default">5</span><div class="description"> + Désigne un alignement en bas. + </div> +<div class="description-bottom"><a href="Positionable.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.MIDDLE"></a><span class="access">const</span> <span class="type">int</span> <a href="Positionable.html#constant.MIDDLE">MIDDLE</a> := <span class="default">6</span><div class="description"> + Désigne un alignement au centre. + </div> +<div class="description-bottom"><a href="Positionable.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAlign"></a><span class="access">public</span> <a href="Positionable.html#method.setAlign">setAlign</a>(<span class="type">int</span> <span class="argument">$h</span> = <span class="default">NULL</span>, <span class="type">int</span> <span class="argument">$v</span> = <span class="default">NULL</span>) + <div class="description"> + Change l'alignement par rapport au point où l'objet sera affiché. + $h correspond à l'alignement horizontal (<a href="Positionable.html#constant.LEFT">Positionable::LEFT</a>, <a href="Positionable.html#constant.RIGHT">Positionable::RIGHT</a> ou <a href="Positionable.html#constant.CENTER">Positionable::CENTER</a>) et $v à l'alignement vertical (<a href="Positionable.html#constant.TOP">Positionable::TOP</a>, <a href="Positionable.html#constant.BOTTOM">Positionable::BOTTOM</a> ou <a href="Positionable.html#constant.MIDDLE">Positionable::MIDDLE</a>). + Si vous ne souhaitez pas modifier une des deux valeurs, vous pouvez passer NULL. + </div> +<div class="description-bottom"><a href="Positionable.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/RadialGradient.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/RadialGradient.html new file mode 100644 index 0000000000000000000000000000000000000000..6edbcf073d8f28d2dcbe38cb815a43163d0cd5a9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/RadialGradient.html @@ -0,0 +1,35 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class RadialGradient</h2><div class="extends"><ul> +<li><a href="Gradient.html">Gradient</a></li> +<ul><li>RadialGradient</li></ul> +</ul></div><div class="description"> + <p>Cette classe permet de décrire un dégradé radial.</p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><h2>Documentation</h2><ul class="doc"></ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/ScatterPlot.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/ScatterPlot.html new file mode 100644 index 0000000000000000000000000000000000000000..c0f72daccc604e2eeb68baec5f6434a2c22924a4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/ScatterPlot.html @@ -0,0 +1,164 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class ScatterPlot</h2><div class="extends"><ul> +<li><a href="Component.html">Component</a></li> +<ul> +<li><a href="Plot.html">Plot</a></li> +<ul><li>ScatterPlot <span class="interface">implements</span> <a href="Legendable.html">Legendable</a> +</li></ul> +</ul> +</ul></div><div class="description"> + <p> + Les ScatterPlot (ou graphiques libres) permettent de dessiner des points aux coordonnées (x, y) sur une image. + Ce type de graphique est plus pluissant que les <a href="LinePlot.html">LinePlot</a> car plusieurs points de même abscisse peuvent être placés sur le même graphique. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <a href="Mark.html"><span class="type">Mark</span></a> <a href="ScatterPlot.html#property.mark">$mark</a> +</li> +<li> +<span class="access">public</span> <a href="Label.html"><span class="type">Label</span></a> <a href="ScatterPlot.html#property.label">$label</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="ScatterPlot.html#method.__construct">__construct</a>(<span class="type">array</span> <span class="argument">$datay</span>, <span class="type">array</span> <span class="argument">$datax</span> = <span class="default">NULL</span>) + </li> +<li> +<span class="access">public</span> <a href="ScatterPlot.html#method.setImpulse">setImpulse</a>(<span class="type">bool</span> <span class="argument">$impulse</span>) + </li> +<li> +<span class="access">public</span> <a href="ScatterPlot.html#method.link">link</a>(<span class="type">bool</span> <span class="argument">$link</span>) + </li> +<li> +<span class="access">public</span> <a href="ScatterPlot.html#method.linkNull">linkNull</a>(<span class="type">bool</span> <span class="argument">$linkNull</span>) + </li> +<li> +<span class="access">public</span> <a href="ScatterPlot.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="ScatterPlot.html#method.setStyle">setStyle</a>(<span class="type">int</span> <span class="argument">$style</span>) + </li> +<li> +<span class="access">public</span> <a href="ScatterPlot.html#method.setThickness">setThickness</a>(<span class="type">int</span> <span class="argument">$thickness</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.mark"></a><span class="access">public</span> <a href="Mark.html"><span class="type">Mark</span></a> <a href="ScatterPlot.html#property.mark">$mark</a><div class="description"> + Représente les marques affichées sur chaque point. + </div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.label"></a><span class="access">public</span> <a href="Label.html"><span class="type">Label</span></a> <a href="ScatterPlot.html#property.label">$label</a><div class="description"> + Représente les étiquettes affichées au-dessus de chaque point. + Ces étiquettes ne sont pas affichées par défaut. + </div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="ScatterPlot.html#method.__construct">__construct</a>(<span class="type">array</span> <span class="argument">$datay</span>, <span class="type">array</span> <span class="argument">$datax</span> = <span class="default">NULL</span>) + <div class="description"> + Créé un nouveau ScatterPlot avec des points d'abscisses $datax et d'ordonnées $datay. + Si la valeur $datax est laissée à NULL, alors la librairie utilisera des valeurs incrémentales pour X, en commençant par zéro. +<pre> + +<?php + +require_once "ScatterPlot.class.php"; + +$graph = new <a href="Graph.html">Graph</a>(400, 400); + +// Tableaux de valeurs +$y = array(2, 4, 6); +$x = array(1, 4, 3); + +// On dessine les points (1, 2), (4, 4) et (3, 6) +$plot = new <a href="ScatterPlot.html">ScatterPlot</a>($y, $x); + +$graph-><a href="Graph.html#method.add">add</a>($plot); +$graph-><a href="Graph.html#method.draw">draw</a>(); + +?> + +</pre> + </div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setImpulse"></a><span class="access">public</span> <a href="ScatterPlot.html#method.setImpulse">setImpulse</a>(<span class="type">bool</span> <span class="argument">$impulse</span>) + <div class="description"> + Si le paramètre $impulse vaut TRUE, alors chaque point sera relié à l'axe des abscisses par une droite. + Cette méthode permet notamment de représenter des graphiques à impulsions. + </div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.link"></a><span class="access">public</span> <a href="ScatterPlot.html#method.link">link</a>(<span class="type">bool</span> <span class="argument">$link</span>) + <div class="description"> + Permet de lier les points du graphique entre eux. + </div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.linkNull"></a><span class="access">public</span> <a href="ScatterPlot.html#method.linkNull">linkNull</a>(<span class="type">bool</span> <span class="argument">$linkNull</span>) + <div class="description"> + Si $linkNull vaut TRUE, alors les valeurs en ordonnée égales à nulles n'interrompront pas le lien entre tous les points. + A l'inverse, si $linkNull vaut FALSE, alors le lien sera rompu à chaque fois qu'une valeur égale à NULL sera trouvée. + Cette méthode n'a de sens que lorsque vous avez choisi de relier les points entre eux. + <div class="see"> + Voir aussi : + <ul><li><a href="ScatterPlot.html#method.link">ScatterPlot::link()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="ScatterPlot.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de la ligne qui relie les points du composant entre eux. + </div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setStyle"></a><span class="access">public</span> <a href="ScatterPlot.html#method.setStyle">setStyle</a>(<span class="type">int</span> <span class="argument">$style</span>) + <div class="description"> + Change le style de ligne (<a href="Line.html#constant.SOLID">Line::SOLID</a>, <a href="Line.html#constant.DOTTED">Line::DOTTED</a> ou <a href="Line.html#constant.DASHED">Line::DASHED</a>) qui relie chaque point. + </div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setThickness"></a><span class="access">public</span> <a href="ScatterPlot.html#method.setThickness">setThickness</a>(<span class="type">int</span> <span class="argument">$thickness</span>) + <div class="description"> + Change l'épaisseur de la ligne qui relie les points du composant entre eux. + L'épaisseur de la ligne doit être toujours positive. + </div> +<div class="description-bottom"><a href="ScatterPlot.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Shadow.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Shadow.html new file mode 100644 index 0000000000000000000000000000000000000000..9eeaa2042eb0636a096797ea3fa9ba8b656caf91 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Shadow.html @@ -0,0 +1,234 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Shadow</h2><div class="description"> + <p> + La classe <a href="Shadow.html">Shadow</a> permet de manipuler des ombres sur des rectangles. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.LEFT_TOP">LEFT_TOP</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.LEFT_BOTTOM">LEFT_BOTTOM</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.RIGHT_TOP">RIGHT_TOP</a> := <span class="default">3</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.RIGHT_BOTTOM">RIGHT_BOTTOM</a> := <span class="default">4</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.IN">IN</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.OUT">OUT</a> := <span class="default">2</span> +</li> +</ul><ul class="properties"> +<li> +<span class="access">protected</span> <span class="type">int</span> <a href="Shadow.html#property.size">$size</a> := <span class="default">0</span> +</li> +<li> +<span class="access">protected</span> <a href="Color.html"><span class="type">Color</span></a> <a href="Shadow.html#property.color">$color</a> := <span class="default">new Color(100, 100, 100)</span> +</li> +<li> +<span class="access">protected</span> <span class="type">int</span> <a href="Shadow.html#property.position">$position</a> +</li> +<li> +<span class="access">protected</span> <span class="type">bool</span> <a href="Shadow.html#property.hide">$hide</a> +</li> +<li> +<span class="access">protected</span> <span class="type">bool</span> <a href="Shadow.html#property.smooth">$smooth</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Shadow.html#method.__construct">__construct</a>(<span class="type">int</span> <span class="argument">$position</span>) + </li> +<li> +<span class="access">public</span> <a href="Shadow.html#method.hide">hide</a>(<span class="type">bool</span> <span class="argument">$hide</span>) + </li> +<li> +<span class="access">public</span> <a href="Shadow.html#method.show">show</a>(<span class="type">bool</span> <span class="argument">$show</span>) + </li> +<li> +<span class="access">public</span> <a href="Shadow.html#method.setSize">setSize</a>(<span class="type">int</span> <span class="argument">$size</span>) + </li> +<li> +<span class="access">public</span> <a href="Shadow.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Shadow.html#method.setPosition">setPosition</a>(<span class="type">int</span> <span class="argument">$position</span>) + </li> +<li> +<span class="access">public</span> <a href="Shadow.html#method.smooth">smooth</a>(<span class="type">bool</span> <span class="argument">$smooth</span>) + </li> +<li> +<span class="access">public</span> <a href="Side.html"><span class="type">Side</span></a> <a href="Shadow.html#method.getSpace">getSpace</a>() + </li> +<li> +<span class="access">public</span> <a href="Shadow.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>, <span class="type">int</span> <span class="argument">$mode</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.LEFT_TOP"></a><span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.LEFT_TOP">LEFT_TOP</a> := <span class="default">1</span><div class="description"> + Dessine l'ombre sur les côtés haut et gauche. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.LEFT_BOTTOM"></a><span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.LEFT_BOTTOM">LEFT_BOTTOM</a> := <span class="default">2</span><div class="description"> + Dessine l'ombre sur les côtés bas et gauche. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.RIGHT_TOP"></a><span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.RIGHT_TOP">RIGHT_TOP</a> := <span class="default">3</span><div class="description"> + Dessine l'ombre sur les côtés haut et droit. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.RIGHT_BOTTOM"></a><span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.RIGHT_BOTTOM">RIGHT_BOTTOM</a> := <span class="default">4</span><div class="description"> + Dessine l'ombre sur les côtés bas et droit. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.IN"></a><span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.IN">IN</a> := <span class="default">1</span><div class="description"> + Spécifie que l'ombre doit être dessinée à l'intérieur. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.OUT"></a><span class="access">const</span> <span class="type">int</span> <a href="Shadow.html#constant.OUT">OUT</a> := <span class="default">2</span><div class="description"> + Spécifie que l'ombre doit être dessinée à l'extérieur. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.size"></a><span class="access">protected</span> <span class="type">int</span> <a href="Shadow.html#property.size">$size</a> := <span class="default">0</span><div class="description"> + Taille de l'ombre. + Cette valeur est par défaut à 0, ce qui signifie qu'aucune ombre n'est affichée. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.color"></a><span class="access">protected</span> <a href="Color.html"><span class="type">Color</span></a> <a href="Shadow.html#property.color">$color</a> := <span class="default">new Color(100, 100, 100)</span><div class="description"> + Taille de l'ombre. + Cette valeur est par défaut à 0, ce qui signifie qu'aucune ombre n'est affichée. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.position"></a><span class="access">protected</span> <span class="type">int</span> <a href="Shadow.html#property.position">$position</a><div class="description"> + Détermine la position de l'ombre. + Les valeurs possible sont <a href="Shadow.html#constant.LEFT_TOP">Shadow::LEFT_TOP</a>, <a href="Shadow.html#constant.RIGHT_TOP">Shadow::RIGHT_TOP</a>, <a href="Shadow.html#constant.LEFT_BOTTOM">Shadow::LEFT_BOTTOM</a> ou <a href="Shadow.html#constant.RIGHT_BOTTOM">Shadow::RIGHT_BOTTOM</a>. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.hide"></a><span class="access">protected</span> <span class="type">bool</span> <a href="Shadow.html#property.hide">$hide</a><div class="description"> + Détermine si l'ombre doit être cachée. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.smooth"></a><span class="access">protected</span> <span class="type">bool</span> <a href="Shadow.html#property.smooth">$smooth</a><div class="description"> + Détermine si l'ombre doit être lissée ou non. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Shadow.html#method.__construct">__construct</a>(<span class="type">int</span> <span class="argument">$position</span>) + <div class="description"> + Déclare une ombre à la position $position. + $position peut prendre les valeurs <a href="Shadow.html#constant.LEFT_TOP">Shadow::LEFT_TOP</a>, <a href="Shadow.html#constant.RIGHT_TOP">Shadow::RIGHT_TOP</a>, <a href="Shadow.html#constant.LEFT_BOTTOM">Shadow::LEFT_BOTTOM</a> ou <a href="Shadow.html#constant.RIGHT_BOTTOM">Shadow::RIGHT_BOTTOM</a>. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Shadow.html#method.hide">hide</a>(<span class="type">bool</span> <span class="argument">$hide</span>) + <div class="description"> + Détermine si l'ombre doit être cachée ou non. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.show"></a><span class="access">public</span> <a href="Shadow.html#method.show">show</a>(<span class="type">bool</span> <span class="argument">$show</span>) + <div class="description"> + Détermine si l'ombre doit être affichée ou non. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSize"></a><span class="access">public</span> <a href="Shadow.html#method.setSize">setSize</a>(<span class="type">int</span> <span class="argument">$size</span>) + <div class="description"> + Change la taille de l'ombre pour $size. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="Shadow.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de l'ombre pour $color. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setPosition"></a><span class="access">public</span> <a href="Shadow.html#method.setPosition">setPosition</a>(<span class="type">int</span> <span class="argument">$position</span>) + <div class="description"> + Change la position de l'ombre. + $position peut prendre les valeurs <a href="Shadow.html#constant.LEFT_TOP">Shadow::LEFT_TOP</a>, <a href="Shadow.html#constant.RIGHT_TOP">Shadow::RIGHT_TOP</a>, <a href="Shadow.html#constant.LEFT_BOTTOM">Shadow::LEFT_BOTTOM</a> ou <a href="Shadow.html#constant.RIGHT_BOTTOM">Shadow::RIGHT_BOTTOM</a>. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.smooth"></a><span class="access">public</span> <a href="Shadow.html#method.smooth">smooth</a>(<span class="type">bool</span> <span class="argument">$smooth</span>) + <div class="description"> + Détermine si l'ombre doit être lissée ou non. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getSpace"></a><span class="access">public</span> <a href="Side.html"><span class="type">Side</span></a> <a href="Shadow.html#method.getSpace">getSpace</a>() + <div class="description"> + Retourne l'espace pris par l'ombre à gauche, droit, en haut et en bas. + Les espaces sont retournés en pixels. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="Shadow.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>, <span class="type">int</span> <span class="argument">$mode</span>) + <div class="description"> + Dessine l'ombre avec le dessinateur $drawer dans un rectangle dont la diagonale est le segment qui relie les points $p1 et $p2. + Le paramètre $mode détermine le mode d'affichage de l'ombre. Si <a href="Shadow.html#constant.OUT">Shadow::OUT</a> est spécifié, alors l'ombre sera dessinée en dehors du rectangle. Si <a href="Shadow.html#constant.IN">Shadow::IN</a> est spécifié, alors l'ombre sera dessinée à l'intérieur du rectangle. + </div> +<div class="description-bottom"><a href="Shadow.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Shape.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Shape.html new file mode 100644 index 0000000000000000000000000000000000000000..afc9332bf77a9cc6a68dfe73a4a64eea4761a34c --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Shape.html @@ -0,0 +1,177 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Shape</h2><div class="description"> + <p>La classe <a href="Shape.html">Shape</a> permet de représenter toutes sortes de formes sur Artichow.</p> + </div><div class="inherit"> + Les classes suivantes dérivent de Shape : + <ul> +<li><a href="Point.html">Point</a></li> +<li><a href="Line.html">Line</a></li> +<li><a href="Polygon.html">Polygon</a></li> +</ul> +</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shape.html#constant.SOLID">SOLID</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shape.html#constant.DOTTED">DOTTED</a> := <span class="default">2</span> +</li> +<li> +<span class="access">const</span> <span class="type">int</span> <a href="Shape.html#constant.DASHED">DASHED</a> := <span class="default">3</span> +</li> +</ul><ul class="properties"> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Shape.html#property.style">$style</a> +</li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Shape.html#property.thickness">$thickness</a> +</li> +<li> +<span class="access">protected</span> <span class="type">bool</span> <a href="Shape.html#property.hide">$hide</a> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Shape.html#method.__construct">__construct</a>(<span class="type">float</span> <span class="argument">$x</span>, <span class="type">float</span> <span class="argument">$y</span>) + </li> +<li> +<span class="access">public</span> <a href="Shape.html#method.setStyle">setStyle</a>(<span class="type">int</span> <span class="argument">$style</span>) + </li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Shape.html#method.getStyle">getStyle</a>() + </li> +<li> +<span class="access">public</span> <a href="Shape.html#method.setThickness">setThickness</a>(<span class="type">int</span> <span class="argument">$thickness</span>) + </li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Shape.html#method.getThickness">getThickness</a>() + </li> +<li> +<span class="access">public</span> <a href="Shape.html#method.hide">hide</a>(<span class="type">bool</span> <span class="argument">$hide</span>) + </li> +<li> +<span class="access">public</span> <a href="Shape.html#method.show">show</a>(<span class="type">bool</span> <span class="argument">$show</span>) + </li> +<li> +<span class="access">public</span> <span class="type">bool</span> <a href="Shape.html#method.isHidden">isHidden</a>() + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.SOLID"></a><span class="access">const</span> <span class="type">int</span> <a href="Shape.html#constant.SOLID">SOLID</a> := <span class="default">1</span><div class="description"> + Désigne une ligne continue. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.DOTTED"></a><span class="access">const</span> <span class="type">int</span> <a href="Shape.html#constant.DOTTED">DOTTED</a> := <span class="default">2</span><div class="description"> + Désigne une ligne pointillée. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.DASHED"></a><span class="access">const</span> <span class="type">int</span> <a href="Shape.html#constant.DASHED">DASHED</a> := <span class="default">3</span><div class="description"> + Désigne une ligne avec de larges pointillés. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.style"></a><span class="access">public</span> <span class="type">int</span> <a href="Shape.html#property.style">$style</a><div class="description"> + Décrit le style du pourtour de la forme. Peut être <a href="Shape.html#constant.DOTTED">Shape::DOTTED</a>, <a href="Shape.html#constant.SOLID">Shape::SOLID</a> ou <a href="Shape.html#constant.DASHED">Shape::DASHED</a>. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.thickness"></a><span class="access">public</span> <span class="type">int</span> <a href="Shape.html#property.thickness">$thickness</a><div class="description"> + L'épaisseur du pourtour de la forme. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.hide"></a><span class="access">protected</span> <span class="type">bool</span> <a href="Shape.html#property.hide">$hide</a><div class="description"> + Déterminer si la forme doit être cachée ou non. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Shape.html#method.__construct">__construct</a>(<span class="type">float</span> <span class="argument">$x</span>, <span class="type">float</span> <span class="argument">$y</span>) + <div class="description"> + Déclare un nouveau point avec des coordonnées x et y. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setStyle"></a><span class="access">public</span> <a href="Shape.html#method.setStyle">setStyle</a>(<span class="type">int</span> <span class="argument">$style</span>) + <div class="description"> + Change le style du pourtour de la forme. Peut être <a href="Shape.html#constant.SOLID">Shape::SOLID</a> pour un pourtour continu, <a href="Shape.html#constant.DOTTED">Shape::DOTTED</a> pour un pourtour pointillé ou encore <a href="Shape.html#constant.DASHED">Shape::DASHED</a>. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getStyle"></a><span class="access">public</span> <span class="type">int</span> <a href="Shape.html#method.getStyle">getStyle</a>() + <div class="description"> + Retourne le style actuel de la forme. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setThickness"></a><span class="access">public</span> <a href="Shape.html#method.setThickness">setThickness</a>(<span class="type">int</span> <span class="argument">$thickness</span>) + <div class="description"> + Change l'épaisseur du pourtour de la forme. Cette épaisseur doit être donnée en pixels. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getThickness"></a><span class="access">public</span> <span class="type">int</span> <a href="Shape.html#method.getThickness">getThickness</a>() + <div class="description"> + Retourne l'épaisseur du pourtour de la forme. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Shape.html#method.hide">hide</a>(<span class="type">bool</span> <span class="argument">$hide</span>) + <div class="description"> + Détermine si la forme doit être cachée ou non. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.show"></a><span class="access">public</span> <a href="Shape.html#method.show">show</a>(<span class="type">bool</span> <span class="argument">$show</span>) + <div class="description"> + Détermine si la forme doit être affichée ou non. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.isHidden"></a><span class="access">public</span> <span class="type">bool</span> <a href="Shape.html#method.isHidden">isHidden</a>() + <div class="description"> + Retourne TRUE si la forme est cachée, FALSE si elle est visible. + </div> +<div class="description-bottom"><a href="Shape.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Side.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Side.html new file mode 100644 index 0000000000000000000000000000000000000000..f17daa756b49f9b129a74a3ae19e9ac1c8effd63 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Side.html @@ -0,0 +1,94 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Side</h2><div class="description"> + <p> + La classe <a href="Side.html">Side</a> est un objet qui fournit des méthodes pour gérer des situations où il est besoin de valoriser les côtés gauche, droit, haut et bas avec des entiers. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Side.html#property.left">$left</a> := <span class="default">0</span> +</li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Side.html#property.right">$right</a> := <span class="default">0</span> +</li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Side.html#property.top">$top</a> := <span class="default">0</span> +</li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Side.html#property.bottom">$bottom</a> := <span class="default">0</span> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Side.html#method.__construct">__construct</a>(<span class="type">mixed</span> <span class="argument">$left</span>, <span class="type">mixed</span> <span class="argument">$right</span>, <span class="type">mixed</span> <span class="argument">$top</span>, <span class="type">mixed</span> <span class="argument">$bottom</span>) + </li> +<li> +<span class="access">public</span> <a href="Side.html#method.set">set</a>(<span class="type">mixed</span> <span class="argument">$left</span>, <span class="type">mixed</span> <span class="argument">$right</span>, <span class="type">mixed</span> <span class="argument">$top</span>, <span class="type">mixed</span> <span class="argument">$bottom</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.left"></a><span class="access">public</span> <span class="type">int</span> <a href="Side.html#property.left">$left</a> := <span class="default">0</span><div class="description"> + Le côté gauche. + </div> +<div class="description-bottom"><a href="Side.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.right"></a><span class="access">public</span> <span class="type">int</span> <a href="Side.html#property.right">$right</a> := <span class="default">0</span><div class="description"> + Le côté droit. + </div> +<div class="description-bottom"><a href="Side.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.top"></a><span class="access">public</span> <span class="type">int</span> <a href="Side.html#property.top">$top</a> := <span class="default">0</span><div class="description"> + Le côté haut. + </div> +<div class="description-bottom"><a href="Side.html#top">Remonter</a></div> +</li> +<li class="property"> +<a id="property.bottom"></a><span class="access">public</span> <span class="type">int</span> <a href="Side.html#property.bottom">$bottom</a> := <span class="default">0</span><div class="description"> + Le côté bas. + </div> +<div class="description-bottom"><a href="Side.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Side.html#method.__construct">__construct</a>(<span class="type">mixed</span> <span class="argument">$left</span>, <span class="type">mixed</span> <span class="argument">$right</span>, <span class="type">mixed</span> <span class="argument">$top</span>, <span class="type">mixed</span> <span class="argument">$bottom</span>) + <div class="description"> + Construit l'objet <a href="Side.html">Side</a> avec les valeurs $left, $right, $top et $bottom pour les côtés gauche, droit, haut et bas. + </div> +<div class="description-bottom"><a href="Side.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.set"></a><span class="access">public</span> <a href="Side.html#method.set">set</a>(<span class="type">mixed</span> <span class="argument">$left</span>, <span class="type">mixed</span> <span class="argument">$right</span>, <span class="type">mixed</span> <span class="argument">$top</span>, <span class="type">mixed</span> <span class="argument">$bottom</span>) + <div class="description"> + Change les valeurs associées aux côtés gauche, droit, haut et bas. + Laisser un paramètre à NULL permet d'éviter que la valeur du côté soit modifiée. + </div> +<div class="description-bottom"><a href="Side.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/TTFFont.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/TTFFont.html new file mode 100644 index 0000000000000000000000000000000000000000..97819bea2076a4b288c70fd5c00f8ab5106921e6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/TTFFont.html @@ -0,0 +1,126 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class TTFFont</h2><div class="extends"><ul> +<li><a href="Font.html">Font</a></li> +<ul><li>TTFFont</li></ul> +</ul></div><div class="description"> + <p> + La classe <a href="TTFFont.html">TTFFont</a> permet de manipuler des polices TrueType. + Quelques polices sont disponibles dans le répertoire <span style="font-weight: bold">font/</span> de Artichow. + Si vous connaissez d'autres polices intéressantes et dans le domaine public, n'hésitez pas à le signaler à <span style="text-decoration: underline">vincent</span> sur <span style="text-decoration: underline">artichow point org</span>. + </p> + <p> + Afin de simplifier l'utilisation de cette classe, plusieurs polices sont déjà prédéfinies sur Artichow. + Chacune de ces polices est une classe qui dérive de <a href="TTFFont.html">TTFFont</a> et dont le constructeur ne prend qu'un paramètre, la taille de la police. Voici les polices prédéfinies : + </p> + <ul> + <li> +<em>Famille Tuffy :</em> Tuffy, TuffyBold, TuffyItalic, TuffyBoldItalic</li> + </ul> + <p> + Voici un exemple d'utilisation pour les polices prédéfinies : +<pre> + +<?php + +// On utilise Tuffy de taille 12 +// Equivalent à new <a href="TTFFont.html">TTFFont</a>(ARTICHOW_FONT.'/Tuffy.ttf', 12); +$blue = new Tuffy(12); + +// On utilise Tuffy en italique taille 42 +// Equivalent à new <a href="TTFFont.html">TTFFont</a>(ARTICHOW_FONT.'/TuffyItalic.ttf', 42); +$orange = new TuffyItalic(42); + +?> + +</pre> + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"><li> +<span class="access">public</span> <span class="type">int</span> <a href="TTFFont.html#property.size">$size</a> +</li></ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="TTFFont.html#method.__construct">__construct</a>(<span class="type">string</span> <span class="argument">$font</span>, <span class="type">int</span> <span class="argument">$size</span>) + </li> +<li> +<span class="access">public</span> <a href="TTFFont.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p</span>, <a href="Text.html"><span class="type">Text</span></a> <span class="argument">$text</span>) + </li> +<li> +<span class="access">public</span> <a href="TTFFont.html#method.getTextWidth">getTextWidth</a>(<a href="Text.html"><span class="type">Text</span></a> <span class="argument">$text</span>) + </li> +<li> +<span class="access">public</span> <a href="TTFFont.html#method.getTextHeight">getTextHeight</a>(<a href="Text.html"><span class="type">Text</span></a> <span class="argument">$text</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.size"></a><span class="access">public</span> <span class="type">int</span> <a href="TTFFont.html#property.size">$size</a><div class="description"> + La taille de la police en pixels. + </div> +<div class="description-bottom"><a href="TTFFont.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="TTFFont.html#method.__construct">__construct</a>(<span class="type">string</span> <span class="argument">$font</span>, <span class="type">int</span> <span class="argument">$size</span>) + <div class="description"> + Construit la police $font de taille $size pixels. + $font doit être le chemin vers un fichier de police TrueType. + Le dossier <span style="font-weight: bold">font/</span> dans le répertoire de Artichow contient quelques polices TrueType. + </div> +<div class="description-bottom"><a href="TTFFont.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="TTFFont.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p</span>, <a href="Text.html"><span class="type">Text</span></a> <span class="argument">$text</span>) + <div class="description"> + Dessine avec la police courante le texte $text. + Le dessinateur $drawer sera utilisé pour le dessin tandis que le texte sera positionné au point $p. + </div> +<div class="description-bottom"><a href="TTFFont.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getTextWidth"></a><span class="access">public</span> <a href="TTFFont.html#method.getTextWidth">getTextWidth</a>(<a href="Text.html"><span class="type">Text</span></a> <span class="argument">$text</span>) + <div class="description"> + Retourne la largeur en pixels occupée par l'objet <a href="Text.html">Text</a> $text. + <div class="see"> + Voir aussi : + <ul><li><a href="TTFFont.html#method.getTextHeight">TTFFont::getTextHeight()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="TTFFont.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getTextHeight"></a><span class="access">public</span> <a href="TTFFont.html#method.getTextHeight">getTextHeight</a>(<a href="Text.html"><span class="type">Text</span></a> <span class="argument">$text</span>) + <div class="description"> + Retourne la hauteur en pixels occupée par l'objet <a href="Text.html">Text</a> $text. + <div class="see"> + Voir aussi : + <ul><li><a href="TTFFont.html#method.getTextWidth">TTFFont::getTextWidth()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="TTFFont.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Text.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Text.html new file mode 100644 index 0000000000000000000000000000000000000000..976b704613286862c0718b1566107b17fa3c8695 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Text.html @@ -0,0 +1,186 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Text</h2><div class="description"> + <p> + La classe <a href="Text.html">Text</a> permet de manipuler du texte de manière uniforme sur Artichow. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties"><li> +<span class="access">public</span> <a href="Border.html"><span class="type">Border</span></a> <a href="Text.html#property.border">$border</a> +</li></ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Text.html#method.__construct">__construct</a>(<span class="type">string</span> <span class="argument">$text</span>, <a href="Font.html"><span class="type">Font</span></a> <span class="argument">$font</span> = <span class="default">new Font(Text::FONT_2)</span>, <a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span> = <span class="default">NULL</span>, <span class="type">int</span> <span class="argument">$angle</span> = <span class="default">0</span>) + </li> +<li> +<span class="access">public</span> <span class="type">string</span> <a href="Text.html#method.getText">getText</a>() + </li> +<li> +<span class="access">public</span> <a href="Text.html#method.setText">setText</a>(<span class="type">string</span> <span class="argument">$text</span>) + </li> +<li> +<span class="access">public</span> <a href="Font.html"><span class="type">Font</span></a> <a href="Text.html#method.getFont">getFont</a>() + </li> +<li> +<span class="access">public</span> <a href="Text.html#method.setFont">setFont</a>(<a href="Font.html"><span class="type">Font</span></a> <span class="argument">$font</span>) + </li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Text.html#method.getAngle">getAngle</a>() + </li> +<li> +<span class="access">public</span> <a href="Text.html#method.setAngle">setAngle</a>(<span class="type">int</span> <span class="argument">$angle</span>) + </li> +<li> +<span class="access">public</span> <span class="type">int</span> <a href="Text.html#method.getColor">getColor</a>() + </li> +<li> +<span class="access">public</span> <a href="Text.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <span class="type">mixed</span> <a href="Text.html#method.getBackground">getBackground</a>() + </li> +<li> +<span class="access">public</span> <a href="Text.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Text.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="type">Gradient</span></a> <span class="argument">$gradient</span>) + </li> +<li> +<span class="access">public</span> <span class="type">array</span> <a href="Text.html#method.getPadding">getPadding</a>() + </li> +<li> +<span class="access">public</span> <a href="Text.html#method.setPadding">setPadding</a>(<span class="type">int</span> <span class="argument">$left</span>, <span class="type">int</span> <span class="argument">$right</span>, <span class="type">int</span> <span class="argument">$top</span>, <span class="type">int</span> <span class="argument">$bottom</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="property"> +<a id="property.border"></a><span class="access">public</span> <a href="Border.html"><span class="type">Border</span></a> <a href="Text.html#property.border">$border</a><div class="description"> + La bordure qui entoure le texte. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Text.html#method.__construct">__construct</a>(<span class="type">string</span> <span class="argument">$text</span>, <a href="Font.html"><span class="type">Font</span></a> <span class="argument">$font</span> = <span class="default">new Font(Text::FONT_2)</span>, <a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span> = <span class="default">NULL</span>, <span class="type">int</span> <span class="argument">$angle</span> = <span class="default">0</span>) + <div class="description"> + Créé un nouveau pavé de texte avec pour texte $text. $font représente la police utilisée pour le texte tandis que $color représente sa couleur. + L'angle est définit par le paramètre $angle, qui peut prendre les valeurs de 0 et 90°. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getText"></a><span class="access">public</span> <span class="type">string</span> <a href="Text.html#method.getText">getText</a>() + <div class="description"> + Retourne le texte de la classe. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setText"></a><span class="access">public</span> <a href="Text.html#method.setText">setText</a>(<span class="type">string</span> <span class="argument">$text</span>) + <div class="description"> + Change le texte associé à l'objet pour $text. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getFont"></a><span class="access">public</span> <a href="Font.html"><span class="type">Font</span></a> <a href="Text.html#method.getFont">getFont</a>() + <div class="description"> + Retourne la police utilisée pour le texte. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setFont"></a><span class="access">public</span> <a href="Text.html#method.setFont">setFont</a>(<a href="Font.html"><span class="type">Font</span></a> <span class="argument">$font</span>) + <div class="description"> + Change la police utilisée pour le texte. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getAngle"></a><span class="access">public</span> <span class="type">int</span> <a href="Text.html#method.getAngle">getAngle</a>() + <div class="description"> + Retourne l'angle du texte. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setAngle"></a><span class="access">public</span> <a href="Text.html#method.setAngle">setAngle</a>(<span class="type">int</span> <span class="argument">$angle</span>) + <div class="description"> + Change l'angle du texte. Les valeurs possibles sont 0 ou 90°. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getColor"></a><span class="access">public</span> <span class="type">int</span> <a href="Text.html#method.getColor">getColor</a>() + <div class="description"> + Retourne la couleur du texte. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="Text.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur du texte. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getBackground"></a><span class="access">public</span> <span class="type">mixed</span> <a href="Text.html#method.getBackground">getBackground</a>() + <div class="description"> + Retourne le fond du texte. Si aucun fond n'a été spécifié, cette méthode retourne NULL. + Dans le cas contraire, elle retourne un objet de la classe Color pour les couleurs, soit une instance de Gradient pour les dégradés. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundColor"></a><span class="access">public</span> <a href="Text.html#method.setBackgroundColor">setBackgroundColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur de fond du texte. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setBackgroundGradient"></a><span class="access">public</span> <a href="Text.html#method.setBackgroundGradient">setBackgroundGradient</a>(<a href="Gradient.html"><span class="type">Gradient</span></a> <span class="argument">$gradient</span>) + <div class="description"> + Change le dégradé de fond du texte. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.getPadding"></a><span class="access">public</span> <span class="type">array</span> <a href="Text.html#method.getPadding">getPadding</a>() + <div class="description"> + Retourne la valeur de l'espace qui entoure le texte par rapport à sa bordure. Cette méthode retourne un tableau de quatre valeurs, qui correspondent à l'espace de gauche, droite, haut et bas. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setPadding"></a><span class="access">public</span> <a href="Text.html#method.setPadding">setPadding</a>(<span class="type">int</span> <span class="argument">$left</span>, <span class="type">int</span> <span class="argument">$right</span>, <span class="type">int</span> <span class="argument">$top</span>, <span class="type">int</span> <span class="argument">$bottom</span>) + <div class="description"> + Change la valeur de l'espace qui entoure le texte par rapport à sa bordure. + </div> +<div class="description-bottom"><a href="Text.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Tick.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Tick.html new file mode 100644 index 0000000000000000000000000000000000000000..9a2d95ed61ac72c535a2f4d9448829a954b09e7a --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Tick.html @@ -0,0 +1,188 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Tick</h2><div class="description"> + <p> + La classe <a href="Tick.html">Tick</a> permet de représenter des ticks, petits traits réguliers associés à un axe. + </p> + <div class="image"> + <img src="doc/image/ticks-out.png" style="margin-right: 42px" alt="Ticks à l'extérieur"> + <img src="doc/image/ticks-in.png" alt="Ticks à l'intérieur"> + </div> + <p> + De nombreuses méthodes de la classe <a href="Tick.html">Tick</a> ne sont pas documentées, + car elles ne sont utilisées qu'en interne par Artichow. + Néanmoins, si vous développez Artichow, vous aurez besoin de ces méthodes. + N'hésitez donc pas à parcourir le code source de cette classe. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="constants"> +<li> +<span class="access">const</span> <span class="type">string</span> <a href="Tick.html#constant.OUT">OUT</a> := <span class="default">0</span> +</li> +<li> +<span class="access">const</span> <span class="type">string</span> <a href="Tick.html#constant.IN">IN</a> := <span class="default">1</span> +</li> +<li> +<span class="access">const</span> <span class="type">string</span> <a href="Tick.html#constant.IN_OUT">IN_OUT</a> := <span class="default">2</span> +</li> +</ul><ul class="methods"> +<li> +<span class="access">public</span> <a href="Tick.html#method.__construct">__construct</a>(<span class="type">int</span> <span class="argument">$number</span>, <span class="type">int</span> <span class="argument">$size</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.setStyle">setStyle</a>(<span class="type">int</span> <span class="argument">$style</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.setSize">setSize</a>(<span class="type">int</span> <span class="argument">$size</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.setInterval">setInterval</a>(<span class="type">int</span> <span class="argument">$interval</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.setNumber">setNumber</a>(<span class="type">int</span> <span class="argument">$number</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.hide">hide</a>(<span class="type">bool</span> <span class="argument">$hide</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.hideFirst">hideFirst</a>(<span class="type">bool</span> <span class="argument">$hideFirst</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.hideLast">hideLast</a>(<span class="type">bool</span> <span class="argument">$hideLast</span>) + </li> +<li> +<span class="access">public</span> <a href="Tick.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Vector.html"><span class="type">Vector</span></a> <span class="argument">$vector</span>) + </li> +</ul><h2>Documentation</h2><ul class="doc"> +<li class="constant"> +<a id="constant.OUT"></a><span class="access">const</span> <span class="type">string</span> <a href="Tick.html#constant.OUT">OUT</a> := <span class="default">0</span><div class="description"> + Indique que les ticks doivent être tournés vers l'extérieur. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.IN"></a><span class="access">const</span> <span class="type">string</span> <a href="Tick.html#constant.IN">IN</a> := <span class="default">1</span><div class="description"> + Indique que les types doivent être tournés vers l'intérieur. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="constant"> +<a id="constant.IN_OUT"></a><span class="access">const</span> <span class="type">string</span> <a href="Tick.html#constant.IN_OUT">IN_OUT</a> := <span class="default">2</span><div class="description"> + Indique que les ticks sont et tournés vers l'extérieur, et tournés vers l'intérieur. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.__construct"></a><span class="access">public</span> <a href="Tick.html#method.__construct">__construct</a>(<span class="type">int</span> <span class="argument">$number</span>, <span class="type">int</span> <span class="argument">$size</span>) + <div class="description"> + Construit un nouvel objet <a href="Tick.html">Tick</a>. + $number représente un nombre de ticks et $size leur taille en pixels. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setStyle"></a><span class="access">public</span> <a href="Tick.html#method.setStyle">setStyle</a>(<span class="type">int</span> <span class="argument">$style</span>) + <div class="description"> + Change le style des ticks. Peut être <a href="Tick.html#constant.IN">Tick::IN</a>, <a href="Tick.html#constant.OUT">Tick::OUT</a> ou <a href="Tick.html#constant.IN_OUT">Tick::IN_OUT</a>. + Dans le premier cas, les ticks seront tournés vers l'intérieur. Dans le second vers l'extérieur et dans le troisième et vers l'extérieur et vers l'intérieur. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setColor"></a><span class="access">public</span> <a href="Tick.html#method.setColor">setColor</a>(<a href="Color.html"><span class="type">Color</span></a> <span class="argument">$color</span>) + <div class="description"> + Change la couleur des ticks pour $color. + Par défaut, les ticks sont dessinés en noir. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setSize"></a><span class="access">public</span> <a href="Tick.html#method.setSize">setSize</a>(<span class="type">int</span> <span class="argument">$size</span>) + <div class="description"> + Change la taille des ticks pour $size. + $size doit être donné en pixels. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setInterval"></a><span class="access">public</span> <a href="Tick.html#method.setInterval">setInterval</a>(<span class="type">int</span> <span class="argument">$interval</span>) + <div class="description"> + Change l'intervalle d'affichage des ticks par rapport à leur nombre. + Si $interval vaut 1, alors tous les ticks seront affichés. + Si $interval vaut 0.5, alors un tick sur deux sera affiché. + <div class="see"> + Voir aussi : + <ul><li><a href="Tick.html#method.setNumber">Tick::setNumber()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.setNumber"></a><span class="access">public</span> <a href="Tick.html#method.setNumber">setNumber</a>(<span class="type">int</span> <span class="argument">$number</span>) + <div class="description"> + Change le nombre de ticks à afficher pour $number. + <div class="see"> + Voir aussi : + <ul><li><a href="Tick.html#method.setInterval">Tick::setInterval()</a></li></ul> +</div> +</div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hide"></a><span class="access">public</span> <a href="Tick.html#method.hide">hide</a>(<span class="type">bool</span> <span class="argument">$hide</span>) + <div class="description"> + Permet de cache ou d'afficher les ticks. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideFirst"></a><span class="access">public</span> <a href="Tick.html#method.hideFirst">hideFirst</a>(<span class="type">bool</span> <span class="argument">$hideFirst</span>) + <div class="description"> + Permet de cache ou d'afficher le premier tick. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.hideLast"></a><span class="access">public</span> <a href="Tick.html#method.hideLast">hideLast</a>(<span class="type">bool</span> <span class="argument">$hideLast</span>) + <div class="description"> + Permet de cache ou d'afficher le dernier tick. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +<li class="method"> +<a id="method.draw"></a><span class="access">public</span> <a href="Tick.html#method.draw">draw</a>(<a href="Drawer.html"><span class="type">Drawer</span></a> <span class="argument">$drawer</span>, <a href="Vector.html"><span class="type">Vector</span></a> <span class="argument">$vector</span>) + <div class="description"> + Dessine les ticks sur le vecteur $vector. + </div> +<div class="description-bottom"><a href="Tick.html#top">Remonter</a></div> +</li> +</ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/Vector.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/Vector.html new file mode 100644 index 0000000000000000000000000000000000000000..93053e36c00563938610476ce2f5af8aac8aecb0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/Vector.html @@ -0,0 +1,48 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='stylesheet' href='style.css' /> + </head> + + <body> + <div align='center'> + <table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'> + <tr> + <td class='borderhg'> </td> + <td class='borderh'> </td> + <td class='cornerhd'></td> + </tr> + <tr> + <td class='borderg'> </td> + <td><a id="top"></a><h2> Class Vector</h2><div class="extends"><ul> +<li><a href="Shape.html">Shape</a></li> +<ul> +<li><a href="Line.html">Line</a></li> +<ul><li>Vector</li></ul> +</ul> +</ul></div><div class="description"> + <p> + La classe <a href="Vector.html">Vector</a> permet de représenter un vecteur. + </p> + </div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="methods"><li> +<span class="access">public</span> <span class="type">float</span> <a href="Vector.html#method.getAngle">getAngle</a>() + </li></ul><h2>Documentation</h2><ul class="doc"><li class="method"> +<a id="method.getAngle"></a><span class="access">public</span> <span class="type">float</span> <a href="Vector.html#method.getAngle">getAngle</a>() + <div class="description"> + Retourne l'angle du vecteur en radians. + </div> +<div class="description-bottom"><a href="Vector.html#top">Remonter</a></div> +</li></ul> +</td> + <td class='borderd'> </td> + </tr> + <tr> + <td class='cornerbg'></td> + <td class='borderb'> </td> + <td class='cornerbd'></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/back-rayures.png b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/back-rayures.png new file mode 100644 index 0000000000000000000000000000000000000000..127b1c3baf4fb6a49d3aea5fd0594ec78363408b Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/back-rayures.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bd.gif b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bd.gif new file mode 100644 index 0000000000000000000000000000000000000000..7eac688fb58e2eabae743b054945e457eebd638c Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bd.gif differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bd.png b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bd.png new file mode 100644 index 0000000000000000000000000000000000000000..3a74021060be697663a8c38c0fc4983d3a8cf677 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bd.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bg-long.gif b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bg-long.gif new file mode 100644 index 0000000000000000000000000000000000000000..a029ea1b93d4d6b8f430caf57dc9263fff2ee2d5 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bg-long.gif differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bg.gif b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..53de14d4f11dc0419fef52ceb08af03cc8acc7a6 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-bg.gif differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hd-transparent.gif b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hd-transparent.gif new file mode 100644 index 0000000000000000000000000000000000000000..fd32211cb2108876c86e8940e4448290a889a5b3 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hd-transparent.gif differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hd.gif b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hd.gif new file mode 100644 index 0000000000000000000000000000000000000000..14b0c9a9570533d50c87630ad86b3371e3373483 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hd.gif differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hg-transparent.gif b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hg-transparent.gif new file mode 100644 index 0000000000000000000000000000000000000000..bb7dac607b327cad3a831ff6ee0c136e4ce2f05f Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hg-transparent.gif differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hg.gif b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hg.gif new file mode 100644 index 0000000000000000000000000000000000000000..1da6df75a94d39521851de82f44a32670bfdfeda Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/coin-hg.gif differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/fond-flou.gif b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/fond-flou.gif new file mode 100644 index 0000000000000000000000000000000000000000..4299f56fc935691e93ac9283fe76a5ba367d6bf0 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/fond-flou.gif differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/image/fond.png b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/fond.png new file mode 100644 index 0000000000000000000000000000000000000000..f616c01a38cb1cd3825a00bfd3441ec90ee9c3d4 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/doc/image/fond.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/index.html b/maarch_entreprise/trunk/tools/graphic_lib/doc/index.html new file mode 100644 index 0000000000000000000000000000000000000000..8df201026ab76796af62ec1208c7da91d0174e14 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/index.html @@ -0,0 +1,138 @@ +<html> + <head> + <title>Documentation</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="stylesheet" href="style.css" /> + </head> + + <body> + <div align='center'> + <table cellpadding="0" cellspacing="0" id="contenu" class="round" style='width: 80%; margin-bottom: 20px'> + <tr> + <td class="borderhg"> </td> + <td class="borderh"> </td> + <td class="cornerhd"></td> + </tr> + <tr> + <td class="borderg"> </td> + <td> + +<h2>La documentation de Artichow</h2> +<p> + Cette documentation vous explique comment utiliser les classes de Artichow. + Vous retrouverez sur le site de Artichow une <a href="http://www.artichow.org/documentation">documentation plus complète</a>, ainsi que des <a href="http://www.artichow.org/tutorial">tutoriels</a>. + Attention, cette documentation est conçue pour la version <em>PHP 5</em> de Artichow, qui est incompatible avec la version <em>PHP 4 & 5</em>. + Vous pouvez retrouver sur le site une <a href="http://www.artichow.org/incompatibility">liste de ces incompatibilités</a> afin de pouvoir utiliser tout de même cette documentation. +</p> + +<h2>Les classes de Artichow</h2> + +<h4>Classes de traitement de l'image</h4> +<ul class='list'> + <li> + <a href='Image.html'>Image</a> + <ul> + <li><a href='Graph.html'>Graph</a></li> + <li><a href='FileImage.html'>FileImage</a></li> + </ul> + </li> + <li><a href='Pattern.html'>Pattern</a></li> +</ul> + +<h4>Classes de traitement des composants</h4> +<ul class='list'> + <li><a href='AntiSpam.html'>AntiSpam</a></li> + <li> + <a href='Component.html'>Component</a> + <ul> + <li> + <a href='ComponentGroup.html'>ComponentGroup</a> + <ul> + <li><a href='PlotGroup.html'>PlotGroup</a></li> + </ul> + </li> + <li><a href='MathPlot.html'>MathPlot</a> (voir aussi <a href='MathFunction.html'>MathFunction</a>)</li> + <li> + <a href='Plot.html'>Plot</a> + <ul> + <li><a href='LinePlot.html'>LinePlot</a></li> + <li><a href='BarPlot.html'>BarPlot</a></li> + <li><a href='ScatterPlot.html'>ScatterPlot</a></li> + </ul> + </li> + <li><a href='Pie.html'>Pie</a></li> + </ul> + </li> +</ul> + +<h4>Classe graphique</h4> +<ul class='list'> + <li><a href='Drawer.html'>Drawer</a></li> +</ul> + +<h4>Classes de dessin</h4> +<ul class='list'> + <li><a href='Color.html'>Color</a></li> + <li> + <a href='Gradient.html'>Gradient</a> + <ul> + <li> + <a href='RadialGradient.html'>RadialGradient</a> + <ul> + <li><a href='BilinearGradient.html'>BilinearGradient</a></li> + </ul> + </li> + <li><a href='LinearGradient.html'>LinearGradient</a></li> + </ul> + </li> + <li> + <a href='Font.html'>Font</a> + <ul> + <li><a href='TTFFont.html'>TTFFont</a></li> + </ul> + </li> + <li><a href='Text.html'>Text</a></li> +</ul> + +<h4>Classes pour le traitement géométrique</h4> +<ul class='list'> + <li> + <a href='Shape.html'>Shape</a> + <ul> + <li><a href='Point.html'>Point</a></li> + <li> + <a href='Line.html'>Line</a> + <ul> + <li><a href='Vector.html'>Vector</a></li> + </ul> + </li> + <li><a href='Polygon.html'>Polygon</a></li> + </ul> + </li> +</ul> + +<h4>Outils d'aide au dessin</h4> +<ul class='list'> + <li><a href='Axis.html'>Axis</a></li> + <li><a href='Grid.html'>Grid</a></li> + <li><a href='Border.html'>Border</a></li> + <li><a href='Label.html'>Label</a></li> + <li><a href='Legend.html'>Legend</a></li> + <li><a href='Mark.html'>Mark</a></li> + <li><a href='Shadow.html'>Shadow</a></li> + <li><a href='Side.html'>Side</a></li> + <li><a href='Tick.html'>Tick</a></li> +</ul> + + </td> + <td class="borderd"> </td> + </tr> + <tr> + <td class="cornerbg"></td> + <td class="borderb"> </td> + <td class="cornerbd"></td> + </tr> + </table> + </div> + </body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/doc/style.css b/maarch_entreprise/trunk/tools/graphic_lib/doc/style.css new file mode 100644 index 0000000000000000000000000000000000000000..793999992f440d952e7b73a7fd88c4f02ae1fde1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/doc/style.css @@ -0,0 +1,383 @@ +body { + font-family: "Trebuchet MS", Geneva, Arial, Helvetica, SunSans-Regular, Verdana, sans-serif; + font-size: 0.75em; + margin: 0px; + padding: 0px; + background-color: #c2d2c4; + background-image: url("image/fond.png"); + background-repeat: repeat-x; + padding-top: 20px; +} + + +a { + color: #000055; + text-decoration: none; +} + +a:hover { + color: #295F37; + text-decoration: underline; +} + +p { + padding-left: 1em; + padding-right: 1em; + text-align: justify; +} + +p:first-letter { + float: left; + font-size: 160%; + font-weight: bold; + color: #646464; + background-color: white; + margin-top: -7px; + margin-right: 3px; + padding-right: 0px; + padding-left: 2px; + margin-bottom: -10px; +} + +pre { + margin: 0px; + padding: 0px; + font-size: 1.25em; +} + +span.php4 { + color: red; + font-weight: bold; +} + +.borderhg { + border-top: 1px solid black; + border-left: 1px solid black; +} + +.borderd { + border-right: 1px solid black; +} + +.borderg { + border-left: 1px solid black; +} + +.borderh { + border-top: 1px solid black; +} + +.borderb { + border-bottom: 1px solid black; +} + + +table#page { + width: 900px; + margin: auto; + text-align: left; +} + +table#page td { + vertical-align: top; +} + +table#page div.logo { + text-align: center; +} + +table#page td table.features td { + vertical-align: middle; +} + +table#menuhaut, table#menubas { + width: 200px; + background-color: white; +} + +table#menuhaut td.cornerhg { + width: 30px; + height: 30px; + background: transparent url("image/coin-hg.gif") no-repeat; +} +table#menubas td.cornerbg { + width: 30px; + height: 30px; + background: url("image/coin-bg.gif") no-repeat; +} + + +div#menu { + border-left: 1px solid black; + background-color: white; +} + + +div#menu ul.ulmenu { + padding: 0px; + margin: 0px; + background-color: #dddddd; +} + +div#menu ul.ulmenu li { + margin: 0px; + list-style-type: none; +} + +div#menu ul.ulmenu a { + display: block; + text-decoration: none; + padding-left: 1em; + color: black; + width: 100%; + border-top: 1px solid black; + +} + +div#menu ul.ulmenu a:hover { + color: #dddddd; + background-color: #a43030; + display: block; +} + +table#contenu { + width: 100%; + color: #2d2d2d; + background-color: white; +} + +table#contenu td.cornerhd, table#contenu td.cornerhg, table#contenu td.cornerbd, table#contenu td.cornerbg { + width: 30px; + height: 30px; +} + +table#contenu td.cornerhd { + background: transparent url("image/coin-hd.gif") no-repeat; +} + +table#contenu td.cornerbd { + background: url("image/coin-bd.gif") no-repeat; +} + +table#contenu td.cornerbg { + background: url("image/coin-bg.gif") no-repeat; +} + +table#contenu table { + width: 95%; + margin: auto; +} + +table#contenu h1 { + text-align: center; + margin: auto; + width: 100%; + color: #a43030; +} + +table#contenu h2:after { + border: 0px; + background-color: transparent; + display: block; + margin-left: -1px; + padding-top: 31px; + width: 97%; + line-height: 1em; + margin-bottom: -25px; + text-align: left; + background: transparent url("image/back-rayures.png") repeat-x; + content: ""; + +} + +table#contenu h4 { + margin-top: 0.3em; + margin-left: 1em; + margin-bottom: 0.5em; + font-size: 1.25em; +} + +table#contenu h5 { + margin-top: 0.3em; + margin-left: 1em; + margin-bottom: 0.5em; + font-size: 1.0em; +} + +table#contenu pre { + margin-left: 1em; +} + +table#contenu ul.features li { + list-style-type: armenian; + margin-left: 3em; +} + +table#contenu div.graph { + padding-top: 8px; + text-align: center; +} + +table#contenu div.graph img { + border: 0px; +} + +table#contenu div.image { + text-align: center; + margin-top: 2em; +} + +table#contenu span.type { + color: #0000FF; +} + +table#contenu span.default { + color: #A000A0; +} + +table#contenu span.interface { + font-weight: bold; +} + +table#contenu span.argument { + color: #880000; +} + +table#contenu span.access { + font-weight: bold; + color: #3B3F3C; + +} + +table#contenu div.description { + margin-right: 3em; + margin-left: 2em; + border: 1px solid #A7BFAD; + padding: 4px; + +} + +table#contenu ul.news li { + list-style-type: none; +} + +table#contenu ul.news li ul li { + list-style-type: square; + margin-left: 20px; +} + +table#contenu div.description ul li { + list-style-type: circle; + font-size: 95%; +} + +table#contenu div.description div.see { + margin-right: 1em; + margin-left: 1em; + background-color: #f0f0f0; + padding: 3px; + +} + +table#contenu div.description div.see ul li { + list-style-type: circle; + margin-bottom: 0em; + margin-top: 0em; + padding-bottom: 0em; + padding-top: 0em; + +} + +table#contenu div.inherit { + border-bottom: 1px solid #a43030; + margin-right: 3em; + margin-left: 2em; + padding: 4px; +} + + +table#contenu ul.doc li.method { +} + +table#contenu ul.doc li.property { +} + +table#contenu ul.doc li { + margin-bottom: 0.5em; + padding: 0.3em; +} + +table#contenu ul { + margin-left: 1.5em; + padding-left: 0px; + padding-right: 1em; +} + +table#contenu ul li { + list-style-type: square; + margin-left: 1em; +} + +table#contenu ul.constants li, table#contenu ul.methods li, table#contenu ul.properties li, +table#contenu ul li.constant, table#contenu ul li.method, table#contenu ul li.property + { + list-style-type: none; + margin-left: 0px; +} + +table#contenu ul.links li { +} + +table#contenu a.easy { + color: red; +} + +div.release { + background-color: #eeeeee; + padding-left: 20px; +} + +div#imagemenu { + background-image: url("mini.php"); + height: 100px; + width: 150px; + margin-left: 25px; + margin-top: 30px; + border: 0px; +} + +td#textebas { + text-align: center; +} + +table#bas { + float:left; + width: 100%; + background-color: white; + margin-top: 10px; +} + +table#bas td.cornerhd, table#bas td.cornerhg, table#bas td.cornerbd, table#bas td.cornerbg { + width: 30px; + height: 30px; +} + +table#bas td.cornerhd { + background: url("image/coin-hd-transparent.gif") no-repeat; +} + +table#bas td.cornerhg { + background: url("image/coin-hg-transparent.gif") no-repeat; +} + +table#bas td.cornerbd { + background: url("image/coin-bd.gif") no-repeat; +} + +table#bas td.cornerbg { + background: url("image/coin-bg.gif") no-repeat; +} + +table#contenu ul.demo li { + list-style-type : circle; +} diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam-image.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam-image.php new file mode 100644 index 0000000000000000000000000000000000000000..68a1d28eb185a6b33b06c72123899b05cdd289ae --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam-image.php @@ -0,0 +1,16 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../AntiSpam.class.php"; + +$object = new AntiSpam(); +$object->setRand(5); +$object->save('example'); +$object->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam-valid.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam-valid.php new file mode 100644 index 0000000000000000000000000000000000000000..c8e4e89f22d34a13947118f6e37020da573a97a8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam-valid.php @@ -0,0 +1,22 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../AntiSpam.class.php"; + +$object = new AntiSpam(); + +if($object->check('example', $_GET['code'])) { + echo "Good value :-)"; +} else { + echo "Bad value :-("; +} +?> +<ul> + <li><a href='AntiSpam.php'>Try again</a></li> +</ul> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam.php new file mode 100644 index 0000000000000000000000000000000000000000..24ed60dd303f9cffdfdc64d42b67f01571f713f7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/AntiSpam.php @@ -0,0 +1,14 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ +?> +<form action="AntiSpam-valid.php" method="get"> +<img src="AntiSpam-image.php" style="vertical-align: middle"/> +<input type="text" name="code"/> +<input type="submit" value="Submit"/> +</form> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/all.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/all.php new file mode 100644 index 0000000000000000000000000000000000000000..242fa0ec4a0cf6621fd6ead8b1ab92abfe9efc17 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/all.php @@ -0,0 +1,57 @@ +<?php +function table($files, $re = NULL) { + + echo "<table cellpadding='4'>"; + + foreach($files as $key => $file) { + + if($key%2 == 0) { + echo "<tr>"; + } + + if($re === NULL or eregi($re, $file)) { + image($file); + } + + if($key%2 == 1) { + echo "</tr>"; + } + + + } + + if($key%2 == 0) { + echo "</tr>"; + } + + echo "</table>"; + +} + +function image($file) { + + echo "<td> + <h3>".$file."</h3> + <a href='".$file."'><img src='".$file."' style='border: 0px'/></a> + </td>"; + +} +?> +<h2>Artichow examples</h2> +<?php +$glob = glob("*.php"); + +table($glob, "[a-z]+\-[0-9]{3}\.php"); +?> +<h2>Artichow.org examples</h2> +<?php +$glob = glob("site/*.php"); + +table($glob); +?> +<h2>Artichow tutorials</h2> +<?php +$glob = glob("tutorials/*.php"); + +table($glob); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-001.php new file mode 100644 index 0000000000000000000000000000000000000000..1bb1056e0364546a4d546578121766da693c2501 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-001.php @@ -0,0 +1,30 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../BarPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->title->set('The title'); +$graph->border->setStyle(LINE_DASHED); +$graph->border->setColor(new DarkGray); + +$values = array(19, 42, 15, -25, 3); + +$plot = new BarPlot($values); +$plot->setSize(1, 0.96); +$plot->setCenter(0.5, 0.52); + +$plot->setBarColor( + new VeryLightPurple(25) +); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-002.php new file mode 100644 index 0000000000000000000000000000000000000000..ef6c2ed68ef7a6e01de63fbcdfd40838a9d1d507 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-002.php @@ -0,0 +1,37 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../BarPlot.class.php"; + +$graph = new Graph(400, 400); + +$values = array(2, 6, 3, 2, 4); + +$plot = new BarPlot($values); + +$plot->setBarGradient( + new LinearGradient( + new LightBlue(25), + new VeryLightOrange(25), + 90 + ) +); + +$plot->setSpace(5, 5, NULL, NULL); + +$plot->barShadow->setSize(4); +$plot->barShadow->setPosition(SHADOW_RIGHT_TOP); +$plot->barShadow->setColor(new Color(180, 180, 180, 10)); +$plot->barShadow->smooth(TRUE); + + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-003.php new file mode 100644 index 0000000000000000000000000000000000000000..2309c3980785018afa6645017f968b348e3eaa27 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-003.php @@ -0,0 +1,37 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../BarPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->title->set('Two bars'); + +$values = array(12, 8, 13, 2, 4); + +$group = new PlotGroup; +$group->setPadding(NULL, NULL, 35, NULL); + +$plot = new BarPlot($values, 1, 2); +$plot->setBarColor(new LightBlue(25)); +$plot->setBarSpace(5); + +$group->add($plot); + +$values = array(1, 7, 2, 10, 6); + +$plot = new BarPlot($values, 2, 2); +$plot->setBarColor(new LightOrange(25)); +$plot->setBarSpace(5); + +$group->add($plot); + +$graph->add($group); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-004.php new file mode 100644 index 0000000000000000000000000000000000000000..fad7778f7b2e5509e2a0192227a2b6df22b8a8f3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-004.php @@ -0,0 +1,36 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../BarPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->title->set('Two bars with depth'); + +$group = new PlotGroup; +$group->setPadding(NULL, NULL, 35, NULL); +$group->setSpace(5, 5, NULL, NULL); + +$group->grid->hide(TRUE); + +$values = array(1, 7, 2, 10, 6, 3, 4, 7); + +$plot = new BarPlot($values, 1, 1, 5); +$plot->setBarColor(new LightBlue(25)); +$group->add($plot); + +$values = array(12, 8, 13, 2, 4, 8, 4, 3); + +$plot = new BarPlot($values, 1, 1, 0); +$plot->setBarColor(new LightRed(25)); +$group->add($plot); + +$graph->add($group); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-005.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-005.php new file mode 100644 index 0000000000000000000000000000000000000000..acec683ec4a278494c2253a68eaf93d39d1011cd --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/bar-005.php @@ -0,0 +1,59 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../BarPlot.class.php"; + +$graph = new Graph(400, 400); + +// Set a title to the graph +$graph->title->set('The title'); + +// Change graph background color +$graph->setBackgroundColor(new Color(230, 230, 230)); + +$values = array(8, 2, 6, 1, 3, 5); + +// Declare a new BarPlot +$plot = new BarPlot($values); + +// Reduce padding around the plot +$plot->setPadding(NULL, NULL, NULL, 20); + +// Reduce plot size and move it to the bottom of the graph +$plot->setSize(1, 0.96); +$plot->setCenter(0.5, 0.52); + +// Set a background color to the plot +$plot->grid->setBackgroundColor(new White); +// Set a dashed grid +$plot->grid->setType(LINE_DASHED); + + +$plot->label->set($values); +$plot->label->move(0, -10); +$plot->label->setColor(new DarkBlue); + +// Set a shadow to the bars +$plot->barShadow->setSize(2); + +// Bar size is at 60% +$plot->setBarSize(0.6); + +// Change the color of the bars +$plot->setBarColor( + new Orange(15) +); + +// Add the plot to the graph +$graph->add($plot); + +// Draw the graph +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/champignon.png b/maarch_entreprise/trunk/tools/graphic_lib/examples/champignon.png new file mode 100644 index 0000000000000000000000000000000000000000..1ab0caf9459a2881abd874231afe82330c91a5a4 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/examples/champignon.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-001.php new file mode 100644 index 0000000000000000000000000000000000000000..56dd49bafdbe28d03bcb86c781030bb603694aaf --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-001.php @@ -0,0 +1,29 @@ +<?php + +require_once "../LinePlot.class.php"; + +$graph = new Graph(400, 400); + +$x = array(1, 10, 3,-4, 1); + +$plot = new LinePlot($x); +$plot->setSpace(6, 6, 10, 10); + +$plot->hideLine(TRUE); +$plot->setFillColor(new Color(180, 180, 180, 75)); + +$plot->mark->setType(MARK_IMAGE); +$plot->mark->setImage(new FileImage("champignon.png")); + +$plot->grid->setBackgroundColor(new Color(235, 235, 180, 60)); + +$plot->label->set($x); +$plot->label->move(0, -23); +$plot->label->setBackgroundGradient(new LinearGradient(new Color(250, 250, 250, 10), new Color(255, 200, 200, 30), 0)); +$plot->label->border->setColor(new Color(20, 20, 20, 20)); +$plot->label->setPadding(3, 1, 1, 0); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-002.php new file mode 100644 index 0000000000000000000000000000000000000000..4bcf5453daa6c0ba2f20c55c00f3e60ef2d8814c --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-002.php @@ -0,0 +1,52 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + + +$graph = new Graph(400, 300); +$graph->setAntiAliasing(TRUE); + +$x = array( + 1, 2, 5, 0.5, 3, 8 +); + +$plot = new LinePlot($x); + +$plot->setSpace(6, 6, 10, 10); +$plot->setXAxisZero(FALSE); + +// Set a background gradient +$plot->setBackgroundGradient( + new LinearGradient( + new Color(210, 210, 210), + new Color(255, 255, 255), + 0 + ) +); + +// Change line color +$plot->setColor(new Color(0, 0, 150, 20)); + +// Set line background gradient +$plot->setFillGradient( + new LinearGradient( + new Color(150, 150, 210), + new Color(230, 230, 255), + 90 + ) +); + +// Change mark type +$plot->mark->setType(MARK_CIRCLE); +$plot->mark->border->show(); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-003.php new file mode 100644 index 0000000000000000000000000000000000000000..1d3532920de4305973074aeb776e1ff6d4bafd35 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-003.php @@ -0,0 +1,44 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + + +$graph = new Graph(400, 300); +$graph->setAntiAliasing(TRUE); + +$x = array( + 1, 2, 5, 0.5, 3, 8, 7, 6, 2, -4 +); + +$plot = new LinePlot($x); + +// Set a background gradient +$plot->setBackgroundGradient( + new LinearGradient( + new Color(210, 210, 210), + new Color(255, 255, 255), + 0 + ) +); + +// Set semi-transparent background gradient +$plot->setFillGradient( + new LinearGradient( + new Color(230, 150, 150, 20), + new Color(230, 230, 180, 50), + 90 + ) +); + +$plot->yAxis->setLabelPrecision(1); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-004.php new file mode 100644 index 0000000000000000000000000000000000000000..c189502a85d857e52dd974946f8f18f68068c5f8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-004.php @@ -0,0 +1,59 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + + +$graph = new Graph(400, 300); +$graph->setAntiAliasing(TRUE); + +$x = array( + 1, 2, 5, 0.5, 3, 8, 7, 6, 2, -4 +); + +$plot = new LinePlot($x); + +// Change component padding +$plot->setPadding(10, NULL, NULL, NULL); + +// Change component space +$plot->setSpace(5, 5, 5, 5); + +// Set a background color +$plot->setBackgroundColor( + new Color(230, 230, 230) +); + +// Change grid background color +$plot->grid->setBackgroundColor( + new Color(235, 235, 180, 60) +); + +// Hide grid +$plot->grid->hide(TRUE); + +// Hide labels on Y axis +$plot->yAxis->label->hide(TRUE); + +$plot->xAxis->label->setInterval(2); + +$plot->label->set($x); +$plot->label->setFormat('%.1f'); +$plot->label->setBackgroundColor(new Color(240, 240, 240, 15)); +$plot->label->border->setColor(new Color(255, 0, 0, 15)); +$plot->label->setPadding(5, 3, 1, 1); + +$plot->xAxis->label->move(0, 5); +$plot->xAxis->label->setBackgroundColor(new Color(240, 240, 240, 15)); +$plot->xAxis->label->border->setColor(new Color(0, 150, 0, 15)); +$plot->xAxis->label->setPadding(5, 3, 1, 1); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-005.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-005.php new file mode 100644 index 0000000000000000000000000000000000000000..b8b78bf9f41c557d772a0c50068f2d2a70c1a3c5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-005.php @@ -0,0 +1,36 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + +$graph = new Graph(400, 300); + +$x = array( + -4, -5, -2, -8, -3, 1, 4, 9, 5, 6, 2 +); + +$plot = new LinePlot($x); + +// Filled an area with a color +$plot->setFilledArea(7, 9, new DarkGreen(25)); + +// Filled the area with a gradient +$gradient = new LinearGradient( + new Yellow(25), + new Orange(25), + 90 +); +$plot->setFilledArea(1, 4, $gradient); + +// Hide first label +$plot->xAxis->label->hideFirst(TRUE); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-006.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-006.php new file mode 100644 index 0000000000000000000000000000000000000000..ca670dc8cdbd7342610241b95e247e11a973378f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-006.php @@ -0,0 +1,49 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + + +// Use cache +$graph = new Graph(400, 400, "Example-006", time() + 5); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + + +$x = array(); +for($i = 0; $i < 10; $i++) { + $x[] = mt_rand(0, 100); +} + +$plot = new LinePlot($x); +$plot->setColor( + new Color(60, 60, 150) +); +$plot->setFillGradient( + new LinearGradient( + new Color(120, 175, 80, 47), + new Color(231, 172, 113, 30), + 0 + ) +); + +$plot->grid->setType(LINE_DASHED); + +$plot->setYMin(-5); + +$plot->yAxis->setLabelNumber(8); +$plot->yAxis->setLabelPrecision(1); + +$plot->xAxis->setNumberByTick('minor', 'major', 3); + +$plot->setXAxisZero(TRUE); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-007.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-007.php new file mode 100644 index 0000000000000000000000000000000000000000..d59c815ae139419edd537c4095994dcd377cb1fb --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-007.php @@ -0,0 +1,67 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + +// Return a random color +function color($a = NULL) { + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +function formatLabel($value) { + return sprintf("%.2f", $value); +} + +$graph = new Graph(450, 400); +$graph->setAntiAliasing(TRUE); +$graph->title->set("Some lines"); + +$group = new PlotGroup; +$group->setXAxisZero(FALSE); +$group->setBackgroundColor(new Color(197, 180, 210, 80)); + +$group->setPadding(40, NULL, 50, NULL); + +$group->axis->left->setLabelNumber(8); +$group->axis->left->setLabelPrecision(1); +$group->axis->left->setTickStyle(TICK_OUT); + +$group->axis->bottom->setTickStyle(TICK_OUT); + +// Display two lines +for($n = 0; $n < 2; $n++) { + + $x = array(); + + for($i = 0; $i < 10; $i++) { + $x[] = (cos($i * M_PI / 5)) / ($n + 1); + } + + $plot = new LinePlot($x); + $plot->setColor(color(10)); // Random line color + $plot->setFillColor(color(90)); // Random background color + + $plot->label->set($x); + $plot->label->setBackgroundColor(new Color(220, 234, 230, 25)); + $plot->label->setPadding(1, 0, 0, 0); + $plot->label->setCallbackFunction("formatLabel"); + $plot->label->setInterval(2); + + $group->add($plot); + $group->legend->add($plot, "Line #".($n + 1), LEGEND_LINE); + +} + +$group->legend->setSpace(12); +$group->legend->setBackgroundColor(new Color(255, 255, 255)); +$group->setPadding(NULL, 100, NULL, NULL); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-008.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-008.php new file mode 100644 index 0000000000000000000000000000000000000000..d20ff682cefa82aca8c7cebe55a16dcbdf9fb98a --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-008.php @@ -0,0 +1,34 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + + +// Use cache +$graph = new Graph(400, 400); +$graph->setAntiAliasing(TRUE); +$graph->border->setStyle(LINE_DOTTED); +$graph->border->setColor(new Red); + +$x = array(); +for($i = 0; $i < 10; $i++) { + $x[] = mt_rand(20, 100); +} + +$plot = new LinePlot($x); +$plot->setFilledArea(0, 1, new Red(40)); +$plot->setFilledArea(1, 2, new LinearGradient(new Red(40), new Orange(40), 90)); +$plot->setFilledArea(2, 4, new LinearGradient(new Orange(40), new Green(40), 90)); +$plot->setFilledArea(4, 7, new LinearGradient(new Green(40), new Blue(40), 90)); +$plot->setFilledArea(7, 8, new LinearGradient(new Blue(40), new Purple(40), 90)); +$plot->setFilledArea(8, 9, new Purple(40)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-009.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-009.php new file mode 100644 index 0000000000000000000000000000000000000000..8319ef42afcb590b5bcda96915e6f0f92b333e35 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-009.php @@ -0,0 +1,66 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + + +$graph = new Graph(400, 200); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setXAxisZero(FALSE); +$group->grid->setType(LINE_DASHED); + +$group->setBackgroundColor(new Color(197, 180, 210, 80)); + +$group->setPadding(40, NULL, 20, NULL); + +$group->axis->left->setLabelNumber(8); +$group->axis->left->setLabelPrecision(1); +$group->axis->left->setTickStyle(TICK_IN); +$group->axis->left->label->move(-4, 0); + +$group->axis->bottom->setTickStyle(TICK_OUT); +$group->axis->bottom->label->move(0, 4); + +$x = array(); + +for($i = 0; $i < 15; $i++) { + $x[] = cos($i * M_PI / 5); +} + +$plot = new LinePlot($x); +$plot->setColor(new Color(40, 40, 150, 10)); +$plot->setFillColor(new Color(40, 40, 150, 90)); + +$group->add($plot); +$group->legend->add($plot, "Ligne #1", LEGEND_LINE); + +$x = array(); + +for($i = 5; $i < 15; $i++) { + $x[] = (cos($i * M_PI / 5)) / 2; +} + +$plot = new LinePlot($x); +$plot->setColor(new Color(120, 120, 30, 10)); +$plot->setFillColor(new Color(120, 120, 30, 90)); + +$group->add($plot); +$group->legend->add($plot, "Ligne #2", LEGEND_LINE); + +$group->legend->setTextFont(new Tuffy(8)); +$group->legend->shadow->setSize(0); +$group->legend->setSpace(12); +$group->legend->setBackgroundColor(new Color(255, 255, 255)); +$group->setPadding(NULL, 100, NULL, NULL); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/line-010.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-010.php new file mode 100644 index 0000000000000000000000000000000000000000..e762363075a74b126a099c1b0b8373942cfc93bb --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/line-010.php @@ -0,0 +1,46 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../LinePlot.class.php"; + +$graph = new Graph(375, 200); + +// Set title +$graph->title->set('Star marks'); +$graph->title->setFont(new Tuffy(12)); +$graph->title->setColor(new DarkRed); + +$plot = new LinePlot(array(5, 3, 4, 7, 6, 5, 8, 4, 7)); + +// Change plot size and position +$plot->setSize(0.76, 1); +$plot->setCenter(0.38, 0.5); + +$plot->setPadding(30, 15, 38, 25); +$plot->setColor(new Orange()); +$plot->setFillColor(new LightOrange(80)); + +// Change grid style +$plot->grid->setType(LINE_DASHED); + +// Add customized marks +$plot->mark->setType(MARK_STAR); +$plot->mark->setFill(new MidRed); +$plot->mark->setSize(6); + +// Change legend +$plot->legend->setPosition(1, 0.5); +$plot->legend->setAlign(LEGEND_LEFT); +$plot->legend->shadow->smooth(TRUE); + +$plot->legend->add($plot, 'My line', LEGEND_MARK); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/math-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-001.php new file mode 100644 index 0000000000000000000000000000000000000000..8fec2517cfe9b4b6027246591d2102e90317da59 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-001.php @@ -0,0 +1,23 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../MathPlot.class.php"; + + +$graph = new Graph(300, 300); + +$plot = new MathPlot(-3, 3, 3, -3); +$plot->setInterval(0.1); + +$function = new MathFunction('cos'); +$plot->add($function); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/math-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-002.php new file mode 100644 index 0000000000000000000000000000000000000000..cd8b5b87e2658aff2a07d4a2d3dc730b3213ff0f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-002.php @@ -0,0 +1,36 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../MathPlot.class.php"; + + +$graph = new Graph(300, 300); + +// Set graph title +$graph->title->set('f(x) = x * x'); +$graph->title->setBackgroundColor(new White(0)); +$graph->title->setPadding(NULL, NULL, 10, 10); +$graph->title->move(0, -10); + +$plot = new MathPlot(-3, 3, 10, -2); +$plot->setInterval(0.2); +$plot->setPadding(NULL, NULL, NULL, 20); + +// Defines x² +function x2($x) { + return $x * $x; +} + +$function = new MathFunction('x2'); +$function->setColor(new Orange); +$plot->add($function); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/math-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-003.php new file mode 100644 index 0000000000000000000000000000000000000000..f6b7915b7a4d4ebae4c1d80fe85ba18a417759cb --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-003.php @@ -0,0 +1,33 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../MathPlot.class.php"; + + +$graph = new Graph(300, 300); + +$plot = new MathPlot(-3, 3, 20, -1); +$plot->setInterval(0.2); +$plot->setPadding(NULL, NULL, NULL, 20); + +$plot->yAxis->setLabelInterval(4); + +$function = new MathFunction('exp'); +$function->setColor(new DarkRed); +$function->mark->setType(MARK_SQUARE); +$function->mark->setSize(3); +$function->mark->setFill(new DarkBlue); +$plot->add($function, "f(x) = exp(x)", LEGEND_MARK); + +$plot->legend->setPosition(0.4, 0.2); +$plot->legend->setPadding(3, 3, 3, 3, 3); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/math-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-004.php new file mode 100644 index 0000000000000000000000000000000000000000..20d1f9c1685cfea50c9e3e9fa73e19b0150ce0b7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-004.php @@ -0,0 +1,39 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../MathPlot.class.php"; + + +$graph = new Graph(300, 300); + +$plot = new MathPlot(-3, 3, 10, -3); +$plot->setInterval(0.2); +$plot->setPadding(NULL, NULL, NULL, 20); + +$function = new MathFunction('exp'); +$function->setColor(new DarkRed); +$function->mark->setType(MARK_SQUARE); +$function->mark->setSize(3); +$function->mark->setFill(new DarkBlue); +$plot->add($function, "f(x) = exp(x)", LEGEND_MARK); + +function x2($x) { + return - $x * $x; +} + +$function = new MathFunction('x2'); +$function->setColor(new DarkBlue); +$plot->add($function, "f(x) = - x * x"); + +$plot->legend->setPosition(0.4, 0.4); +$plot->legend->setPadding(3, 3, 3, 3, 3); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/math-005.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-005.php new file mode 100644 index 0000000000000000000000000000000000000000..85e2a95f68c1ba0ee1a8004c7b4c65fca88dd674 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/math-005.php @@ -0,0 +1,34 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../MathPlot.class.php"; + + +$graph = new Graph(300, 300); + +$plot = new MathPlot(-3, 3, 2, -3); +$plot->setInterval(0.05); + +$function = new MathFunction('sqrt', 0); +$plot->add($function, "sqrt(x)"); + +function x2($x) { + return - $x * $x; +} + +$function = new MathFunction('sin', -2, 2); +$function->setColor(new DarkBlue); +$plot->add($function, "sin(x) (-2 < x < 2)"); + +$plot->legend->setPosition(0.98, 0.8); +$plot->legend->setTextFont(new Tuffy(8)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-001.php new file mode 100644 index 0000000000000000000000000000000000000000..0ebc2831ef660e5e9dfcf8556d26f7011d903e27 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-001.php @@ -0,0 +1,26 @@ +<?php +require_once "../Pattern.class.php"; +require_once "../Graph.class.php"; + +$graph = new Graph(300, 200); + +// Set title +$graph->title->set('Pattern 1'); +$graph->title->move(100, 0); +$graph->title->setFont(new Tuffy(9)); +$graph->title->setColor(new DarkRed); + +$pattern = Pattern::get('BarDepth'); +$pattern->setArgs(array( + 'yForeground' => array(5, 3, 4, 7, 6, 5, 8, 4, 7, NULL, NULL), + 'yBackground' => array(NULL, NULL, 4, 5, 6, 4, 2, 3, 7, 5, 4), + 'legendForeground' => '2003', + 'legendBackground' => '2004' +)); + +$group = $pattern->create(); + +$graph->add($group); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-002.php new file mode 100644 index 0000000000000000000000000000000000000000..35095f1b06d23e048ec6c55af9465fc3406afaa4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-002.php @@ -0,0 +1,23 @@ +<?php +require_once "../Pattern.class.php"; +require_once "../Graph.class.php"; + +$graph = new Graph(300, 200); +$graph->title->set('Customized pattern 1'); +$graph->title->setFont(new Tuffy(12)); + +$pattern = Pattern::get('BarDepth'); +$pattern->setArgs(array( + 'yForeground' => array(5, 3, 4, 7, 6, 5, 8, 4, 7, NULL, NULL), + 'yBackground' => array(NULL, NULL, 4, 5, 6, 4, 2, 3, 7, 5, 4), + 'colorForeground' => new Color(230, 230, 230), + 'colorBackground' => new Color(250, 90, 90) +)); + +$group = $pattern->create(); +$group->legend->setPosition(0.5, 0.78); + +$graph->add($group); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-003.php new file mode 100644 index 0000000000000000000000000000000000000000..973569f0ddd785e0c4b179c273eb2e97f43dd737 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pattern-003.php @@ -0,0 +1,23 @@ +<?php +require_once "../Pattern.class.php"; +require_once "../Graph.class.php"; + +$graph = new Graph(400, 200); + +// Set title +$graph->title->set('Pattern 2'); +$graph->title->setFont(new Tuffy(12)); +$graph->title->setColor(new DarkRed); + +$pattern = Pattern::get('LightLine'); +$pattern->setArgs(array( + 'y' => array(5, 3, 4, 7, 6, 5, 8, 4, 7), + 'legend' => 'John Doe' +)); + +$plot = $pattern->create(); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-001.php new file mode 100644 index 0000000000000000000000000000000000000000..a90ae420dd84ffe88ae5b0ebc7c6a68cb7d2a6b2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-001.php @@ -0,0 +1,40 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); + +$graph->title->set("Pie (example 1)"); + +$values = array(12, 5, 13, 18, 10, 6, 11); + +$plot = new Pie($values, PIE_EARTH); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(10); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.3); +$plot->legend->shadow->setSize(0); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-002.php new file mode 100644 index 0000000000000000000000000000000000000000..d931219cadb1c8fa877e3b4790d58e12bcb42a6c --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-002.php @@ -0,0 +1,41 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 2)"); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values, PIE_EARTH); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(10); +$plot->explode(array(1 => 20, 4 => 26, 0 => 25)); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.3); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-003.php new file mode 100644 index 0000000000000000000000000000000000000000..1718df69c4de99a67f0e5f3380ad6c952a28e362 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-003.php @@ -0,0 +1,42 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 3)"); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values, PIE_AQUA); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(15); +$plot->explode(array(4 => 20, 0 => 30)); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.3); +$plot->legend->setBackgroundColor(new VeryLightGray(30)); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-004.php new file mode 100644 index 0000000000000000000000000000000000000000..ce187084fbe0e5124ba48eaeb4623fd855821e53 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-004.php @@ -0,0 +1,50 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setBackgroundGradient( + new LinearGradient( + new White, + new VeryLightGray, + 0 + ) +); +$graph->title->set("Pie (example 4)"); +$graph->shadow->setSize(7); +$graph->shadow->smooth(TRUE); +$graph->shadow->setPosition(SHADOW_LEFT_BOTTOM); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(10); + + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.3); +$plot->legend->setBackgroundColor(new VeryLightGray(30)); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-005.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-005.php new file mode 100644 index 0000000000000000000000000000000000000000..de7fa0822c12f6d5324bc43117f78fc2af3fc98d --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-005.php @@ -0,0 +1,47 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setBackgroundGradient( + new LinearGradient( + new VeryLightGray, + new White, + 0 + ) +); +$graph->title->set("Pie (example 5) - Initial angle: 140°"); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(10); +$plot->setStartAngle(140); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.3); +$plot->legend->setBackgroundColor(new VeryLightGray(30)); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-006.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-006.php new file mode 100644 index 0000000000000000000000000000000000000000..668b60a9dfb4b4b2db27426b223376695bf63b35 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-006.php @@ -0,0 +1,37 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setBackgroundGradient( + new LinearGradient( + new VeryLightGray, + new White, + 0 + ) +); +$graph->title->set("Pie (example 6)"); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values); +$plot->setCenter(0.5, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(5); +$plot->setBorder(new Black); + + +$plot->legend->hide(TRUE); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-007.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-007.php new file mode 100644 index 0000000000000000000000000000000000000000..3d1028a10f85c386f8eae5b1ea5b77369361ea8e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-007.php @@ -0,0 +1,56 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 7)"); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values, PIE_DARK); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(5); +$plot->setBorder(new White); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.3); +$plot->legend->setBackgroundColor(new VeryLightGray(30)); +$plot->legend->shadow->setPosition(SHADOW_RIGHT_TOP); + +$plot->label->setPadding(2, 2, 2, 2); +$plot->label->border->setColor(new Red(60)); +$plot->label->setFont(new Tuffy(7)); +$plot->label->setBackgroundGradient( + new LinearGradient( + new Red(80), + new White(80), + 0 + ) +); +$plot->setLabelPrecision(1); + + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-008.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-008.php new file mode 100644 index 0000000000000000000000000000000000000000..a7e6bd93156d16229885f1160ff8af467c0a2737 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-008.php @@ -0,0 +1,54 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 300); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 8)"); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values, PIE_EARTH); +$plot->setSize(0.85, 0.60); +$plot->set3D(15); +$plot->setBorder(new LightGray); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->shadow->setSize(3); +$plot->legend->setModel(LEGEND_MODEL_BOTTOM); +$plot->legend->setPosition(NULL, 1.1); + +$plot->label->setPadding(2, 2, 2, 2); +$plot->label->border->setColor(new Red(60)); +$plot->label->setFont(new Tuffy(7)); +$plot->label->setBackgroundGradient( + new LinearGradient( + new Red(80), + new White(80), + 0 + ) +); +$plot->setLabelPrecision(1); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-009.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-009.php new file mode 100644 index 0000000000000000000000000000000000000000..3a8748600c949b6806fb8107c69555d0ed424d60 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-009.php @@ -0,0 +1,49 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 9) - User defined colors"); +$graph->title->border->show(); +$graph->title->setBackgroundColor(new LightRed(60)); +$graph->title->setPadding(3, 3, 3, 3); + +$values = array(8, 4, 6, 3, 4); +$colors = array( + new LightOrange, + new LightPurple, + new LightBlue, + new LightRed, + new LightPink +); + +$plot = new Pie($values, $colors); +$plot->setSize(0.70, 0.60); +$plot->setCenter(0.40, 0.55); +$plot->set3D(10); +$plot->setBorder(new LightGray); + +$plot->setLegend(array( + 'Alpha', + 'Beta', + 'Gamma', + 'Delta', + 'Epsilon' +)); + +$plot->legend->setPosition(1.30); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-010.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-010.php new file mode 100644 index 0000000000000000000000000000000000000000..dc8d6fef6e3e88106da9b46ae36e167375c3235f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-010.php @@ -0,0 +1,29 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); + +$graph->title->set("Pie (example 10) - Just a pie"); +$graph->title->setFont(new Tuffy(10)); + +$values = array(8, 4, 6, 1, 2, 3, 4); + +$plot = new Pie($values); +$plot->set3D(10); + +$plot->legend->hide(TRUE); +$plot->label->hide(TRUE); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-011.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-011.php new file mode 100644 index 0000000000000000000000000000000000000000..8b7b39d9ab4c5d7d42764d4deed9631c5915e4a9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-011.php @@ -0,0 +1,48 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + +function createPie($values, $title, $x, $y) { + + $plot = new Pie($values, PIE_EARTH); + $plot->title->set($title); + $plot->title->setFont(new TuffyBold(8)); + $plot->title->move(NULL, -12); + + $plot->label->setFont(new Tuffy(7)); + $plot->legend->hide(TRUE); + $plot->setLabelPosition(5); + $plot->setSize(0.45, 0.45); + $plot->setCenter($x, $y); + $plot->set3D(10); + $plot->setBorder(new Color(230, 230, 230)); + + return $plot; + +} + +$graph = new Graph(400, 300); + +$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.22, 0.25); +$graph->add($plot); + +$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.68, 0.25); +$graph->add($plot); + +$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.22, 0.75); +$graph->add($plot); + +$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.68, 0.75); +$plot->legend->hide(FALSE); // We print only one legend +$plot->legend->setPosition(1.18, 0); +$graph->add($plot); + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-012.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-012.php new file mode 100644 index 0000000000000000000000000000000000000000..5cdfa4ef19e48819afcfc83088f842e62c2f3da5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-012.php @@ -0,0 +1,38 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + +$graph = new Graph(300, 300); + +$graph->title->set("Pie (example 12)"); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values, PIE_EARTH); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.7, 0.6); +$plot->explode(array(1 => 20, 4 => 25)); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.3); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-013.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-013.php new file mode 100644 index 0000000000000000000000000000000000000000..5d26a686ed135e7434748a8ef03bf73406ad72ee --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-013.php @@ -0,0 +1,40 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 13)"); + +$values = array(12, 5, 13, 18, 10, 6, 11); + +$plot = new Pie($values, PIE_EARTH); +$plot->setCenter(0.4, 0.55); +$plot->setAbsSize(180, 180); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.5); +$plot->legend->shadow->setSize(0); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-014.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-014.php new file mode 100644 index 0000000000000000000000000000000000000000..025bec2d13b4b0434a7cfd171eb31b87f26a4806 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-014.php @@ -0,0 +1,48 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + +function createPie($values, $title, $x, $y) { + + $plot = new Pie($values); + $plot->title->set($title); + $plot->title->setFont(new TuffyBold(8)); + $plot->title->move(NULL, -12); + + $plot->label->setFont(new Tuffy(7)); + $plot->legend->hide(TRUE); + $plot->setLabelPosition(5); + $plot->setSize(0.40, 0.40); + $plot->setCenter($x, $y); + $plot->setBorder(new Black); + + return $plot; + +} + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(TRUE); + +$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.22, 0.25); +$graph->add($plot); + +$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.66, 0.25); +$graph->add($plot); + +$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.22, 0.75); +$graph->add($plot); + +$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.66, 0.75); +$plot->legend->hide(FALSE); // We print only one legend +$plot->legend->setPosition(1.25, 0); +$graph->add($plot); + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-015.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-015.php new file mode 100644 index 0000000000000000000000000000000000000000..7895e707c7231cfd2e493ad47b60398c1be588e2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-015.php @@ -0,0 +1,50 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 300); +$graph->setBackgroundGradient( + new LinearGradient( + new VeryLightGray, + new White, + 0 + ) +); +$graph->title->set("Pie (example 15) - Arbitrary labels"); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.6, 0.6 * 4 / 3); + +$plot->label->set(array( + 'Arthur', 'Abel', 'Bernard', 'Thierry', 'Paul', 'Gaston', 'Joe' +)); +$plot->label->setCallbackFunction(NULL); // We must disable the default callback function + +$plot->setLegend(array( + 'ABC', + 'DEF', + 'GHI', + 'JKL', + 'MNO', + 'PQR', + 'STU' +)); + +$plot->legend->setPosition(1.3); +$plot->legend->setBackgroundColor(new VeryLightGray(30)); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-016.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-016.php new file mode 100644 index 0000000000000000000000000000000000000000..82e94ac86ce0569dddc3ed64e09d25047c877847 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-016.php @@ -0,0 +1,45 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 13) - Adjusting labels"); + +$values = array(16, 9, 13, 23, 10); + +$plot = new Pie($values, PIE_EARTH); +$plot->setCenter(0.4, 0.55); +$plot->setAbsSize(220, 220); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->setLabelPosition(-40); +$plot->label->setPadding(2, 2, 2, 2); +$plot->label->setFont(new Tuffy(7)); +$plot->label->setBackgroundColor(new White(60)); + +$plot->legend->setPosition(1.3); +$plot->legend->shadow->setSize(0); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-017.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-017.php new file mode 100644 index 0000000000000000000000000000000000000000..3bbe8c66a4f67ecfc1bb6267e2d60daaf4df335e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-017.php @@ -0,0 +1,48 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 17)"); +$graph->title->setFont(new Tuffy(14)); + +$values = array(12, 16, 13, 18, 10, 20, 11); + +$plot = new Pie($values, PIE_AQUA); +$plot->setCenter(0.4, 0.55); +$plot->setAbsSize(180, 180); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$explode = array(); +for($i = 0; $i < count($values); $i++) { + $explode[] = 15; +} + +$plot->explode($explode); + +$plot->legend->setPosition(1.5); +$plot->legend->shadow->setSize(0); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-018.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-018.php new file mode 100644 index 0000000000000000000000000000000000000000..1c4817dc4de8e34b215967f58cb9ce6f2bd19fd4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/pie-018.php @@ -0,0 +1,32 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../Pie.class.php"; + + +$graph = new Graph(400, 250); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Pie (example 18) - Display labels > 10 %"); +$graph->title->setFont(new Tuffy(14)); + +$values = array(1, 5, 6, 16, 18, 19, 21, 3, 4, 7, 6); + +$plot = new Pie($values); +$plot->setCenter(0.4, 0.55); +$plot->setAbsSize(180, 180); +$plot->setLabelMinimum(10); + +$plot->legend->setPosition(1.5); +$plot->legend->shadow->setSize(0); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-001.php new file mode 100644 index 0000000000000000000000000000000000000000..efdc5b7c468ebacf0e76fee91770deac216573bf --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-001.php @@ -0,0 +1,20 @@ +<?php + +require_once "../ScatterPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->title->set('Simple ScatterPlot'); + +$y = array(1, 10, 3,-4, 1, 4, 8, 7); +$x = array(0.5, 0.5, 3, 5, 2, 3, 4, 1.5); + +$plot = new ScatterPlot($y, $x); +$plot->setBackgroundColor(new VeryLightGray); +$plot->setPadding(NULL, NULL, 40, 20); + +$plot->legend->add($plot, 'Some points', LEGEND_MARKONLY); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-002.php new file mode 100644 index 0000000000000000000000000000000000000000..aedaa423e2c05bdbfda2085708702e3f6f5c1f71 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-002.php @@ -0,0 +1,20 @@ +<?php + +require_once "../ScatterPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->title->set('Linked ScatterPlot'); + +$y = array(1, 10, 3,-4, 1, 4, 8, 7); +$x = array(0.5, 0.5, 3, 5, 2, 3, 4, 1.5); + +$plot = new ScatterPlot($y, $x); +$plot->setBackgroundColor(new VeryLightGray); +$plot->setPadding(NULL, NULL, 40, 20); + +$plot->link(TRUE, new DarkBlue); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-003.php new file mode 100644 index 0000000000000000000000000000000000000000..b4ce40171b4071c04afe338987a27f8ca6be5de7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-003.php @@ -0,0 +1,29 @@ +<?php + +require_once "../ScatterPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->shadow->setSize(5); +$graph->title->set('ScatterPlot with values'); + +$y = array(4, 3, 2, 5, 8, 1, 3, 6, 4, 5); +$x = array(1, 2, 5, 4, 3, 6, 2, 4, 5, 1); + +$plot = new ScatterPlot($y, $x); +$plot->setSpace(6, 6, 6, 0); +$plot->setPadding(NULL, NULL, 40, 20); + +// Set dashed lines on the grid +$plot->grid->setType(LINE_DASHED); + +$plot->mark->setSize(30); +$plot->mark->setFill(new DarkOrange(20)); + + +$plot->label->set($y); +$plot->label->setColor(new White); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-004.php new file mode 100644 index 0000000000000000000000000000000000000000..ec50874e075c8694b08e01e4cd5c4cc68c22bcb0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-004.php @@ -0,0 +1,31 @@ +<?php + +require_once "../ScatterPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->shadow->setSize(5); + +$y = array(); +for($i = 0; $i < 60; $i++) { + $y[] = cos($i / 30 * 2 * M_PI); +} + +$plot = new ScatterPlot($y); +$plot->setSpace(6, 6); + +// Set impulses +$plot->setImpulse(new DarkGreen); + +$plot->grid->hideVertical(); + +// Hide axis labels and ticks +$plot->xAxis->label->hide(); +$plot->xAxis->hideTicks(); + +$plot->mark->setType(MARK_SQUARE); +$plot->mark->setSize(4); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-005.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-005.php new file mode 100644 index 0000000000000000000000000000000000000000..14469c2c2b855f19b941d7120434dad9603ad85b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-005.php @@ -0,0 +1,36 @@ +<?php + +require_once "../ScatterPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->title->set('Impulses'); +$graph->title->move(0, 30); +$graph->shadow->setSize(5); + +$y = array(); +for($i = 0; $i < 60; $i++) { + $y[] = cos($i / 30 * 2 * M_PI) / (1.5 + $i / 15); +} + +$plot = new ScatterPlot($y); +$plot->setBackgroundColor(new VeryLightOrange); +$plot->setSpace(5); + +// Set impulses +$plot->setImpulse(new DarkBlue); + +$plot->grid->hideVertical(); + +// Hide ticks +$plot->xAxis->hideTicks(); + +// Change labels interval +$plot->xAxis->label->setInterval(5); + +$plot->mark->setType(MARK_SQUARE); +$plot->mark->setSize(4); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-006.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-006.php new file mode 100644 index 0000000000000000000000000000000000000000..1b647d14700115986b38b45889dd9ca5426276fd --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-006.php @@ -0,0 +1,39 @@ +<?php + +require_once "../ScatterPlot.class.php"; + +$graph = new Graph(400, 400); + +$center = 5; + +$x = array(); +$y = array(); + +for($i = 0; $i <= 30; $i++) { + $rad = ($i / 30) * 2 * M_PI; + $x[] = $center + cos($rad) * $center; + $y[] = $center + sin($rad) * $center; +} + +$plot = new ScatterPlot($y, $x); +$plot->setBackgroundColor(new VeryLightGray); +$plot->setPadding(30, 30, 30, 30); +$plot->setSpace(5, 5, 5, 5); + +$plot->link(TRUE, new DarkGreen); + +$plot->mark->setFill(new DarkOrange); +$plot->mark->setType(MARK_SQUARE, 4); + +$plot->setXAxis(PLOT_BOTH); +$plot->setXAxisZero(FALSE); +$plot->setYAxis(PLOT_BOTH); + +$plot->legend->add($plot, 'A circle', LEGEND_MARK); +$plot->legend->setPosition(0.5, 0.5); +$plot->legend->setAlign(LEGEND_CENTER, LEGEND_MIDDLE); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-007.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-007.php new file mode 100644 index 0000000000000000000000000000000000000000..3e025e534074a26778902a7211f3defc86de6fdb --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/scatter-007.php @@ -0,0 +1,60 @@ +<?php + +require_once "../ScatterPlot.class.php"; + +$graph = new Graph(400, 400); + +$group = new PlotGroup; + +$group->setBackgroundColor(new VeryLightGray); +$group->setPadding(30, 30, 30, 30); +$group->setSpace(5, 5, 5, 5); + +$group->legend->setPosition(0.5, 0.62); +$group->legend->setAlign(LEGEND_CENTER, LEGEND_MIDDLE); + +function getCircle($size) { + + $center = 0; + + $x = array(); + $y = array(); + + for($i = 0; $i <= 30; $i++) { + $rad = ($i / 30) * 2 * M_PI; + $x[] = $center + cos($rad) * $size; + $y[] = $center + sin($rad) * $size; + } + + return array($x, $y); + +} + +list($x, $y) = getCircle(3); + +$plot = new ScatterPlot($y, $x); + +$plot->link(TRUE, new DarkBlue); + +$plot->mark->setFill(new DarkPink); +$plot->mark->setType(MARK_CIRCLE, 6); + +$group->legend->add($plot, 'Circle #1', LEGEND_MARK); +$group->add($plot); + +list($x, $y) = getCircle(5); + +$plot = new ScatterPlot($y, $x); + +$plot->link(TRUE, new DarkGreen); + +$plot->mark->setFill(new DarkOrange); +$plot->mark->setType(MARK_SQUARE, 4); + +$group->legend->add($plot, 'Circle #2', LEGEND_MARK); +$group->add($plot); + +$graph->add($group); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-001.php new file mode 100644 index 0000000000000000000000000000000000000000..168b2c7fd1366dda0df3405ce15e5d20a1f6ee57 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-001.php @@ -0,0 +1,79 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + + +$graph = new Graph(280, 200); +$graph->setAntiAliasing(TRUE); + +$x = array( + 1, 2, 5, 0.5, 3, 8, 6 +); + +$plot = new BarPlot($x); + +$plot->setSpace(4, 4, 10, 0); +$plot->setPadding(40, 15, 10, 40); + +$plot->title->set("Zoé and friends"); +$plot->title->setFont(new TuffyBold(11)); +$plot->title->border->show(); +$plot->title->setBackgroundColor(new Color(255, 255, 255, 25)); +$plot->title->setPadding(4, 4, 4, 4); +$plot->title->move(-20, 25); + +$plot->yAxis->title->set("Axe des Y"); +$plot->yAxis->title->setFont(new TuffyBold(10)); +$plot->yAxis->title->move(-4, 0); +$plot->yAxis->setTitleAlignment(LABEL_TOP); + +$plot->xAxis->title->set("Axe des X"); +$plot->xAxis->title->setFont(new TuffyBold(10)); +$plot->xAxis->setTitleAlignment(LABEL_RIGHT); + +$plot->setBackgroundGradient( + new LinearGradient( + new Color(230, 230, 230), + new Color(255, 255, 255), + 0 + ) +); + +$plot->barBorder->setColor(new Color(0, 0, 150, 20)); + +$plot->setBarGradient( + new LinearGradient( + new Color(150, 150, 210, 0), + new Color(230, 230, 255, 30), + 0 + ) +); + +$y = array( + 'Zoé', + 'Yvan', + 'Fred', + 'Lucie', + 'Ilia', + 'Nino', + 'Marie' +); + +$plot->xAxis->setLabelText($y); +$plot->xAxis->label->setFont(new TuffyBold(7)); + +$graph->shadow->setSize(4); +$graph->shadow->setPosition(SHADOW_LEFT_TOP); +$graph->shadow->smooth(TRUE); +$graph->shadow->setColor(new Color(160, 160, 160)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-002.php new file mode 100644 index 0000000000000000000000000000000000000000..9d3f9c8bcd46c628109e55c06e75d944e66525bc --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-002.php @@ -0,0 +1,64 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +$graph = new Graph(280, 240); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setSpace(6, 6, 5, 5); +$group->setBackgroundColor(new Color(235, 235, 235)); +$group->setPadding(40, 10, 10, 10); + +$group->axis->left->setLabelPrecision(2); +$group->axis->bottom->label->hide(TRUE); +$group->axis->bottom->hideTicks(TRUE); + +$gradients = array( + new LinearGradient( + new Color(30, 30, 160, 10), new Color(120, 120, 160, 10), 0 + ), + new LinearGradient( + new Color(30, 160, 30, 10), new Color(120, 160, 120, 10), 0 + ), + new LinearGradient( + new Color(160, 30, 30, 10), new Color(160, 120, 120, 10), 0 + ) +); + +for($n = 0; $n < 3; $n++) { + + $x = array(); + + for($i = 0; $i < 6; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 900) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0); + } + + $plot = new BarPlot($x, $n + 1, 3); + $plot->barBorder->hide(); + + $plot->setXAxis(PLOT_BOTTOM); + +// $plot->setBarPadding(3, 3); + $plot->barShadow->setSize(4); + $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); + $plot->barShadow->setColor(new Color(255, 255, 255, 10)); + $plot->barShadow->smooth(TRUE); + + $plot->setBarGradient($gradients[$n]); + + $group->add($plot); + +} + + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-003.php new file mode 100644 index 0000000000000000000000000000000000000000..6388f7a3577d81706403121267183cc1a17924d4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-003.php @@ -0,0 +1,72 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(300, 200); +$graph->setAntiAliasing(TRUE); +$graph->border->hide(); + +$group = new PlotGroup; +$group->setSpace(5, 10, 20, 15); +$group->setPadding(40, 10, NULL, 20); +$group->setXAxisZero(FALSE); + +$group->axis->left->setLabelPrecision(2); + +$colors = array( + new Color(100, 180, 154, 12), + new Color(100, 154, 180, 12), + new Color(154, 100, 180, 12), + new Color(180, 100, 154, 12) +); + +for($n = 0; $n < 4; $n++) { + + $x = array(); + + for($i = 0; $i < 6; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 1400) / 1000 - 0.5); + } + + $plot = new BarPlot($x, 1, 1, (3 - $n) * 7); + $plot->barBorder->setColor(new Color(0, 0, 0)); + + $plot->setBarSize(0.54); + + $plot->barShadow->setSize(3); + $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); + $plot->barShadow->setColor(new Color(160, 160, 160, 10)); + $plot->barShadow->smooth(TRUE); + + $plot->setBarColor($colors[$n]); + + $group->add($plot); + $group->legend->add($plot, "Barre #".$n, LEGEND_BACKGROUND); + +} + +$group->legend->shadow->setSize(0); +$group->legend->setAlign(LEGEND_CENTER); +$group->legend->setSpace(6); +$group->legend->setTextFont(new Tuffy(8)); +$group->legend->setPosition(0.50, 0.12); +$group->legend->setBackgroundColor(new Color(255, 255, 255, 25)); +$group->legend->setColumns(2); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-004.php new file mode 100644 index 0000000000000000000000000000000000000000..dcd1736989d9e99db25507eac3d347e671d5b547 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-004.php @@ -0,0 +1,91 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +function labelFormat($value) { + return round($value, 2); +} + +$graph = new Graph(280, 200); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setSpace(5, 5, 15, 0); +$group->setPadding(40, 40); + +$group->axis->left->setLabelPrecision(2); +$group->axis->right->setLabelPrecision(2); + +$colors = array( + new Color(80, 105, 190, 10), + new Color(105, 190, 80, 10) +); + +$darkColor = array( + new Color(40, 55, 120, 10), + new Color(55, 120, 40, 10) +); + +$axis = array( + PLOT_LEFT, + PLOT_RIGHT +); + +$group->axis->left->setColor($darkColor[0]); +$group->axis->left->label->setColor($darkColor[0]); +$group->axis->right->setColor($darkColor[1]); +$group->axis->right->label->setColor($darkColor[1]); + +$group->setBackgroundGradient( + new LinearGradient( + new Color(225, 225, 225), + new Color(255, 255, 255), + 0 + ) +); + +for($n = 0; $n < 2; $n++) { + + $x = array(); + + for($i = 0; $i < 4; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0) + 1; + } + + $plot = new BarPlot($x, $n+1, 2); + $plot->barBorder->setColor(new Color(0, 0, 0, 30)); + + $plot->setBarPadding(0.1, 0.1); + $plot->setBarSpace(5); + + $plot->barShadow->setSize(3); + $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); + $plot->barShadow->setColor(new Color(180, 180, 180, 10)); + $plot->barShadow->smooth(TRUE); + + $plot->label->set($x); + $plot->label->move(0, -6); + $plot->label->setFont(new Tuffy(7)); + $plot->label->setAngle(90); + $plot->label->setAlign(NULL, LABEL_TOP); + $plot->label->setPadding(3, 1, 0, 6); + $plot->label->setCallbackFunction("labelFormat"); + + $plot->setBarColor($colors[$n]); + + $plot->setYAxis($axis[$n]); + + $group->add($plot); + +} + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-005.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-005.php new file mode 100644 index 0000000000000000000000000000000000000000..899f776f08c72e001a26bab8c3a4aa45884600da --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/bar-005.php @@ -0,0 +1,81 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +$graph = new Graph(300, 200); +$graph->setAntiAliasing(TRUE); +$graph->border->hide(); + +$group = new PlotGroup; +$group->grid->hide(TRUE); +$group->setSpace(2, 2, 20, 0); +$group->setPadding(30, 10, NULL, NULL); + +$colors = array( + new Orange(25), + new LightBlue(10) +); + +for($n = 0; $n < 2; $n++) { + + $x = array(); + + for($i = 0; $i < 3 - $n * 3; $i++) { + $x[] = NULL; + } + + for($i = 3 - ($n * 3); $i < 12 - ($n * 3); $i++) { + $x[] = cos($i * M_PI / 100) * mt_rand(800, 1200) / 1000 * (((1 - $n) * 5 + 10) / 10); + } + + for($i = 0; $i < $n * 3; $i++) { + $x[] = NULL; + } + + $plot = new BarPlot($x, 1, 1, (1 - $n) * 6); + +// $plot->setBarPadding(2, 2); + + $plot->barShadow->setSize(2); + $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); + $plot->barShadow->setColor(new Color(160, 160, 160, 10)); + $plot->barShadow->smooth(TRUE); + + $plot->setBarColor($colors[$n]); + + $group->add($plot); + $group->legend->add($plot, $n + date('Y'), LEGEND_BACKGROUND); + +} + +function setPc($value) { + return round($value * 10).'%'; +} + +$group->axis->left->label->setCallbackFunction('setPc'); + +$months = array( + "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" +); + +$group->axis->bottom->setLabelText($months); +$group->axis->bottom->hideTicks(TRUE); + +$group->legend->shadow->setSize(0); +$group->legend->setAlign(LEGEND_CENTER); +$group->legend->setSpace(6); +$group->legend->setTextFont(new Tuffy(8)); +$group->legend->setPosition(0.50, 0.10); +$group->legend->setBackgroundColor(new Color(255, 255, 255, 25)); +$group->legend->setColumns(2); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/canvas-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/canvas-001.php new file mode 100644 index 0000000000000000000000000000000000000000..5e577b92cc5a6e71437d42c136de93ab1410162e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/canvas-001.php @@ -0,0 +1,68 @@ +<?php + +require_once "../../Graph.class.php"; + +$graph = new Graph(300, 200); + +$drawer = $graph->getDrawer(); + +$drawer->filledRectangle( + new Color(230, 230, 230, 0), + new Line( + new Point(10, 10), + new Point(200, 150) + ) +); + +for($i = 7; $i < 400; $i += 15) { + $drawer->line( + new Color(0, 0, 0), + new Line( + new Point($i, 0 + 50), + new Point($i, 30 + 50) + ) + ); +} + +for($i = 7; $i < 30; $i += 15) { + $drawer->line( + new Color(0, 0, 0), + new Line( + new Point(0, $i + 50), + new Point(400, $i + 50) + ) + ); +} + +$drawer->filledRectangle( + new Color(0, 100, 200, 50), + new Line( + new Point(100, 100), + new Point(280, 180) + ) +); + +$debut = new Color(230, 250, 0); +$fin = new Color(255, 255, 255, 100); + +$drawer->filledEllipse( + new RadialGradient( + $debut, + $fin + ), + new Point(105, 135), + 90, 90 +); + +$text = new Text( + "Artichow !", + new Tuffy(15), + new Color(0, 0, 80), + 45 +); + +$drawer->string($text, new Point(210, 75)); + +$graph->draw(); + +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/impulse-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/impulse-001.php new file mode 100644 index 0000000000000000000000000000000000000000..1257e35f53e3b86f47c72dd44527b8233c8a7f82 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/impulse-001.php @@ -0,0 +1,35 @@ +<?php + +require_once "../../ScatterPlot.class.php"; + +$graph = new Graph(300, 200); +$graph->title->set('Impulses'); +$graph->shadow->setSize(4); + +$y = array(); +for($i = 0; $i < 40; $i++) { + $y[] = cos($i / 15 * 2 * M_PI) / (0.8 + $i / 15) * 4; +} + +$plot = new ScatterPlot($y); +$plot->setPadding(25, 15, 35, 15); +$plot->setBackgroundColor(new Color(230, 230, 255)); +$plot->setSpace(2, 2); + +// Set impulses +$plot->setImpulse(new DarkBlue); + +$plot->grid->hideVertical(); +$plot->grid->setType(LINE_DASHED); + +// Hide ticks +$plot->xAxis->hideTicks(); +$plot->xAxis->label->hide(); + +$plot->mark->setType(MARK_SQUARE); +$plot->mark->setSize(4); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-001.php new file mode 100644 index 0000000000000000000000000000000000000000..a879a5b49d592d01d0ac3a8b2ad9b31732383c4c --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-001.php @@ -0,0 +1,70 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(300, 175); +$graph->setAntiAliasing(TRUE); + +$x = array( + 3, 1, 5, 6, 3, 8, 6 +); + +$plot = new LinePlot($x); + +$plot->grid->setNoBackground(); + +$plot->title->set("Filled line and marks"); +$plot->title->setFont(new Tuffy(10)); +$plot->title->setBackgroundColor(new Color(255, 255, 255, 25)); +$plot->title->border->show(); +$plot->title->setPadding(3, 3, 3, 3); +$plot->title->move(-20, 25); + +$plot->setSpace(4, 4, 10, 0); +$plot->setPadding(25, 15, 10, 18); + +$plot->setBackgroundGradient( + new LinearGradient( + new Color(210, 210, 210), + new Color(255, 255, 255), + 0 + ) +); + +$plot->setColor(new Color(0, 0, 150, 20)); + +$plot->setFillGradient( + new LinearGradient( + new Color(150, 150, 210), + new Color(245, 245, 245), + 0 + ) +); + +$plot->mark->setType(MARK_CIRCLE); +$plot->mark->border->show(); + +$y = array( + 'Lundi', + 'Mardi', + 'Mercredi', + 'Jeudi', + 'Vendredi', + 'Samedi', + 'Dimanche' +); + +$plot->xAxis->setLabelText($y); +$plot->xAxis->label->setFont(new Tuffy(7)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-002.php new file mode 100644 index 0000000000000000000000000000000000000000..054c23def52e0e13c7a1929079682a75e246421e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-002.php @@ -0,0 +1,61 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(300, 175); +$graph->setAntiAliasing(TRUE); + +$x = array( + 4, 3, 1, 0, -2, 1, 3, 2, 3, 5, 4, 1 +); + +$plot = new LinePlot($x); +$plot->setXAxisZero(FALSE); + +$plot->grid->hide(TRUE); + +$plot->title->set("Using dashed line and legend"); +$plot->title->setFont(new TuffyItalic(9)); +$plot->title->setBackgroundColor(new Color(255, 255, 255, 50)); +$plot->title->setPadding(3, 3, 3, 3); +$plot->title->move(0, 20); + +$plot->setSpace(6, 6, 10, 10); +$plot->setPadding(30, 10, 15, 25); + +$plot->setBackgroundColor( + new Color(245, 245, 245) +); + +$plot->setStyle(LINE_DASHED); +$plot->setColor(new Color(0, 150, 0, 20)); + +$plot->setFillGradient( + new LinearGradient( + new Color(220, 220, 150, 40), + new Color(255, 255, 210, 30), + 0 + ) +); + +$graph->shadow->setSize(4); +$graph->shadow->setPosition(SHADOW_LEFT_BOTTOM); +$graph->shadow->smooth(TRUE); + +$plot->legend->add($plot, "Apples"); +$plot->legend->shadow->setSize(0); +$plot->legend->setAlign(LEGEND_CENTER, LEGEND_TOP); +$plot->legend->setPosition(0.75, 0.60); +$plot->legend->setTextFont(new Tuffy(8)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-003.php new file mode 100644 index 0000000000000000000000000000000000000000..e20455e1de059076721a19adc5ef71ac112ceed5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-003.php @@ -0,0 +1,71 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +$graph = new Graph(280, 200); + + +$x = array(); +for($i = 115; $i < 115 + 180; $i++) { + $x[] = cos($i / 25); +} + +function format($value) { + return sprintf("%.1f", $value).' %'; +} + +$plot = new LinePlot($x); + +$plot->setBackgroundColor( + new Color(240, 240, 240) +); + +$plot->setPadding(40, 15, 15, 15); + +$plot->setColor( + new Color(60, 60, 150) +); + +$plot->setFillColor( + new Color(120, 175, 80, 47) +); + +$plot->grid->setType(LINE_DASHED); + +$plot->yAxis->setLabelNumber(6); +$plot->yAxis->setLabelPrecision(1); +$plot->yAxis->setNumberByTick('minor', 'major', 1); +$plot->yAxis->label->setCallbackFunction('format'); +$plot->yAxis->label->setFont(new Tuffy(7)); + +$plot->xAxis->setNumberByTick('minor', 'major', 3); +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->setLabelInterval(50); +$plot->xAxis->label->setFont(new Tuffy(7)); + +$plot->grid->setInterval(1, 50); + +$graph->shadow->setSize(4); +$graph->shadow->setPosition(SHADOW_RIGHT_BOTTOM); +$graph->shadow->smooth(TRUE); + +$plot->label->set($x); +$plot->label->setInterval(25); +$plot->label->hideFirst(TRUE); +$plot->label->setPadding(1, 1, 1, 1); +$plot->label->setCallbackFunction('format'); +$plot->label->setBackgroundColor( + new Color(227, 223, 241, 15) +); +$plot->label->setFont(new Tuffy(7)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-004.php new file mode 100644 index 0000000000000000000000000000000000000000..0421935a151402ffda4fee48cec4c032d88fa780 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-004.php @@ -0,0 +1,103 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; +require_once "../../BarPlot.class.php"; + + + +$graph = new Graph(600, 250); +$graph->setBackgroundColor(new Color(0xF4, 0xF4, 0xF4)); +$graph->shadow->setSize(3); + +$graph->title->set("Evolution"); +$graph->title->setFont(new Tuffy(15)); +$graph->title->setColor(new Color(0x00, 0x00, 0x8B)); + + +$group = new PlotGroup; +$group->setSize(0.82, 1); +$group->setCenter(0.41, 0.5); +$group->setPadding(35, 26, 40, 27); +$group->setSpace(2, 2); + +$group->grid->setColor(new Color(0xC4, 0xC4, 0xC4)); +$group->grid->setType(LINE_DASHED); +$group->grid->hideVertical(TRUE); +$group->grid->setBackgroundColor(new White); + +$group->axis->left->setColor(new DarkGreen); +$group->axis->left->label->setFont(new Font2); + +$group->axis->right->setColor(new DarkBlue); +$group->axis->right->label->setFont(new Font2); + +$group->axis->bottom->label->setFont(new Font2); + +$group->legend->setPosition(1.18); +$group->legend->setTextFont(new Tuffy(8)); +$group->legend->setSpace(10); + +// Add a bar plot +$x = array(16, 16, 12, 13, 11, 18, 10, 12, 11, 12, 11, 16); + +$plot = new BarPlot($x, 1, 2); +$plot->setBarColor(new MidYellow); +$plot->setBarPadding(0.15, 0.15); +$plot->barShadow->setSize(3); +$plot->barShadow->smooth(TRUE); +$plot->barShadow->setColor(new Color(200, 200, 200, 10)); +$plot->move(1, 0); + +$group->legend->add($plot, "Yellow bar", LEGEND_BACKGROUND); +$group->add($plot); + +// Add a bar plot +$x = array(20, 25, 20, 18, 16, 25, 29, 12, 15, 18, 21, 26); + +$plot = new BarPlot($x, 2, 2); +$plot->setBarColor(new Color(120, 175, 80, 10)); +$plot->setBarPadding(0.15, 0.15); +$plot->barShadow->setSize(3); +$plot->barShadow->smooth(TRUE); +$plot->barShadow->setColor(new Color(200, 200, 200, 10)); + +$group->legend->add($plot, "Green bar", LEGEND_BACKGROUND); +$group->add($plot); + +// Add a second bar plot +$x = array(12, 14, 10, 9, 10, 16, 12, 8, 8, 10, 12, 13); + +$plot = new BarPlot($x, 2, 2); +$plot->setBarColor(new Orange); +$plot->setBarPadding(0.15, 0.15); + +$group->legend->add($plot, "Orange bar", LEGEND_BACKGROUND); +$group->add($plot); + +// Add a line plot +$x = array(6, 5, 6, 5.5, 4.5, 4, 4.5, 4, 5, 4, 5, 5.5); + +$plot = new LinePlot($x, LINEPLOT_MIDDLE); +$plot->setColor(new DarkBlue); +$plot->setThickness(5); +$plot->setYAxis(PLOT_RIGHT); +$plot->setYMax(12); + +$plot->mark->setType(MARK_CIRCLE); +$plot->mark->setSize(6); +$plot->mark->setFill(new LightBlue); +$plot->mark->border->show(); + +$group->legend->add($plot, "Blue line", LEGEND_MARK); +$group->add($plot); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-006.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-006.php new file mode 100644 index 0000000000000000000000000000000000000000..1e6cd87667c9054b794ca521e28c01c64ec70f10 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-006.php @@ -0,0 +1,57 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(300, 200); +$graph->setAntiAliasing(TRUE); + +$x = array( + -4, -5, -2, -8, -3, 1, 4, 9, 5, 6, 2 +); + +$plot = new LinePlot($x); +$plot->setStyle(LINE_DASHED); + +$plot->setSpace(4, 4, 10, 0); +$plot->setPadding(25, 15, 10, 18); + +$plot->setBackgroundGradient( + new LinearGradient( + new Color(230, 230, 230), + new Color(255, 255, 255), + 90 + ) +); + +$plot->setFilledArea(7, 9, new Red(25)); +$plot->setFilledArea(1, 4, new Yellow(25)); + +$plot->setColor(new Color(0, 0, 150, 20)); + +$plot->grid->setColor(new VeryLightGray); + +$plot->mark->setType(MARK_SQUARE); +$plot->mark->setSize(4); +$plot->mark->setFill(new VeryDarkGreen(30)); +$plot->mark->border->show(); +$plot->mark->border->setColor(new DarkBlue(60)); + +$plot->xAxis->label->hide(TRUE); +$plot->xAxis->setNumberByTick('minor', 'major', 3); + +$plot->yAxis->setLabelNumber(8); + +$plot->legend->add($plot, "My line"); +$plot->legend->setPosition(0.9, 0.77); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-007.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-007.php new file mode 100644 index 0000000000000000000000000000000000000000..2161a04dacb20541da95bac0aefa1b387e2ead04 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/line-007.php @@ -0,0 +1,69 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(300, 200); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->grid->setType(LINE_DASHED); + +$group->setPadding(40, NULL, 20, NULL); + +$group->axis->left->setLabelNumber(8); +$group->axis->left->setLabelPrecision(1); +$group->axis->left->setTickStyle(TICK_OUT); + +$x = array(2, 4, 8, 16, 32, 48, 56, 60, 62); + +$plot = new LinePlot($x); +$plot->setColor(new Orange()); +$plot->setFillColor(new LightOrange(80)); + +$plot->mark->setType(MARK_CIRCLE); +$plot->mark->setFill(new MidRed); +$plot->mark->setSize(6); + +$group->legend->add($plot, "John", LEGEND_MARK); +$group->add($plot); + +$x = array(NULL, NULL, NULL, 10, 12, 14, 18, 26, 42); + +$plot = new LinePlot($x); +$plot->setColor(new Color(120, 120, 30, 10)); +$plot->setFillColor(new Color(120, 120, 60, 90)); + +$plot->mark->setType(MARK_SQUARE); +$plot->mark->setFill(new DarkGreen); +$plot->mark->setSize(5); + +$group->add($plot); + +function setYear($value) { + return $value + 2000; +} + +$group->axis->bottom->label->setCallbackFunction('setYear'); + +function setK($value) { + return round($value).'K'; +} + +$group->axis->left->label->setCallbackFunction('setK'); + +$group->legend->add($plot, "George", LEGEND_MARK); +$group->legend->setPosition(0.45, 0.25); +$group->legend->shadow->smooth(TRUE); + +$graph->add($group); + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/logo.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/logo.php new file mode 100644 index 0000000000000000000000000000000000000000..0d0b038924624eeff89ecdcbd4b0ed2909ba339b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/logo.php @@ -0,0 +1,50 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(500, 100); +$graph->setAntiAliasing(TRUE); +$graph->border->hide(); + +$x = array(); +for($i = 0; $i < 20; $i++) { + $x[] = mt_rand(4, 12); +} + +$plot = new LinePlot($x); + +$plot->setSpace(0, 0, 50, 0); +$plot->setPadding(3, 3, 3, 3); + +$plot->setBackgroundGradient( + new LinearGradient( + new Color(230, 230, 230), + new Color(255, 255, 255), + 0 + ) +); + +$plot->setColor(new Color(0, 0, 180, 20)); + +$plot->setFillGradient( + new LinearGradient( + new Color(220, 220, 230, 25), + new Color(240, 240, 255, 25), + 90 + ) +); + +$plot->xAxis->hide(TRUE); +$plot->yAxis->hide(TRUE); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/math-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/math-001.php new file mode 100644 index 0000000000000000000000000000000000000000..94f0064b299cc06ae8c2331d3cb138141a9c0781 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/math-001.php @@ -0,0 +1,45 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../MathPlot.class.php"; + + +$graph = new Graph(300, 300); + +$plot = new MathPlot(-3, 3, 3, -3); +$plot->setInterval(0.2); +$plot->setPadding(NULL, NULL, NULL, 20); + +$function = new MathFunction('cos'); +$function->setColor(new DarkGreen); +$function->mark->setType(MARK_SQUARE); +$function->mark->setSize(3); +$plot->add($function, "f(x) = cos(x)", LEGEND_MARK); + +$function = new MathFunction('exp'); +$function->setColor(new DarkRed); +$function->mark->setType(MARK_SQUARE); +$function->mark->setSize(3); +$function->mark->setFill(new DarkBlue); +$plot->add($function, "f(x) = exp(x)", LEGEND_MARK); + +function x2($x) { + return - $x * $x + 0.5; +} + +$function = new MathFunction('x2'); +$function->setColor(new DarkBlue); +$plot->add($function, "f(x) = - x * x + 0.5"); + +$plot->legend->setPosition(0.9, 0.8); +$plot->legend->setPadding(3, 3, 3, 3, 3); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-001.php new file mode 100644 index 0000000000000000000000000000000000000000..bd37e3aa37c733d9362c89d2bacec12eab203dd0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-001.php @@ -0,0 +1,59 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(150, 100); +$graph->setAntiAliasing(TRUE); + +$x = array( + 0, 2, 5, 2, 3, 8 +); + +$plot = new LinePlot($x); +$plot->setXAxisZero(FALSE); +$plot->grid->setNobackground(); + +$plot->setSpace(6, 6, 10, 10); +$plot->setPadding(30, 6, 8, 18); + +// Set a background gradient +$plot->setBackgroundGradient( + new LinearGradient( + new Color(210, 210, 210), + new Color(255, 255, 255), + 0 + ) +); + +// Change line color +$plot->setColor(new Color(0, 0, 150, 20)); + +// Set line background gradient +$plot->setFillGradient( + new LinearGradient( + new Color(150, 150, 210), + new Color(230, 230, 255), + 0 + ) +); + +// Change mark type +$plot->mark->setType(MARK_CIRCLE); +$plot->mark->border->show(); +$plot->mark->setSize(6); + +$plot->yAxis->setLabelPrecision(1); +$plot->yAxis->label->setFont(new Font1); +$plot->xAxis->label->setFont(new Font1); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-002.php new file mode 100644 index 0000000000000000000000000000000000000000..168e6434f6c661895358c2e6b4e624e46cedc670 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-002.php @@ -0,0 +1,49 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(150, 100); +$graph->setAntiAliasing(TRUE); + +$x = array( + 1, 2, 5, 0.5, 3, 8, 7, 6, 2, -4 +); + +$plot = new LinePlot($x); +$plot->grid->setNobackground(); +$plot->setPadding(20, 8, 8, 20); +$plot->setXAxisZero(FALSE); + +// Set a background gradient +$plot->setBackgroundGradient( + new LinearGradient( + new Color(210, 210, 210), + new Color(255, 255, 255), + 0 + ) +); + +// Set semi-transparent background gradient +$plot->setFillGradient( + new LinearGradient( + new Color(230, 150, 150, 20), + new Color(230, 230, 180, 50), + 90 + ) +); + +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->label->hideLast(TRUE); +$plot->xAxis->setNumberByTick('minor', 'major', 2); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-003.php new file mode 100644 index 0000000000000000000000000000000000000000..468ba5341fb136c1b7e0d145a2831eaf067084bd --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-003.php @@ -0,0 +1,56 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(150, 100); + +$x = array(); + +for($i = 0; $i < 8; $i++) { + $x[] = cos($i / 3 * M_PI) + mt_rand(-10, 10) / 40; +} + +$plot = new LinePlot($x); +$plot->setPadding(22, 5, 25, 8); + +// Hide grid +$plot->grid->setType(LINE_DASHED); + +// Change background color +$plot->setBackgroundColor(new Color(240, 240, 240, 50)); + +// Set Y on both left and rights sides +$plot->setYAxis(PLOT_BOTH); + +// Change line properties +$plot->setColor(new Color(0, 0, 0)); +$plot->setFillColor(new Color(240, 190, 130, 50)); + +// Chenge ticks and labels interval +$plot->xAxis->setTickInterval(2); +$plot->xAxis->label->hide(TRUE); +$plot->xAxis->setNumberByTick('minor', 'major', 1); + +// Hide first and last values on X axis +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->label->hideLast(TRUE); + +// Add a title +$plot->title->set("Random values"); +$plot->title->move(0, 2); +$plot->title->setFont(new Tuffy(8)); +$plot->title->setBackgroundColor(new Color(255, 255, 255, 25)); +$plot->title->border->show(); +$plot->title->setPadding(2, 2, 2, 2); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-004.php new file mode 100644 index 0000000000000000000000000000000000000000..b8c9418f3679cc620c29c11841e00cd51202b6d1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-004.php @@ -0,0 +1,58 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(150, 100); +$graph->setAntiAliasing(TRUE); + +$x = array( + 1, 2, 5, 4, 2, 3 +); + +$plot = new LinePlot($x); + +// Change component padding +$plot->setPadding(10, 12, 12, 7); + +// Set a background gradient +$plot->setBackgroundGradient( + new LinearGradient( + new Color(230, 230, 230), + new Color(255, 255, 255), + 0 + ) +); + +// Change line background color +$plot->setFillGradient( + new LinearGradient( + new Color(200, 240, 215, 30), + new Color(150, 190, 165, 30), + 0 + ) +); + +// Hide grid +$plot->grid->hide(TRUE); +$plot->grid->setNobackground(); + +$plot->yAxis->label->hide(TRUE); +$plot->xAxis->label->hide(TRUE); + +$plot->label->set($x); +$plot->label->setBackgroundColor(new Color(240, 240, 240, 10)); +$plot->label->border->setColor(new Color(255, 0, 0, 15)); +$plot->label->setPadding(3, 2, 0, 0); +$plot->label->setFont(new Font1); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-005.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-005.php new file mode 100644 index 0000000000000000000000000000000000000000..fa0d74b2ed8374d8a9067e0f23e024a3d7251d80 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-005.php @@ -0,0 +1,46 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +$graph = new Graph(150, 100); +$graph->setAntiAliasing(TRUE); + + +$x = array(); +for($i = 0; $i < 10; $i++) { + $x[] = mt_rand(1, 99) / 10; +} + +$plot = new LinePlot($x); +$plot->setBackgroundColor(new Color(240, 240, 240)); +$plot->setPadding(30, 8, 8, 20); + +$plot->setColor( + new Color(60, 60, 150) +); +$plot->setFillGradient( + new LinearGradient( + new Color(120, 175, 80, 47), + new Color(231, 172, 113, 30), + 0 + ) +); + +$plot->grid->setType(LINE_DASHED); + +$plot->yAxis->setLabelNumber(2); +$plot->yAxis->setLabelPrecision(1); + +$plot->xAxis->setLabelInterval(2); +$plot->xAxis->setNumberByTick('minor', 'major', 2); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-006.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-006.php new file mode 100644 index 0000000000000000000000000000000000000000..e689d72d42e566ac03e332cd2d327ebf0ccceb05 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/mini-006.php @@ -0,0 +1,52 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +// Return a random color +function color($a = NULL) { + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +function formatLabel($value) { + return sprintf("%.2f", $value); +} + +$graph = new Graph(150, 100); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setXAxisZero(FALSE); +$group->setBackgroundColor(new Color(197, 180, 210, 80)); + +$group->setPadding(25, 10, 10, 20); + +$group->axis->left->setLabelNumber(2); +$group->axis->left->setLabelPrecision(1); + +// Display two lines +for($n = 0; $n < 2; $n++) { + + $x = array(); + + for($i = 0; $i < 10; $i++) { + $x[] = (cos($i * M_PI / 5)) / ($n + 1); + } + + $plot = new LinePlot($x); + $plot->setColor(color(10)); // Random line color + $plot->setFillColor(color(90)); // Random background color + + $group->add($plot); + +} + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-001.php new file mode 100644 index 0000000000000000000000000000000000000000..06c8cdaf220ce7027a8263d6c9ffaa383c47ba2d --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-001.php @@ -0,0 +1,42 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(300, 175); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Stats"); +$graph->title->setFont(new TuffyItalic(16)); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values, PIE_EARTH); +$plot->setCenter(0.4, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(10); +$plot->explode(array(1 => 14, 4 => 20, 0 => 10)); + +$plot->setLegend(array( + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun' +)); + +$plot->legend->setPosition(1.3); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-002.php new file mode 100644 index 0000000000000000000000000000000000000000..dd0327454e1db17bfc077fd7e85ef925764e99a6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-002.php @@ -0,0 +1,50 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(300, 175); +$graph->setBackgroundGradient( + new LinearGradient( + new White, + new VeryLightGray(40), + 0 + ) +); +$graph->title->set("Horses"); +$graph->shadow->setSize(5); +$graph->shadow->smooth(TRUE); +$graph->shadow->setPosition(SHADOW_LEFT_BOTTOM); +$graph->shadow->setColor(new DarkGray); + +$values = array(8, 4, 6, 2, 5); + +$plot = new Pie($values); +$plot->setCenter(0.35, 0.55); +$plot->setSize(0.7, 0.6); +$plot->set3D(10); +$plot->setLabelPosition(10); + +$plot->setLegend(array( + 'France', + 'Spain', + 'Italy', + 'Germany', + 'England' +)); + +$plot->legend->setPosition(1.40); +$plot->legend->shadow->setSize(0); +$plot->legend->setBackgroundColor(new VeryLightGray(30)); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-003.php new file mode 100644 index 0000000000000000000000000000000000000000..f10cedda023c60af831638375907ae8c3c27436b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-003.php @@ -0,0 +1,52 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(300, 175); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("Customized colors"); +$graph->title->setFont(new Tuffy(12)); +$graph->title->move(80, 10); + +$values = array(16, 9, 13, 23); +$colors = array( + new LightOrange, + new LightPurple, + new LightBlue, + new LightRed, + new LightPink +); + +$plot = new Pie($values, $colors); +$plot->setCenter(0.3, 0.53); +$plot->setAbsSize(200, 200); +$plot->setBorder(new White); +$plot->setStartAngle(234); + +$plot->setLegend(array( + 'Arthur', + 'Abel', + 'Pascal', + 'Thamer' +)); + +$plot->setLabelPosition(-40); +$plot->label->setPadding(2, 2, 2, 2); +$plot->label->setFont(new Tuffy(7)); +$plot->label->setBackgroundColor(new White(60)); + +$plot->legend->setPosition(1.38); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-004.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-004.php new file mode 100644 index 0000000000000000000000000000000000000000..579ec94653431a48f94e9711e9a28f9f654d696e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-004.php @@ -0,0 +1,53 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(300, 175); +$graph->setBackgroundGradient( + new LinearGradient( + new VeryLightGray(40), + new White, + 90 + ) +); +$graph->title->set("Arbitrary labels"); +$graph->title->setAngle(90); +$graph->title->move(120, NULL); + +$values = array(8, 4, 6, 2, 5, 3, 4); + +$plot = new Pie($values); +$plot->setCenter(0.45, 0.5); +$plot->setSize(0.55, 0.55 * 300 / 175); + +$plot->label->set(array( + 'Arthur', 'Abel', 'Bernard', 'Thierry', 'Paul', 'Gaston', 'Joe' +)); + +$plot->label->setCallbackFunction(NULL); // We must disable the default callback function +$plot->setLabelPosition(10); + +$plot->setLegend(array( + 'ABC', + 'DEF', + 'GHI', + 'JKL', + 'MNO', + 'PQR', + 'STU' +)); + +$plot->legend->hide(TRUE); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-005.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-005.php new file mode 100644 index 0000000000000000000000000000000000000000..316e39945e3ad11154e24d3cff9f60a1ce487a95 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/pie-005.php @@ -0,0 +1,51 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + +function createPie($values, $title, $x, $y) { + + $plot = new Pie($values, PIE_EARTH); + $plot->title->set($title); + $plot->title->setFont(new TuffyBold(9)); + $plot->title->move(NULL, -12); + + $plot->label->setFont(new Tuffy(7)); + $plot->legend->hide(TRUE); + $plot->setLabelPosition(5); + $plot->setSize(0.48, 0.35); + $plot->setCenter($x, $y); + $plot->set3D(8); + $plot->setBorder(new White); + + return $plot; + +} + +$graph = new Graph(280, 350); +$graph->setAntiAliasing(TRUE); + +$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.25, 0.24); +$graph->add($plot); + +$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.75, 0.24); +$graph->add($plot); + +$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.25, 0.65); +$graph->add($plot); + +$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.75, 0.65); +$plot->legend->setModel(LEGEND_MODEL_BOTTOM); +$plot->setLegend(array('plip', 'plop', 'plap', 'plup', 'plep')); +$plot->legend->hide(FALSE); // We print only one legend +$plot->legend->setPosition(0, 1.10); +$graph->add($plot); + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-001.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-001.php new file mode 100644 index 0000000000000000000000000000000000000000..28bf0142ec383fdd313ce2f92805557c059670fc --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-001.php @@ -0,0 +1,68 @@ +<?php + +require_once "../../ScatterPlot.class.php"; + +$graph = new Graph(280, 280); +$graph->title->move(-40, 0); +$graph->title->set('Two circles'); + +$group = new PlotGroup; +$group->setBackgroundGradient( + new LinearGradient( + new VeryLightGray, + new Color(245, 245, 245), + 0 + ) +); + +$group->setPadding(25, 20, 40, 15); +$group->setSpace(5, 5, 5, 5); + +$group->legend->setPosition(0.82, 0.1); +$group->legend->setAlign(LEGEND_CENTER, LEGEND_MIDDLE); + +function getCircle($size) { + + $center = 0; + + $x = array(); + $y = array(); + + for($i = 0; $i <= 20; $i++) { + $rad = ($i / 20) * 2 * M_PI; + $x[] = $center + cos($rad) * $size; + $y[] = $center + sin($rad) * $size; + } + + return array($x, $y); + +} + +list($x, $y) = getCircle(3); + +$plot = new ScatterPlot($y, $x); + +$plot->link(TRUE, new DarkBlue); + +$plot->mark->setFill(new DarkPink); +$plot->mark->setType(MARK_CIRCLE, 6); + +$group->legend->add($plot, 'Circle #1', LEGEND_MARK); +$group->add($plot); + +list($x, $y) = getCircle(5); + +$plot = new ScatterPlot($y, $x); + +$plot->link(TRUE, new DarkGreen); + +$plot->mark->setFill(new DarkOrange); +$plot->mark->setType(MARK_SQUARE, 4); + +$group->legend->add($plot, 'Circle #2', LEGEND_MARK); +$group->add($plot); + +$graph->add($group); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-002.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-002.php new file mode 100644 index 0000000000000000000000000000000000000000..d2a351302d23adcda844078a0bf03114d8b0777b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-002.php @@ -0,0 +1,29 @@ +<?php + +require_once "../../ScatterPlot.class.php"; + +$graph = new Graph(300, 240); +$graph->title->set('Simple ScatterPlot'); +$graph->shadow->setSize(4); + +$y = array(1, 1.3, 1.8, 1.6, 10, 7, 8, 3, 4, 2, 4); +$x = array(0.5, 0.7, 0.65, 0.9, 0.5, 1.5, 4, 3, 5, 2, 2); + +$plot = new ScatterPlot($y, $x); +$plot->setBackgroundColor(new Color(255, 245, 220)); + +$plot->mark->setSize(15); +$plot->mark->setFill( + new RadialGradient( + new LightRed, + new Red + ) +); + +$plot->setSpace(6, 6, 6, 0); +$plot->setPadding(25, NULL, 40, 20); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-003.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-003.php new file mode 100644 index 0000000000000000000000000000000000000000..c3bf148e98473f012976fb7fc76f5156e06673e7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/site/scatter-003.php @@ -0,0 +1,33 @@ +<?php + +require_once "../../ScatterPlot.class.php"; + +$graph = new Graph(300, 280); +$graph->title->set('Linked ScatterPlot'); +$graph->title->setFont(new TuffyItalic(14)); +$graph->shadow->setSize(4); + +$y = array(1, 10, 7, 8, 5, 4, 2, 4); +$x = array(0.5, 0.5, 1.5, 4, 3, 5, 2, 2); + +$plot = new ScatterPlot($y, $x); +$plot->setBackgroundColor(new Color(235, 235, 235)); + +$plot->mark->setSize(15); +$plot->mark->setFill( + new RadialGradient( + new LightGreen, + new DarkGreen + ) +); + +$plot->link(TRUE); +$plot->setColor(new DarkGreen); + +$plot->setSpace(6, 6, 6, 0); +$plot->setPadding(25, NULL, 40, 20); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/form.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/form.php new file mode 100644 index 0000000000000000000000000000000000000000..1c58c799fc29903866bcd6884456a679f98a9ec8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/form.php @@ -0,0 +1,5 @@ +<form action="valid.php" method="get"> + <img src="spam.php" style="vertical-align: middle"/> + <input type="text" name="code"/> + <input type="submit" value="Submit"/> +</form> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/spam.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/spam.php new file mode 100644 index 0000000000000000000000000000000000000000..4e56df45ade7c54a09d0b7e44c36451e69d7fc0f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/spam.php @@ -0,0 +1,18 @@ +<?php + +require_once '../../../AntiSpam.class.php'; + +// On créé l'image anti-spam +$object = new AntiSpam(); + +// La valeur affichée sur l'image fera 5 caractères +$object->setRand(5); + +// On assigne un nom à cette image pour vérifier +// ultérieurement la valeur fournie par l'utilisateur +$object->save('example'); + +// On affiche l'image à l'écran +$object->draw(); + +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/valid.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/valid.php new file mode 100644 index 0000000000000000000000000000000000000000..2709dbb23156de40b42d8514d03e4b701295508e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/AntiSpam/valid.php @@ -0,0 +1,11 @@ +<?php +require_once "../../../AntiSpam.class.php"; + +$object = new AntiSpam(); + +if($object->check('example', $_GET['code'])) { + echo "Good value :-)"; +} else { + echo "Bad value :-("; +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/bar-Bars.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/bar-Bars.php new file mode 100644 index 0000000000000000000000000000000000000000..b8fdc533ece493bf50fff97c34b2664f12c48b82 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/bar-Bars.php @@ -0,0 +1,46 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +$graph = new Graph(450, 400); +$graph->setAntiAliasing(TRUE); + +$blue = new Color(0, 0, 200); +$red = new Color(200, 0, 0); + +$group = new PlotGroup; +$group->setPadding(40, 40); +$group->setBackgroundColor( + new Color(240, 240, 240) +); + +$values = array(12, 8, 20, 32, 15, 5); + +$plot = new BarPlot($values, 1, 2); +$plot->setBarColor($blue); +$plot->setYAxis(PLOT_LEFT); + +$group->add($plot); +$group->axis->left->setColor($blue); +$group->axis->left->title->set("Blue bars"); + +$values = array(6, 12, 14, 2, 11, 7); + +$plot = new BarPlot($values, 2, 2); +$plot->setBarColor($red); +$plot->setYAxis(PLOT_RIGHT); + +$group->add($plot); +$group->axis->right->setColor($red); +$group->axis->right->title->set("Red bars"); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/bar-Simple.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/bar-Simple.php new file mode 100644 index 0000000000000000000000000000000000000000..a48213defd0de3d0999a72cfa0e8bd0610b068cc --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/bar-Simple.php @@ -0,0 +1,30 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(TRUE); + +$values = array(19, 42, 15, -25, 3); +$plot = new BarPlot($values); +$plot->setBarColor( + new Color(250, 230, 180) +); +$plot->setSpace(5, 5, NULL, NULL); + +$plot->barShadow->setSize(4); +$plot->barShadow->setPosition(SHADOW_RIGHT_TOP); +$plot->barShadow->setColor(new Color(180, 180, 180, 10)); +$plot->barShadow->smooth(TRUE); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Color.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Color.php new file mode 100644 index 0000000000000000000000000000000000000000..e9770921b6a40651130c27b7aeec2c29048b8378 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Color.php @@ -0,0 +1,39 @@ +<?php +require_once "../../Graph.class.php"; + +$graph = new Graph(400, 30); +$graph->border->hide(); + +$drawer = $graph->getDrawer(); + +for($i = 7; $i < 400; $i += 15) { + $drawer->line( + new Color(0, 0, 0), + new Line( + new Point($i, 0), + new Point($i, 30) + ) + ); +} + +for($i = 7; $i < 30; $i += 15) { + $drawer->line( + new Color(0, 0, 0), + new Line( + new Point(0, $i), + new Point(400, $i) + ) + ); +} + +$drawer->filledRectangle( + new Color(0, 100, 200, 50), + new Line( + new Point(0, 0), + new Point(400, 30) + ) +); + +$graph->draw(); + +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Gradient-linear.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Gradient-linear.php new file mode 100644 index 0000000000000000000000000000000000000000..4fff68ad11e8c12460121f3ce8ae298b7f2f3c05 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Gradient-linear.php @@ -0,0 +1,24 @@ +<?php + +require_once "../../Graph.class.php"; + +$graph = new Graph(400, 30); +$graph->border->hide(); + +$drawer = $graph->getDrawer(); + +$drawer->filledRectangle( + new LinearGradient( + new Black, + new White, + 0 + ), + new Line( + new Point(0, 0), + new Point(400, 30) + ) +); + +$graph->draw(); + +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Gradient-radial.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Gradient-radial.php new file mode 100644 index 0000000000000000000000000000000000000000..0cc91f3a774a47da968c81fb4ee3c726403b5bf5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/base-Gradient-radial.php @@ -0,0 +1,23 @@ +<?php +require_once "../../Graph.class.php"; + +$graph = new Graph(250, 250); +$graph->border->hide(); + +$drawer = $graph->getDrawer(); + +$debut = new Color(125, 250, 0); +$fin = new Color(0, 125, 125); + +// On dessine le dégradé radial dans un cercle +$drawer->filledEllipse( + new RadialGradient( + $debut, + $fin + ), + new Point(125, 125), + 250, 250 +); + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Customize.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Customize.php new file mode 100644 index 0000000000000000000000000000000000000000..2c63abebd5e3457ebf390c13ca4aefba33abb8e9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Customize.php @@ -0,0 +1,49 @@ +<?php +require_once "../../LinePlot.class.php"; + +$graph = new Graph(400, 300); +$graph->setAntiAliasing(TRUE); + +$values = array(1, 7, 3, 2.5, 5, -4.5, -5); +$plot = new LinePlot($values); +$plot->setBackgroundColor(new Color(245, 245, 245)); + +$plot->hideLine(TRUE); +$plot->setFillColor(new Color(180, 180, 180, 75)); + +$plot->grid->setBackgroundColor(new Color(235, 235, 180, 60)); + +$plot->yAxis->setLabelPrecision(2); +$plot->yAxis->setLabelNumber(6); + +$days = array( + 'Lundi', + 'Mardi', + 'Mercredi', + 'Jeudi', + 'Vendredi', + 'Samedi', + 'Dimanche' +); +$plot->xAxis->setLabelText($days); + +$plot->setSpace(6, 6, 10, 10); + +$plot->mark->setType(MARK_IMAGE); +$plot->mark->setImage(new FileImage("smiley.png")); + +$plot->label->set($values); +$plot->label->move(0, -23); +$plot->label->setBackgroundGradient( + new LinearGradient( + new Color(250, 250, 250, 10), + new Color(255, 200, 200, 30), + 0 + ) +); +$plot->label->border->setColor(new Color(20, 20, 20, 20)); +$plot->label->setPadding(3, 1, 1, 0); + +$graph->add($plot); +$graph->draw(); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Lines.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Lines.php new file mode 100644 index 0000000000000000000000000000000000000000..2f72fa705317fcc6d149758b06c6ffa06ba0d01c --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Lines.php @@ -0,0 +1,48 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +$graph = new Graph(450, 400); +$graph->setAntiAliasing(TRUE); + +$blue = new Color(0, 0, 200); +$red = new Color(200, 0, 0); + +$group = new PlotGroup; +$group->setBackgroundColor( + new Color(240, 240, 240) +); +$group->setPadding(40, 40); + +$values = array(12, 5, 20, 32, 15, 4, 16); + +$plot = new LinePlot($values); +$plot->setColor($blue); +$plot->setYAxis(PLOT_LEFT); + +$group->add($plot); + +$group->axis->left->setColor($blue); +$group->axis->left->title->set("Blue line"); + +$values = array(6, 12, 14, 2, 11, 5, 21); + +$plot = new LinePlot($values); +$plot->setColor($red); +$plot->setYAxis(PLOT_RIGHT); + +$group->add($plot); + +$group->axis->right->setColor($red); +$group->axis->right->title->set("Red line"); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Simple.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Simple.php new file mode 100644 index 0000000000000000000000000000000000000000..977672ff65145661bbfe36230bff7feb59622110 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/line-Simple.php @@ -0,0 +1,21 @@ +<?php +require_once "../../LinePlot.class.php"; + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(FALSE); + +$values = array(1, 4, 5, -2.5, 3); +$plot = new LinePlot($values); +$plot->setBackgroundGradient( + new LinearGradient( + new Color(210, 210, 210), + new Color(250, 250, 250), + 0 + ) +); +$plot->yAxis->setLabelPrecision(1); +$plot->setSpace(5, 5, NULL, NULL); + +$graph->add($plot); +$graph->draw(); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/plot-More.php b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/plot-More.php new file mode 100644 index 0000000000000000000000000000000000000000..6e8d3efcda8cc429ded74c6a93235638662da7fd --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/plot-More.php @@ -0,0 +1,46 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; +require_once "../../LinePlot.class.php"; + +$graph = new Graph(450, 400); +$graph->setAntiAliasing(TRUE); + +$blue = new Color(150, 150, 230, 50); +$red = new Color(240, 50, 50, 25); + +$group = new PlotGroup; +$group->setSpace(5, 5, 5, 0); +$group->setBackgroundColor( + new Color(240, 240, 240) +); + +$values = array(18, 12, 14, 21, 11, 7, 9, 16, 7, 23); + +$plot = new BarPlot($values); +$plot->setBarColor($red); + +$group->add($plot); + +$values = array(12, 8, 6, 12, 7, 5, 4, 9, 3, 12); + +$plot = new LinePlot($values, LINEPLOT_MIDDLE); +$plot->setFillColor($blue); + +$plot->mark->setType(MARK_SQUARE); +$plot->mark->setSize(7); +$plot->mark->setFill(new Color(255, 255, 255)); +$plot->mark->border->show(); + +$group->add($plot); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/smiley.png b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/smiley.png new file mode 100644 index 0000000000000000000000000000000000000000..454a82f8932a7f4ee04b2be1d2a8d8bd481c1c1e Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/examples/tutorials/smiley.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/font/Tuffy.ttf b/maarch_entreprise/trunk/tools/graphic_lib/font/Tuffy.ttf new file mode 100644 index 0000000000000000000000000000000000000000..8151817be0cd6ef44548420de0f34450bbd78fb6 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/font/Tuffy.ttf differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyBold.ttf b/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyBold.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2f45b4f1778912b162aff17b23dd51824f496403 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyBold.ttf differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyBoldItalic.ttf b/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyBoldItalic.ttf new file mode 100644 index 0000000000000000000000000000000000000000..554faf20211288e69e37514ccb8ca844875c0628 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyBoldItalic.ttf differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyItalic.ttf b/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyItalic.ttf new file mode 100644 index 0000000000000000000000000000000000000000..5f972ec086f38a46c661439c0cb7889b1adad372 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/font/TuffyItalic.ttf differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/images/book.png b/maarch_entreprise/trunk/tools/graphic_lib/images/book.png new file mode 100644 index 0000000000000000000000000000000000000000..da188510059e706fefc435bf908e30e00658f059 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/images/book.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/images/paperclip.png b/maarch_entreprise/trunk/tools/graphic_lib/images/paperclip.png new file mode 100644 index 0000000000000000000000000000000000000000..12188f90cd9e0b0f7213dc840b13aba94aee64e7 Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/images/paperclip.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/images/star.png b/maarch_entreprise/trunk/tools/graphic_lib/images/star.png new file mode 100644 index 0000000000000000000000000000000000000000..4acf0033092550107743197ff17016341f5e184e Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/images/star.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/patterns/BarDepth.php b/maarch_entreprise/trunk/tools/graphic_lib/patterns/BarDepth.php new file mode 100644 index 0000000000000000000000000000000000000000..b0bdd0842cd4c1157f46d765c8e6cd9225d31246 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/patterns/BarDepth.php @@ -0,0 +1,85 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once ARTICHOW."/BarPlot.class.php"; + +class BarDepthPattern extends Pattern { + + function getPlot($y, $depth) { + + $plot = new BarPlot($y, 1, 1, $depth); + + $plot->barShadow->setSize(2); + $plot->barShadow->smooth(TRUE); + $plot->barShadow->setColor(new Color(160, 160, 160, 10)); + + return $plot; + + } + + function create() { + + $group = new PlotGroup; + $group->setSpace(2, 2, 2, 0); + $group->setPadding(30, 10, NULL, NULL); + + $group->grid->hideVertical(TRUE); + $group->grid->setType(LINE_DASHED); + + $yForeground = $this->getArg('yForeground'); + $yBackground = $this->getArg('yBackground'); + + $legendForeground = $this->getArg('legendForeground'); + $legendBackground = $this->getArg('legendBackground'); + + $colorForeground = $this->getArg('colorForeground', new LightBlue(10)); + $colorBackground = $this->getArg('colorBackground', new Orange(25)); + + if($yForeground === NULL) { + trigger_error("Argument 'yForeground' must not be NULL", E_USER_ERROR); + } + + // Background + if($yBackground !== NULL) { + + $plot = $this->getPlot($yBackground, 6); + $plot->setBarColor($colorBackground); + + $group->add($plot); + if($legendBackground !== NULL) { + $group->legend->add($plot, $legendBackground, LEGEND_BACKGROUND); + } + + } + + // Foreground + $plot = $this->getPlot($yForeground, 0); + $plot->setBarColor($colorForeground); + + $group->add($plot); + if($legendForeground !== NULL) { + $group->legend->add($plot, $legendForeground, LEGEND_BACKGROUND); + } + + $group->axis->bottom->hideTicks(TRUE); + + $group->legend->shadow->setSize(0); + $group->legend->setAlign(LEGEND_CENTER); + $group->legend->setSpace(6); + $group->legend->setTextFont(new Tuffy(8)); + $group->legend->setPosition(0.50, 0.10); + $group->legend->setBackgroundColor(new Color(255, 255, 255, 10)); + $group->legend->setColumns(2); + + return $group; + + } + +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/patterns/LightLine.php b/maarch_entreprise/trunk/tools/graphic_lib/patterns/LightLine.php new file mode 100644 index 0000000000000000000000000000000000000000..50689211d8a0401b63d924746cc13dbc07167d7b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/patterns/LightLine.php @@ -0,0 +1,50 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once ARTICHOW."/LinePlot.class.php"; + +class LightLinePattern extends Pattern { + + function create() { + + $legend = $this->getArg('legend'); + + $y = $this->getArg('y'); + + if($y === NULL) { + trigger_error("Argument 'y' must not be NULL", E_USER_ERROR); + } + + $plot = new LinePlot($y); + $plot->setSize(0.7, 1); + $plot->setCenter(0.35, 0.5); + $plot->setPadding(35, 15, 35, 30); + $plot->setColor(new Orange()); + $plot->setFillColor(new LightOrange(80)); + + $plot->grid->setType(LINE_DASHED); + + $plot->mark->setType(MARK_CIRCLE); + $plot->mark->setFill(new MidRed); + $plot->mark->setSize(6); + + $plot->legend->setPosition(1, 0.5); + $plot->legend->setAlign(LEGEND_LEFT); + $plot->legend->shadow->smooth(TRUE); + + if($legend !== NULL) { + $plot->legend->add($plot, $legend, LEGEND_MARK); + } + + return $plot; + + } + +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/AntiSpam.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/AntiSpam.class.php new file mode 100644 index 0000000000000000000000000000000000000000..e230fe1babca20cd842e0463b8caa384b09dbdc3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/AntiSpam.class.php @@ -0,0 +1,218 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Graph.class.php"; + +/** + * AntiSpam + * String printed on the images are case insensitive. + * + * @package Artichow + */ +class awAntiSpam extends awImage { + + /** + * Anti-spam string + * + * @var string + */ + var $string; + + /** + * Noise intensity + * + * @var int + */ + var $noise = 0; + + /** + * Construct a new awAntiSpam image + * + * @param string $string A string to display + */ + function awAntiSpam($string = '') { + + parent::awImage(); + + $this->string = (string)$string; + + } + + /** + * Create a random string + * + * @param int $length String length + * @return string String created + */ + function setRand($length) { + + $length = (int)$length; + + $this->string = ''; + + $letters = 'aAbBCDeEFgGhHJKLmMnNpPqQRsStTuVwWXYZz2345679'; + $number = strlen($letters); + + for($i = 0; $i < $length; $i++) { + $this->string .= $letters{mt_rand(0, $number - 1)}; + } + + return $this->string; + + } + + /** + * Set noise on image + * + * @param int $nois Noise intensity (from 0 to 10) + */ + function setNoise($noise) { + if($noise < 0) { + $noise = 0; + } + if($noise > 10) { + $noise = 10; + } + $this->noise = (int)$noise; + } + + /** + * Save string value in session + * You can use check() to verify the value later + * + * @param string $qName A name that identify the anti-spam image + */ + function save($qName) { + $this->session(); + $session = 'artichow_'.(string)$qName; + $_SESSION[$session] = $this->string; + } + + /** + * Verify user entry + * + * @param string $qName A name that identify the anti-spam image + * @param string $value User-defined value + * @param bool $case TRUE for case insensitive check, FALSE for case sensitive check ? (default to TRUE) + * @return bool TRUE if the value is correct, FALSE otherwise + */ + function check($qName, $value, $case = TRUE) { + + $this->session(); + + $session = 'artichow_'.(string)$qName; + + return ( + array_key_exists($session, $_SESSION) === TRUE and + $case ? + (strtolower($_SESSION[$session]) === strtolower((string)$value)) : + ($_SESSION[$session] === (string)$value) + ); + + } + + /** + * Draw image + */ + function draw() { + + $fonts = array( + ARTICHOW_FONT.DIRECTORY_SEPARATOR.'Tuffy.ttf', + ARTICHOW_FONT.DIRECTORY_SEPARATOR.'TuffyBold.ttf', + ARTICHOW_FONT.DIRECTORY_SEPARATOR.'TuffyItalic.ttf', + ARTICHOW_FONT.DIRECTORY_SEPARATOR.'TuffyBoldItalic.ttf' + ); + + $sizes = array(12, 12.5, 13, 13.5, 14, 15, 16, 17, 18, 19); + + $widths = array(); + $heights = array(); + $texts = array(); + + for($i = 0; $i < strlen($this->string); $i++) { + + $fontKey = array_rand($fonts); + $sizeKey = array_rand($sizes); + + $font = new awTTFFont( + $fonts[$fontKey], $sizes[$sizeKey] + ); + + $text = new awText( + $this->string{$i}, + $font, + NULL, + mt_rand(-15, 15) + ); + + $widths[] = $font->getTextWidth($text); + $heights[] = $font->getTextHeight($text); + $texts[] = $text; + + } + + $width = array_sum($widths); + $height = array_max($heights); + + $totalWidth = $width + 10 + count($texts) * 10; + $totalHeight = $height + 20; + + $this->setSize($totalWidth, $totalHeight); + + $this->create(); + + for($i = 0; $i < strlen($this->string); $i++) { + + $this->drawer->string( + $texts[$i], + new awPoint( + 5 + array_sum(array_slice($widths, 0, $i)) + $widths[$i] / 2 + $i * 10, + 10 + ($height - $heights[$i]) / 2 + ) + ); + + } + + $this->drawNoise($totalWidth, $totalHeight); + + $this->send(); + + } + + function drawNoise($width, $height) { + + $points = $this->noise * 30; + $color = new awColor(0, 0, 0); + + for($i = 0; $i < $points; $i++) { + $this->drawer->point( + $color, + new awPoint( + mt_rand(0, $width), + mt_rand(0, $height) + ) + ); + } + + } + + function session() { + + // Start session if needed + if(!session_id()) { + session_name('PeopleBox'); +session_start(); + } + + } + +} + +registerClass('AntiSpam'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/Artichow.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/Artichow.class.php new file mode 100644 index 0000000000000000000000000000000000000000..ec3cb3566c76ab9789805a7cac6d7ecfd949ed45 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/Artichow.class.php @@ -0,0 +1,321 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +// Artichow configuration + +// Some useful files +require_once ARTICHOW."/Component.class.php"; +require_once ARTICHOW."/Image.class.php"; +require_once ARTICHOW."/common.php"; + +require_once ARTICHOW."/inc/Grid.class.php"; +require_once ARTICHOW."/inc/Tools.class.php"; +require_once ARTICHOW."/inc/Drawer.class.php"; +require_once ARTICHOW."/inc/Math.class.php"; +require_once ARTICHOW."/inc/Tick.class.php"; +require_once ARTICHOW."/inc/Axis.class.php"; +require_once ARTICHOW."/inc/Legend.class.php"; +require_once ARTICHOW."/inc/Mark.class.php"; +require_once ARTICHOW."/inc/Label.class.php"; +require_once ARTICHOW."/inc/Text.class.php"; +require_once ARTICHOW."/inc/Color.class.php"; +require_once ARTICHOW."/inc/Font.class.php"; +require_once ARTICHOW."/inc/Gradient.class.php"; + +// Catch all errors +ob_start(); + +/** + * A graph + * + * @package Artichow + */ +class awGraph extends awImage { + + /** + * Graph name + * + * @var string + */ + var $name; + + /** + * Cache timeout + * + * @var int + */ + var $timeout = 0; + + /** + * Graph timing ? + * + * @var bool + */ + var $timing; + + /** + * Components + * + * @var array + */ + var $components = array(); + + /** + * Graph title + * + * @var Label + */ + var $title; + + /** + * Construct a new awgraph + * + * @param int $width Graph width + * @param int $height Graph height + * @param string $name Graph name for the cache (must be unique). Let it null to not use the cache. + * @param int $timeout Cache timeout (unix timestamp) + */ + function awGraph($width = NULL, $height = NULL, $name = NULL, $timeout = 0) { + + parent::awImage(); + + $this->setSize($width, $height); + + if(ARTICHOW_CACHE) { + + $this->name = $name; + $this->timeout = $timeout; + + // Clean sometimes all the cache + if(mt_rand(0, 5000) === 0) { + awGraph::cleanCache(); + } + + if($this->name !== NULL) { + + $file = ARTICHOW."/cache/".$this->name."-time"; + + if(is_file($file)) { + + $type = awGraph::cleanGraphCache($file); + + if($type === NULL) { + awGraph::deleteFromCache($this->name); + } else { + header("Content-Type: image/".$type); + readfile(ARTICHOW."/cache/".$this->name.""); + exit; + } + + } + + } + + } + + + $this->title = new awLabel( + NULL, + new awTuffy(16), + NULL, + 0 + ); + $this->title->setAlign(LABEL_CENTER, LABEL_BOTTOM); + + } + + /** + * Delete a graph from the cache + * + * @param string $name Graph name + * @return bool TRUE on success, FALSE on failure + */ + function deleteFromCache($name) { + + if(ARTICHOW_CACHE) { + + if(is_file(ARTICHOW."/cache/".$name."-time")) { + unlink(ARTICHOW."/cache/".$name.""); + unlink(ARTICHOW."/cache/".$name."-time"); + } + + } + + } + + /** + * Delete all graphs from the cache + */ + function deleteAllCache() { + + if(ARTICHOW_CACHE) { + + $dp = opendir(ARTICHOW."/cache"); + + while($file = readdir($dp)) { + if($file !== '.' and $file != '..') { + unlink(ARTICHOW."/cache/".$file); + } + } + + } + + } + + /** + * Clean cache + */ + function cleanCache() { + + if(ARTICHOW_CACHE) { + + $glob = glob(ARTICHOW."/cache/*-time"); + + foreach($glob as $file) { + + $type = awGraph::cleanGraphCache($file); + + if($type === NULL) { + $name = ereg_replace(".*/(.*)\-time", "\\1", $file); + awGraph::deleteFromCache($name); + } + + } + + } + + } + + /** + * Enable/Disable graph timing + * + * @param bool $timing + */ + function setTiming($timing) { + $this->timing = (bool)$timing; + } + + /** + * Add a component to the graph + * + * @param &$component + */ + function add(&$component) { + + $this->components[] = $component; + + } + + /** + * Build the graph and draw component on it + * Image is sent to the user browser + */ + function draw() { + + if($this->timing) { + $time = microtimeFloat(); + } + + $this->create(); + + foreach($this->components as $component) { + + $this->drawComponent($component); + + } + + $this->drawTitle(); + $this->drawShadow(); + + if($this->timing) { + $this->drawTiming(microtimeFloat() - $time); + } + + $this->send(); + + if(ARTICHOW_CACHE) { + + if($this->name !== NULL) { + + $data = ob_get_contents(); + + if(is_writable(ARTICHOW."/cache") === FALSE) { + trigger_error("Cache directory is not writable"); + } + + $file = ARTICHOW."/cache/".$this->name.""; + file_put_contents($file, $data); + + $file .= "-time"; + file_put_contents($file, $this->timeout."\n".$this->getFormat()); + + } + + } + + } + + function drawTitle() { + + $drawer = $this->getDrawer(); + + $point = new awPoint( + $this->width / 2, + 10 + ); + + $this->title->draw($drawer, $point); + + } + + function drawTiming($time) { + + $drawer = $this->getDrawer(); + + $label = new awLabel; + $label->set("(".sprintf("%.3f", $time)." s)"); + $label->setAlign(LABEL_LEFT, LABEL_TOP); + $label->border->show(); + $label->setPadding(1, 0, 0, 0); + $label->setBackgroundColor(new awColor(230, 230, 230, 25)); + + $label->draw($drawer, new awPoint(5, $drawer->height - 5)); + + } + + function cleanGraphCache($file) { + + list( + $time, + $type + ) = explode("\n", file_get_contents($file)); + + $time = (int)$time; + + if($time !== 0 and $time < time()) { + return NULL; + } else { + return $type; + } + + + } + +} + +registerClass('Graph'); + +/* + * To preserve PHP 4 compatibility + */ +function microtimeFloat() { + list($usec, $sec) = explode(" ", microtime()); + return (float)$usec + (float)$sec; +} +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/BarPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/BarPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..dea20512631c8830fb438d9f10deef5416fd3e4d --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/BarPlot.class.php @@ -0,0 +1,364 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Plot.class.php"; + +/** + * BarPlot + * + * @package Artichow + */ +class awBarPlot extends awPlot { + + /** + * Labels on your bar plot + * + * @var Label + */ + var $label; + + /** + * Bar plot identifier + * + * @var int + */ + var $identifier; + + /** + * Bar plot number + * + * @var int + */ + var $number; + + /** + * Bar plot depth + * + * @var int + */ + var $depth; + + /** + * For moving bars + * + * @var int + */ + var $move; + + /** + * Bars shadow + * + * @var Shadow + */ + var $barShadow; + + /** + * Bars border + * + * @var Border + */ + var $barBorder; + + /** + * Bars padding + * + * @var Side + */ + var $barPadding; + + /** + * Bars space + * + * @var int + */ + var $barSpace = 0; + + /** + * Bars background + * + * @var Color, Gradient + */ + var $barBackground; + + /** + * Construct a new awBarPlot + * + * @param array $values Some numeric values for Y axis + * @param int $identifier Plot identifier + * @param int $number Bar plot number + * @param int $depth Bar plot depth in pixels + */ + function awBarPlot($values, $identifier = 1, $number = 1, $depth = 0) { + + parent::awPlot(); + + $this->label = new awLabel; + + $this->barPadding = new awSide(0.08, 0.08, 0, 0); + $this->barShadow = new awShadow(SHADOW_RIGHT_TOP); + $this->barBorder = new awBorder; + + $this->setValues($values); + + $this->identifier = (int)$identifier; + $this->number = (int)$number; + $this->depth = (int)$depth; + + $this->move = new awSide; + + // Hide vertical grid + $this->grid->hideVertical(TRUE); + + } + + /** + * Change bars padding + * This method is not compatible with awBarPlot::setBarPadding() + * + * @param float $left Left padding (between 0 and 1) + * @param float $right Right padding (between 0 and 1) + */ + function setBarPadding($left = NULL, $right = NULL) { + $this->barPadding->set($left, $right); + } + + /** + * Change bars size + * This method is not compatible with awBarPlot::setBarPadding() + * + * @param int $width Bars size (between 0 and 1) + */ + function setBarSize($size) { + $padding = (1 - $size) / 2; + $this->barPadding->set($padding, $padding); + } + + /** + * Move bars + * + * @param int $x + * @param int $y + */ + function move($x, $y) { + $this->move->set($x, NULL, $y, NULL); + } + + /** + * Change bars space + * + * @param int $space Space in pixels + */ + function setBarSpace($space) { + $this->barSpace = (int)$space; + } + + /** + * Change line background color + * + * @param $color + */ + function setBarColor($color) { + $this->barBackground = $color; + } + + /** + * Change line background gradient + * + * @param $gradient + */ + function setBarGradient($gradient) { + $this->barBackground = $gradient; + } + + /** + * Get the line thickness + * + * @return int + */ + function getLegendLineThickness() { + } + + /** + * Get the line type + * + * @return int + */ + function getLegendLineStyle() { + } + + /** + * Get the color of line + * + * @return Color + */ + function getLegendLineColor() { + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + function getLegendBackground() { + return $this->barBackground; + } + + /** + * Get a mark object + * + * @return Mark + */ + function getLegendMark() { + } + + function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $count = count($this->datay); + $max = $this->getRealYMax(NULL); + $min = $this->getRealYMin(NULL); + + // Find zero for bars + if($this->xAxisZero and $min <= 0 and $max >= 0) { + $zero = 0; + } else if($max < 0) { + $zero = $max; + } else { + $zero = $min; + } + + // Get base position + $zero = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint(0, $zero)); + + // Distance between two values on the graph + $distance = $this->xAxis->getDistance(0, 1); + + // Compute paddings + $leftPadding = $this->barPadding->left * $distance; + $rightPadding = $this->barPadding->right * $distance; + + $padding = $leftPadding + $rightPadding; + $space = $this->barSpace * ($this->number - 1); + + $barSize = ($distance - $padding - $space) / $this->number; + $barPosition = $leftPadding + $barSize * ($this->identifier - 1); + + for($key = 0; $key < $count; $key++) { + + $value = $this->datay[$key]; + + if($value !== NULL) { + + $position = awAxis::toPosition( + $this->xAxis, + $this->yAxis, + new awPoint($key, $value) + ); + + $barStart = $barPosition + ($this->identifier - 1) * $this->barSpace + $position->x; + $barStop = $barStart + $barSize; + + $t1 = min($zero->y, $position->y); + $t2 = max($zero->y, $position->y); + + if(round($t2 - $t1) == 0) { + continue; + } + + $p1 = new awPoint( + round($barStart) + $this->depth + $this->move->left, + round($t1) - $this->depth + $this->move->top + ); + + $p2 = new awPoint( + round($barStop) + $this->depth + $this->move->left, + round($t2) - $this->depth + $this->move->top + ); + + $this->drawBar($drawer, $p1, $p2); + + } + + } + + // Draw labels + foreach($this->datay as $key => $value) { + + if($value !== NULL) { + + $position = awAxis::toPosition( + $this->xAxis, + $this->yAxis, + new awPoint($key, $value) + ); + + $point = new awPoint( + $barPosition + ($this->identifier - 1) * $this->barSpace + $position->x + $barSize / 2 + 1 + $this->depth, + $position->y - $this->depth + ); + + $this->label->draw($drawer, $point, $key); + + } + + } + + } + + function getXAxisNumber() { + return count($this->datay) + 1; + } + // ça bidouille à fond ici ! + function getXMax() { + return array_max($this->datax) + 1; + } + + function getXCenter() { + return TRUE; + } + + function drawBar($drawer, $p1, $p2) { + + // Draw shadow + $this->barShadow->draw( + $drawer, + $p1, + $p2, + SHADOW_OUT + ); + + if(abs($p2->y - $p1->y) > 1) { + + $this->barBorder->rectangle( + $drawer, + $p1, + $p2 + ); + + if($this->barBackground !== NULL) { + + $size = $this->barBorder->visible() ? 1 : 0; + + $b1 = $p1->move($size, $size); + $b2 = $p2->move(-1 * $size, -1 * $size); + + // Draw background + $drawer->filledRectangle( + $this->barBackground, + new awLine($b1, $b2) + ); + + } + + } + } + +} + +registerClass('BarPlot'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/Component.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/Component.class.php new file mode 100644 index 0000000000000000000000000000000000000000..be43c6bbbe0a28df2e7bb07f3073fd4b8c9b5b41 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/Component.class.php @@ -0,0 +1,415 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Graph.class.php"; + + +/** + * A graph can contain some groups of components + * + * @package Artichow + */ + class awComponentGroup extends awComponent { + + /** + * Components of this group + * + * @var array + */ + var $components; + + /** + * Build the component group + */ + function awComponentGroup() { + parent::awComponent(); + $this->components = array(); + } + + /** + * Add a component to the group + * + * @param &$component A component + */ + function add(&$component) { + $this->components[] = $component; + } + +} + +registerClass('ComponentGroup', TRUE); + + class awComponent { + + /** + * Component drawer + * + * @var Drawer + */ + var $drawer; + + /** + * Component width + * + * @var float + */ + var $width = 1.0; + + /** + * Component height + * + * @var float + */ + var $height = 1.0; + + /** + * Position X of the center the graph (from 0 to 1) + * + * @var float + */ + var $x = 0.5; + + /** + * Position Y of the center the graph (from 0 to 1) + * + * @var float + */ + var $y = 0.5; + + /** + * Component absolute width (in pixels) + * + * + * @var int + */ + var $w; + + /** + * Component absolute height (in pixels) + * + * + * @var int + */ + var $h; + + /** + * Left-top corner Y position + * + * @var float + */ + var $top; + + /** + * Left-top corner X position + * + * @var float + */ + var $left; + + /** + * Component background color + * + * @var Color + */ + var $background; + + /** + * Component padding + * + * @var Side + */ + var $padding; + + /** + * Component space + * + * @var Side + */ + var $space; + + /** + * Component title + * + * @var Label + */ + var $title; + + /** + * Adjust automatically the component ? + * + * @var bool + */ + var $auto = TRUE; + + /** + * Legend + * + * @var Legend + */ + var $legend; + + /** + * Build the component + */ + function awComponent() { + + // Component legend + $this->legend = new awLegend(); + + $this->padding = new awSide(25, 25, 25, 25); + $this->space = new awSide(0, 0, 0, 0); + + // Component title + $this->title = new awLabel( + NULL, + new awTuffy(10), + NULL, + 0 + ); + $this->title->setAlign(LABEL_CENTER, LABEL_TOP); + + } + + /** + * Adjust automatically the component ? + * + * @param bool $auto + */ + function auto($auto) { + $this->auto = (bool)$auto; + } + + /** + * Change the size of the component + * + * @param int $width Component width (from 0 to 1) + * @param int $height Component height (from 0 to 1) + */ + function setSize($width, $height) { + + $this->width = (float)$width; + $this->height = (float)$height; + + } + + /** + * Change the absolute size of the component + * + * @param int $w Component width (in pixels) + * @param int $h Component height (in pixels) + */ + function setAbsSize($w, $h) { + + $this->w = (int)$w; + $this->h = (int)$h; + + } + + /** + * Change component background color + * + * @param $color (can be null) + */ + function setBackgroundColor($color) { + if($color === NULL or is_a($color, 'awColor')) { + $this->background = $color; + } + } + + /** + * Change component background gradient + * + * @param $gradient (can be null) + */ + function setBackgroundGradient($gradient) { + if($gradient === NULL or is_a($gradient, 'awGradient')) { + $this->background = $gradient; + } + } + + /** + * Change component background image + * + * @param &$image (can be null) + */ + function setBackgroundImage($image) { + if($image === NULL or is_a($image, 'awImage')) { + $this->background = $image; + } + } + + /** + * Return the component background + * + * @return Color, Gradient + */ + function getBackground() { + return $this->background; + } + + /** + * Change component padding + * + * @param int $left Padding in pixels (NULL to keep old value) + * @param int $right Padding in pixels (NULL to keep old value) + * @param int $top Padding in pixels (NULL to keep old value) + * @param int $bottom Padding in pixels (NULL to keep old value) + */ + function setPadding($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { + $this->padding->set($left, $right, $top, $bottom); + } + + /** + * Change component space + * + * @param float $left Space in % (NULL to keep old value) + * @param float $right Space in % (NULL to keep old value) + * @param float $bottom Space in % (NULL to keep old value) + * @param float $top Space in % (NULL to keep old value) + */ + function setSpace($left = NULL, $right = NULL, $bottom = NULL, $top = NULL) { + $this->space->set($left, $right, $bottom, $top); + } + + /** + * Change the absolute position of the component on the graph + * + * @var int $x Left-top corner X position + * @var int $y Left-top corner Y position + */ + function setAbsPosition($left, $top) { + + $this->left = (int)$left; + $this->top = (int)$top; + + } + + /** + * Set the center of the component + * + * @param int $x Position on X axis of the center of the component + * @param int $y Position on Y axis of the center of the component + */ + function setCenter($x, $y) { + + $this->x = (float)$x; + $this->y = (float)$y; + + } + + /** + * Get component coords with its padding + * + * @return array Coords of the component + */ + function getPosition() { + + // Get component coords + $x1 = $this->padding->left; + $y1 = $this->padding->top; + $x2 = $this->w - $this->padding->right; + $y2 = $this->h - $this->padding->bottom; + + return array($x1, $y1, $x2, $y2); + + } + + /** + * Init the drawing of the component + */ + function init($drawer) { + + // Set component background + $background = $this->getBackground(); + + if($background !== NULL) { + + $p1 = new awPoint(0, 0); + $p2 = new awPoint($this->w - 1, $this->h - 1); + + if(is_a($background, 'awImage')) { + + $drawer->copyImage( + $background, + $p1, + $p2 + ); + + } else { + + $drawer->filledRectangle( + $background, + new awLine($p1, $p2) + ); + + } + + } + } + + /** + * Finalize the drawing of the component + */ + function finalize($drawer) { + + // Draw component title + $point = new awPoint( + $this->w / 2, + $this->padding->top - 8 + ); + $this->title->draw($drawer, $point); + + // Draw legend + $this->legend->draw($drawer); + + } + + /** + * Draw the grid around your component + * + * @param Drawer A drawer + * @return array Coords for the component + */ + + + /** + * Draw the component on the graph + * Component should be drawed into specified coords + * + * @param Drawer A drawer + * @param int $x1 + * @param int $y1 + * @param int $x2 + * @param int $y2 + * @param bool $aliasing Use anti-aliasing to draw the component ? + */ + + + /** + * Get space width in pixels + * + * @param int $width Component width + * @param int $height Component height + * @return array + */ + function getSpace($width, $height) { + + $left = (int)($width * $this->space->left / 100); + $right = (int)($width * $this->space->right / 100); + $top = (int)($height * $this->space->top / 100); + $bottom = (int)($height * $this->space->bottom / 100); + + return array($left, $right, $top, $bottom); + + } + +} + +registerClass('Component', TRUE); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/Graph.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/Graph.class.php new file mode 100644 index 0000000000000000000000000000000000000000..8e69ad4c012585b7c4f6e6e1b1d7cdde24384604 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/Graph.class.php @@ -0,0 +1,373 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +// Artichow configuration + +// Some useful files +require_once ARTICHOW."/common.php"; +require_once ARTICHOW."/Component.class.php"; +require_once ARTICHOW."/Image.class.php"; + +require_once ARTICHOW."/inc/Grid.class.php"; +require_once ARTICHOW."/inc/Tools.class.php"; +require_once ARTICHOW."/inc/Drawer.class.php"; +require_once ARTICHOW."/inc/Math.class.php"; +require_once ARTICHOW."/inc/Tick.class.php"; +require_once ARTICHOW."/inc/Axis.class.php"; +require_once ARTICHOW."/inc/Legend.class.php"; +require_once ARTICHOW."/inc/Mark.class.php"; +require_once ARTICHOW."/inc/Label.class.php"; +require_once ARTICHOW."/inc/Text.class.php"; +require_once ARTICHOW."/inc/Color.class.php"; +require_once ARTICHOW."/inc/Font.class.php"; +require_once ARTICHOW."/inc/Gradient.class.php"; + +// Catch all errors +ob_start(); + +/** + * A graph + * + * @package Artichow + */ +class awGraph extends awImage { + + /** + * Graph name + * + * @var string + */ + var $name; + + /** + * Cache timeout + * + * @var int + */ + var $timeout = 0; + + /** + * Graph timing ? + * + * @var bool + */ + var $timing; + + /** + * Components + * + * @var array + */ + var $components = array(); + + /** + * Some labels to add to the component + * + * @var array + */ + var $labels = array(); + + /** + * Graph title + * + * @var Label + */ + var $title; + + /** + * Construct a new graph + * + * @param int $width Graph width + * @param int $height Graph height + * @param string $name Graph name for the cache (must be unique). Let it null to not use the cache. + * @param int $timeout Cache timeout (unix timestamp) + */ + function awGraph($width = NULL, $height = NULL, $name = NULL, $timeout = 0) { + + parent::awImage(); + + $this->setSize($width, $height); + + $this->name = $name; + $this->timeout = $timeout; + + // Clean sometimes all the cache + if(mt_rand(0, 5000) === 0) { + awGraph::cleanCache(); + } + + if($this->name !== NULL) { + + $file = ARTICHOW."/cache/".$this->name."-time"; + + if(is_file($file)) { + + $type = awGraph::cleanGraphCache($file); + + if($type === NULL) { + awGraph::deleteFromCache($this->name); + } else { + header("Content-Type: image/".$type); + readfile(ARTICHOW."/cache/".$this->name.""); + exit; + } + + } + + } + + + $this->title = new awLabel( + NULL, + new awTuffy(16), + NULL, + 0 + ); + $this->title->setAlign(LABEL_CENTER, LABEL_BOTTOM); + + } + + /** + * Delete a graph from the cache + * + * @param string $name Graph name + * @return bool TRUE on success, FALSE on failure + */ + function deleteFromCache($name) { + + if(is_file(ARTICHOW."/cache/".$name."-time")) { + unlink(ARTICHOW."/cache/".$name.""); + unlink(ARTICHOW."/cache/".$name."-time"); + } + + } + + /** + * Delete all graphs from the cache + */ + function deleteAllCache() { + + $dp = opendir(ARTICHOW."/cache"); + + while($file = readdir($dp)) { + if($file !== '.' and $file != '..') { + unlink(ARTICHOW."/cache/".$file); + } + } + + } + + /** + * Clean cache + */ + function cleanCache() { + + $glob = glob(ARTICHOW."/cache/*-time"); + + foreach($glob as $file) { + + $type = awGraph::cleanGraphCache($file); + + if($type === NULL) { + $name = ereg_replace(".*/(.*)\-time", "\\1", $file); + awGraph::deleteFromCache($name); + } + + } + + } + + /** + * Enable/Disable Graph timing + * + * @param bool $timing + */ + function setTiming($timing) { + $this->timing = (bool)$timing; + } + + /** + * Add a component to the graph + * + * @param &$component + */ + function add(&$component) { + + $this->components[] = $component; + + } + + /** + * Add a label to the component + * + * @param &$label + * @param int $x Position on X axis of the center of the text + * @param int $y Position on Y axis of the center of the text + */ + function addLabel(&$label, $x, $y) { + + $this->labels[] = array( + $label, $x, $y + ); + + } + + /** + * Add a label to the component with aboslute position + * + * @param &$label + * @param $point Text position + */ + function addAbsLabel(&$label, $point) { + + $this->labels[] = array( + $label, $point + ); + + } + + /** + * Build the graph and draw component on it + * Image is sent to the user browser + * + * @param string $file Save the image in the specified file. Let it null to print image to screen. + */ + function draw($file = NULL) { + + if($this->timing) { + $time = microtimeFloat(); + } + + $this->create(); + + foreach($this->components as $component) { + + $this->drawComponent($component); + + } + + $this->drawTitle(); + $this->drawShadow(); + $this->drawLabels(); + + if($this->timing) { + $this->drawTiming(microtimeFloat() - $time); + } + + $this->send($file); + + if($file === NULL) { + + $data = ob_get_contents(); + + if($this->name !== NULL) { + + if(is_writable(ARTICHOW."/cache") === FALSE) { + trigger_error("Cache directory is not writable"); + } + + $file = ARTICHOW."/cache/".$this->name.""; + file_put_contents($file, $data); + + $file .= "-time"; + file_put_contents($file, $this->timeout."\n".$this->getFormat()); + + } + + } + + } + + function drawLabels() { + + $drawer = $this->getDrawer(); + + foreach($this->labels as $array) { + + if(count($array) === 3) { + + // Text in relative position + list($label, $x, $y) = $array; + + $point = new awPoint( + $x * $this->width, + $y * $this->height + ); + + } else { + + // Text in absolute position + list($label, $point) = $array; + + } + + $label->draw($drawer, $point); + + } + + } + + function drawTitle() { + + $drawer = $this->getDrawer(); + + $point = new awPoint( + $this->width / 2, + 10 + ); + + $this->title->draw($drawer, $point); + + } + + function drawTiming($time) { + + $drawer = $this->getDrawer(); + + $label = new awLabel; + $label->set("(".sprintf("%.3f", $time)." s)"); + $label->setAlign(LABEL_LEFT, LABEL_TOP); + $label->border->show(); + $label->setPadding(1, 0, 0, 0); + $label->setBackgroundColor(new awColor(230, 230, 230, 25)); + + $label->draw($drawer, new awPoint(5, $drawer->height - 5)); + + } + + function cleanGraphCache($file) { + + list( + $time, + $type + ) = explode("\n", file_get_contents($file)); + + $time = (int)$time; + + if($time !== 0 and $time < time()) { + return NULL; + } else { + return $type; + } + + + } + +} + +registerClass('Graph'); + +/* + * To preserve PHP 4 compatibility + */ +function microtimeFloat() { + list($usec, $sec) = explode(" ", microtime()); + return (float)$usec + (float)$sec; +} +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/Image.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/Image.class.php new file mode 100644 index 0000000000000000000000000000000000000000..a8c8abb3d5ad6e19a843a226fb50babde12a681e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/Image.class.php @@ -0,0 +1,425 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* <php4> */ + +define("IMAGE_JPEG", 1); +define("IMAGE_PNG", 2); +define("IMAGE_GIF", 3); + +/* </php4> */ + +/* + * Check for GD2 + */ +if(function_exists('imagecreatetruecolor') === FALSE) { + trigger_error("You must compile PHP with GD2 support to use Artichow", E_USER_ERROR); +} + +require_once ARTICHOW."/inc/Shadow.class.php"; +require_once ARTICHOW."/inc/Border.class.php"; + +/** + * An image for a graph + * + * @package Artichow + */ +class awImage { + + /** + * Graph width + * + * @var int + */ + var $width; + + /** + * Graph height + * + * @var int + */ + var $height; + + /** + * Use anti-aliasing ? + * + * @var bool + */ + var $antiAliasing = FALSE; + + /** + * Image format + * + * @var int + */ + var $format = IMAGE_PNG; + + /** + * Image background color + * + * @var Color + */ + var $background; + + /** + * GD resource + * + * @var resource + */ + var $resource; + + /** + * Image drawer + * + * @var Drawer + */ + var $drawer; + + /** + * Shadow + * + * @var Shadow + */ + var $shadow; + + /** + * Image border + * + * @var Border + */ + var $border; + + /** + * Use JPEG for image + * + * @var int + */ + + + /** + * Use PNG for image + * + * @var int + */ + + + /** + * Use GIF for image + * + * @var int + */ + + + /** + * Build the image + */ + function awImage() { + + $this->background = new awColor(255, 255, 255); + $this->shadow = new awShadow(SHADOW_RIGHT_BOTTOM); + $this->border = new awBorder; + + } + + /** + * Get drawer of the image + * + * @param int $w Drawer width (from 0 to 1) (default to 1) + * @param int $h Drawer height (from 0 to 1) (default to 1) + * @param float $x Position on X axis of the center of the drawer (default to 0.5) + * @param float $y Position on Y axis of the center of the drawer (default to 0.5) + * @return Drawer + */ + function getDrawer($w = 1, $h = 1, $x = 0.5, $y = 0.5) { + $this->create(); + $this->drawer->setSize($w, $h); + $this->drawer->setPosition($x, $y); + return $this->drawer; + } + + /** + * Change the image size + * + * @var int $width Image width + * @var int $height Image height + */ + function setSize($width, $height) { + + if($width !== NULL) { + $this->width = (int)$width; + } + if($height !== NULL) { + $this->height = (int)$height; + } + + } + + /** + * Change image background color + * + * @param $color + */ + function setBackgroundColor($color) { + $this->background = $color; + } + + /** + * Change image background gradient + * + * @param $gradient + */ + function setBackgroundGradient($gradient) { + $this->background = $gradient; + } + + /** + * Can we use anti-aliasing ? + * + * @var bool $bool + */ + function setAntiAliasing($bool) { + $this->antiAliasing = (bool)$bool; + } + + /** + * Change image format + * + * @var int $format New image format + */ + function setFormat($format) { + if($format === IMAGE_JPEG or $format === IMAGE_PNG or $format === IMAGE_GIF) { + $this->format = $format; + } + } + + /** + * Create a new awimage + */ + function create() { + + if($this->resource === NULL) { + + // Create image + + $this->resource = imagecreatetruecolor($this->width, $this->height); + if(!$this->resource) { + trigger_error("Unable to create a graph", E_USER_ERROR); + } + + imagealphablending($this->resource, TRUE); + + if($this->antiAliasing and function_exists('imageantialias')) { + imageantialias($this->resource, TRUE); + } + + $this->drawer = new awDrawer($this->resource); + $this->drawer->setImageSize($this->width, $this->height); + + // Original color + $this->drawer->filledRectangle( + new awWhite, + new awLine( + new awPoint(0, 0), + new awPoint($this->width, $this->height) + ) + ); + + $shadow = $this->shadow->getSpace(); + + $p1 = new awPoint($shadow->left, $shadow->top); + $p2 = new awPoint($this->width - $shadow->right - 1, $this->height - $shadow->bottom - 1); + + // Draw image background + $this->drawer->filledRectangle($this->background, new awLine($p1, $p2)); + $this->background->free(); + + // Draw image border + $this->border->rectangle($this->drawer, $p1, $p2); + + } + + } + + /** + * Draw a component on the image + * + * @var &$component A component + */ + function drawComponent(&$component) { + + $shadow = $this->shadow->getSpace(); // Image shadow + $border = $this->border->visible() ? 1 : 0; // Image border size + + $drawer = $this->drawer; + $drawer->setImageSize( + $this->width - $shadow->left - $shadow->right - $border * 2, + $this->height - $shadow->top - $shadow->bottom - $border * 2 + ); + + // No absolute size specified + if($component->w === NULL and $component->h === NULL) { + + list($width, $height) = $drawer->setSize($component->width, $component->height); + + // Set component size in pixels + $component->setAbsSize($width, $height); + + } else { + + $drawer->setAbsSize($component->w, $component->h); + + } + + if($component->top !== NULL and $component->left !== NULL) { + $drawer->setAbsPosition( + $border + $shadow->left + $component->left, + $border + $shadow->top + $component->top + ); + } else { + $drawer->setPosition($component->x, $component->y); + } + + $drawer->movePosition($border + $shadow->left, $border + $shadow->top); + + list($x1, $y1, $x2, $y2) = $component->getPosition(); + + $component->init($drawer); + + $component->drawComponent($drawer, $x1, $y1, $x2, $y2, $this->antiAliasing); + $component->drawEnvelope($drawer, $x1, $y1, $x2, $y2); + + $component->finalize($drawer); + + } + + function drawShadow() { + + $drawer = $this->getDrawer(); + + $this->shadow->draw( + $drawer, + new awPoint(0, 0), + new awPoint($this->width, $this->height), + SHADOW_IN + ); + + } + + /** + * Send the image into a file or to the user browser + * + * @var string $file Save image into a file if you provide a file name + */ + function send($file = NULL) { + + // Test if format is available + if((imagetypes() & $this->format) === FALSE) { + trigger_error("Format '".$this->format."' is not available on your system. Check that your PHP has been compiled with the good libraries."); + } + + // Get some infos about this image + + switch($this->format) { + case IMAGE_JPEG : + $function = 'imagejpeg'; + break; + case IMAGE_PNG : + $function = 'imagepng'; + break; + case IMAGE_GIF : + $function = 'imagegif'; + break; + } + + // Create image + + if($file !== NULL) { + + $function($this->resource, $file); + + } else { + + // Test some text has been printed + $data = ob_get_contents(); + if($data !== '') { + exit; + } + + // Send headers to the browser + header("Content-type: image/".$this->getFormat()); + + $function($this->resource); + + } + + } + + function getFormat() { + + switch($this->format) { + case IMAGE_JPEG : + return 'jpeg'; + case IMAGE_PNG : + return 'png'; + case IMAGE_GIF : + return 'gif'; + } + + } + +} + +registerClass('Image'); + + +/** + * Load an image from a file + * + * @package Artichow + */ +class awFileImage extends awImage { + + /** + * Build a new awimage + * + * @param string $file Image file name + */ + function awFileImage($file) { + + $image = @getimagesize($file); + + if($image and in_array($image[2], array(2, 3))) { + + $this->setSize($image[0], $image[1]); + + switch($image[2]) { + + case 2 : + $this->resource = imagecreatefromjpeg($file); + break; + + case 3 : + $this->resource = imagecreatefrompng($file); + break; + + } + + $this->drawer = new awDrawer($this->resource); + $this->drawer->setImageSize($this->width, $this->height); + + } else { + trigger_error("Artichow does not support this image (must be in PNG or JPEG)", E_USER_ERROR); + } + + } + +} + +registerClass('FileImage'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/LinePlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/LinePlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..3387b9a67ef3c656c6a8a90e06b82e5623131da1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/LinePlot.class.php @@ -0,0 +1,596 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Plot.class.php"; + +/* <php4> */ + +define("LINEPLOT_LINE", 0); +define("LINEPLOT_MIDDLE", 1); + +/* </php4> */ + +/** + * LinePlot + * + * @package Artichow + */ +class awLinePlot extends awPlot { + + /** + * Add marks to your line plot + * + * @var Mark + */ + var $mark; + + /** + * Labels on your line plot + * + * @var Label + */ + var $label; + + /** + * Filled areas + * + * @var bool + */ + var $areas = array(); + + /** + * Is the line hidden + * + * @var bool + */ + var $lineHide = FALSE; + + /** + * Line color + * + * @var Color + */ + var $lineColor; + + /** + * Line mode + * + * @var int + */ + var $lineMode = LINEPLOT_LINE; + + /** + * Line type + * + * @var int + */ + var $lineStyle = LINE_SOLID; + + /** + * Line thickness + * + * @var int + */ + var $lineThickness = 1; + + /** + * Line background + * + * @var Color, Gradient + */ + var $lineBackground; + + /** + * Line mode + * + * @var int + */ + + + /** + * Line in the middle + * + * @var int + */ + + + /** + * Construct a new awLinePlot + * + * @param array $values Some numeric values for Y axis + * @param int $mode + */ + function awLinePlot($values, $mode = LINEPLOT_LINE) { + + parent::awPlot(); + + $this->mark = new awMark; + $this->label = new awLabel; + + $this->lineMode = (int)$mode; + + $this->setValues($values); + + } + + /** + * Hide line + * + * @param bool $hide + */ + function hideLine($hide) { + $this->lineHide = (bool)$hide; + } + + /** + * Add a filled area + * + * @param int $start Begining of the area + * @param int $end End of the area + * @param mixed $background Background color or gradient of the area + */ + function setFilledArea($start, $stop, $background) { + + if($stop <= $start) { + trigger_error("End position can not be greater than begin position in awLinePlot::setFilledArea()", E_USER_ERROR); + } + + $this->areas[] = array((int)$start, (int)$stop, $background); + + } + + /** + * Change line color + * + * @param $color + */ + function setColor($color) { + $this->lineColor = $color; + } + + /** + * Change line style + * + * @param int $style + */ + function setStyle($style) { + $this->lineStyle = (int)$style; + } + + /** + * Change line tickness + * + * @param int $tickness + */ + function setThickness($tickness) { + $this->lineThickness = (int)$tickness; + } + + /** + * Change line background color + * + * @param $color + */ + function setFillColor($color) { + $this->lineBackground = $color; + } + + /** + * Change line background gradient + * + * @param $gradient + */ + function setFillGradient($gradient) { + $this->lineBackground = $gradient; + } + + /** + * Get the line thickness + * + * @return int + */ + function getLegendLineThickness() { + return $this->lineThickness; + } + + /** + * Get the line type + * + * @return int + */ + function getLegendLineStyle() { + return $this->lineStyle; + } + + /** + * Get the color of line + * + * @return Color + */ + function getLegendLineColor() { + return $this->lineColor; + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + function getLegendBackground() { + return $this->lineBackground; + } + + /** + * Get a mark object + * + * @return Mark + */ + function getLegendMark() { + return $this->mark; + } + + function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $max = $this->getRealYMax(); + $min = $this->getRealYMin(); + + // Get start and stop values + list($start, $stop) = $this->getLimit(); + + if($this->lineMode === LINEPLOT_MIDDLE) { + $inc = $this->xAxis->getDistance(0, 1) / 2; + } else { + $inc = 0; + } + + // Build the polygon + $polygon = new awPolygon; + + for($key = $start; $key <= $stop; $key++) { + + $value = $this->datay[$key]; + + if($value !== NULL) { + + $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value)); + $p = $p->move($inc, 0); + $polygon->set($key, $p); + + } + + } + + // Draw backgrounds + if(is_a($this->lineBackground, 'awColor') or is_a($this->lineBackground, 'awGradient')) { + + $backgroundPolygon = new awPolygon; + + $p = $this->xAxisPoint($start); + $p = $p->move($inc, 0); + $backgroundPolygon->append($p); + + // Add others points + foreach($polygon->all() as $point) { + $backgroundPolygon->append($point); + } + + $p = $this->xAxisPoint($stop); + $p = $p->move($inc, 0); + $backgroundPolygon->append($p); + + // Draw polygon background + $drawer->filledPolygon($this->lineBackground, $backgroundPolygon); + + } + + $this->drawArea($drawer, $polygon); + + // Draw line + $prev = NULL; + + // Line color + if($this->lineHide === FALSE) { + + if($this->lineColor === NULL) { + $this->lineColor = new awColor(0, 0, 0); + } + + foreach($polygon->all() as $point) { + + if($prev !== NULL) { + $drawer->line( + $this->lineColor, + new awLine( + $prev, + $point, + $this->lineStyle, + $this->lineThickness + ) + ); + } + $prev = $point; + + } + + $this->lineColor->free(); + + } + + // Draw marks and labels + foreach($polygon->all() as $key => $point) { + + $this->mark->draw($drawer, $point); + $this->label->draw($drawer, $point, $key); + + } + + } + + function drawArea($drawer, &$polygon) { + + $starts = array(); + foreach($this->areas as $area) { + list($start) = $area; + $starts[$start] = TRUE; + } + + // Draw filled areas + foreach($this->areas as $area) { + + list($start, $stop, $background) = $area; + + $polygonArea = new awPolygon; + + $p = $this->xAxisPoint($start); + $polygonArea->append($p); + + for($i = $start; $i <= $stop; $i++) { + $p = $polygon->get($i); + if($i === $stop and array_key_exists($stop, $starts)) { + $p = $p->move(-1, 0); + } + $polygonArea->append($p); + } + + $p = $this->xAxisPoint($stop); + if(array_key_exists($stop, $starts)) { + $p = $p->move(-1, 0); + } + $polygonArea->append($p); + + // Draw area + $drawer->filledPolygon($background, $polygonArea); + + } + + } + + function getXAxisNumber() { + if($this->lineMode === LINEPLOT_MIDDLE) { + return count($this->datay) + 1; + } else { + return count($this->datay); + } + } + + function xAxisPoint($position) { + $y = $this->xAxisZero ? 0 : $this->getRealYMin(); + return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); + } + + function getXCenter() { + return ($this->lineMode === LINEPLOT_MIDDLE); + } + +} + +registerClass('LinePlot'); + + +/** + * Simple LinePlot + * Useful to draw simple horizontal lines + * + * @package Artichow + */ +class awSimpleLinePlot extends awPlot { + + /** + * Line color + * + * @var Color + */ + var $lineColor; + + /** + * Line start + * + * @var int + */ + var $lineStart; + + /** + * Line stop + * + * @var int + */ + var $lineStop; + + /** + * Line value + * + * @var flaot + */ + var $lineValue; + + /** + * Line mode + * + * @var int + */ + var $lineMode = LINEPLOT_LINE; + + /** + * Line type + * + * @var int + */ + var $lineStyle = LINE_SOLID; + + /** + * Line thickness + * + * @var int + */ + var $lineThickness = 1; + + /** + * Line mode + * + * @var int + */ + + + /** + * Line in the middle + * + * @var int + */ + + + /** + * Construct a new awLinePlot + * + * @param float $value A Y value + * @param int $start Line start index + * @param int $stop Line stop index + * @param int $mode Line mode + */ + function awSimpleLinePlot($value, $start, $stop, $mode = LINEPLOT_LINE) { + + parent::awPlot(); + + $this->lineMode = (int)$mode; + + $this->lineStart = (int)$start; + $this->lineStop = (int)$stop; + $this->lineValue = (float)$value; + + $this->lineColor = new awColor(0, 0, 0); + + } + + /** + * Change line color + * + * @param $color + */ + function setColor($color) { + $this->lineColor = $color; + } + + /** + * Change line style + * + * @param int $style + */ + function setStyle($style) { + $this->lineStyle = (int)$style; + } + + /** + * Change line tickness + * + * @param int $tickness + */ + function setThickness($tickness) { + $this->lineThickness = (int)$tickness; + } + + /** + * Get the line thickness + * + * @return int + */ + function getLegendLineThickness() { + return $this->lineThickness; + } + + /** + * Get the line type + * + * @return int + */ + function getLegendLineStyle() { + return $this->lineStyle; + } + + /** + * Get the color of line + * + * @return Color + */ + function getLegendLineColor() { + return $this->lineColor; + } + + function getLegendBackground() { + return NULL; + } + + function getLegendMark() { + return NULL; + } + + function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing) { + + if($this->lineMode === LINEPLOT_MIDDLE) { + $inc = $this->xAxis->getDistance(0, 1) / 2; + } else { + $inc = 0; + } + + $p1 = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($this->lineStart, $this->lineValue)); + $p2 = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($this->lineStop, $this->lineValue)); + + $drawer->line( + $this->lineColor, + new awLine( + $p1->move($inc, 0), + $p2->move($inc, 0), + $this->lineStyle, + $this->lineThickness + ) + ); + + $this->lineColor->free(); + + } + + function getXAxisNumber() { + if($this->lineMode === LINEPLOT_MIDDLE) { + return count($this->datay) + 1; + } else { + return count($this->datay); + } + } + + function xAxisPoint($position) { + $y = $this->xAxisZero ? 0 : $this->getRealYMin(); + return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); + } + + function getXCenter() { + return ($this->lineMode === LINEPLOT_MIDDLE); + } + +} + +registerClass('SimpleLinePlot'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/MathPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/MathPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..a9469846bbb194fc4bda632352731956c780ab99 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/MathPlot.class.php @@ -0,0 +1,439 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Component.class.php"; + +/** + * A mathematic function + * + * @package Artichow + */ +class awMathFunction { + + /** + * Function line + * + * @var Line + */ + var $line; + + /** + * Marks for your plot + * + * @var Mark + */ + var $mark; + + /** + * Callback function + * + * @var string + */ + var $f; + + /** + * Start the drawing from this value + * + * @var float + */ + var $fromX; + + /** + * Stop the drawing at this value + * + * @var float + */ + var $toX; + + /** + * Line color + * + * @var Color + */ + var $color; + + /** + * Construct the function + * + * @param string $f Callback function + * @param float $fromX + * @param float $toX + */ + function awMathFunction($f, $fromX = NULL, $toX = NULL) { + + $this->f = (string)$f; + $this->fromX = is_null($fromX) ? NULL : (float)$fromX; + $this->toX = is_null($toX) ? NULL : (float)$toX; + + $this->line = new awLine; + $this->mark = new awMark; + $this->color = new awBlack; + + } + + /** + * Change line color + * + * @param $color A new awcolor + */ + function setColor($color) { + $this->color = $color; + } + + /** + * Get line color + * + * @return Color + */ + function getColor() { + return $this->color; + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + function getLegendBackground() { + } + + /** + * Get the line thickness + * + * @return NULL + */ + function getLegendLineThickness() { + return $this->line->getThickness(); + } + + /** + * Get the line type + * + * @return NULL + */ + function getLegendLineStyle() { + return $this->line->getStyle(); + } + + /** + * Get the color of line + * + * @return NULL + */ + function getLegendLineColor() { + return $this->color; + } + + /** + * Get a mark object + * + * @return NULL + */ + function getLegendMark() { + return $this->mark; + } + +} + +registerClass('MathFunction'); + +/** + * For mathematics functions + * + * @package Artichow + */ +class awMathPlot extends awComponent { + + /** + * Functions + * + * @var array + */ + var $functions = array(); + + /** + * Grid properties + * + * @var Grid + */ + var $grid; + + /** + * X axis + * + * @var Axis + */ + var $xAxis; + + /** + * Y axis + * + * @var Axis + */ + var $yAxis; + + /** + * Extremum + * + * @var Side + */ + var $extremum = NULL; + + /** + * Interval + * + * @var float + */ + var $interval = 1; + + /** + * Build the plot + * + * @param int $xMin Minimum X value + * @param int $xMax Maximum X value + * @param int $yMax Maximum Y value + * @param int $yMin Minimum Y value + */ + function awMathPlot($xMin, $xMax, $yMax, $yMin) { + + parent::awComponent(); + + $this->setPadding(8, 8, 8, 8); + + $this->grid = new awGrid; + + // Hide grid by default + $this->grid->hide(TRUE); + + // Set extremum + $this->extremum = new awSide($xMin, $xMax, $yMax, $yMin); + + // Create axis + $this->xAxis = new awAxis; + $this->xAxis->setTickStyle(TICK_IN); + $this->xAxis->label->hideValue(0); + $this->initAxis($this->xAxis); + + $this->yAxis = new awAxis; + $this->yAxis->setTickStyle(TICK_IN); + $this->yAxis->label->hideValue(0); + $this->initAxis($this->yAxis); + + } + + function initAxis(&$axis) { + + $axis->setLabelPrecision(1); + $axis->addTick('major', new awTick(0, 5)); + $axis->addTick('minor', new awTick(0, 3)); + $axis->addTick('micro', new awTick(0, 1)); + $axis->setNumberByTick('minor', 'major', 1); + $axis->setNumberByTick('micro', 'minor', 4); + $axis->label->setFont(new awTuffy(7)); + + } + + /** + * Interval to calculate values + * + * @param float $interval + */ + function setInterval($interval) { + $this->interval = (float)$interval; + } + + /** + * Add a formula f(x) + * + * @param &$function + * @param string $name Name for the legend (can be NULL if you don't want to set a legend) + * @param int $type Type for the legend + */ + function add(&$function, $name = NULL, $type = LEGEND_LINE) { + + $this->functions[] = $function; + + if($name !== NULL) { + $this->legend->add($function, $name, $type); + } + + } + + function init($drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + $this->xAxis->line->setX($x1, $x2); + $this->xAxis->label->setAlign(NULL, LABEL_BOTTOM); + $this->xAxis->label->move(0, 3); + $this->xAxis->setRange($this->extremum->left, $this->extremum->right); + + $this->yAxis->line->setY($y2, $y1); + $this->yAxis->label->setAlign(LABEL_RIGHT); + $this->yAxis->label->move(-6, 0); + $this->yAxis->reverseTickStyle(); + $this->yAxis->setRange($this->extremum->bottom, $this->extremum->top); + + + $this->xAxis->setYCenter($this->yAxis, 0); + $this->yAxis->setXCenter($this->xAxis, 0); + + if($this->yAxis->getLabelNumber() === NULL) { + $number = $this->extremum->top - $this->extremum->bottom + 1; + $this->yAxis->setLabelNumber($number); + } + + if($this->xAxis->getLabelNumber() === NULL) { + $number = $this->extremum->right - $this->extremum->left + 1; + $this->xAxis->setLabelNumber($number); + } + + // Set ticks + + $this->xAxis->ticks['major']->setNumber($this->xAxis->getLabelNumber()); + $this->yAxis->ticks['major']->setNumber($this->yAxis->getLabelNumber()); + + + // Set axis labels + $labels = array(); + for($i = 0, $count = $this->xAxis->getLabelNumber(); $i < $count; $i++) { + $labels[] = $i; + } + $this->xAxis->label->set($labels); + + $labels = array(); + for($i = 0, $count = $this->yAxis->getLabelNumber(); $i < $count; $i++) { + $labels[] = $i; + } + $this->yAxis->label->set($labels); + + parent::init($drawer); + + // Create the grid + $this->createGrid(); + + // Draw the grid + $this->grid->draw($drawer, $x1, $y1, $x2, $y2); + + } + + function drawEnvelope($drawer) { + + // Draw axis + $this->xAxis->draw($drawer); + $this->yAxis->draw($drawer); + + } + + function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing) { + + foreach($this->functions as $function) { + + $f = $function->f; + $fromX = is_null($function->fromX) ? $this->extremum->left : $function->fromX; + $toX = is_null($function->toX) ? $this->extremum->right : $function->toX; + + $old = NULL; + + for($i = $fromX; $i <= $toX; $i += $this->interval) { + + $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($i, $f($i))); + + if($p->y >= $y1 and $p->y <= $y2) { + $function->mark->draw($drawer, $p); + } + + if($old !== NULL) { + + $line = $function->line; + $line->setLocation($old, $p); + + if( + ($line->p1->y >= $y1 and $line->p1->y <= $y2) or + ($line->p2->y >= $y1 and $line->p2->y <= $y2) + ) { + $drawer->line( + $function->getColor(), + $line + ); + } + + } + + $old = $p; + + } + + // Draw last point if needed + if($old !== NULL and $i - $this->interval != $toX) { + + $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($toX, $f($toX))); + + if($p->y >= $y1 and $p->y <= $y2) { + $function->mark->draw($drawer, $p); + } + + + $line = $function->line; + $line->setLocation($old, $p); + + if( + ($line->p1->y >= $y1 and $line->p1->y <= $y2) or + ($line->p2->y >= $y1 and $line->p2->y <= $y2) + ) { + $drawer->line( + $function->getColor(), + $line + ); + } + + } + + } + + } + + function createGrid() { + + // Horizontal lines of the grid + + $major = $this->yAxis->tick('major'); + $interval = $major->getInterval(); + $number = $this->yAxis->getLabelNumber() - 1; + + $h = array(); + if($number > 0) { + for($i = 0; $i <= $number; $i++) { + $h[] = $i / $number; + } + } + + // Vertical lines + + $major = $this->xAxis->tick('major'); + $interval = $major->getInterval(); + $number = $this->xAxis->getLabelNumber() - 1; + + $w = array(); + if($number > 0) { + for($i = 0; $i <= $number; $i++) { + if($i%$interval === 0) { + $w[] = $i / $number; + } + } + } + + $this->grid->setGrid($w, $h); + + } + +} + +registerClass('MathPlot'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/Pattern.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/Pattern.class.php new file mode 100644 index 0000000000000000000000000000000000000000..a7432a0d1bb2dc1caa5ecd2d03a9ba38cf264c3b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/Pattern.class.php @@ -0,0 +1,97 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Graph.class.php"; + +/** + * All patterns must derivate from this class + * + * @package Artichow + */ + class awPattern { + + /** + * Pattern arguments + * + * @var array + */ + var $args = array(); + + /** + * Load a pattern + * + * @param string $pattern Pattern name + * @return Component + */ + function get($pattern) { + + $file = ARTICHOW_PATTERN.DIRECTORY_SEPARATOR.$pattern.'.php'; + + if(is_file($file)) { + + require_once $file; + + $class = $pattern.'Pattern'; + + if(class_exists($class)) { + return new $class; + } else { + trigger_error("Class '".$class."' does not exist", E_USER_ERROR); + } + + } else { + trigger_error("Pattern '".$pattern."' does not exist", E_USER_ERROR); + } + + } + + /** + * Change pattern argument + * + * @param string $name Argument name + * @param mixed $value Argument value + */ + function setArg($name, $value) { + if(is_string($name)) { + $this->args[$name] = $value; + } + } + + /** + * Get an argument + * + * @param string $name + * @param mixed $default Default value if the argument does not exist (default to NULL) + * @return mixed Argument value + */ + function getArg($name, $default = NULL) { + if(array_key_exists($name, $this->args)) { + return $this->args[$name]; + } else { + return $default; + } + } + + /** + * Change several arguments + * + * @param array $args New arguments + */ + function setArgs($args) { + if(is_array($args)) { + foreach($args as $name => $value) { + $this->setArg($name, $value); + } + } + } + +} + +registerClass('Pattern', TRUE); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/Pie.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/Pie.class.php new file mode 100644 index 0000000000000000000000000000000000000000..37fa577a24da1580bc1d1df6b51b3077cb11b3ca --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/Pie.class.php @@ -0,0 +1,680 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Component.class.php"; + +/* <php4> */ + +define("PIE_DARK", 1); +define("PIE_COLORED", 2); +define("PIE_AQUA", 3); +define("PIE_EARTH", 4); + +/* </php4> */ + +/** + * Pie + * + * @package Artichow + */ +class awPie extends awComponent { + + /** + * A dark theme for pies + * + * + * @var int + */ + + + /** + * A colored theme for pies + * + * @var int + */ + + + /** + * A water theme for pies + * + * @var int + */ + + + /** + * A earth theme for pies + * + * @var int + */ + + + /** + * Pie values + * + * @var array + */ + var $values; + + /** + * Pie colors + * + * @var array + */ + var $colors; + + /** + * Pie legend + * + * @var array + */ + var $legendValues = array(); + + /** + * Intensity of the 3D effect + * + * @var int + */ + var $size; + + /** + * Border color + * + * @var Color + */ + var $border; + + /** + * Pie explode + * + * @var array + */ + var $explode = array(); + + /** + * Initial angle + * + * @var int + */ + var $angle = 0; + + /** + * Labels precision + * + * @var int + */ + var $precision; + + /** + * Labels number + * + * @var int + */ + var $number; + + /** + * Labels minimum + * + * @var int + */ + var $minimum; + + /** + * Labels position + * + * @var int + */ + var $position = 15; + + /** + * Labels of your pie + * + * @var Label + */ + var $label; + + /** + * Build the plot + * + * @param array $values Pie values + */ + function awPie($values, $colors = PIE_COLORED) { + + $this->setValues($values); + + if(is_array($colors)) { + $this->colors = $colors; + } else { + + switch($colors) { + + case PIE_AQUA : + $this->colors = array( + new awColor(131, 220, 215), + new awColor(131, 190, 215), + new awColor(131, 160, 215), + new awColor(160, 140, 215), + new awColor(190, 131, 215), + new awColor(220, 131, 215) + ); + break; + + case PIE_EARTH : + $this->colors = array( + new awColor(97, 179, 110), + new awColor(130, 179, 97), + new awColor(168, 179, 97), + new awColor(179, 147, 97), + new awColor(179, 108, 97), + new awColor(99, 107, 189), + new awColor(99, 165, 189) + ); + break; + + case PIE_DARK : + $this->colors = array( + new awColor(140, 100, 170), + new awColor(130, 170, 100), + new awColor(160, 160, 120), + new awColor(150, 110, 140), + new awColor(130, 150, 160), + new awColor(90, 170, 140) + ); + break; + + default : + $this->colors = array( + new awColor(187, 213, 151), + new awColor(223, 177, 151), + new awColor(111, 186, 132), + new awColor(197, 160, 230), + new awColor(165, 169, 63), + new awColor(218, 177, 89), + new awColor(116, 205, 121), + new awColor(200, 201, 78), + new awColor(127, 205, 177), + new awColor(205, 160, 160), + new awColor(190, 190, 190) + ); + break; + + } + + } + + parent::awComponent(); + + $this->label = new awLabel; + $this->label->setCallbackFunction('callbackPerCent'); + + } + + /** + * Change legend values + * + * @param array $legend An array of values for each part of the pie + */ + function setLegend($legend) { + + $this->legendValues = (array)$legend; + + } + + /** + * Set a border all around the pie + * + * @param $color A color for the border + */ + function setBorder($color) { + $this->border = $color; + } + + /** + * Change 3D effect intensity + * + * @param int $size Effect size + */ + function set3D($size) { + $this->size = (int)$size; + } + + /** + * Change initial angle + * + * @param int $angle New angle in degrees + */ + function setStartAngle($angle) { + $this->angle = (int)$angle; + } + + /** + * Change label precision + * + * @param int $precision New precision + */ + function setLabelPrecision($precision) { + $this->precision = (int)$precision; + } + + /** + * Change label position + * + * @param int $position New position in pixels + */ + function setLabelPosition($position) { + $this->position = (int)$position; + } + + /** + * Change label number + * + * @param int $number New number + */ + function setLabelNumber($number) { + $this->number = is_null($number) ? $number : (int)$number; + } + + /** + * Change label minimum + * + * @param int $minimum New minimum + */ + function setLabelMinimum($minimum) { + $this->minimum = is_null($minimum) ? $minimum : (int)$minimum; + } + + /** + * Change Pie explode + * + * @param array $explode + */ + function explode($explode) { + $this->explode = (array)$explode; + } + + function drawEnvelope($drawer) { + + } + + function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $count = count($this->values); + $sum = array_sum($this->values); + + $width = $x2 - $x1; + $height = $y2 - $y1; + + if($aliasing) { + $x = $width / 2; + $y = $height / 2; + } else { + $x = $width / 2 + $x1; + $y = $height / 2 + $y1; + } + + $position = $this->angle; + $values = array(); + $parts = array(); + $angles = 0; + + if($aliasing) { + $side = new awSide(0, 0, 0, 0); + } + + foreach($this->values as $key => $value) { + + $angle = ($value / $sum * 360); + + if($key === $count - 1) { + $angle = 360 - $angles; + } + + $angles += $angle; + + if(array_key_exists($key, $this->explode)) { + $middle = 360 - ($position + $angle / 2); + $posX = $this->explode[$key] * cos($middle * M_PI / 180); + $posY = $this->explode[$key] * sin($middle * M_PI / 180) * -1; + + if($aliasing) { + $explode = new awPoint( + $posX * 2, + $posY * 2 + ); + $side->set( + max($side->left, $posX * -2), + max($side->right, $posX * 2), + max($side->top, $posY * -2), + max($side->bottom, $posY * 2) + ); + } else { + $explode = new awPoint( + $posX, + $posY + ); + } + + } else { + $explode = new awPoint(0, 0); + } + + $values[$key] = array( + $position, ($position + $angle), $explode + ); + + $color = $this->colors[$key % count($this->colors)]; + $parts[$key] = new awPiePart($color); + + // Add part to the legend + $legend = array_key_exists($key, $this->legendValues) ? $this->legendValues[$key] : $key; + $this->legend->add($parts[$key], $legend, LEGEND_BACKGROUND); + + $position += $angle; + + } + + if($aliasing) { + + $mainDrawer = $drawer; + + $x *= 2; + $y *= 2; + $width *= 2; + $height *= 2; + $this->size *= 2; + + $image = new awImage; + $image->border->hide(); + $image->setSize( + $width + $side->left + $side->right, + $height + $side->top + $side->bottom + $this->size + 1 /* bugs.php.net ! */ + ); + + $drawer = $image->getDrawer( + $width / $image->width, + $height / $image->height, + ($width / 2 + $side->left) / $image->width, + ($height / 2 + $side->top) / $image->height + ); + + } + + // Draw 3D effect + for($i = $this->size; $i > 0; $i--) { + + foreach($values as $key => $value) { + + $color = $this->colors[$key % count($this->colors)]; + $color->brightness(-50); + + list($from, $to, $explode) = $value; + + $drawer->filledArc($color, $explode->move($x, $y + $i), $width, $height, $from, $to); + + $color->free(); + unset($color); + + if(is_a($this->border, 'awColor')) { + + $point = $explode->move($x, $y); + + if($i === $this->size) { + + $drawer->arc($this->border, $point->move(0, $this->size), $width, $height, $from, $to); + + } + + } + + } + + } + + foreach($values as $key => $value) { + + $color = $this->colors[$key % count($this->colors)]; + + list($from, $to, $explode) = $value; + + $drawer->filledArc($color, $explode->move($x, $y), $width, $height, $from, $to); + + if(is_a($this->border, 'awColor')) { + + $point = $explode->move($x, $y); + $drawer->arc($this->border, $point, $width, $height, $from, $to); + } + + } + + if($aliasing) { + + $x = $x / 2 + $x1; + $y = $y / 2 + $y1; + $width /= 2; + $height /= 2; + $this->size /= 2; + + foreach($values as $key => $value) { + $old = $values[$key][2]; + $values[$key][2] = new awPoint( + $old->x / 2, $old->y / 2 + ); + } + + $mainDrawer->copyResizeImage( + $image, + new awPoint($x1 - $side->left / 2, $y1 - $side->top / 2), + new awPoint($x1 - $side->left / 2 + $image->width / 2, $y1 - $side->top / 2 + $image->height/ 2), + new awPoint(0, 0), + new awPoint($image->width, $image->height), + TRUE + ); + + $drawer = $mainDrawer; + + } + + // Get labels values + $pc = array(); + foreach($this->values as $key => $value) { + $pc[$key] = round($value / $sum * 100, $this->precision); + } + if($this->label->count() === 0) { // Check that there is no user defined values + $this->label->set($pc); + } + + $position = 0; + + foreach($pc as $key => $value) { + + // Limit number of labels to display + if($position === $this->number) { + break; + } + + if(is_null($this->minimum) === FALSE and $value < $this->minimum) { + continue; + } + + $position++; + + list($from, $to, $explode) = $values[$key]; + + $angle = $from + ($to - $from) / 2; + $angleRad = (360 - $angle) * M_PI / 180; + + $point = new awPoint( + $x + $explode->x + cos($angleRad) * ($width / 2 + $this->position), + $y + $explode->y - sin($angleRad) * ($height / 2 + $this->position) + ); + + $angle %= 360; + + // We don't display labels on the 3D effect + if($angle > 0 and $angle < 180) { + $point = $point->move(0, -1 * sin($angleRad) * $this->size); + } + + if($angle >= 45 and $angle < 135) { + $this->label->setAlign(LABEL_CENTER, LABEL_BOTTOM); + } else if($angle >= 135 and $angle < 225) { + $this->label->setAlign(LABEL_RIGHT, LABEL_MIDDLE); + } else if($angle >= 225 and $angle < 315) { + $this->label->setAlign(LABEL_CENTER, LABEL_TOP); + } else { + $this->label->setAlign(LABEL_LEFT, LABEL_MIDDLE); + } + + $this->label->draw( + $drawer, + $point, + $key + ); + + } + + } + + /** + * Return margins around the component + * + * @return array Left, right, top and bottom margins + */ + function getMargin() { + + // Get axis informations + + $leftAxis = $this->padding->left; + $rightAxis = $this->padding->right; + $topAxis = $this->padding->top; + $bottomAxis = $this->padding->bottom; + + return array($leftAxis, $rightAxis, $topAxis, $bottomAxis); + + } + + + /** + * Change values of Y axis + * This method ignores not numeric values + * + * @param array $values + */ + function setValues($values) { + + $this->checkArray($values); + $this->values = $values; + + } + + + /** + * Return values of Y axis + * + * @return array + */ + function getValues() { + return $this->values; + } + + function checkArray(&$array) { + + if(is_array($array) === FALSE) { + trigger_error("You tried to set values that are not an array"); + } + + foreach($array as $key => $value) { + if(is_numeric($value) === FALSE) { + unset($array[$key]); + } + } + + if(count($array) < 1) { + trigger_error("Your graph must have at least 1 value"); + } + + } + +} + +registerClass('Pie'); + +/** + * Pie + * + * @package Artichow + */ +class awPiePart { + + /** + * Pie part color + * + * @var Color + */ + var $color; + + /** + * Build a new awPiePart + * + * @param $color Pie part color + */ + function awPiePart($color) { + + $this->color = $color; + + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + function getLegendBackground() { + return $this->color; + } + + /** + * Get the line thickness + * + * @return NULL + */ + function getLegendLineThickness() { + } + + /** + * Get the line type + * + * @return NULL + */ + function getLegendLineStyle() { + } + + /** + * Get the color of line + * + * @return NULL + */ + function getLegendLineColor() { + } + + /** + * Get a mark object + * + * @return NULL + */ + function getLegendMark() { + } + +} + +registerClass('PiePart'); + +function callbackPerCent($value) { + return $value.'%'; +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/Plot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/Plot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..3551ff1e7162cdc421dc462313a02829a9420288 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/Plot.class.php @@ -0,0 +1,1464 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Component.class.php"; + +/* <php4> */ + +define("PLOT_LEFT", 'left'); +define("PLOT_RIGHT", 'right'); +define("PLOT_TOP", 'top'); +define("PLOT_BOTTOM", 'bottom'); +define("PLOT_BOTH", 'both'); + +/* </php4> */ + +/** + * Graph using X and Y axis + * + * @package Artichow + */ + class awPlot extends awComponent { + + /** + * Values for Y axis + * + * @var array + */ + var $datay; + + /** + * Values for X axis + * + * @var array + */ + var $datax; + + /** + * Grid properties + * + * @var Grid + */ + var $grid; + + /** + * X axis + * + * @var Axis + */ + var $xAxis; + + /** + * Y axis + * + * @var Axis + */ + var $yAxis; + + /** + * Position of X axis + * + * @var int + */ + var $xAxisPosition = PLOT_BOTTOM; + + /** + * Set X axis on zero ? + * + * @var bool + */ + var $xAxisZero = TRUE; + + /** + * Set Y axis on zero ? + * + * @var bool + */ + var $yAxisZero = FALSE; + + /** + * Position of Y axis + * + * @var int + */ + var $yAxisPosition = PLOT_LEFT; + + /** + * Change min value for Y axis + * + * @var mixed + */ + var $yMin = NULL; + + /** + * Change max value for Y axis + * + * @var mixed + */ + var $yMax = NULL; + + /** + * Change min value for X axis + * + * @var mixed + */ + var $xMin = NULL; + + /** + * Change max value for X axis + * + * @var mixed + */ + var $xMax = NULL; + + /** + * Left axis + * + * @var int + */ + + + /** + * RIGHT axis + * + * @var int + */ + + + /** + * Top axis + * + * @var int + */ + + + /** + * Bottom axis + * + * @var int + */ + + + /** + * Both left/right or top/bottom axis + * + * @var int + */ + + + /** + * Build the plot + * + */ + function awPlot() { + + parent::awComponent(); + + $this->grid = new awGrid; + $this->grid->setBackgroundColor(new awWhite); + + $this->padding->add(20, 0, 0, 20); + + $this->xAxis = new awAxis; + $this->xAxis->addTick('major', new awTick(0, 5)); + $this->xAxis->addTick('minor', new awTick(0, 3)); + $this->xAxis->setTickStyle(TICK_OUT); + $this->xAxis->label->setFont(new awTuffy(7)); + + $this->yAxis = new awAxis; + $this->yAxis->auto(TRUE); + $this->yAxis->addTick('major', new awTick(0, 5)); + $this->yAxis->addTick('minor', new awTick(0, 3)); + $this->yAxis->setTickStyle(TICK_OUT); + $this->yAxis->setNumberByTick('minor', 'major', 3); + $this->yAxis->label->setFont(new awTuffy(7)); + $this->yAxis->title->setAngle(90); + + } + + /** + * Get plot values + * + * @return array + */ + function getValues() { + return $this->datay; + } + + /** + * Reduce number of values in the plot + * + * @param int $number Reduce number of values to $number + */ + function reduce($number) { + + $count = count($this->datay); + $ratio = ceil($count / $number); + + if($ratio > 1) { + + $tmpy = $this->datay; + $datay = array(); + + $datax = array(); + $cbLabel = $this->xAxis->label->getCallbackFunction(); + + for($i = 0; $i < $count; $i += $ratio) { + + $slice = array_slice($tmpy, $i, $ratio); + $datay[] = array_sum($slice) / count($slice); + + // Reduce data on X axis if needed + if($cbLabel !== NULL) { + $datax[] = $cbLabel($i + round($ratio / 2)); + } + + } + + $this->setValues($datay); + + if($cbLabel !== NULL) { + $this->xAxis->setLabelText($datax); + } + + + } + + } + + /** + * Count values in the plot + * + * @return int + */ + function getXAxisNumber() { + list($min, $max) = $this->xAxis->getRange(); + return ($max - $min + 1); + } + + /** + * Change X axis + * + * @param int $axis + */ + function setXAxis($axis) { + $this->xAxisPosition = $axis; + } + + /** + * Get X axis + * + * @return int + */ + function getXAxis() { + return $this->xAxisPosition; + } + + /** + * Set X axis on zero + * + * @param bool $zero + */ + function setXAxisZero($zero) { + $this->xAxisZero = (bool)$zero; + } + + /** + * Set Y axis on zero + * + * @param bool $zero + */ + function setYAxisZero($zero) { + $this->yAxisZero = (bool)$zero; + } + + /** + * Change Y axis + * + * @param int $axis + */ + function setYAxis($axis) { + $this->yAxisPosition = $axis; + } + + /** + * Get Y axis + * + * @return int + */ + function getYAxis() { + return $this->yAxisPosition; + } + + /** + * Change min value for Y axis + * Set NULL for auto selection. + * + * @param float $value + */ + function setYMin($value) { + $this->yMin = $value; + $this->yAxis->auto(FALSE); + $this->updateAxis(); + } + + /** + * Change max value for Y axis + * Set NULL for auto selection. + * + * @param float $value + */ + function setYMax($value) { + $this->yMax = $value; + $this->yAxis->auto(FALSE); + $this->updateAxis(); + } + + /** + * Change min value for X axis + * Set NULL for auto selection. + * + * @param float $value + */ + function setXMin($value) { + $this->xMin = $value; + $this->updateAxis(); + } + + /** + * Change max value for X axis + * Set NULL for auto selection. + * + * @param float $value + */ + function setXMax($value) { + $this->xMax = $value; + $this->updateAxis(); + } + + /** + * Get min value for Y axis + * + * @return float $value + */ + function getYMin() { + if($this->auto) { + if(is_null($this->yMin)) { + $min = array_min($this->datay); + if($min > 0) { + return 0; + } + } + } + return is_null($this->yMin) ? array_min($this->datay) : (float)$this->yMin; + } + + /** + * Get max value for Y axis + * + * @return float $value + */ + function getYMax() { + if($this->auto) { + if(is_null($this->yMax)) { + $max = array_max($this->datay); + if($max < 0) { + return 0; + } + } + } + return is_null($this->yMax) ? array_max($this->datay) : (float)$this->yMax; + } + + /** + * Get min value for X axis + * + * @return float $value + */ + function getXMin() { + return floor(is_null($this->xMin) ? array_min($this->datax) : $this->xMin); + } + + /** + * Get max value for X axis + * + * @return float $value + */ + function getXMax() { + return (ceil(is_null($this->xMax) ? array_max($this->datax) : (float)$this->xMax)) + ($this->getXCenter() ? 1 : 0); + } + + /** + * Get min value with spaces for Y axis + * + * @return float $value + */ + function getRealYMin() { + $min = $this->getYMin(); + if($this->space->bottom !== NULL) { + $interval = ($this->getYMax() - $min) * $this->space->bottom / 100; + return $min - $interval; + } else { + return is_null($this->yMin) ? $min : (float)$this->yMin; + } + } + + /** + * Get max value with spaces for Y axis + * + * @return float $value + */ + function getRealYMax() { + $max = $this->getYMax(); + if($this->space->top !== NULL) { + $interval = ($max - $this->getYMin()) * $this->space->top / 100; + return $max + $interval; + } else { + return is_null($this->yMax) ? $max : (float)$this->yMax; + } + } + + function init($drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + // Get space informations + list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); + + $this->xAxis->setPadding($leftSpace, $rightSpace); + + if($this->space->bottom > 0 or $this->space->top > 0) { + + list($min, $max) = $this->yAxis->getRange(); + $interval = $max - $min; + + $this->yAxis->setRange( + $min - $interval * $this->space->bottom / 100, + $max + $interval * $this->space->top / 100 + ); + + } + + // Auto-scaling mode + $this->yAxis->autoScale(); + + // Number of labels is not specified + if($this->yAxis->getLabelNumber() === NULL) { + $number = round(($y2 - $y1) / 75) + 2; + $this->yAxis->setLabelNumber($number); + } + + $this->xAxis->line->setX($x1, $x2); + $this->yAxis->line->setY($y2, $y1); + + // Set ticks + + $this->xAxis->ticks['major']->setNumber($this->getXAxisNumber()); + $this->yAxis->ticks['major']->setNumber($this->yAxis->getLabelNumber()); + + + // Center X axis on zero + if($this->xAxisZero) { + $this->xAxis->setYCenter($this->yAxis, 0); + } + + // Center Y axis on zero + if($this->yAxisZero) { + $this->yAxis->setXCenter($this->xAxis, 0); + } + + // Set axis labels + $labels = array(); + for($i = 0, $count = $this->getXAxisNumber(); $i < $count; $i++) { + $labels[] = $i; + } + $this->xAxis->label->set($labels); + + parent::init($drawer); + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + list($leftSpace, $rightSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); + + // Create the grid + $this->createGrid(); + + // Draw the grid + $this->grid->setSpace($leftSpace, $rightSpace, 0, 0); + $this->grid->draw($drawer, $x1, $y1, $x2, $y2); + + } + + function drawEnvelope($drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + if($this->getXCenter()) { + $size = $this->xAxis->getDistance(0, 1); + $this->xAxis->label->move($size / 2, 0); + $this->xAxis->label->hideLast(TRUE); + } + + // Draw top axis + if($this->xAxisPosition === PLOT_TOP or $this->xAxisPosition === PLOT_BOTH) { + $top = $this->xAxis; + if($this->xAxisZero === FALSE) { + $top->line->setY($y1, $y1); + } + $top->label->setAlign(NULL, LABEL_TOP); + $top->label->move(0, -3); + $top->title->move(0, -25); + $top->draw($drawer); + } + + // Draw bottom axis + if($this->xAxisPosition === PLOT_BOTTOM or $this->xAxisPosition === PLOT_BOTH) { + $bottom = $this->xAxis; + if($this->xAxisZero === FALSE) { + $bottom->line->setY($y2, $y2); + } + $bottom->label->setAlign(NULL, LABEL_BOTTOM); + $bottom->label->move(0, 3); + $bottom->reverseTickStyle(); + $bottom->title->move(0, 25); + $bottom->draw($drawer); + } + + // Draw left axis + if($this->yAxisPosition === PLOT_LEFT or $this->yAxisPosition === PLOT_BOTH) { + $left = $this->yAxis; + if($this->yAxisZero === FALSE) { + $left->line->setX($x1, $x1); + } + $left->label->setAlign(LABEL_RIGHT); + $left->label->move(-6, 0); + $left->title->move(-25, 0); + $left->draw($drawer); + } + + // Draw right axis + if($this->yAxisPosition === PLOT_RIGHT or $this->yAxisPosition === PLOT_BOTH) { + $right = $this->yAxis; + if($this->yAxisZero === FALSE) { + $right->line->setX($x2, $x2); + } + $right->label->setAlign(LABEL_LEFT); + $right->label->move(6, 0); + $right->reverseTickStyle(); + $right->title->move(25, 0); + $right->draw($drawer); + } + + } + + function createGrid() { + + $max = $this->getRealYMax(); + $min = $this->getRealYMin(); + + $number = $this->yAxis->getLabelNumber() - 1; + + if($number < 1) { + return; + } + + // Horizontal lines of the grid + + $h = array(); + for($i = 0; $i <= $number; $i++) { + $h[] = $i / $number; + } + + // Vertical lines + + $major = $this->yAxis->tick('major'); + $interval = $major->getInterval(); + $number = $this->getXAxisNumber() - 1; + + $w = array(); + + if($number > 0) { + + for($i = 0; $i <= $number; $i++) { + if($i%$interval === 0) { + $w[] = $i / $number; + } + } + + } + + $this->grid->setGrid($w, $h); + + } + + /** + * Change values of Y axis + * This method ignores not numeric values + * + * @param array $datay + * @param array $datax + */ + function setValues($datay, $datax = NULL) { + + $this->checkArray($datay); + + foreach($datay as $key => $value) { + unset($datay[$key]); + $datay[(int)$key] = $value; + } + + if($datax === NULL) { + $datax = array(); + for($i = 0; $i < count($datay); $i++) { + $datax[] = $i; + } + } else { + foreach($datax as $key => $value) { + unset($datax[$key]); + $datax[(int)$key] = $value; + } + } + + $this->checkArray($datax); + + if(count($datay) === count($datax)) { + + // Set values + $this->datay = $datay; + $this->datax = $datax; + // Update axis with the new awvalues + $this->updateAxis(); + } else { + trigger_error("Plots must have the same number of X and Y points", E_USER_ERROR); + } + + } + + /** + * Return begin and end values + * + * @return array + */ + function getLimit() { + + $i = 0; + while(array_key_exists($i, $this->datay) and $this->datay[$i] === NULL) { + $i++; + } + $start = $i; + $i = count($this->datay) - 1; + while(array_key_exists($i, $this->datay) and $this->datay[$i] === NULL) { + $i--; + } + $stop = $i; + + return array($start, $stop); + + } + + /** + * Return TRUE if labels must be centered on X axis, FALSE otherwise + * + * @return bool + */ + + + function updateAxis() { + + $this->xAxis->setRange( + $this->getXMin(), + $this->getXMax() + ); + $this->yAxis->setRange( + $this->getRealYMin(), + $this->getRealYMax() + ); + + } + + function checkArray(&$array) { + + if(is_array($array) === FALSE) { + trigger_error("You tried to set a value that is not an array", E_USER_ERROR); + } + + foreach($array as $key => $value) { + if(is_numeric($value) === FALSE and is_null($value) === FALSE) { + trigger_error("Expected numeric values for the plot", E_USER_ERROR); + } + } + + if(count($array) < 1) { + trigger_error("Your plot must have at least 1 value", E_USER_ERROR); + } + + } + +} + +registerClass('Plot', TRUE); + +class awPlotAxis { + + /** + * Left axis + * + * @var Axis + */ + var $left; + + /** + * Right axis + * + * @var Axis + */ + var $right; + + /** + * Top axis + * + * @var Axis + */ + var $top; + + /** + * Bottom axis + * + * @var Axis + */ + var $bottom; + + /** + * Build the group of axis + */ + function awPlotAxis() { + + $this->left = new awAxis; + $this->left->auto(TRUE); + $this->left->label->setAlign(LABEL_RIGHT); + $this->left->label->move(-6, 0); + $this->yAxis($this->left); + $this->left->setTickStyle(TICK_OUT); + $this->left->title->move(-25, 0); + + $this->right = new awAxis; + $this->right->auto(TRUE); + $this->right->label->setAlign(LABEL_LEFT); + $this->right->label->move(6, 0); + $this->yAxis($this->right); + $this->right->setTickStyle(TICK_IN); + $this->right->title->move(25, 0); + + $this->top = new awAxis; + $this->top->label->setAlign(NULL, LABEL_TOP); + $this->top->label->move(0, -3); + $this->xAxis($this->top); + $this->top->setTickStyle(TICK_OUT); + $this->top->title->move(0, -25); + + $this->bottom = new awAxis; + $this->bottom->label->setAlign(NULL, LABEL_BOTTOM); + $this->bottom->label->move(0, 3); + $this->xAxis($this->bottom); + $this->bottom->setTickStyle(TICK_IN); + $this->bottom->title->move(0, 25); + + } + + function xAxis(&$axis) { + + $axis->addTick('major', new awTick(0, 5)); + $axis->addTick('minor', new awTick(0, 3)); + $axis->label->setFont(new awTuffy(7)); + + } + + function yAxis(&$axis) { + + $axis->addTick('major', new awTick(0, 5)); + $axis->addTick('minor', new awTick(0, 3)); + $axis->setNumberByTick('minor', 'major', 3); + $axis->label->setFont(new awTuffy(7)); + $axis->title->setAngle(90); + + } + +} + +registerClass('PlotAxis'); + +/** + * A graph with axis can contain some groups of components + * + * @package Artichow + */ +class awPlotGroup extends awComponentGroup { + + /** + * Grid properties + * + * @var Grid + */ + var $grid; + + /** + * Left, right, top and bottom axis + * + * @var PlotAxis + */ + var $axis; + + /** + * Set the X axis on zero + * + * @var bool + */ + var $xAxisZero = TRUE; + + /** + * Set the Y axis on zero + * + * @var bool + */ + var $yAxisZero = FALSE; + + /** + * Real axis used for Y axis + * + * @var string + */ + var $yRealAxis = PLOT_LEFT; + + /** + * Real axis used for X axis + * + * @var string + */ + var $xRealAxis = PLOT_BOTTOM; + + /** + * Change min value for Y axis + * + * @var mixed + */ + var $yMin = NULL; + + /** + * Change max value for Y axis + * + * @var mixed + */ + var $yMax = NULL; + + /** + * Change min value for X axis + * + * @var mixed + */ + var $xMin = NULL; + + /** + * Change max value for X axis + * + * @var mixed + */ + var $xMax = NULL; + + /** + * Build the PlotGroup + * + */ + function awPlotGroup() { + + parent::awComponentGroup(); + + $this->grid = new awGrid; + $this->grid->setBackgroundColor(new awWhite); + + $this->axis = new awPlotAxis; + + } + + /** + * Set the X axis on zero or not + * + * @param bool $zero + */ + function setXAxisZero($zero) { + $this->xAxisZero = (bool)$zero; + } + + /** + * Set the Y axis on zero or not + * + * @param bool $zero + */ + function setYAxisZero($zero) { + $this->yAxisZero = (bool)$zero; + } + + /** + * Change min value for Y axis + * Set NULL for auto selection. + * + * @param float $value + */ + function setYMin($value) { + $this->axis->left->auto(FALSE); + $this->axis->right->auto(FALSE); + $this->yMin = $value; + } + + /** + * Change max value for Y axis + * Set NULL for auto selection. + * + * @param float $value + */ + function setYMax($value) { + $this->axis->left->auto(FALSE); + $this->axis->right->auto(FALSE); + $this->yMax = $value; + } + + /** + * Change min value for X axis + * Set NULL for auto selection. + * + * @param float $value + */ + function setXMin($value) { + $this->xMin = $value; + } + + /** + * Change max value for X axis + * Set NULL for auto selection. + * + * @param float $value + */ + function setXMax($value) { + $this->xMax = $value; + } + + /** + * Get min value for X axis + * + * @return float $value + */ + function getXMin() { + + return $this->getX('min'); + + } + + /** + * Get max value for X axis + * + * @return float $value + */ + function getXMax() { + + return $this->getX('max'); + + } + + function getX($type) { + + switch($type) { + case 'max' : + if($this->xMax !== NULL) { + return $this->xMax; + } + break; + case 'min' : + if($this->xMin !== NULL) { + return $this->xMin; + } + break; + } + + $value = NULL; + $get = 'getX'.ucfirst($type); + + for($i = 0; $i < count($this->components); $i++) { + + $component = $this->components[$i]; + + if($value === NULL) { + $value = $component->$get(); + } else { + $value = $type($value, $component->$get()); + } + + } + + return $value; + + } + + /** + * Get min value with spaces for Y axis + * + * @param string $axis Axis name + * @return float $value + */ + function getRealYMin($axis = NULL) { + + if($axis === NULL) { + return NULL; + } + + $min = $this->getRealY('min', $axis); + $max = $this->getRealY('max', $axis); + + if($this->space->bottom !== NULL) { + $interval = ($min - $max) * $this->space->bottom / 100; + return $min + $interval; + } else { + return $min; + } + + } + + /** + * Get max value with spaces for Y axis + * + * @param string $axis Axis name + * @return float $value + */ + function getRealYMax($axis = NULL) { + + if($axis === NULL) { + return NULL; + } + + $min = $this->getRealY('min', $axis); + $max = $this->getRealY('max', $axis); + + if($this->space->top !== NULL) { + $interval = ($max - $min) * $this->space->top / 100; + return $max + $interval; + } else { + return $max; + } + + } + + function getRealY($type, $axis) { + + switch($type) { + case 'max' : + if($this->yMax !== NULL) { + return $this->yMax; + } + break; + case 'min' : + if($this->yMin !== NULL) { + return $this->yMin; + } + break; + } + + $value = NULL; + $get = 'getY'.ucfirst($type); + + for($i = 0; $i < count($this->components); $i++) { + + $component = $this->components[$i]; + + switch($axis) { + + case PLOT_LEFT : + case PLOT_RIGHT : + $test = ($component->getYAxis() === $axis); + break; + default : + $test = FALSE; + + } + + if($test) { + if($value === NULL) { + $value = $component->$get(); + } else { + $value = $type($value, $component->$get()); + } + } + + } + + return $value; + + } + + function init($drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + // Get PlotGroup space + list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); + + // Count values in the group + $values = $this->getXAxisNumber(); + + // Init the PlotGroup + $this->axis->top->line->setX($x1, $x2); + $this->axis->bottom->line->setX($x1, $x2); + $this->axis->left->line->setY($y2, $y1); + $this->axis->right->line->setY($y2, $y1); + + $this->axis->top->setPadding($leftSpace, $rightSpace); + $this->axis->bottom->setPadding($leftSpace, $rightSpace); + + $xMin = $this->getXMin(); + $xMax = $this->getXMax(); + + $this->axis->top->setRange($xMin, $xMax); + $this->axis->bottom->setRange($xMin, $xMax); + + for($i = 0; $i < count($this->components); $i++) { + + + $component = &$this->components[$i]; + + $component->auto($this->auto); + + // Copy space to the component + + $component->setSpace($this->space->left, $this->space->right, $this->space->top, $this->space->bottom); + + $component->xAxis->setPadding($leftSpace, $rightSpace); + $component->xAxis->line->setX($x1, $x2); + + $component->yAxis->line->setY($y2, $y1); + + } + + // Set Y axis range + foreach(array('left', 'right') as $axis) { + + if($this->isAxisUsed($axis)) { + + $min = $this->getRealYMin($axis); + $max = $this->getRealYMax($axis); + + $interval = $max - $min; + + $this->axis->{$axis}->setRange( + $min - $interval * $this->space->bottom / 100, + $max + $interval * $this->space->top / 100 + ); + + // Auto-scaling mode + $this->axis->{$axis}->autoScale(); + + } + + } + + if($this->axis->left->getLabelNumber() === NULL) { + $number = round(($y2 - $y1) / 75) + 2; + $this->axis->left->setLabelNumber($number); + } + + if($this->axis->right->getLabelNumber() === NULL) { + $number = round(($y2 - $y1) / 75) + 2; + $this->axis->right->setLabelNumber($number); + } + + // Center labels on X axis if needed + $test = array(PLOT_TOP => FALSE, PLOT_BOTTOM => FALSE); + + for($i = 0; $i < count($this->components); $i++) { + + + $component = &$this->components[$i]; + + + if($component->getValues() !== NULL) { + + $axis = $component->getXAxis(); + + if($test[$axis] === FALSE) { + + // Center labels for bar plots + if($component->getXCenter()) { + $size = $this->axis->{$axis}->getDistance(0, 1); + $this->axis->{$axis}->label->move($size / 2, 0); + $this->axis->{$axis}->label->hideLast(TRUE); + $test[$axis] = TRUE; + } + + } + + } + + + } + + // Set axis labels + $labels = array(); + for($i = $xMin; $i <= $xMax; $i++) { + $labels[] = $i; + } + if($this->axis->top->label->count() === 0) { + $this->axis->top->label->set($labels); + } + if($this->axis->bottom->label->count() === 0) { + $this->axis->bottom->label->set($labels); + } + + // Set ticks + + $this->axis->top->ticks['major']->setNumber($values); + $this->axis->bottom->ticks['major']->setNumber($values); + $this->axis->left->ticks['major']->setNumber($this->axis->left->getLabelNumber()); + $this->axis->right->ticks['major']->setNumber($this->axis->right->getLabelNumber()); + + + // Set X axis on zero + if($this->xAxisZero) { + $axis = $this->selectYAxis(); + $this->axis->bottom->setYCenter($axis, 0); + $this->axis->top->setYCenter($axis, 0); + } + + // Set Y axis on zero + if($this->yAxisZero) { + $axis = $this->selectXAxis(); + $this->axis->left->setXCenter($axis, 1); + $this->axis->right->setXCenter($axis, 1); + } + + parent::init($drawer); + + list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); + + // Create the grid + $this->createGrid(); + + // Draw the grid + $this->grid->setSpace($leftSpace, $rightSpace, 0, 0); + $this->grid->draw($drawer, $x1, $y1, $x2, $y2); + + } + + function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $xMin = $this->getXMin(); + $xMax = $this->getXMax(); + + $maxLeft = $this->getRealYMax(PLOT_LEFT); + $maxRight = $this->getRealYMax(PLOT_RIGHT); + + $minLeft = $this->getRealYMin(PLOT_LEFT); + $minRight = $this->getRealYMin(PLOT_RIGHT); + + foreach($this->components as $component) { + + $min = $component->getYMin(); + $max = $component->getYMax(); + + // Set component minimum and maximum + if($component->getYAxis() === PLOT_LEFT) { + + list($min, $max) = $this->axis->left->getRange(); + + $component->setYMin($min); + $component->setYMax($max); + + } else { + + list($min, $max) = $this->axis->right->getRange(); + + $component->setYMin($min); + $component->setYMax($max); + + } + + $component->setXAxisZero($this->xAxisZero); + $component->setYAxisZero($this->yAxisZero); + + $component->xAxis->setRange($xMin, $xMax); + + $component->drawComponent( + $drawer, + $x1, $y1, + $x2, $y2, + $aliasing + ); + + $component->setYMin($min); + $component->setYMax($max); + + } + + } + + function drawEnvelope($drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + // Hide unused axis + foreach(array(PLOT_LEFT, PLOT_RIGHT, PLOT_TOP, PLOT_BOTTOM) as $axis) { + if($this->isAxisUsed($axis) === FALSE) { + $this->axis->{$axis}->hide(TRUE); + } + } + + // Draw top axis + $top = $this->axis->top; + if($this->xAxisZero === FALSE) { + $top->line->setY($y1, $y1); + } + $top->draw($drawer); + + // Draw bottom axis + $bottom = $this->axis->bottom; + if($this->xAxisZero === FALSE) { + $bottom->line->setY($y2, $y2); + } + $bottom->draw($drawer); + + // Draw left axis + $left = $this->axis->left; + if($this->yAxisZero === FALSE) { + $left->line->setX($x1, $x1); + } + $left->draw($drawer); + + // Draw right axis + $right = $this->axis->right; + if($this->yAxisZero === FALSE) { + $right->line->setX($x2, $x2); + } + $right->draw($drawer); + + } + + /** + * Is the specified axis used ? + * + * @param string $axis Axis name + * @return bool + */ + function isAxisUsed($axis) { + + for($i = 0; $i < count($this->components); $i++) { + + $component = $this->components[$i]; + + switch($axis) { + + case PLOT_LEFT : + case PLOT_RIGHT : + if($component->getYAxis() === $axis) { + return TRUE; + } + break; + + case PLOT_TOP : + case PLOT_BOTTOM : + if($component->getXAxis() === $axis) { + return TRUE; + } + break; + + } + + } + + return FALSE; + + } + + function createGrid() { + + $max = $this->getRealYMax(PLOT_LEFT); + $min = $this->getRealYMin(PLOT_RIGHT); + + // Select axis (left if possible, right otherwise) + $axis = $this->selectYAxis(); + + $number = $axis->getLabelNumber() - 1; + + if($number < 1) { + return; + } + + // Horizontal lines of grid + + $h = array(); + for($i = 0; $i <= $number; $i++) { + $h[] = $i / $number; + } + + // Vertical lines + + $major = $axis->tick('major'); + $interval = $major->getInterval(); + $number = $this->getXAxisNumber() - 1; + + $w = array(); + + if($number > 0) { + + for($i = 0; $i <= $number; $i++) { + if($i%$interval === 0) { + $w[] = $i / $number; + } + } + + } + + $this->grid->setGrid($w, $h); + + } + + function selectYAxis(){ + + // Select axis (left if possible, right otherwise) + if($this->isAxisUsed(PLOT_LEFT)) { + $axis = $this->axis->left; + } else { + $axis = $this->axis->right; + } + + return $axis; + + } + + function selectXAxis(){ + + // Select axis (bottom if possible, top otherwise) + if($this->isAxisUsed(PLOT_BOTTOM)) { + $axis = $this->axis->bottom; + } else { + $axis = $this->axis->top; + } + + return $axis; + + } + + function getXAxisNumber() { + $offset = $this->components[0]; + $max = $offset->getXAxisNumber(); + for($i = 1; $i < count($this->components); $i++) { + $offset = $this->components[$i]; + $max = max($max, $offset->getXAxisNumber()); + } + return $max; + } + +} + +registerClass('PlotGroup'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/ScatterPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/ScatterPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..c820fd9af42849896fd7b6e680979aa4725440fb --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/ScatterPlot.class.php @@ -0,0 +1,303 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Plot.class.php"; + +/** + * ScatterPlot + * + * @package Artichow + */ +class awScatterPlot extends awPlot { + + /** + * Add marks to the scatter plot + * + * @var Mark + */ + var $mark; + + /** + * Labels on the plot + * + * @var Label + */ + var $label; + + /** + * Link points ? + * + * @var bool + */ + var $link = FALSE; + + /** + * Display impulses + * + * @var bool + */ + var $impulse = NULL; + + /** + * Link NULL points ? + * + * @var bool + */ + var $linkNull = FALSE; + + /** + * Line color + * + * @var Color + */ + var $lineColor; + + /** + * Line type + * + * @var int + */ + var $lineStyle = LINE_SOLID; + + /** + * Line thickness + * + * @var int + */ + var $lineThickness = 1; + + /** + * Construct a new awScatterPlot + * + * @param array $datay Numeric values for Y axis + * @param array $datax Numeric values for X axis + * @param int $mode + */ + function awScatterPlot($datay, $datax = NULL) { + + parent::awPlot(); + + // Defaults marks + $this->mark = new awMark; + $this->mark->setType(MARK_CIRCLE); + $this->mark->setSize(7); + $this->mark->border->show(); + + $this->label = new awLabel; + + $this->setValues($datay, $datax); + $this->setColor(new awBlack); + + } + + /** + * Display plot as impulses + * + * @param $impulse Impulses color (or NULL to disable impulses) + */ + function setImpulse($color) { + $this->impulse = $color; + } + + /** + * Link scatter plot points + * + * @param bool $link + * @param $color Line color (default to black) + */ + function link($link, $color = NULL) { + $this->link = (bool)$link; + if(is_a($color, 'awColor')) { + $this->setColor($color); + } + } + + /** + * Ignore null values for Y data and continue linking + * + * @param bool $link + */ + function linkNull($link) { + $this->linkNull = (bool)$link; + } + + /** + * Change line color + * + * @param $color + */ + function setColor($color) { + $this->lineColor = $color; + } + + /** + * Change line style + * + * @param int $style + */ + function setStyle($style) { + $this->lineStyle = (int)$style; + } + + /** + * Change line tickness + * + * @param int $tickness + */ + function setThickness($tickness) { + $this->lineThickness = (int)$tickness; + } + + /** + * Get the line thickness + * + * @return int + */ + function getLegendLineThickness() { + return $this->lineThickness; + } + + /** + * Get the line type + * + * @return int + */ + function getLegendLineStyle() { + return $this->lineStyle; + } + + /** + * Get the color of line + * + * @return Color + */ + function getLegendLineColor() { + return $this->lineColor; + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + function getLegendBackground() { + return NULL; + } + + /** + * Get a mark object + * + * @return Mark + */ + function getLegendMark() { + return $this->mark; + } + + function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $count = count($this->datay); + + // Get start and stop values + list($start, $stop) = $this->getLimit(); + + // Build the polygon + $polygon = new awPolygon; + + for($key = 0; $key < $count; $key++) { + + $x = $this->datax[$key]; + $y = $this->datay[$key]; + + if($y !== NULL) { + $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($x, $y)); + $polygon->set($key, $p); + } else if($this->linkNull === FALSE) { + $polygon->set($key, NULL); + } + + } + + // Link points if needed + if($this->link) { + + $prev = NULL; + + foreach($polygon->all() as $point) { + + if($prev !== NULL and $point !== NULL) { + $drawer->line( + $this->lineColor, + new awLine( + $prev, + $point, + $this->lineStyle, + $this->lineThickness + ) + ); + } + $prev = $point; + + } + + $this->lineColor->free(); + + } + + // Draw impulses + if(is_a($this->impulse, 'awColor')) { + + foreach($polygon->all() as $key => $point) { + + if($point !== NULL) { + + $zero = awAxis::toPosition( + $this->xAxis, + $this->yAxis, + new awPoint($key, 0) + ); + + $drawer->line( + $this->impulse, + new awLine( + $zero, + $point, + LINE_SOLID, + 1 + ) + ); + + } + + } + + } + + // Draw marks and labels + foreach($polygon->all() as $key => $point) { + + $this->mark->draw($drawer, $point); + $this->label->draw($drawer, $point, $key); + + } + + } + + function xAxisPoint($position) { + $y = $this->xAxisZero ? 0 : $this->getRealYMin(); + return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); + } + + function getXCenter() { + return FALSE; + } + +} + +registerClass('ScatterPlot'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/common.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/common.php new file mode 100644 index 0000000000000000000000000000000000000000..f476476d3562604d1a00d4685bae93f1b8693635 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/common.php @@ -0,0 +1,102 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* + * Get the minimum of an array and ignore non numeric values + */ +function array_min($array) { + + if(is_array($array) and count($array) > 0) { + + do { + $min = array_pop($array); + if(is_numeric($min === FALSE)) { + $min = NULL; + } + } while(count($array) > 0 and $min === NULL); + + if($min !== NULL) { + $min = (float)$min; + } + + foreach($array as $value) { + if(is_numeric($value) and (float)$value < $min) { + $min = (float)$value; + } + } + + return $min; + + } + + return NULL; + +} + +/* + * Get the maximum of an array and ignore non numeric values + */ +function array_max($array) { + + if(is_array($array) and count($array) > 0) { + + do { + $max = array_pop($array); + if(is_numeric($max === FALSE)) { + $max = NULL; + } + } while(count($array) > 0 and $max === NULL); + + if($max !== NULL) { + $max = (float)$max; + } + + foreach($array as $value) { + if(is_numeric($value) and (float)$value > $max) { + $max = (float)$value; + } + } + + return $max; + + } + + return NULL; + +} + +/* + * Register a class with the prefix in configuration file + */ +function registerClass($class, $abstract = FALSE) { + + if(ARTICHOW_PREFIX === 'aw') { + return; + } + + + $abstract = ''; + + + eval($abstract." class ".ARTICHOW_PREFIX.$class." extends aw".$class." { }"); + +} + +/* + * Register an interface with the prefix in configuration file + */ +function registerInterface($interface) { + + if(ARTICHOW_PREFIX === 'aw') { + return; + } + + +} +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Axis.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Axis.class.php new file mode 100644 index 0000000000000000000000000000000000000000..7026a30fa33885ec3a8db181d9f3d39d9d6e94e2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Axis.class.php @@ -0,0 +1,760 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Handle axis + * + * @package Artichow + */ +class awAxis { + + /** + * Axis line + * + * @var Line + */ + var $line; + + /** + * Axis labels + * + * @var Label + */ + var $label; + + /** + * Axis title + * + * @var Label + */ + var $title; + + /** + * Title position + * + * @var float + */ + var $titlePosition = 0.5; + + /** + * Labels number + * + * @var int + */ + var $labelNumber; + + /** + * Axis ticks + * + * @var array + */ + var $ticks = array(); + + /** + * Axis and ticks color + * + * @var Color + */ + var $color; + + /** + * Axis left and right padding + * + * @var Side + */ + var $padding; + + /** + * Axis range + * + * @var array + */ + var $range; + + /** + * Hide axis + * + * @var bool + */ + var $hide = FALSE; + + /** + * Auto-scaling mode + * + * @var bool + */ + var $auto = TRUE; + + /** + * Axis range callback function + * + * @var array + */ + var $rangeCallback = array( + 'toValue' => 'toProportionalValue', + 'toPosition' => 'toProportionalPosition' + ); + + /** + * Build the axis + * + * @param float $min Begin of the range of the axis + * @param float $max End of the range of the axis + */ + function awAxis($min = NULL, $max = NULL) { + + $this->line = new awVector( + new awPoint(0, 0), + new awPoint(0, 0) + ); + + $this->label = new awLabel; + $this->padding = new awSide; + + $this->title = new awLabel( + NULL, + NULL, + NULL, + 0 + ); + + $this->setColor(new awBlack); + + if($min !== NULL and $max !== NULL) { + $this->setRange($min, $max); + } + + } + + /** + * Enable/disable auto-scaling mode + * + * @param bool $auto + */ + function auto($auto) { + $this->auto = (bool)$auto; + } + + /** + * Get auto-scaling mode status + * + * @return bool + */ + function isAuto() { + return $this->auto; + } + + /** + * Hide axis + * + * @param bool $hide + */ + function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show axis + * + * @param bool $show + */ + function show($show = TRUE) { + $this->hide = !(bool)$show; + } + + /** + * Return a tick object from its name + * + * @param string $name Tick object name + * @return Tick + */ + function tick($name) { + + if(array_key_exists($name, $this->ticks)) { + return $tick = &$this->ticks[$name]; + } else { + return NULL; + } + + } + + /** + * Add a tick object + * + * @param string $name Tick object name + * @param &$tick Tick object + */ + function addTick($name, &$tick) { + + $this->ticks[$name] = &$tick; + + } + + /** + * Delete a tick object + * + * @param string $name Tick object name + */ + function deleteTick($name) { + if(array_key_exists($name, $this->ticks)) { + unset($this->ticks[$name]); + } + } + + /** + * Hide all ticks + * + * @param bool $hide Hide or not ? + */ + function hideTicks($hide = TRUE) { + + foreach($this->ticks as $key => $tick) { + $this->ticks[$key]->hide($hide); + } + + } + + /** + * Change ticks style + * + * @param int $style Ticks style + */ + function setTickStyle($style) { + + foreach($this->ticks as $key => $tick) { + $this->ticks[$key]->setStyle($style); + } + + } + + /** + * Change ticks interval + * + * @param int $interval Ticks interval + */ + function setTickInterval($interval) { + + foreach($this->ticks as $key => $tick) { + $this->ticks[$key]->setInterval($interval); + } + + } + + /** + * Change number of ticks relative to others ticks + * + * @param &$to Change number of theses ticks + * @param &$from Ticks reference + * @param float $number Number of ticks by the reference + */ + function setNumberByTick($to, $from, $number) { + $this->ticks[$to]->setNumberByTick($this->ticks[$from], $number); + } + + /** + * Reverse ticks style + */ + function reverseTickStyle() { + + foreach($this->ticks as $key => $tick) { + if($this->ticks[$key]->getStyle() === TICK_IN) { + $this->ticks[$key]->setStyle(TICK_OUT); + } else if($this->ticks[$key]->getStyle() === TICK_OUT) { + $this->ticks[$key]->setStyle(TICK_IN); + } + } + + } + + /** + * Change interval of labels + * + * @param int $interval Interval + */ + function setLabelInterval($interval) { + $this->auto(FALSE); + $this->setTickInterval($interval); + $this->label->setInterval($interval); + } + + /** + * Change number of labels + * + * @param int $number Number of labels to display (can be NULL) + */ + function setLabelNumber($number) { + $this->auto(FALSE); + $this->labelNumber = is_null($number) ? NULL : (int)$number; + } + + /** + * Get number of labels + * + * @return int + */ + function getLabelNumber() { + return $this->labelNumber; + } + + /** + * Change precision of labels + * + * @param int $precision Precision + */ + function setLabelPrecision($precision) { + $this->auto(FALSE); + $function = 'axis'.time().'_'.(microtime() * 1000000); + eval('function '.$function.'($value) { + return sprintf("%.'.(int)$precision.'f", $value); + }'); + $this->label->setCallbackFunction($function); + } + + /** + * Change text of labels + * + * @param array $texts Some texts + */ + function setLabelText($texts) { + if(is_array($texts)) { + $this->auto(FALSE); + $function = 'axis'.time().'_'.(microtime() * 1000000); + eval('function '.$function.'($value) { + $texts = '.var_export($texts, TRUE).'; + return $texts[$value]; + }'); + $this->label->setCallbackFunction($function); + } + } + + /** + * Get the position of a point + * + * @param &$xAxis X axis + * @param &$yAxis Y axis + * @param $p Position of the point + * @return Point Position on the axis + */ + function toPosition(&$xAxis, &$yAxis, $p) { + + $p1 = $xAxis->getPointFromValue($p->x); + $p2 = $yAxis->getPointFromValue($p->y); + + return new awPoint( + round($p1->x), + round($p2->y) + ); + + } + + /** + * Change title alignment + * + * @param int $alignment New Alignment + */ + function setTitleAlignment($alignment) { + + switch($alignment) { + + case LABEL_TOP : + $this->setTitlePosition(1); + $this->title->setAlign(NULL, LABEL_BOTTOM); + break; + + case LABEL_BOTTOM : + $this->setTitlePosition(0); + $this->title->setAlign(NULL, LABEL_TOP); + break; + + case LABEL_LEFT : + $this->setTitlePosition(0); + $this->title->setAlign(LABEL_LEFT); + break; + + case LABEL_RIGHT : + $this->setTitlePosition(1); + $this->title->setAlign(LABEL_RIGHT); + break; + + } + + } + + /** + * Change title position on the axis + * + * @param float $position A new awposition between 0 and 1 + */ + function setTitlePosition($position) { + $this->titlePosition = (float)$position; + } + + /** + * Change axis and axis title color + * + * @param $color + */ + function setColor($color) { + $this->color = $color; + $this->title->setColor($color); + } + + /** + * Change axis padding + * + * @param int $left Left padding in pixels + * @param int $right Right padding in pixels + */ + function setPadding($left, $right) { + $this->padding->set($left, $right); + } + + /** + * Get axis padding + * + * @return Side + */ + function getPadding() { + return $this->padding; + } + + /** + * Change axis range + * + * @param float $min + * @param float $max + */ + function setRange($min, $max) { + if($min !== NULL) { + $this->range[0] = (float)$min; + } + if($max !== NULL) { + $this->range[1] = (float)$max; + } + } + + /** + * Get axis range + * + * @return array + */ + function getRange() { + return $this->range; + } + + /** + * Change axis range callback function + * + * @param string $toValue Transform a position between 0 and 1 to a value + * @param string $toPosition Transform a value to a position between 0 and 1 on the axis + */ + function setRangeCallback($toValue, $toPosition) { + $this->rangeCallback = array( + 'toValue' => (string)$toValue, + 'toPosition' => (string)$toPosition + ); + } + + /** + * Center X values of the axis + * + * @param &$axis An axis + * @param float $value The reference value on the axis + */ + function setXCenter(&$axis, $value) { + + // Check vector angle + if($this->line->isVertical() === FALSE) { + trigger_error("setXCenter() can only be used on vertical axes", E_USER_ERROR); + } + + $p = $axis->getPointFromValue($value); + + $this->line->setX( + $p->x, + $p->x + ); + + } + + /** + * Center Y values of the axis + * + * @param &$axis An axis + * @param float $value The reference value on the axis + */ + function setYCenter(&$axis, $value) { + + // Check vector angle + if($this->line->isHorizontal() === FALSE) { + trigger_error("setYCenter() can only be used on horizontal axes", E_USER_ERROR); + } + + $p = $axis->getPointFromValue($value); + + $this->line->setY( + $p->y, + $p->y + ); + + } + + /** + * Get the distance between to values on the axis + * + * @param float $from The first value + * @param float $to The last value + * @return Point + */ + function getDistance($from, $to) { + + $p1 = $this->getPointFromValue($from); + $p2 = $this->getPointFromValue($to); + + return $p1->getDistance($p2); + + } + + /** + * Get a point on the axis from a value + * + * @param float $value + * @return Point + */ + function getPointFromValue($value) { + + $callback = $this->rangeCallback['toPosition']; + + list($min, $max) = $this->range; + $position = $callback($value, $min, $max); + + return $this->getPointFromPosition($position); + + } + + /** + * Get a point on the axis from a position + * + * @param float $position A position between 0 and 1 + * @return Point + */ + function getPointFromPosition($position) { + + $vector = $this->getVector(); + + $angle = $vector->getAngle(); + $size = $vector->getSize(); + + return $vector->p1->move( + cos($angle) * $size * $position, + -1 * sin($angle) * $size * $position + ); + + } + + /** + * Draw axis + * + * @param $drawer A drawer + */ + function draw($drawer) { + + if($this->hide) { + return; + } + + $vector = $this->getVector(); + + // Draw axis ticks + $this->drawTicks($drawer, $vector); + + // Draw axis line + $this->line($drawer); + + // Draw labels + $this->drawLabels($drawer); + + // Draw axis title + $p = $this->getPointFromPosition($this->titlePosition); + $this->title->draw($drawer, $p); + + } + + function autoScale() { + + if($this->isAuto() === FALSE) { + return; + } + + list($min, $max) = $this->getRange(); + $interval = $max - $min; + + $partMax = $max / $interval; + $partMin = $min / $interval; + + $difference = log($interval) / log(10); + $difference = floor($difference); + + $pow = pow(10, $difference); + + $intervalNormalize = $interval / $pow; + + if($difference <= 0) { + + $precision = $difference * -1 + 1; + + if($intervalNormalize > 2) { + $precision--; + } + + } else { + $precision = 0; + } + + if($min != 0 and $max != 0) { + $precision++; + } + + $this->setLabelPrecision($precision); + + if($intervalNormalize <= 1.5) { + $intervalReal = 1.5; + $labelNumber = 4; + } else if($intervalNormalize <= 2) { + $intervalReal = 2; + $labelNumber = 5; + } else if($intervalNormalize <= 3) { + $intervalReal = 3; + $labelNumber = 4; + } else if($intervalNormalize <= 4) { + $intervalReal = 4; + $labelNumber = 5; + } else if($intervalNormalize <= 5) { + $intervalReal = 5; + $labelNumber = 6; + } else if($intervalNormalize <= 8) { + $intervalReal = 8; + $labelNumber = 5; + } else if($intervalNormalize <= 10) { + $intervalReal = 10; + $labelNumber = 6; + } + + if($min == 0) { + + $this->setRange( + $min, + $intervalReal * $pow + ); + + } else if($max == 0) { + + $this->setRange( + $intervalReal * $pow * -1, + 0 + ); + + } + + $this->setLabelNumber($labelNumber); + + } + + function line($drawer) { + + $drawer->line( + $this->color, + $this->line + ); + + } + + function drawTicks($drawer, &$vector) { + + foreach($this->ticks as $tick) { + $tick->setColor($this->color); + $tick->draw($drawer, $vector); + } + + } + + function drawLabels($drawer) { + + if($this->labelNumber !== NULL) { + list($min, $max) = $this->range; + $number = $this->labelNumber - 1; + if($number < 1) { + return; + } + $function = $this->rangeCallback['toValue']; + $labels = array(); + for($i = 0; $i <= $number; $i++) { + $labels[] = $function($i / $number, $min, $max); + } + $this->label->set($labels); + } + + $labels = $this->label->count(); + + for($i = 0; $i < $labels; $i++) { + + $p = $this->getPointFromValue($this->label->get($i)); + $this->label->draw($drawer, $p, $i); + + } + + } + + function getVector() { + + $angle = $this->line->getAngle(); + + // Compute paddings + $vector = new awVector( + $this->line->p1->move( + cos($angle) * $this->padding->left, + -1 * sin($angle) * $this->padding->left + ), + $this->line->p2->move( + -1 * cos($angle) * $this->padding->right, + -1 * -1 * sin($angle) * $this->padding->right + ) + ); + + return $vector; + + } + + function __clone() { + + $this->label = $this->label; + $this->line = $this->line; + $this->title = $this->title; + + foreach($this->ticks as $name => $tick) { + $this->ticks[$name] = $tick; + } + + } + +} + +registerClass('Axis'); + +function toProportionalValue($position, $min, $max) { + return $min + ($max - $min) * $position; +} + +function toProportionalPosition($value, $min, $max) { + if($max - $min == 0) { + return 0; + } + return ($value - $min) / ($max - $min); +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Border.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Border.class.php new file mode 100644 index 0000000000000000000000000000000000000000..6f4270dcc459c5f83cbd2bd8572ec0ea60276ee3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Border.class.php @@ -0,0 +1,158 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Draw border + * + * @package Artichow + */ +class awBorder { + + /** + * Border color + * + * @var Color + */ + var $color; + + /** + * Hide border ? + * + * @var bool + */ + var $hide = FALSE; + + /** + * Border line style + * + * @var int + */ + var $style; + + /** + * Build the border + * + * @param $color Border color + * @param int $style Border style + */ + function awBorder($color = NULL, $style = LINE_SOLID) { + + $this->setStyle($style); + + if(is_a($color, 'awColor')) { + $this->setColor($color); + } else { + $this->setColor(new awBlack); + } + + } + + /** + * Change border color + * This method automatically shows the border if it is hidden + * + * @param $color + */ + function setColor($color) { + $this->color = $color; + $this->show(); + } + + /** + * Change border style + * + * @param int $style + */ + function setStyle($style) { + $this->style = (int)$style; + } + + /** + * Hide border ? + * + * @param bool $hide + */ + function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show border ? + * + * @param bool $show + */ + function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + /** + * Is the border visible ? + * + * @return bool + */ + function visible() { + return !$this->hide; + } + + /** + * Draw border as a rectangle + * + * @param $drawer + * @param $p1 Top-left corner + * @param $p2 Bottom-right corner + */ + function rectangle($drawer, $p1, $p2) { + + // Border is hidden + if($this->hide) { + return; + } + + $line = new awLine; + $line->setStyle($this->style); + $line->setLocation($p1, $p2); + + $drawer->rectangle($this->color, $line); + + } + + /** + * Draw border as an ellipse + * + * @param $drawer + * @param $center Ellipse center + * @param int $width Ellipse width + * @param int $height Ellipse height + */ + function ellipse($drawer, $center, $width, $height) { + + // Border is hidden + if($this->hide) { + return; + } + + switch($this->style) { + + case LINE_SOLID : + $drawer->ellipse($this->color, $center, $width, $height); + break; + + default : + trigger_error("Dashed and dotted borders and not yet implemented on ellipses", E_USER_ERROR); + break; + + } + + + } + +} + +registerClass('Border'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Color.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Color.class.php new file mode 100644 index 0000000000000000000000000000000000000000..ac92bf623870ecb50fc6f9b1094496af34725c29 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Color.class.php @@ -0,0 +1,201 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Create your colors + * + * @package Artichow + */ +class awColor { + + var $red; + var $green; + var $blue; + var $alpha; + + var $resource; + var $color; + + /** + * Build your color + * + * @var int $red Red intensity (from 0 to 255) + * @var int $green Green intensity (from 0 to 255) + * @var int $blue Blue intensity (from 0 to 255) + * @var int $alpha Alpha channel (from 0 to 100) + */ + function awColor($red, $green, $blue, $alpha = 0) { + + $this->red = (int)$red; + $this->green = (int)$green; + $this->blue = (int)$blue; + $this->alpha = (int)round($alpha * 127 / 100); + + } + + /** + * Return a GDised color + * + * @param resource $resource A GD resource + * @return int + */ + function getColor($resource) { + + $this->resource = $resource; + + if($this->color === NULL) { + + if($this->alpha === 0 or function_exists('imagecolorallocatealpha') === FALSE) { + $this->color = imagecolorallocate($this->resource, $this->red, $this->green, $this->blue); + } else { + $this->color = imagecolorallocatealpha($this->resource, $this->red, $this->green, $this->blue, $this->alpha); + } + + } + + return $this->color; + + } + + /** + * Change color brightness + * + * @param int $brightness Add this intensity to the color (betweeen -255 and +255) + */ + function brightness($brightness) { + + $brightness = (int)$brightness; + + $this->red = min(255, max(0, $this->red + $brightness)); + $this->green = min(255, max(0, $this->green + $brightness)); + $this->blue = min(255, max(0, $this->blue + $brightness)); + + } + + /** + * Get RGB and alpha values of your color + * + * @return array + */ + function rgba() { + + return array($this->red, $this->green, $this->blue, $this->alpha); + + } + + /** + * Free resources used for this color + */ + function free() { + + if($this->resource !== NULL) { + + @imagecolordeallocate($this->resource, $this->color); + $this->resource = NULL; + + } + + } + + function php5Destructor() { + + $this->free(); + + } + +} + +registerClass('Color'); + +$colors = array( + 'Black' => array(0, 0, 0), + 'AlmostBlack' => array(48, 48, 48), + 'VeryDarkGray' => array(88, 88, 88), + 'DarkGray' => array(128, 128, 128), + 'MidGray' => array(160, 160, 160), + 'LightGray' => array(195, 195, 195), + 'VeryLightGray' => array(220, 220, 220), + 'White' => array(255, 255, 255), + 'VeryDarkRed' => array(64, 0, 0), + 'DarkRed' => array(128, 0, 0), + 'MidRed' => array(192, 0, 0), + 'Red' => array(255, 0, 0), + 'LightRed' => array(255, 192, 192), + 'VeryDarkGreen' => array(0, 64, 0), + 'DarkGreen' => array(0, 128, 0), + 'MidGreen' => array(0, 192, 0), + 'Green' => array(0, 255, 0), + 'LightGreen' => array(192, 255, 192), + 'VeryDarkBlue' => array(0, 0, 64), + 'DarkBlue' => array(0, 0, 128), + 'MidBlue' => array(0, 0, 192), + 'Blue' => array(0, 0, 255), + 'LightBlue' => array(192, 192, 255), + 'VeryDarkYellow' => array(64, 64, 0), + 'DarkYellow' => array(128, 128, 0), + 'MidYellow' => array(192, 192, 0), + 'Yellow' => array(255, 255, 2), + 'LightYellow' => array(255, 255, 192), + 'VeryDarkCyan' => array(0, 64, 64), + 'DarkCyan' => array(0, 128, 128), + 'MidCyan' => array(0, 192, 192), + 'Cyan' => array(0, 255, 255), + 'LightCyan' => array(192, 255, 255), + 'VeryDarkMagenta' => array(64, 0, 64), + 'DarkMagenta' => array(128, 0, 128), + 'MidMagenta' => array(192, 0, 192), + 'Magenta' => array(255, 0, 255), + 'LightMagenta' => array(255, 192, 255), + 'DarkOrange' => array(192, 88, 0), + 'Orange' => array(255, 128, 0), + 'LightOrange' => array(255, 168, 88), + 'VeryLightOrange' => array(255, 220, 168), + 'DarkPink' => array(192, 0, 88), + 'Pink' => array(255, 0, 128), + 'LightPink' => array(255, 88, 168), + 'VeryLightPink' => array(255, 168, 220), + 'DarkPurple' => array(88, 0, 192), + 'Purple' => array(128, 0, 255), + 'LightPurple' => array(168, 88, 255), + 'VeryLightPurple' => array(220, 168, 255), +); + + + +$php = ''; + +foreach($colors as $name => $color) { + + list($red, $green, $blue) = $color; + + $php .= ' + class aw'.$name.' extends awColor { + + function aw'.$name.'($alpha = 0) { + parent::awColor('.$red.', '.$green.', '.$blue.', $alpha); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.$name.' extends aw'.$name.' { + + } + '; + } + +} + +eval($php); + + + +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Drawer.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Drawer.class.php new file mode 100644 index 0000000000000000000000000000000000000000..3af1b31af3a95303b6c02fa70a100e990308a87f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Drawer.class.php @@ -0,0 +1,1127 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Draw your objects + * + * @package Artichow + */ +class awDrawer { + + /** + * A GD resource + * + * @var $resource + */ + var $resource; + + /** + * Image width + * + * @var int + */ + var $width; + + /** + * Image height + * + * @var int + */ + var $height; + + /** + * Drawer X position + * + * @var int + */ + var $x; + + /** + * Drawer Y position + * + * @var int + */ + var $y; + + var $w; + var $h; + + /** + * Build your drawer + * + * @var resource $resource A GD resource + */ + function awDrawer($resource) { + + $this->resource = $resource; + + } + + /** + * Change the image size + * + * @param int $width Image width + * @param int $height Image height + */ + function setImageSize($width, $height) { + + $this->width = $width; + $this->height = $height; + + } + + /** + * Inform the drawer of the position of your image + * + * @param float $x Position on X axis of the center of the component + * @param float $y Position on Y axis of the center of the component + */ + function setPosition($x, $y) { + + // Calcul absolute position + $this->x = round($x * $this->width - $this->w / 2); + $this->y = round($y * $this->height - $this->h / 2); + + } + + /** + * Inform the drawer of the position of your image + * This method need absolutes values + * + * @param int $x Left-top corner X position + * @param int $y Left-top corner Y position + */ + function setAbsPosition($x, $y) { + + $this->x = $x; + $this->y = $y; + + } + + /** + * Move the position of the image + * + * @param int $x Add this value to X axis + * @param int $y Add this value to Y axis + */ + function movePosition($x, $y) { + + $this->x += (int)$x; + $this->y += (int)$y; + + } + + /** + * Inform the drawer of the size of your image + * Height and width must be between 0 and 1. + * + * @param int $w Image width + * @param int $h Image height + * @return array Absolute width and height of the image + */ + function setSize($w, $h) { + + // Calcul absolute size + $this->w = round($w * $this->width); + $this->h = round($h * $this->height); + + return $this->getSize(); + + } + + /** + * Inform the drawer of the size of your image + * You can set absolute size with this method. + * + * @param int $w Image width + * @param int $h Image height + */ + function setAbsSize($w, $h) { + + $this->w = $w; + $this->h = $h; + + return $this->getSize(); + + } + + /** + * Get the size of the component handled by the drawer + * + * @return array Absolute width and height of the component + */ + function getSize() { + + return array($this->w, $this->h); + + } + + /** + * Draw an image here + * + * @param &$image Image + * @param int $p1 Image top-left point + * @param int $p2 Image bottom-right point + */ + function copyImage(&$image, $p1, $p2) { + + list($x1, $y1) = $p1->getLocation(); + list($x2, $y2) = $p2->getLocation(); + + $drawer = $image->getDrawer(); + imagecopy($this->resource, $drawer->resource, $this->x + $x1, $this->y + $y1, 0, 0, $x2 - $x1, $y2 - $y1); + + } + + /** + * Draw an image here + * + * @param &$image Image + * @param int $d1 Destination top-left position + * @param int $d2 Destination bottom-right position + * @param int $s1 Source top-left position + * @param int $s2 Source bottom-right position + * @param bool $resample Resample image ? (default to TRUE) + */ + function copyResizeImage(&$image, $d1, $d2, $s1, $s2, $resample = TRUE) { + + if($resample) { + $function = 'imagecopyresampled'; + } else { + $function = 'imagecopyresized'; + } + + $drawer = $image->getDrawer(); + + $function( + $this->resource, + $drawer->resource, + $this->x + $d1->x, $this->y + $d1->y, + $s1->x, $s1->y, + $d2->x - $d1->x, $d2->y - $d1->y, + $s2->x - $s1->x, $s2->y - $s1->y + ); + + } + + /** + * Draw a string + * + * @var &$text Text to print + * @param $point Draw the text at this point + */ + function string(&$text, $point) { + + $font = $text->getFont(); + + if($text->getBackground() !== NULL or $text->border->visible()) { + + list($left, $right, $top, $bottom) = $text->getPadding(); + + $width = $font->getTextWidth($text); + $height = $font->getTextHeight($text); + + $x1 = floor($point->x - $left); + $y1 = floor($point->y - $top); + $x2 = $x1 + $width + $left + $right; + $y2 = $y1 + $height + $top + $bottom; + + $this->filledRectangle( + $text->getBackground(), + awLine::build($x1, $y1, $x2, $y2) + ); + + $text->border->rectangle( + $this, + new awPoint($x1 - 1, $y1 - 1), + new awPoint($x2 + 1, $y2 + 1) + ); + + } + + $font->draw($this, $point, $text); + + } + + /** + * Draw a pixel + * + * @param $color Pixel color + * @param $p + */ + function point($color, $p) { + + if($p->isHidden() === FALSE) { + $rgb = $color->getColor($this->resource); + imagesetpixel($this->resource, $this->x + round($p->x), $this->y + round($p->y), $rgb); + } + + } + + /** + * Draw a colored line + * + * @param $color Line color + * @param $line + * @param int $thickness Line tickness + */ + function line($color, $line) { + + if($line->thickness > 0 and $line->isHidden() === FALSE) { + + $rgb = $color->getColor($this->resource); + $thickness = $line->thickness; + + list($p1, $p2) = $line->getLocation(); + + $this->startThickness($thickness); + + switch($line->getStyle()) { + + case LINE_SOLID : + imageline($this->resource, $this->x + round($p1->x), $this->y + round($p1->y), $this->x + round($p2->x), $this->y + round($p2->y), $rgb); + break; + + case LINE_DOTTED : + $size = sqrt(pow($p2->y - $p1->y, 2) + pow($p2->x - $p1->x, 2)); + $cos = ($p2->x - $p1->x) / $size; + $sin = ($p2->y - $p1->y) / $size; + for($i = 0; $i <= $size; $i += 2) { + $p = new awPoint( + round($i * $cos + $p1->x), + round($i * $sin + $p1->y) + ); + $this->point($color, $p); + } + break; + + case LINE_DASHED : + $width = $p2->x - $p1->x; + $height = $p2->y - $p1->y; + $size = sqrt(pow($height, 2) + pow($width, 2)); + + if($size == 0) { + return; + } + + $cos = $width / $size; + $sin = $height / $size; + + for($i = 0; $i <= $size; $i += 6) { + + $t1 = new awPoint( + round($i * $cos + $p1->x), + round($i * $sin + $p1->y) + ); + + $function = ($height > 0) ? 'min' : 'max'; + $t2 = new awPoint( + round(min(($i + 3) * $cos, $width) + $p1->x), + round($function(($i + 3) * $sin, $height) + $p1->y) + ); + + $this->line($color, new awLine($t1, $t2)); + + } + break; + + } + + $this->stopThickness($thickness); + + } + + } + + /** + * Draw a color arc + + * @param $color Arc color + * @param $center Point center + * @param int $width Ellipse width + * @param int $height Ellipse height + * @param int $from Start angle + * @param int $to End angle + */ + function arc($color, $center, $width, $height, $from, $to) { + + imagefilledarc( + $this->resource, + $this->x + $center->x, $this->y + $center->y, + $width, $height, + $from, $to, + $color->getColor($this->resource), + IMG_ARC_EDGED | IMG_ARC_NOFILL + ); + + } + + /** + * Draw an arc with a background color + * + * @param $color Arc background color + * @param $center Point center + * @param int $width Ellipse width + * @param int $height Ellipse height + * @param int $from Start angle + * @param int $to End angle + */ + function filledArc($color, $center, $width, $height, $from, $to) { + + imagefilledarc( + $this->resource, + $this->x + $center->x, $this->y + $center->y, + $width, $height, + $from, $to, + $color->getColor($this->resource), + IMG_ARC_PIE + ); + + } + + /** + * Draw a colored ellipse + * + * @param $color Ellipse color + * @param $center Ellipse center + * @param int $width Ellipse width + * @param int $height Ellipse height + */ + function ellipse($color, $center, $width, $height) { + + list($x, $y) = $center->getLocation(); + + $rgb = $color->getColor($this->resource); + imageellipse( + $this->resource, + $this->x + $x, + $this->y + $y, + $width, + $height, + $rgb + ); + + } + + /** + * Draw an ellipse with a background + * + * @param mixed $background Background (can be a color or a gradient) + * @param $center Ellipse center + * @param int $width Ellipse width + * @param int $height Ellipse height + */ + function filledEllipse($background, $center, $width, $height) { + + if(is_a($background, 'awColor')) { + + list($x, $y) = $center->getLocation(); + + $rgb = $background->getColor($this->resource); + + imagefilledellipse( + $this->resource, + $this->x + $x, + $this->y + $y, + $width, + $height, + $rgb + ); + + } else if(is_a($background, 'awGradient')) { + + list($x, $y) = $center->getLocation(); + + $x1 = $x - round($width / 2); + $y1 = $y - round($height / 2); + $x2 = $x1 + $width; + $y2 = $y1 + $height; + + $gradientDrawer = new awGradientDrawer($this); + $gradientDrawer->filledEllipse( + $background, + $x1, $y1, + $x2, $y2 + ); + + } + + } + + /** + * Draw a colored rectangle + * + * @param $color Rectangle color + * @param $line Rectangle diagonale + * @param $p2 + */ + function rectangle($color, $line) { + + $p1 = $line->p1; + $p2 = $line->p2; + + switch($line->getStyle()) { + + case LINE_SOLID : + $thickness = $line->getThickness(); + $this->startThickness($thickness); + $rgb = $color->getColor($this->resource); + imagerectangle($this->resource, $this->x + $p1->x, $this->y + $p1->y, $this->x + $p2->x, $this->y + $p2->y, $rgb); + $this->stopThickness($thickness); + break; + + default : + + // Top side + $line->setLocation( + new awPoint($p1->x, $p1->y), + new awPoint($p2->x, $p1->y) + ); + $this->line($color, $line); + + // Right side + $line->setLocation( + new awPoint($p2->x, $p1->y), + new awPoint($p2->x, $p2->y) + ); + $this->line($color, $line); + + // Bottom side + $line->setLocation( + new awPoint($p1->x, $p2->y), + new awPoint($p2->x, $p2->y) + ); + $this->line($color, $line); + + // Left side + $line->setLocation( + new awPoint($p1->x, $p1->y), + new awPoint($p1->x, $p2->y) + ); + $this->line($color, $line); + + break; + + } + + } + + /** + * Draw a rectangle with a background + * + * @param mixed $background Background (can be a color or a gradient) + * @param $line Rectangle diagonale + */ + function filledRectangle($background, $line) { + + $p1 = $line->p1; + $p2 = $line->p2; + + if(is_a($background, 'awColor')) { + $rgb = $background->getColor($this->resource); + imagefilledrectangle($this->resource, $this->x + $p1->x, $this->y + $p1->y, $this->x + $p2->x, $this->y + $p2->y, $rgb); + } else if(is_a($background, 'awGradient')) { + $gradientDrawer = new awGradientDrawer($this); + $gradientDrawer->filledRectangle($background, $p1, $p2); + } + + } + + /** + * Draw a polygon + * + * @param $color Polygon color + * @param Polygon A polygon + */ + function polygon($color, &$polygon) { + + switch($polygon->getStyle()) { + + case POLYGON_SOLID : + $thickness = $line->getThickness(); + $this->startThickness($thickness); + $points = $this->getPolygonPoints($polygon); + $rgb = $color->getColor($this->resource); + imagepolygon($this->resource, $points, $polygon->count(), $rgb); + $this->stopThickness($thickness); + break; + + default : + + if($polygon->count() > 1) { + + $prev = $polygon->get(0); + + $line = new awLine; + $line->setStyle($polygon->getStyle()); + $line->setThickness($polygon->getThickness()); + + for($i = 1; $i < $polygon->count(); $i++) { + $current = $polygon->get($i); + $line->setLocation($prev, $current); + $this->line($color, $line); + $prev = $current; + } + + } + + } + + } + + /** + * Draw a polygon with a background + * + * @param mixed $background Background (can be a color or a gradient) + * @param Polygon A polygon + */ + function filledPolygon($background, &$polygon) { + + if(is_a($background, 'awColor')) { + $points = $this->getPolygonPoints($polygon); + $rgb = $background->getColor($this->resource); + imagefilledpolygon($this->resource, $points, $polygon->count(), $rgb); + } else if(is_a($background, 'awGradient')) { + $gradientDrawer = new awGradientDrawer($this); + $gradientDrawer->filledPolygon($background, $polygon); + } + + } + + function getPolygonPoints(&$polygon) { + + $points = array(); + + foreach($polygon->all() as $point) { + $points[] = $point->x + $this->x; + $points[] = $point->y + $this->y; + } + + return $points; + + } + + function startThickness($thickness) { + + if($thickness > 1) { + + // Beurk :'( + imageantialias($this->resource, FALSE); + imagesetthickness($this->resource, $thickness); + + } + + } + + function stopThickness($thickness) { + + if($thickness > 1) { + + imagesetthickness($this->resource, 1); + imageantialias($this->resource, TRUE); + + } + + } + + +} + +registerClass('Drawer'); + +/** + * To your gradients + * + * @package Artichow + */ + +class awGradientDrawer { + + /** + * A drawer + * + * @var Drawer + */ + var $drawer; + + /** + * Build your GradientDrawer + * + * @var $drawer + */ + function awGradientDrawer($drawer) { + + $this->drawer = $drawer; + + } + + function drawFilledFlatTriangle($gradient, $a, $b, $c) { + + if($gradient->angle !== 0) { + trigger_error("Flat triangles can only be used with 0 degree gradients", E_USER_ERROR); + } + + // Look for right-angled triangle + if($a->x !== $b->x and $b->x !== $c->x) { + trigger_error("Not right-angled flat triangles are not supported yet", E_USER_ERROR); + } + + if($a->x === $b->x) { + $d = $a; + $e = $c; + } else { + $d = $c; + $e = $a; + } + + $this->init($gradient, $b->y - $d->y); + + for($i = $c->y + 1; $i < $b->y; $i++) { + + $color = $this->color($i - $d->y); + $pos = ($i - $d->y) / ($b->y - $d->y); + + $p1 = new awPoint($e->x, $i); + $p2 = new awPoint(1 + floor($e->x - $pos * ($e->x - $d->x)), $i); + + $this->drawer->filledRectangle($color, new awLine($p1, $p2)); + + $color->free(); + unset($color); + + } + + } + + function filledRectangle($gradient, $p1, $p2) { + + list($x1, $y1) = $p1->getLocation(); + list($x2, $y2) = $p2->getLocation(); + + if($y1 < $y2) { + $y1 ^= $y2 ^= $y1 ^= $y2; + } + + if($x2 < $x1) { + $x1 ^= $x2 ^= $x1 ^= $x2; + } + + if(is_a($gradient, 'awLinearGradient')) { + $this->rectangleLinearGradient($gradient, new awPoint($x1, $y1), new awPoint($x2, $y2)); + } else { + trigger_error("This gradient is not supported by rectangles", E_USER_ERROR); + } + + } + + function filledPolygon($gradient, &$polygon) { + + if(is_a($gradient, 'awLinearGradient')) { + $this->polygonLinearGradient($gradient, $polygon); + } else { + trigger_error("This gradient is not supported by polygons", E_USER_ERROR); + } + + } + + function rectangleLinearGradient(&$gradient, $p1, $p2) { + + list($x1, $y1) = $p1->getLocation(); + list($x2, $y2) = $p2->getLocation(); + + if($y1 - $y2 > 0) { + + if($gradient->angle === 0) { + + $this->init($gradient, $y1 - $y2); + + for($i = $y2; $i <= $y1; $i++) { + + $color = $this->color($i - $y2); + + $p1 = new awPoint($x1, $i); + $p2 = new awPoint($x2, $i); + + $this->drawer->filledRectangle($color, new awLine($p1, $p2)); + + $color->free(); + unset($color); + + } + + } else if($gradient->angle === 90) { + + $this->init($gradient, $x2 - $x1); + + for($i = $x1; $i <= $x2; $i++) { + + $color = $this->color($i - $x1); + + $p1 = new awPoint($i, $y2); + $p2 = new awPoint($i, $y1); + + $this->drawer->filledRectangle($color, new awLine($p1, $p2)); + + $color->free(); + unset($color); + + } + + } + + } + + } + + function filledEllipse($gradient, $x1, $y1, $x2, $y2) { + + if($y1 < $y2) { + $y1 ^= $y2 ^= $y1 ^= $y2; + } + + if($x2 < $x1) { + $x1 ^= $x2 ^= $x1 ^= $x2; + } + + if(is_a($gradient, 'awRadialGradient')) { + $this->ellipseRadialGradient($gradient, $x1, $y1, $x2, $y2); + } else if(is_a($gradient, 'awLinearGradient')) { + $this->ellipseLinearGradient($gradient, $x1, $y1, $x2, $y2); + } else { + trigger_error("This gradient is not supported by ellipses", E_USER_ERROR); + } + + } + + function ellipseRadialGradient($gradient, $x1, $y1, $x2, $y2) { + + if($y1 - $y2 > 0) { + + if($y1 - $y2 != $x2 - $x1) { + trigger_error("Radial gradients are only implemented on circle, not ellipses"); + } + + $c = new awPoint($x1 + ($x2 - $x1) / 2, $y1 + ($y2 - $y1) / 2); + $r = ($x2 - $x1) / 2; + $ok = array(); + + // Init gradient + $this->init($gradient, $r); + + for($i = 0; $i <= $r; $i += 0.45) { + + $p = ceil((2 * M_PI * $i)); + + if($p > 0) { + $interval = 360 / $p; + } else { + $interval = 360; + } + + $color = $this->color($i); + + for($j = 0; $j < 360; $j += $interval) { + + $rad = ($j / 360) * (2 * M_PI); + + $x = round($i * cos($rad)); + $y = round($i * sin($rad)); + + $l = sqrt($x * $x + $y * $y); + + if($l <= $r) { + + if( + array_key_exists((int)$x, $ok) === FALSE or + array_key_exists((int)$y, $ok[$x]) === FALSE + ) { + + // Print the point + $this->drawer->point($color, new awPoint($c->x + $x, $c->y + $y)); + + $ok[(int)$x][(int)$y] = TRUE; + + } + + } + + } + + $color->free(); + unset($color); + + } + + } + + } + + function ellipseLinearGradient($gradient, $x1, $y1, $x2, $y2) { + + // Gauche->droite : 90° + + if($y1 - $y2 > 0) { + + if($y1 - $y2 != $x2 - $x1) { + trigger_error("Linear gradients are only implemented on circle, not ellipses"); + } + + $r = ($x2 - $x1) / 2; + + // Init gradient + $this->init($gradient, $x2 - $x1); + + for($i = -$r; $i <= $r; $i++) { + + $h = sin(acos($i / $r)) * $r; + + $color = $this->color($i + $r); + + if($gradient->angle === 90) { + + // Print the line + $p1 = new awPoint( + $x1 + $i + $r, + round(max($y2 + $r - $h + 1, $y2)) + ); + + $p2 = new awPoint( + $x1 + $i + $r, + round(min($y1 - $r + $h - 1, $y1)) + ); + + } else { + + // Print the line + $p1 = new awPoint( + round(max($x1 + $r - $h + 1, $x1)), + $y2 + $i + $r + ); + + $p2 = new awPoint( + round(min($x2 - $r + $h - 1, $x2)), + $y2 + $i + $r + ); + + } + + $this->drawer->filledRectangle($color, new awLine($p1, $p2)); + + $color->free(); + unset($color); + + } + + } + + } + + function polygonLinearGradient(&$gradient, &$polygon) { + + $count = $polygon->count(); + + if($count >= 3) { + + $left = $polygon->get(0); + $right = $polygon->get($count - 1); + + if($gradient->angle === 0) { + + // Get polygon maximum and minimum + $offset = $polygon->get(0); + $max = $min = $offset->y; + for($i = 1; $i < $count - 1; $i++) { + $offset = $polygon->get($i); + $max = max($max, $offset->y); + $min = min($min, $offset->y); + } + + $this->init($gradient, $max - $min); + + $prev = $polygon->get(1); + + $sum = 0; + + for($i = 2; $i < $count - 1; $i++) { + + $current = $polygon->get($i); + + $interval = 1; + + if($i !== $count - 2) { + $current->x -= $interval; + } + + if($current->x - $prev->x > 0) { + + // Draw rectangle + $x1 = $prev->x; + $x2 = $current->x; + $y1 = max($prev->y, $current->y); + $y2 = $left->y; + + $gradient = new awLinearGradient( + $this->color($max - $min - ($y2 - $y1)), + $this->color($max - $min), + 0 + ); + + if($y1 > $y2) { + $y2 = $y1; + } + + $this->drawer->filledRectangle( + $gradient, + awLine::build($x1, $y1, $x2, $y2) + ); + + $top = ($prev->y < $current->y) ? $current : $prev; + $bottom = ($prev->y >= $current->y) ? $current : $prev; + + $gradient = new awLinearGradient( + $this->color($bottom->y - $min), + $this->color($max - $min - ($y2 - $y1)), + 0 + ); + + + $gradientDrawer = new awGradientDrawer($this->drawer); + $gradientDrawer->drawFilledFlatTriangle( + $gradient, + new awPoint($prev->x, min($prev->y, $current->y)), + $top, + new awPoint($current->x, min($prev->y, $current->y)) + ); + unset($gradientDrawer); + + $sum += $current->x - $prev->x; + + } + + $prev = $current; + $prev->x += $interval; + + } + + } else if($gradient->angle === 90) { + + $width = $right->x - $left->x; + $this->init($gradient, $width); + + $pos = 1; + $next = $polygon->get($pos++); + + $this->next($polygon, $pos, $prev, $next); + + for($i = 0; $i <= $width; $i++) { + + $x = $left->x + $i; + + $y1 = round($prev->y + ($next->y - $prev->y) * (($i + $left->x - $prev->x) / ($next->x - $prev->x))); + $y2 = $left->y; + + // Draw line + $color = $this->color($i); + // YaPB : PHP does not handle alpha on lines + $this->drawer->filledRectangle($color, awLine::build($x, $y1, $x, $y2)); + $color->free(); + unset($color); + + // Jump to next point + if($next->x == $i + $left->x) { + + $this->next($polygon, $pos, $prev, $next); + + } + + } + + } + + } + + } + + function next($polygon, &$pos, &$prev, &$next) { + + do { + $prev = $next; + $next = $polygon->get($pos++); + } + while($next->x - $prev->x == 0 and $pos < $polygon->count()); + + } + + /** + * Start colors + * + * @var int + */ + var $r1, $g1, $b1, $a1; + + /** + * Stop colors + * + * @var int + */ + var $r2, $g2, $b2, $a2; + + /** + * Gradient size in pixels + * + * @var int + */ + var $size; + + + function init($gradient, $size) { + + list( + $this->r1, $this->g1, $this->b1, $this->a1 + ) = $gradient->from->rgba(); + + list( + $this->r2, $this->g2, $this->b2, $this->a2 + ) = $gradient->to->rgba(); + + $this->size = $size; + } + + function color($pos) { + + return new awColor( + $this->getRed($pos), + $this->getGreen($pos), + $this->getBlue($pos), + $this->getAlpha($pos) + ); + + } + + + function getRed($pos) { + return (int)round($this->r1 + ($pos / $this->size) * ($this->r2 - $this->r1)); + } + + function getGreen($pos) { + return (int)round($this->g1 + ($pos / $this->size) * ($this->g2 - $this->g1)); + } + + function getBlue($pos) { + return (int)round($this->b1 + ($pos / $this->size) * ($this->b2 - $this->b1)); + } + + function getAlpha($pos) { + return (int)round(($this->a1 + ($pos / $this->size) * ($this->a2 - $this->a1)) / 127 * 100); + } + +} + +registerClass('GradientDrawer'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Font.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Font.class.php new file mode 100644 index 0000000000000000000000000000000000000000..34448263d7b9e69e4362508a56f723abdefbbb59 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Font.class.php @@ -0,0 +1,295 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + +/** + * Built-in PHP fonts + * + * @package Artichow + */ +class awFont { + + /** + * Used font + * + * @param int $font + */ + var $font; + + /** + * Build the font + * + * @param int $font Font identifier + */ + function awFont($font) { + + $this->font = $font; + + } + + /** + * Draw a text + * + * @param $drawer + * @param $p Draw text at this point + * @param &$text The text + */ + function draw($drawer, $p, &$text) { + + $angle = $text->getAngle(); + + if($angle !== 90 and $angle !== 0) { + trigger_error("You can only use 0° and 90°", E_USER_ERROR); + } + + if($angle === 90) { + $function = 'imagestringup'; + } else { + $function = 'imagestring'; + } + + if($angle === 90) { + $add = $this->getTextHeight($text); + } else { + $add = 0; + } + + $color = $text->getColor(); + $rgb = $color->getColor($drawer->resource); + + $function( + $drawer->resource, + $this->font, + $drawer->x + $p->x, + $drawer->y + $p->y + $add, + $text->getText(), + $rgb + ); + + } + + /** + * Get the width of a string + * + * @param &$text A string + */ + function getTextWidth(&$text) { + + if($text->getAngle() === 90) { + $text->setAngle(45); + return $this->getTextHeight($text); + } else if($text->getAngle() === 45) { + $text->setAngle(90); + } + + $font = $text->getFont(); + $fontWidth = imagefontwidth($font->font); + + if($fontWidth === FALSE) { + trigger_error("Unable to get font size", E_USER_ERROR); + } + + return (int)$fontWidth * strlen($text->getText()); + + } + + /** + * Get the height of a string + * + * @param &$text A string + */ + function getTextHeight(&$text) { + + if($text->getAngle() === 90) { + $text->setAngle(45); + return $this->getTextWidth($text); + } else if($text->getAngle() === 45) { + $text->setAngle(90); + } + + $font = $text->getFont(); + $fontHeight = imagefontheight($font->font); + + if($fontHeight === FALSE) { + trigger_error("Unable to get font size", E_USER_ERROR); + } + + return (int)$fontHeight; + + } + +} + +registerClass('Font'); + +/** + * TTF fonts + * + * @package Artichow + */ +class awTTFFont extends awFont { + + /** + * Font size + * + * @var int + */ + var $size; + + /** + * Font file + * + * @param string $font Font file + * @param int $size Font size + */ + function awTTFFont($font, $size) { + + parent::awFont($font); + + $this->size = (int)$size; + + } + + /** + * Draw a text + * + * @param $drawer + * @param $p Draw text at this point + * @param &$text The text + */ + function draw($drawer, $p, &$text) { + + // Make easier font positionment + $text->setText($text->getText()." "); + + $color = $text->getColor(); + $rgb = $color->getColor($drawer->resource); + + $box = imagettfbbox($this->size, $text->getAngle(), $this->font, $text->getText()); + + $height = - $box[5]; + + $box = imagettfbbox($this->size, 90, $this->font, $text->getText()); + $width = abs($box[6] - $box[2]); + + // Restore old text + $text->setText(substr($text->getText(), 0, strlen($text->getText()) - 1)); + + imagettftext( + $drawer->resource, + $this->size, + $text->getAngle(), + $drawer->x + $p->x + $width * sin($text->getAngle() / 180 * M_PI), + $drawer->y + $p->y + $height, + $rgb, + $this->font, + $text->getText() + ); + + } + + /** + * Get the width of a string + * + * @param &$text A string + */ + function getTextWidth(&$text) { + + $box = imagettfbbox($this->size, $text->getAngle(), $this->font, $text->getText()); + + if($box === FALSE) { + trigger_error("Unable to get font size", E_USER_ERROR); + return; + } + + list(, , $x2, $y2, , , $x1, $y1) = $box; + + return abs($x2 - $x1); + + } + + /** + * Get the height of a string + * + * @param &$text A string + */ + function getTextHeight(&$text) { + + $box = imagettfbbox($this->size, $text->getAngle(), $this->font, $text->getText()); + + if($box === FALSE) { + trigger_error("Unable to get font size", E_USER_ERROR); + return; + } + + list(, , $x2, $y2, , , $x1, $y1) = $box; + + return abs($y2 - $y1); + + } + +} + +registerClass('TTFFont'); + + + +$php = ''; + +for($i = 1; $i <= 5; $i++) { + + $php .= ' + class awFont'.$i.' extends awFont { + + function awFont'.$i.'() { + parent::awFont('.$i.'); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.'Font'.$i.' extends awFont'.$i.' { + } + '; + } + +} + +eval($php); + +$php = ''; + +foreach($fonts as $font) { + + $php .= ' + class aw'.$font.' extends awTTFFont { + + function aw'.$font.'($size) { + parent::awTTFFont(\''.(ARTICHOW_FONT.DIRECTORY_SEPARATOR.$font.'.ttf').'\', $size); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.$font.' extends aw'.$font.' { + } + '; + } + +} + +eval($php); + + + +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Gradient.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Gradient.class.php new file mode 100644 index 0000000000000000000000000000000000000000..4ac36327ef954aa4bddf9b0c6ad807a00b309580 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Gradient.class.php @@ -0,0 +1,149 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + + +/** + * Create your gradients + * + * @package Artichow + */ + class awGradient { + + /** + * From color + * + * @var Color + */ + var $from; + + /** + * To color + * + * @var Color + */ + var $to; + + /** + * Build the gradient + * + * @param $from From color + * @param $to To color + */ + function awGradient($from, $to) { + + $this->from = $from; + $this->to = $to; + + } + + /** + * Free memory used by the colors of the gradient + */ + function free() { + + $this->from->free(); + $this->to->free(); + + } + + function php5Destructor( ){ + + $this->free(); + + } + +} + +registerClass('Gradient', TRUE); + + +/** + * Create a linear gradient + * + * @package Artichow + */ +class awLinearGradient extends awGradient { + + /** + * Gradient angle + * + * @var int + */ + var $angle; + + /** + * Build the linear gradient + * + * @param $from From color + * @param $to To color + * @param int $angle Gradient angle + */ + function awLinearGradient($from, $to, $angle) { + + parent::awGradient( + $from, $to + ); + + $this->angle = $angle; + + } + +} + +registerClass('LinearGradient'); + + +/** + * Create a bilinear gradient + * + * @package Artichow + */ +class awBilinearGradient extends awLinearGradient { + + /** + * Gradient center + * + * @var int Center between 0 and 1 + */ + var $center; + + /** + * Build the bilinear gradient + * + * @param $from From color + * @param $to To color + * @param int $angle Gradient angle + * @param int $center Gradient center + */ + function awBilinearGradient($from, $to, $angle, $center = 0.5) { + + parent::awLinearGradient( + $from, $to, $angle + ); + + $this->center = $center; + + } + +} + +registerClass('BilinearGradient'); + +/** + * Create a radial gradient + * + * @package Artichow + */ +class awRadialGradient extends awGradient { + +} + +registerClass('RadialGradient'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Grid.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Grid.class.php new file mode 100644 index 0000000000000000000000000000000000000000..86a97963a21ff90c515f1f52011c666d456ff206 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Grid.class.php @@ -0,0 +1,289 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Grid + * + * @package Artichow + */ +class awGrid { + + /** + * Vertical lines of the grid + * + * @var array + */ + var $xgrid = array(); + + /** + * Horizontal lines of the grid + * + * @var array + */ + var $ygrid = array(); + + /** + * Is the component grid hidden ? + * + * @var bool + */ + var $hide = FALSE; + + /** + * Are horizontal lines hidden ? + * + * @var bool + */ + var $hideHorizontal = FALSE; + + /** + * Are vertical lines hidden ? + * + * @var bool + */ + var $hideVertical = FALSE; + + /** + * Grid color + * + * @var Color + */ + var $color; + + /** + * Grid space + * + * @var int + */ + var $space; + + /** + * Line type + * + * @var int + */ + var $type = LINE_SOLID; + + /** + * Grid interval + * + * @var int + */ + var $interval = array(1, 1); + + /** + * Grid background color + * + * @var Color + */ + var $background; + + /** + * Build the factory + */ + function awGrid() { + + // Set a grid default color + $this->color = new awColor(210, 210, 210); + $this->background = new awColor(255, 255, 255, 100); + + } + + /** + * Hide grid ? + * + * @param bool $hide + */ + function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Hide horizontal lines ? + * + * @param bool $hideHorizontal + */ + function hideHorizontal($hide = TRUE) { + $this->hideHorizontal = (bool)$hide; + } + + /** + * Hide vertical lines ? + * + * @param bool $hideVertical + */ + function hideVertical($hide = TRUE) { + $this->hideVertical = (bool)$hide; + } + + /** + * Change grid color + * + * @param $color + */ + function setColor($color) { + $this->color = $color; + } + + /** + * Remove grid background + */ + function setNoBackground() { + $this->background = NULL; + } + + /** + * Change grid background color + * + * @param $color + */ + function setBackgroundColor($color) { + $this->background = $color; + } + + /** + * Change line type + * + * @param int $type + */ + function setType($type) { + $this->type = (int)$type; + } + + /** + * Change grid interval + * + * @param int $hInterval + * @param int $vInterval + */ + function setInterval($hInterval, $vInterval) { + $this->interval = array((int)$hInterval, (int)$vInterval); + } + + /** + * Set grid space + * + * @param int $left Left space in pixels + * @param int $right Right space in pixels + * @param int $top Top space in pixels + * @param int $bottom Bottom space in pixels + */ + function setSpace($left, $right, $top, $bottom) { + $this->space = array((int)$left, (int)$right, (int)$top, (int)$bottom); + } + + /** + * Change the current grid + * + * @param array $xgrid Vertical lines + * @param array $ygrid Horizontal lines + */ + function setGrid($xgrid, $ygrid) { + + $this->xgrid = $xgrid; + $this->ygrid = $ygrid; + + } + + /** + * Draw grids + * + * @param $drawer A drawer object + * @param int $x1 + * @param int $y1 + * @param int $x2 + * @param int $y2 + */ + function draw($drawer, $x1, $y1, $x2, $y2) { + + if(is_a($this->background, 'awColor')) { + + // Draw background color + $drawer->filledRectangle( + $this->background, + awLine::build($x1, $y1, $x2, $y2) + ); + + $this->background->free(); + + } + + if($this->hide === FALSE) { + + $this->drawGrid( + $drawer, + $this->color, + $this->hideVertical ? array() : $this->xgrid, + $this->hideHorizontal ? array() : $this->ygrid, + $x1, $y1, $x2, $y2, + $this->type, + $this->space, + $this->interval[0], + $this->interval[1] + ); + + } + + $this->color->free(); + + } + + function drawGrid( + $drawer, $color, + $nx, $ny, $x1, $y1, $x2, $y2, + $type, $space, $hInterval, $vInterval + ) { + + list($left, $right, $top, $bottom) = $space; + + $width = $x2 - $x1 - $left - $right; + $height = $y2 - $y1 - $top - $bottom; + + foreach($nx as $key => $n) { + + if(($key % $vInterval) === 0) { + + $pos = (int)round($x1 + $left + $n * $width); + $drawer->line( + $color, + new awLine( + new awPoint($pos, $y1), + new awPoint($pos, $y2), + $type + ) + ); + + } + + } + + foreach($ny as $key => $n) { + + if(($key % $hInterval) === 0) { + + $pos = (int)round($y1 + $top + $n * $height); + $drawer->line( + $color, + new awLine( + new awPoint($x1, $pos), + new awPoint($x2, $pos), + $type + ) + ); + + } + + } + + } + +} + +registerClass('Grid'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Label.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Label.class.php new file mode 100644 index 0000000000000000000000000000000000000000..788e2c9ce2a4201ec89ce8de48a6aa8c7c81f491 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Label.class.php @@ -0,0 +1,596 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + +/* <php4> */ + +define("LABEL_LEFT", 1); +define("LABEL_RIGHT", 2); +define("LABEL_CENTER", 3); +define("LABEL_TOP", 4); +define("LABEL_BOTTOM", 5); +define("LABEL_MIDDLE", 6); + +/* </php4> */ + +/** + * Draw labels + * + * @package Artichow + */ +class awLabel { + + /** + * Label border + * + * @var int + */ + var $border; + + /** + * Label texts + * + * @var array + */ + var $texts; + + /** + * Text font + * + * @var int + */ + var $font; + + /** + * Text angle + * + * @var int + */ + var $angle = 0; + + /** + * Text color + * + * @var Color + */ + var $color; + + /** + * Text background + * + * @var Color, Gradient + */ + var $background; + + /** + * Callback function + * + * @var string + */ + var $function; + + /** + * Padding + * + * @var int + */ + var $padding; + + /** + * Move position from this vector + * + * @var Point + */ + var $move; + + /** + * Label interval + * + * @var int + */ + var $interval = 1; + + /** + * Horizontal align + * + * @var int + */ + var $hAlign = LABEL_CENTER; + + /** + * Vertical align + * + * @var int + */ + var $vAlign = LABEL_MIDDLE; + + /** + * Hide all labels ? + * + * @var bool + */ + var $hide = FALSE; + + /** + * Keys to hide + * + * @var array + */ + var $hideKey = array(); + + /** + * Values to hide + * + * @var array + */ + var $hideValue = array(); + + /** + * Hide first label + * + * @var bool + */ + var $hideFirst = FALSE; + + /** + * Hide last label + * + * @var bool + */ + var $hideLast = FALSE; + + /** + * Build the label + * + * @param string $label First label + */ + function awLabel($label = NULL, $font = NULL, $color = NULL, $angle = 0) { + + if(is_array($label)) { + $this->set($label); + } else if(is_string($label)) { + $this->set(array($label)); + } + + if($font === NULL) { + $font = new awFont2; + } + + $this->setFont($font); + $this->setAngle($angle); + + if(is_a($color, 'awColor')) { + $this->setColor($color); + } else { + $this->setColor(new awColor(0, 0, 0)); + } + + $this->move = new awPoint(0, 0); + + $this->border = new awBorder; + $this->border->hide(); + + } + + /** + * Get an element of the label from its key + * + * @param int $key Element key + * @return string A value + */ + function get($key) { + return array_key_exists($key, $this->texts) ? $this->texts[$key] : NULL; + } + + /** + * Get all labels + * + * @return array + */ + function all() { + return $this->texts; + } + + /** + * Set one or several labels + * + * @param array $labels Array of string or a string + */ + function set($labels) { + + if(is_string($labels)) { + $this->texts = array($labels); + } else if(is_array($labels)) { + $this->texts = $labels; + } + + } + + /** + * Count number of texts in the label + * + * @return int + */ + function count() { + return is_array($this->texts) ? count($this->texts) : 0; + } + + /** + * Set a callback function for labels + * + * @param string $function + */ + function setCallbackFunction($function) { + $this->function = is_null($function) ? $function : (string)$function; + } + + /** + * Return the callback function for labels + * + * @return string + */ + function getCallbackFunction() { + return $this->function; + } + + /** + * Change labels format + * + * @param string $format New format (printf style: %.2f for example) + */ + function setFormat($format) { + $function = 'label'.time().'_'.(microtime() * 1000000); + eval('function '.$function.'($value) { + return sprintf("'.addcslashes($format, '"').'", $value); + }'); + $this->setCallbackFunction($function); + } + + /** + * Change font for label + * + * @param &$font New font + * @param $color Font color (can be NULL) + */ + function setFont(&$font, $color = NULL) { + $this->font = $font; + if(is_a($color, 'awColor')) { + $this->setColor($color); + } + } + + /** + * Change font angle + * + * @param int $angle New angle + */ + function setAngle($angle) { + $this->angle = (int)$angle; + } + + /** + * Change font color + * + * @param $color + */ + function setColor($color) { + $this->color = $color; + } + + /** + * Change text background + * + * @param mixed $background + */ + function setBackground($background) { + $this->background = $background; + } + + /** + * Change text background color + * + * @param Color + */ + function setBackgroundColor($color) { + $this->background = $color; + } + + /** + * Change text background gradient + * + * @param Gradient + */ + function setBackgroundGradient($gradient) { + $this->background = $gradient; + } + + /** + * Change padding + * + * @param int $left Left padding + * @param int $right Right padding + * @param int $top Top padding + * @param int $bottom Bottom padding + */ + function setPadding($left, $right, $top, $bottom) { + $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); + } + + /** + * Hide all labels ? + * + * @param bool $hide + */ + function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show all labels ? + * + * @param bool $show + */ + function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + /** + * Hide a key + * + * @param int $key The key to hide + */ + function hideKey($key) { + $this->hideKey[$key] = TRUE; + } + + /** + * Hide a value + * + * @param int $value The value to hide + */ + function hideValue($value) { + $this->hideValue[] = $value; + } + + /** + * Hide first label + * + * @param bool $hide + */ + function hideFirst($hide) { + $this->hideFirst = (bool)$hide; + } + + /** + * Hide last label + * + * @param bool $hide + */ + function hideLast($hide) { + $this->hideLast = (bool)$hide; + } + + /** + * Set label interval + * + * @param int + */ + function setInterval($interval) { + + $this->interval = (int)$interval; + + } + + /** + * Change label position + * + * @param int $x Add this interval to X coord + * @param int $y Add this interval to Y coord + */ + function move($x, $y) { + + $this->move = $this->move->move($x, $y); + + } + + /** + * Change alignment + * + * @param int $h Horizontal alignment + * @param int $v Vertical alignment + */ + function setAlign($h = NULL, $v = NULL) { + if($h !== NULL) { + $this->hAlign = (int)$h; + } + if($v !== NULL) { + $this->vAlign = (int)$v; + } + } + + /** + * Get a text from the labele + * + * @param mixed $key Key in the array text + * @return Text + */ + function getText($key) { + + if(is_array($this->texts) and array_key_exists($key, $this->texts)) { + + $value = $this->texts[$key]; + + if(is_string($this->function)) { + $value = call_user_func($this->function, $value); + } + + $text = new awText($value); + $text->setFont($this->font); + $text->setAngle($this->angle); + $text->setColor($this->color); + + if(is_a($this->background, 'awColor')) { + $text->setBackgroundColor($this->background); + } else if(is_a($this->background, 'awGradient')) { + $text->setBackgroundGradient($this->background); + } + + $text->border = $this->border; + + if($this->padding !== NULL) { + call_user_func_array(array($text, 'setPadding'), $this->padding); + } + + return $text; + + } else { + return NULL; + } + + } + + /** + * Get max width of all texts + * + * @param $drawer A drawer + * @return int + */ + function getMaxWidth($drawer) { + + return $this->getMax($drawer, 'getTextWidth'); + + } + + /** + * Get max height of all texts + * + * @param $drawer A drawer + * @return int + */ + function getMaxHeight($drawer) { + + return $this->getMax($drawer, 'getTextHeight'); + + } + + /** + * Draw the label + * + * @param $drawer + * @param $p Label center + * @param int $key Text position in the array of texts (default to zero) + */ + function draw($drawer, $p, $key = 0) { + + if(($key % $this->interval) !== 0) { + return; + } + + // Hide all labels + if($this->hide) { + return; + } + + // Key is hidden + if(array_key_exists($key, $this->hideKey)) { + return; + } + + // Hide first label + if($key === 0 and $this->hideFirst) { + return; + } + + // Hide last label + if($key === count($this->texts) - 1 and $this->hideLast) { + return; + } + + $text = $this->getText($key); + + if($text !== NULL) { + + // Value must be hidden + if(in_array($text->getText(), $this->hideValue)) { + return; + } + + $x = $p->x; + $y = $p->y; + + // Get padding + list($left, $right, $top, $bottom) = $text->getPadding(); + + $font = $text->getFont(); + $width = $font->getTextWidth($text); + $height = $font->getTextHeight($text); + + switch($this->hAlign) { + + case LABEL_RIGHT : + $x -= ($width + $right); + break; + + case LABEL_CENTER : + $x -= ($width - $left + $right) / 2; + break; + + case LABEL_LEFT : + $x += $left; + break; + + } + + switch($this->vAlign) { + + case LABEL_TOP : + $y -= ($height + $bottom); + break; + + case LABEL_MIDDLE : + $y -= ($height - $top + $bottom) / 2; + break; + + case LABEL_BOTTOM : + $y += $top; + break; + + } + + $drawer->string($text, $this->move->move($x, $y)); + + } + + } + + function getMax($drawer, $function) { + + $max = NULL; + + foreach($this->texts as $key => $text) { + + $text = $this->getText($key); + $font = $text->getFont(); + + if(is_null($max)) { + $max = $font->{$function}($text); + } else { + $max = max($max, $font->{$function}($text)); + } + + } + + return $max; + + } + +} + +registerClass('Label'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Legend.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Legend.class.php new file mode 100644 index 0000000000000000000000000000000000000000..269dd630414b5e314f9c1f0f5e1550f7af6956a7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Legend.class.php @@ -0,0 +1,691 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + +/* <php4> */ + +define("LEGEND_LINE", 1); +define("LEGEND_BACKGROUND", 2); +define("LEGEND_MARK", 3); +define("LEGEND_MARKONLY", 4); + +define("LEGEND_MODEL_RIGHT", 1); +define("LEGEND_MODEL_BOTTOM", 2); + +define("LEGEND_LEFT", 1); +define("LEGEND_RIGHT", 2); +define("LEGEND_CENTER", 3); +define("LEGEND_TOP", 4); +define("LEGEND_BOTTOM", 5); +define("LEGEND_MIDDLE", 6); + +/* </php4> */ + +/** + * Some legends + * + * @package Artichow + */ +class awLegend { + + /** + * Legends added + * + * @var array + */ + var $legends = array(); + + /** + * The current component + * + * @var Component + */ + var $component; + + /** + * Background color or gradient + * + * @var Color, Gradient + */ + var $background; + + /** + * Text color + * + * @var Color + */ + var $textColor; + + /** + * Text font + * + * @var Font + */ + var $textFont; + + /** + * Text margin + * + * @var Side + */ + var $textMargin; + + /** + * Number of columns + * + * @var int + */ + var $columns = NULL; + + /** + * Number of rows + * + * @var int + */ + var $rows = NULL; + + /** + * Legend position + * + * @var Point + */ + var $position; + + /** + * Hide legend ? + * + * @var bool + */ + var $hide = FALSE; + + /** + * Space between each legend + * + * @var int + */ + var $space = 4; + + /** + * Horizontal alignment + * + * @var int + */ + var $hAlign; + + /** + * Vertical alignment + * + * @var int + */ + var $vAlign; + + /** + * Margin + * + * @var array Array for left, right, top and bottom margins + */ + var $margin; + + /** + * Legend shadow + * + * @var Shadow + */ + var $shadow; + + /** + * Legend border + * + * @var Border + */ + var $border; + + /** + * Line legend + * + * @var int + */ + + + /** + * Color/Gradient background legend + * + * @var int + */ + + + /** + * Use marks and line as legend + * + * @var int + */ + + + /** + * Use marks as legend + * + * @var int + */ + + + /** + * Right side model + * + * @var int + */ + + + /** + * Bottom side model + * + * @var int + */ + + + /** + * Build the legend + * + * @param int $model Legend model + */ + function awLegend($model = LEGEND_MODEL_RIGHT) { + + $this->shadow = new awShadow(SHADOW_LEFT_BOTTOM); + $this->border = new awBorder; + + $this->textMargin = new awSide(4); + $this->setModel($model); + + } + + /** + * Set a predefined model for the legend + * + * @param int $model + */ + function setModel($model) { + + $this->setBackgroundColor(new awColor(255, 255, 255, 15)); + $this->setPadding(8, 8, 8, 8); + $this->setTextFont(new awFont2); + $this->shadow->setSize(3); + + switch($model) { + + case LEGEND_MODEL_RIGHT : + + $this->setColumns(1); + $this->setAlign(LEGEND_RIGHT, LEGEND_MIDDLE); + $this->setPosition(0.96, 0.50); + + break; + + case LEGEND_MODEL_BOTTOM : + + $this->setRows(1); + $this->setAlign(LEGEND_CENTER, LEGEND_TOP); + $this->setPosition(0.50, 0.92); + + break; + + default : + + $this->setPosition(0.5, 0.5); + + break; + + } + + } + + /** + * Hide legend ? + * + * @param bool $hide TRUE to hide legend, FALSE otherwise + */ + function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show legend ? + * + * @param bool $show + */ + function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + + /** + * Add a Legendable object to the legend + * + * @param &$legendable + * @param string $title Legend title + * @param int $type Legend type (default to LEGEND_LINE) + */ + function add(&$legendable, $title, $type = LEGEND_LINE) { + + $legend = array($legendable, $title, $type); + + $this->legends[] = $legend; + + } + + /** + * Change legend padding + * + * @param int $left + * @param int $right + * @param int $top + * @param int $bottom + */ + function setPadding($left, $right, $top, $bottom) { + $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); + } + + /** + * Change space between each legend + * + * @param int $space + */ + function setSpace($space) { + $this->space = (int)$space; + } + + /** + * Change alignment + * + * @param int $h Horizontal alignment + * @param int $v Vertical alignment + */ + function setAlign($h = NULL, $v = NULL) { + if($h !== NULL) { + $this->hAlign = (int)$h; + } + if($v !== NULL) { + $this->vAlign = (int)$v; + } + } + + /** + * Change number of columns + * + * @param int $columns + */ + function setColumns($columns) { + $this->rows = NULL; + $this->columns = (int)$columns; + } + + /** + * Change number of rows + * + * @param int $rows + */ + function setRows($rows) { + $this->columns = NULL; + $this->rows = (int)$rows; + } + + /** + * Change legend position + * X and Y positions must be between 0 and 1. + * + * @param float $x + * @param float $y + */ + function setPosition($x = NULL, $y = NULL) { + $x = (is_null($x) and !is_null($this->position)) ? $this->position->x : $x; + $y = (is_null($y) and !is_null($this->position)) ? $this->position->y : $y; + + $this->position = new awPoint($x, $y); + } + + /** + * Get legend position + * + * @return Point + */ + function getPosition() { + return $this->position; + } + + /** + * Change text font + * + * @param &$font + */ + function setTextFont(&$font) { + $this->textFont = $font; + } + + /** + * Change text margin + * + * @param int $left + * @param int $right + */ + function setTextMargin($left, $right) { + $this->textMargin->set($left, $right); + } + + /** + * Change text color + * + * @param $color + */ + function setTextColor($color) { + $this->textColor = $color; + } + + /** + * Change background + * + * @param mixed $background + */ + function setBackground($background) { + $this->background = $background; + } + + /** + * Change background color + * + * @param $color + */ + function setBackgroundColor($color) { + $this->background = $color; + } + + /** + * Change background gradient + * + * @param $gradient + */ + function setBackgroundGradient($gradient) { + $this->background = $gradient; + } + + /** + * Count the number of Legendable objects in the legend + * + * @return int + */ + function count() { + return count($this->legends); + } + + function draw($drawer) { + + if($this->hide) { + return; + } + + $count = $this->count(); + + // No legend to print + if($count === 0) { + return; + } + + // Get text widths and heights of each element of the legend + $widths = array(); + $heights = array(); + $texts = array(); + for($i = 0; $i < $count; $i++) { + list(, $title, ) = $this->legends[$i]; + $text = new awText( + $title, + $this->textFont, + $this->textColor, + 0 + ); + $font = $text->getFont(); + $widths[$i] = $font->getTextWidth($text) + $this->textMargin->left + $this->textMargin->right; + $heights[$i] = $font->getTextHeight($text); + $texts[$i] = $text; + } + + // Maximum height of the font used + $heightMax = array_max($heights); + + // Get number of columns + if($this->columns !== NULL) { + $columns = $this->columns; + } else if($this->rows !== NULL) { + $columns = ceil($count / $this->rows); + } else { + $columns = $count; + } + + // Number of rows + $rows = (int)ceil($count / $columns); + + // Get maximum with of each column + $widthMax = array(); + for($i = 0; $i < $count; $i++) { + // Get column width + $column = $i % $columns; + if(array_key_exists($column, $widthMax) === FALSE) { + $widthMax[$column] = $widths[$i]; + } else { + $widthMax[$column] = max($widthMax[$column], $widths[$i]); + } + } + + $width = $this->padding[0] + $this->padding[1] - $this->space; + for($i = 0; $i < $columns; $i++) { + $width += $this->space + 5 + 10 + $widthMax[$i]; + } + + $height = ($heightMax + $this->space) * $rows - $this->space + $this->padding[2] + $this->padding[3]; + + // Look for legends position + list($x, $y) = $drawer->getSize(); + + $p = new awPoint( + $this->position->x * $x, + $this->position->y * $y + ); + + switch($this->hAlign) { + + case LEGEND_CENTER : + $p->x -= $width / 2; + break; + + case LEGEND_RIGHT : + $p->x -= $width; + break; + + } + + switch($this->vAlign) { + + case LEGEND_MIDDLE : + $p->y -= $height / 2; + break; + + case LEGEND_BOTTOM : + $p->y -= $height; + break; + + } + + // Draw legend shadow + $this->shadow->draw( + $drawer, + $p, + $p->move($width, $height), + SHADOW_OUT + ); + + // Draw legends base + $this->drawBase($drawer, $p, $width, $height); + + // Draw each legend + for($i = 0; $i < $count; $i++) { + + list($component, $title, $type) = $this->legends[$i]; + + $column = $i % $columns; + $row = (int)floor($i / $columns); + + // Get width of all previous columns + $previousColumns = 0; + for($j = 0; $j < $column; $j++) { + $previousColumns += $this->space + 10 + 5 + $widthMax[$j]; + } + + // Draw legend text + $drawer->string( + $texts[$i], + $p->move( + $this->padding[0] + $previousColumns + 10 + 5 + $this->textMargin->left, + $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - $heights[$i] / 2 + ) + ); + + // Draw legend icon + switch($type) { + + case LEGEND_LINE : + case LEGEND_MARK : + case LEGEND_MARKONLY : + + // Get vertical position + $x = $this->padding[0] + $previousColumns; + $y = $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - $component->getLegendLineThickness(); + + // Draw two lines + if($component->getLegendLineColor() !== NULL) { + + $color = $component->getLegendLineColor(); + + if(is_a($color, 'awColor') and $type !== LEGEND_MARKONLY) { + + $drawer->line( + $color, + new awLine( + $p->move( + $x, // YaPB ?? + $y + $component->getLegendLineThickness() / 2 + ), + $p->move( + $x + 10, + $y + $component->getLegendLineThickness() / 2 + ), + $component->getLegendLineStyle(), + $component->getLegendLineThickness() + ) + ); + + $color->free(); + unset($color); + + } + + } + + if($type === LEGEND_MARK or $type === LEGEND_MARKONLY) { + + $mark = $component->getLegendMark(); + + if($mark !== NULL) { + $mark->draw( + $drawer, + $p->move( + $x + 5.5, + $y + $component->getLegendLineThickness() / 2 + ) + ); + } + + unset($mark); + + } + + break; + + case LEGEND_BACKGROUND : + + // Get vertical position + $x = $this->padding[0] + $previousColumns; + $y = $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - 5; + + $from = $p->move( + $x, + $y + ); + + $to = $p->move( + $x + 10, + $y + 10 + ); + + $background = $component->getLegendBackground(); + + if($background !== NULL) { + + $drawer->filledRectangle( + $component->getLegendBackground(), + new awLine($from, $to) + ); + + // Draw rectangle border + $this->border->rectangle( + $drawer, + $from->move(0, 0), + $to->move(0, 0) + ); + + } + + unset($background, $from, $to); + + break; + + } + + } + + } + + function drawBase($drawer, $p, $width, $height) { + + $this->border->rectangle( + $drawer, + $p, + $p->move($width, $height) + ); + + $size = $this->border->visible() ? 1 : 0; + + $drawer->filledRectangle( + $this->background, + new awLine( + $p->move($size, $size), + $p->move($width - $size, $height - $size) + ) + ); + + } + +} + +registerClass('Legend'); + +/** + * You can add a legend to components which implements this interface + * + * @package Artichow + */ + + +registerInterface('Legendable'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Mark.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Mark.class.php new file mode 100644 index 0000000000000000000000000000000000000000..85d01acd44f843402b137675dd2d77966566a411 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Mark.class.php @@ -0,0 +1,335 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* <php4> */ + +define("MARK_CIRCLE", 1); +define("MARK_SQUARE", 2); +define("MARK_IMAGE", 3); +define("MARK_STAR", 4); +define("MARK_PAPERCLIP", 5); +define("MARK_BOOK", 6); + +/* </php4> */ + +/** + * Draw marks + * + * @package Artichow + */ +class awMark { + + /** + * Circle mark + * + * @var int + */ + + + /** + * Quare mark + * + * @var int + */ + + + /** + * Image mark + * + * @var int + */ + + + /** + * Star mark + * + * @var int + */ + + + /** + * Paperclip mark + * + * @var int + */ + + + /** + * Book mark + * + * @var int + */ + + + /** + * Must marks be hidden ? + * + * @var bool + */ + var $hide; + + /** + * Mark type + * + * @var int + */ + var $type; + + /** + * Mark size + * + * @var int + */ + var $size = 8; + + /** + * Fill mark + * + * @var Color, Gradient + */ + var $fill; + + /** + * Mark image + * + * @var Image + */ + var $image; + + /** + * To draw marks + * + * @var Drawer + */ + var $drawer; + + /** + * Move position from this vector + * + * @var Point + */ + var $move; + + /** + * Marks border + * + * @var Border + */ + var $border; + + /** + * Build the mark + */ + function awMark() { + + $this->fill = new awColor(255, 0, 0, 0); + $this->border = new awBorder; + $this->border->hide(); + + $this->move = new awPoint(0, 0); + + } + + /** + * Change mark position + * + * @param int $x Add this interval to X coord + * @param int $y Add this interval to Y coord + */ + function move($x, $y) { + + $this->move = $this->move->move($x, $y); + + } + + /** + * Hide marks ? + * + * @param bool $hide TRUE to hide marks, FALSE otherwise + */ + function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show marks ? + * + * @param bool $show + */ + function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + /** + * Change mark type + * + * @param int $size Size in pixels + */ + function setSize($size) { + $this->size = (int)$size; + } + + /** + * Change mark type + * + * @param int $type New mark type + * @param int $size Mark size (can be NULL) + */ + function setType($type, $size = NULL) { + $this->type = (int)$type; + if($size !== NULL) { + $this->setSize($size); + } + } + + /** + * Fill the mark with a color or a gradient + * + * @param mixed $fill A color or a gradient + */ + function setFill($fill) { + if(is_a($fill, 'awColor') or is_a($fill, 'awGradient')) { + $this->fill = $fill; + } + } + + /** + * Set an image + * Only for MARK_IMAGE type. + * + * @param Image An image + */ + function setImage(&$image) { + $this->image = $image; + } + + /** + * Draw the mark + * + * @param $drawer + * @param $point Mark center + */ + function draw($drawer, $point) { + + // Hide marks ? + if($this->hide) { + return; + } + + // Check if we can print marks + if($this->type !== NULL) { + + $this->drawer = $drawer; + $realPoint = $this->move->move($point->x, $point->y); + + switch($this->type) { + + case MARK_CIRCLE : + $this->drawCircle($realPoint); + break; + + case MARK_SQUARE : + $this->drawSquare($realPoint); + break; + + case MARK_IMAGE : + $this->drawImage($realPoint); + break; + + case MARK_STAR : + $this->changeType('star'); + $this->draw($drawer, $point); + break; + + case MARK_PAPERCLIP : + $this->changeType('paperclip'); + $this->draw($drawer, $point); + break; + + case MARK_BOOK : + $this->changeType('book'); + $this->draw($drawer, $point); + break; + + } + + } + + } + + function changeType($image) { + $this->setType(MARK_IMAGE); + $this->setImage(new awFileImage(ARTICHOW_IMAGE.DIRECTORY_SEPARATOR.$image.'.png')); + } + + function drawCircle($point) { + + $this->drawer->filledEllipse( + $this->fill, + $point, + $this->size, $this->size + ); + + $this->border->ellipse( + $this->drawer, + $point, + $this->size, $this->size + ); + + } + + function drawSquare($point) { + + list($x, $y) = $point->getLocation(); + + $x1 = (int)($x - $this->size / 2); + $x2 = $x1 + $this->size; + $y1 = (int)($y - $this->size / 2); + $y2 = $y1 + $this->size; + + $this->border->rectangle($this->drawer, new awPoint($x1, $y1), new awPoint($x2, $y2)); + + $size = $this->border->visible() ? 1 : 0; + + $this->drawer->filledRectangle( + $this->fill, + new awLine( + new awPoint($x1 + $size, $y1 + $size), + new awPoint($x2 - $size, $y2 - $size) + ) + ); + + } + + function drawImage($point) { + + if(is_a($this->image, 'awImage')) { + + $width = $this->image->width; + $height = $this->image->height; + + list($x, $y) = $point->getLocation(); + + $x1 = (int)($x - $width / 2); + $x2 = $x1 + $width; + $y1 = (int)($y - $width / 2); + $y2 = $y1 + $height; + + $this->border->rectangle($this->drawer, new awPoint($x1 - 1, $y1 - 1), new awPoint($x2 + 1, $y2 + 1)); + + $this->drawer->copyImage($this->image, new awPoint($x1, $y1), new awPoint($x2, $y2)); + + } + + } + +} + +registerClass('Mark'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Math.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Math.class.php new file mode 100644 index 0000000000000000000000000000000000000000..0a3fac129cf25245a44978b368b76c474af0c910 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Math.class.php @@ -0,0 +1,492 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + class awShape { + + /** + * Is the shape hidden ? + * + * @var bool + */ + var $hide = FALSE; + + /** + * Shape style + * + * @var int + */ + var $style; + + /** + * Shape thickness + * + * @var int + */ + var $thickness; + + /** + * Solid shape + * + * @var int + */ + + + /** + * Dotted shape + * + * @var int + */ + + + /** + * Dashed shape + * + * @var int + */ + + + /** + * Change shape style + * + * @param int $style Line style + */ + function setStyle($style) { + $this->style = (int)$style; + } + + /** + * Return shape style + * + * @return int + */ + function getStyle() { + return $this->style; + } + + /** + * Change shape thickness + * + * @param int $thickness Shape thickness in pixels + */ + function setThickness($thickness) { + $this->thickness = (int)$thickness; + } + + /** + * Return shape thickness + * + * @return int + */ + function getThickness() { + return $this->thickness; + } + + /** + * Hide the shape + * + * @param bool $hide + */ + function hide($hide) { + $this->hide = (bool)$hide; + } + + /** + * Show the shape + * + * @param bool $shape + */ + function show($shape) { + $this->hide = (bool)!$shape; + } + + /** + * Is the line hidden ? + * + * @return bool + */ + function isHidden() { + return $this->hide; + } + +} + +registerClass('Shape', TRUE); + +/** + * Describe a point + * + * @package Artichow + */ +class awPoint extends awShape { + + /** + * X coord + * + * @var float + */ + var $x; + + /** + * Y coord + * + * @var float + */ + var $y; + + /** + * Build a new awpoint + * + * @param float $x + * @param float $y + */ + function awPoint($x, $y) { + + $this->setLocation($x, $y); + + } + + /** + * Change X value + * + * @param float $x + */ + function setX($x) { + $this->x = (float)$x; + } + + /** + * Change Y value + * + * @param float $y + */ + function setY($y) { + $this->y = (float)$y; + } + + /** + * Change point location + * + * @param float $x + * @param float $y + */ + function setLocation($x, $y) { + $this->setX($x); + $this->setY($y); + } + + /** + * Get point location + * + * @param array Point location + */ + function getLocation() { + return array($this->x, $this->y); + } + + /** + * Get distance to another point + * + * @param $p A point + * @return float + */ + function getDistance($p) { + + return sqrt(pow($p->x - $this->x, 2) + pow($p->y - $this->y, 2)); + + } + + /** + * Move the point to another location + * + * @param Point A Point with the new awlocation + */ + function move($x, $y) { + + return new awPoint( + $this->x + $x, + $this->y + $y + ); + + } + +} + +registerClass('Point'); + +/* <php4> */ + +define("LINE_SOLID", 1); +define("LINE_DOTTED", 2); +define("LINE_DASHED", 3); + +/* </php4> */ + +/** + * Describe a line + * + * @package Artichow + */ +class awLine extends awShape { + + /** + * Line first point + * + * @param Point + */ + var $p1; + + /** + * Line second point + * + * @param Point + */ + var $p2; + + /** + * Build a new awline + * + * @param $p1 First point + * @param $p2 Second point + * @param int $type Style of line (default to solid) + * @param int $thickness Line thickness (default to 1) + */ + function awLine($p1 = NULL, $p2 = NULL, $type = LINE_SOLID, $thickness = 1) { + + $this->setLocation($p1, $p2); + $this->setStyle($type); + $this->setThickness($thickness); + + } + + /** + * Build a line from 4 coords + * + * @param int $x1 Left position + * @param int $y1 Top position + * @param int $x2 Right position + * @param int $y2 Bottom position + */ + function build($x1, $y1, $x2, $y2) { + + return new awLine( + new awPoint($x1, $y1), + new awPoint($x2, $y2) + ); + + } + + /** + * Change X values of the line + * + * @param int $x1 Begin value + * @param int $x2 End value + */ + function setX($x1, $x2) { + $this->p1->setX($x1); + $this->p2->setX($x2); + } + + /** + * Change Y values of the line + * + * @param int $y1 Begin value + * @param int $y2 End value + */ + function setY($y1, $y2) { + $this->p1->setY($y1); + $this->p2->setY($y2); + } + + /** + * Change line location + * + * @param $p1 First point + * @param $p2 Second point + */ + function setLocation($p1, $p2) { + if(is_null($p1) or is_a($p1, 'awPoint')) { + $this->p1 = $p1; + } + if(is_null($p2) or is_a($p2, 'awPoint')) { + $this->p2 = $p2; + } + } + + /** + * Get line location + * + * @param array Line location + */ + function getLocation() { + return array($this->p1, $this->p2); + } + + /** + * Get the line size + * + * @return float + */ + function getSize() { + + $square = pow($this->p2->x - $this->p1->x, 2) + pow($this->p2->y - $this->p1->y, 2); + return sqrt($square); + + } + + /** + * Test if the line can be considered as a point + * + * @return bool + */ + function isPoint() { + return ($this->p1->x === $this->p2->x and $this->p1->y === $this->p2->y); + } + + /** + * Test if the line is a vertical line + * + * @return bool + */ + function isVertical() { + return ($this->p1->x === $this->p2->x); + } + + /** + * Test if the line is an horizontal line + * + * @return bool + */ + function isHorizontal() { + return ($this->p1->y === $this->p2->y); + } + +} + +registerClass('Line'); + +/** + * A vector is a type of line + * The sense of the vector goes from $p1 to $p2. + * + * @package Artichow + */ +class awVector extends awLine { + + /** + * Get vector angle in radians + * + * @return float + */ + function getAngle() { + + if($this->isPoint()) { + return 0.0; + } + + $size = $this->getSize(); + + $width = ($this->p2->x - $this->p1->x); + $height = ($this->p2->y - $this->p1->y) * -1; + + if($width >= 0 and $height >= 0) { + return acos($width / $size); + } else if($width <= 0 and $height >= 0) { + return acos($width / $size); + } else { + $height *= -1; + if($width >= 0 and $height >= 0) { + return 2 * M_PI - acos($width / $size); + } else if($width <= 0 and $height >= 0) { + return 2 * M_PI - acos($width / $size); + } + } + + } + +} + +registerClass('Vector'); + +/* <php4> */ + +define("POLYGON_SOLID", 1); +define("POLYGON_DOTTED", 2); +define("POLYGON_DASHED", 3); + +/* </php4> */ + +/** + * Describe a polygon + * + * @package Artichow + */ +class awPolygon extends awShape { + + /** + * Polygon points + * + * @var array + */ + var $points = array(); + + /** + * Set a point in the polygon + * + * @param int $pos Point position + * @param $point + */ + function set($pos, $point) { + if(is_null($point) or is_a($point, 'awPoint')) { + $this->points[$pos] = $point; + } + } + + /** + * Add a point at the end of the polygon + * + * @param $point + */ + function append($point) { + if(is_null($point) or is_a($point, 'awPoint')) { + $this->points[] = $point; + } + } + + /** + * Get a point at a position in the polygon + * + * @param int $pos Point position + * @return Point + */ + function get($pos) { + return $this->points[$pos]; + } + + /** + * Count number of points in the polygon + * + * @return int + */ + function count() { + return count($this->points); + } + + /** + * Returns all points in the polygon + * + * @return array + */ + function all() { + return $this->points; + } + +} + +registerClass('Polygon'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Shadow.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Shadow.class.php new file mode 100644 index 0000000000000000000000000000000000000000..94f52a070a178bb09ef6720cc75e101724b16024 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Shadow.class.php @@ -0,0 +1,415 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* <php4> */ + +define("SHADOW_LEFT_TOP", 1); +define("SHADOW_LEFT_BOTTOM", 2); +define("SHADOW_RIGHT_TOP", 3); +define("SHADOW_RIGHT_BOTTOM", 4); + +define("SHADOW_IN", 1); +define("SHADOW_OUT", 2); + +/* </php4> */ + +/** + * Draw shadows + * + */ +class awShadow { + + /** + * Shadow on left and top sides + * + * @var int + */ + + + /** + * Shadow on left and bottom sides + * + * @var int + */ + + + + /** + * Shadow on right and top sides + * + * @var int + */ + + + /** + * Shadow on right and bottom sides + * + * @var int + */ + + + /** + * In mode + * + * @var int + */ + + + /** + * Out mode + * + * @var int + */ + + + /** + * Shadow size + * + * @var int + */ + var $size = 0; + + /** + * Hide shadow ? + * + * @var bool + */ + var $hide = FALSE; + + /** + * Shadow color + * + * @var Color + */ + var $color; + + /** + * Shadow position + * + * @var int + */ + var $position; + + /** + * Smooth shadow ? + * + * @var bool + */ + var $smooth = FALSE; + + /** + * Shadow constructor + * + * @param int $position Shadow position + */ + function awShadow($position) { + $this->setPosition($position); + } + + /** + * Hide shadow ? + * + * @param bool $hide + */ + function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show shadow ? + * + * @param bool $show + */ + function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + /** + * Change shadow size + * + * @param int $size + * @param bool $smooth Smooth the shadow (facultative argument) + */ + function setSize($size, $smooth = NULL) { + $this->size = (int)$size; + if($smooth !== NULL) { + $this->smooth($smooth); + } + } + + /** + * Change shadow color + * + * @param $color + */ + function setColor($color) { + $this->color = (int)$color; + } + + /** + * Change shadow position + * + * @param int $position + */ + function setPosition($position) { + $this->position = (int)$position; + } + + /** + * Smooth shadow ? + * + * @param bool $smooth + */ + function smooth($smooth) { + $this->smooth = (bool)$smooth; + } + + /** + * Get the space taken by the shadow + * + * @return Side + */ + function getSpace() { + + return new awSide( + ($this->position === SHADOW_LEFT_TOP or $this->position === SHADOW_LEFT_BOTTOM) ? $this->size : 0, + ($this->position === SHADOW_RIGHT_TOP or $this->position === SHADOW_RIGHT_BOTTOM) ? $this->size : 0, + ($this->position === SHADOW_LEFT_TOP or $this->position === SHADOW_RIGHT_TOP) ? $this->size : 0, + ($this->position === SHADOW_LEFT_BOTTOM or $this->position === SHADOW_RIGHT_BOTTOM) ? $this->size : 0 + ); + + } + + /** + * Draw shadow + * + * @param $drawer + * @param $p1 Top-left point + * @param $p2 Right-bottom point + * @param int Drawing mode + */ + function draw($drawer, $p1, $p2, $mode) { + + if($this->hide) { + return; + } + + if($this->size <= 0) { + return; + } + + + + $color = (is_a($this->color, 'awColor')) ? $this->color : new awColor(125, 125, 125); + + switch($this->position) { + + case SHADOW_RIGHT_BOTTOM : + + if($mode === SHADOW_OUT) { + $t1 = $p1->move(0, 0); + $t2 = $p2->move($this->size + 1, $this->size + 1); + } else { // PHP 4 compatibility + $t1 = $p1->move(0, 0); + $t2 = $p2->move(0, 0); + } + + $width = $t2->x - $t1->x; + $height = $t2->y - $t1->y; + + $drawer->setAbsPosition($t1->x + $drawer->x, $t1->y + $drawer->y); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($width - $this->size, $this->size), + new awPoint($width - 1, $height - 1) + ) + ); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($this->size, $height - $this->size), + new awPoint($width - $this->size - 1, $height - 1) + ) + ); + + $this->smoothPast($drawer, $color, $width, $height); + + break; + + case SHADOW_LEFT_TOP : + + if($mode === SHADOW_OUT) { + $t1 = $p1->move(- $this->size, - $this->size); + $t2 = $p2->move(0, 0); + } else { // PHP 4 compatibility + $t1 = $p1->move(0, 0); + $t2 = $p2->move(0, 0); + } + + $width = $t2->x - $t1->x; + $height = $t2->y - $t1->y; + + $drawer->setAbsPosition($t1->x + $drawer->x, $t1->y + $drawer->y); + + $height = max($height + 1, $this->size); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint(0, 0), + new awPoint($this->size - 1, $height - $this->size - 1) + ) + ); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($this->size, 0), + new awPoint($width - $this->size - 1, $this->size - 1) + ) + ); + + $this->smoothPast($drawer, $color, $width, $height); + + break; + + case SHADOW_RIGHT_TOP : + + if($mode === SHADOW_OUT) { + $t1 = $p1->move(0, - $this->size); + $t2 = $p2->move($this->size + 1, 0); + } else { // PHP 4 compatibility + $t1 = $p1->move(0, 0); + $t2 = $p2->move(0, 0); + } + + $width = $t2->x - $t1->x; + $height = $t2->y - $t1->y; + + $drawer->setAbsPosition($t1->x + $drawer->x, $t1->y + $drawer->y); + + $height = max($height + 1, $this->size); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($width - $this->size, 0), + new awPoint($width - 1, $height - $this->size - 1) + ) + ); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($this->size, 0), + new awPoint($width - $this->size - 1, $this->size - 1) + ) + ); + + $this->smoothFuture($drawer, $color, $width, $height); + + break; + + case SHADOW_LEFT_BOTTOM : + + if($mode === SHADOW_OUT) { + $t1 = $p1->move(- $this->size, 0); + $t2 = $p2->move(0, $this->size + 1); + } else { // PHP 4 compatibility + $t1 = $p1->move(0, 0); + $t2 = $p2->move(0, 0); + } + + $width = $t2->x - $t1->x; + $height = $t2->y - $t1->y; + + $drawer->setAbsPosition($t1->x + $drawer->x, $t1->y + $drawer->y); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint(0, $this->size), + new awPoint($this->size - 1, $height - 1) + ) + ); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($this->size, $height - $this->size), + new awPoint($width - $this->size - 1, $height - 1) + ) + ); + + $this->smoothFuture($drawer, $color, $width, $height); + + break; + + } + + } + + function smoothPast($drawer, $color, $width, $height) { + + if($this->smooth) { + + for($i = 0; $i < $this->size; $i++) { + for($j = 0; $j <= $i; $j++) { + $drawer->point( + $color, + new awPoint($i, $j + $height - $this->size) + ); + } + } + + for($i = 0; $i < $this->size; $i++) { + for($j = 0; $j <= $i; $j++) { + $drawer->point( + $color, + new awPoint($width - $this->size + $j, $i) + ); + } + } + + } + + } + + function smoothFuture($drawer, $color, $width, $height) { + + if($this->smooth) { + + for($i = 0; $i < $this->size; $i++) { + for($j = 0; $j <= $i; $j++) { + $drawer->point( + $color, + new awPoint($i, $this->size - $j - 1) + ); + } + } + + for($i = 0; $i < $this->size; $i++) { + for($j = 0; $j <= $i; $j++) { + $drawer->point( + $color, + new awPoint($width - $this->size + $j, $height - $i - 1) + ); + } + } + + } + } + +} + +registerClass('Shadow'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Text.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Text.class.php new file mode 100644 index 0000000000000000000000000000000000000000..57d60121e88ce0b0ce8e0f4d6c3b622ee4568a8d --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Text.class.php @@ -0,0 +1,217 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * To handle text + * + * @package Artichow + */ +class awText { + + /** + * Your text + * + * @var string + */ + var $text; + + /** + * Text font + * + * @var Font + */ + var $font; + + /** + * Text angle + * Can be 0 or 90 + * + * @var int + */ + var $angle; + + /** + * Text color + * + * @var Color + */ + var $color; + + /** + * Text background + * + * @var Color, Gradient + */ + var $background; + + /** + * Padding + * + * @var array Array for left, right, top and bottom paddings + */ + var $padding; + + /** + * Text border + * + * @var Border + */ + var $border; + + /** + * Build a new awtext + * + * @param string $text Your text + */ + function awText($text, $font = NULL, $color = NULL, $angle = 0) { + + if(is_null($font)) { + $font = new awFont2; + } + + $this->setText($text); + $this->setFont($font); + + // Set default color to black + if($color === NULL) { + $color = new awColor(0, 0, 0); + } + + $this->setColor($color); + $this->setAngle($angle); + + $this->border = new awBorder; + $this->border->hide(); + + } + + /** + * Get text + * + * @return string + */ + function getText() { + return $this->text; + } + + /** + * Change text + * + * @param string $text New text + */ + function setText($text) { + $this->text = (string)$text; + } + + /** + * Change text font + * + * @param Font + */ + function setFont(&$font) { + $this->font = $font; + } + + /** + * Get text font + * + * @return int + */ + function getFont() { + return $this->font; + } + + /** + * Change text angle + * + * @param int + */ + function setAngle($angle) { + $this->angle = (int)$angle; + } + + /** + * Get text angle + * + * @return int + */ + function getAngle() { + return $this->angle; + } + + /** + * Change text color + * + * @param Color + */ + function setColor($color) { + $this->color = $color; + } + + /** + * Get text color + * + * @return Color + */ + function getColor() { + return $this->color; + } + + /** + * Change text background color + * + * @param $color + */ + function setBackgroundColor($color) { + $this->background = $color; + } + + /** + * Change text background gradient + * + * @param $gradient + */ + function setBackgroundGradient($gradient) { + $this->background = $gradient; + } + + /** + * Get text background + * + * @return Color, Gradient + */ + function getBackground() { + return $this->background; + } + + /** + * Change padding + * + * @param int $left Left padding + * @param int $right Right padding + * @param int $top Top padding + * @param int $bottom Bottom padding + */ + function setPadding($left, $right, $top, $bottom) { + $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); + } + + /** + * Get current padding + * + * @return array + */ + function getPadding() { + return $this->padding; + } + +} + +registerClass('Text'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Tick.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Tick.class.php new file mode 100644 index 0000000000000000000000000000000000000000..5047ac6f7a221e172ba8390ebc8638612ea98841 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Tick.class.php @@ -0,0 +1,349 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* <php4> */ + +define("TICK_IN", 0); +define("TICK_OUT", 1); +define("TICK_IN_OUT", 2); + +/* </php4> */ + +/** + * Handle ticks + * + * @package Artichow + */ +class awTick { + + /** + * Ticks style + * + * @var int + */ + var $style = TICK_IN; + + /** + * Ticks size + * + * @var int + */ + var $size; + + /** + * Ticks color + * + * @var Color + */ + var $color; + + /** + * Ticks number + * + * @var int + */ + var $number; + + /** + * Ticks number by other tick + * + * @var array + */ + var $numberByTick; + + /** + * Ticks interval + * + * @var int + */ + var $interval = 1; + + /** + * Hide ticks + * + * @var bool + */ + var $hide = FALSE; + + /** + * Hide first tick + * + * @var bool + */ + var $hideFirst = FALSE; + + /** + * Hide last tick + * + * @var bool + */ + var $hideLast = FALSE; + + /** + * In mode + * + * @param int + */ + + + /** + * Out mode + * + * @param int + */ + + + /** + * In and out mode + * + * @param int + */ + + + /** + * Build the ticks + * + * @param int $number Number of ticks + * @param int $size Ticks size + */ + function awTick($number, $size) { + + $this->setSize($size); + $this->setNumber($number); + $this->setColor(new awBlack); + $this->style = TICK_IN; + + } + + /** + * Change ticks style + * + * @param int $style + */ + function setStyle($style) { + $this->style = (int)$style; + } + + /** + * Get ticks style + * + * @return int + */ + function getStyle() { + return $this->style; + } + + /** + * Change ticks color + * + * @param $color + */ + function setColor($color) { + $this->color = $color; + } + + /** + * Change ticks size + * + * @param int $size + */ + function setSize($size) { + $this->size = (int)$size; + } + + /** + * Change interval of ticks + * + * @param int $interval + */ + function setInterval($interval) { + $this->interval = (int)$interval; + } + + /** + * Get interval between each tick + * + * @return int + */ + function getInterval() { + return $this->interval; + } + + /** + * Change number of ticks + * + * @param int $number + */ + function setNumber($number) { + $this->number = (int)$number; + } + + /** + * Get number of ticks + * + * @return int + */ + function getNumber() { + return $this->number; + } + + /** + * Change number of ticks relative to others ticks + * + * @param &$tick Ticks reference + * @param int $number Number of ticks + */ + function setNumberByTick(&$tick, $number) { + + $this->numberByTick = array(&$tick, (int)$number); + + } + + /** + * Hide ticks + * + * @param bool $hide + */ + function hide($hide) { + $this->hide = (bool)$hide; + } + + /** + * Hide first tick + * + * @param bool $hide + */ + function hideFirst($hide) { + $this->hideFirst = (bool)$hide; + } + + /** + * Hide last tick + * + * @param bool $hide + */ + function hideLast($hide) { + $this->hideLast = (bool)$hide; + } + + /** + * Draw ticks on a vector + * + * @param $drawer A drawer + * @param &$vector A vector + */ + function draw($drawer, &$vector) { + + if($this->numberByTick !== NULL) { + list($tick, $number) = $this->numberByTick; + $this->number = 1 + ($tick->getNumber() - 1) * ($number + 1); + $this->interval = $tick->getInterval(); + } + + if($this->number < 2 or $this->hide) { + return; + } + + $angle = $vector->getAngle(); + // echo "INIT:".$angle."<br/>"; + switch($this->style) { + + case TICK_IN : + $this->drawTicks($drawer, $vector, NULL, $angle + M_PI / 2); + break; + + case TICK_OUT : + $this->drawTicks($drawer, $vector, $angle + 3 * M_PI / 2, NULL); + break; + + default : + $this->drawTicks($drawer, $vector, $angle + M_PI / 2, $angle + 3 * M_PI / 2); + break; + + } + + } + + function drawTicks($drawer, &$vector, $from, $to) { + + // Draw last tick + if($this->hideLast === FALSE) { + + //echo '<b>'; + if(($this->number - 1) % $this->interval === 0) { + $this->drawTick($drawer, $vector->p2, $from, $to); + } + //echo '</b>'; + + } + + $number = $this->number - 1; + $size = $vector->getSize(); + + // Get tick increment in pixels + $inc = $size / $number; + + // Check if we must hide the first tick + $start = $this->hideFirst ? $inc : 0; + $stop = $inc * $number; + + $position = 0; + + for($i = $start; round($i, 6) < $stop; $i += $inc) { + + if($position % $this->interval === 0) { + $p = $vector->p1->move( + round($i * cos($vector->getAngle()), 6), + round($i * sin($vector->getAngle() * -1), 6) + ); + $this->drawTick($drawer, $p, $from, $to); + } + + $position++; + + } + //echo '<br/><br/>'; + } + + function drawTick($drawer, $p, $from, $to) { +// echo $this->size.':'.$angle.'|<b>'.cos($angle).'</b>/'; + // The round avoid some errors in the calcul + // For example, 12.00000008575245 becomes 12 + $p1 = $p; + $p2 = $p; + + if($from !== NULL) { + $p1 = $p1->move( + round($this->size * cos($from), 6), + round($this->size * sin($from) * -1, 6) + ); + } + + if($to !== NULL) { + $p2 = $p2->move( + round($this->size * cos($to), 6), + round($this->size * sin($to) * -1, 6) + ); + } + //echo $p1->x.':'.$p2->x.'('.$p1->y.':'.$p2->y.')'.'/'; + $vector = new awVector( + $p1, $p2 + ); + + $drawer->line( + $this->color, + $vector + ); + + } + +} + +registerClass('Tick'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Tools.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Tools.class.php new file mode 100644 index 0000000000000000000000000000000000000000..5f8162b54cc9eab3c4eaa1b89749e2ffed243555 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php4/inc/Tools.class.php @@ -0,0 +1,121 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Objects capable of being positioned + * + * @package Artichow + */ + + +registerInterface('Positionable'); + +/** + * Manage left, right, top and bottom sides + * + * @package Artichow + */ +class awSide { + + /** + * Left side + * + * @var int + */ + var $left = 0; + + /** + * Right side + * + * @var int + */ + var $right = 0; + + /** + * Top side + * + * @var int + */ + var $top = 0; + + /** + * Bottom side + * + * @var int + */ + var $bottom = 0; + + /** + * Build the side + * + * @param mixed $left + * @param mixed $right + * @param mixed $top + * @param mixed $bottom + */ + function awSide($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { + $this->set($left, $right, $top, $bottom); + } + + + /** + * Change side values + * + * @param mixed $left + * @param mixed $right + * @param mixed $top + * @param mixed $bottom + */ + function set($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { + + if($left !== NULL) { + $this->left = (float)$left; + } + if($right !== NULL) { + $this->right = (float)$right; + } + if($top !== NULL) { + $this->top = (float)$top; + } + if($bottom !== NULL) { + $this->bottom = (float)$bottom; + } + + } + + + /** + * Add values to each side + * + * @param mixed $left + * @param mixed $right + * @param mixed $top + * @param mixed $bottom + */ + function add($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { + + if($left !== NULL) { + $this->left += (float)$left; + } + if($right !== NULL) { + $this->right += (float)$right; + } + if($top !== NULL) { + $this->top += (float)$top; + } + if($bottom !== NULL) { + $this->bottom += (float)$bottom; + } + + } + +} + +registerClass('Side'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/AntiSpam.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/AntiSpam.class.php new file mode 100644 index 0000000000000000000000000000000000000000..f29b5bc49a0b17712cea6038382697b8eae0df92 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/AntiSpam.class.php @@ -0,0 +1,218 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Graph.class.php"; + +/** + * AntiSpam + * String printed on the images are case insensitive. + * + * @package Artichow + */ +class awAntiSpam extends awImage { + + /** + * Anti-spam string + * + * @var string + */ + protected $string; + + /** + * Noise intensity + * + * @var int + */ + protected $noise = 0; + + /** + * Construct a new awAntiSpam image + * + * @param string $string A string to display + */ + public function __construct($string = '') { + + parent::__construct(); + + $this->string = (string)$string; + + } + + /** + * Create a random string + * + * @param int $length String length + * @return string String created + */ + public function setRand($length) { + + $length = (int)$length; + + $this->string = ''; + + $letters = 'aAbBCDeEFgGhHJKLmMnNpPqQRsStTuVwWXYZz2345679'; + $number = strlen($letters); + + for($i = 0; $i < $length; $i++) { + $this->string .= $letters{mt_rand(0, $number - 1)}; + } + + return $this->string; + + } + + /** + * Set noise on image + * + * @param int $nois Noise intensity (from 0 to 10) + */ + public function setNoise($noise) { + if($noise < 0) { + $noise = 0; + } + if($noise > 10) { + $noise = 10; + } + $this->noise = (int)$noise; + } + + /** + * Save string value in session + * You can use check() to verify the value later + * + * @param string $qName A name that identify the anti-spam image + */ + public function save($qName) { + $this->session(); + $session = 'artichow_'.(string)$qName; + $_SESSION[$session] = $this->string; + } + + /** + * Verify user entry + * + * @param string $qName A name that identify the anti-spam image + * @param string $value User-defined value + * @param bool $case TRUE for case insensitive check, FALSE for case sensitive check ? (default to TRUE) + * @return bool TRUE if the value is correct, FALSE otherwise + */ + public function check($qName, $value, $case = TRUE) { + + $this->session(); + + $session = 'artichow_'.(string)$qName; + + return ( + array_key_exists($session, $_SESSION) === TRUE and + $case ? + (strtolower($_SESSION[$session]) === strtolower((string)$value)) : + ($_SESSION[$session] === (string)$value) + ); + + } + + /** + * Draw image + */ + public function draw() { + + $fonts = array( + ARTICHOW_FONT.DIRECTORY_SEPARATOR.'Tuffy.ttf', + ARTICHOW_FONT.DIRECTORY_SEPARATOR.'TuffyBold.ttf', + ARTICHOW_FONT.DIRECTORY_SEPARATOR.'TuffyItalic.ttf', + ARTICHOW_FONT.DIRECTORY_SEPARATOR.'TuffyBoldItalic.ttf' + ); + + $sizes = array(12, 12.5, 13, 13.5, 14, 15, 16, 17, 18, 19); + + $widths = array(); + $heights = array(); + $texts = array(); + + for($i = 0; $i < strlen($this->string); $i++) { + + $fontKey = array_rand($fonts); + $sizeKey = array_rand($sizes); + + $font = new awTTFFont( + $fonts[$fontKey], $sizes[$sizeKey] + ); + + $text = new awText( + $this->string{$i}, + $font, + NULL, + mt_rand(-15, 15) + ); + + $widths[] = $font->getTextWidth($text); + $heights[] = $font->getTextHeight($text); + $texts[] = $text; + + } + + $width = array_sum($widths); + $height = array_max($heights); + + $totalWidth = $width + 10 + count($texts) * 10; + $totalHeight = $height + 20; + + $this->setSize($totalWidth, $totalHeight); + + $this->create(); + + for($i = 0; $i < strlen($this->string); $i++) { + + $this->drawer->string( + $texts[$i], + new awPoint( + 5 + array_sum(array_slice($widths, 0, $i)) + $widths[$i] / 2 + $i * 10, + 10 + ($height - $heights[$i]) / 2 + ) + ); + + } + + $this->drawNoise($totalWidth, $totalHeight); + + $this->send(); + + } + + protected function drawNoise($width, $height) { + + $points = $this->noise * 30; + $color = new awColor(0, 0, 0); + + for($i = 0; $i < $points; $i++) { + $this->drawer->point( + $color, + new awPoint( + mt_rand(0, $width), + mt_rand(0, $height) + ) + ); + } + + } + + protected function session() { + + // Start session if needed + if(!session_id()) { + session_name('PeopleBox'); +session_start(); + } + + } + +} + +registerClass('AntiSpam'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/Artichow.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/Artichow.class.php new file mode 100644 index 0000000000000000000000000000000000000000..3d8bc9ea97ee4fef76db3cce194a35d815ead34a --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/Artichow.class.php @@ -0,0 +1,326 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +// Artichow configuration +/* <php5> */ +if(is_file(dirname(__FILE__)."/Artichow.cfg.php")) { // For PHP 4+5 version + require_once dirname(__FILE__)."/Artichow.cfg.php"; +} +/* </php5> */ + +// Some useful files +require_once ARTICHOW."/Component.class.php"; +require_once ARTICHOW."/Image.class.php"; +require_once ARTICHOW."/common.php"; + +require_once ARTICHOW."/inc/Grid.class.php"; +require_once ARTICHOW."/inc/Tools.class.php"; +require_once ARTICHOW."/inc/Drawer.class.php"; +require_once ARTICHOW."/inc/Math.class.php"; +require_once ARTICHOW."/inc/Tick.class.php"; +require_once ARTICHOW."/inc/Axis.class.php"; +require_once ARTICHOW."/inc/Legend.class.php"; +require_once ARTICHOW."/inc/Mark.class.php"; +require_once ARTICHOW."/inc/Label.class.php"; +require_once ARTICHOW."/inc/Text.class.php"; +require_once ARTICHOW."/inc/Color.class.php"; +require_once ARTICHOW."/inc/Font.class.php"; +require_once ARTICHOW."/inc/Gradient.class.php"; + +// Catch all errors +ob_start(); + +/** + * A graph + * + * @package Artichow + */ +class awGraph extends awImage { + + /** + * Graph name + * + * @var string + */ + protected $name; + + /** + * Cache timeout + * + * @var int + */ + protected $timeout = 0; + + /** + * Graph timing ? + * + * @var bool + */ + protected $timing; + + /** + * Components + * + * @var array + */ + private $components = array(); + + /** + * Graph title + * + * @var Label + */ + public $title; + + /** + * Construct a new awgraph + * + * @param int $width Graph width + * @param int $height Graph height + * @param string $name Graph name for the cache (must be unique). Let it null to not use the cache. + * @param int $timeout Cache timeout (unix timestamp) + */ + public function __construct($width = NULL, $height = NULL, $name = NULL, $timeout = 0) { + + parent::__construct(); + + $this->setSize($width, $height); + + if(ARTICHOW_CACHE) { + + $this->name = $name; + $this->timeout = $timeout; + + // Clean sometimes all the cache + if(mt_rand(0, 5000) === 0) { + awGraph::cleanCache(); + } + + if($this->name !== NULL) { + + $file = ARTICHOW."/cache/".$this->name."-time"; + + if(is_file($file)) { + + $type = awGraph::cleanGraphCache($file); + + if($type === NULL) { + awGraph::deleteFromCache($this->name); + } else { + header("Content-Type: image/".$type); + readfile(ARTICHOW."/cache/".$this->name.""); + exit; + } + + } + + } + + } + + + $this->title = new awLabel( + NULL, + new awTuffy(16), + NULL, + 0 + ); + $this->title->setAlign(awLabel::CENTER, awLabel::BOTTOM); + + } + + /** + * Delete a graph from the cache + * + * @param string $name Graph name + * @return bool TRUE on success, FALSE on failure + */ + public static function deleteFromCache($name) { + + if(ARTICHOW_CACHE) { + + if(is_file(ARTICHOW."/cache/".$name."-time")) { + unlink(ARTICHOW."/cache/".$name.""); + unlink(ARTICHOW."/cache/".$name."-time"); + } + + } + + } + + /** + * Delete all graphs from the cache + */ + public static function deleteAllCache() { + + if(ARTICHOW_CACHE) { + + $dp = opendir(ARTICHOW."/cache"); + + while($file = readdir($dp)) { + if($file !== '.' and $file != '..') { + unlink(ARTICHOW."/cache/".$file); + } + } + + } + + } + + /** + * Clean cache + */ + public static function cleanCache() { + + if(ARTICHOW_CACHE) { + + $glob = glob(ARTICHOW."/cache/*-time"); + + foreach($glob as $file) { + + $type = awGraph::cleanGraphCache($file); + + if($type === NULL) { + $name = preg_replace("/.*/(.*)\-time/", "\\1", $file); + awGraph::deleteFromCache($name); + } + + } + + } + + } + + /** + * Enable/Disable graph timing + * + * @param bool $timing + */ + public function setTiming($timing) { + $this->timing = (bool)$timing; + } + + /** + * Add a component to the graph + * + * @param awComponent $component + */ + public function add(awComponent $component) { + + $this->components[] = $component; + + } + + /** + * Build the graph and draw component on it + * Image is sent to the user browser + */ + public function draw() { + + if($this->timing) { + $time = microtimeFloat(); + } + + $this->create(); + + foreach($this->components as $component) { + + $this->drawComponent($component); + + } + + $this->drawTitle(); + $this->drawShadow(); + + if($this->timing) { + $this->drawTiming(microtimeFloat() - $time); + } + + $this->send(); + + if(ARTICHOW_CACHE) { + + if($this->name !== NULL) { + + $data = ob_get_contents(); + + if(is_writable(ARTICHOW."/cache") === FALSE) { + trigger_error("Cache directory is not writable"); + } + + $file = ARTICHOW."/cache/".$this->name.""; + file_put_contents($file, $data); + + $file .= "-time"; + file_put_contents($file, $this->timeout."\n".$this->getFormat()); + + } + + } + + } + + private function drawTitle() { + + $drawer = $this->getDrawer(); + + $point = new awPoint( + $this->width / 2, + 10 + ); + + $this->title->draw($drawer, $point); + + } + + private function drawTiming($time) { + + $drawer = $this->getDrawer(); + + $label = new awLabel; + $label->set("(".sprintf("%.3f", $time)." s)"); + $label->setAlign(awLabel::LEFT, awLabel::TOP); + $label->border->show(); + $label->setPadding(1, 0, 0, 0); + $label->setBackgroundColor(new awColor(230, 230, 230, 25)); + + $label->draw($drawer, new awPoint(5, $drawer->height - 5)); + + } + + private static function cleanGraphCache($file) { + + list( + $time, + $type + ) = explode("\n", file_get_contents($file)); + + $time = (int)$time; + + if($time !== 0 and $time < time()) { + return NULL; + } else { + return $type; + } + + + } + +} + +registerClass('Graph'); + +/* + * To preserve PHP 4 compatibility + */ +function microtimeFloat() { + list($usec, $sec) = explode(" ", microtime()); + return (float)$usec + (float)$sec; +} +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/BarPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/BarPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..2d898fbd4d648d2026630aecb63300839b3b6e50 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/BarPlot.class.php @@ -0,0 +1,364 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Plot.class.php"; + +/** + * BarPlot + * + * @package Artichow + */ +class awBarPlot extends awPlot implements awLegendable { + + /** + * Labels on your bar plot + * + * @var Label + */ + public $label; + + /** + * Bar plot identifier + * + * @var int + */ + protected $identifier; + + /** + * Bar plot number + * + * @var int + */ + protected $number; + + /** + * Bar plot depth + * + * @var int + */ + protected $depth; + + /** + * For moving bars + * + * @var int + */ + protected $move; + + /** + * Bars shadow + * + * @var Shadow + */ + public $barShadow; + + /** + * Bars border + * + * @var Border + */ + public $barBorder; + + /** + * Bars padding + * + * @var Side + */ + protected $barPadding; + + /** + * Bars space + * + * @var int + */ + protected $barSpace = 0; + + /** + * Bars background + * + * @var Color, Gradient + */ + protected $barBackground; + + /** + * Construct a new awBarPlot + * + * @param array $values Some numeric values for Y axis + * @param int $identifier Plot identifier + * @param int $number Bar plot number + * @param int $depth Bar plot depth in pixels + */ + public function __construct($values, $identifier = 1, $number = 1, $depth = 0) { + + parent::__construct(); + + $this->label = new awLabel; + + $this->barPadding = new awSide(0.08, 0.08, 0, 0); + $this->barShadow = new awShadow(awShadow::RIGHT_TOP); + $this->barBorder = new awBorder; + + $this->setValues($values); + + $this->identifier = (int)$identifier; + $this->number = (int)$number; + $this->depth = (int)$depth; + + $this->move = new awSide; + + // Hide vertical grid + $this->grid->hideVertical(TRUE); + + } + + /** + * Change bars padding + * This method is not compatible with awBarPlot::setBarPadding() + * + * @param float $left Left padding (between 0 and 1) + * @param float $right Right padding (between 0 and 1) + */ + public function setBarPadding($left = NULL, $right = NULL) { + $this->barPadding->set($left, $right); + } + + /** + * Change bars size + * This method is not compatible with awBarPlot::setBarPadding() + * + * @param int $width Bars size (between 0 and 1) + */ + public function setBarSize($size) { + $padding = (1 - $size) / 2; + $this->barPadding->set($padding, $padding); + } + + /** + * Move bars + * + * @param int $x + * @param int $y + */ + public function move($x, $y) { + $this->move->set($x, NULL, $y, NULL); + } + + /** + * Change bars space + * + * @param int $space Space in pixels + */ + public function setBarSpace($space) { + $this->barSpace = (int)$space; + } + + /** + * Change line background color + * + * @param awColor $color + */ + public function setBarColor(awColor $color) { + $this->barBackground = $color; + } + + /** + * Change line background gradient + * + * @param awGradient $gradient + */ + public function setBarGradient(awGradient $gradient) { + $this->barBackground = $gradient; + } + + /** + * Get the line thickness + * + * @return int + */ + public function getLegendLineThickness() { + } + + /** + * Get the line type + * + * @return int + */ + public function getLegendLineStyle() { + } + + /** + * Get the color of line + * + * @return Color + */ + public function getLegendLineColor() { + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + public function getLegendBackground() { + return $this->barBackground; + } + + /** + * Get a mark object + * + * @return Mark + */ + public function getLegendMark() { + } + + public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $count = count($this->datay); + $max = $this->getRealYMax(NULL); + $min = $this->getRealYMin(NULL); + + // Find zero for bars + if($this->xAxisZero and $min <= 0 and $max >= 0) { + $zero = 0; + } else if($max < 0) { + $zero = $max; + } else { + $zero = $min; + } + + // Get base position + $zero = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint(0, $zero)); + + // Distance between two values on the graph + $distance = $this->xAxis->getDistance(0, 1); + + // Compute paddings + $leftPadding = $this->barPadding->left * $distance; + $rightPadding = $this->barPadding->right * $distance; + + $padding = $leftPadding + $rightPadding; + $space = $this->barSpace * ($this->number - 1); + + $barSize = ($distance - $padding - $space) / $this->number; + $barPosition = $leftPadding + $barSize * ($this->identifier - 1); + + for($key = 0; $key < $count; $key++) { + + $value = $this->datay[$key]; + + if($value !== NULL) { + + $position = awAxis::toPosition( + $this->xAxis, + $this->yAxis, + new awPoint($key, $value) + ); + + $barStart = $barPosition + ($this->identifier - 1) * $this->barSpace + $position->x; + $barStop = $barStart + $barSize; + + $t1 = min($zero->y, $position->y); + $t2 = max($zero->y, $position->y); + + if(round($t2 - $t1) == 0) { + continue; + } + + $p1 = new awPoint( + round($barStart) + $this->depth + $this->move->left, + round($t1) - $this->depth + $this->move->top + ); + + $p2 = new awPoint( + round($barStop) + $this->depth + $this->move->left, + round($t2) - $this->depth + $this->move->top + ); + + $this->drawBar($drawer, $p1, $p2); + + } + + } + + // Draw labels + foreach($this->datay as $key => $value) { + + if($value !== NULL) { + + $position = awAxis::toPosition( + $this->xAxis, + $this->yAxis, + new awPoint($key, $value) + ); + + $point = new awPoint( + $barPosition + ($this->identifier - 1) * $this->barSpace + $position->x + $barSize / 2 + 1 + $this->depth, + $position->y - $this->depth + ); + + $this->label->draw($drawer, $point, $key); + + } + + } + + } + + public function getXAxisNumber() { + return count($this->datay) + 1; + } + // ça bidouille à fond ici ! + public function getXMax() { + return array_max($this->datax) + 1; + } + + public function getXCenter() { + return TRUE; + } + + protected function drawBar(awDrawer $drawer, awPoint $p1, awPoint $p2) { + + // Draw shadow + $this->barShadow->draw( + $drawer, + $p1, + $p2, + awShadow::OUT + ); + + if(abs($p2->y - $p1->y) > 1) { + + $this->barBorder->rectangle( + $drawer, + $p1, + $p2 + ); + + if($this->barBackground !== NULL) { + + $size = $this->barBorder->visible() ? 1 : 0; + + $b1 = $p1->move($size, $size); + $b2 = $p2->move(-1 * $size, -1 * $size); + + // Draw background + $drawer->filledRectangle( + $this->barBackground, + new awLine($b1, $b2) + ); + + } + + } + } + +} + +registerClass('BarPlot'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/Component.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/Component.class.php new file mode 100644 index 0000000000000000000000000000000000000000..9e1a126524605a6def08a0a145e0fe968d2b3bb8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/Component.class.php @@ -0,0 +1,415 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Graph.class.php"; + + +/** + * A graph can contain some groups of components + * + * @package Artichow + */ +abstract class awComponentGroup extends awComponent { + + /** + * Components of this group + * + * @var array + */ + protected $components; + + /** + * Build the component group + */ + public function __construct() { + parent::__construct(); + $this->components = array(); + } + + /** + * Add a component to the group + * + * @param awComponent $component A component + */ + public function add(awComponent $component) { + $this->components[] = $component; + } + +} + +registerClass('ComponentGroup', TRUE); + +abstract class awComponent { + + /** + * Component drawer + * + * @var Drawer + */ + protected $drawer; + + /** + * Component width + * + * @var float + */ + public $width = 1.0; + + /** + * Component height + * + * @var float + */ + public $height = 1.0; + + /** + * Position X of the center the graph (from 0 to 1) + * + * @var float + */ + public $x = 0.5; + + /** + * Position Y of the center the graph (from 0 to 1) + * + * @var float + */ + public $y = 0.5; + + /** + * Component absolute width (in pixels) + * + * + * @var int + */ + public $w; + + /** + * Component absolute height (in pixels) + * + * + * @var int + */ + public $h; + + /** + * Left-top corner Y position + * + * @var float + */ + public $top; + + /** + * Left-top corner X position + * + * @var float + */ + public $left; + + /** + * Component background color + * + * @var Color + */ + protected $background; + + /** + * Component padding + * + * @var Side + */ + protected $padding; + + /** + * Component space + * + * @var Side + */ + protected $space; + + /** + * Component title + * + * @var Label + */ + public $title; + + /** + * Adjust automatically the component ? + * + * @var bool + */ + protected $auto = TRUE; + + /** + * Legend + * + * @var Legend + */ + public $legend; + + /** + * Build the component + */ + public function __construct() { + + // Component legend + $this->legend = new awLegend(); + + $this->padding = new awSide(25, 25, 25, 25); + $this->space = new awSide(0, 0, 0, 0); + + // Component title + $this->title = new awLabel( + NULL, + new awTuffy(10), + NULL, + 0 + ); + $this->title->setAlign(awLabel::CENTER, awLabel::TOP); + + } + + /** + * Adjust automatically the component ? + * + * @param bool $auto + */ + public function auto($auto) { + $this->auto = (bool)$auto; + } + + /** + * Change the size of the component + * + * @param int $width Component width (from 0 to 1) + * @param int $height Component height (from 0 to 1) + */ + public function setSize($width, $height) { + + $this->width = (float)$width; + $this->height = (float)$height; + + } + + /** + * Change the absolute size of the component + * + * @param int $w Component width (in pixels) + * @param int $h Component height (in pixels) + */ + public function setAbsSize($w, $h) { + + $this->w = (int)$w; + $this->h = (int)$h; + + } + + /** + * Change component background color + * + * @param awColor $color (can be null) + */ + public function setBackgroundColor($color) { + if($color === NULL or $color instanceof awColor) { + $this->background = $color; + } + } + + /** + * Change component background gradient + * + * @param awGradient $gradient (can be null) + */ + public function setBackgroundGradient($gradient) { + if($gradient === NULL or $gradient instanceof awGradient) { + $this->background = $gradient; + } + } + + /** + * Change component background image + * + * @param awImage $image (can be null) + */ + public function setBackgroundImage($image) { + if($image === NULL or $image instanceof awImage) { + $this->background = $image; + } + } + + /** + * Return the component background + * + * @return Color, Gradient + */ + public function getBackground() { + return $this->background; + } + + /** + * Change component padding + * + * @param int $left Padding in pixels (NULL to keep old value) + * @param int $right Padding in pixels (NULL to keep old value) + * @param int $top Padding in pixels (NULL to keep old value) + * @param int $bottom Padding in pixels (NULL to keep old value) + */ + public function setPadding($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { + $this->padding->set($left, $right, $top, $bottom); + } + + /** + * Change component space + * + * @param float $left Space in % (NULL to keep old value) + * @param float $right Space in % (NULL to keep old value) + * @param float $bottom Space in % (NULL to keep old value) + * @param float $top Space in % (NULL to keep old value) + */ + public function setSpace($left = NULL, $right = NULL, $bottom = NULL, $top = NULL) { + $this->space->set($left, $right, $bottom, $top); + } + + /** + * Change the absolute position of the component on the graph + * + * @var int $x Left-top corner X position + * @var int $y Left-top corner Y position + */ + public function setAbsPosition($left, $top) { + + $this->left = (int)$left; + $this->top = (int)$top; + + } + + /** + * Set the center of the component + * + * @param int $x Position on X axis of the center of the component + * @param int $y Position on Y axis of the center of the component + */ + public function setCenter($x, $y) { + + $this->x = (float)$x; + $this->y = (float)$y; + + } + + /** + * Get component coords with its padding + * + * @return array Coords of the component + */ + public function getPosition() { + + // Get component coords + $x1 = $this->padding->left; + $y1 = $this->padding->top; + $x2 = $this->w - $this->padding->right; + $y2 = $this->h - $this->padding->bottom; + + return array($x1, $y1, $x2, $y2); + + } + + /** + * Init the drawing of the component + */ + public function init(awDrawer $drawer) { + + // Set component background + $background = $this->getBackground(); + + if($background !== NULL) { + + $p1 = new awPoint(0, 0); + $p2 = new awPoint($this->w - 1, $this->h - 1); + + if($background instanceof awImage) { + + $drawer->copyImage( + $background, + $p1, + $p2 + ); + + } else { + + $drawer->filledRectangle( + $background, + new awLine($p1, $p2) + ); + + } + + } + } + + /** + * Finalize the drawing of the component + */ + public function finalize(awDrawer $drawer) { + + // Draw component title + $point = new awPoint( + $this->w / 2, + $this->padding->top - 8 + ); + $this->title->draw($drawer, $point); + + // Draw legend + $this->legend->draw($drawer); + + } + + /** + * Draw the grid around your component + * + * @param Drawer A drawer + * @return array Coords for the component + */ + abstract public function drawEnvelope(awDrawer $drawer); + + /** + * Draw the component on the graph + * Component should be drawed into specified coords + * + * @param Drawer A drawer + * @param int $x1 + * @param int $y1 + * @param int $x2 + * @param int $y2 + * @param bool $aliasing Use anti-aliasing to draw the component ? + */ + abstract public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing); + + /** + * Get space width in pixels + * + * @param int $width Component width + * @param int $height Component height + * @return array + */ + protected function getSpace($width, $height) { + + $left = (int)($width * $this->space->left / 100); + $right = (int)($width * $this->space->right / 100); + $top = (int)($height * $this->space->top / 100); + $bottom = (int)($height * $this->space->bottom / 100); + + return array($left, $right, $top, $bottom); + + } + +} + +registerClass('Component', TRUE); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/Graph.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/Graph.class.php new file mode 100644 index 0000000000000000000000000000000000000000..07f757c3e38b026bbe3e5f6ca405c58f0ad69da1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/Graph.class.php @@ -0,0 +1,378 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +// Artichow configuration +/* <php5> */ +if(is_file(dirname(__FILE__)."/Artichow.cfg.php")) { // For PHP 4+5 version + require_once dirname(__FILE__)."/Artichow.cfg.php"; +} +/* </php5> */ + +// Some useful files +require_once ARTICHOW."/common.php"; +require_once ARTICHOW."/Component.class.php"; +require_once ARTICHOW."/Image.class.php"; + +require_once ARTICHOW."/inc/Grid.class.php"; +require_once ARTICHOW."/inc/Tools.class.php"; +require_once ARTICHOW."/inc/Drawer.class.php"; +require_once ARTICHOW."/inc/Math.class.php"; +require_once ARTICHOW."/inc/Tick.class.php"; +require_once ARTICHOW."/inc/Axis.class.php"; +require_once ARTICHOW."/inc/Legend.class.php"; +require_once ARTICHOW."/inc/Mark.class.php"; +require_once ARTICHOW."/inc/Label.class.php"; +require_once ARTICHOW."/inc/Text.class.php"; +require_once ARTICHOW."/inc/Color.class.php"; +require_once ARTICHOW."/inc/Font.class.php"; +require_once ARTICHOW."/inc/Gradient.class.php"; + +// Catch all errors +ob_start(); + +/** + * A graph + * + * @package Artichow + */ +class awGraph extends awImage { + + /** + * Graph name + * + * @var string + */ + protected $name; + + /** + * Cache timeout + * + * @var int + */ + protected $timeout = 0; + + /** + * Graph timing ? + * + * @var bool + */ + protected $timing; + + /** + * Components + * + * @var array + */ + private $components = array(); + + /** + * Some labels to add to the component + * + * @var array + */ + protected $labels = array(); + + /** + * Graph title + * + * @var Label + */ + public $title; + + /** + * Construct a new graph + * + * @param int $width Graph width + * @param int $height Graph height + * @param string $name Graph name for the cache (must be unique). Let it null to not use the cache. + * @param int $timeout Cache timeout (unix timestamp) + */ + public function __construct($width = NULL, $height = NULL, $name = NULL, $timeout = 0) { + + parent::__construct(); + + $this->setSize($width, $height); + + $this->name = $name; + $this->timeout = $timeout; + + // Clean sometimes all the cache + if(mt_rand(0, 5000) === 0) { + awGraph::cleanCache(); + } + + if($this->name !== NULL) { + + $file = ARTICHOW."/cache/".$this->name."-time"; + + if(is_file($file)) { + + $type = awGraph::cleanGraphCache($file); + + if($type === NULL) { + awGraph::deleteFromCache($this->name); + } else { + header("Content-Type: image/".$type); + readfile(ARTICHOW."/cache/".$this->name.""); + exit; + } + + } + + } + + + $this->title = new awLabel( + NULL, + new awTuffy(16), + NULL, + 0 + ); + $this->title->setAlign(awLabel::CENTER, awLabel::BOTTOM); + + } + + /** + * Delete a graph from the cache + * + * @param string $name Graph name + * @return bool TRUE on success, FALSE on failure + */ + public static function deleteFromCache($name) { + + if(is_file(ARTICHOW."/cache/".$name."-time")) { + unlink(ARTICHOW."/cache/".$name.""); + unlink(ARTICHOW."/cache/".$name."-time"); + } + + } + + /** + * Delete all graphs from the cache + */ + public static function deleteAllCache() { + + $dp = opendir(ARTICHOW."/cache"); + + while($file = readdir($dp)) { + if($file !== '.' and $file != '..') { + unlink(ARTICHOW."/cache/".$file); + } + } + + } + + /** + * Clean cache + */ + public static function cleanCache() { + + $glob = glob(ARTICHOW."/cache/*-time"); + + foreach($glob as $file) { + + $type = awGraph::cleanGraphCache($file); + + if($type === NULL) { + $name = preg_replace("/.*/(.*)\-time/", "\\1", $file); + awGraph::deleteFromCache($name); + } + + } + + } + + /** + * Enable/Disable Graph timing + * + * @param bool $timing + */ + public function setTiming($timing) { + $this->timing = (bool)$timing; + } + + /** + * Add a component to the graph + * + * @param awComponent $component + */ + public function add(awComponent $component) { + + $this->components[] = $component; + + } + + /** + * Add a label to the component + * + * @param awLabel $label + * @param int $x Position on X axis of the center of the text + * @param int $y Position on Y axis of the center of the text + */ + public function addLabel(awLabel $label, $x, $y) { + + $this->labels[] = array( + $label, $x, $y + ); + + } + + /** + * Add a label to the component with aboslute position + * + * @param awLabel $label + * @param awPoint $point Text position + */ + public function addAbsLabel(awLabel $label, awPoint $point) { + + $this->labels[] = array( + $label, $point + ); + + } + + /** + * Build the graph and draw component on it + * Image is sent to the user browser + * + * @param string $file Save the image in the specified file. Let it null to print image to screen. + */ + public function draw($file = NULL) { + + if($this->timing) { + $time = microtimeFloat(); + } + + $this->create(); + + foreach($this->components as $component) { + + $this->drawComponent($component); + + } + + $this->drawTitle(); + $this->drawShadow(); + $this->drawLabels(); + + if($this->timing) { + $this->drawTiming(microtimeFloat() - $time); + } + + $this->send($file); + + if($file === NULL) { + + $data = ob_get_contents(); + + if($this->name !== NULL) { + + if(is_writable(ARTICHOW."/cache") === FALSE) { + trigger_error("Cache directory is not writable"); + } + + $file = ARTICHOW."/cache/".$this->name.""; + file_put_contents($file, $data); + + $file .= "-time"; + file_put_contents($file, $this->timeout."\n".$this->getFormat()); + + } + + } + + } + + private function drawLabels() { + + $drawer = $this->getDrawer(); + + foreach($this->labels as $array) { + + if(count($array) === 3) { + + // Text in relative position + list($label, $x, $y) = $array; + + $point = new awPoint( + $x * $this->width, + $y * $this->height + ); + + } else { + + // Text in absolute position + list($label, $point) = $array; + + } + + $label->draw($drawer, $point); + + } + + } + + private function drawTitle() { + + $drawer = $this->getDrawer(); + + $point = new awPoint( + $this->width / 2, + 10 + ); + + $this->title->draw($drawer, $point); + + } + + private function drawTiming($time) { + + $drawer = $this->getDrawer(); + + $label = new awLabel; + $label->set("(".sprintf("%.3f", $time)." s)"); + $label->setAlign(awLabel::LEFT, awLabel::TOP); + $label->border->show(); + $label->setPadding(1, 0, 0, 0); + $label->setBackgroundColor(new awColor(230, 230, 230, 25)); + + $label->draw($drawer, new awPoint(5, $drawer->height - 5)); + + } + + private static function cleanGraphCache($file) { + + list( + $time, + $type + ) = explode("\n", file_get_contents($file)); + + $time = (int)$time; + + if($time !== 0 and $time < time()) { + return NULL; + } else { + return $type; + } + + + } + +} + +registerClass('Graph'); + +/* + * To preserve PHP 4 compatibility + */ +function microtimeFloat() { + list($usec, $sec) = explode(" ", microtime()); + return (float)$usec + (float)$sec; +} +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/Image.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/Image.class.php new file mode 100644 index 0000000000000000000000000000000000000000..7d1a2fcdc07546d8e76bc5e281219714c3552e3f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/Image.class.php @@ -0,0 +1,425 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* <php4> */ + +define("IMAGE_JPEG", 1); +define("IMAGE_PNG", 2); +define("IMAGE_GIF", 3); + +/* </php4> */ + +/* + * Check for GD2 + */ +if(function_exists('imagecreatetruecolor') === FALSE) { + trigger_error("You must compile PHP with GD2 support to use Artichow", E_USER_ERROR); +} + +require_once ARTICHOW."/inc/Shadow.class.php"; +require_once ARTICHOW."/inc/Border.class.php"; + +/** + * An image for a graph + * + * @package Artichow + */ +class awImage { + + /** + * Graph width + * + * @var int + */ + public $width; + + /** + * Graph height + * + * @var int + */ + public $height; + + /** + * Use anti-aliasing ? + * + * @var bool + */ + protected $antiAliasing = FALSE; + + /** + * Image format + * + * @var int + */ + protected $format = awImage::PNG; + + /** + * Image background color + * + * @var Color + */ + protected $background; + + /** + * GD resource + * + * @var resource + */ + protected $resource; + + /** + * Image drawer + * + * @var Drawer + */ + protected $drawer; + + /** + * Shadow + * + * @var Shadow + */ + public $shadow; + + /** + * Image border + * + * @var Border + */ + public $border; + + /** + * Use JPEG for image + * + * @var int + */ + const JPEG = IMG_JPG; + + /** + * Use PNG for image + * + * @var int + */ + const PNG = IMG_PNG; + + /** + * Use GIF for image + * + * @var int + */ + const GIF = IMG_GIF; + + /** + * Build the image + */ + public function __construct() { + + $this->background = new awColor(255, 255, 255); + $this->shadow = new awShadow(awShadow::RIGHT_BOTTOM); + $this->border = new awBorder; + + } + + /** + * Get drawer of the image + * + * @param int $w Drawer width (from 0 to 1) (default to 1) + * @param int $h Drawer height (from 0 to 1) (default to 1) + * @param float $x Position on X axis of the center of the drawer (default to 0.5) + * @param float $y Position on Y axis of the center of the drawer (default to 0.5) + * @return Drawer + */ + public function getDrawer($w = 1, $h = 1, $x = 0.5, $y = 0.5) { + $this->create(); + $this->drawer->setSize($w, $h); + $this->drawer->setPosition($x, $y); + return $this->drawer; + } + + /** + * Change the image size + * + * @var int $width Image width + * @var int $height Image height + */ + public function setSize($width, $height) { + + if($width !== NULL) { + $this->width = (int)$width; + } + if($height !== NULL) { + $this->height = (int)$height; + } + + } + + /** + * Change image background color + * + * @param awColor $color + */ + public function setBackgroundColor(awColor $color) { + $this->background = $color; + } + + /** + * Change image background gradient + * + * @param awGradient $gradient + */ + public function setBackgroundGradient(awGradient $gradient) { + $this->background = $gradient; + } + + /** + * Can we use anti-aliasing ? + * + * @var bool $bool + */ + public function setAntiAliasing($bool) { + $this->antiAliasing = (bool)$bool; + } + + /** + * Change image format + * + * @var int $format New image format + */ + public function setFormat($format) { + if($format === awImage::JPEG or $format === awImage::PNG or $format === awImage::GIF) { + $this->format = $format; + } + } + + /** + * Create a new awimage + */ + public function create() { + + if($this->resource === NULL) { + + // Create image + + $this->resource = imagecreatetruecolor($this->width, $this->height); + if(!$this->resource) { + trigger_error("Unable to create a graph", E_USER_ERROR); + } + + imagealphablending($this->resource, TRUE); + + if($this->antiAliasing and function_exists('imageantialias')) { + imageantialias($this->resource, TRUE); + } + + $this->drawer = new awDrawer($this->resource); + $this->drawer->setImageSize($this->width, $this->height); + + // Original color + $this->drawer->filledRectangle( + new awWhite, + new awLine( + new awPoint(0, 0), + new awPoint($this->width, $this->height) + ) + ); + + $shadow = $this->shadow->getSpace(); + + $p1 = new awPoint($shadow->left, $shadow->top); + $p2 = new awPoint($this->width - $shadow->right - 1, $this->height - $shadow->bottom - 1); + + // Draw image background + $this->drawer->filledRectangle($this->background, new awLine($p1, $p2)); + $this->background->free(); + + // Draw image border + $this->border->rectangle($this->drawer, $p1, $p2); + + } + + } + + /** + * Draw a component on the image + * + * @var awComponent $component A component + */ + public function drawComponent(awComponent $component) { + + $shadow = $this->shadow->getSpace(); // Image shadow + $border = $this->border->visible() ? 1 : 0; // Image border size + + $drawer = clone $this->drawer; + $drawer->setImageSize( + $this->width - $shadow->left - $shadow->right - $border * 2, + $this->height - $shadow->top - $shadow->bottom - $border * 2 + ); + + // No absolute size specified + if($component->w === NULL and $component->h === NULL) { + + list($width, $height) = $drawer->setSize($component->width, $component->height); + + // Set component size in pixels + $component->setAbsSize($width, $height); + + } else { + + $drawer->setAbsSize($component->w, $component->h); + + } + + if($component->top !== NULL and $component->left !== NULL) { + $drawer->setAbsPosition( + $border + $shadow->left + $component->left, + $border + $shadow->top + $component->top + ); + } else { + $drawer->setPosition($component->x, $component->y); + } + + $drawer->movePosition($border + $shadow->left, $border + $shadow->top); + + list($x1, $y1, $x2, $y2) = $component->getPosition(); + + $component->init($drawer); + + $component->drawComponent($drawer, $x1, $y1, $x2, $y2, $this->antiAliasing); + $component->drawEnvelope($drawer, $x1, $y1, $x2, $y2); + + $component->finalize($drawer); + + } + + protected function drawShadow() { + + $drawer = $this->getDrawer(); + + $this->shadow->draw( + $drawer, + new awPoint(0, 0), + new awPoint($this->width, $this->height), + awShadow::IN + ); + + } + + /** + * Send the image into a file or to the user browser + * + * @var string $file Save image into a file if you provide a file name + */ + public function send($file = NULL) { + + // Test if format is available + if((imagetypes() & $this->format) === FALSE) { + trigger_error("Format '".$this->format."' is not available on your system. Check that your PHP has been compiled with the good libraries."); + } + + // Get some infos about this image + + switch($this->format) { + case awImage::JPEG : + $function = 'imagejpeg'; + break; + case awImage::PNG : + $function = 'imagepng'; + break; + case awImage::GIF : + $function = 'imagegif'; + break; + } + + // Create image + + if($file !== NULL) { + + $function($this->resource, $file); + + } else { + + // Test some text has been printed + $data = ob_get_contents(); + if($data !== '') { + exit; + } + + // Send headers to the browser + header("Content-type: image/".$this->getFormat()); + + $function($this->resource); + + } + + } + + protected function getFormat() { + + switch($this->format) { + case awImage::JPEG : + return 'jpeg'; + case awImage::PNG : + return 'png'; + case awImage::GIF : + return 'gif'; + } + + } + +} + +registerClass('Image'); + + +/** + * Load an image from a file + * + * @package Artichow + */ +class awFileImage extends awImage { + + /** + * Build a new awimage + * + * @param string $file Image file name + */ + public function __construct($file) { + + $image = @getimagesize($file); + + if($image and in_array($image[2], array(2, 3))) { + + $this->setSize($image[0], $image[1]); + + switch($image[2]) { + + case 2 : + $this->resource = imagecreatefromjpeg($file); + break; + + case 3 : + $this->resource = imagecreatefrompng($file); + break; + + } + + $this->drawer = new awDrawer($this->resource); + $this->drawer->setImageSize($this->width, $this->height); + + } else { + trigger_error("Artichow does not support this image (must be in PNG or JPEG)", E_USER_ERROR); + } + + } + +} + +registerClass('FileImage'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/LinePlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/LinePlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..d08675d254f9ef414eef8caa5ca481f517b82db5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/LinePlot.class.php @@ -0,0 +1,596 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Plot.class.php"; + +/* <php4> */ + +define("LINEPLOT_LINE", 0); +define("LINEPLOT_MIDDLE", 1); + +/* </php4> */ + +/** + * LinePlot + * + * @package Artichow + */ +class awLinePlot extends awPlot implements awLegendable { + + /** + * Add marks to your line plot + * + * @var Mark + */ + public $mark; + + /** + * Labels on your line plot + * + * @var Label + */ + public $label; + + /** + * Filled areas + * + * @var bool + */ + protected $areas = array(); + + /** + * Is the line hidden + * + * @var bool + */ + protected $lineHide = FALSE; + + /** + * Line color + * + * @var Color + */ + protected $lineColor; + + /** + * Line mode + * + * @var int + */ + protected $lineMode = awLinePlot::LINE; + + /** + * Line type + * + * @var int + */ + protected $lineStyle = awLine::SOLID; + + /** + * Line thickness + * + * @var int + */ + protected $lineThickness = 1; + + /** + * Line background + * + * @var Color, Gradient + */ + protected $lineBackground; + + /** + * Line mode + * + * @var int + */ + const LINE = 0; + + /** + * Line in the middle + * + * @var int + */ + const MIDDLE = 1; + + /** + * Construct a new awLinePlot + * + * @param array $values Some numeric values for Y axis + * @param int $mode + */ + public function __construct($values, $mode = awLinePlot::LINE) { + + parent::__construct(); + + $this->mark = new awMark; + $this->label = new awLabel; + + $this->lineMode = (int)$mode; + + $this->setValues($values); + + } + + /** + * Hide line + * + * @param bool $hide + */ + public function hideLine($hide) { + $this->lineHide = (bool)$hide; + } + + /** + * Add a filled area + * + * @param int $start Begining of the area + * @param int $end End of the area + * @param mixed $background Background color or gradient of the area + */ + public function setFilledArea($start, $stop, $background) { + + if($stop <= $start) { + trigger_error("End position can not be greater than begin position in awLinePlot::setFilledArea()", E_USER_ERROR); + } + + $this->areas[] = array((int)$start, (int)$stop, $background); + + } + + /** + * Change line color + * + * @param awColor $color + */ + public function setColor(awColor $color) { + $this->lineColor = $color; + } + + /** + * Change line style + * + * @param int $style + */ + public function setStyle($style) { + $this->lineStyle = (int)$style; + } + + /** + * Change line tickness + * + * @param int $tickness + */ + public function setThickness($tickness) { + $this->lineThickness = (int)$tickness; + } + + /** + * Change line background color + * + * @param awColor $color + */ + public function setFillColor(awColor $color) { + $this->lineBackground = $color; + } + + /** + * Change line background gradient + * + * @param awGradient $gradient + */ + public function setFillGradient(awGradient $gradient) { + $this->lineBackground = $gradient; + } + + /** + * Get the line thickness + * + * @return int + */ + public function getLegendLineThickness() { + return $this->lineThickness; + } + + /** + * Get the line type + * + * @return int + */ + public function getLegendLineStyle() { + return $this->lineStyle; + } + + /** + * Get the color of line + * + * @return Color + */ + public function getLegendLineColor() { + return $this->lineColor; + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + public function getLegendBackground() { + return $this->lineBackground; + } + + /** + * Get a mark object + * + * @return Mark + */ + public function getLegendMark() { + return $this->mark; + } + + public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $max = $this->getRealYMax(); + $min = $this->getRealYMin(); + + // Get start and stop values + list($start, $stop) = $this->getLimit(); + + if($this->lineMode === awLinePlot::MIDDLE) { + $inc = $this->xAxis->getDistance(0, 1) / 2; + } else { + $inc = 0; + } + + // Build the polygon + $polygon = new awPolygon; + + for($key = $start; $key <= $stop; $key++) { + + $value = $this->datay[$key]; + + if($value !== NULL) { + + $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value)); + $p = $p->move($inc, 0); + $polygon->set($key, $p); + + } + + } + + // Draw backgrounds + if($this->lineBackground instanceof awColor or $this->lineBackground instanceof awGradient) { + + $backgroundPolygon = new awPolygon; + + $p = $this->xAxisPoint($start); + $p = $p->move($inc, 0); + $backgroundPolygon->append($p); + + // Add others points + foreach($polygon->all() as $point) { + $backgroundPolygon->append(clone $point); + } + + $p = $this->xAxisPoint($stop); + $p = $p->move($inc, 0); + $backgroundPolygon->append($p); + + // Draw polygon background + $drawer->filledPolygon($this->lineBackground, $backgroundPolygon); + + } + + $this->drawArea($drawer, $polygon); + + // Draw line + $prev = NULL; + + // Line color + if($this->lineHide === FALSE) { + + if($this->lineColor === NULL) { + $this->lineColor = new awColor(0, 0, 0); + } + + foreach($polygon->all() as $point) { + + if($prev !== NULL) { + $drawer->line( + $this->lineColor, + new awLine( + $prev, + $point, + $this->lineStyle, + $this->lineThickness + ) + ); + } + $prev = $point; + + } + + $this->lineColor->free(); + + } + + // Draw marks and labels + foreach($polygon->all() as $key => $point) { + + $this->mark->draw($drawer, $point); + $this->label->draw($drawer, $point, $key); + + } + + } + + protected function drawArea(awDrawer $drawer, awPolygon $polygon) { + + $starts = array(); + foreach($this->areas as $area) { + list($start) = $area; + $starts[$start] = TRUE; + } + + // Draw filled areas + foreach($this->areas as $area) { + + list($start, $stop, $background) = $area; + + $polygonArea = new awPolygon; + + $p = $this->xAxisPoint($start); + $polygonArea->append($p); + + for($i = $start; $i <= $stop; $i++) { + $p = clone $polygon->get($i); + if($i === $stop and array_key_exists($stop, $starts)) { + $p = $p->move(-1, 0); + } + $polygonArea->append($p); + } + + $p = $this->xAxisPoint($stop); + if(array_key_exists($stop, $starts)) { + $p = $p->move(-1, 0); + } + $polygonArea->append($p); + + // Draw area + $drawer->filledPolygon($background, $polygonArea); + + } + + } + + public function getXAxisNumber() { + if($this->lineMode === awLinePlot::MIDDLE) { + return count($this->datay) + 1; + } else { + return count($this->datay); + } + } + + protected function xAxisPoint($position) { + $y = $this->xAxisZero ? 0 : $this->getRealYMin(); + return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); + } + + public function getXCenter() { + return ($this->lineMode === awLinePlot::MIDDLE); + } + +} + +registerClass('LinePlot'); + + +/** + * Simple LinePlot + * Useful to draw simple horizontal lines + * + * @package Artichow + */ +class awSimpleLinePlot extends awPlot implements awLegendable { + + /** + * Line color + * + * @var Color + */ + protected $lineColor; + + /** + * Line start + * + * @var int + */ + protected $lineStart; + + /** + * Line stop + * + * @var int + */ + protected $lineStop; + + /** + * Line value + * + * @var flaot + */ + protected $lineValue; + + /** + * Line mode + * + * @var int + */ + protected $lineMode = awLinePlot::LINE; + + /** + * Line type + * + * @var int + */ + protected $lineStyle = awLine::SOLID; + + /** + * Line thickness + * + * @var int + */ + protected $lineThickness = 1; + + /** + * Line mode + * + * @var int + */ + const LINE = 0; + + /** + * Line in the middle + * + * @var int + */ + const MIDDLE = 1; + + /** + * Construct a new awLinePlot + * + * @param float $value A Y value + * @param int $start Line start index + * @param int $stop Line stop index + * @param int $mode Line mode + */ + public function __construct($value, $start, $stop, $mode = awLinePlot::LINE) { + + parent::__construct(); + + $this->lineMode = (int)$mode; + + $this->lineStart = (int)$start; + $this->lineStop = (int)$stop; + $this->lineValue = (float)$value; + + $this->lineColor = new awColor(0, 0, 0); + + } + + /** + * Change line color + * + * @param awColor $color + */ + public function setColor(awColor $color) { + $this->lineColor = $color; + } + + /** + * Change line style + * + * @param int $style + */ + public function setStyle($style) { + $this->lineStyle = (int)$style; + } + + /** + * Change line tickness + * + * @param int $tickness + */ + public function setThickness($tickness) { + $this->lineThickness = (int)$tickness; + } + + /** + * Get the line thickness + * + * @return int + */ + public function getLegendLineThickness() { + return $this->lineThickness; + } + + /** + * Get the line type + * + * @return int + */ + public function getLegendLineStyle() { + return $this->lineStyle; + } + + /** + * Get the color of line + * + * @return Color + */ + public function getLegendLineColor() { + return $this->lineColor; + } + + public function getLegendBackground() { + return NULL; + } + + public function getLegendMark() { + return NULL; + } + + public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing) { + + if($this->lineMode === awLinePlot::MIDDLE) { + $inc = $this->xAxis->getDistance(0, 1) / 2; + } else { + $inc = 0; + } + + $p1 = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($this->lineStart, $this->lineValue)); + $p2 = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($this->lineStop, $this->lineValue)); + + $drawer->line( + $this->lineColor, + new awLine( + $p1->move($inc, 0), + $p2->move($inc, 0), + $this->lineStyle, + $this->lineThickness + ) + ); + + $this->lineColor->free(); + + } + + public function getXAxisNumber() { + if($this->lineMode === awLinePlot::MIDDLE) { + return count($this->datay) + 1; + } else { + return count($this->datay); + } + } + + protected function xAxisPoint($position) { + $y = $this->xAxisZero ? 0 : $this->getRealYMin(); + return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); + } + + public function getXCenter() { + return ($this->lineMode === awLinePlot::MIDDLE); + } + +} + +registerClass('SimpleLinePlot'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/MathPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/MathPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..a3b7213b09d7db773a5b05fed67fdbce6f4e18a3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/MathPlot.class.php @@ -0,0 +1,443 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Component.class.php"; + +/** + * A mathematic function + * + * @package Artichow + */ +class awMathFunction implements awLegendable { + + /** + * Function line + * + * @var Line + */ + public $line; + + /** + * Marks for your plot + * + * @var Mark + */ + public $mark; + + /** + * Callback function + * + * @var string + */ + public $f; + + /** + * Start the drawing from this value + * + * @var float + */ + public $fromX; + + /** + * Stop the drawing at this value + * + * @var float + */ + public $toX; + + /** + * Line color + * + * @var Color + */ + protected $color; + + /** + * Construct the function + * + * @param string $f Callback function + * @param float $fromX + * @param float $toX + */ + public function __construct($f, $fromX = NULL, $toX = NULL) { + + $this->f = (string)$f; + $this->fromX = is_null($fromX) ? NULL : (float)$fromX; + $this->toX = is_null($toX) ? NULL : (float)$toX; + + $this->line = new awLine; + $this->mark = new awMark; + $this->color = new awBlack; + + } + + /** + * Change line color + * + * @param awColor $color A new awcolor + */ + public function setColor(awColor $color) { + $this->color = $color; + } + + /** + * Get line color + * + * @return Color + */ + public function getColor() { + return $this->color; + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + public function getLegendBackground() { + } + + /** + * Get the line thickness + * + * @return NULL + */ + public function getLegendLineThickness() { + return $this->line->getThickness(); + } + + /** + * Get the line type + * + * @return NULL + */ + public function getLegendLineStyle() { + return $this->line->getStyle(); + } + + /** + * Get the color of line + * + * @return NULL + */ + public function getLegendLineColor() { + return $this->color; + } + + /** + * Get a mark object + * + * @return NULL + */ + public function getLegendMark() { + return $this->mark; + } + +} + +registerClass('MathFunction'); + +/** + * For mathematics functions + * + * @package Artichow + */ +class awMathPlot extends awComponent { + + /** + * Functions + * + * @var array + */ + protected $functions = array(); + + /** + * Grid properties + * + * @var Grid + */ + public $grid; + + /** + * X axis + * + * @var Axis + */ + public $xAxis; + + /** + * Y axis + * + * @var Axis + */ + public $yAxis; + + /** + * Extremum + * + * @var Side + */ + private $extremum = NULL; + + /** + * Interval + * + * @var float + */ + private $interval = 1; + + /** + * Build the plot + * + * @param int $xMin Minimum X value + * @param int $xMax Maximum X value + * @param int $yMax Maximum Y value + * @param int $yMin Minimum Y value + */ + public function __construct($xMin, $xMax, $yMax, $yMin) { + + parent::__construct(); + + $this->setPadding(8, 8, 8, 8); + + $this->grid = new awGrid; + + // Hide grid by default + $this->grid->hide(TRUE); + + // Set extremum + $this->extremum = new awSide($xMin, $xMax, $yMax, $yMin); + + // Create axis + $this->xAxis = new awAxis; + $this->xAxis->setTickStyle(awTick::IN); + $this->xAxis->label->hideValue(0); + $this->initAxis($this->xAxis); + + $this->yAxis = new awAxis; + $this->yAxis->setTickStyle(awTick::IN); + $this->yAxis->label->hideValue(0); + $this->initAxis($this->yAxis); + + } + + protected function initAxis(awAxis $axis) { + + $axis->setLabelPrecision(1); + $axis->addTick('major', new awTick(0, 5)); + $axis->addTick('minor', new awTick(0, 3)); + $axis->addTick('micro', new awTick(0, 1)); + $axis->setNumberByTick('minor', 'major', 1); + $axis->setNumberByTick('micro', 'minor', 4); + $axis->label->setFont(new awTuffy(7)); + + } + + /** + * Interval to calculate values + * + * @param float $interval + */ + public function setInterval($interval) { + $this->interval = (float)$interval; + } + + /** + * Add a formula f(x) + * + * @param awMathFunction $function + * @param string $name Name for the legend (can be NULL if you don't want to set a legend) + * @param int $type Type for the legend + */ + public function add(awMathFunction $function, $name = NULL, $type = awLegend::LINE) { + + $this->functions[] = $function; + + if($name !== NULL) { + $this->legend->add($function, $name, $type); + } + + } + + public function init(awDrawer $drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + $this->xAxis->line->setX($x1, $x2); + $this->xAxis->label->setAlign(NULL, awLabel::BOTTOM); + $this->xAxis->label->move(0, 3); + $this->xAxis->setRange($this->extremum->left, $this->extremum->right); + + $this->yAxis->line->setY($y2, $y1); + $this->yAxis->label->setAlign(awLabel::RIGHT); + $this->yAxis->label->move(-6, 0); + $this->yAxis->reverseTickStyle(); + $this->yAxis->setRange($this->extremum->bottom, $this->extremum->top); + + + $this->xAxis->setYCenter($this->yAxis, 0); + $this->yAxis->setXCenter($this->xAxis, 0); + + if($this->yAxis->getLabelNumber() === NULL) { + $number = $this->extremum->top - $this->extremum->bottom + 1; + $this->yAxis->setLabelNumber($number); + } + + if($this->xAxis->getLabelNumber() === NULL) { + $number = $this->extremum->right - $this->extremum->left + 1; + $this->xAxis->setLabelNumber($number); + } + + // Set ticks + /* <php5> */ + $this->xAxis->tick('major')->setNumber($this->xAxis->getLabelNumber()); + $this->yAxis->tick('major')->setNumber($this->yAxis->getLabelNumber()); + /* </php5> */ + /* <php4> -- + $this->xAxis->ticks['major']->setNumber($this->xAxis->getLabelNumber()); + $this->yAxis->ticks['major']->setNumber($this->yAxis->getLabelNumber()); + -- </php4> */ + + // Set axis labels + $labels = array(); + for($i = 0, $count = $this->xAxis->getLabelNumber(); $i < $count; $i++) { + $labels[] = $i; + } + $this->xAxis->label->set($labels); + + $labels = array(); + for($i = 0, $count = $this->yAxis->getLabelNumber(); $i < $count; $i++) { + $labels[] = $i; + } + $this->yAxis->label->set($labels); + + parent::init($drawer); + + // Create the grid + $this->createGrid(); + + // Draw the grid + $this->grid->draw($drawer, $x1, $y1, $x2, $y2); + + } + + public function drawEnvelope(awDrawer $drawer) { + + // Draw axis + $this->xAxis->draw($drawer); + $this->yAxis->draw($drawer); + + } + + public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing) { + + foreach($this->functions as $function) { + + $f = $function->f; + $fromX = is_null($function->fromX) ? $this->extremum->left : $function->fromX; + $toX = is_null($function->toX) ? $this->extremum->right : $function->toX; + + $old = NULL; + + for($i = $fromX; $i <= $toX; $i += $this->interval) { + + $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($i, $f($i))); + + if($p->y >= $y1 and $p->y <= $y2) { + $function->mark->draw($drawer, $p); + } + + if($old !== NULL) { + + $line = $function->line; + $line->setLocation($old, $p); + + if( + ($line->p1->y >= $y1 and $line->p1->y <= $y2) or + ($line->p2->y >= $y1 and $line->p2->y <= $y2) + ) { + $drawer->line( + $function->getColor(), + $line + ); + } + + } + + $old = $p; + + } + + // Draw last point if needed + if($old !== NULL and $i - $this->interval != $toX) { + + $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($toX, $f($toX))); + + if($p->y >= $y1 and $p->y <= $y2) { + $function->mark->draw($drawer, $p); + } + + + $line = $function->line; + $line->setLocation($old, $p); + + if( + ($line->p1->y >= $y1 and $line->p1->y <= $y2) or + ($line->p2->y >= $y1 and $line->p2->y <= $y2) + ) { + $drawer->line( + $function->getColor(), + $line + ); + } + + } + + } + + } + + protected function createGrid() { + + // Horizontal lines of the grid + + $major = $this->yAxis->tick('major'); + $interval = $major->getInterval(); + $number = $this->yAxis->getLabelNumber() - 1; + + $h = array(); + if($number > 0) { + for($i = 0; $i <= $number; $i++) { + $h[] = $i / $number; + } + } + + // Vertical lines + + $major = $this->xAxis->tick('major'); + $interval = $major->getInterval(); + $number = $this->xAxis->getLabelNumber() - 1; + + $w = array(); + if($number > 0) { + for($i = 0; $i <= $number; $i++) { + if($i%$interval === 0) { + $w[] = $i / $number; + } + } + } + + $this->grid->setGrid($w, $h); + + } + +} + +registerClass('MathPlot'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/Pattern.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/Pattern.class.php new file mode 100644 index 0000000000000000000000000000000000000000..fac3c780364332d36914a7f3915a96c9d55ca92f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/Pattern.class.php @@ -0,0 +1,97 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Graph.class.php"; + +/** + * All patterns must derivate from this class + * + * @package Artichow + */ +abstract class awPattern { + + /** + * Pattern arguments + * + * @var array + */ + protected $args = array(); + + /** + * Load a pattern + * + * @param string $pattern Pattern name + * @return Component + */ + public static function get($pattern) { + + $file = ARTICHOW_PATTERN.DIRECTORY_SEPARATOR.$pattern.'.php'; + + if(is_file($file)) { + + require_once $file; + + $class = $pattern.'Pattern'; + + if(class_exists($class)) { + return new $class; + } else { + trigger_error("Class '".$class."' does not exist", E_USER_ERROR); + } + + } else { + trigger_error("Pattern '".$pattern."' does not exist", E_USER_ERROR); + } + + } + + /** + * Change pattern argument + * + * @param string $name Argument name + * @param mixed $value Argument value + */ + public function setArg($name, $value) { + if(is_string($name)) { + $this->args[$name] = $value; + } + } + + /** + * Get an argument + * + * @param string $name + * @param mixed $default Default value if the argument does not exist (default to NULL) + * @return mixed Argument value + */ + protected function getArg($name, $default = NULL) { + if(array_key_exists($name, $this->args)) { + return $this->args[$name]; + } else { + return $default; + } + } + + /** + * Change several arguments + * + * @param array $args New arguments + */ + public function setArgs($args) { + if(is_array($args)) { + foreach($args as $name => $value) { + $this->setArg($name, $value); + } + } + } + +} + +registerClass('Pattern', TRUE); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/Pie.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/Pie.class.php new file mode 100644 index 0000000000000000000000000000000000000000..c54bd8eb212b18e3fcecedb744c5bd279fb2961e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/Pie.class.php @@ -0,0 +1,680 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Component.class.php"; + +/* <php4> */ + +define("PIE_DARK", 1); +define("PIE_COLORED", 2); +define("PIE_AQUA", 3); +define("PIE_EARTH", 4); + +/* </php4> */ + +/** + * Pie + * + * @package Artichow + */ +class awPie extends awComponent { + + /** + * A dark theme for pies + * + * + * @var int + */ + const DARK = 1; + + /** + * A colored theme for pies + * + * @var int + */ + const COLORED = 2; + + /** + * A water theme for pies + * + * @var int + */ + const AQUA = 3; + + /** + * A earth theme for pies + * + * @var int + */ + const EARTH = 4; + + /** + * Pie values + * + * @var array + */ + protected $values; + + /** + * Pie colors + * + * @var array + */ + protected $colors; + + /** + * Pie legend + * + * @var array + */ + protected $legendValues = array(); + + /** + * Intensity of the 3D effect + * + * @var int + */ + protected $size; + + /** + * Border color + * + * @var Color + */ + protected $border; + + /** + * Pie explode + * + * @var array + */ + protected $explode = array(); + + /** + * Initial angle + * + * @var int + */ + protected $angle = 0; + + /** + * Labels precision + * + * @var int + */ + protected $precision; + + /** + * Labels number + * + * @var int + */ + protected $number; + + /** + * Labels minimum + * + * @var int + */ + protected $minimum; + + /** + * Labels position + * + * @var int + */ + protected $position = 15; + + /** + * Labels of your pie + * + * @var Label + */ + public $label; + + /** + * Build the plot + * + * @param array $values Pie values + */ + public function __construct($values, $colors = awPie::COLORED) { + + $this->setValues($values); + + if(is_array($colors)) { + $this->colors = $colors; + } else { + + switch($colors) { + + case awPie::AQUA : + $this->colors = array( + new awColor(131, 220, 215), + new awColor(131, 190, 215), + new awColor(131, 160, 215), + new awColor(160, 140, 215), + new awColor(190, 131, 215), + new awColor(220, 131, 215) + ); + break; + + case awPie::EARTH : + $this->colors = array( + new awColor(97, 179, 110), + new awColor(130, 179, 97), + new awColor(168, 179, 97), + new awColor(179, 147, 97), + new awColor(179, 108, 97), + new awColor(99, 107, 189), + new awColor(99, 165, 189) + ); + break; + + case awPie::DARK : + $this->colors = array( + new awColor(140, 100, 170), + new awColor(130, 170, 100), + new awColor(160, 160, 120), + new awColor(150, 110, 140), + new awColor(130, 150, 160), + new awColor(90, 170, 140) + ); + break; + + default : + $this->colors = array( + new awColor(187, 213, 151), + new awColor(223, 177, 151), + new awColor(111, 186, 132), + new awColor(197, 160, 230), + new awColor(165, 169, 63), + new awColor(218, 177, 89), + new awColor(116, 205, 121), + new awColor(200, 201, 78), + new awColor(127, 205, 177), + new awColor(205, 160, 160), + new awColor(190, 190, 190) + ); + break; + + } + + } + + parent::__construct(); + + $this->label = new awLabel; + $this->label->setCallbackFunction('callbackPerCent'); + + } + + /** + * Change legend values + * + * @param array $legend An array of values for each part of the pie + */ + public function setLegend($legend) { + + $this->legendValues = (array)$legend; + + } + + /** + * Set a border all around the pie + * + * @param awColor $color A color for the border + */ + public function setBorder(awColor $color) { + $this->border = $color; + } + + /** + * Change 3D effect intensity + * + * @param int $size Effect size + */ + public function set3D($size) { + $this->size = (int)$size; + } + + /** + * Change initial angle + * + * @param int $angle New angle in degrees + */ + public function setStartAngle($angle) { + $this->angle = (int)$angle; + } + + /** + * Change label precision + * + * @param int $precision New precision + */ + public function setLabelPrecision($precision) { + $this->precision = (int)$precision; + } + + /** + * Change label position + * + * @param int $position New position in pixels + */ + public function setLabelPosition($position) { + $this->position = (int)$position; + } + + /** + * Change label number + * + * @param int $number New number + */ + public function setLabelNumber($number) { + $this->number = is_null($number) ? $number : (int)$number; + } + + /** + * Change label minimum + * + * @param int $minimum New minimum + */ + public function setLabelMinimum($minimum) { + $this->minimum = is_null($minimum) ? $minimum : (int)$minimum; + } + + /** + * Change Pie explode + * + * @param array $explode + */ + public function explode($explode) { + $this->explode = (array)$explode; + } + + public function drawEnvelope(awDrawer $drawer) { + + } + + public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $count = count($this->values); + $sum = array_sum($this->values); + + $width = $x2 - $x1; + $height = $y2 - $y1; + + if($aliasing) { + $x = $width / 2; + $y = $height / 2; + } else { + $x = $width / 2 + $x1; + $y = $height / 2 + $y1; + } + + $position = $this->angle; + $values = array(); + $parts = array(); + $angles = 0; + + if($aliasing) { + $side = new awSide(0, 0, 0, 0); + } + + foreach($this->values as $key => $value) { + + $angle = ($value / $sum * 360); + + if($key === $count - 1) { + $angle = 360 - $angles; + } + + $angles += $angle; + + if(array_key_exists($key, $this->explode)) { + $middle = 360 - ($position + $angle / 2); + $posX = $this->explode[$key] * cos($middle * M_PI / 180); + $posY = $this->explode[$key] * sin($middle * M_PI / 180) * -1; + + if($aliasing) { + $explode = new awPoint( + $posX * 2, + $posY * 2 + ); + $side->set( + max($side->left, $posX * -2), + max($side->right, $posX * 2), + max($side->top, $posY * -2), + max($side->bottom, $posY * 2) + ); + } else { + $explode = new awPoint( + $posX, + $posY + ); + } + + } else { + $explode = new awPoint(0, 0); + } + + $values[$key] = array( + $position, ($position + $angle), $explode + ); + + $color = $this->colors[$key % count($this->colors)]; + $parts[$key] = new awPiePart($color); + + // Add part to the legend + $legend = array_key_exists($key, $this->legendValues) ? $this->legendValues[$key] : $key; + $this->legend->add($parts[$key], $legend, awLegend::BACKGROUND); + + $position += $angle; + + } + + if($aliasing) { + + $mainDrawer = $drawer; + + $x *= 2; + $y *= 2; + $width *= 2; + $height *= 2; + $this->size *= 2; + + $image = new awImage; + $image->border->hide(); + $image->setSize( + $width + $side->left + $side->right, + $height + $side->top + $side->bottom + $this->size + 1 /* bugs.php.net ! */ + ); + + $drawer = $image->getDrawer( + $width / $image->width, + $height / $image->height, + ($width / 2 + $side->left) / $image->width, + ($height / 2 + $side->top) / $image->height + ); + + } + + // Draw 3D effect + for($i = $this->size; $i > 0; $i--) { + + foreach($values as $key => $value) { + + $color = clone $this->colors[$key % count($this->colors)]; + $color->brightness(-50); + + list($from, $to, $explode) = $value; + + $drawer->filledArc($color, $explode->move($x, $y + $i), $width, $height, $from, $to); + + $color->free(); + unset($color); + + if($this->border instanceof awColor) { + + $point = $explode->move($x, $y); + + if($i === $this->size) { + + $drawer->arc($this->border, $point->move(0, $this->size), $width, $height, $from, $to); + + } + + } + + } + + } + + foreach($values as $key => $value) { + + $color = $this->colors[$key % count($this->colors)]; + + list($from, $to, $explode) = $value; + + $drawer->filledArc($color, $explode->move($x, $y), $width, $height, $from, $to); + + if($this->border instanceof awColor) { + + $point = $explode->move($x, $y); + $drawer->arc($this->border, $point, $width, $height, $from, $to); + } + + } + + if($aliasing) { + + $x = $x / 2 + $x1; + $y = $y / 2 + $y1; + $width /= 2; + $height /= 2; + $this->size /= 2; + + foreach($values as $key => $value) { + $old = $values[$key][2]; + $values[$key][2] = new awPoint( + $old->x / 2, $old->y / 2 + ); + } + + $mainDrawer->copyResizeImage( + $image, + new awPoint($x1 - $side->left / 2, $y1 - $side->top / 2), + new awPoint($x1 - $side->left / 2 + $image->width / 2, $y1 - $side->top / 2 + $image->height/ 2), + new awPoint(0, 0), + new awPoint($image->width, $image->height), + TRUE + ); + + $drawer = $mainDrawer; + + } + + // Get labels values + $pc = array(); + foreach($this->values as $key => $value) { + $pc[$key] = round($value / $sum * 100, $this->precision); + } + if($this->label->count() === 0) { // Check that there is no user defined values + $this->label->set($pc); + } + + $position = 0; + + foreach($pc as $key => $value) { + + // Limit number of labels to display + if($position === $this->number) { + break; + } + + if(is_null($this->minimum) === FALSE and $value < $this->minimum) { + continue; + } + + $position++; + + list($from, $to, $explode) = $values[$key]; + + $angle = $from + ($to - $from) / 2; + $angleRad = (360 - $angle) * M_PI / 180; + + $point = new awPoint( + $x + $explode->x + cos($angleRad) * ($width / 2 + $this->position), + $y + $explode->y - sin($angleRad) * ($height / 2 + $this->position) + ); + + $angle %= 360; + + // We don't display labels on the 3D effect + if($angle > 0 and $angle < 180) { + $point = $point->move(0, -1 * sin($angleRad) * $this->size); + } + + if($angle >= 45 and $angle < 135) { + $this->label->setAlign(awLabel::CENTER, awLabel::BOTTOM); + } else if($angle >= 135 and $angle < 225) { + $this->label->setAlign(awLabel::RIGHT, awLabel::MIDDLE); + } else if($angle >= 225 and $angle < 315) { + $this->label->setAlign(awLabel::CENTER, awLabel::TOP); + } else { + $this->label->setAlign(awLabel::LEFT, awLabel::MIDDLE); + } + + $this->label->draw( + $drawer, + $point, + $key + ); + + } + + } + + /** + * Return margins around the component + * + * @return array Left, right, top and bottom margins + */ + public function getMargin() { + + // Get axis informations + + $leftAxis = $this->padding->left; + $rightAxis = $this->padding->right; + $topAxis = $this->padding->top; + $bottomAxis = $this->padding->bottom; + + return array($leftAxis, $rightAxis, $topAxis, $bottomAxis); + + } + + + /** + * Change values of Y axis + * This method ignores not numeric values + * + * @param array $values + */ + public function setValues($values) { + + $this->checkArray($values); + $this->values = $values; + + } + + + /** + * Return values of Y axis + * + * @return array + */ + public function getValues() { + return $this->values; + } + + private function checkArray(&$array) { + + if(is_array($array) === FALSE) { + trigger_error("You tried to set values that are not an array"); + } + + foreach($array as $key => $value) { + if(is_numeric($value) === FALSE) { + unset($array[$key]); + } + } + + if(count($array) < 1) { + trigger_error("Your graph must have at least 1 value"); + } + + } + +} + +registerClass('Pie'); + +/** + * Pie + * + * @package Artichow + */ +class awPiePart implements awLegendable { + + /** + * Pie part color + * + * @var Color + */ + protected $color; + + /** + * Build a new awPiePart + * + * @param awColor $color Pie part color + */ + public function __construct(awColor $color) { + + $this->color = $color; + + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + public function getLegendBackground() { + return $this->color; + } + + /** + * Get the line thickness + * + * @return NULL + */ + public function getLegendLineThickness() { + } + + /** + * Get the line type + * + * @return NULL + */ + public function getLegendLineStyle() { + } + + /** + * Get the color of line + * + * @return NULL + */ + public function getLegendLineColor() { + } + + /** + * Get a mark object + * + * @return NULL + */ + public function getLegendMark() { + } + +} + +registerClass('PiePart'); + +function callbackPerCent($value) { + return $value.'%'; +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/Plot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/Plot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..b7460247c18a29acc271f0b5171cd47b36364317 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/Plot.class.php @@ -0,0 +1,1480 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Component.class.php"; + +/* <php4> */ + +define("PLOT_LEFT", 'left'); +define("PLOT_RIGHT", 'right'); +define("PLOT_TOP", 'top'); +define("PLOT_BOTTOM", 'bottom'); +define("PLOT_BOTH", 'both'); + +/* </php4> */ + +/** + * Graph using X and Y axis + * + * @package Artichow + */ +abstract class awPlot extends awComponent { + + /** + * Values for Y axis + * + * @var array + */ + protected $datay; + + /** + * Values for X axis + * + * @var array + */ + protected $datax; + + /** + * Grid properties + * + * @var Grid + */ + public $grid; + + /** + * X axis + * + * @var Axis + */ + public $xAxis; + + /** + * Y axis + * + * @var Axis + */ + public $yAxis; + + /** + * Position of X axis + * + * @var int + */ + protected $xAxisPosition = awPlot::BOTTOM; + + /** + * Set X axis on zero ? + * + * @var bool + */ + protected $xAxisZero = TRUE; + + /** + * Set Y axis on zero ? + * + * @var bool + */ + protected $yAxisZero = FALSE; + + /** + * Position of Y axis + * + * @var int + */ + protected $yAxisPosition = awPlot::LEFT; + + /** + * Change min value for Y axis + * + * @var mixed + */ + private $yMin = NULL; + + /** + * Change max value for Y axis + * + * @var mixed + */ + private $yMax = NULL; + + /** + * Change min value for X axis + * + * @var mixed + */ + private $xMin = NULL; + + /** + * Change max value for X axis + * + * @var mixed + */ + private $xMax = NULL; + + /** + * Left axis + * + * @var int + */ + const LEFT = 'left'; + + /** + * RIGHT axis + * + * @var int + */ + const RIGHT = 'right'; + + /** + * Top axis + * + * @var int + */ + const TOP = 'top'; + + /** + * Bottom axis + * + * @var int + */ + const BOTTOM = 'bottom'; + + /** + * Both left/right or top/bottom axis + * + * @var int + */ + const BOTH = 'both'; + + /** + * Build the plot + * + */ + public function __construct() { + + parent::__construct(); + + $this->grid = new awGrid; + $this->grid->setBackgroundColor(new awWhite); + + $this->padding->add(20, 0, 0, 20); + + $this->xAxis = new awAxis; + $this->xAxis->addTick('major', new awTick(0, 5)); + $this->xAxis->addTick('minor', new awTick(0, 3)); + $this->xAxis->setTickStyle(awTick::OUT); + $this->xAxis->label->setFont(new awTuffy(7)); + + $this->yAxis = new awAxis; + $this->yAxis->auto(TRUE); + $this->yAxis->addTick('major', new awTick(0, 5)); + $this->yAxis->addTick('minor', new awTick(0, 3)); + $this->yAxis->setTickStyle(awTick::OUT); + $this->yAxis->setNumberByTick('minor', 'major', 3); + $this->yAxis->label->setFont(new awTuffy(7)); + $this->yAxis->title->setAngle(90); + + } + + /** + * Get plot values + * + * @return array + */ + public function getValues() { + return $this->datay; + } + + /** + * Reduce number of values in the plot + * + * @param int $number Reduce number of values to $number + */ + public function reduce($number) { + + $count = count($this->datay); + $ratio = ceil($count / $number); + + if($ratio > 1) { + + $tmpy = $this->datay; + $datay = array(); + + $datax = array(); + $cbLabel = $this->xAxis->label->getCallbackFunction(); + + for($i = 0; $i < $count; $i += $ratio) { + + $slice = array_slice($tmpy, $i, $ratio); + $datay[] = array_sum($slice) / count($slice); + + // Reduce data on X axis if needed + if($cbLabel !== NULL) { + $datax[] = $cbLabel($i + round($ratio / 2)); + } + + } + + $this->setValues($datay); + + if($cbLabel !== NULL) { + $this->xAxis->setLabelText($datax); + } + + + } + + } + + /** + * Count values in the plot + * + * @return int + */ + public function getXAxisNumber() { + list($min, $max) = $this->xAxis->getRange(); + return ($max - $min + 1); + } + + /** + * Change X axis + * + * @param int $axis + */ + public function setXAxis($axis) { + $this->xAxisPosition = $axis; + } + + /** + * Get X axis + * + * @return int + */ + public function getXAxis() { + return $this->xAxisPosition; + } + + /** + * Set X axis on zero + * + * @param bool $zero + */ + public function setXAxisZero($zero) { + $this->xAxisZero = (bool)$zero; + } + + /** + * Set Y axis on zero + * + * @param bool $zero + */ + public function setYAxisZero($zero) { + $this->yAxisZero = (bool)$zero; + } + + /** + * Change Y axis + * + * @param int $axis + */ + public function setYAxis($axis) { + $this->yAxisPosition = $axis; + } + + /** + * Get Y axis + * + * @return int + */ + public function getYAxis() { + return $this->yAxisPosition; + } + + /** + * Change min value for Y axis + * Set NULL for auto selection. + * + * @param float $value + */ + public function setYMin($value) { + $this->yMin = $value; + $this->yAxis->auto(FALSE); + $this->updateAxis(); + } + + /** + * Change max value for Y axis + * Set NULL for auto selection. + * + * @param float $value + */ + public function setYMax($value) { + $this->yMax = $value; + $this->yAxis->auto(FALSE); + $this->updateAxis(); + } + + /** + * Change min value for X axis + * Set NULL for auto selection. + * + * @param float $value + */ + public function setXMin($value) { + $this->xMin = $value; + $this->updateAxis(); + } + + /** + * Change max value for X axis + * Set NULL for auto selection. + * + * @param float $value + */ + public function setXMax($value) { + $this->xMax = $value; + $this->updateAxis(); + } + + /** + * Get min value for Y axis + * + * @return float $value + */ + public function getYMin() { + if($this->auto) { + if(is_null($this->yMin)) { + $min = array_min($this->datay); + if($min > 0) { + return 0; + } + } + } + return is_null($this->yMin) ? array_min($this->datay) : (float)$this->yMin; + } + + /** + * Get max value for Y axis + * + * @return float $value + */ + public function getYMax() { + if($this->auto) { + if(is_null($this->yMax)) { + $max = array_max($this->datay); + if($max < 0) { + return 0; + } + } + } + return is_null($this->yMax) ? array_max($this->datay) : (float)$this->yMax; + } + + /** + * Get min value for X axis + * + * @return float $value + */ + public function getXMin() { + return floor(is_null($this->xMin) ? array_min($this->datax) : $this->xMin); + } + + /** + * Get max value for X axis + * + * @return float $value + */ + public function getXMax() { + return (ceil(is_null($this->xMax) ? array_max($this->datax) : (float)$this->xMax)) + ($this->getXCenter() ? 1 : 0); + } + + /** + * Get min value with spaces for Y axis + * + * @return float $value + */ + public function getRealYMin() { + $min = $this->getYMin(); + if($this->space->bottom !== NULL) { + $interval = ($this->getYMax() - $min) * $this->space->bottom / 100; + return $min - $interval; + } else { + return is_null($this->yMin) ? $min : (float)$this->yMin; + } + } + + /** + * Get max value with spaces for Y axis + * + * @return float $value + */ + public function getRealYMax() { + $max = $this->getYMax(); + if($this->space->top !== NULL) { + $interval = ($max - $this->getYMin()) * $this->space->top / 100; + return $max + $interval; + } else { + return is_null($this->yMax) ? $max : (float)$this->yMax; + } + } + + public function init(awDrawer $drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + // Get space informations + list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); + + $this->xAxis->setPadding($leftSpace, $rightSpace); + + if($this->space->bottom > 0 or $this->space->top > 0) { + + list($min, $max) = $this->yAxis->getRange(); + $interval = $max - $min; + + $this->yAxis->setRange( + $min - $interval * $this->space->bottom / 100, + $max + $interval * $this->space->top / 100 + ); + + } + + // Auto-scaling mode + $this->yAxis->autoScale(); + + // Number of labels is not specified + if($this->yAxis->getLabelNumber() === NULL) { + $number = round(($y2 - $y1) / 75) + 2; + $this->yAxis->setLabelNumber($number); + } + + $this->xAxis->line->setX($x1, $x2); + $this->yAxis->line->setY($y2, $y1); + + // Set ticks + /* <php5> */ + $this->xAxis->tick('major')->setNumber($this->getXAxisNumber()); + $this->yAxis->tick('major')->setNumber($this->yAxis->getLabelNumber()); + /* </php5> */ + /* <php4> -- + $this->xAxis->ticks['major']->setNumber($this->getXAxisNumber()); + $this->yAxis->ticks['major']->setNumber($this->yAxis->getLabelNumber()); + -- </php4> */ + + // Center X axis on zero + if($this->xAxisZero) { + $this->xAxis->setYCenter($this->yAxis, 0); + } + + // Center Y axis on zero + if($this->yAxisZero) { + $this->yAxis->setXCenter($this->xAxis, 0); + } + + // Set axis labels + $labels = array(); + for($i = 0, $count = $this->getXAxisNumber(); $i < $count; $i++) { + $labels[] = $i; + } + $this->xAxis->label->set($labels); + + parent::init($drawer); + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + list($leftSpace, $rightSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); + + // Create the grid + $this->createGrid(); + + // Draw the grid + $this->grid->setSpace($leftSpace, $rightSpace, 0, 0); + $this->grid->draw($drawer, $x1, $y1, $x2, $y2); + + } + + public function drawEnvelope(awDrawer $drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + if($this->getXCenter()) { + $size = $this->xAxis->getDistance(0, 1); + $this->xAxis->label->move($size / 2, 0); + $this->xAxis->label->hideLast(TRUE); + } + + // Draw top axis + if($this->xAxisPosition === awPlot::TOP or $this->xAxisPosition === awPlot::BOTH) { + $top = clone $this->xAxis; + if($this->xAxisZero === FALSE) { + $top->line->setY($y1, $y1); + } + $top->label->setAlign(NULL, awLabel::TOP); + $top->label->move(0, -3); + $top->title->move(0, -25); + $top->draw($drawer); + } + + // Draw bottom axis + if($this->xAxisPosition === awPlot::BOTTOM or $this->xAxisPosition === awPlot::BOTH) { + $bottom = clone $this->xAxis; + if($this->xAxisZero === FALSE) { + $bottom->line->setY($y2, $y2); + } + $bottom->label->setAlign(NULL, awLabel::BOTTOM); + $bottom->label->move(0, 3); + $bottom->reverseTickStyle(); + $bottom->title->move(0, 25); + $bottom->draw($drawer); + } + + // Draw left axis + if($this->yAxisPosition === awPlot::LEFT or $this->yAxisPosition === awPlot::BOTH) { + $left = clone $this->yAxis; + if($this->yAxisZero === FALSE) { + $left->line->setX($x1, $x1); + } + $left->label->setAlign(awLabel::RIGHT); + $left->label->move(-6, 0); + $left->title->move(-25, 0); + $left->draw($drawer); + } + + // Draw right axis + if($this->yAxisPosition === awPlot::RIGHT or $this->yAxisPosition === awPlot::BOTH) { + $right = clone $this->yAxis; + if($this->yAxisZero === FALSE) { + $right->line->setX($x2, $x2); + } + $right->label->setAlign(awLabel::LEFT); + $right->label->move(6, 0); + $right->reverseTickStyle(); + $right->title->move(25, 0); + $right->draw($drawer); + } + + } + + protected function createGrid() { + + $max = $this->getRealYMax(); + $min = $this->getRealYMin(); + + $number = $this->yAxis->getLabelNumber() - 1; + + if($number < 1) { + return; + } + + // Horizontal lines of the grid + + $h = array(); + for($i = 0; $i <= $number; $i++) { + $h[] = $i / $number; + } + + // Vertical lines + + $major = $this->yAxis->tick('major'); + $interval = $major->getInterval(); + $number = $this->getXAxisNumber() - 1; + + $w = array(); + + if($number > 0) { + + for($i = 0; $i <= $number; $i++) { + if($i%$interval === 0) { + $w[] = $i / $number; + } + } + + } + + $this->grid->setGrid($w, $h); + + } + + /** + * Change values of Y axis + * This method ignores not numeric values + * + * @param array $datay + * @param array $datax + */ + public function setValues($datay, $datax = NULL) { + + $this->checkArray($datay); + + foreach($datay as $key => $value) { + unset($datay[$key]); + $datay[(int)$key] = $value; + } + + if($datax === NULL) { + $datax = array(); + for($i = 0; $i < count($datay); $i++) { + $datax[] = $i; + } + } else { + foreach($datax as $key => $value) { + unset($datax[$key]); + $datax[(int)$key] = $value; + } + } + + $this->checkArray($datax); + + if(count($datay) === count($datax)) { + + // Set values + $this->datay = $datay; + $this->datax = $datax; + // Update axis with the new awvalues + $this->updateAxis(); + } else { + trigger_error("Plots must have the same number of X and Y points", E_USER_ERROR); + } + + } + + /** + * Return begin and end values + * + * @return array + */ + protected function getLimit() { + + $i = 0; + while(array_key_exists($i, $this->datay) and $this->datay[$i] === NULL) { + $i++; + } + $start = $i; + $i = count($this->datay) - 1; + while(array_key_exists($i, $this->datay) and $this->datay[$i] === NULL) { + $i--; + } + $stop = $i; + + return array($start, $stop); + + } + + /** + * Return TRUE if labels must be centered on X axis, FALSE otherwise + * + * @return bool + */ + abstract public function getXCenter(); + + private function updateAxis() { + + $this->xAxis->setRange( + $this->getXMin(), + $this->getXMax() + ); + $this->yAxis->setRange( + $this->getRealYMin(), + $this->getRealYMax() + ); + + } + + private function checkArray(&$array) { + + if(is_array($array) === FALSE) { + trigger_error("You tried to set a value that is not an array", E_USER_ERROR); + } + + foreach($array as $key => $value) { + if(is_numeric($value) === FALSE and is_null($value) === FALSE) { + trigger_error("Expected numeric values for the plot", E_USER_ERROR); + } + } + + if(count($array) < 1) { + trigger_error("Your plot must have at least 1 value", E_USER_ERROR); + } + + } + +} + +registerClass('Plot', TRUE); + +class awPlotAxis { + + /** + * Left axis + * + * @var Axis + */ + public $left; + + /** + * Right axis + * + * @var Axis + */ + public $right; + + /** + * Top axis + * + * @var Axis + */ + public $top; + + /** + * Bottom axis + * + * @var Axis + */ + public $bottom; + + /** + * Build the group of axis + */ + public function __construct() { + + $this->left = new awAxis; + $this->left->auto(TRUE); + $this->left->label->setAlign(awLabel::RIGHT); + $this->left->label->move(-6, 0); + $this->yAxis($this->left); + $this->left->setTickStyle(awTick::OUT); + $this->left->title->move(-25, 0); + + $this->right = new awAxis; + $this->right->auto(TRUE); + $this->right->label->setAlign(awLabel::LEFT); + $this->right->label->move(6, 0); + $this->yAxis($this->right); + $this->right->setTickStyle(awTick::IN); + $this->right->title->move(25, 0); + + $this->top = new awAxis; + $this->top->label->setAlign(NULL, awLabel::TOP); + $this->top->label->move(0, -3); + $this->xAxis($this->top); + $this->top->setTickStyle(awTick::OUT); + $this->top->title->move(0, -25); + + $this->bottom = new awAxis; + $this->bottom->label->setAlign(NULL, awLabel::BOTTOM); + $this->bottom->label->move(0, 3); + $this->xAxis($this->bottom); + $this->bottom->setTickStyle(awTick::IN); + $this->bottom->title->move(0, 25); + + } + + protected function xAxis(awAxis $axis) { + + $axis->addTick('major', new awTick(0, 5)); + $axis->addTick('minor', new awTick(0, 3)); + $axis->label->setFont(new awTuffy(7)); + + } + + protected function yAxis(awAxis $axis) { + + $axis->addTick('major', new awTick(0, 5)); + $axis->addTick('minor', new awTick(0, 3)); + $axis->setNumberByTick('minor', 'major', 3); + $axis->label->setFont(new awTuffy(7)); + $axis->title->setAngle(90); + + } + +} + +registerClass('PlotAxis'); + +/** + * A graph with axis can contain some groups of components + * + * @package Artichow + */ +class awPlotGroup extends awComponentGroup { + + /** + * Grid properties + * + * @var Grid + */ + public $grid; + + /** + * Left, right, top and bottom axis + * + * @var PlotAxis + */ + public $axis; + + /** + * Set the X axis on zero + * + * @var bool + */ + protected $xAxisZero = TRUE; + + /** + * Set the Y axis on zero + * + * @var bool + */ + protected $yAxisZero = FALSE; + + /** + * Real axis used for Y axis + * + * @var string + */ + private $yRealAxis = awPlot::LEFT; + + /** + * Real axis used for X axis + * + * @var string + */ + private $xRealAxis = awPlot::BOTTOM; + + /** + * Change min value for Y axis + * + * @var mixed + */ + private $yMin = NULL; + + /** + * Change max value for Y axis + * + * @var mixed + */ + private $yMax = NULL; + + /** + * Change min value for X axis + * + * @var mixed + */ + private $xMin = NULL; + + /** + * Change max value for X axis + * + * @var mixed + */ + private $xMax = NULL; + + /** + * Build the PlotGroup + * + */ + public function __construct() { + + parent::__construct(); + + $this->grid = new awGrid; + $this->grid->setBackgroundColor(new awWhite); + + $this->axis = new awPlotAxis; + + } + + /** + * Set the X axis on zero or not + * + * @param bool $zero + */ + public function setXAxisZero($zero) { + $this->xAxisZero = (bool)$zero; + } + + /** + * Set the Y axis on zero or not + * + * @param bool $zero + */ + public function setYAxisZero($zero) { + $this->yAxisZero = (bool)$zero; + } + + /** + * Change min value for Y axis + * Set NULL for auto selection. + * + * @param float $value + */ + public function setYMin($value) { + $this->axis->left->auto(FALSE); + $this->axis->right->auto(FALSE); + $this->yMin = $value; + } + + /** + * Change max value for Y axis + * Set NULL for auto selection. + * + * @param float $value + */ + public function setYMax($value) { + $this->axis->left->auto(FALSE); + $this->axis->right->auto(FALSE); + $this->yMax = $value; + } + + /** + * Change min value for X axis + * Set NULL for auto selection. + * + * @param float $value + */ + public function setXMin($value) { + $this->xMin = $value; + } + + /** + * Change max value for X axis + * Set NULL for auto selection. + * + * @param float $value + */ + public function setXMax($value) { + $this->xMax = $value; + } + + /** + * Get min value for X axis + * + * @return float $value + */ + public function getXMin() { + + return $this->getX('min'); + + } + + /** + * Get max value for X axis + * + * @return float $value + */ + public function getXMax() { + + return $this->getX('max'); + + } + + private function getX($type) { + + switch($type) { + case 'max' : + if($this->xMax !== NULL) { + return $this->xMax; + } + break; + case 'min' : + if($this->xMin !== NULL) { + return $this->xMin; + } + break; + } + + $value = NULL; + $get = 'getX'.ucfirst($type); + + for($i = 0; $i < count($this->components); $i++) { + + $component = $this->components[$i]; + + if($value === NULL) { + $value = $component->$get(); + } else { + $value = $type($value, $component->$get()); + } + + } + + return $value; + + } + + /** + * Get min value with spaces for Y axis + * + * @param string $axis Axis name + * @return float $value + */ + public function getRealYMin($axis = NULL) { + + if($axis === NULL) { + return NULL; + } + + $min = $this->getRealY('min', $axis); + $max = $this->getRealY('max', $axis); + + if($this->space->bottom !== NULL) { + $interval = ($min - $max) * $this->space->bottom / 100; + return $min + $interval; + } else { + return $min; + } + + } + + /** + * Get max value with spaces for Y axis + * + * @param string $axis Axis name + * @return float $value + */ + public function getRealYMax($axis = NULL) { + + if($axis === NULL) { + return NULL; + } + + $min = $this->getRealY('min', $axis); + $max = $this->getRealY('max', $axis); + + if($this->space->top !== NULL) { + $interval = ($max - $min) * $this->space->top / 100; + return $max + $interval; + } else { + return $max; + } + + } + + private function getRealY($type, $axis) { + + switch($type) { + case 'max' : + if($this->yMax !== NULL) { + return $this->yMax; + } + break; + case 'min' : + if($this->yMin !== NULL) { + return $this->yMin; + } + break; + } + + $value = NULL; + $get = 'getY'.ucfirst($type); + + for($i = 0; $i < count($this->components); $i++) { + + $component = $this->components[$i]; + + switch($axis) { + + case awPlot::LEFT : + case awPlot::RIGHT : + $test = ($component->getYAxis() === $axis); + break; + default : + $test = FALSE; + + } + + if($test) { + if($value === NULL) { + $value = $component->$get(); + } else { + $value = $type($value, $component->$get()); + } + } + + } + + return $value; + + } + + public function init(awDrawer $drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + // Get PlotGroup space + list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); + + // Count values in the group + $values = $this->getXAxisNumber(); + + // Init the PlotGroup + $this->axis->top->line->setX($x1, $x2); + $this->axis->bottom->line->setX($x1, $x2); + $this->axis->left->line->setY($y2, $y1); + $this->axis->right->line->setY($y2, $y1); + + $this->axis->top->setPadding($leftSpace, $rightSpace); + $this->axis->bottom->setPadding($leftSpace, $rightSpace); + + $xMin = $this->getXMin(); + $xMax = $this->getXMax(); + + $this->axis->top->setRange($xMin, $xMax); + $this->axis->bottom->setRange($xMin, $xMax); + + for($i = 0; $i < count($this->components); $i++) { + + /* <php5> */ + $component = $this->components[$i]; + /* </php5> */ + /* <php4> -- + $component = &$this->components[$i]; + -- </php4> */ + $component->auto($this->auto); + + // Copy space to the component + + $component->setSpace($this->space->left, $this->space->right, $this->space->top, $this->space->bottom); + + $component->xAxis->setPadding($leftSpace, $rightSpace); + $component->xAxis->line->setX($x1, $x2); + + $component->yAxis->line->setY($y2, $y1); + + } + + // Set Y axis range + foreach(array('left', 'right') as $axis) { + + if($this->isAxisUsed($axis)) { + + $min = $this->getRealYMin($axis); + $max = $this->getRealYMax($axis); + + $interval = $max - $min; + + $this->axis->{$axis}->setRange( + $min - $interval * $this->space->bottom / 100, + $max + $interval * $this->space->top / 100 + ); + + // Auto-scaling mode + $this->axis->{$axis}->autoScale(); + + } + + } + + if($this->axis->left->getLabelNumber() === NULL) { + $number = round(($y2 - $y1) / 75) + 2; + $this->axis->left->setLabelNumber($number); + } + + if($this->axis->right->getLabelNumber() === NULL) { + $number = round(($y2 - $y1) / 75) + 2; + $this->axis->right->setLabelNumber($number); + } + + // Center labels on X axis if needed + $test = array(awPlot::TOP => FALSE, awPlot::BOTTOM => FALSE); + + for($i = 0; $i < count($this->components); $i++) { + + /* <php5> */ + $component = $this->components[$i]; + /* </php5> */ + /* <php4> -- + $component = &$this->components[$i]; + -- </php4> */ + + if($component->getValues() !== NULL) { + + $axis = $component->getXAxis(); + + if($test[$axis] === FALSE) { + + // Center labels for bar plots + if($component->getXCenter()) { + $size = $this->axis->{$axis}->getDistance(0, 1); + $this->axis->{$axis}->label->move($size / 2, 0); + $this->axis->{$axis}->label->hideLast(TRUE); + $test[$axis] = TRUE; + } + + } + + } + + + } + + // Set axis labels + $labels = array(); + for($i = $xMin; $i <= $xMax; $i++) { + $labels[] = $i; + } + if($this->axis->top->label->count() === 0) { + $this->axis->top->label->set($labels); + } + if($this->axis->bottom->label->count() === 0) { + $this->axis->bottom->label->set($labels); + } + + // Set ticks + /* <php5> */ + $this->axis->top->tick('major')->setNumber($values); + $this->axis->bottom->tick('major')->setNumber($values); + $this->axis->left->tick('major')->setNumber($this->axis->left->getLabelNumber()); + $this->axis->right->tick('major')->setNumber($this->axis->right->getLabelNumber()); + /* </php5> */ + /* <php4> -- + $this->axis->top->ticks['major']->setNumber($values); + $this->axis->bottom->ticks['major']->setNumber($values); + $this->axis->left->ticks['major']->setNumber($this->axis->left->getLabelNumber()); + $this->axis->right->ticks['major']->setNumber($this->axis->right->getLabelNumber()); + -- </php4> */ + + // Set X axis on zero + if($this->xAxisZero) { + $axis = $this->selectYAxis(); + $this->axis->bottom->setYCenter($axis, 0); + $this->axis->top->setYCenter($axis, 0); + } + + // Set Y axis on zero + if($this->yAxisZero) { + $axis = $this->selectXAxis(); + $this->axis->left->setXCenter($axis, 1); + $this->axis->right->setXCenter($axis, 1); + } + + parent::init($drawer); + + list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); + + // Create the grid + $this->createGrid(); + + // Draw the grid + $this->grid->setSpace($leftSpace, $rightSpace, 0, 0); + $this->grid->draw($drawer, $x1, $y1, $x2, $y2); + + } + + public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $xMin = $this->getXMin(); + $xMax = $this->getXMax(); + + $maxLeft = $this->getRealYMax(awPlot::LEFT); + $maxRight = $this->getRealYMax(awPlot::RIGHT); + + $minLeft = $this->getRealYMin(awPlot::LEFT); + $minRight = $this->getRealYMin(awPlot::RIGHT); + + foreach($this->components as $component) { + + $min = $component->getYMin(); + $max = $component->getYMax(); + + // Set component minimum and maximum + if($component->getYAxis() === awPlot::LEFT) { + + list($min, $max) = $this->axis->left->getRange(); + + $component->setYMin($min); + $component->setYMax($max); + + } else { + + list($min, $max) = $this->axis->right->getRange(); + + $component->setYMin($min); + $component->setYMax($max); + + } + + $component->setXAxisZero($this->xAxisZero); + $component->setYAxisZero($this->yAxisZero); + + $component->xAxis->setRange($xMin, $xMax); + + $component->drawComponent( + $drawer, + $x1, $y1, + $x2, $y2, + $aliasing + ); + + $component->setYMin($min); + $component->setYMax($max); + + } + + } + + public function drawEnvelope(awDrawer $drawer) { + + list($x1, $y1, $x2, $y2) = $this->getPosition(); + + // Hide unused axis + foreach(array(awPlot::LEFT, awPlot::RIGHT, awPlot::TOP, awPlot::BOTTOM) as $axis) { + if($this->isAxisUsed($axis) === FALSE) { + $this->axis->{$axis}->hide(TRUE); + } + } + + // Draw top axis + $top = $this->axis->top; + if($this->xAxisZero === FALSE) { + $top->line->setY($y1, $y1); + } + $top->draw($drawer); + + // Draw bottom axis + $bottom = $this->axis->bottom; + if($this->xAxisZero === FALSE) { + $bottom->line->setY($y2, $y2); + } + $bottom->draw($drawer); + + // Draw left axis + $left = $this->axis->left; + if($this->yAxisZero === FALSE) { + $left->line->setX($x1, $x1); + } + $left->draw($drawer); + + // Draw right axis + $right = $this->axis->right; + if($this->yAxisZero === FALSE) { + $right->line->setX($x2, $x2); + } + $right->draw($drawer); + + } + + /** + * Is the specified axis used ? + * + * @param string $axis Axis name + * @return bool + */ + protected function isAxisUsed($axis) { + + for($i = 0; $i < count($this->components); $i++) { + + $component = $this->components[$i]; + + switch($axis) { + + case awPlot::LEFT : + case awPlot::RIGHT : + if($component->getYAxis() === $axis) { + return TRUE; + } + break; + + case awPlot::TOP : + case awPlot::BOTTOM : + if($component->getXAxis() === $axis) { + return TRUE; + } + break; + + } + + } + + return FALSE; + + } + + protected function createGrid() { + + $max = $this->getRealYMax(awPlot::LEFT); + $min = $this->getRealYMin(awPlot::RIGHT); + + // Select axis (left if possible, right otherwise) + $axis = $this->selectYAxis(); + + $number = $axis->getLabelNumber() - 1; + + if($number < 1) { + return; + } + + // Horizontal lines of grid + + $h = array(); + for($i = 0; $i <= $number; $i++) { + $h[] = $i / $number; + } + + // Vertical lines + + $major = $axis->tick('major'); + $interval = $major->getInterval(); + $number = $this->getXAxisNumber() - 1; + + $w = array(); + + if($number > 0) { + + for($i = 0; $i <= $number; $i++) { + if($i%$interval === 0) { + $w[] = $i / $number; + } + } + + } + + $this->grid->setGrid($w, $h); + + } + + protected function selectYAxis(){ + + // Select axis (left if possible, right otherwise) + if($this->isAxisUsed(awPlot::LEFT)) { + $axis = $this->axis->left; + } else { + $axis = $this->axis->right; + } + + return $axis; + + } + + protected function selectXAxis(){ + + // Select axis (bottom if possible, top otherwise) + if($this->isAxisUsed(awPlot::BOTTOM)) { + $axis = $this->axis->bottom; + } else { + $axis = $this->axis->top; + } + + return $axis; + + } + + protected function getXAxisNumber() { + $offset = $this->components[0]; + $max = $offset->getXAxisNumber(); + for($i = 1; $i < count($this->components); $i++) { + $offset = $this->components[$i]; + $max = max($max, $offset->getXAxisNumber()); + } + return $max; + } + +} + +registerClass('PlotGroup'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/ScatterPlot.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/ScatterPlot.class.php new file mode 100644 index 0000000000000000000000000000000000000000..ff5a4451237e3a3c50013d5c91c8689dfb58c303 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/ScatterPlot.class.php @@ -0,0 +1,303 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once dirname(__FILE__)."/Plot.class.php"; + +/** + * ScatterPlot + * + * @package Artichow + */ +class awScatterPlot extends awPlot implements awLegendable { + + /** + * Add marks to the scatter plot + * + * @var Mark + */ + public $mark; + + /** + * Labels on the plot + * + * @var Label + */ + public $label; + + /** + * Link points ? + * + * @var bool + */ + protected $link = FALSE; + + /** + * Display impulses + * + * @var bool + */ + protected $impulse = NULL; + + /** + * Link NULL points ? + * + * @var bool + */ + protected $linkNull = FALSE; + + /** + * Line color + * + * @var Color + */ + protected $lineColor; + + /** + * Line type + * + * @var int + */ + protected $lineStyle = awLine::SOLID; + + /** + * Line thickness + * + * @var int + */ + protected $lineThickness = 1; + + /** + * Construct a new awScatterPlot + * + * @param array $datay Numeric values for Y axis + * @param array $datax Numeric values for X axis + * @param int $mode + */ + public function __construct($datay, $datax = NULL) { + + parent::__construct(); + + // Defaults marks + $this->mark = new awMark; + $this->mark->setType(awMark::CIRCLE); + $this->mark->setSize(7); + $this->mark->border->show(); + + $this->label = new awLabel; + + $this->setValues($datay, $datax); + $this->setColor(new awBlack); + + } + + /** + * Display plot as impulses + * + * @param awColor $impulse Impulses color (or NULL to disable impulses) + */ + public function setImpulse($color) { + $this->impulse = $color; + } + + /** + * Link scatter plot points + * + * @param bool $link + * @param awColor $color Line color (default to black) + */ + public function link($link, $color = NULL) { + $this->link = (bool)$link; + if($color instanceof awColor) { + $this->setColor($color); + } + } + + /** + * Ignore null values for Y data and continue linking + * + * @param bool $link + */ + public function linkNull($link) { + $this->linkNull = (bool)$link; + } + + /** + * Change line color + * + * @param awColor $color + */ + public function setColor(awColor $color) { + $this->lineColor = $color; + } + + /** + * Change line style + * + * @param int $style + */ + public function setStyle($style) { + $this->lineStyle = (int)$style; + } + + /** + * Change line tickness + * + * @param int $tickness + */ + public function setThickness($tickness) { + $this->lineThickness = (int)$tickness; + } + + /** + * Get the line thickness + * + * @return int + */ + public function getLegendLineThickness() { + return $this->lineThickness; + } + + /** + * Get the line type + * + * @return int + */ + public function getLegendLineStyle() { + return $this->lineStyle; + } + + /** + * Get the color of line + * + * @return Color + */ + public function getLegendLineColor() { + return $this->lineColor; + } + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + public function getLegendBackground() { + return NULL; + } + + /** + * Get a mark object + * + * @return Mark + */ + public function getLegendMark() { + return $this->mark; + } + + public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing) { + + $count = count($this->datay); + + // Get start and stop values + list($start, $stop) = $this->getLimit(); + + // Build the polygon + $polygon = new awPolygon; + + for($key = 0; $key < $count; $key++) { + + $x = $this->datax[$key]; + $y = $this->datay[$key]; + + if($y !== NULL) { + $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($x, $y)); + $polygon->set($key, $p); + } else if($this->linkNull === FALSE) { + $polygon->set($key, NULL); + } + + } + + // Link points if needed + if($this->link) { + + $prev = NULL; + + foreach($polygon->all() as $point) { + + if($prev !== NULL and $point !== NULL) { + $drawer->line( + $this->lineColor, + new awLine( + $prev, + $point, + $this->lineStyle, + $this->lineThickness + ) + ); + } + $prev = $point; + + } + + $this->lineColor->free(); + + } + + // Draw impulses + if($this->impulse instanceof awColor) { + + foreach($polygon->all() as $key => $point) { + + if($point !== NULL) { + + $zero = awAxis::toPosition( + $this->xAxis, + $this->yAxis, + new awPoint($key, 0) + ); + + $drawer->line( + $this->impulse, + new awLine( + $zero, + $point, + awLine::SOLID, + 1 + ) + ); + + } + + } + + } + + // Draw marks and labels + foreach($polygon->all() as $key => $point) { + + $this->mark->draw($drawer, $point); + $this->label->draw($drawer, $point, $key); + + } + + } + + protected function xAxisPoint($position) { + $y = $this->xAxisZero ? 0 : $this->getRealYMin(); + return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); + } + + public function getXCenter() { + return FALSE; + } + +} + +registerClass('ScatterPlot'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/common.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/common.php new file mode 100644 index 0000000000000000000000000000000000000000..79ccbc49e50b78a56be52b700aacbe184f50a756 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/common.php @@ -0,0 +1,112 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* + * Get the minimum of an array and ignore non numeric values + */ +function array_min($array) { + + if(is_array($array) and count($array) > 0) { + + do { + $min = array_pop($array); + if(is_numeric($min === FALSE)) { + $min = NULL; + } + } while(count($array) > 0 and $min === NULL); + + if($min !== NULL) { + $min = (float)$min; + } + + foreach($array as $value) { + if(is_numeric($value) and (float)$value < $min) { + $min = (float)$value; + } + } + + return $min; + + } + + return NULL; + +} + +/* + * Get the maximum of an array and ignore non numeric values + */ +function array_max($array) { + + if(is_array($array) and count($array) > 0) { + + do { + $max = array_pop($array); + if(is_numeric($max === FALSE)) { + $max = NULL; + } + } while(count($array) > 0 and $max === NULL); + + if($max !== NULL) { + $max = (float)$max; + } + + foreach($array as $value) { + if(is_numeric($value) and (float)$value > $max) { + $max = (float)$value; + } + } + + return $max; + + } + + return NULL; + +} + +/* + * Register a class with the prefix in configuration file + */ +function registerClass($class, $abstract = FALSE) { + + if(ARTICHOW_PREFIX === 'aw') { + return; + } + + /* <php5> */ + if($abstract) { + $abstract = 'abstract'; + } else { + $abstract = ''; + } + /* </php5> */ + /* <php4> -- + $abstract = ''; + -- </php4> */ + + eval($abstract." class ".ARTICHOW_PREFIX.$class." extends aw".$class." { }"); + +} + +/* + * Register an interface with the prefix in configuration file + */ +function registerInterface($interface) { + + if(ARTICHOW_PREFIX === 'aw') { + return; + } + + /* <php5> */ + eval("interface ".ARTICHOW_PREFIX.$interface." extends aw".$interface." { }"); + /* </php5> */ + +} +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Axis.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Axis.class.php new file mode 100644 index 0000000000000000000000000000000000000000..43363f08534b97dc50a132aa6b1f6051435d0073 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Axis.class.php @@ -0,0 +1,790 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Handle axis + * + * @package Artichow + */ +class awAxis { + + /** + * Axis line + * + * @var Line + */ + public $line; + + /** + * Axis labels + * + * @var Label + */ + public $label; + + /** + * Axis title + * + * @var Label + */ + public $title; + + /** + * Title position + * + * @var float + */ + protected $titlePosition = 0.5; + + /** + * Labels number + * + * @var int + */ + protected $labelNumber; + + /** + * Axis ticks + * + * @var array + */ + protected $ticks = array(); + + /** + * Axis and ticks color + * + * @var Color + */ + protected $color; + + /** + * Axis left and right padding + * + * @var Side + */ + protected $padding; + + /** + * Axis range + * + * @var array + */ + protected $range; + + /** + * Hide axis + * + * @var bool + */ + protected $hide = FALSE; + + /** + * Auto-scaling mode + * + * @var bool + */ + protected $auto = TRUE; + + /** + * Axis range callback function + * + * @var array + */ + protected $rangeCallback = array( + 'toValue' => 'toProportionalValue', + 'toPosition' => 'toProportionalPosition' + ); + + /** + * Build the axis + * + * @param float $min Begin of the range of the axis + * @param float $max End of the range of the axis + */ + public function __construct($min = NULL, $max = NULL) { + + $this->line = new awVector( + new awPoint(0, 0), + new awPoint(0, 0) + ); + + $this->label = new awLabel; + $this->padding = new awSide; + + $this->title = new awLabel( + NULL, + NULL, + NULL, + 0 + ); + + $this->setColor(new awBlack); + + if($min !== NULL and $max !== NULL) { + $this->setRange($min, $max); + } + + } + + /** + * Enable/disable auto-scaling mode + * + * @param bool $auto + */ + public function auto($auto) { + $this->auto = (bool)$auto; + } + + /** + * Get auto-scaling mode status + * + * @return bool + */ + public function isAuto() { + return $this->auto; + } + + /** + * Hide axis + * + * @param bool $hide + */ + public function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show axis + * + * @param bool $show + */ + public function show($show = TRUE) { + $this->hide = !(bool)$show; + } + + /** + * Return a tick object from its name + * + * @param string $name Tick object name + * @return Tick + */ + public function tick($name) { + /* <php5> */ + return array_key_exists($name, $this->ticks) ? $this->ticks[$name] : NULL; + /* </php5> */ + /* <php4> -- + if(array_key_exists($name, $this->ticks)) { + return $tick = &$this->ticks[$name]; + } else { + return NULL; + } + -- </php4> */ + } + + /** + * Add a tick object + * + * @param string $name Tick object name + * @param awTick $tick Tick object + */ + public function addTick($name, awTick $tick) { + /* <php5> */ + $this->ticks[$name] = $tick; + /* </php5> */ + /* <php4> -- + $this->ticks[$name] = &$tick; + -- </php4> */ + } + + /** + * Delete a tick object + * + * @param string $name Tick object name + */ + public function deleteTick($name) { + if(array_key_exists($name, $this->ticks)) { + unset($this->ticks[$name]); + } + } + + /** + * Hide all ticks + * + * @param bool $hide Hide or not ? + */ + public function hideTicks($hide = TRUE) { + /* <php5> */ + foreach($this->ticks as $tick) { + $tick->hide($hide); + } + /* </php5> */ + /* <php4> -- + foreach($this->ticks as $key => $tick) { + $this->ticks[$key]->hide($hide); + } + -- </php4> */ + } + + /** + * Change ticks style + * + * @param int $style Ticks style + */ + public function setTickStyle($style) { + /* <php5> */ + foreach($this->ticks as $tick) { + $tick->setStyle($style); + } + /* </php5> */ + /* <php4> -- + foreach($this->ticks as $key => $tick) { + $this->ticks[$key]->setStyle($style); + } + -- </php4> */ + } + + /** + * Change ticks interval + * + * @param int $interval Ticks interval + */ + public function setTickInterval($interval) { + /* <php5> */ + foreach($this->ticks as $tick) { + $tick->setInterval($interval); + } + /* </php5> */ + /* <php4> -- + foreach($this->ticks as $key => $tick) { + $this->ticks[$key]->setInterval($interval); + } + -- </php4> */ + } + + /** + * Change number of ticks relative to others ticks + * + * @param awTick $to Change number of theses ticks + * @param awTick $from Ticks reference + * @param float $number Number of ticks by the reference + */ + public function setNumberByTick($to, $from, $number) { + $this->ticks[$to]->setNumberByTick($this->ticks[$from], $number); + } + + /** + * Reverse ticks style + */ + public function reverseTickStyle() { + /* <php5> */ + foreach($this->ticks as $tick) { + if($tick->getStyle() === awTick::IN) { + $tick->setStyle(awTick::OUT); + } else if($tick->getStyle() === awTick::OUT) { + $tick->setStyle(awTick::IN); + } + } + /* </php5> */ + /* <php4> -- + foreach($this->ticks as $key => $tick) { + if($this->ticks[$key]->getStyle() === awTick::IN) { + $this->ticks[$key]->setStyle(awTick::OUT); + } else if($this->ticks[$key]->getStyle() === awTick::OUT) { + $this->ticks[$key]->setStyle(awTick::IN); + } + } + -- </php4> */ + } + + /** + * Change interval of labels + * + * @param int $interval Interval + */ + public function setLabelInterval($interval) { + $this->auto(FALSE); + $this->setTickInterval($interval); + $this->label->setInterval($interval); + } + + /** + * Change number of labels + * + * @param int $number Number of labels to display (can be NULL) + */ + public function setLabelNumber($number) { + $this->auto(FALSE); + $this->labelNumber = is_null($number) ? NULL : (int)$number; + } + + /** + * Get number of labels + * + * @return int + */ + public function getLabelNumber() { + return $this->labelNumber; + } + + /** + * Change precision of labels + * + * @param int $precision Precision + */ + public function setLabelPrecision($precision) { + $this->auto(FALSE); + $function = 'axis'.time().'_'.(microtime() * 1000000); + eval('function '.$function.'($value) { + return sprintf("%.'.(int)$precision.'f", $value); + }'); + $this->label->setCallbackFunction($function); + } + + /** + * Change text of labels + * + * @param array $texts Some texts + */ + public function setLabelText($texts) { + if(is_array($texts)) { + $this->auto(FALSE); + $function = 'axis'.time().'_'.(microtime() * 1000000); + eval('function '.$function.'($value) { + $texts = '.var_export($texts, TRUE).'; + return $texts[$value]; + }'); + $this->label->setCallbackFunction($function); + } + } + + /** + * Get the position of a point + * + * @param awAxis $xAxis X axis + * @param awAxis $yAxis Y axis + * @param awPoint $p Position of the point + * @return Point Position on the axis + */ + public static function toPosition(awAxis $xAxis, awAxis $yAxis, awPoint $p) { + + $p1 = $xAxis->getPointFromValue($p->x); + $p2 = $yAxis->getPointFromValue($p->y); + + return new awPoint( + round($p1->x), + round($p2->y) + ); + + } + + /** + * Change title alignment + * + * @param int $alignment New Alignment + */ + public function setTitleAlignment($alignment) { + + switch($alignment) { + + case awLabel::TOP : + $this->setTitlePosition(1); + $this->title->setAlign(NULL, awLabel::BOTTOM); + break; + + case awLabel::BOTTOM : + $this->setTitlePosition(0); + $this->title->setAlign(NULL, awLabel::TOP); + break; + + case awLabel::LEFT : + $this->setTitlePosition(0); + $this->title->setAlign(awLabel::LEFT); + break; + + case awLabel::RIGHT : + $this->setTitlePosition(1); + $this->title->setAlign(awLabel::RIGHT); + break; + + } + + } + + /** + * Change title position on the axis + * + * @param float $position A new awposition between 0 and 1 + */ + public function setTitlePosition($position) { + $this->titlePosition = (float)$position; + } + + /** + * Change axis and axis title color + * + * @param awColor $color + */ + public function setColor(awColor $color) { + $this->color = $color; + $this->title->setColor($color); + } + + /** + * Change axis padding + * + * @param int $left Left padding in pixels + * @param int $right Right padding in pixels + */ + public function setPadding($left, $right) { + $this->padding->set($left, $right); + } + + /** + * Get axis padding + * + * @return Side + */ + public function getPadding() { + return $this->padding; + } + + /** + * Change axis range + * + * @param float $min + * @param float $max + */ + public function setRange($min, $max) { + if($min !== NULL) { + $this->range[0] = (float)$min; + } + if($max !== NULL) { + $this->range[1] = (float)$max; + } + } + + /** + * Get axis range + * + * @return array + */ + public function getRange() { + return $this->range; + } + + /** + * Change axis range callback function + * + * @param string $toValue Transform a position between 0 and 1 to a value + * @param string $toPosition Transform a value to a position between 0 and 1 on the axis + */ + public function setRangeCallback($toValue, $toPosition) { + $this->rangeCallback = array( + 'toValue' => (string)$toValue, + 'toPosition' => (string)$toPosition + ); + } + + /** + * Center X values of the axis + * + * @param awAxis $axis An axis + * @param float $value The reference value on the axis + */ + public function setXCenter(awAxis $axis, $value) { + + // Check vector angle + if($this->line->isVertical() === FALSE) { + trigger_error("setXCenter() can only be used on vertical axes", E_USER_ERROR); + } + + $p = $axis->getPointFromValue($value); + + $this->line->setX( + $p->x, + $p->x + ); + + } + + /** + * Center Y values of the axis + * + * @param awAxis $axis An axis + * @param float $value The reference value on the axis + */ + public function setYCenter(awAxis $axis, $value) { + + // Check vector angle + if($this->line->isHorizontal() === FALSE) { + trigger_error("setYCenter() can only be used on horizontal axes", E_USER_ERROR); + } + + $p = $axis->getPointFromValue($value); + + $this->line->setY( + $p->y, + $p->y + ); + + } + + /** + * Get the distance between to values on the axis + * + * @param float $from The first value + * @param float $to The last value + * @return Point + */ + public function getDistance($from, $to) { + + $p1 = $this->getPointFromValue($from); + $p2 = $this->getPointFromValue($to); + + return $p1->getDistance($p2); + + } + + /** + * Get a point on the axis from a value + * + * @param float $value + * @return Point + */ + protected function getPointFromValue($value) { + + $callback = $this->rangeCallback['toPosition']; + + list($min, $max) = $this->range; + $position = $callback($value, $min, $max); + + return $this->getPointFromPosition($position); + + } + + /** + * Get a point on the axis from a position + * + * @param float $position A position between 0 and 1 + * @return Point + */ + protected function getPointFromPosition($position) { + + $vector = $this->getVector(); + + $angle = $vector->getAngle(); + $size = $vector->getSize(); + + return $vector->p1->move( + cos($angle) * $size * $position, + -1 * sin($angle) * $size * $position + ); + + } + + /** + * Draw axis + * + * @param awDrawer $drawer A drawer + */ + public function draw(awDrawer $drawer) { + + if($this->hide) { + return; + } + + $vector = $this->getVector(); + + // Draw axis ticks + $this->drawTicks($drawer, $vector); + + // Draw axis line + $this->line($drawer); + + // Draw labels + $this->drawLabels($drawer); + + // Draw axis title + $p = $this->getPointFromPosition($this->titlePosition); + $this->title->draw($drawer, $p); + + } + + public function autoScale() { + + if($this->isAuto() === FALSE) { + return; + } + + list($min, $max) = $this->getRange(); + $interval = $max - $min; + + $partMax = $max / $interval; + $partMin = $min / $interval; + + $difference = log($interval) / log(10); + $difference = floor($difference); + + $pow = pow(10, $difference); + + $intervalNormalize = $interval / $pow; + + if($difference <= 0) { + + $precision = $difference * -1 + 1; + + if($intervalNormalize > 2) { + $precision--; + } + + } else { + $precision = 0; + } + + if($min != 0 and $max != 0) { + $precision++; + } + + $this->setLabelPrecision($precision); + + if($intervalNormalize <= 1.5) { + $intervalReal = 1.5; + $labelNumber = 4; + } else if($intervalNormalize <= 2) { + $intervalReal = 2; + $labelNumber = 5; + } else if($intervalNormalize <= 3) { + $intervalReal = 3; + $labelNumber = 4; + } else if($intervalNormalize <= 4) { + $intervalReal = 4; + $labelNumber = 5; + } else if($intervalNormalize <= 5) { + $intervalReal = 5; + $labelNumber = 6; + } else if($intervalNormalize <= 8) { + $intervalReal = 8; + $labelNumber = 5; + } else if($intervalNormalize <= 10) { + $intervalReal = 10; + $labelNumber = 6; + } + + if($min == 0) { + + $this->setRange( + $min, + $intervalReal * $pow + ); + + } else if($max == 0) { + + $this->setRange( + $intervalReal * $pow * -1, + 0 + ); + + } + + $this->setLabelNumber($labelNumber); + + } + + protected function line(awDrawer $drawer) { + + $drawer->line( + $this->color, + $this->line + ); + + } + + protected function drawTicks(awDrawer $drawer, awVector $vector) { + + foreach($this->ticks as $tick) { + $tick->setColor($this->color); + $tick->draw($drawer, $vector); + } + + } + + protected function drawLabels($drawer) { + + if($this->labelNumber !== NULL) { + list($min, $max) = $this->range; + $number = $this->labelNumber - 1; + if($number < 1) { + return; + } + $function = $this->rangeCallback['toValue']; + $labels = array(); + for($i = 0; $i <= $number; $i++) { + $labels[] = $function($i / $number, $min, $max); + } + $this->label->set($labels); + } + + $labels = $this->label->count(); + + for($i = 0; $i < $labels; $i++) { + + $p = $this->getPointFromValue($this->label->get($i)); + $this->label->draw($drawer, $p, $i); + + } + + } + + protected function getVector() { + + $angle = $this->line->getAngle(); + + // Compute paddings + $vector = new awVector( + $this->line->p1->move( + cos($angle) * $this->padding->left, + -1 * sin($angle) * $this->padding->left + ), + $this->line->p2->move( + -1 * cos($angle) * $this->padding->right, + -1 * -1 * sin($angle) * $this->padding->right + ) + ); + + return $vector; + + } + + public function __clone() { + + $this->label = clone $this->label; + $this->line = clone $this->line; + $this->title = clone $this->title; + + foreach($this->ticks as $name => $tick) { + $this->ticks[$name] = clone $tick; + } + + } + +} + +registerClass('Axis'); + +function toProportionalValue($position, $min, $max) { + return $min + ($max - $min) * $position; +} + +function toProportionalPosition($value, $min, $max) { + if($max - $min == 0) { + return 0; + } + return ($value - $min) / ($max - $min); +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Border.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Border.class.php new file mode 100644 index 0000000000000000000000000000000000000000..be8d8be7389fb82b3bc4ecce781a279fe122bdb3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Border.class.php @@ -0,0 +1,158 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Draw border + * + * @package Artichow + */ +class awBorder { + + /** + * Border color + * + * @var Color + */ + protected $color; + + /** + * Hide border ? + * + * @var bool + */ + protected $hide = FALSE; + + /** + * Border line style + * + * @var int + */ + protected $style; + + /** + * Build the border + * + * @param awColor $color Border color + * @param int $style Border style + */ + public function __construct($color = NULL, $style = awLine::SOLID) { + + $this->setStyle($style); + + if($color instanceof awColor) { + $this->setColor($color); + } else { + $this->setColor(new awBlack); + } + + } + + /** + * Change border color + * This method automatically shows the border if it is hidden + * + * @param awColor $color + */ + public function setColor(awColor $color) { + $this->color = $color; + $this->show(); + } + + /** + * Change border style + * + * @param int $style + */ + public function setStyle($style) { + $this->style = (int)$style; + } + + /** + * Hide border ? + * + * @param bool $hide + */ + public function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show border ? + * + * @param bool $show + */ + public function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + /** + * Is the border visible ? + * + * @return bool + */ + public function visible() { + return !$this->hide; + } + + /** + * Draw border as a rectangle + * + * @param awDrawer $drawer + * @param awPoint $p1 Top-left corner + * @param awPoint $p2 Bottom-right corner + */ + public function rectangle(awDrawer $drawer, awPoint $p1, awPoint $p2) { + + // Border is hidden + if($this->hide) { + return; + } + + $line = new awLine; + $line->setStyle($this->style); + $line->setLocation($p1, $p2); + + $drawer->rectangle($this->color, $line); + + } + + /** + * Draw border as an ellipse + * + * @param awDrawer $drawer + * @param awPoint $center Ellipse center + * @param int $width Ellipse width + * @param int $height Ellipse height + */ + public function ellipse(awDrawer $drawer, awPoint $center, $width, $height) { + + // Border is hidden + if($this->hide) { + return; + } + + switch($this->style) { + + case awLine::SOLID : + $drawer->ellipse($this->color, $center, $width, $height); + break; + + default : + trigger_error("Dashed and dotted borders and not yet implemented on ellipses", E_USER_ERROR); + break; + + } + + + } + +} + +registerClass('Border'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Color.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Color.class.php new file mode 100644 index 0000000000000000000000000000000000000000..4b40dca4d0517e3f5ab03cd3e16432e176de3af3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Color.class.php @@ -0,0 +1,232 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Create your colors + * + * @package Artichow + */ +class awColor { + + public $red; + public $green; + public $blue; + public $alpha; + + private $resource; + private $color; + + /** + * Build your color + * + * @var int $red Red intensity (from 0 to 255) + * @var int $green Green intensity (from 0 to 255) + * @var int $blue Blue intensity (from 0 to 255) + * @var int $alpha Alpha channel (from 0 to 100) + */ + public function __construct($red, $green, $blue, $alpha = 0) { + + $this->red = (int)$red; + $this->green = (int)$green; + $this->blue = (int)$blue; + $this->alpha = (int)round($alpha * 127 / 100); + + } + + /** + * Return a GDised color + * + * @param resource $resource A GD resource + * @return int + */ + public function getColor($resource) { + + $this->resource = $resource; + + if($this->color === NULL) { + + if($this->alpha === 0 or function_exists('imagecolorallocatealpha') === FALSE) { + $this->color = imagecolorallocate($this->resource, $this->red, $this->green, $this->blue); + } else { + $this->color = imagecolorallocatealpha($this->resource, $this->red, $this->green, $this->blue, $this->alpha); + } + + } + + return $this->color; + + } + + /** + * Change color brightness + * + * @param int $brightness Add this intensity to the color (betweeen -255 and +255) + */ + public function brightness($brightness) { + + $brightness = (int)$brightness; + + $this->red = min(255, max(0, $this->red + $brightness)); + $this->green = min(255, max(0, $this->green + $brightness)); + $this->blue = min(255, max(0, $this->blue + $brightness)); + + } + + /** + * Get RGB and alpha values of your color + * + * @return array + */ + public function rgba() { + + return array($this->red, $this->green, $this->blue, $this->alpha); + + } + + /** + * Free resources used for this color + */ + public function free() { + + if($this->resource !== NULL) { + + @imagecolordeallocate($this->resource, $this->color); + $this->resource = NULL; + + } + + } + + public function __destruct() { + + $this->free(); + + } + +} + +registerClass('Color'); + +$colors = array( + 'Black' => array(0, 0, 0), + 'AlmostBlack' => array(48, 48, 48), + 'VeryDarkGray' => array(88, 88, 88), + 'DarkGray' => array(128, 128, 128), + 'MidGray' => array(160, 160, 160), + 'LightGray' => array(195, 195, 195), + 'VeryLightGray' => array(220, 220, 220), + 'White' => array(255, 255, 255), + 'VeryDarkRed' => array(64, 0, 0), + 'DarkRed' => array(128, 0, 0), + 'MidRed' => array(192, 0, 0), + 'Red' => array(255, 0, 0), + 'LightRed' => array(255, 192, 192), + 'VeryDarkGreen' => array(0, 64, 0), + 'DarkGreen' => array(0, 128, 0), + 'MidGreen' => array(0, 192, 0), + 'Green' => array(0, 255, 0), + 'LightGreen' => array(192, 255, 192), + 'VeryDarkBlue' => array(0, 0, 64), + 'DarkBlue' => array(0, 0, 128), + 'MidBlue' => array(0, 0, 192), + 'Blue' => array(0, 0, 255), + 'LightBlue' => array(192, 192, 255), + 'VeryDarkYellow' => array(64, 64, 0), + 'DarkYellow' => array(128, 128, 0), + 'MidYellow' => array(192, 192, 0), + 'Yellow' => array(255, 255, 2), + 'LightYellow' => array(255, 255, 192), + 'VeryDarkCyan' => array(0, 64, 64), + 'DarkCyan' => array(0, 128, 128), + 'MidCyan' => array(0, 192, 192), + 'Cyan' => array(0, 255, 255), + 'LightCyan' => array(192, 255, 255), + 'VeryDarkMagenta' => array(64, 0, 64), + 'DarkMagenta' => array(128, 0, 128), + 'MidMagenta' => array(192, 0, 192), + 'Magenta' => array(255, 0, 255), + 'LightMagenta' => array(255, 192, 255), + 'DarkOrange' => array(192, 88, 0), + 'Orange' => array(255, 128, 0), + 'LightOrange' => array(255, 168, 88), + 'VeryLightOrange' => array(255, 220, 168), + 'DarkPink' => array(192, 0, 88), + 'Pink' => array(255, 0, 128), + 'LightPink' => array(255, 88, 168), + 'VeryLightPink' => array(255, 168, 220), + 'DarkPurple' => array(88, 0, 192), + 'Purple' => array(128, 0, 255), + 'LightPurple' => array(168, 88, 255), + 'VeryLightPurple' => array(220, 168, 255), +); + +/* <php5> */ + +$php = ''; + +foreach($colors as $name => $color) { + + list($red, $green, $blue) = $color; + + $php .= ' + class aw'.$name.' extends awColor { + + public function __construct($alpha = 0) { + parent::__construct('.$red.', '.$green.', '.$blue.', $alpha); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.$name.' extends aw'.$name.' { + + } + '; + } + +} + +eval($php); + +/* </php5> */ +/* <php4> -- + +$php = ''; + +foreach($colors as $name => $color) { + + list($red, $green, $blue) = $color; + + $php .= ' + class aw'.$name.' extends awColor { + + function aw'.$name.'($alpha = 0) { + parent::awColor('.$red.', '.$green.', '.$blue.', $alpha); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.$name.' extends aw'.$name.' { + + } + '; + } + +} + +eval($php); + +-- </php4> */ + +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Drawer.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Drawer.class.php new file mode 100644 index 0000000000000000000000000000000000000000..42acf2199de7d0c72a69817b66c7d57d49c4c449 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Drawer.class.php @@ -0,0 +1,1127 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Draw your objects + * + * @package Artichow + */ +class awDrawer { + + /** + * A GD resource + * + * @var $resource + */ + public $resource; + + /** + * Image width + * + * @var int + */ + public $width; + + /** + * Image height + * + * @var int + */ + public $height; + + /** + * Drawer X position + * + * @var int + */ + public $x; + + /** + * Drawer Y position + * + * @var int + */ + public $y; + + private $w; + private $h; + + /** + * Build your drawer + * + * @var resource $resource A GD resource + */ + public function __construct($resource) { + + $this->resource = $resource; + + } + + /** + * Change the image size + * + * @param int $width Image width + * @param int $height Image height + */ + public function setImageSize($width, $height) { + + $this->width = $width; + $this->height = $height; + + } + + /** + * Inform the drawer of the position of your image + * + * @param float $x Position on X axis of the center of the component + * @param float $y Position on Y axis of the center of the component + */ + public function setPosition($x, $y) { + + // Calcul absolute position + $this->x = round($x * $this->width - $this->w / 2); + $this->y = round($y * $this->height - $this->h / 2); + + } + + /** + * Inform the drawer of the position of your image + * This method need absolutes values + * + * @param int $x Left-top corner X position + * @param int $y Left-top corner Y position + */ + public function setAbsPosition($x, $y) { + + $this->x = $x; + $this->y = $y; + + } + + /** + * Move the position of the image + * + * @param int $x Add this value to X axis + * @param int $y Add this value to Y axis + */ + public function movePosition($x, $y) { + + $this->x += (int)$x; + $this->y += (int)$y; + + } + + /** + * Inform the drawer of the size of your image + * Height and width must be between 0 and 1. + * + * @param int $w Image width + * @param int $h Image height + * @return array Absolute width and height of the image + */ + public function setSize($w, $h) { + + // Calcul absolute size + $this->w = round($w * $this->width); + $this->h = round($h * $this->height); + + return $this->getSize(); + + } + + /** + * Inform the drawer of the size of your image + * You can set absolute size with this method. + * + * @param int $w Image width + * @param int $h Image height + */ + public function setAbsSize($w, $h) { + + $this->w = $w; + $this->h = $h; + + return $this->getSize(); + + } + + /** + * Get the size of the component handled by the drawer + * + * @return array Absolute width and height of the component + */ + public function getSize() { + + return array($this->w, $this->h); + + } + + /** + * Draw an image here + * + * @param awImage $image Image + * @param int $p1 Image top-left point + * @param int $p2 Image bottom-right point + */ + public function copyImage(awImage $image, awPoint $p1, awPoint $p2) { + + list($x1, $y1) = $p1->getLocation(); + list($x2, $y2) = $p2->getLocation(); + + $drawer = $image->getDrawer(); + imagecopy($this->resource, $drawer->resource, $this->x + $x1, $this->y + $y1, 0, 0, $x2 - $x1, $y2 - $y1); + + } + + /** + * Draw an image here + * + * @param awImage $image Image + * @param int $d1 Destination top-left position + * @param int $d2 Destination bottom-right position + * @param int $s1 Source top-left position + * @param int $s2 Source bottom-right position + * @param bool $resample Resample image ? (default to TRUE) + */ + public function copyResizeImage(awImage $image, awPoint $d1, awPoint $d2, awPoint $s1, awPoint $s2, $resample = TRUE) { + + if($resample) { + $function = 'imagecopyresampled'; + } else { + $function = 'imagecopyresized'; + } + + $drawer = $image->getDrawer(); + + $function( + $this->resource, + $drawer->resource, + $this->x + $d1->x, $this->y + $d1->y, + $s1->x, $s1->y, + $d2->x - $d1->x, $d2->y - $d1->y, + $s2->x - $s1->x, $s2->y - $s1->y + ); + + } + + /** + * Draw a string + * + * @var awText $text Text to print + * @param awPoint $point Draw the text at this point + */ + public function string(awText $text, awPoint $point) { + + $font = $text->getFont(); + + if($text->getBackground() !== NULL or $text->border->visible()) { + + list($left, $right, $top, $bottom) = $text->getPadding(); + + $width = $font->getTextWidth($text); + $height = $font->getTextHeight($text); + + $x1 = floor($point->x - $left); + $y1 = floor($point->y - $top); + $x2 = $x1 + $width + $left + $right; + $y2 = $y1 + $height + $top + $bottom; + + $this->filledRectangle( + $text->getBackground(), + awLine::build($x1, $y1, $x2, $y2) + ); + + $text->border->rectangle( + $this, + new awPoint($x1 - 1, $y1 - 1), + new awPoint($x2 + 1, $y2 + 1) + ); + + } + + $font->draw($this, $point, $text); + + } + + /** + * Draw a pixel + * + * @param awColor $color Pixel color + * @param awPoint $p + */ + public function point(awColor $color, awPoint $p) { + + if($p->isHidden() === FALSE) { + $rgb = $color->getColor($this->resource); + imagesetpixel($this->resource, $this->x + round($p->x), $this->y + round($p->y), $rgb); + } + + } + + /** + * Draw a colored line + * + * @param awColor $color Line color + * @param awLine $line + * @param int $thickness Line tickness + */ + public function line(awColor $color, awLine $line) { + + if($line->thickness > 0 and $line->isHidden() === FALSE) { + + $rgb = $color->getColor($this->resource); + $thickness = $line->thickness; + + list($p1, $p2) = $line->getLocation(); + + $this->startThickness($thickness); + + switch($line->getStyle()) { + + case awLine::SOLID : + imageline($this->resource, $this->x + round($p1->x), $this->y + round($p1->y), $this->x + round($p2->x), $this->y + round($p2->y), $rgb); + break; + + case awLine::DOTTED : + $size = sqrt(pow($p2->y - $p1->y, 2) + pow($p2->x - $p1->x, 2)); + $cos = ($p2->x - $p1->x) / $size; + $sin = ($p2->y - $p1->y) / $size; + for($i = 0; $i <= $size; $i += 2) { + $p = new awPoint( + round($i * $cos + $p1->x), + round($i * $sin + $p1->y) + ); + $this->point($color, $p); + } + break; + + case awLine::DASHED : + $width = $p2->x - $p1->x; + $height = $p2->y - $p1->y; + $size = sqrt(pow($height, 2) + pow($width, 2)); + + if($size == 0) { + return; + } + + $cos = $width / $size; + $sin = $height / $size; + + for($i = 0; $i <= $size; $i += 6) { + + $t1 = new awPoint( + round($i * $cos + $p1->x), + round($i * $sin + $p1->y) + ); + + $function = ($height > 0) ? 'min' : 'max'; + $t2 = new awPoint( + round(min(($i + 3) * $cos, $width) + $p1->x), + round($function(($i + 3) * $sin, $height) + $p1->y) + ); + + $this->line($color, new awLine($t1, $t2)); + + } + break; + + } + + $this->stopThickness($thickness); + + } + + } + + /** + * Draw a color arc + + * @param awColor $color Arc color + * @param awPoint $center Point center + * @param int $width Ellipse width + * @param int $height Ellipse height + * @param int $from Start angle + * @param int $to End angle + */ + public function arc(awColor $color, awPoint $center, $width, $height, $from, $to) { + + imagefilledarc( + $this->resource, + $this->x + $center->x, $this->y + $center->y, + $width, $height, + $from, $to, + $color->getColor($this->resource), + IMG_ARC_EDGED | IMG_ARC_NOFILL + ); + + } + + /** + * Draw an arc with a background color + * + * @param awColor $color Arc background color + * @param awPoint $center Point center + * @param int $width Ellipse width + * @param int $height Ellipse height + * @param int $from Start angle + * @param int $to End angle + */ + public function filledArc(awColor $color, awPoint $center, $width, $height, $from, $to) { + + imagefilledarc( + $this->resource, + $this->x + $center->x, $this->y + $center->y, + $width, $height, + $from, $to, + $color->getColor($this->resource), + IMG_ARC_PIE + ); + + } + + /** + * Draw a colored ellipse + * + * @param awColor $color Ellipse color + * @param awPoint $center Ellipse center + * @param int $width Ellipse width + * @param int $height Ellipse height + */ + public function ellipse(awColor $color, awPoint $center, $width, $height) { + + list($x, $y) = $center->getLocation(); + + $rgb = $color->getColor($this->resource); + imageellipse( + $this->resource, + $this->x + $x, + $this->y + $y, + $width, + $height, + $rgb + ); + + } + + /** + * Draw an ellipse with a background + * + * @param mixed $background Background (can be a color or a gradient) + * @param awPoint $center Ellipse center + * @param int $width Ellipse width + * @param int $height Ellipse height + */ + public function filledEllipse($background, awPoint $center, $width, $height) { + + if($background instanceof awColor) { + + list($x, $y) = $center->getLocation(); + + $rgb = $background->getColor($this->resource); + + imagefilledellipse( + $this->resource, + $this->x + $x, + $this->y + $y, + $width, + $height, + $rgb + ); + + } else if($background instanceof awGradient) { + + list($x, $y) = $center->getLocation(); + + $x1 = $x - round($width / 2); + $y1 = $y - round($height / 2); + $x2 = $x1 + $width; + $y2 = $y1 + $height; + + $gradientDrawer = new awGradientDrawer($this); + $gradientDrawer->filledEllipse( + $background, + $x1, $y1, + $x2, $y2 + ); + + } + + } + + /** + * Draw a colored rectangle + * + * @param awColor $color Rectangle color + * @param awLine $line Rectangle diagonale + * @param awPoint $p2 + */ + public function rectangle(awColor $color, awLine $line) { + + $p1 = $line->p1; + $p2 = $line->p2; + + switch($line->getStyle()) { + + case awLine::SOLID : + $thickness = $line->getThickness(); + $this->startThickness($thickness); + $rgb = $color->getColor($this->resource); + imagerectangle($this->resource, $this->x + $p1->x, $this->y + $p1->y, $this->x + $p2->x, $this->y + $p2->y, $rgb); + $this->stopThickness($thickness); + break; + + default : + + // Top side + $line->setLocation( + new awPoint($p1->x, $p1->y), + new awPoint($p2->x, $p1->y) + ); + $this->line($color, $line); + + // Right side + $line->setLocation( + new awPoint($p2->x, $p1->y), + new awPoint($p2->x, $p2->y) + ); + $this->line($color, $line); + + // Bottom side + $line->setLocation( + new awPoint($p1->x, $p2->y), + new awPoint($p2->x, $p2->y) + ); + $this->line($color, $line); + + // Left side + $line->setLocation( + new awPoint($p1->x, $p1->y), + new awPoint($p1->x, $p2->y) + ); + $this->line($color, $line); + + break; + + } + + } + + /** + * Draw a rectangle with a background + * + * @param mixed $background Background (can be a color or a gradient) + * @param awLine $line Rectangle diagonale + */ + public function filledRectangle($background, awLine $line) { + + $p1 = $line->p1; + $p2 = $line->p2; + + if($background instanceof awColor) { + $rgb = $background->getColor($this->resource); + imagefilledrectangle($this->resource, $this->x + $p1->x, $this->y + $p1->y, $this->x + $p2->x, $this->y + $p2->y, $rgb); + } else if($background instanceof awGradient) { + $gradientDrawer = new awGradientDrawer($this); + $gradientDrawer->filledRectangle($background, $p1, $p2); + } + + } + + /** + * Draw a polygon + * + * @param awColor $color Polygon color + * @param Polygon A polygon + */ + public function polygon(awColor $color, awPolygon $polygon) { + + switch($polygon->getStyle()) { + + case awPolygon::SOLID : + $thickness = $line->getThickness(); + $this->startThickness($thickness); + $points = $this->getPolygonPoints($polygon); + $rgb = $color->getColor($this->resource); + imagepolygon($this->resource, $points, $polygon->count(), $rgb); + $this->stopThickness($thickness); + break; + + default : + + if($polygon->count() > 1) { + + $prev = $polygon->get(0); + + $line = new awLine; + $line->setStyle($polygon->getStyle()); + $line->setThickness($polygon->getThickness()); + + for($i = 1; $i < $polygon->count(); $i++) { + $current = $polygon->get($i); + $line->setLocation($prev, $current); + $this->line($color, $line); + $prev = $current; + } + + } + + } + + } + + /** + * Draw a polygon with a background + * + * @param mixed $background Background (can be a color or a gradient) + * @param Polygon A polygon + */ + public function filledPolygon($background, awPolygon $polygon) { + + if($background instanceof awColor) { + $points = $this->getPolygonPoints($polygon); + $rgb = $background->getColor($this->resource); + imagefilledpolygon($this->resource, $points, $polygon->count(), $rgb); + } else if($background instanceof awGradient) { + $gradientDrawer = new awGradientDrawer($this); + $gradientDrawer->filledPolygon($background, $polygon); + } + + } + + private function getPolygonPoints(awPolygon $polygon) { + + $points = array(); + + foreach($polygon->all() as $point) { + $points[] = $point->x + $this->x; + $points[] = $point->y + $this->y; + } + + return $points; + + } + + private function startThickness($thickness) { + + if($thickness > 1) { + + // Beurk :'( + imageantialias($this->resource, FALSE); + imagesetthickness($this->resource, $thickness); + + } + + } + + private function stopThickness($thickness) { + + if($thickness > 1) { + + imagesetthickness($this->resource, 1); + imageantialias($this->resource, TRUE); + + } + + } + + +} + +registerClass('Drawer'); + +/** + * To your gradients + * + * @package Artichow + */ + +class awGradientDrawer { + + /** + * A drawer + * + * @var Drawer + */ + protected $drawer; + + /** + * Build your GradientDrawer + * + * @var awDrawer $drawer + */ + public function __construct(awDrawer $drawer) { + + $this->drawer = $drawer; + + } + + public function drawFilledFlatTriangle(awGradient $gradient, awPoint $a, awPoint $b, awPoint $c) { + + if($gradient->angle !== 0) { + trigger_error("Flat triangles can only be used with 0 degree gradients", E_USER_ERROR); + } + + // Look for right-angled triangle + if($a->x !== $b->x and $b->x !== $c->x) { + trigger_error("Not right-angled flat triangles are not supported yet", E_USER_ERROR); + } + + if($a->x === $b->x) { + $d = $a; + $e = $c; + } else { + $d = $c; + $e = $a; + } + + $this->init($gradient, $b->y - $d->y); + + for($i = $c->y + 1; $i < $b->y; $i++) { + + $color = $this->color($i - $d->y); + $pos = ($i - $d->y) / ($b->y - $d->y); + + $p1 = new awPoint($e->x, $i); + $p2 = new awPoint(1 + floor($e->x - $pos * ($e->x - $d->x)), $i); + + $this->drawer->filledRectangle($color, new awLine($p1, $p2)); + + $color->free(); + unset($color); + + } + + } + + public function filledRectangle(awGradient $gradient, awPoint $p1, awPoint $p2) { + + list($x1, $y1) = $p1->getLocation(); + list($x2, $y2) = $p2->getLocation(); + + if($y1 < $y2) { + $y1 ^= $y2 ^= $y1 ^= $y2; + } + + if($x2 < $x1) { + $x1 ^= $x2 ^= $x1 ^= $x2; + } + + if($gradient instanceof awLinearGradient) { + $this->rectangleLinearGradient($gradient, new awPoint($x1, $y1), new awPoint($x2, $y2)); + } else { + trigger_error("This gradient is not supported by rectangles", E_USER_ERROR); + } + + } + + public function filledPolygon(awGradient $gradient, awPolygon $polygon) { + + if($gradient instanceof awLinearGradient) { + $this->polygonLinearGradient($gradient, $polygon); + } else { + trigger_error("This gradient is not supported by polygons", E_USER_ERROR); + } + + } + + protected function rectangleLinearGradient(awLinearGradient $gradient, awPoint $p1, awPoint $p2) { + + list($x1, $y1) = $p1->getLocation(); + list($x2, $y2) = $p2->getLocation(); + + if($y1 - $y2 > 0) { + + if($gradient->angle === 0) { + + $this->init($gradient, $y1 - $y2); + + for($i = $y2; $i <= $y1; $i++) { + + $color = $this->color($i - $y2); + + $p1 = new awPoint($x1, $i); + $p2 = new awPoint($x2, $i); + + $this->drawer->filledRectangle($color, new awLine($p1, $p2)); + + $color->free(); + unset($color); + + } + + } else if($gradient->angle === 90) { + + $this->init($gradient, $x2 - $x1); + + for($i = $x1; $i <= $x2; $i++) { + + $color = $this->color($i - $x1); + + $p1 = new awPoint($i, $y2); + $p2 = new awPoint($i, $y1); + + $this->drawer->filledRectangle($color, new awLine($p1, $p2)); + + $color->free(); + unset($color); + + } + + } + + } + + } + + public function filledEllipse(awGradient $gradient, $x1, $y1, $x2, $y2) { + + if($y1 < $y2) { + $y1 ^= $y2 ^= $y1 ^= $y2; + } + + if($x2 < $x1) { + $x1 ^= $x2 ^= $x1 ^= $x2; + } + + if($gradient instanceof awRadialGradient) { + $this->ellipseRadialGradient($gradient, $x1, $y1, $x2, $y2); + } else if($gradient instanceof awLinearGradient) { + $this->ellipseLinearGradient($gradient, $x1, $y1, $x2, $y2); + } else { + trigger_error("This gradient is not supported by ellipses", E_USER_ERROR); + } + + } + + protected function ellipseRadialGradient(awGradient $gradient, $x1, $y1, $x2, $y2) { + + if($y1 - $y2 > 0) { + + if($y1 - $y2 != $x2 - $x1) { + trigger_error("Radial gradients are only implemented on circle, not ellipses"); + } + + $c = new awPoint($x1 + ($x2 - $x1) / 2, $y1 + ($y2 - $y1) / 2); + $r = ($x2 - $x1) / 2; + $ok = array(); + + // Init gradient + $this->init($gradient, $r); + + for($i = 0; $i <= $r; $i += 0.45) { + + $p = ceil((2 * M_PI * $i)); + + if($p > 0) { + $interval = 360 / $p; + } else { + $interval = 360; + } + + $color = $this->color($i); + + for($j = 0; $j < 360; $j += $interval) { + + $rad = ($j / 360) * (2 * M_PI); + + $x = round($i * cos($rad)); + $y = round($i * sin($rad)); + + $l = sqrt($x * $x + $y * $y); + + if($l <= $r) { + + if( + array_key_exists((int)$x, $ok) === FALSE or + array_key_exists((int)$y, $ok[$x]) === FALSE + ) { + + // Print the point + $this->drawer->point($color, new awPoint($c->x + $x, $c->y + $y)); + + $ok[(int)$x][(int)$y] = TRUE; + + } + + } + + } + + $color->free(); + unset($color); + + } + + } + + } + + protected function ellipseLinearGradient(awGradient $gradient, $x1, $y1, $x2, $y2) { + + // Gauche->droite : 90° + + if($y1 - $y2 > 0) { + + if($y1 - $y2 != $x2 - $x1) { + trigger_error("Linear gradients are only implemented on circle, not ellipses"); + } + + $r = ($x2 - $x1) / 2; + + // Init gradient + $this->init($gradient, $x2 - $x1); + + for($i = -$r; $i <= $r; $i++) { + + $h = sin(acos($i / $r)) * $r; + + $color = $this->color($i + $r); + + if($gradient->angle === 90) { + + // Print the line + $p1 = new awPoint( + $x1 + $i + $r, + round(max($y2 + $r - $h + 1, $y2)) + ); + + $p2 = new awPoint( + $x1 + $i + $r, + round(min($y1 - $r + $h - 1, $y1)) + ); + + } else { + + // Print the line + $p1 = new awPoint( + round(max($x1 + $r - $h + 1, $x1)), + $y2 + $i + $r + ); + + $p2 = new awPoint( + round(min($x2 - $r + $h - 1, $x2)), + $y2 + $i + $r + ); + + } + + $this->drawer->filledRectangle($color, new awLine($p1, $p2)); + + $color->free(); + unset($color); + + } + + } + + } + + protected function polygonLinearGradient(awLinearGradient $gradient, awPolygon $polygon) { + + $count = $polygon->count(); + + if($count >= 3) { + + $left = $polygon->get(0); + $right = $polygon->get($count - 1); + + if($gradient->angle === 0) { + + // Get polygon maximum and minimum + $offset = $polygon->get(0); + $max = $min = $offset->y; + for($i = 1; $i < $count - 1; $i++) { + $offset = $polygon->get($i); + $max = max($max, $offset->y); + $min = min($min, $offset->y); + } + + $this->init($gradient, $max - $min); + + $prev = $polygon->get(1); + + $sum = 0; + + for($i = 2; $i < $count - 1; $i++) { + + $current = $polygon->get($i); + + $interval = 1; + + if($i !== $count - 2) { + $current->x -= $interval; + } + + if($current->x - $prev->x > 0) { + + // Draw rectangle + $x1 = $prev->x; + $x2 = $current->x; + $y1 = max($prev->y, $current->y); + $y2 = $left->y; + + $gradient = new awLinearGradient( + $this->color($max - $min - ($y2 - $y1)), + $this->color($max - $min), + 0 + ); + + if($y1 > $y2) { + $y2 = $y1; + } + + $this->drawer->filledRectangle( + $gradient, + awLine::build($x1, $y1, $x2, $y2) + ); + + $top = ($prev->y < $current->y) ? $current : $prev; + $bottom = ($prev->y >= $current->y) ? $current : $prev; + + $gradient = new awLinearGradient( + $this->color($bottom->y - $min), + $this->color($max - $min - ($y2 - $y1)), + 0 + ); + + + $gradientDrawer = new awGradientDrawer($this->drawer); + $gradientDrawer->drawFilledFlatTriangle( + $gradient, + new awPoint($prev->x, min($prev->y, $current->y)), + $top, + new awPoint($current->x, min($prev->y, $current->y)) + ); + unset($gradientDrawer); + + $sum += $current->x - $prev->x; + + } + + $prev = $current; + $prev->x += $interval; + + } + + } else if($gradient->angle === 90) { + + $width = $right->x - $left->x; + $this->init($gradient, $width); + + $pos = 1; + $next = $polygon->get($pos++); + + $this->next($polygon, $pos, $prev, $next); + + for($i = 0; $i <= $width; $i++) { + + $x = $left->x + $i; + + $y1 = round($prev->y + ($next->y - $prev->y) * (($i + $left->x - $prev->x) / ($next->x - $prev->x))); + $y2 = $left->y; + + // Draw line + $color = $this->color($i); + // YaPB : PHP does not handle alpha on lines + $this->drawer->filledRectangle($color, awLine::build($x, $y1, $x, $y2)); + $color->free(); + unset($color); + + // Jump to next point + if($next->x == $i + $left->x) { + + $this->next($polygon, $pos, $prev, $next); + + } + + } + + } + + } + + } + + private function next($polygon, &$pos, &$prev, &$next) { + + do { + $prev = $next; + $next = $polygon->get($pos++); + } + while($next->x - $prev->x == 0 and $pos < $polygon->count()); + + } + + /** + * Start colors + * + * @var int + */ + private $r1, $g1, $b1, $a1; + + /** + * Stop colors + * + * @var int + */ + private $r2, $g2, $b2, $a2; + + /** + * Gradient size in pixels + * + * @var int + */ + private $size; + + + private function init(awGradient $gradient, $size) { + + list( + $this->r1, $this->g1, $this->b1, $this->a1 + ) = $gradient->from->rgba(); + + list( + $this->r2, $this->g2, $this->b2, $this->a2 + ) = $gradient->to->rgba(); + + $this->size = $size; + } + + private function color($pos) { + + return new awColor( + $this->getRed($pos), + $this->getGreen($pos), + $this->getBlue($pos), + $this->getAlpha($pos) + ); + + } + + + private function getRed($pos) { + return (int)round($this->r1 + ($pos / $this->size) * ($this->r2 - $this->r1)); + } + + private function getGreen($pos) { + return (int)round($this->g1 + ($pos / $this->size) * ($this->g2 - $this->g1)); + } + + private function getBlue($pos) { + return (int)round($this->b1 + ($pos / $this->size) * ($this->b2 - $this->b1)); + } + + private function getAlpha($pos) { + return (int)round(($this->a1 + ($pos / $this->size) * ($this->a2 - $this->a1)) / 127 * 100); + } + +} + +registerClass('GradientDrawer'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Font.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Font.class.php new file mode 100644 index 0000000000000000000000000000000000000000..df503a256da269d5883b606442cc62ff85575021 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Font.class.php @@ -0,0 +1,348 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + +/** + * Built-in PHP fonts + * + * @package Artichow + */ +class awFont { + + /** + * Used font + * + * @param int $font + */ + public $font; + + /** + * Build the font + * + * @param int $font Font identifier + */ + public function __construct($font) { + + $this->font = $font; + + } + + /** + * Draw a text + * + * @param awDrawer $drawer + * @param awPoint $p Draw text at this point + * @param awText $text The text + */ + public function draw(awDrawer $drawer, awPoint $p, awText $text) { + + $angle = $text->getAngle(); + + if($angle !== 90 and $angle !== 0) { + trigger_error("You can only use 0° and 90°", E_USER_ERROR); + } + + if($angle === 90) { + $function = 'imagestringup'; + } else { + $function = 'imagestring'; + } + + if($angle === 90) { + $add = $this->getTextHeight($text); + } else { + $add = 0; + } + + $color = $text->getColor(); + $rgb = $color->getColor($drawer->resource); + + $function( + $drawer->resource, + $this->font, + $drawer->x + $p->x, + $drawer->y + $p->y + $add, + $text->getText(), + $rgb + ); + + } + + /** + * Get the width of a string + * + * @param awText $text A string + */ + public function getTextWidth(awText $text) { + + if($text->getAngle() === 90) { + $text->setAngle(45); + return $this->getTextHeight($text); + } else if($text->getAngle() === 45) { + $text->setAngle(90); + } + + $font = $text->getFont(); + $fontWidth = imagefontwidth($font->font); + + if($fontWidth === FALSE) { + trigger_error("Unable to get font size", E_USER_ERROR); + } + + return (int)$fontWidth * strlen($text->getText()); + + } + + /** + * Get the height of a string + * + * @param awText $text A string + */ + public function getTextHeight(awText $text) { + + if($text->getAngle() === 90) { + $text->setAngle(45); + return $this->getTextWidth($text); + } else if($text->getAngle() === 45) { + $text->setAngle(90); + } + + $font = $text->getFont(); + $fontHeight = imagefontheight($font->font); + + if($fontHeight === FALSE) { + trigger_error("Unable to get font size", E_USER_ERROR); + } + + return (int)$fontHeight; + + } + +} + +registerClass('Font'); + +/** + * TTF fonts + * + * @package Artichow + */ +class awTTFFont extends awFont { + + /** + * Font size + * + * @var int + */ + public $size; + + /** + * Font file + * + * @param string $font Font file + * @param int $size Font size + */ + public function __construct($font, $size) { + + parent::__construct($font); + + $this->size = (int)$size; + + } + + /** + * Draw a text + * + * @param awDrawer $drawer + * @param awPoint $p Draw text at this point + * @param awText $text The text + */ + public function draw(awDrawer $drawer, awPoint $p, awText $text) { + + // Make easier font positionment + $text->setText($text->getText()." "); + + $color = $text->getColor(); + $rgb = $color->getColor($drawer->resource); + + $box = imagettfbbox($this->size, $text->getAngle(), $this->font, $text->getText()); + + $height = - $box[5]; + + $box = imagettfbbox($this->size, 90, $this->font, $text->getText()); + $width = abs($box[6] - $box[2]); + + // Restore old text + $text->setText(substr($text->getText(), 0, strlen($text->getText()) - 1)); + + imagettftext( + $drawer->resource, + $this->size, + $text->getAngle(), + $drawer->x + $p->x + $width * sin($text->getAngle() / 180 * M_PI), + $drawer->y + $p->y + $height, + $rgb, + $this->font, + $text->getText() + ); + + } + + /** + * Get the width of a string + * + * @param awText $text A string + */ + public function getTextWidth(awText $text) { + + $box = imagettfbbox($this->size, $text->getAngle(), $this->font, $text->getText()); + + if($box === FALSE) { + trigger_error("Unable to get font size", E_USER_ERROR); + return; + } + + list(, , $x2, $y2, , , $x1, $y1) = $box; + + return abs($x2 - $x1); + + } + + /** + * Get the height of a string + * + * @param awText $text A string + */ + public function getTextHeight(awText $text) { + + $box = imagettfbbox($this->size, $text->getAngle(), $this->font, $text->getText()); + + if($box === FALSE) { + trigger_error("Unable to get font size", E_USER_ERROR); + return; + } + + list(, , $x2, $y2, , , $x1, $y1) = $box; + + return abs($y2 - $y1); + + } + +} + +registerClass('TTFFont'); + +/* <php5> */ + +$php = ''; + +for($i = 1; $i <= 5; $i++) { + + $php .= ' + class awFont'.$i.' extends awFont { + + public function __construct() { + parent::__construct('.$i.'); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.'Font'.$i.' extends awFont'.$i.' { + } + '; + } + +} + +eval($php); + +$php = ''; + +foreach($fonts as $font) { + + $php .= ' + class aw'.$font.' extends awTTFFont { + + public function __construct($size) { + parent::__construct(\''.(ARTICHOW_FONT.DIRECTORY_SEPARATOR.$font.'.ttf').'\', $size); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.$font.' extends aw'.$font.' { + } + '; + } + +} + +eval($php); + +/* </php5> */ +/* <php4> -- + +$php = ''; + +for($i = 1; $i <= 5; $i++) { + + $php .= ' + class awFont'.$i.' extends awFont { + + function awFont'.$i.'() { + parent::awFont('.$i.'); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.'Font'.$i.' extends awFont'.$i.' { + } + '; + } + +} + +eval($php); + +$php = ''; + +foreach($fonts as $font) { + + $php .= ' + class aw'.$font.' extends awTTFFont { + + function aw'.$font.'($size) { + parent::awTTFFont(\''.(ARTICHOW_FONT.DIRECTORY_SEPARATOR.$font.'.ttf').'\', $size); + } + + } + '; + + if(ARTICHOW_PREFIX !== 'aw') { + $php .= ' + class '.ARTICHOW_PREFIX.$font.' extends aw'.$font.' { + } + '; + } + +} + +eval($php); + +-- </php4> */ + +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Gradient.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Gradient.class.php new file mode 100644 index 0000000000000000000000000000000000000000..7cb69cca337c07c6bbe922a855f106b10ba608b0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Gradient.class.php @@ -0,0 +1,149 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + + +/** + * Create your gradients + * + * @package Artichow + */ +abstract class awGradient { + + /** + * From color + * + * @var Color + */ + public $from; + + /** + * To color + * + * @var Color + */ + public $to; + + /** + * Build the gradient + * + * @param awColor $from From color + * @param awColor $to To color + */ + public function __construct($from, $to) { + + $this->from = $from; + $this->to = $to; + + } + + /** + * Free memory used by the colors of the gradient + */ + public function free() { + + $this->from->free(); + $this->to->free(); + + } + + public function __destruct( ){ + + $this->free(); + + } + +} + +registerClass('Gradient', TRUE); + + +/** + * Create a linear gradient + * + * @package Artichow + */ +class awLinearGradient extends awGradient { + + /** + * Gradient angle + * + * @var int + */ + public $angle; + + /** + * Build the linear gradient + * + * @param awColor $from From color + * @param awColor $to To color + * @param int $angle Gradient angle + */ + public function __construct($from, $to, $angle) { + + parent::__construct( + $from, $to + ); + + $this->angle = $angle; + + } + +} + +registerClass('LinearGradient'); + + +/** + * Create a bilinear gradient + * + * @package Artichow + */ +class awBilinearGradient extends awLinearGradient { + + /** + * Gradient center + * + * @var int Center between 0 and 1 + */ + public $center; + + /** + * Build the bilinear gradient + * + * @param awColor $from From color + * @param awColor $to To color + * @param int $angle Gradient angle + * @param int $center Gradient center + */ + public function __construct($from, $to, $angle, $center = 0.5) { + + parent::__construct( + $from, $to, $angle + ); + + $this->center = $center; + + } + +} + +registerClass('BilinearGradient'); + +/** + * Create a radial gradient + * + * @package Artichow + */ +class awRadialGradient extends awGradient { + +} + +registerClass('RadialGradient'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Grid.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Grid.class.php new file mode 100644 index 0000000000000000000000000000000000000000..3517414bc90321ff0a8733bc093394464995f096 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Grid.class.php @@ -0,0 +1,289 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Grid + * + * @package Artichow + */ +class awGrid { + + /** + * Vertical lines of the grid + * + * @var array + */ + private $xgrid = array(); + + /** + * Horizontal lines of the grid + * + * @var array + */ + private $ygrid = array(); + + /** + * Is the component grid hidden ? + * + * @var bool + */ + private $hide = FALSE; + + /** + * Are horizontal lines hidden ? + * + * @var bool + */ + private $hideHorizontal = FALSE; + + /** + * Are vertical lines hidden ? + * + * @var bool + */ + private $hideVertical = FALSE; + + /** + * Grid color + * + * @var Color + */ + private $color; + + /** + * Grid space + * + * @var int + */ + private $space; + + /** + * Line type + * + * @var int + */ + private $type = awLine::SOLID; + + /** + * Grid interval + * + * @var int + */ + private $interval = array(1, 1); + + /** + * Grid background color + * + * @var Color + */ + private $background; + + /** + * Build the factory + */ + public function __construct() { + + // Set a grid default color + $this->color = new awColor(210, 210, 210); + $this->background = new awColor(255, 255, 255, 100); + + } + + /** + * Hide grid ? + * + * @param bool $hide + */ + public function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Hide horizontal lines ? + * + * @param bool $hideHorizontal + */ + public function hideHorizontal($hide = TRUE) { + $this->hideHorizontal = (bool)$hide; + } + + /** + * Hide vertical lines ? + * + * @param bool $hideVertical + */ + public function hideVertical($hide = TRUE) { + $this->hideVertical = (bool)$hide; + } + + /** + * Change grid color + * + * @param awColor $color + */ + public function setColor(awColor $color) { + $this->color = $color; + } + + /** + * Remove grid background + */ + public function setNoBackground() { + $this->background = NULL; + } + + /** + * Change grid background color + * + * @param awColor $color + */ + public function setBackgroundColor(awColor $color) { + $this->background = $color; + } + + /** + * Change line type + * + * @param int $type + */ + public function setType($type) { + $this->type = (int)$type; + } + + /** + * Change grid interval + * + * @param int $hInterval + * @param int $vInterval + */ + public function setInterval($hInterval, $vInterval) { + $this->interval = array((int)$hInterval, (int)$vInterval); + } + + /** + * Set grid space + * + * @param int $left Left space in pixels + * @param int $right Right space in pixels + * @param int $top Top space in pixels + * @param int $bottom Bottom space in pixels + */ + public function setSpace($left, $right, $top, $bottom) { + $this->space = array((int)$left, (int)$right, (int)$top, (int)$bottom); + } + + /** + * Change the current grid + * + * @param array $xgrid Vertical lines + * @param array $ygrid Horizontal lines + */ + public function setGrid($xgrid, $ygrid) { + + $this->xgrid = $xgrid; + $this->ygrid = $ygrid; + + } + + /** + * Draw grids + * + * @param awDrawer $drawer A drawer object + * @param int $x1 + * @param int $y1 + * @param int $x2 + * @param int $y2 + */ + public function draw(awDrawer $drawer, $x1, $y1, $x2, $y2) { + + if($this->background instanceof awColor) { + + // Draw background color + $drawer->filledRectangle( + $this->background, + awLine::build($x1, $y1, $x2, $y2) + ); + + $this->background->free(); + + } + + if($this->hide === FALSE) { + + $this->drawGrid( + $drawer, + $this->color, + $this->hideVertical ? array() : $this->xgrid, + $this->hideHorizontal ? array() : $this->ygrid, + $x1, $y1, $x2, $y2, + $this->type, + $this->space, + $this->interval[0], + $this->interval[1] + ); + + } + + $this->color->free(); + + } + + private function drawGrid( + awDrawer $drawer, awColor $color, + $nx, $ny, $x1, $y1, $x2, $y2, + $type, $space, $hInterval, $vInterval + ) { + + list($left, $right, $top, $bottom) = $space; + + $width = $x2 - $x1 - $left - $right; + $height = $y2 - $y1 - $top - $bottom; + + foreach($nx as $key => $n) { + + if(($key % $vInterval) === 0) { + + $pos = (int)round($x1 + $left + $n * $width); + $drawer->line( + $color, + new awLine( + new awPoint($pos, $y1), + new awPoint($pos, $y2), + $type + ) + ); + + } + + } + + foreach($ny as $key => $n) { + + if(($key % $hInterval) === 0) { + + $pos = (int)round($y1 + $top + $n * $height); + $drawer->line( + $color, + new awLine( + new awPoint($x1, $pos), + new awPoint($x2, $pos), + $type + ) + ); + + } + + } + + } + +} + +registerClass('Grid'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Label.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Label.class.php new file mode 100644 index 0000000000000000000000000000000000000000..04dd4381cf0522149bacffc9266c9eb4ec3316bc --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Label.class.php @@ -0,0 +1,596 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + +/* <php4> */ + +define("LABEL_LEFT", 1); +define("LABEL_RIGHT", 2); +define("LABEL_CENTER", 3); +define("LABEL_TOP", 4); +define("LABEL_BOTTOM", 5); +define("LABEL_MIDDLE", 6); + +/* </php4> */ + +/** + * Draw labels + * + * @package Artichow + */ +class awLabel implements awPositionable { + + /** + * Label border + * + * @var int + */ + public $border; + + /** + * Label texts + * + * @var array + */ + protected $texts; + + /** + * Text font + * + * @var int + */ + protected $font; + + /** + * Text angle + * + * @var int + */ + protected $angle = 0; + + /** + * Text color + * + * @var Color + */ + protected $color; + + /** + * Text background + * + * @var Color, Gradient + */ + private $background; + + /** + * Callback function + * + * @var string + */ + private $function; + + /** + * Padding + * + * @var int + */ + private $padding; + + /** + * Move position from this vector + * + * @var Point + */ + protected $move; + + /** + * Label interval + * + * @var int + */ + protected $interval = 1; + + /** + * Horizontal align + * + * @var int + */ + protected $hAlign = awLabel::CENTER; + + /** + * Vertical align + * + * @var int + */ + protected $vAlign = awLabel::MIDDLE; + + /** + * Hide all labels ? + * + * @var bool + */ + protected $hide = FALSE; + + /** + * Keys to hide + * + * @var array + */ + protected $hideKey = array(); + + /** + * Values to hide + * + * @var array + */ + protected $hideValue = array(); + + /** + * Hide first label + * + * @var bool + */ + protected $hideFirst = FALSE; + + /** + * Hide last label + * + * @var bool + */ + protected $hideLast = FALSE; + + /** + * Build the label + * + * @param string $label First label + */ + public function __construct($label = NULL, $font = NULL, $color = NULL, $angle = 0) { + + if(is_array($label)) { + $this->set($label); + } else if(is_string($label)) { + $this->set(array($label)); + } + + if($font === NULL) { + $font = new awFont2; + } + + $this->setFont($font); + $this->setAngle($angle); + + if($color instanceof awColor) { + $this->setColor($color); + } else { + $this->setColor(new awColor(0, 0, 0)); + } + + $this->move = new awPoint(0, 0); + + $this->border = new awBorder; + $this->border->hide(); + + } + + /** + * Get an element of the label from its key + * + * @param int $key Element key + * @return string A value + */ + public function get($key) { + return array_key_exists($key, $this->texts) ? $this->texts[$key] : NULL; + } + + /** + * Get all labels + * + * @return array + */ + public function all() { + return $this->texts; + } + + /** + * Set one or several labels + * + * @param array $labels Array of string or a string + */ + public function set($labels) { + + if(is_string($labels)) { + $this->texts = array($labels); + } else if(is_array($labels)) { + $this->texts = $labels; + } + + } + + /** + * Count number of texts in the label + * + * @return int + */ + public function count() { + return is_array($this->texts) ? count($this->texts) : 0; + } + + /** + * Set a callback function for labels + * + * @param string $function + */ + public function setCallbackFunction($function) { + $this->function = is_null($function) ? $function : (string)$function; + } + + /** + * Return the callback function for labels + * + * @return string + */ + public function getCallbackFunction() { + return $this->function; + } + + /** + * Change labels format + * + * @param string $format New format (printf style: %.2f for example) + */ + public function setFormat($format) { + $function = 'label'.time().'_'.(microtime() * 1000000); + eval('function '.$function.'($value) { + return sprintf("'.addcslashes($format, '"').'", $value); + }'); + $this->setCallbackFunction($function); + } + + /** + * Change font for label + * + * @param awFont $font New font + * @param awColor $color Font color (can be NULL) + */ + public function setFont(awFont $font, $color = NULL) { + $this->font = $font; + if($color instanceof awColor) { + $this->setColor($color); + } + } + + /** + * Change font angle + * + * @param int $angle New angle + */ + public function setAngle($angle) { + $this->angle = (int)$angle; + } + + /** + * Change font color + * + * @param awColor $color + */ + public function setColor($color) { + $this->color = $color; + } + + /** + * Change text background + * + * @param mixed $background + */ + public function setBackground($background) { + $this->background = $background; + } + + /** + * Change text background color + * + * @param Color + */ + public function setBackgroundColor(awColor $color) { + $this->background = $color; + } + + /** + * Change text background gradient + * + * @param Gradient + */ + public function setBackgroundGradient(awGradient $gradient) { + $this->background = $gradient; + } + + /** + * Change padding + * + * @param int $left Left padding + * @param int $right Right padding + * @param int $top Top padding + * @param int $bottom Bottom padding + */ + public function setPadding($left, $right, $top, $bottom) { + $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); + } + + /** + * Hide all labels ? + * + * @param bool $hide + */ + public function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show all labels ? + * + * @param bool $show + */ + public function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + /** + * Hide a key + * + * @param int $key The key to hide + */ + public function hideKey($key) { + $this->hideKey[$key] = TRUE; + } + + /** + * Hide a value + * + * @param int $value The value to hide + */ + public function hideValue($value) { + $this->hideValue[] = $value; + } + + /** + * Hide first label + * + * @param bool $hide + */ + public function hideFirst($hide) { + $this->hideFirst = (bool)$hide; + } + + /** + * Hide last label + * + * @param bool $hide + */ + public function hideLast($hide) { + $this->hideLast = (bool)$hide; + } + + /** + * Set label interval + * + * @param int + */ + public function setInterval($interval) { + + $this->interval = (int)$interval; + + } + + /** + * Change label position + * + * @param int $x Add this interval to X coord + * @param int $y Add this interval to Y coord + */ + public function move($x, $y) { + + $this->move = $this->move->move($x, $y); + + } + + /** + * Change alignment + * + * @param int $h Horizontal alignment + * @param int $v Vertical alignment + */ + public function setAlign($h = NULL, $v = NULL) { + if($h !== NULL) { + $this->hAlign = (int)$h; + } + if($v !== NULL) { + $this->vAlign = (int)$v; + } + } + + /** + * Get a text from the labele + * + * @param mixed $key Key in the array text + * @return Text + */ + public function getText($key) { + + if(is_array($this->texts) and array_key_exists($key, $this->texts)) { + + $value = $this->texts[$key]; + + if(is_string($this->function)) { + $value = call_user_func($this->function, $value); + } + + $text = new awText($value); + $text->setFont($this->font); + $text->setAngle($this->angle); + $text->setColor($this->color); + + if($this->background instanceof awColor) { + $text->setBackgroundColor($this->background); + } else if($this->background instanceof awGradient) { + $text->setBackgroundGradient($this->background); + } + + $text->border = $this->border; + + if($this->padding !== NULL) { + call_user_func_array(array($text, 'setPadding'), $this->padding); + } + + return $text; + + } else { + return NULL; + } + + } + + /** + * Get max width of all texts + * + * @param awDrawer $drawer A drawer + * @return int + */ + public function getMaxWidth(awDrawer $drawer) { + + return $this->getMax($drawer, 'getTextWidth'); + + } + + /** + * Get max height of all texts + * + * @param awDrawer $drawer A drawer + * @return int + */ + public function getMaxHeight(awDrawer $drawer) { + + return $this->getMax($drawer, 'getTextHeight'); + + } + + /** + * Draw the label + * + * @param awDrawer $drawer + * @param awPoint $p Label center + * @param int $key Text position in the array of texts (default to zero) + */ + public function draw(awDrawer $drawer, awPoint $p, $key = 0) { + + if(($key % $this->interval) !== 0) { + return; + } + + // Hide all labels + if($this->hide) { + return; + } + + // Key is hidden + if(array_key_exists($key, $this->hideKey)) { + return; + } + + // Hide first label + if($key === 0 and $this->hideFirst) { + return; + } + + // Hide last label + if($key === count($this->texts) - 1 and $this->hideLast) { + return; + } + + $text = $this->getText($key); + + if($text !== NULL) { + + // Value must be hidden + if(in_array($text->getText(), $this->hideValue)) { + return; + } + + $x = $p->x; + $y = $p->y; + + // Get padding + list($left, $right, $top, $bottom) = $text->getPadding(); + + $font = $text->getFont(); + $width = $font->getTextWidth($text); + $height = $font->getTextHeight($text); + + switch($this->hAlign) { + + case awLabel::RIGHT : + $x -= ($width + $right); + break; + + case awLabel::CENTER : + $x -= ($width - $left + $right) / 2; + break; + + case awLabel::LEFT : + $x += $left; + break; + + } + + switch($this->vAlign) { + + case awLabel::TOP : + $y -= ($height + $bottom); + break; + + case awLabel::MIDDLE : + $y -= ($height - $top + $bottom) / 2; + break; + + case awLabel::BOTTOM : + $y += $top; + break; + + } + + $drawer->string($text, $this->move->move($x, $y)); + + } + + } + + protected function getMax(awDrawer $drawer, $function) { + + $max = NULL; + + foreach($this->texts as $key => $text) { + + $text = $this->getText($key); + $font = $text->getFont(); + + if(is_null($max)) { + $max = $font->{$function}($text); + } else { + $max = max($max, $font->{$function}($text)); + } + + } + + return $max; + + } + +} + +registerClass('Label'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Legend.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Legend.class.php new file mode 100644 index 0000000000000000000000000000000000000000..1ad7a4d2f6fd1c47b54c4cad956101df71382f8e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Legend.class.php @@ -0,0 +1,728 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + + +/* <php4> */ + +define("LEGEND_LINE", 1); +define("LEGEND_BACKGROUND", 2); +define("LEGEND_MARK", 3); +define("LEGEND_MARKONLY", 4); + +define("LEGEND_MODEL_RIGHT", 1); +define("LEGEND_MODEL_BOTTOM", 2); + +define("LEGEND_LEFT", 1); +define("LEGEND_RIGHT", 2); +define("LEGEND_CENTER", 3); +define("LEGEND_TOP", 4); +define("LEGEND_BOTTOM", 5); +define("LEGEND_MIDDLE", 6); + +/* </php4> */ + +/** + * Some legends + * + * @package Artichow + */ +class awLegend implements awPositionable { + + /** + * Legends added + * + * @var array + */ + protected $legends = array(); + + /** + * The current component + * + * @var Component + */ + protected $component; + + /** + * Background color or gradient + * + * @var Color, Gradient + */ + protected $background; + + /** + * Text color + * + * @var Color + */ + protected $textColor; + + /** + * Text font + * + * @var Font + */ + protected $textFont; + + /** + * Text margin + * + * @var Side + */ + protected $textMargin; + + /** + * Number of columns + * + * @var int + */ + protected $columns = NULL; + + /** + * Number of rows + * + * @var int + */ + protected $rows = NULL; + + /** + * Legend position + * + * @var Point + */ + protected $position; + + /** + * Hide legend ? + * + * @var bool + */ + protected $hide = FALSE; + + /** + * Space between each legend + * + * @var int + */ + protected $space = 4; + + /** + * Horizontal alignment + * + * @var int + */ + protected $hAlign; + + /** + * Vertical alignment + * + * @var int + */ + protected $vAlign; + + /** + * Margin + * + * @var array Array for left, right, top and bottom margins + */ + private $margin; + + /** + * Legend shadow + * + * @var Shadow + */ + public $shadow; + + /** + * Legend border + * + * @var Border + */ + public $border; + + /** + * Line legend + * + * @var int + */ + const LINE = 1; + + /** + * Color/Gradient background legend + * + * @var int + */ + const BACKGROUND = 2; + + /** + * Use marks and line as legend + * + * @var int + */ + const MARK = 3; + + /** + * Use marks as legend + * + * @var int + */ + const MARKONLY = 4; + + /** + * Right side model + * + * @var int + */ + const MODEL_RIGHT = 1; + + /** + * Bottom side model + * + * @var int + */ + const MODEL_BOTTOM = 2; + + /** + * Build the legend + * + * @param int $model Legend model + */ + public function __construct($model = awLegend::MODEL_RIGHT) { + + $this->shadow = new awShadow(awShadow::LEFT_BOTTOM); + $this->border = new awBorder; + + $this->textMargin = new awSide(4); + $this->setModel($model); + + } + + /** + * Set a predefined model for the legend + * + * @param int $model + */ + public function setModel($model) { + + $this->setBackgroundColor(new awColor(255, 255, 255, 15)); + $this->setPadding(8, 8, 8, 8); + $this->setTextFont(new awFont2); + $this->shadow->setSize(3); + + switch($model) { + + case awLegend::MODEL_RIGHT : + + $this->setColumns(1); + $this->setAlign(awLegend::RIGHT, awLegend::MIDDLE); + $this->setPosition(0.96, 0.50); + + break; + + case awLegend::MODEL_BOTTOM : + + $this->setRows(1); + $this->setAlign(awLegend::CENTER, awLegend::TOP); + $this->setPosition(0.50, 0.92); + + break; + + default : + + $this->setPosition(0.5, 0.5); + + break; + + } + + } + + /** + * Hide legend ? + * + * @param bool $hide TRUE to hide legend, FALSE otherwise + */ + public function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show legend ? + * + * @param bool $show + */ + public function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + + /** + * Add a Legendable object to the legend + * + * @param awLegendable $legendable + * @param string $title Legend title + * @param int $type Legend type (default to awLegend::LINE) + */ + public function add(awLegendable $legendable, $title, $type = awLegend::LINE) { + + $legend = array($legendable, $title, $type); + + $this->legends[] = $legend; + + } + + /** + * Change legend padding + * + * @param int $left + * @param int $right + * @param int $top + * @param int $bottom + */ + public function setPadding($left, $right, $top, $bottom) { + $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); + } + + /** + * Change space between each legend + * + * @param int $space + */ + public function setSpace($space) { + $this->space = (int)$space; + } + + /** + * Change alignment + * + * @param int $h Horizontal alignment + * @param int $v Vertical alignment + */ + public function setAlign($h = NULL, $v = NULL) { + if($h !== NULL) { + $this->hAlign = (int)$h; + } + if($v !== NULL) { + $this->vAlign = (int)$v; + } + } + + /** + * Change number of columns + * + * @param int $columns + */ + public function setColumns($columns) { + $this->rows = NULL; + $this->columns = (int)$columns; + } + + /** + * Change number of rows + * + * @param int $rows + */ + public function setRows($rows) { + $this->columns = NULL; + $this->rows = (int)$rows; + } + + /** + * Change legend position + * X and Y positions must be between 0 and 1. + * + * @param float $x + * @param float $y + */ + public function setPosition($x = NULL, $y = NULL) { + $x = (is_null($x) and !is_null($this->position)) ? $this->position->x : $x; + $y = (is_null($y) and !is_null($this->position)) ? $this->position->y : $y; + + $this->position = new awPoint($x, $y); + } + + /** + * Get legend position + * + * @return Point + */ + public function getPosition() { + return $this->position; + } + + /** + * Change text font + * + * @param awFont $font + */ + public function setTextFont(awFont $font) { + $this->textFont = $font; + } + + /** + * Change text margin + * + * @param int $left + * @param int $right + */ + public function setTextMargin($left, $right) { + $this->textMargin->set($left, $right); + } + + /** + * Change text color + * + * @param awColor $color + */ + public function setTextColor(awColor $color) { + $this->textColor = $color; + } + + /** + * Change background + * + * @param mixed $background + */ + public function setBackground($background) { + $this->background = $background; + } + + /** + * Change background color + * + * @param awColor $color + */ + public function setBackgroundColor(awColor $color) { + $this->background = $color; + } + + /** + * Change background gradient + * + * @param awGradient $gradient + */ + public function setBackgroundGradient(awGradient $gradient) { + $this->background = $gradient; + } + + /** + * Count the number of Legendable objects in the legend + * + * @return int + */ + public function count() { + return count($this->legends); + } + + public function draw(awDrawer $drawer) { + + if($this->hide) { + return; + } + + $count = $this->count(); + + // No legend to print + if($count === 0) { + return; + } + + // Get text widths and heights of each element of the legend + $widths = array(); + $heights = array(); + $texts = array(); + for($i = 0; $i < $count; $i++) { + list(, $title, ) = $this->legends[$i]; + $text = new awText( + $title, + $this->textFont, + $this->textColor, + 0 + ); + $font = $text->getFont(); + $widths[$i] = $font->getTextWidth($text) + $this->textMargin->left + $this->textMargin->right; + $heights[$i] = $font->getTextHeight($text); + $texts[$i] = $text; + } + + // Maximum height of the font used + $heightMax = array_max($heights); + + // Get number of columns + if($this->columns !== NULL) { + $columns = $this->columns; + } else if($this->rows !== NULL) { + $columns = ceil($count / $this->rows); + } else { + $columns = $count; + } + + // Number of rows + $rows = (int)ceil($count / $columns); + + // Get maximum with of each column + $widthMax = array(); + for($i = 0; $i < $count; $i++) { + // Get column width + $column = $i % $columns; + if(array_key_exists($column, $widthMax) === FALSE) { + $widthMax[$column] = $widths[$i]; + } else { + $widthMax[$column] = max($widthMax[$column], $widths[$i]); + } + } + + $width = $this->padding[0] + $this->padding[1] - $this->space; + for($i = 0; $i < $columns; $i++) { + $width += $this->space + 5 + 10 + $widthMax[$i]; + } + + $height = ($heightMax + $this->space) * $rows - $this->space + $this->padding[2] + $this->padding[3]; + + // Look for legends position + list($x, $y) = $drawer->getSize(); + + $p = new awPoint( + $this->position->x * $x, + $this->position->y * $y + ); + + switch($this->hAlign) { + + case awLegend::CENTER : + $p->x -= $width / 2; + break; + + case awLegend::RIGHT : + $p->x -= $width; + break; + + } + + switch($this->vAlign) { + + case awLegend::MIDDLE : + $p->y -= $height / 2; + break; + + case awLegend::BOTTOM : + $p->y -= $height; + break; + + } + + // Draw legend shadow + $this->shadow->draw( + $drawer, + $p, + $p->move($width, $height), + awShadow::OUT + ); + + // Draw legends base + $this->drawBase($drawer, $p, $width, $height); + + // Draw each legend + for($i = 0; $i < $count; $i++) { + + list($component, $title, $type) = $this->legends[$i]; + + $column = $i % $columns; + $row = (int)floor($i / $columns); + + // Get width of all previous columns + $previousColumns = 0; + for($j = 0; $j < $column; $j++) { + $previousColumns += $this->space + 10 + 5 + $widthMax[$j]; + } + + // Draw legend text + $drawer->string( + $texts[$i], + $p->move( + $this->padding[0] + $previousColumns + 10 + 5 + $this->textMargin->left, + $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - $heights[$i] / 2 + ) + ); + + // Draw legend icon + switch($type) { + + case awLegend::LINE : + case awLegend::MARK : + case awLegend::MARKONLY : + + // Get vertical position + $x = $this->padding[0] + $previousColumns; + $y = $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - $component->getLegendLineThickness(); + + // Draw two lines + if($component->getLegendLineColor() !== NULL) { + + $color = $component->getLegendLineColor(); + + if($color instanceof awColor and $type !== awLegend::MARKONLY) { + + $drawer->line( + $color, + new awLine( + $p->move( + $x, // YaPB ?? + $y + $component->getLegendLineThickness() / 2 + ), + $p->move( + $x + 10, + $y + $component->getLegendLineThickness() / 2 + ), + $component->getLegendLineStyle(), + $component->getLegendLineThickness() + ) + ); + + $color->free(); + unset($color); + + } + + } + + if($type === awLegend::MARK or $type === awLegend::MARKONLY) { + + $mark = $component->getLegendMark(); + + if($mark !== NULL) { + $mark->draw( + $drawer, + $p->move( + $x + 5.5, + $y + $component->getLegendLineThickness() / 2 + ) + ); + } + + unset($mark); + + } + + break; + + case awLegend::BACKGROUND : + + // Get vertical position + $x = $this->padding[0] + $previousColumns; + $y = $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - 5; + + $from = $p->move( + $x, + $y + ); + + $to = $p->move( + $x + 10, + $y + 10 + ); + + $background = $component->getLegendBackground(); + + if($background !== NULL) { + + $drawer->filledRectangle( + $component->getLegendBackground(), + new awLine($from, $to) + ); + + // Draw rectangle border + $this->border->rectangle( + $drawer, + $from->move(0, 0), + $to->move(0, 0) + ); + + } + + unset($background, $from, $to); + + break; + + } + + } + + } + + private function drawBase(awDrawer $drawer, awPoint $p, $width, $height) { + + $this->border->rectangle( + $drawer, + $p, + $p->move($width, $height) + ); + + $size = $this->border->visible() ? 1 : 0; + + $drawer->filledRectangle( + $this->background, + new awLine( + $p->move($size, $size), + $p->move($width - $size, $height - $size) + ) + ); + + } + +} + +registerClass('Legend'); + +/** + * You can add a legend to components which implements this interface + * + * @package Artichow + */ +interface awLegendable { + + /** + * Get the line type + * + * @return int + */ + public function getLegendLineStyle(); + + /** + * Get the line thickness + * + * @return int + */ + public function getLegendLineThickness(); + + /** + * Get the color of line + * + * @return Color + */ + public function getLegendLineColor(); + + /** + * Get the background color or gradient of an element of the component + * + * @return Color, Gradient + */ + public function getLegendBackground(); + + /** + * Get a Mark object + * + * @return Mark + */ + public function getLegendMark(); + +} + +registerInterface('Legendable'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Mark.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Mark.class.php new file mode 100644 index 0000000000000000000000000000000000000000..c66dff1eaf83578852e0a06e45431aead5281731 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Mark.class.php @@ -0,0 +1,335 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* <php4> */ + +define("MARK_CIRCLE", 1); +define("MARK_SQUARE", 2); +define("MARK_IMAGE", 3); +define("MARK_STAR", 4); +define("MARK_PAPERCLIP", 5); +define("MARK_BOOK", 6); + +/* </php4> */ + +/** + * Draw marks + * + * @package Artichow + */ +class awMark { + + /** + * Circle mark + * + * @var int + */ + const CIRCLE = 1; + + /** + * Quare mark + * + * @var int + */ + const SQUARE = 2; + + /** + * Image mark + * + * @var int + */ + const IMAGE = 3; + + /** + * Star mark + * + * @var int + */ + const STAR = 4; + + /** + * Paperclip mark + * + * @var int + */ + const PAPERCLIP = 5; + + /** + * Book mark + * + * @var int + */ + const BOOK = 6; + + /** + * Must marks be hidden ? + * + * @var bool + */ + protected $hide; + + /** + * Mark type + * + * @var int + */ + protected $type; + + /** + * Mark size + * + * @var int + */ + protected $size = 8; + + /** + * Fill mark + * + * @var Color, Gradient + */ + protected $fill; + + /** + * Mark image + * + * @var Image + */ + protected $image; + + /** + * To draw marks + * + * @var Drawer + */ + protected $drawer; + + /** + * Move position from this vector + * + * @var Point + */ + protected $move; + + /** + * Marks border + * + * @var Border + */ + public $border; + + /** + * Build the mark + */ + public function __construct() { + + $this->fill = new awColor(255, 0, 0, 0); + $this->border = new awBorder; + $this->border->hide(); + + $this->move = new awPoint(0, 0); + + } + + /** + * Change mark position + * + * @param int $x Add this interval to X coord + * @param int $y Add this interval to Y coord + */ + public function move($x, $y) { + + $this->move = $this->move->move($x, $y); + + } + + /** + * Hide marks ? + * + * @param bool $hide TRUE to hide marks, FALSE otherwise + */ + public function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show marks ? + * + * @param bool $show + */ + public function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + /** + * Change mark type + * + * @param int $size Size in pixels + */ + public function setSize($size) { + $this->size = (int)$size; + } + + /** + * Change mark type + * + * @param int $type New mark type + * @param int $size Mark size (can be NULL) + */ + public function setType($type, $size = NULL) { + $this->type = (int)$type; + if($size !== NULL) { + $this->setSize($size); + } + } + + /** + * Fill the mark with a color or a gradient + * + * @param mixed $fill A color or a gradient + */ + public function setFill($fill) { + if($fill instanceof awColor or $fill instanceof awGradient) { + $this->fill = $fill; + } + } + + /** + * Set an image + * Only for awMark::IMAGE type. + * + * @param Image An image + */ + public function setImage(awImage $image) { + $this->image = $image; + } + + /** + * Draw the mark + * + * @param awDrawer $drawer + * @param awPoint $point Mark center + */ + public function draw(awDrawer $drawer, awPoint $point) { + + // Hide marks ? + if($this->hide) { + return; + } + + // Check if we can print marks + if($this->type !== NULL) { + + $this->drawer = $drawer; + $realPoint = $this->move->move($point->x, $point->y); + + switch($this->type) { + + case awMark::CIRCLE : + $this->drawCircle($realPoint); + break; + + case awMark::SQUARE : + $this->drawSquare($realPoint); + break; + + case awMark::IMAGE : + $this->drawImage($realPoint); + break; + + case awMark::STAR : + $this->changeType('star'); + $this->draw($drawer, $point); + break; + + case awMark::PAPERCLIP : + $this->changeType('paperclip'); + $this->draw($drawer, $point); + break; + + case awMark::BOOK : + $this->changeType('book'); + $this->draw($drawer, $point); + break; + + } + + } + + } + + protected function changeType($image) { + $this->setType(awMARK::IMAGE); + $this->setImage(new awFileImage(ARTICHOW_IMAGE.DIRECTORY_SEPARATOR.$image.'.png')); + } + + protected function drawCircle(awPoint $point) { + + $this->drawer->filledEllipse( + $this->fill, + $point, + $this->size, $this->size + ); + + $this->border->ellipse( + $this->drawer, + $point, + $this->size, $this->size + ); + + } + + protected function drawSquare(awPoint $point) { + + list($x, $y) = $point->getLocation(); + + $x1 = (int)($x - $this->size / 2); + $x2 = $x1 + $this->size; + $y1 = (int)($y - $this->size / 2); + $y2 = $y1 + $this->size; + + $this->border->rectangle($this->drawer, new awPoint($x1, $y1), new awPoint($x2, $y2)); + + $size = $this->border->visible() ? 1 : 0; + + $this->drawer->filledRectangle( + $this->fill, + new awLine( + new awPoint($x1 + $size, $y1 + $size), + new awPoint($x2 - $size, $y2 - $size) + ) + ); + + } + + protected function drawImage(awPoint $point) { + + if($this->image instanceof awImage) { + + $width = $this->image->width; + $height = $this->image->height; + + list($x, $y) = $point->getLocation(); + + $x1 = (int)($x - $width / 2); + $x2 = $x1 + $width; + $y1 = (int)($y - $width / 2); + $y2 = $y1 + $height; + + $this->border->rectangle($this->drawer, new awPoint($x1 - 1, $y1 - 1), new awPoint($x2 + 1, $y2 + 1)); + + $this->drawer->copyImage($this->image, new awPoint($x1, $y1), new awPoint($x2, $y2)); + + } + + } + +} + +registerClass('Mark'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Math.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Math.class.php new file mode 100644 index 0000000000000000000000000000000000000000..9f1f03c61c5dccc9c4d2c0f184493498036349cc --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Math.class.php @@ -0,0 +1,492 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +abstract class awShape { + + /** + * Is the shape hidden ? + * + * @var bool + */ + protected $hide = FALSE; + + /** + * Shape style + * + * @var int + */ + public $style; + + /** + * Shape thickness + * + * @var int + */ + public $thickness; + + /** + * Solid shape + * + * @var int + */ + const SOLID = 1; + + /** + * Dotted shape + * + * @var int + */ + const DOTTED = 2; + + /** + * Dashed shape + * + * @var int + */ + const DASHED = 3; + + /** + * Change shape style + * + * @param int $style Line style + */ + public function setStyle($style) { + $this->style = (int)$style; + } + + /** + * Return shape style + * + * @return int + */ + public function getStyle() { + return $this->style; + } + + /** + * Change shape thickness + * + * @param int $thickness Shape thickness in pixels + */ + public function setThickness($thickness) { + $this->thickness = (int)$thickness; + } + + /** + * Return shape thickness + * + * @return int + */ + public function getThickness() { + return $this->thickness; + } + + /** + * Hide the shape + * + * @param bool $hide + */ + public function hide($hide) { + $this->hide = (bool)$hide; + } + + /** + * Show the shape + * + * @param bool $shape + */ + public function show($shape) { + $this->hide = (bool)!$shape; + } + + /** + * Is the line hidden ? + * + * @return bool + */ + public function isHidden() { + return $this->hide; + } + +} + +registerClass('Shape', TRUE); + +/** + * Describe a point + * + * @package Artichow + */ +class awPoint extends awShape { + + /** + * X coord + * + * @var float + */ + public $x; + + /** + * Y coord + * + * @var float + */ + public $y; + + /** + * Build a new awpoint + * + * @param float $x + * @param float $y + */ + public function __construct($x, $y) { + + $this->setLocation($x, $y); + + } + + /** + * Change X value + * + * @param float $x + */ + public function setX($x) { + $this->x = (float)$x; + } + + /** + * Change Y value + * + * @param float $y + */ + public function setY($y) { + $this->y = (float)$y; + } + + /** + * Change point location + * + * @param float $x + * @param float $y + */ + public function setLocation($x, $y) { + $this->setX($x); + $this->setY($y); + } + + /** + * Get point location + * + * @param array Point location + */ + public function getLocation() { + return array($this->x, $this->y); + } + + /** + * Get distance to another point + * + * @param awPoint $p A point + * @return float + */ + public function getDistance(awPoint $p) { + + return sqrt(pow($p->x - $this->x, 2) + pow($p->y - $this->y, 2)); + + } + + /** + * Move the point to another location + * + * @param Point A Point with the new awlocation + */ + public function move($x, $y) { + + return new awPoint( + $this->x + $x, + $this->y + $y + ); + + } + +} + +registerClass('Point'); + +/* <php4> */ + +define("LINE_SOLID", 1); +define("LINE_DOTTED", 2); +define("LINE_DASHED", 3); + +/* </php4> */ + +/** + * Describe a line + * + * @package Artichow + */ +class awLine extends awShape { + + /** + * Line first point + * + * @param Point + */ + public $p1; + + /** + * Line second point + * + * @param Point + */ + public $p2; + + /** + * Build a new awline + * + * @param awPoint $p1 First point + * @param awPoint $p2 Second point + * @param int $type Style of line (default to solid) + * @param int $thickness Line thickness (default to 1) + */ + public function __construct($p1 = NULL, $p2 = NULL, $type = awLine::SOLID, $thickness = 1) { + + $this->setLocation($p1, $p2); + $this->setStyle($type); + $this->setThickness($thickness); + + } + + /** + * Build a line from 4 coords + * + * @param int $x1 Left position + * @param int $y1 Top position + * @param int $x2 Right position + * @param int $y2 Bottom position + */ + public static function build($x1, $y1, $x2, $y2) { + + return new awLine( + new awPoint($x1, $y1), + new awPoint($x2, $y2) + ); + + } + + /** + * Change X values of the line + * + * @param int $x1 Begin value + * @param int $x2 End value + */ + public function setX($x1, $x2) { + $this->p1->setX($x1); + $this->p2->setX($x2); + } + + /** + * Change Y values of the line + * + * @param int $y1 Begin value + * @param int $y2 End value + */ + public function setY($y1, $y2) { + $this->p1->setY($y1); + $this->p2->setY($y2); + } + + /** + * Change line location + * + * @param awPoint $p1 First point + * @param awPoint $p2 Second point + */ + public function setLocation($p1, $p2) { + if(is_null($p1) or $p1 instanceof awPoint) { + $this->p1 = $p1; + } + if(is_null($p2) or $p2 instanceof awPoint) { + $this->p2 = $p2; + } + } + + /** + * Get line location + * + * @param array Line location + */ + public function getLocation() { + return array($this->p1, $this->p2); + } + + /** + * Get the line size + * + * @return float + */ + public function getSize() { + + $square = pow($this->p2->x - $this->p1->x, 2) + pow($this->p2->y - $this->p1->y, 2); + return sqrt($square); + + } + + /** + * Test if the line can be considered as a point + * + * @return bool + */ + public function isPoint() { + return ($this->p1->x === $this->p2->x and $this->p1->y === $this->p2->y); + } + + /** + * Test if the line is a vertical line + * + * @return bool + */ + public function isVertical() { + return ($this->p1->x === $this->p2->x); + } + + /** + * Test if the line is an horizontal line + * + * @return bool + */ + public function isHorizontal() { + return ($this->p1->y === $this->p2->y); + } + +} + +registerClass('Line'); + +/** + * A vector is a type of line + * The sense of the vector goes from $p1 to $p2. + * + * @package Artichow + */ +class awVector extends awLine { + + /** + * Get vector angle in radians + * + * @return float + */ + public function getAngle() { + + if($this->isPoint()) { + return 0.0; + } + + $size = $this->getSize(); + + $width = ($this->p2->x - $this->p1->x); + $height = ($this->p2->y - $this->p1->y) * -1; + + if($width >= 0 and $height >= 0) { + return acos($width / $size); + } else if($width <= 0 and $height >= 0) { + return acos($width / $size); + } else { + $height *= -1; + if($width >= 0 and $height >= 0) { + return 2 * M_PI - acos($width / $size); + } else if($width <= 0 and $height >= 0) { + return 2 * M_PI - acos($width / $size); + } + } + + } + +} + +registerClass('Vector'); + +/* <php4> */ + +define("POLYGON_SOLID", 1); +define("POLYGON_DOTTED", 2); +define("POLYGON_DASHED", 3); + +/* </php4> */ + +/** + * Describe a polygon + * + * @package Artichow + */ +class awPolygon extends awShape { + + /** + * Polygon points + * + * @var array + */ + protected $points = array(); + + /** + * Set a point in the polygon + * + * @param int $pos Point position + * @param awPoint $point + */ + public function set($pos, $point) { + if(is_null($point) or $point instanceof awPoint) { + $this->points[$pos] = $point; + } + } + + /** + * Add a point at the end of the polygon + * + * @param awPoint $point + */ + public function append($point) { + if(is_null($point) or $point instanceof awPoint) { + $this->points[] = $point; + } + } + + /** + * Get a point at a position in the polygon + * + * @param int $pos Point position + * @return Point + */ + public function get($pos) { + return $this->points[$pos]; + } + + /** + * Count number of points in the polygon + * + * @return int + */ + public function count() { + return count($this->points); + } + + /** + * Returns all points in the polygon + * + * @return array + */ + public function all() { + return $this->points; + } + +} + +registerClass('Polygon'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Shadow.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Shadow.class.php new file mode 100644 index 0000000000000000000000000000000000000000..ffed03a4d4d55309a87b46e94e4f4da8b3dae275 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Shadow.class.php @@ -0,0 +1,415 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* <php4> */ + +define("SHADOW_LEFT_TOP", 1); +define("SHADOW_LEFT_BOTTOM", 2); +define("SHADOW_RIGHT_TOP", 3); +define("SHADOW_RIGHT_BOTTOM", 4); + +define("SHADOW_IN", 1); +define("SHADOW_OUT", 2); + +/* </php4> */ + +/** + * Draw shadows + * + */ +class awShadow { + + /** + * Shadow on left and top sides + * + * @var int + */ + const LEFT_TOP = 1; + + /** + * Shadow on left and bottom sides + * + * @var int + */ + const LEFT_BOTTOM = 2; + + + /** + * Shadow on right and top sides + * + * @var int + */ + const RIGHT_TOP = 3; + + /** + * Shadow on right and bottom sides + * + * @var int + */ + const RIGHT_BOTTOM = 4; + + /** + * In mode + * + * @var int + */ + const IN = 1; + + /** + * Out mode + * + * @var int + */ + const OUT = 2; + + /** + * Shadow size + * + * @var int + */ + private $size = 0; + + /** + * Hide shadow ? + * + * @var bool + */ + protected $hide = FALSE; + + /** + * Shadow color + * + * @var Color + */ + private $color; + + /** + * Shadow position + * + * @var int + */ + private $position; + + /** + * Smooth shadow ? + * + * @var bool + */ + private $smooth = FALSE; + + /** + * Shadow constructor + * + * @param int $position Shadow position + */ + public function __construct($position) { + $this->setPosition($position); + } + + /** + * Hide shadow ? + * + * @param bool $hide + */ + public function hide($hide = TRUE) { + $this->hide = (bool)$hide; + } + + /** + * Show shadow ? + * + * @param bool $show + */ + public function show($show = TRUE) { + $this->hide = (bool)!$show; + } + + /** + * Change shadow size + * + * @param int $size + * @param bool $smooth Smooth the shadow (facultative argument) + */ + public function setSize($size, $smooth = NULL) { + $this->size = (int)$size; + if($smooth !== NULL) { + $this->smooth($smooth); + } + } + + /** + * Change shadow color + * + * @param awColor $color + */ + public function setColor($color) { + $this->color = (int)$color; + } + + /** + * Change shadow position + * + * @param int $position + */ + public function setPosition($position) { + $this->position = (int)$position; + } + + /** + * Smooth shadow ? + * + * @param bool $smooth + */ + public function smooth($smooth) { + $this->smooth = (bool)$smooth; + } + + /** + * Get the space taken by the shadow + * + * @return Side + */ + public function getSpace() { + + return new awSide( + ($this->position === awShadow::LEFT_TOP or $this->position === awShadow::LEFT_BOTTOM) ? $this->size : 0, + ($this->position === awShadow::RIGHT_TOP or $this->position === awShadow::RIGHT_BOTTOM) ? $this->size : 0, + ($this->position === awShadow::LEFT_TOP or $this->position === awShadow::RIGHT_TOP) ? $this->size : 0, + ($this->position === awShadow::LEFT_BOTTOM or $this->position === awShadow::RIGHT_BOTTOM) ? $this->size : 0 + ); + + } + + /** + * Draw shadow + * + * @param awDrawer $drawer + * @param awPoint $p1 Top-left point + * @param awPoint $p2 Right-bottom point + * @param int Drawing mode + */ + public function draw(awDrawer $drawer, awPoint $p1, awPoint $p2, $mode) { + + if($this->hide) { + return; + } + + if($this->size <= 0) { + return; + } + + $drawer = clone $drawer; + + $color = ($this->color instanceof awColor) ? $this->color : new awColor(125, 125, 125); + + switch($this->position) { + + case awShadow::RIGHT_BOTTOM : + + if($mode === awShadow::OUT) { + $t1 = $p1->move(0, 0); + $t2 = $p2->move($this->size + 1, $this->size + 1); + } else { // PHP 4 compatibility + $t1 = $p1->move(0, 0); + $t2 = $p2->move(0, 0); + } + + $width = $t2->x - $t1->x; + $height = $t2->y - $t1->y; + + $drawer->setAbsPosition($t1->x + $drawer->x, $t1->y + $drawer->y); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($width - $this->size, $this->size), + new awPoint($width - 1, $height - 1) + ) + ); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($this->size, $height - $this->size), + new awPoint($width - $this->size - 1, $height - 1) + ) + ); + + $this->smoothPast($drawer, $color, $width, $height); + + break; + + case awShadow::LEFT_TOP : + + if($mode === awShadow::OUT) { + $t1 = $p1->move(- $this->size, - $this->size); + $t2 = $p2->move(0, 0); + } else { // PHP 4 compatibility + $t1 = $p1->move(0, 0); + $t2 = $p2->move(0, 0); + } + + $width = $t2->x - $t1->x; + $height = $t2->y - $t1->y; + + $drawer->setAbsPosition($t1->x + $drawer->x, $t1->y + $drawer->y); + + $height = max($height + 1, $this->size); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint(0, 0), + new awPoint($this->size - 1, $height - $this->size - 1) + ) + ); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($this->size, 0), + new awPoint($width - $this->size - 1, $this->size - 1) + ) + ); + + $this->smoothPast($drawer, $color, $width, $height); + + break; + + case awShadow::RIGHT_TOP : + + if($mode === awShadow::OUT) { + $t1 = $p1->move(0, - $this->size); + $t2 = $p2->move($this->size + 1, 0); + } else { // PHP 4 compatibility + $t1 = $p1->move(0, 0); + $t2 = $p2->move(0, 0); + } + + $width = $t2->x - $t1->x; + $height = $t2->y - $t1->y; + + $drawer->setAbsPosition($t1->x + $drawer->x, $t1->y + $drawer->y); + + $height = max($height + 1, $this->size); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($width - $this->size, 0), + new awPoint($width - 1, $height - $this->size - 1) + ) + ); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($this->size, 0), + new awPoint($width - $this->size - 1, $this->size - 1) + ) + ); + + $this->smoothFuture($drawer, $color, $width, $height); + + break; + + case awShadow::LEFT_BOTTOM : + + if($mode === awShadow::OUT) { + $t1 = $p1->move(- $this->size, 0); + $t2 = $p2->move(0, $this->size + 1); + } else { // PHP 4 compatibility + $t1 = $p1->move(0, 0); + $t2 = $p2->move(0, 0); + } + + $width = $t2->x - $t1->x; + $height = $t2->y - $t1->y; + + $drawer->setAbsPosition($t1->x + $drawer->x, $t1->y + $drawer->y); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint(0, $this->size), + new awPoint($this->size - 1, $height - 1) + ) + ); + + $drawer->filledRectangle( + $color, + new awLine( + new awPoint($this->size, $height - $this->size), + new awPoint($width - $this->size - 1, $height - 1) + ) + ); + + $this->smoothFuture($drawer, $color, $width, $height); + + break; + + } + + } + + private function smoothPast(awDrawer $drawer, awColor $color, $width, $height) { + + if($this->smooth) { + + for($i = 0; $i < $this->size; $i++) { + for($j = 0; $j <= $i; $j++) { + $drawer->point( + $color, + new awPoint($i, $j + $height - $this->size) + ); + } + } + + for($i = 0; $i < $this->size; $i++) { + for($j = 0; $j <= $i; $j++) { + $drawer->point( + $color, + new awPoint($width - $this->size + $j, $i) + ); + } + } + + } + + } + + private function smoothFuture(awDrawer $drawer, awColor $color, $width, $height) { + + if($this->smooth) { + + for($i = 0; $i < $this->size; $i++) { + for($j = 0; $j <= $i; $j++) { + $drawer->point( + $color, + new awPoint($i, $this->size - $j - 1) + ); + } + } + + for($i = 0; $i < $this->size; $i++) { + for($j = 0; $j <= $i; $j++) { + $drawer->point( + $color, + new awPoint($width - $this->size + $j, $height - $i - 1) + ); + } + } + + } + } + +} + +registerClass('Shadow'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Text.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Text.class.php new file mode 100644 index 0000000000000000000000000000000000000000..787037065fc1d3eac7d06127bdc615ad6c861b21 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Text.class.php @@ -0,0 +1,217 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * To handle text + * + * @package Artichow + */ +class awText { + + /** + * Your text + * + * @var string + */ + private $text; + + /** + * Text font + * + * @var Font + */ + private $font; + + /** + * Text angle + * Can be 0 or 90 + * + * @var int + */ + private $angle; + + /** + * Text color + * + * @var Color + */ + private $color; + + /** + * Text background + * + * @var Color, Gradient + */ + private $background; + + /** + * Padding + * + * @var array Array for left, right, top and bottom paddings + */ + private $padding; + + /** + * Text border + * + * @var Border + */ + public $border; + + /** + * Build a new awtext + * + * @param string $text Your text + */ + public function __construct($text, $font = NULL, $color = NULL, $angle = 0) { + + if(is_null($font)) { + $font = new awFont2; + } + + $this->setText($text); + $this->setFont($font); + + // Set default color to black + if($color === NULL) { + $color = new awColor(0, 0, 0); + } + + $this->setColor($color); + $this->setAngle($angle); + + $this->border = new awBorder; + $this->border->hide(); + + } + + /** + * Get text + * + * @return string + */ + public function getText() { + return $this->text; + } + + /** + * Change text + * + * @param string $text New text + */ + public function setText($text) { + $this->text = (string)$text; + } + + /** + * Change text font + * + * @param Font + */ + public function setFont(awFont $font) { + $this->font = $font; + } + + /** + * Get text font + * + * @return int + */ + public function getFont() { + return $this->font; + } + + /** + * Change text angle + * + * @param int + */ + public function setAngle($angle) { + $this->angle = (int)$angle; + } + + /** + * Get text angle + * + * @return int + */ + public function getAngle() { + return $this->angle; + } + + /** + * Change text color + * + * @param Color + */ + public function setColor(awColor $color) { + $this->color = $color; + } + + /** + * Get text color + * + * @return Color + */ + public function getColor() { + return $this->color; + } + + /** + * Change text background color + * + * @param awColor $color + */ + public function setBackgroundColor(awColor $color) { + $this->background = $color; + } + + /** + * Change text background gradient + * + * @param awGradient $gradient + */ + public function setBackgroundGradient(awGradient $gradient) { + $this->background = $gradient; + } + + /** + * Get text background + * + * @return Color, Gradient + */ + public function getBackground() { + return $this->background; + } + + /** + * Change padding + * + * @param int $left Left padding + * @param int $right Right padding + * @param int $top Top padding + * @param int $bottom Bottom padding + */ + public function setPadding($left, $right, $top, $bottom) { + $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); + } + + /** + * Get current padding + * + * @return array + */ + public function getPadding() { + return $this->padding; + } + +} + +registerClass('Text'); +?> diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Tick.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Tick.class.php new file mode 100644 index 0000000000000000000000000000000000000000..f37f146b3d4b1a017f1a005d7e47a76a5bd7587a --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Tick.class.php @@ -0,0 +1,352 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/* <php4> */ + +define("TICK_IN", 0); +define("TICK_OUT", 1); +define("TICK_IN_OUT", 2); + +/* </php4> */ + +/** + * Handle ticks + * + * @package Artichow + */ +class awTick { + + /** + * Ticks style + * + * @var int + */ + protected $style = awTick::IN; + + /** + * Ticks size + * + * @var int + */ + protected $size; + + /** + * Ticks color + * + * @var Color + */ + protected $color; + + /** + * Ticks number + * + * @var int + */ + protected $number; + + /** + * Ticks number by other tick + * + * @var array + */ + protected $numberByTick; + + /** + * Ticks interval + * + * @var int + */ + protected $interval = 1; + + /** + * Hide ticks + * + * @var bool + */ + protected $hide = FALSE; + + /** + * Hide first tick + * + * @var bool + */ + protected $hideFirst = FALSE; + + /** + * Hide last tick + * + * @var bool + */ + protected $hideLast = FALSE; + + /** + * In mode + * + * @param int + */ + const IN = 0; + + /** + * Out mode + * + * @param int + */ + const OUT = 1; + + /** + * In and out mode + * + * @param int + */ + const IN_OUT = 2; + + /** + * Build the ticks + * + * @param int $number Number of ticks + * @param int $size Ticks size + */ + public function __construct($number, $size) { + + $this->setSize($size); + $this->setNumber($number); + $this->setColor(new awBlack); + $this->style = awTick::IN; + + } + + /** + * Change ticks style + * + * @param int $style + */ + public function setStyle($style) { + $this->style = (int)$style; + } + + /** + * Get ticks style + * + * @return int + */ + public function getStyle() { + return $this->style; + } + + /** + * Change ticks color + * + * @param awColor $color + */ + public function setColor(awColor $color) { + $this->color = $color; + } + + /** + * Change ticks size + * + * @param int $size + */ + public function setSize($size) { + $this->size = (int)$size; + } + + /** + * Change interval of ticks + * + * @param int $interval + */ + public function setInterval($interval) { + $this->interval = (int)$interval; + } + + /** + * Get interval between each tick + * + * @return int + */ + public function getInterval() { + return $this->interval; + } + + /** + * Change number of ticks + * + * @param int $number + */ + public function setNumber($number) { + $this->number = (int)$number; + } + + /** + * Get number of ticks + * + * @return int + */ + public function getNumber() { + return $this->number; + } + + /** + * Change number of ticks relative to others ticks + * + * @param awTick $tick Ticks reference + * @param int $number Number of ticks + */ + public function setNumberByTick(awTick $tick, $number) { + /* <php5> */ + $this->numberByTick = array($tick, (int)$number); + /* </php5> */ + /* <php4> -- + $this->numberByTick = array(&$tick, (int)$number); + -- </php4> */ + } + + /** + * Hide ticks + * + * @param bool $hide + */ + public function hide($hide) { + $this->hide = (bool)$hide; + } + + /** + * Hide first tick + * + * @param bool $hide + */ + public function hideFirst($hide) { + $this->hideFirst = (bool)$hide; + } + + /** + * Hide last tick + * + * @param bool $hide + */ + public function hideLast($hide) { + $this->hideLast = (bool)$hide; + } + + /** + * Draw ticks on a vector + * + * @param awDrawer $drawer A drawer + * @param awVector $vector A vector + */ + public function draw(awDrawer $drawer, awVector $vector) { + + if($this->numberByTick !== NULL) { + list($tick, $number) = $this->numberByTick; + $this->number = 1 + ($tick->getNumber() - 1) * ($number + 1); + $this->interval = $tick->getInterval(); + } + + if($this->number < 2 or $this->hide) { + return; + } + + $angle = $vector->getAngle(); + // echo "INIT:".$angle."<br/>"; + switch($this->style) { + + case awTick::IN : + $this->drawTicks($drawer, $vector, NULL, $angle + M_PI / 2); + break; + + case awTick::OUT : + $this->drawTicks($drawer, $vector, $angle + 3 * M_PI / 2, NULL); + break; + + default : + $this->drawTicks($drawer, $vector, $angle + M_PI / 2, $angle + 3 * M_PI / 2); + break; + + } + + } + + protected function drawTicks(awDrawer $drawer, awVector $vector, $from, $to) { + + // Draw last tick + if($this->hideLast === FALSE) { + + //echo '<b>'; + if(($this->number - 1) % $this->interval === 0) { + $this->drawTick($drawer, $vector->p2, $from, $to); + } + //echo '</b>'; + + } + + $number = $this->number - 1; + $size = $vector->getSize(); + + // Get tick increment in pixels + $inc = $size / $number; + + // Check if we must hide the first tick + $start = $this->hideFirst ? $inc : 0; + $stop = $inc * $number; + + $position = 0; + + for($i = $start; round($i, 6) < $stop; $i += $inc) { + + if($position % $this->interval === 0) { + $p = $vector->p1->move( + round($i * cos($vector->getAngle()), 6), + round($i * sin($vector->getAngle() * -1), 6) + ); + $this->drawTick($drawer, $p, $from, $to); + } + + $position++; + + } + //echo '<br/><br/>'; + } + + protected function drawTick(awDrawer $drawer, awPoint $p, $from, $to) { +// echo $this->size.':'.$angle.'|<b>'.cos($angle).'</b>/'; + // The round avoid some errors in the calcul + // For example, 12.00000008575245 becomes 12 + $p1 = $p; + $p2 = $p; + + if($from !== NULL) { + $p1 = $p1->move( + round($this->size * cos($from), 6), + round($this->size * sin($from) * -1, 6) + ); + } + + if($to !== NULL) { + $p2 = $p2->move( + round($this->size * cos($to), 6), + round($this->size * sin($to) * -1, 6) + ); + } + //echo $p1->x.':'.$p2->x.'('.$p1->y.':'.$p2->y.')'.'/'; + $vector = new awVector( + $p1, $p2 + ); + + $drawer->line( + $this->color, + $vector + ); + + } + +} + +registerClass('Tick'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Tools.class.php b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Tools.class.php new file mode 100644 index 0000000000000000000000000000000000000000..724f91dd75ab32e2e539ceb0d33ac297be0fc87f --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/php5/inc/Tools.class.php @@ -0,0 +1,173 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +/** + * Objects capable of being positioned + * + * @package Artichow + */ +interface awPositionable { + + /** + * Left align + * + * @var int + */ + const LEFT = 1; + + /** + * Right align + * + * @var int + */ + const RIGHT = 2; + + /** + * Center align + * + * @var int + */ + const CENTER = 3; + + /** + * Top align + * + * @var int + */ + const TOP = 4; + + /** + * Bottom align + * + * @var int + */ + const BOTTOM = 5; + + /** + * Middle align + * + * @var int + */ + const MIDDLE = 6; + + /** + * Change alignment + * + * @param int $h Horizontal alignment + * @param int $v Vertical alignment + */ + public function setAlign($h = NULL, $v = NULL); + +} + +registerInterface('Positionable'); + +/** + * Manage left, right, top and bottom sides + * + * @package Artichow + */ +class awSide { + + /** + * Left side + * + * @var int + */ + public $left = 0; + + /** + * Right side + * + * @var int + */ + public $right = 0; + + /** + * Top side + * + * @var int + */ + public $top = 0; + + /** + * Bottom side + * + * @var int + */ + public $bottom = 0; + + /** + * Build the side + * + * @param mixed $left + * @param mixed $right + * @param mixed $top + * @param mixed $bottom + */ + public function __construct($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { + $this->set($left, $right, $top, $bottom); + } + + + /** + * Change side values + * + * @param mixed $left + * @param mixed $right + * @param mixed $top + * @param mixed $bottom + */ + public function set($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { + + if($left !== NULL) { + $this->left = (float)$left; + } + if($right !== NULL) { + $this->right = (float)$right; + } + if($top !== NULL) { + $this->top = (float)$top; + } + if($bottom !== NULL) { + $this->bottom = (float)$bottom; + } + + } + + + /** + * Add values to each side + * + * @param mixed $left + * @param mixed $right + * @param mixed $top + * @param mixed $bottom + */ + public function add($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { + + if($left !== NULL) { + $this->left += (float)$left; + } + if($right !== NULL) { + $this->right += (float)$right; + } + if($top !== NULL) { + $this->top += (float)$top; + } + if($bottom !== NULL) { + $this->bottom += (float)$bottom; + } + + } + +} + +registerClass('Side'); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/readme b/maarch_entreprise/trunk/tools/graphic_lib/readme new file mode 100644 index 0000000000000000000000000000000000000000..43e4da6313ff415768311d54770bd71d9e9a2d7d --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/readme @@ -0,0 +1,120 @@ + I. Installation + II. Configuration +III. Utilisation + IV. Divers + + +I. Installation + ------------ + +*** Première installation *** + +L'installation de Artichow se résume à décompresser l'archive dans le dossier +de votre choix sur votre serveur. Veillez simplement à télécharger l'archive +dont vous avez vraiment besoin (PHP 5 ou PHP 4 & 5). +Notez que Artichow requiert GD 2 et PHP 4.3.0 au minimum pour fonctionner. + +*** Mise à jour *** + +Lorsque vous souhaitez mettre à jour Artichow avec la dernière version, +essayez de suivre pas à pas ces étapes : + 1) Décompressez la dernière version de Artichow dans un dossier + 2) Ecrasez le fichier Artichow.cfg.php avec votre ancien fichier + 3) Copiez vos patterns dans le dossier patterns/ de la nouvelle version + 4) Supprimez l'ancienne version de Artichow de votre disque + 5) Copiez la nouvelle version là où était l'ancienne +Une fois ces cinq étapes effectuées, vous n'aurez plus qu'à mettre +éventuellement à jour vos graphiques, en fonction des dernières évolutions de +l'API de Artichow. Pour cela, voyez le titre "Migrer d'une version à l'autre" +sur la page : +http://www.artichow.org/documentation + +II. Configuration + ------------- + +Même si une utilisation normale de Artichow ne nécessite pas de configuration +particulière, il existe un fichier Artichow.cfg.php qui permet de modifier +quelques paramètres de la librairie. +Vous pouvez notamment configurer le répertoire vers les polices de caractère +en modifiant la constante ARTICHOW_FONT (par exemple en choisissant +'c:\Windows\font' si vous êtes sous Windows). +Vous pouvez également redéfinir la variable $fonts. Cette variable contient une +liste de polices TTF (sans l'extension) présentes dans votre répertoire +ARTICHOW_FONT. Pour toutes les polices de cette liste, une classe du même nom +est créée. Les polices ainsi définies peuvent ensuite être utilisées de cette +manière : +<?php +$font = new Verdana(12); // 12 représente la taille en points +?> +Il existe également une constante ARTICHOW_DEPRECATED. Si cette constante vaut +TRUE, alors un message d'erreur sera affiché lorsque vous utiliserez une +fonctionnalité dépréciée de Artichow. A l'inverse, avec la valeur FALSE, +vous pourrez continuer à utiliser les fonctions dépréciées sans soucis. +Cependant, dans un souci de compatibilité, il est préférable de mettre à +jour vos graphiques dès lors qu'un message de ce type apparaît (et donc de +laisser la constante à TRUE). Les fonctionnalités dépréciées sont toujours +potentiellement susceptibles de disparaître d'une version à l'autre de la +librairie. +La constante ARTICHOW_PREFIX est vide par défaut et correspond à un préfixe qui +est ajouté au nom de chaque classe utilisée sur Artichow. Certains noms de +classe (Graph, Image, Text, Font, etc.) sont utilisés par d'autres librairies +et cela peut aboutir à des conflits. Pour résoudre ce problème, choisissez par +exemple 'xyz' comme préfixe et toutes les classes de Artichow s'appèleront +désormais xyz[Nom normal]. Exemple d'utilisation de Artichow avec +ARTICHOW_PREFIX à 'xyz' : +<?php +require_once "Artichow/LinePlot.class.php"; + +$plot = new xyzLinePlot(array(1, 2, 3)); +$plot->title->set('Mon graphique'); +$plot->title->setFont(new xyzFont4); + +$graph = new xyzGraph(400, 300); +$graph->add($plot); +$graph->draw(); +?> + + +III. Utilisation + ----------- + +Si vous utilisez la version conçue exclusivement pour PHP 5, vous pouvez vous +référer aux exemples et aux tutoriels afin de bien prendre en main la +librairie. +Si vous utilisez la version pour PHP 4 & 5, référez vous également aux exemples +et tutoriels mais faîtes attention lors de l'inclusion des fichiers de +Artichow. N'incluez pas les fichiers de cette manière : +<?php +// Ceci ne fonctionnera pas +require_once "Artichow/php5/LinePlot.class.php"; +// Cela non plus +require_once "Artichow/php4/LinePlot.class.php"; +?> +Préférez plutôt : +<?php +// Fonctionnera correctement +require_once "Artichow/LinePlot.class.php"; +?> +C'est la librairie qui se charge de sélectionner les bons fichiers en fonction +de la version de PHP dont vous disposez. + +IV. Divers + ------ + +La documentation de Artichow est disponible sur : +http://www.artichow.org/documentation + +Des tutoriels sont accessibles sur : +http://www.artichow.org/tutorial + +Un forum de support peut être trouvé sur : +http://www.artichow.org/forum/ + +N'oubliez pas que Artichow est dans le domaine public. Vous pouvez donc faire +CE QUE VOUS SOUHAITEZ avec cette librairie, y compris ajouter votre nom dans +chaque fichier, et la redistribuer ainsi. + +Si vous souhaitez aider et participer au développement de Artichow, n'hésitez +pas à consulter cette page : +http://www.artichow.org/help + diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/.htaccess b/maarch_entreprise/trunk/tools/graphic_lib/test/.htaccess new file mode 100644 index 0000000000000000000000000000000000000000..f7661d04913fd5788437b3c306c920b4a1ebab6c --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/.htaccess @@ -0,0 +1 @@ +allow from all diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/AntiSpam-2.php b/maarch_entreprise/trunk/tools/graphic_lib/test/AntiSpam-2.php new file mode 100644 index 0000000000000000000000000000000000000000..1379dd624e3dda62babbb5fc32b0184559a194c8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/AntiSpam-2.php @@ -0,0 +1,23 @@ +<?php +require_once '../AntiSpam.class.php'; + +$span = new AntiSpam; + +ob_start(); + +assert($span->check('test', 'TeST It!') === TRUE); +assert($span->check('test', 'TeST iT!', FALSE) === FALSE); +assert($span->check('test', 'test it!', TRUE) === TRUE); + +$data = ob_get_clean(); + +if($data === '') { + echo "All tests passed!"; +} else { + echo "Some errors have occur:<br/>"; + echo $data; +} +echo "<ul> + <li><a href='AntiSpam.php'>Previous page</a></li> +</ul>"; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/AntiSpam.php b/maarch_entreprise/trunk/tools/graphic_lib/test/AntiSpam.php new file mode 100644 index 0000000000000000000000000000000000000000..5250e0bb6a9438e0bfcc031663a94edd54c74ff6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/AntiSpam.php @@ -0,0 +1,6 @@ +<img src='image/AntiSpam-1.test.php' border=2 bordercolor=black/> +<img src='image/AntiSpam-2.test.php' border=2 bordercolor=black/> +<img src='image/AntiSpam-3.test.php' border=2 bordercolor=black/> +<img src='image/AntiSpam-4.test.php' border=2 bordercolor=black/> +<br/> +<a href="AntiSpam-2.php">Others tests</a> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/BarPlot.php b/maarch_entreprise/trunk/tools/graphic_lib/test/BarPlot.php new file mode 100644 index 0000000000000000000000000000000000000000..45af276a7ccb8258c648cb77429ac85209660e90 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/BarPlot.php @@ -0,0 +1,6 @@ +<img src='image/BarPlot-1.test.php' border=2 bordercolor=black/> +<img src='image/BarPlot-2.test.php' border=2 bordercolor=black/> +<img src='image/BarPlot-3.test.php' border=2 bordercolor=black/> +<img src='image/BarPlot-4.test.php' border=2 bordercolor=black/> +<img src='image/BarPlot-5.test.php' border=2 bordercolor=black/> +<img src='image/BarPlot-6.test.php' border=2 bordercolor=black/> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/LinePlot.php b/maarch_entreprise/trunk/tools/graphic_lib/test/LinePlot.php new file mode 100644 index 0000000000000000000000000000000000000000..e976753a6470b36c17cf0d24d84a21272eedcb61 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/LinePlot.php @@ -0,0 +1,18 @@ +<img src='image/LinePlot-1.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-2.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-3.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-4.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-5.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-6.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-7.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-8.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-9.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-10.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-11.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-12.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-13.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-14.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-15.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-16.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-17.test.php' border=2 bordercolor=black/> +<img src='image/LinePlot-18.test.php' border=2 bordercolor=black/> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/MathPlot.php b/maarch_entreprise/trunk/tools/graphic_lib/test/MathPlot.php new file mode 100644 index 0000000000000000000000000000000000000000..a30c4c9ebdf438e6af538d9589f5f7655a6b6bd3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/MathPlot.php @@ -0,0 +1,3 @@ +<img src='image/MathPlot-1.test.php' border=2 bordercolor=black/> +<img src='image/MathPlot-2.test.php' border=2 bordercolor=black/> +<img src='image/MathPlot-3.test.php' border=2 bordercolor=black/> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/Pie.php b/maarch_entreprise/trunk/tools/graphic_lib/test/Pie.php new file mode 100644 index 0000000000000000000000000000000000000000..fc4ec19738a5f7cfb40dd6f42d09cca2656a9028 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/Pie.php @@ -0,0 +1,6 @@ +<img src='image/Pie-1.test.php' border=2 bordercolor=black/> +<img src='image/Pie-2.test.php' border=2 bordercolor=black/> +<img src='image/Pie-3.test.php' border=2 bordercolor=black/> +<img src='image/Pie-4.test.php' border=2 bordercolor=black/> +<img src='image/Pie-5.test.php' border=2 bordercolor=black/> +<img src='image/Pie-6.test.php' border=2 bordercolor=black/> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/ScatterPlot.php b/maarch_entreprise/trunk/tools/graphic_lib/test/ScatterPlot.php new file mode 100644 index 0000000000000000000000000000000000000000..8640666bbf7c041fa00f93418d5d6ea5f037f4aa --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/ScatterPlot.php @@ -0,0 +1 @@ +<img src='image/ScatterPlot-1.test.php' border=2 bordercolor=black/> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/Tools.php b/maarch_entreprise/trunk/tools/graphic_lib/test/Tools.php new file mode 100644 index 0000000000000000000000000000000000000000..06799089eace7b4d63fc5cfb903b053e1a026b28 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/Tools.php @@ -0,0 +1,2 @@ +<img src='image/Tools-1.test.php' border=2 bordercolor=black/> +<img src='image/Tools-2.test.php' border=2 bordercolor=black/> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/42.png b/maarch_entreprise/trunk/tools/graphic_lib/test/image/42.png new file mode 100644 index 0000000000000000000000000000000000000000..e3735110e694e1818f2bc7833f7d1e486de997ae Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/test/image/42.png differ diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-1.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-1.test.php new file mode 100644 index 0000000000000000000000000000000000000000..9e8f455f4735de261d85e0cd501c976224a8132d --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-1.test.php @@ -0,0 +1,16 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../AntiSpam.class.php"; + +$object = new AntiSpam; +$object->setRand(mt_rand(0, 15)); +$object->setNoise(mt_rand(0, 10)); +$object->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-2.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-2.test.php new file mode 100644 index 0000000000000000000000000000000000000000..557d6ed66bb38c412d07023049aafa227db53542 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-2.test.php @@ -0,0 +1,14 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../AntiSpam.class.php"; + +$object = new AntiSpam("plop"); +$object->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-3.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-3.test.php new file mode 100644 index 0000000000000000000000000000000000000000..49f32105cd8d58affddc5dcdb7d82f80405ea0f2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-3.test.php @@ -0,0 +1,16 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../AntiSpam.class.php"; + +$object = new AntiSpam; +$object->setRand(mt_rand(5, 10)); +$object->setBackgroundColor(new Color(mt_rand(220, 240), mt_rand(220, 240), mt_rand(220, 240))); +$object->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-4.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-4.test.php new file mode 100644 index 0000000000000000000000000000000000000000..54b131a489a9b6db95118e53adc72f17af6d3ecf --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/AntiSpam-4.test.php @@ -0,0 +1,15 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../AntiSpam.class.php"; + +$object = new AntiSpam('test it!'); +$object->save('test'); +$object->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-1.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-1.test.php new file mode 100644 index 0000000000000000000000000000000000000000..e104e34b70b473b0f26b222800b76c4956cfca98 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-1.test.php @@ -0,0 +1,68 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + + +$graph = new Graph(400, 300/*, "Albert", time() + mt_rand(2, 15)*/); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + +$x = array(); + +for($i = 0; $i < 7; $i++) { + $x[] = mt_rand(-20, 100); +} + +$y = array( + 'Lundi', + 'Mardi', + 'Mercredi', + 'Jeudi', + 'Vendredi', + 'Samedi', + 'Dimanche' +); + +$plot = new BarPlot($x); + +$plot->setSpace(6, 6, 10, 10); + +$plot->setBarColor(new Color(100, 100, 100, 50)); +$plot->setBarPadding(mt_rand(0, 30) / 100, mt_rand(0, 30) / 100); + +$plot->label->hideFirst(TRUE); +$plot->label->hideLast(TRUE); +$plot->label->set($x); +$plot->label->move(0, -23); +$plot->label->setBackgroundGradient(new LinearGradient(new Color(250, 250, 250, 10), new Color(255, 200, 200, 30), 0)); +$plot->label->border->setColor(new Color(20, 20, 20, 20)); +$plot->label->setPadding(0, 0, 0, 1); +$plot->label->setFont(new Tuffy(10)); + +$plot->setBackgroundGradient(new LinearGradient(new Color(210, 210, 210), new Color(255, 255, 255), 0)); + +$plot->grid->setBackgroundColor(new Color(235, 235, 180, 60)); + +$plot->yAxis->setLabelPrecision(2); +$plot->yAxis->label->setFont(new Tuffy(8)); + +$plot->xAxis->setLabelText($y); +$plot->xAxis->label->setFont(new Tuffy(8)); +$plot->xAxis->label->setAngle(mt_rand(0, 90)); + +$plot->legend->add($plot, "Test", LEGEND_BACKGROUND); +$plot->legend->setModel(LEGEND_MODEL_BOTTOM); +$plot->legend->setPadding(10, 10, 10, 10); +$plot->legend->setPosition(NULL, 0.85); +$plot->legend->setTextMargin(8, 0); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-2.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-2.test.php new file mode 100644 index 0000000000000000000000000000000000000000..f6a9a8dec1d89d43e3870ae3481a9706f2ca6329 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-2.test.php @@ -0,0 +1,83 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setBackgroundGradient(new LinearGradient(new Color(200, 200, 200), new Color(240, 240, 240), 0)); +$group->setPadding(40, NULL, 25, 25); + +$group->axis->left->setLabelNumber(10); +$group->axis->left->setLabelPrecision(2); +$group->axis->left->setTickStyle(TICK_OUT);; + +foreach(array('top', 'bottom') as $axis) { + $group->axis->{$axis}->setTickInterval(20); + $group->axis->{$axis}->setLabelInterval(1); + $group->axis->{$axis}->setTickStyle(TICK_OUT);; +} + +for($n = 0; $n < 4; $n++) { + + $x = array(); + + for($i = 0; $i < 10; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0); + } + + $plot = new BarPlot($x); + $plot->barBorder->setColor(color()); + + $plot->setBarGradient( + new LinearGradient( + color(60), color(60), 90 + ) + ); + + $y = array(); + foreach($x as $v) { + $y[] = sprintf("%.2f", $v); + } + + $plot->label->set($y); + $plot->label->setColor(color(0)); + $plot->label->setBackgroundColor(new Color(mt_rand(220, 240), mt_rand(220, 240), mt_rand(220, 240), mt_rand(10, 20))); + $plot->label->setPadding(1, 0, 0, 0); + $plot->label->setInterval(4); + $plot->label->setFont(new Font1); + + + $plot->setXAxis(PLOT_BOTTOM); + $plot->setYAxis(PLOT_LEFT); + + $group->add($plot); + $group->legend->add($plot, "Line #".($n + 1)); + +} + +$group->legend->setAlign(LEGEND_CENTER, LEGEND_TOP); +$group->legend->setPosition(0.87, 0.1); + +$graph->shadow->setSize(10); +$graph->shadow->setPosition(mt_rand(1, 4)); +$graph->shadow->smooth(mt_rand(0, 1) ? TRUE : FALSE); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-3.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-3.test.php new file mode 100644 index 0000000000000000000000000000000000000000..ff7e65de1a15429ad8fe25deb3c52155bce01d3c --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-3.test.php @@ -0,0 +1,63 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setSpace(3, 3, 5, 5); +$group->setBackgroundGradient(new LinearGradient(new Color(200, 200, 200), new Color(240, 240, 240), 0)); +$group->setPadding(NULL, NULL, 25, 25); + +$group->axis->left->setLabelPrecision(2); + +for($n = 0; $n < 4; $n++) { + + $x = array(); + + for($i = 0; $i < 5; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0); + } + + $plot = new BarPlot($x, $n + 1, 4); + $plot->barBorder->hide(); + + $plot->setXAxis(PLOT_TOP); + + $plot->barShadow->setSize(4); + $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); + $plot->barShadow->setColor(new Color(255, 255, 255, 20)); + $plot->barShadow->smooth(TRUE); + + $plot->setBarGradient( + new LinearGradient( + color(50), color(50), 90 + ) + ); + + $group->add($plot); + $group->legend->add($plot, "Line #".($n + 1), LEGEND_BACKGROUND); + +} + +$group->legend->setAlign(LEGEND_CENTER, LEGEND_TOP); +$group->legend->setPosition(0.87, 0.1); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-4.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-4.test.php new file mode 100644 index 0000000000000000000000000000000000000000..eb58fe90f802af677025987c3390c45cf50db2a4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-4.test.php @@ -0,0 +1,69 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +function labelFormat($value) { + return round($value, 2); +} + +$graph = new Graph(500, 400); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setSpace(5, 5, 15, 15); +$group->setPadding(40, 40, 25, 25); + +$group->axis->left->setLabelPrecision(2); + +for($n = 0; $n < 4; $n++) { + + $x = array(); + + for($i = 0; $i < 6; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0) + 0.3; + } + + $plot = new BarPlot($x, floor($n / 2) + 1, 2, (($n % 2) === 0) * 6); + $plot->barBorder->setColor(color()); + + $plot->setBarSpace(12); + + $plot->barShadow->setSize(4); + $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); + $plot->barShadow->setColor(new Color(180, 180, 180, 10)); + $plot->barShadow->smooth(TRUE); + + $plot->label->set($x); + $plot->label->move(0, -12); + $plot->label->setFont(new Font1); + $plot->label->setAngle(90); + $plot->label->setInterval(2); + $plot->label->setAlign(NULL, LABEL_TOP); + $plot->label->setBackgroundGradient(new LinearGradient(new Color(250, 250, 250, 10), new Color(255, 200, 200, 30), 0)); + $plot->label->border->setColor(new Color(20, 20, 20, 20)); + $plot->label->setPadding(3, 1, 1, 0); + $plot->label->setCallbackFunction("labelFormat"); + + $plot->setBarColor(color(5)); + + $group->add($plot); + +} + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-5.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-5.test.php new file mode 100644 index 0000000000000000000000000000000000000000..b7990c8050fb57d168d3566f3197ebc1211ed5fd --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-5.test.php @@ -0,0 +1,63 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setBackgroundGradient(new LinearGradient(new Color(200, 200, 200), new Color(240, 240, 240), 0)); +$group->setPadding(40, 40, 25, 25); + +$group->setXAxisZero((bool)mt_rand(0, 1)); +if(mt_rand(0, 1)) { + $group->setYMax(0); +} + +$group->axis->left->setLabelPrecision(2); + +for($n = 0; $n < 4; $n++) { + + $x = array(); + + for($i = 0; $i < 5; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) - 1; + } + + $plot = new BarPlot($x, $n + 1, 4); + $plot->barBorder->hide(); + + $plot->setBarPadding(0.2, 0.2); + $plot->barShadow->setSize(4); + $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); + $plot->barShadow->setColor(new Color(255, 255, 255, 20)); + $plot->barShadow->smooth(TRUE); + + $plot->setBarGradient( + new LinearGradient( + color(50), color(50), 90 + ) + ); + + $group->add($plot); + $group->legend->add($plot, "Line #".($n + 1), LEGEND_BACKGROUND); + +} + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-6.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-6.test.php new file mode 100644 index 0000000000000000000000000000000000000000..c76e3d13fcc8629b56ce8727f1a04d9ea7a0bb86 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/BarPlot-6.test.php @@ -0,0 +1,52 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../BarPlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(500, 400); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setSpace(5, 10, 15, 15); +$group->setPadding(40, 40, 25, 25); + +$group->axis->left->setLabelPrecision(2); + +for($n = 0; $n < 4; $n++) { + + $x = array(); + + for($i = 0; $i < 6; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 1400) / 1000 - 0.5) + 1; + } + + $plot = new BarPlot($x, 1, 1, (3 - $n) * 7); + $plot->barBorder->setColor(color()); + + $plot->barShadow->setSize(3); + $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); + $plot->barShadow->setColor(new Color(180, 180, 180, 10)); + $plot->barShadow->smooth(TRUE); + + $plot->setBarColor(color(5)); + + $group->add($plot); + +} + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-1.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-1.test.php new file mode 100644 index 0000000000000000000000000000000000000000..15f3ee209608cec26ec5942244cc4a24056cec42 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-1.test.php @@ -0,0 +1,67 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(400, 300, "Albert", time() + mt_rand(2, 15)); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + +$x = array(); + +for($i = 0; $i < 7; $i++) { + $x[] = mt_rand(-20, 100); +} + +$y = array( + 'Lundi', + 'Mardi', + 'Mercredi', + 'Jeudi', + 'Vendredi', + 'Samedi', + 'Dimanche' +); + +$plot = new LinePlot($x); + +$plot->setSpace(6, 6, 10, 10); + +$plot->hideLine(TRUE); +$plot->setFillColor(new Color(200, 200, 200, 75)); + +$plot->mark->setType(MARK_IMAGE); +$plot->mark->setImage(new FileImage("smiley.png")); + +$plot->label->set($x); +$plot->label->move(0, -23); +$plot->label->setBackgroundGradient(new LinearGradient(new Color(250, 250, 250, 10), new Color(255, 200, 200, 30), 0)); +$plot->label->border->setColor(new Color(20, 20, 20, 20)); +$plot->label->setPadding(3, 1, 1, 0); + +$plot->setBackgroundGradient(new LinearGradient(new Color(210, 210, 210), new Color(255, 255, 255), 0)); + +$plot->grid->setBackgroundColor(new Color(235, 235, 180, 60)); + +$plot->yAxis->setLabelPrecision(2); + +$plot->xAxis->setLabelText($y); +$plot->xAxis->setTickInterval(1); +$plot->xAxis->setNumberByTick('minor', 'major', 1); + +$plot->legend->add($plot, "Test", LEGEND_MARK); +$plot->legend->setModel(LEGEND_MODEL_BOTTOM); +$plot->legend->setPadding(10, 10, 10, 10); +$plot->legend->setPosition(NULL, 0.85); +$plot->legend->setTextMargin(8, 0); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-10.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-10.test.php new file mode 100644 index 0000000000000000000000000000000000000000..b9a4f498f63382152690bfbeb5bad6461f9fa50b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-10.test.php @@ -0,0 +1,80 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = mt_rand(20, 100); + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +function label($text, $font) { + + $label = new Label($text, $font, NULL, 0); + $label->setBackgroundColor(new Color(255, 255, 255, 25)); + $label->border->show(); + $label->setPadding(1, 0, 0, 0); + + return $label; + +} + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("It is a title"); +$graph->title->setBackgroundColor(new Color(255, 255, 255, 25)); +$graph->title->border->show(); +$graph->title->setPadding(3, 3, 3, 3); + +$label = label("Artichow", new Font5); +$graph->addLabel($label, 0.5, 0.5); + +$label = label("Current timestamp: ".date("Y-m-d H:i:s")."", new Font4); +$label->setAlign(LABEL_RIGHT, LABEL_TOP); +$graph->addAbsLabel($label, new Point(395, 395)); + +$x = array(); + +for($i = 0; $i < 6; $i++) { + $x[] = mt_rand(-100, 100); +} + +$plot = new LinePlot($x); + +$plot->setBackgroundGradient(new LinearGradient(color(80), color(80), 0)); +$plot->setColor(color()); +$plot->setFillGradient(new LinearGradient(color(), color(), 90)); + +$plot->mark->setType(MARK_CIRCLE); +$plot->mark->setSize(40); +$plot->mark->border->show(); + + +// All possible backgrounds +if(mt_rand(0, 2) === 0) { + $plot->mark->setFill(new RadialGradient(color(20), color(30))); +} else { + $plot->mark->setFill(new LinearGradient(color(20), color(30), 90 * mt_rand(0, 1))); +} + +$plot->mark->border->setColor(new Color(0, 0, 0, 50)); + +$plot->yAxis->setLabelNumber(15); +$plot->yAxis->setLabelPrecision(1); +$plot->yAxis->setNumberByTick('minor', 'major', 4); + +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->setNumberByTick('minor', 'major', 4); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-11.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-11.test.php new file mode 100644 index 0000000000000000000000000000000000000000..a042e77e639e6246beedc56c8f052a18c56feee9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-11.test.php @@ -0,0 +1,98 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} +function getPerCent($value) { + return sprintf('%.1f', $value).' %'; +} + +$graph = new Graph(450, 400); +$graph->setTiming(TRUE); + +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setBackgroundColor(color(80)); +$group->setXAxisZero(FALSE); + +$group->title->set("Some lines"); +$group->title->setBackgroundColor(new Color(255, 255, 255, 25)); +$group->title->border->show(); +$group->title->setPadding(3, 3, 3, 3); +$group->title->move(0, -15); + +$group->setPadding(45, NULL, 45, NULL); + + +$group->axis->left->setLabelNumber(mt_rand(0, 10)); +$group->axis->left->label->setCallbackFunction('getPerCent'); + +foreach(array('left', 'right') as $axis) { + $group->axis->{$axis}->setTickStyle(TICK_OUT);; +} + +foreach(array('top', 'bottom') as $axis) { + $group->axis->{$axis}->setTickStyle(TICK_OUT);; +} + +// Set axis title +$group->axis->left->title->set("Axis des Y : Mille deux cent quarante-et-un"); + +$group->axis->bottom->title->set("Axis des X : Quarante-deux plus un"); +$group->axis->bottom->title->setBackgroundColor(new Color(255, 255, 255, 25)); +$group->axis->bottom->title->setPadding(1, 0, 0, 0); + +$group->axis->top->title->set("Axis des X : Treize plus douze"); +$group->axis->top->title->setBackgroundColor(new Color(240, 200, 197, 25)); +$group->axis->top->title->setPadding(1, 0, 0, 0); + +$count = mt_rand(2, 4); + +for($n = 0; $n < $count; $n++) { + + $x = array(); + + for($i = 0; $i < 10; $i++) { + $x[] = round(cos($i * M_PI / 10) * mt_rand(-20, 100)); + } + + $plot = new LinePlot($x); + $plot->setColor(color()); + $plot->setFillColor(color(90)); + $plot->setXAxis(mt_rand(0, 1) ? PLOT_BOTTOM : PLOT_TOP); + $plot->setYAxis(mt_rand(0, 1) ? PLOT_LEFT : PLOT_RIGHT); + + $plot->label->set($x); + $plot->label->setColor(color(0)); + if($n%2 === 0) { + $plot->label->setBackgroundColor(new Color(mt_rand(220, 240), mt_rand(220, 240), mt_rand(220, 240), mt_rand(15, 35))); + } + $plot->label->setPadding(1, 0, 0, 0); + + $group->add($plot); + $group->legend->add($plot, str_repeat("#".($n + 1), mt_rand(1, 2)), ($n%2) ? LEGEND_LINE : LEGEND_BACKGROUND); + +} + +$group->legend->setColumns(2); +$group->legend->border->hide(); +$group->legend->setSpace(20); +$group->legend->setBackgroundColor(new Color(245, 255, 255)); +$group->setPadding(NULL, 130, NULL, NULL); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-12.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-12.test.php new file mode 100644 index 0000000000000000000000000000000000000000..b2961f776c9f9b8b9f90574166b906dd7d5b1058 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-12.test.php @@ -0,0 +1,77 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 400); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setBackgroundColor(color(80)); +$group->setPadding(NULL, NULL, 25, 25); + +$group->title->set("Two filled lines"); +$group->title->setFont(new TuffyBold(20)); +$group->title->setAlign(NULL, LABEL_CENTER); + +$group->grid->setInterval(1, 12); +$group->setXAxisZero(FALSE); + +foreach(array('left', 'right') as $axis) { + $group->axis->{$axis}->setLabelNumber(mt_rand(0, 10)); + $group->axis->{$axis}->setLabelPrecision(1); +} + +foreach(array('top', 'bottom') as $axis) { + $group->axis->{$axis}->label->hideLast(TRUE); + $group->axis->{$axis}->label->hideFirst(TRUE); + + $group->axis->{$axis}->setTickInterval(mt_rand(17, 23)); + $group->axis->{$axis}->setLabelInterval(2); +} + +for($n = 0; $n < 2; $n++) { + + $x = array(); + + for($i = 0; $i < 500; $i++) { + $x[] = cos($i * M_PI / 500) / ($n + 1) * mt_rand(800, 1200) / 1000; + } + + $plot = new LinePlot($x); + $plot->setColor(color()); + $plot->setFillColor(color(40)); + $plot->setXAxis(($n%2) ? 'top' : 'bottom'); + $plot->setYAxis(($n%2) ? 'left' : 'right'); + + $group->add($plot); + $group->legend->add($plot, "Line #".($n + 1), $n ? LEGEND_LINE : LEGEND_BACKGROUND); + +} + +$group->legend->border->setColor(color(0)); +$group->legend->setTextColor(color(0)); +$group->legend->setTextFont(new Font(mt_rand(1, 3))); +$group->legend->setPadding(3, 3, 3, 3); +$group->legend->setRows(1); +$group->legend->setAlign(LEGEND_LEFT, LEGEND_BOTTOM); + +$group->legend->setPosition(0.16, 0.86); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-13.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-13.test.php new file mode 100644 index 0000000000000000000000000000000000000000..ada5461de63fa6fb3c9d3b4177b622530dc90d87 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-13.test.php @@ -0,0 +1,68 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 400); +$graph->setTiming(TRUE); + + +$x = array(); + +for($i = 0; $i < 10; $i++) { + $x[] = mt_rand(-20, 100); +} + +$plot = new LinePlot($x); +$plot->setPadding(NULL, 40, NULL, NULL); +$plot->setBackgroundColor(color(80)); +$plot->setYAxis(PLOT_BOTH); +$plot->setColor(color()); + +if(mt_rand(0, 2) > 0) { + $plot->setFillGradient(new LinearGradient(color(40), color(60), mt_rand(0, 1) * 90)); +} else { + $plot->setFillColor(color(64)); +} + +$plot->yAxis->setLabelNumber(mt_rand(0, 10)); +$plot->yAxis->setLabelPrecision(1); +$plot->yAxis->title->set("Axis des Y : Quarante-deux"); + +$plot->xAxis->setTickInterval(2); +$plot->xAxis->setLabelInterval(2); +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->label->hideLast(TRUE); + +$plot->label->set($x); +$plot->label->setInterval(mt_rand(1, 5)); +$plot->label->setColor(color(0)); +$plot->label->setBackgroundColor(new Color(mt_rand(180, 220), mt_rand(180, 220), mt_rand(180, 220), mt_rand(25, 35))); +$plot->label->border->setColor(color()); +$plot->label->setPadding(1, 0, 0, 0); +$plot->label->setAngle(mt_rand(0, 1) ? 0 : 90); + +$plot->legend->add($plot, "Plip Plop", LEGEND_MARK); +$plot->legend->setModel(LEGEND_MODEL_BOTTOM); + +$graph->shadow->setSize(7); +$graph->shadow->setColor(new Color(0, 50, 150)); +$graph->shadow->setPosition(mt_rand(1, 4)); +$graph->shadow->smooth(mt_rand(0, 1) ? TRUE : FALSE); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-14.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-14.test.php new file mode 100644 index 0000000000000000000000000000000000000000..6cc8ee9566ad2b89374e4d73f108276a20ec5c51 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-14.test.php @@ -0,0 +1,89 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setBackgroundGradient(new LinearGradient(new Color(200, 200, 200), new Color(240, 240, 240), 0)); +$group->setPadding(30, NULL, 25, 25); + +$group->axis->left->setLabelNumber(10); +$group->axis->left->setLabelPrecision(2); +$group->axis->left->setTickStyle(TICK_OUT);; +$group->axis->left->label->setCallbackFunction('formatLabel'); + +function formatLabel($value) { + return $value.' %'; +} + +foreach(array('top', 'bottom') as $axis) { + $group->axis->{$axis}->label->hideLast(TRUE); + $group->axis->{$axis}->label->hideFirst(TRUE); + $group->axis->{$axis}->setLabelInterval(5); + $group->axis->{$axis}->setTickStyle(TICK_OUT);; +} + +for($n = 0; $n < 4; $n++) { + + $x = array(); + + for($i = 0; $i < /*100*/50; $i++) { + $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0); + } + + $plot = new LinePlot($x, mt_rand(0, 1) ? LINEPLOT_LINE : LINEPLOT_MIDDLE); + $plot->setColor(color()); + + $plot->setFillGradient( + new LinearGradient( + color(60), color(60), 90 + ) + ); + + $y = array(); + foreach($x as $v) { + $y[] = sprintf("%.2f", $v); + } + + $plot->label->set($y); + $plot->label->setColor(color(0)); + $plot->label->setBackgroundColor(new Color(mt_rand(220, 240), mt_rand(220, 240), mt_rand(220, 240), mt_rand(10, 20))); + $plot->label->setPadding(1, 0, 0, 0); + $plot->label->setInterval(12); + $plot->label->setFont(new Tuffy(6)); + + + $plot->setXAxis(PLOT_BOTTOM); + $plot->setYAxis(PLOT_LEFT); + + $group->add($plot); + $group->legend->add($plot, "Line #".($n + 1)); + +} + +$group->legend->setAlign(LEGEND_CENTER, LEGEND_TOP); +$group->legend->setPosition(0.87, 0.1); + +$graph->shadow->setSize(mt_rand(10, 20)); +$graph->shadow->setPosition(mt_rand(1, 4)); +$graph->shadow->smooth(mt_rand(0, 1) ? TRUE : FALSE); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-15.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-15.test.php new file mode 100644 index 0000000000000000000000000000000000000000..45381cce63991d9d78237ac7f0081a97a01243a0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-15.test.php @@ -0,0 +1,26 @@ +<?php + +require_once "../../LinePlot.class.php"; + +$graph = new Graph(); +$graph->setSize(400, 400); + +$x = array(1, 4, 3, -1, 1); + +$plot = new LinePlot($x); +$plot->setXAxisZero(FALSE); +$plot->setFillGradient( + new LinearGradient( + new Color(255, 20, 20, 30), + new Color(20, 255, 20, 30), + 0 + ) +); + +$graph->shadow->setSize(50); +$graph->shadow->smooth(mt_rand(0, 1) ? TRUE : FALSE); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-16.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-16.test.php new file mode 100644 index 0000000000000000000000000000000000000000..4744bdcf684cc71c17ae5f7616f57cf00c0fa5f4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-16.test.php @@ -0,0 +1,37 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +$graph = new Graph(450, 400); +$graph->setAntiAliasing(TRUE); + +$values = array(); +for($i = 0; $i < 15; $i++) { + $values[] = mt_rand(4, 20); +} + +$graph->title->set('Mon graphique'); + +$plot = new LinePlot($values, LINEPLOT_MIDDLE); +$plot->setFillColor(new Color(0, 200, 0, 75)); + +$plot->mark->setType(MARK_CIRCLE); +$plot->mark->setSize(8); +$plot->mark->setFill(new Color(255, 255, 255)); +$plot->mark->border->show(); + +$plot->setSpace(5, 5, 5, 5); +$plot->setBackgroundColor( + new Color(240, 240, 240) +); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-17.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-17.test.php new file mode 100644 index 0000000000000000000000000000000000000000..082cff2461949ddfe7c6355244c51f41fc53fa91 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-17.test.php @@ -0,0 +1,61 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(300, 200); +$graph->setAntiAliasing(TRUE); + +$group = new PlotGroup; +$group->setXAxisZero(FALSE); +$group->grid->setType(LINE_DASHED); + +$group->setBackgroundColor(new Color(197, 180, 210, 80)); + +$group->setPadding(40, NULL, 20, NULL); + +$group->axis->left->setLabelNumber(8); +$group->axis->left->setLabelPrecision(1); +$group->axis->left->setTickStyle(TICK_OUT); + +$x = array(NULL); + +for($i = 1; $i < 10; $i++) { + $x[] = cos($i * M_PI / 8) - 1; +} + +$plot = new LinePlot($x); +$plot->setXAxis(PLOT_TOP); +$plot->setColor(new Color(40, 40, 150, 10)); +$plot->setFillColor(new Color(40, 40, 150, 90)); + +$plot->mark->setType(MARK_BOOK); +$plot->mark->move(mt_rand(0, 10), mt_rand(0, 10)); + +$group->add($plot); + +$x = array(NULL, NULL, NULL); + +for($i = 8; $i < 14; $i++) { + $x[] = (cos($i * M_PI / mt_rand(2, 8))) / 2 - 0.2; +} + +$x[] = NULL; + +$plot = new LinePlot($x); +$plot->setXAxis(PLOT_TOP); +$plot->setColor(new Color(120, 120, 30, 10)); +$plot->setFillColor(new Color(120, 120, 30, 90)); + +$group->add($plot); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-18.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-18.test.php new file mode 100644 index 0000000000000000000000000000000000000000..3f0ee262257fdf5a65324c3d183472585fc6b651 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-18.test.php @@ -0,0 +1,44 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color() { + return new Color(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 100)); +} + +$graph = new Graph(450, 400); +$graph->title->set('test of LINEPLOT_MIDDLE'); +$graph->setAntiAliasing(TRUE); + +$values = array(); +for($i = 0; $i < 5; $i++) { + $values[] = mt_rand(4, 20); +} + +$group = new PlotGroup; +$group->setSpace(5, 5, 5, 5); +$group->setBackgroundColor( + new Color(240, 240, 240) +); + +$plot = new LinePlot($values, LINEPLOT_MIDDLE); +$plot->setFillColor(color()); + +$plot->mark->setType(MARK_CIRCLE); +$plot->mark->setSize(mt_rand(1, 20)); +$plot->mark->setFill(new Color(255, 255, 255)); +$plot->mark->border->show(); + + +$group->add($plot); + +$graph->add($group); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-2.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-2.test.php new file mode 100644 index 0000000000000000000000000000000000000000..652d9d05c5655df913ec36a2b8af49fb1126dc9c --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-2.test.php @@ -0,0 +1,53 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +function color($a = NULL) { + if($a === NULL) { + $a = mt_rand(0, 100); + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 300); +$graph->setBackgroundColor(new Color(175, 175, 175)); + +$x = array( + mt_rand(-20, 20), + 42, + mt_rand(-20, 20), + 15, + 80, + 42, + 42, + mt_rand(-20, 20) +); + +$plot = new LinePlot($x); +$plot->setBackgroundImage(new FileImage("42.png")); +$plot->setAbsSize(350, 250); +$plot->setCenter(0.5, 0.5); +$plot->setThickness(mt_rand(4, 6)); +$plot->setFillColor(color()); + +$plot->grid->setColor(new Color(0, 200, 42)); +$plot->grid->hide(FALSE); +$plot->grid->setColor(new Color(255, 25, 160)); + +$plot->yAxis->label->hideFirst(FALSE); +$plot->yAxis->label->setFont(new Font2); + +$plot->xAxis->setNumberByTick('minor', 'major', 2); +$plot->xAxis->label->hideFirst(TRUE); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-3.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-3.test.php new file mode 100644 index 0000000000000000000000000000000000000000..fee0cc4fa74c879a60b79e943e95aa1fba813fc4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-3.test.php @@ -0,0 +1,59 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color() { + return new Color(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 100)); +} + +$width = mt_rand(200, 400); + +$graph = new Graph($width, 400); +$graph->setAntiAliasing(TRUE); +$graph->setBackgroundColor(new Color(50, 50, 50)); + +$x = array( + -100, + 35, + -20, + 15, + 79, + -50 +); + +$plot = new LinePlot($x); +$plot->setAbsSize($width - 20, 380); +$plot->setAbsPosition(mt_rand(0, 20), mt_rand(0, 20)); + +$plot->setThickness(mt_rand(2, 5)); +$plot->setBackgroundGradient(new LinearGradient(color(), color(), mt_rand(0, 1) * 90)); +$plot->yAxis->setLabelNumber(mt_rand(0, 10)); +/* +$plot->setYMin(-80); +$plot->setYMax(120); +*/ + +$plot->xAxis->setLabelInterval(2); +$plot->xAxis->setTickInterval(2); +$major = $plot->xAxis->tick('major'); +$major->setSize(10); +$minor = $plot->xAxis->tick('minor'); +$minor->setSize(6); +$plot->xAxis->setNumberByTick('minor', 'major', 4); +$plot->xAxis->label->hideFirst(TRUE); + +$plot->grid->setType(LINE_DOTTED); + +$plot->label->set($x); +$plot->label->setBackgroundColor(new Color(mt_rand(200, 240), mt_rand(200, 240), mt_rand(200, 240), mt_rand(0, 20))); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-4.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-4.test.php new file mode 100644 index 0000000000000000000000000000000000000000..294867da1be9705c57fd1a405331e7ae2b38f29b --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-4.test.php @@ -0,0 +1,103 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + + +$graph = new Graph(); +$graph->setTiming(TRUE); + +function color($a = NULL) { + if($a === NULL) { + $a = mt_rand(0, 100); + } + return new Color(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), $a); +} + +function label($text, $font) { + + $label = new Label($text, $font, NULL, 0); + $label->setBackgroundColor(color(25)); + $label->border->show(); + $label->setPadding(1, 0, 0, 0); + + return $label; + +} + +$graph->setSize(400, 400); +$graph->setFormat(IMAGE_PNG); +$graph->setBackgroundColor(new Color(150, 150, 150)); + +for($i = 0; $i <= 1; $i++) { + + $x = array(); + + for($j = 0, $count = mt_rand(1, 8); $j <= $count; $j++) { + $x[] = mt_rand(-100, 100) / 10; + } + + $plot = new LinePlot($x); + + $plot->title->set(label("Component #".$i, new Font2)); + + if(mt_rand(0, 1) === 0) { + $plot->setBackgroundGradient(new LinearGradient(color(), color(), mt_rand(0, 1) * 90)); + } else { + $plot->setBackgroundColor(color()); + } + + + $mark = mt_rand(1, 2); + + $plot->mark->setType($mark); + $plot->mark->setSize(mt_rand(3, 16)); + $plot->mark->border->show(); + + if($mark === 1 or mt_rand(0, 1) === 1) { + $plot->mark->setFill(color()); + } else { + $plot->mark->setFill(new LinearGradient(color(), color(), 0)); + } + + $plot->mark->border->setColor(color()); + + $plot->setSize(0.33 + $i / 2 + mt_rand(0, 15) / 100, 0.33 + mt_rand(0, 15) / 100); + $plot->setCenter(0.25 + $i / 4 + (1 - $i) * mt_rand(0, 40) / 100, 0.25 + $i / 2 - $i * mt_rand(0, 10) / 100); + + $plot->grid->setColor(new Color(160, 200 * ($i - 1), 42 * $i)); + $plot->grid->hide(FALSE); + $plot->grid->setBackgroundColor(new Color(235 - 20 * $i, 235 + 20 * $i, 180, 50)); + + $plot->setYAxis(mt_rand(0, 1) ? PLOT_RIGHT : PLOT_LEFT); + $plot->setXAxis(mt_rand(0, 1) ? PLOT_TOP : PLOT_BOTTOM); + $plot->setPadding(NULL, NULL, 40, NULL); + + $plot->yAxis->label->hideFirst((bool)$i); + $plot->yAxis->setLabelPrecision(2 - $i); + $plot->yAxis->setColor(new Color(124 / ($i+1), 50, 20)); + $plot->yAxis->setNumberByTick('minor', 'major', $i * 2); + $plot->yAxis->label->setFont(new Font3); + $plot->yAxis->label->setAngle($i ? 90 : 0); + $plot->yAxis->label->setColor(new Color(124 / ($i+1), 20, 200)); + + + $plot->xAxis->setNumberByTick('minor', 'major', 2 + $i); + $plot->xAxis->setLabelInterval(2 - $i); + $plot->xAxis->label->setColor(color(0)); + $plot->xAxis->label->setBackgroundColor(new Color(255, 255, 255, 10)); + $plot->xAxis->label->border->setColor(new Color(0, 0, 0, 10)); + $plot->xAxis->label->setPadding(2, 0, -1, -1); + + $graph->add($plot); + +} + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-5.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-5.test.php new file mode 100644 index 0000000000000000000000000000000000000000..cd92f971f71ec7e3d976da1ab41c9dfaac7de346 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-5.test.php @@ -0,0 +1,61 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +function label($value) { + return $value.' %'; +} + +$graph = new Graph(400, 400); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + + +$x = array(); + +for($i = 0; $i < 5; $i++) { + $x[] = mt_rand(-20, 100); +} + +$plot = new LinePlot($x); +$plot->setBackgroundColor(color(80)); +$plot->setXAxis(PLOT_BOTH); +$plot->setYAxis(PLOT_BOTH); +$plot->setColor(color()); +$plot->setStyle(LINE_DOTTED); + +$plot->grid->hideHorizontal(TRUE); +$plot->grid->setBackgroundColor(new Color(235, 235, 180, 60)); + +$plot->yAxis->setLabelNumber(mt_rand(0, 10)); +$plot->yAxis->setLabelPrecision(1); + +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->label->hideLast(TRUE); + +$plot->label->set($x); +$plot->label->move(0, mt_rand(0, 20)); +$plot->label->setCallbackFunction('label'); +$plot->label->setColor(color(0)); +$plot->label->setBackgroundColor(new Color(mt_rand(200, 240), mt_rand(200, 240), mt_rand(200, 240), mt_rand(0, 20))); +$plot->label->border->setColor(color()); +$plot->label->setPadding(mt_rand(0, 3), mt_rand(0, 3), mt_rand(0, 3), mt_rand(0, 3)); +$plot->label->setAngle(mt_rand(0, 1) ? 0 : 90); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-6.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-6.test.php new file mode 100644 index 0000000000000000000000000000000000000000..514ae6b13b68eebd3b1c2d5ddc9e5a3058040707 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-6.test.php @@ -0,0 +1,53 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 400); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + + +$x = array(); +$n = mt_rand(5, 5); + +for($i = 0; $i < $n; $i++) { + $x[] = mt_rand(-20, 100); +} + +$plot = new LinePlot($x); +$plot->setPadding(40, 40, NULL, NULL); +$plot->setBackgroundColor(color(80)); +$plot->setYAxis(PLOT_BOTH); +$plot->setColor(color()); +$plot->setFillColor(color(90)); + +$plot->yAxis->setLabelNumber(mt_rand(0, 10)); +$plot->yAxis->setLabelPrecision(1); + +$plot->xAxis->label->hideLast(TRUE); + +$plot->label->set($x); +$plot->label->setInterval(mt_rand(1, 5)); +$plot->label->setColor(color(0)); +$plot->label->setBackgroundColor(new Color(mt_rand(180, 220), mt_rand(180, 220), mt_rand(180, 220), mt_rand(25, 35))); +$plot->label->border->setColor(color()); +$plot->label->setPadding(1, 0, 0, 0); +$plot->label->setAngle(mt_rand(0, 1) ? 0 : 90); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-7.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-7.test.php new file mode 100644 index 0000000000000000000000000000000000000000..478294227918af3c23e907d8d984933d79f22b57 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-7.test.php @@ -0,0 +1,65 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = 0; + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(); +$graph->setTiming(TRUE); +$graph->setSize(400, 400); +$graph->setAntiAliasing(TRUE); + + +$x = array(); +$k = array(); + +for($i = 0; $i < 100; $i++) { + $x[] = cos($i / 10); + $k[] = sprintf("%.1f", $i / 10); +} + +$plot = new LinePlot($x, $k); +$plot->setBackgroundColor(color(80)); +$plot->setYAxis(PLOT_BOTH); +$plot->setColor(color()); + +$plot->grid->setInterval(mt_rand(1, 4), mt_rand(1, 4)); + +$plot->yAxis->setLabelNumber(20); +$plot->yAxis->setLabelPrecision(1); + +$plot->xAxis->setTickInterval(5); +$plot->xAxis->setLabelInterval(2); +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->label->hideLast(TRUE); +$plot->xAxis->setNumberByTick('minor', 'major', 1); +$plot->xAxis->setLabelText($k); + +foreach($x as $k => $v) { + $x[$k] = sprintf("%.2f", $v); +} + + + +$plot->label->set($x); +$plot->label->setColor(color(0)); +$plot->label->setBackgroundColor(new Color(mt_rand(180, 220), mt_rand(180, 220), mt_rand(180, 220), mt_rand(25, 35))); +$plot->label->border->setColor(color()); +$plot->label->setPadding(1, 0, 0, 0); +$plot->label->setAngle(0); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-8.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-8.test.php new file mode 100644 index 0000000000000000000000000000000000000000..86d117a3e56588d483df76e3692358109d9ffb32 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-8.test.php @@ -0,0 +1,50 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = mt_rand(20, 100); + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(); +$graph->setTiming(TRUE); +$graph->setSize(400, 400); +$graph->setAntiAliasing(TRUE); + + +$x = array(); + +for($i = 0; $i < 10; $i++) { + $x[] = mt_rand(-20, 100); +} + +$plot = new LinePlot($x); +$plot->setBackgroundColor(color(80)); +$plot->setColor(color()); +$plot->setFillGradient(new LinearGradient(color(), color(), 90)); + +$plot->grid->hideVertical(TRUE); + +$plot->setYMin(mt_rand(-20, -30)); + +$plot->yAxis->setLabelNumber(mt_rand(0, 10)); +$plot->yAxis->setLabelPrecision(1); + +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->setNumberByTick('minor', 'major', 2); + +$plot->setXAxisZero((bool)mt_rand(0, 1)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-9.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-9.test.php new file mode 100644 index 0000000000000000000000000000000000000000..9a534f1110f00595344a5c7d6b2b664723dbd1ff --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/LinePlot-9.test.php @@ -0,0 +1,49 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../LinePlot.class.php"; + +function color($a = NULL) { + if($a === NULL) { + $a = mt_rand(20, 80); + } + return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); +} + +$graph = new Graph(400, 400, "Abel", time() + 5); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + + +$x = array(); + +for($i = 0; $i < 10; $i++) { + $x[] = mt_rand(0, 100); +} + +$plot = new LinePlot($x); +$plot->setThickness(1); +$plot->setColor(color()); +$plot->setFillGradient(new LinearGradient(color(), color(), 0)); + +$plot->grid->setType(LINE_DASHED); + +$plot->setYMin(mt_rand(-20, 0)); + +$plot->yAxis->setLabelNumber(mt_rand(0, 10)); +$plot->yAxis->setLabelPrecision(1); + +$plot->xAxis->label->hideFirst(TRUE); +$plot->xAxis->setNumberByTick('minor', 'major', 2); + +$plot->setXAxisZero((bool)mt_rand(0, 1)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-1.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-1.test.php new file mode 100644 index 0000000000000000000000000000000000000000..0608aebd532655578bf444be1ce2a323680261ac --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-1.test.php @@ -0,0 +1,50 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../MathPlot.class.php"; + + +$graph = new Graph(400, 400); +$graph->setTiming(TRUE); + +$plot = new MathPlot(-5, 5, 5, -5); +$plot->grid->hide(FALSE); +$plot->grid->setType(LINE_DOTTED); +$plot->setInterval(mt_rand(1, 10) / 10); + +function x2($x) { + return $x * $x; +} + +function random($x) { + return mt_rand(-3, 3); +} + +$function = new MathFunction('x2'); +$plot->add($function, "f(x) = x * x"); + +$function = new MathFunction('random'); +$function->setColor(new Orange); +$plot->add($function); + +$function = new MathFunction('sqrt', 0); +$function->setColor(new DarkBlue); +$function->line->setThickness(3); +$plot->add($function, "f(x) = sqrt(x)"); + +$function = new MathFunction('sin'); +$function->setColor(new DarkGreen); +$function->line->setStyle(LINE_DASHED); +$plot->add($function, "f(x) = sin(x)"); + +$plot->legend->setPosition(NULL, 0.85); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-2.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-2.test.php new file mode 100644 index 0000000000000000000000000000000000000000..34b8a80410f654cbe3448724e451c42effc03de9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-2.test.php @@ -0,0 +1,32 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../MathPlot.class.php"; + + +$graph = new Graph(400, 400); +$graph->setTiming(TRUE); + +$plot = new MathPlot(mt_rand(-10, 0), mt_rand(1, 10), mt_rand(1, 10), mt_rand(-10, 0)); +$plot->setInterval(0.05); + +$function = new MathFunction('asin', -1, 1); +$function->setColor(new DarkGreen); +$function->line->setStyle(LINE_DASHED); // Don't work as expected +$plot->add($function, "f(x) = asin(x)"); + +$function = new MathFunction('log', 0.0000001); +$function->setColor(new DarkRed); +$plot->add($function, "f(x) = log(x)"); + +$plot->legend->setPosition(0.5, 0.85); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-3.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-3.test.php new file mode 100644 index 0000000000000000000000000000000000000000..852f0e4f78d4d5e5830308140efa2e6457286c34 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/MathPlot-3.test.php @@ -0,0 +1,40 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../MathPlot.class.php"; + + +$graph = new Graph(400, 400); +$graph->setTiming(TRUE); + +$plot = new MathPlot(-3, 3, 6, 0); +$plot->setInterval(0.2); +$plot->setPadding(NULL, NULL, NULL, 20); + +$function = new MathFunction('acos', -1, 1); +$function->setColor(new DarkGreen); +$function->mark->setType(MARK_SQUARE); +$function->mark->setSize(4); +$plot->add($function, "f(x) = acos(x)"); + +$function = new MathFunction('exp'); +$function->setColor(new DarkRed); +$function->mark->setType(MARK_CIRCLE); +$function->mark->setSize(7); +$function->mark->setFill(new Blue); +$function->mark->border->show(); +$function->mark->border->setColor(new Black); +$function->line->hide(TRUE); +$plot->add($function, "f(x) = exp(x)"); + +$plot->legend->setPosition(0.4, 0.1); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-1.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-1.test.php new file mode 100644 index 0000000000000000000000000000000000000000..8f7716b8ac1411c56d5b1a1c64480bcecf98070d --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-1.test.php @@ -0,0 +1,55 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(400, 300); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + +$graph->title->set("It's raining again"); +$graph->title->setBackgroundColor(new White(25)); +$graph->title->border->show(); +$graph->title->setPadding(3, 3, 3, 3); + +$x = array(); + +for($i = 0; $i < 7; $i++) { + $x[] = mt_rand(20, 100); +} + +$y = array( + 'Lundi', + 'Mardi', + 'Mercredi', + 'Jeudi', + 'Vendredi', + 'Samedi', + 'Dimanche' +); + +$plot = new Pie($x, PIE_AQUA); +$plot->setCenter(0.5, 0.58); +$plot->setSize(mt_rand(50, 100) / 100, mt_rand(50, 100) / 100); + +$plot->setLegend($y); +$plot->setBorder(new Color(0, 0, 0)); + +$plot->label->hide(TRUE); + + +//$plot->legend->add($plot, "Test", LEGEND_BACKGROUND); +$plot->legend->setPadding(10, 10, 10, 10); +$plot->legend->setTextMargin(8, 0); +$plot->legend->shadow->setSize(4); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-2.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-2.test.php new file mode 100644 index 0000000000000000000000000000000000000000..b7e8688aa4f27242e30feb60f9d9f95941c4b7ba --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-2.test.php @@ -0,0 +1,49 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(400, 300); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + +for($i = 0; $i < 4; $i++) { + + $x = array(); + + for($j = 0; $j < 6; $j++) { + $x[] = mt_rand(35, 100); + } + + $plot = new Pie($x, PIE_DARK); + $plot->setStartAngle(mt_rand(0, 360)); + $plot->title->set('Pie #'.$i); + $plot->setSize(0.45, 0.45); + $plot->setCenter(($i % 2) / 2 + 0.20, ($i > 1) ? 0.20 : 0.70); + + if(mt_rand(0, 1) === 1) { + $plot->set3D(15); + } + + $plot->setBorder(new Color(230, 230, 230)); + $plot->explode(array(mt_rand(5, 35), 3 => 8)); + + if($i === 3) { + $plot->legend->setPosition(1.1, 1.0); + } else { + $plot->legend->setTextMargin(8, 0); + $plot->legend->hide(TRUE); + } + + $graph->add($plot); + +} +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-3.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-3.test.php new file mode 100644 index 0000000000000000000000000000000000000000..3d90196a44766b53521f27c0b913b16866b862fc --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-3.test.php @@ -0,0 +1,45 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(400, 300); + +$x = array(); + +for($i = 0; $i < 10; $i++) { + $x[] = mt_rand(0, 100); +} + +$plot = new Pie($x); +$plot->setSize(0.8, 0.8); +$plot->setCenter(0.45, 0.5); +$plot->set3D(20); +$plot->setBorder(new Color(100, 100, 100)); + +$plot->label->setPadding(2, 2, 2, 2); +$plot->label->border->setColor(new Red(60)); +$plot->label->setFont(new Tuffy(7)); +$plot->label->setBackgroundGradient( + new LinearGradient( + new Red(80), + new White(80), + 0 + ) +); +$plot->setLabelPrecision(1); + +$plot->legend->setPadding(10, 10, 10, 10); +$plot->legend->setTextMargin(8, 0); +$plot->legend->setPosition(1.16, 0.5); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-4.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-4.test.php new file mode 100644 index 0000000000000000000000000000000000000000..b3977fb49d7e73ae58ba0bf3eafd60e063e83407 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-4.test.php @@ -0,0 +1,46 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + +function callbackLabel($value) { + return ".:: *** ::.\n".$value."\n.:: *** ::."; +} + +$graph = new Graph(400, 300); + +$x = array(); + +for($i = 0; $i < 9; $i++) { + $x[] = mt_rand(20, 100); +} + +$plot = new Pie($x); +$plot->setSize(0.6, 0.6); +$plot->setCenter(0.4, 0.5); + +$plot->legend->shadow->setSize(4); +$plot->legend->setPadding(10, 10, 10, 10); +$plot->legend->setTextMargin(8, 0); +$plot->legend->setPosition(1.45, 0.50); +$plot->legend->setAlign(LEGEND_RIGHT); + +$plot->setLegend(array( + 'Un', 'Deux', 'Trois', 'Quatre', 'Cinq', 'Six', 'Sept', 'Huit', 'Neuf' +)); + +$plot->setLabelNumber(6); +$plot->setLabelMinimum(10); + +$plot->label->setCallbackFunction('callbackLabel'); +$plot->label->setFont(new Tuffy(8)); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-5.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-5.test.php new file mode 100644 index 0000000000000000000000000000000000000000..9f538d9208f95be361858ad1bbdca9d46a5c650d --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-5.test.php @@ -0,0 +1,44 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(400, 300); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + +$x = array(); + +for($i = 0; $i < 7; $i++) { + $x[] = mt_rand(20, 100); +} + +$plot = new Pie($x, PIE_EARTH); +$plot->setBorder(new Color(50, 50, 50)); +$plot->set3D(20); + +$plot->setLabelPosition(-60); +$plot->label->setPadding(2, 2, 2, 2); +$plot->label->border->setColor(new Red(20)); +$plot->label->setFont(new Tuffy(7)); +$plot->label->setBackgroundGradient( + new LinearGradient( + new LightRed(30), + new White(30), + 0 + ) +); + +$plot->legend->setPadding(10, 10, 10, 10); +$plot->legend->setTextMargin(8, 0); + +$graph->add($plot); +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-6.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-6.test.php new file mode 100644 index 0000000000000000000000000000000000000000..d8e8519e35761db3a7674c92d8ff45bed4e91323 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Pie-6.test.php @@ -0,0 +1,41 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Pie.class.php"; + + +$graph = new Graph(400, 300); +$graph->setTiming(TRUE); +$graph->setAntiAliasing(TRUE); + +$graph->shadow->setSize(10); +$graph->shadow->smooth(TRUE); + +$x = array(); + +for($j = 0; $j < mt_rand(3, 6); $j++) { + $x[] = mt_rand(35, 100); +} + +$plot = new Pie($x, PIE_DARK); +$plot->setSize(0.8, 0.8); +$plot->setCenter(mt_rand(45, 55) / 100, mt_rand(45, 55) / 100); + +$plot->set3D(10); +$plot->setBorder(new Color(230, 230, 230)); +$plot->explode(array(1 => mt_rand(5, 50), 2 => mt_rand(5, 50), 3 => 12)); + +$plot->legend->setPadding(10, 10, 10, 10); +$plot->legend->setTextMargin(8, 0); +$plot->legend->hide(TRUE); + +$graph->add($plot); + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/ScatterPlot-1.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/ScatterPlot-1.test.php new file mode 100644 index 0000000000000000000000000000000000000000..1e6663bde5e590c011cf56e6bdd8b70607a44093 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/ScatterPlot-1.test.php @@ -0,0 +1,32 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../ScatterPlot.class.php"; + +$graph = new Graph(300, 300); +$graph->title->set('One value!'); + +$y = array(mt_rand(-42, 42)); + +$plot = new ScatterPlot($y); +$plot->setPadding(NULL, NULL, 40, 20); + +// Set dashed lines on the grid +$plot->grid->setType(LINE_DASHED); + +$plot->mark->setSize(mt_rand(0, 60)); +$plot->mark->setFill(new Black(mt_rand(0, 50))); + +$plot->label->set($y); +$plot->label->setColor(new White); + +$graph->add($plot); +$graph->draw(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/Tools-1.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Tools-1.test.php new file mode 100644 index 0000000000000000000000000000000000000000..50ac1dbbfffcbfa5134ea0ba2cdf9bd60bca6044 --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Tools-1.test.php @@ -0,0 +1,142 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ +require_once "../../Graph.class.php"; + +$graph = new Graph(400, 400); +//$graph->setAntiAliasing(TRUE); +$graph->title->set("Ticks"); + +$drawer = $graph->getDrawer(); + +// Simple horizontal line +$line = new Vector( + new Point(10, 50), + new Point(390, 50) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(10, 8); +$tick->draw($drawer, $line); +$tick2 = new Tick(40 - 3, 5); +$tick2->setInterval(2); +$tick2->draw($drawer, $line); +$tick3 = new Tick(0, 2); +$tick3->setNumberByTick($tick2, 1); +$tick3->draw($drawer, $line); + +// Simple horizontal line +// TICK_OUT style +// Hide first tick +$line = new Vector( + new Point(10, 70), + new Point(390, 70) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(20, 5); +$tick->setStyle(TICK_OUT); +$tick->hideFirst(TRUE); +$tick->draw($drawer, $line); + +// Simple horizontal line +// TICK_IN_OUT style +// Change color and hide last tick +$line = new Vector( + new Point(10, 90), + new Point(390, 90) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(10, 5); +$tick->setColor(new Red); +$tick->setStyle(TICK_IN_OUT); +$tick->hideLast(TRUE); +$tick->draw($drawer, $line); + +// Horizontal line 180° +$line = new Vector( + new Point(390, 110), + new Point(10, 110) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(60, 5); +$tick->draw($drawer, $line); + +// Simple vertical line +$line = new Vector( + new Point(20, 130), + new Point(20, 390) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(10, 5); +$tick->draw($drawer, $line); + +// Simple vertical line +// TICK_OUT style +// Hide first tick +$line = new Vector( + new Point(40, 130), + new Point(40, 390) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(10, 5); +$tick->setStyle(TICK_OUT); +$tick->hideFirst(TRUE); +$tick->draw($drawer, $line); + +// Simple vertical line +// TICK_IN_OUT style +// Change color and hide last tick +$line = new Vector( + new Point(60, 130), + new Point(60, 390) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(10, 5); +$tick->setColor(new Blue); +$tick->setStyle(TICK_IN_OUT); +$tick->hideLast(TRUE); +$tick->draw($drawer, $line); + +// Complex line +$line = new Vector( + new Point(80, 130), + new Point(390, 390) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(10, 5); +$tick->draw($drawer, $line); + +// Complex line +// Hide first tick +// TICK_OUT style +// Change color +$line = new Vector( + new Point(390, 130), + new Point(80, 390) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(10, 10); +$tick->setColor(new DarkGreen); +$tick->setStyle(TICK_OUT); +$tick->hideFirst(TRUE); +$tick->draw($drawer, $line); + +// Complex line +// TICK_IN_OUT style +// Hide last tick +$line = new Vector( + new Point(360, 390), + new Point(80, 160) +); +$drawer->line(new VeryLightGray, $line); +$tick = new Tick(30, 15); +$tick->setStyle(TICK_IN_OUT); +$tick->hideLast(TRUE); +$tick->draw($drawer, $line); + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/Tools-2.test.php b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Tools-2.test.php new file mode 100644 index 0000000000000000000000000000000000000000..5b2676f6116990406de0846fafce695203eac79e --- /dev/null +++ b/maarch_entreprise/trunk/tools/graphic_lib/test/image/Tools-2.test.php @@ -0,0 +1,110 @@ +<?php +/* + * This work is hereby released into the Public Domain. + * To view a copy of the public domain dedication, + * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to + * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + * + */ + +require_once "../../Graph.class.php"; + +$graph = new Graph(400, 400); +$graph->setAntiAliasing(FALSE); // TRUE est bogus sa mère +$graph->title->set("Axis"); + +$drawer = $graph->getDrawer(); + +// Horizontal axis +$xAxis = new Axis(); +$xAxis->setColor(new MidBlue); +//$xAxis->line->setThickness(2); +$xAxis->setRange(-10, 10); +$xAxis->setPadding(20, 20); +$xAxis->line->setX(10, 390); + +$labels = array(); +for($i = -10; $i <= 10; $i++) { + if($i !== 0) { + $labels[] = $i; + } +} +$xAxis->label->set($labels); +$xAxis->label->setColor(new DarkGray); +$xAxis->label->setFont(new Tuffy(7)); +$xAxis->label->move(0, 8); + +$tick = new Tick(0, 2); +$xAxis->addTick('minor', $tick); + +$tick = new Tick(21, 5); +$xAxis->addTick('major', $tick); + +$xAxis->setNumberByTick('minor', 'major', 3); + +// Vertical axis +$yAxis = new Axis(); +$yAxis->setColor(new MidBlue); +//$yAxis->line->setThickness(2); +$yAxis->setRange(5, -5); +$yAxis->setPadding(20, 20); +$yAxis->line->setY(50, 240); + +$labels = array(); +for($i = -5; $i <= 5; $i++) { + if($i !== 0) { + $labels[] = $i; + } +} +$yAxis->label->set($labels); +$yAxis->label->setColor(new DarkGray); +$yAxis->label->setAlign(LABEL_RIGHT); +$yAxis->label->setFont(new Tuffy(7)); +$yAxis->label->move(-5, 0); + +$tick = new Tick(0, 2); +$yAxis->addTick('minor', $tick); + +$tick = new Tick(11, 5); +$yAxis->addTick('major', $tick); + +$yAxis->setNumberByTick('minor', 'major', 3); + +$xAxis->setYCenter($yAxis, 0); +$yAxis->setXCenter($xAxis, 0); + +$xAxis->draw($drawer); +$yAxis->draw($drawer); + +for($x = -10; $x <= 10; $x += 0.1) { + + $p = Axis::toPosition( + $xAxis, $yAxis, + new Point($x, cos($x) * 4) + ); + $drawer->point(new Red, $p); + +} + +// Vertical axis +$axis = new Axis(); +//$axis->line->setThickness(2); +$axis->setRange(8, -8); +$axis->setPadding(10, 10); +$axis->line->setLocation( + new Point(20, 260), + new Point(380, 380) +); + +$tick = new Tick(0, 4); +$axis->addTick('minor', $tick); + +$tick = new Tick(11, 8); +$axis->addTick('major', $tick); + +$axis->setNumberByTick('minor', 'major', 3); + +$axis->draw($drawer); + +$graph->draw(); +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/graphic_lib/test/image/smiley.png b/maarch_entreprise/trunk/tools/graphic_lib/test/image/smiley.png new file mode 100644 index 0000000000000000000000000000000000000000..454a82f8932a7f4ee04b2be1d2a8d8bd481c1c1e Binary files /dev/null and b/maarch_entreprise/trunk/tools/graphic_lib/test/image/smiley.png differ diff --git a/maarch_entreprise/trunk/tools/mails/LICENCE.php b/maarch_entreprise/trunk/tools/mails/LICENCE.php new file mode 100644 index 0000000000000000000000000000000000000000..0cf291b147332e5caa68d447e2262bc6be5bdaf0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/LICENCE.php @@ -0,0 +1,277 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/maarch_entreprise/trunk/tools/mails/LICENSE b/maarch_entreprise/trunk/tools/mails/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..2e3a6a5594efc35794d816a90d25cccda5bfdc41 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/LICENSE @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + diff --git a/maarch_entreprise/trunk/tools/mails/RFC822.php b/maarch_entreprise/trunk/tools/mails/RFC822.php new file mode 100644 index 0000000000000000000000000000000000000000..c2bf425b36d6130e9607ff0e5afa9ee030d49054 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/RFC822.php @@ -0,0 +1,872 @@ +<?php +/** +* RFC 822 Email address list validation Utility +* +* What is it? +* +* This class will take an address string, and parse it into it's consituent +* parts, be that either addresses, groups, or combinations. Nested groups +* are not supported. The structure it returns is pretty straight forward, +* and is similar to that provided by the imap_rfc822_parse_adrlist(). Use +* print_r() to view the structure. +* +* How do I use it? +* +* $address_string = 'My Group: "Richard Heyes" <richard@localhost> (A comment), ted@example.com (Ted Bloggs), Barney;'; +* $structure = Mail_RFC822::parseAddressList($address_string, 'example.com', TRUE) +* print_r($structure); +* +* @author Richard Heyes <richard@phpguru.org> +* @author Chuck Hagenbuch <chuck@horde.org> +* @version $Revision: 1.1 $ +* @package Mail +*/ + +class Mail_RFC822 +{ + /** + * The address being parsed by the RFC822 object. + * @var string $address + */ + var $address = ''; + + /** + * The default domain to use for unqualified addresses. + * @var string $default_domain + */ + var $default_domain = 'localhost'; + + /** + * Should we return a nested array showing groups, or flatten everything? + * @var boolean $nestGroups + */ + var $nestGroups = true; + + /** + * Whether or not to validate atoms for non-ascii characters. + * @var boolean $validate + */ + var $validate = true; + + /** + * The array of raw addresses built up as we parse. + * @var array $addresses + */ + var $addresses = array(); + + /** + * The final array of parsed address information that we build up. + * @var array $structure + */ + var $structure = array(); + + /** + * The current error message, if any. + * @var string $error + */ + var $error = null; + + /** + * An internal counter/pointer. + * @var integer $index + */ + var $index = null; + + /** + * The number of groups that have been found in the address list. + * @var integer $num_groups + * @access public + */ + var $num_groups = 0; + + /** + * A variable so that we can tell whether or not we're inside a + * Mail_RFC822 object. + * @var boolean $mailRFC822 + */ + var $mailRFC822 = true; + + /** + * A limit after which processing stops + * @var int $limit + */ + var $limit = null; + + + /** + * Sets up the object. The address must either be set here or when + * calling parseAddressList(). One or the other. + * + * @access public + * @param string $address The address(es) to validate. + * @param string $default_domain Default domain/host etc. If not supplied, will be set to localhost. + * @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing. + * @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. + * + * @return object Mail_RFC822 A new Mail_RFC822 object. + */ + function Mail_RFC822($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) + { + if (isset($address)) $this->address = $address; + if (isset($default_domain)) $this->default_domain = $default_domain; + if (isset($nest_groups)) $this->nestGroups = $nest_groups; + if (isset($validate)) $this->validate = $validate; + if (isset($limit)) $this->limit = $limit; + } + + + /** + * Starts the whole process. The address must either be set here + * or when creating the object. One or the other. + * + * @access public + * @param string $address The address(es) to validate. + * @param string $default_domain Default domain/host etc. + * @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing. + * @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. + * + * @return array A structured array of addresses. + */ + function parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) + { + + if (!isset($this->mailRFC822)) { + $obj = new Mail_RFC822($address, $default_domain, $nest_groups, $validate, $limit); + return $obj->parseAddressList(); + } + + if (isset($address)) $this->address = $address; + if (isset($default_domain)) $this->default_domain = $default_domain; + if (isset($nest_groups)) $this->nestGroups = $nest_groups; + if (isset($validate)) $this->validate = $validate; + if (isset($limit)) $this->limit = $limit; + + $this->structure = array(); + $this->addresses = array(); + $this->error = null; + $this->index = null; + + while ($this->address = $this->_splitAddresses($this->address)) { + continue; + } + + if ($this->address === false || isset($this->error)) { + return false; + } + + // Reset timer since large amounts of addresses can take a long time to + // get here + set_time_limit(30); + + // Loop through all the addresses + for ($i = 0; $i < count($this->addresses); $i++){ + + if (($return = $this->_validateAddress($this->addresses[$i])) === false + || isset($this->error)) { + return false; + } + + if (!$this->nestGroups) { + $this->structure = array_merge($this->structure, $return); + } else { + $this->structure[] = $return; + } + } + + return $this->structure; + } + + /** + * Splits an address into seperate addresses. + * + * @access private + * @param string $address The addresses to split. + * @return boolean Success or failure. + */ + function _splitAddresses($address) + { + + if (!empty($this->limit) AND count($this->addresses) == $this->limit) { + return ''; + } + + if ($this->_isGroup($address) && !isset($this->error)) { + $split_char = ';'; + $is_group = true; + } elseif (!isset($this->error)) { + $split_char = ','; + $is_group = false; + } elseif (isset($this->error)) { + return false; + } + + // Split the string based on the above ten or so lines. + $parts = explode($split_char, $address); + $string = $this->_splitCheck($parts, $split_char); + + // If a group... + if ($is_group) { + // If $string does not contain a colon outside of + // brackets/quotes etc then something's fubar. + + // First check there's a colon at all: + if (strpos($string, ':') === false) { + $this->error = 'Invalid address: ' . $string; + return false; + } + + // Now check it's outside of brackets/quotes: + if (!$this->_splitCheck(explode(':', $string), ':')) + return false; + + // We must have a group at this point, so increase the counter: + $this->num_groups++; + } + + // $string now contains the first full address/group. + // Add to the addresses array. + $this->addresses[] = array( + 'address' => trim($string), + 'group' => $is_group + ); + + // Remove the now stored address from the initial line, the +1 + // is to account for the explode character. + $address = trim(substr($address, strlen($string) + 1)); + + // If the next char is a comma and this was a group, then + // there are more addresses, otherwise, if there are any more + // chars, then there is another address. + if ($is_group && substr($address, 0, 1) == ','){ + $address = trim(substr($address, 1)); + return $address; + + } elseif (strlen($address) > 0) { + return $address; + + } else { + return ''; + } + + // If you got here then something's off + return false; + } + + /** + * Checks for a group at the start of the string. + * + * @access private + * @param string $address The address to check. + * @return boolean Whether or not there is a group at the start of the string. + */ + function _isGroup($address) + { + // First comma not in quotes, angles or escaped: + $parts = explode(',', $address); + $string = $this->_splitCheck($parts, ','); + + // Now we have the first address, we can reliably check for a + // group by searching for a colon that's not escaped or in + // quotes or angle brackets. + if (count($parts = explode(':', $string)) > 1) { + $string2 = $this->_splitCheck($parts, ':'); + return ($string2 !== $string); + } else { + return false; + } + } + + /** + * A common function that will check an exploded string. + * + * @access private + * @param array $parts The exloded string. + * @param string $char The char that was exploded on. + * @return mixed False if the string contains unclosed quotes/brackets, or the string on success. + */ + function _splitCheck($parts, $char) + { + $string = $parts[0]; + + for ($i = 0; $i < count($parts); $i++) { + if ($this->_hasUnclosedQuotes($string) + || $this->_hasUnclosedBrackets($string, '<>') + || $this->_hasUnclosedBrackets($string, '[]') + || $this->_hasUnclosedBrackets($string, '()') + || substr($string, -1) == '\\') { + if (isset($parts[$i + 1])) { + $string = $string . $char . $parts[$i + 1]; + } else { + $this->error = 'Invalid address spec. Unclosed bracket or quotes'; + return false; + } + } else { + $this->index = $i; + break; + } + } + + return $string; + } + + /** + * Checks if a string has an unclosed quotes or not. + * + * @access private + * @param string $string The string to check. + * @return boolean True if there are unclosed quotes inside the string, false otherwise. + */ + function _hasUnclosedQuotes($string) + { + $string = explode('"', $string); + $string_cnt = count($string); + + for ($i = 0; $i < (count($string) - 1); $i++) + if (substr($string[$i], -1) == '\\') + $string_cnt--; + + return ($string_cnt % 2 === 0); + } + + /** + * Checks if a string has an unclosed brackets or not. IMPORTANT: + * This function handles both angle brackets and square brackets; + * + * @access private + * @param string $string The string to check. + * @param string $chars The characters to check for. + * @return boolean True if there are unclosed brackets inside the string, false otherwise. + */ + function _hasUnclosedBrackets($string, $chars) + { + $num_angle_start = substr_count($string, $chars[0]); + $num_angle_end = substr_count($string, $chars[1]); + + $this->_hasUnclosedBracketsSub($string, $num_angle_start, $chars[0]); + $this->_hasUnclosedBracketsSub($string, $num_angle_end, $chars[1]); + + if ($num_angle_start < $num_angle_end) { + $this->error = 'Invalid address spec. Unmatched quote or bracket (' . $chars . ')'; + return false; + } else { + return ($num_angle_start > $num_angle_end); + } + } + + /** + * Sub function that is used only by hasUnclosedBrackets(). + * + * @access private + * @param string $string The string to check. + * @param integer &$num The number of occurences. + * @param string $char The character to count. + * @return integer The number of occurences of $char in $string, adjusted for backslashes. + */ + function _hasUnclosedBracketsSub($string, &$num, $char) + { + $parts = explode($char, $string); + for ($i = 0; $i < count($parts); $i++){ + if (substr($parts[$i], -1) == '\\' || $this->_hasUnclosedQuotes($parts[$i])) + $num--; + if (isset($parts[$i + 1])) + $parts[$i + 1] = $parts[$i] . $char . $parts[$i + 1]; + } + + return $num; + } + + /** + * Function to begin checking the address. + * + * @access private + * @param string $address The address to validate. + * @return mixed False on failure, or a structured array of address information on success. + */ + function _validateAddress($address) + { + $is_group = false; + + if ($address['group']) { + $is_group = true; + + // Get the group part of the name + $parts = explode(':', $address['address']); + $groupname = $this->_splitCheck($parts, ':'); + $structure = array(); + + // And validate the group part of the name. + if (!$this->_validatePhrase($groupname)){ + $this->error = 'Group name did not validate.'; + return false; + } else { + // Don't include groups if we are not nesting + // them. This avoids returning invalid addresses. + if ($this->nestGroups) { + $structure = new stdClass; + $structure->groupname = $groupname; + } + } + + $address['address'] = ltrim(substr($address['address'], strlen($groupname . ':'))); + } + + // If a group then split on comma and put into an array. + // Otherwise, Just put the whole address in an array. + if ($is_group) { + while (strlen($address['address']) > 0) { + $parts = explode(',', $address['address']); + $addresses[] = $this->_splitCheck($parts, ','); + $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ','))); + } + } else { + $addresses[] = $address['address']; + } + + // Check that $addresses is set, if address like this: + // Groupname:; + // Then errors were appearing. + if (!isset($addresses)){ + $this->error = 'Empty group.'; + return false; + } + + for ($i = 0; $i < count($addresses); $i++) { + $addresses[$i] = trim($addresses[$i]); + } + + // Validate each mailbox. + // Format could be one of: name <geezer@domain.com> + // geezer@domain.com + // geezer + // ... or any other format valid by RFC 822. + array_walk($addresses, array($this, 'validateMailbox')); + + // Nested format + if ($this->nestGroups) { + if ($is_group) { + $structure->addresses = $addresses; + } else { + $structure = $addresses[0]; + } + + // Flat format + } else { + if ($is_group) { + $structure = array_merge($structure, $addresses); + } else { + $structure = $addresses; + } + } + + return $structure; + } + + /** + * Function to validate a phrase. + * + * @access private + * @param string $phrase The phrase to check. + * @return boolean Success or failure. + */ + function _validatePhrase($phrase) + { + // Splits on one or more Tab or space. + $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY); + + $phrase_parts = array(); + while (count($parts) > 0){ + $phrase_parts[] = $this->_splitCheck($parts, ' '); + for ($i = 0; $i < $this->index + 1; $i++) + array_shift($parts); + } + + for ($i = 0; $i < count($phrase_parts); $i++) { + // If quoted string: + if (substr($phrase_parts[$i], 0, 1) == '"') { + if (!$this->_validateQuotedString($phrase_parts[$i])) + return false; + continue; + } + + // Otherwise it's an atom: + if (!$this->_validateAtom($phrase_parts[$i])) return false; + } + + return true; + } + + /** + * Function to validate an atom which from rfc822 is: + * atom = 1*<any CHAR except specials, SPACE and CTLs> + * + * If validation ($this->validate) has been turned off, then + * validateAtom() doesn't actually check anything. This is so that you + * can split a list of addresses up before encoding personal names + * (umlauts, etc.), for example. + * + * @access private + * @param string $atom The string to check. + * @return boolean Success or failure. + */ + function _validateAtom($atom) + { + if (!$this->validate) { + // Validation has been turned off; assume the atom is okay. + return true; + } + + // Check for any char from ASCII 0 - ASCII 127 + if (!preg_match('/^[\\x00-\\x7E]+$/i', $atom, $matches)) { + return false; + } + + // Check for specials: + if (preg_match('/[][()<>@,;\\:". ]/', $atom)) { + return false; + } + + // Check for control characters (ASCII 0-31): + if (preg_match('/[\\x00-\\x1F]+/', $atom)) { + return false; + } + + return true; + } + + /** + * Function to validate quoted string, which is: + * quoted-string = <"> *(qtext/quoted-pair) <"> + * + * @access private + * @param string $qstring The string to check + * @return boolean Success or failure. + */ + function _validateQuotedString($qstring) + { + // Leading and trailing " + $qstring = substr($qstring, 1, -1); + + // Perform check. + return !(preg_match('/(.)[\x0D\\\\"]/', $qstring, $matches) && $matches[1] != '\\'); + } + + /** + * Function to validate a mailbox, which is: + * mailbox = addr-spec ; simple address + * / phrase route-addr ; name and route-addr + * + * @access public + * @param string &$mailbox The string to check. + * @return boolean Success or failure. + */ + function validateMailbox(&$mailbox) + { + // A couple of defaults. + $phrase = ''; + $comment = ''; + + // Catch any RFC822 comments and store them separately + $_mailbox = $mailbox; + while (strlen(trim($_mailbox)) > 0) { + $parts = explode('(', $_mailbox); + $before_comment = $this->_splitCheck($parts, '('); + if ($before_comment != $_mailbox) { + // First char should be a ( + $comment = substr(str_replace($before_comment, '', $_mailbox), 1); + $parts = explode(')', $comment); + $comment = $this->_splitCheck($parts, ')'); + $comments[] = $comment; + + // +1 is for the trailing ) + $_mailbox = substr($_mailbox, strpos($_mailbox, $comment)+strlen($comment)+1); + } else { + break; + } + } + + for($i=0; $i<count(@$comments); $i++){ + $mailbox = str_replace('('.$comments[$i].')', '', $mailbox); + } + $mailbox = trim($mailbox); + + // Check for name + route-addr + if (substr($mailbox, -1) == '>' && substr($mailbox, 0, 1) != '<') { + $parts = explode('<', $mailbox); + $name = $this->_splitCheck($parts, '<'); + + $phrase = trim($name); + $route_addr = trim(substr($mailbox, strlen($name.'<'), -1)); + + if ($this->_validatePhrase($phrase) === false || ($route_addr = $this->_validateRouteAddr($route_addr)) === false) + return false; + + // Only got addr-spec + } else { + // First snip angle brackets if present. + if (substr($mailbox,0,1) == '<' && substr($mailbox,-1) == '>') + $addr_spec = substr($mailbox,1,-1); + else + $addr_spec = $mailbox; + + if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) + return false; + } + + // Construct the object that will be returned. + $mbox = new stdClass(); + + // Add the phrase (even if empty) and comments + $mbox->personal = $phrase; + $mbox->comment = isset($comments) ? $comments : array(); + + if (isset($route_addr)) { + $mbox->mailbox = $route_addr['local_part']; + $mbox->host = $route_addr['domain']; + $route_addr['adl'] !== '' ? $mbox->adl = $route_addr['adl'] : ''; + } else { + $mbox->mailbox = $addr_spec['local_part']; + $mbox->host = $addr_spec['domain']; + } + + $mailbox = $mbox; + return true; + } + + /** + * This function validates a route-addr which is: + * route-addr = "<" [route] addr-spec ">" + * + * Angle brackets have already been removed at the point of + * getting to this function. + * + * @access private + * @param string $route_addr The string to check. + * @return mixed False on failure, or an array containing validated address/route information on success. + */ + function _validateRouteAddr($route_addr) + { + // Check for colon. + if (strpos($route_addr, ':') !== false) { + $parts = explode(':', $route_addr); + $route = $this->_splitCheck($parts, ':'); + } else { + $route = $route_addr; + } + + // If $route is same as $route_addr then the colon was in + // quotes or brackets or, of course, non existent. + if ($route === $route_addr){ + unset($route); + $addr_spec = $route_addr; + if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { + return false; + } + } else { + // Validate route part. + if (($route = $this->_validateRoute($route)) === false) { + return false; + } + + $addr_spec = substr($route_addr, strlen($route . ':')); + + // Validate addr-spec part. + if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { + return false; + } + } + + if (isset($route)) { + $return['adl'] = $route; + } else { + $return['adl'] = ''; + } + + $return = array_merge($return, $addr_spec); + return $return; + } + + /** + * Function to validate a route, which is: + * route = 1#("@" domain) ":" + * + * @access private + * @param string $route The string to check. + * @return mixed False on failure, or the validated $route on success. + */ + function _validateRoute($route) + { + // Split on comma. + $domains = explode(',', trim($route)); + + for ($i = 0; $i < count($domains); $i++) { + $domains[$i] = str_replace('@', '', trim($domains[$i])); + if (!$this->_validateDomain($domains[$i])) return false; + } + + return $route; + } + + /** + * Function to validate a domain, though this is not quite what + * you expect of a strict internet domain. + * + * domain = sub-domain *("." sub-domain) + * + * @access private + * @param string $domain The string to check. + * @return mixed False on failure, or the validated domain on success. + */ + function _validateDomain($domain) + { + // Note the different use of $subdomains and $sub_domains + $subdomains = explode('.', $domain); + + while (count($subdomains) > 0) { + $sub_domains[] = $this->_splitCheck($subdomains, '.'); + for ($i = 0; $i < $this->index + 1; $i++) + array_shift($subdomains); + } + + for ($i = 0; $i < count($sub_domains); $i++) { + if (!$this->_validateSubdomain(trim($sub_domains[$i]))) + return false; + } + + // Managed to get here, so return input. + return $domain; + } + + /** + * Function to validate a subdomain: + * subdomain = domain-ref / domain-literal + * + * @access private + * @param string $subdomain The string to check. + * @return boolean Success or failure. + */ + function _validateSubdomain($subdomain) + { + if (preg_match('|^\[(.*)]$|', $subdomain, $arr)){ + if (!$this->_validateDliteral($arr[1])) return false; + } else { + if (!$this->_validateAtom($subdomain)) return false; + } + + // Got here, so return successful. + return true; + } + + /** + * Function to validate a domain literal: + * domain-literal = "[" *(dtext / quoted-pair) "]" + * + * @access private + * @param string $dliteral The string to check. + * @return boolean Success or failure. + */ + function _validateDliteral($dliteral) + { + return !preg_match('/(.)[][\x0D\\\\]/', $dliteral, $matches) && $matches[1] != '\\'; + } + + /** + * Function to validate an addr-spec. + * + * addr-spec = local-part "@" domain + * + * @access private + * @param string $addr_spec The string to check. + * @return mixed False on failure, or the validated addr-spec on success. + */ + function _validateAddrSpec($addr_spec) + { + $addr_spec = trim($addr_spec); + + // Split on @ sign if there is one. + if (strpos($addr_spec, '@') !== false) { + $parts = explode('@', $addr_spec); + $local_part = $this->_splitCheck($parts, '@'); + $domain = substr($addr_spec, strlen($local_part . '@')); + + // No @ sign so assume the default domain. + } else { + $local_part = $addr_spec; + $domain = $this->default_domain; + } + + if (($local_part = $this->_validateLocalPart($local_part)) === false) return false; + if (($domain = $this->_validateDomain($domain)) === false) return false; + + // Got here so return successful. + return array('local_part' => $local_part, 'domain' => $domain); + } + + /** + * Function to validate the local part of an address: + * local-part = word *("." word) + * + * @access private + * @param string $local_part + * @return mixed False on failure, or the validated local part on success. + */ + function _validateLocalPart($local_part) + { + $parts = explode('.', $local_part); + + // Split the local_part into words. + while (count($parts) > 0){ + $words[] = $this->_splitCheck($parts, '.'); + for ($i = 0; $i < $this->index + 1; $i++) { + array_shift($parts); + } + } + + // Validate each word. + for ($i = 0; $i < count($words); $i++) { + if ($this->_validatePhrase(trim($words[$i])) === false) return false; + } + + // Managed to get here, so return the input. + return $local_part; + } + + /** + * Returns an approximate count of how many addresses are + * in the given string. This is APPROXIMATE as it only splits + * based on a comma which has no preceding backslash. Could be + * useful as large amounts of addresses will end up producing + * *large* structures when used with parseAddressList(). + * + * @param string $data Addresses to count + * @return int Approximate count + */ + function approximateCount($data) + { + return count(preg_split('/(?<!\\\\),/', $data)); + } + + /** + * This is a email validating function seperate to the rest + * of the class. It simply validates whether an email is of + * the common internet form: <user>@<domain>. This can be + * sufficient for most people. Optional stricter mode can + * be utilised which restricts mailbox characters allowed + * to alphanumeric, full stop, hyphen and underscore. + * + * @param string $data Address to check + * @param boolean $strict Optional stricter mode + * @return mixed False if it fails, an indexed array + * username/domain if it matches + */ + function isValidInetAddress($data, $strict = false) + { + $regex = $strict ? '/^([.0-9a-z_-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i' : '/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i'; + if (preg_match($regex, trim($data), $matches)) { + return array($matches[1], $matches[2]); + } else { + return false; + } + } +} + +?> diff --git a/maarch_entreprise/trunk/tools/mails/background.gif b/maarch_entreprise/trunk/tools/mails/background.gif new file mode 100644 index 0000000000000000000000000000000000000000..3dbe69a09a5c5bff487bc45b73db0a929b115c09 Binary files /dev/null and b/maarch_entreprise/trunk/tools/mails/background.gif differ diff --git a/maarch_entreprise/trunk/tools/mails/docs/API.txt b/maarch_entreprise/trunk/tools/mails/docs/API.txt new file mode 100644 index 0000000000000000000000000000000000000000..b609ee8bf6605fc8436bf3b9bec1f8b25b9bff07 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/API.txt @@ -0,0 +1,186 @@ + + API docs + ¯¯¯¯¯¯¯¯ + +Only public methods are documented. All properties are considered private except for +is_built, which is a boolean and determines whether the message is built or not. This +can be reset after sending to false, to force rebuilding if sending multiple times. +If the content of the message doesn't change, rebuilding shouldn't be necessary. + + + +void htmlMimeMail() + + Constructor. Simply sets up some defaults. In particular the smtp parameters + are initialised to: + + host -> localhost + port -> 25 + helo -> Either HTTP_HOST, SERVER_NAME, or localhost in that order + auth -> false + user -> blank + pass -> blank + + Also, the build parameters are initialised to: + + html_encoding -> quoted-printable + text_encoding -> 7bit + html_charset -> ISO-8859-1 + text_charset -> ISO-8859-1 + head_charset -> ISO-8859-1 + text_wrap -> 998 + + + +void setCrlf(string CRLF style) + + Sets the type of CRLF to use. Usually either \r\n, \n or \r. Don't normally + need to call this as the send() function will set it according to what method + of sending you're using (SMTP versus PHP mail()). + + + +void setSMTPParams(string host, integer port, string helo, boolean auth, string user, string pass) + + Use this if you need to alter the SMTP details. All arguments default to NULL so you + if you only need to set one thing you can set the rest to NULL. + + + +void setTextEncoding(string encoding) + + Use this method to set the style of encoding for the text part of the message. Can be + one of 7bit, 8bit, quoted-printable, and base64. Defaults to 7bit. + + + +void setHTMLEncoding(string encoding) + + As above except it applies to the HTML part of the message. Defaults to quoted-printable. + + + +void setTextCharset(string charset) + + The character set to use for the text part of the message. Defaults ISO-8859-1. + + + +void setHTMLCharset(string charset) + + The character set to use for the HTML part of the message. Defaults ISO-8859-1. + + + +void setHeadCharset(string charset) + + The characer set to use when headers are encoded (RFC2047). Defaults to ISO-8859-1. + + + +void setSubject(string subject) + + Sets the Subject: header. + + + +void setFrom(string from) + + Sets the From: header. This is also used if the return path is not set when sending via + SMTP. + + + +void setCc(string Cc) + + Sets the Cc: header. This can be multiple addresses. + + + +void setBcc(string bcc) + + Sets the Bcc: header. This can be multiple addresses. + + + +void setText(string text) + + Sets the text part of the message. Should ONLY be used if you're sending a TEXT ONLY + email. See the setHTML() method for setting the text alternative to a HTML/text email. + + + +void setHTML(string html, string text, string images_path) + + Use this method to set the HTML part of your message. The 2nd and 3rd arguments are + optional. The second sets the alternative text to the HTML in your message. The third + sets a path for the class to look in for any image references it finds in the HTML. If + you want to avoid multiple calls to addHTMLImage() you can use this third argument to + get the class to look for and auto add images referenced by the HTML. It has restrictions + in that the image refs must be quoted (eg. <img src="foo.gif" and not <img src=foo.gif). + The extension/content-type mappings are set in the constructor in the property image_types. + This property can be added to if necessary, and is not restricted to mere images. + + + +void addHTMLImage(string filedata, string name, string content_type) + + Use this method to add an embedded image to your message. The first argument is the file + itself (you can use the getFile() method if you have a filename). The second the name of + the file, commonly the filename (eg foo.gif). This name must match precisely the name it + is referenced by in the HTML. The third argument is the content-type of the file, eg. + image/gif. + + + +void addAttachment(string filedata, string filename, string content_type, string encoding) + + Use this method to add an attachment to the message. The first three arguments are the + same as the method above. The fourth can be used to specify an alternate encoding to + base64. This is useful when you're adding attached messages which are better encoded as + 7bit, (an example of this is in example.5.php). + + + +boolean buildMessage(array params) + + Usually you don't need to call this method as it's automatically called by the send() + method. However, if you're using the send() method in a loop sending to multiple recipients + AND changing the HTML/text/headers each time, then you will need to call this method before + calling the send() method to force the email to be rebuilt. The argument is an associative + array containing the following options to alter the way the email is built: + + Array key Purpose + ========= ======= + html_encoding Sets the encoding type for HTML. See setHTMLEncoding() + text_encoding Sets the encoding type for text. See setTextEncoding() + text_wrap Sets the default wrap for text parts. Defaults to 998. + html_charset Sets the charset for the HTML part. See setHTMLCharset(). + text_charset Sets the charset for the text part. See setTextCharset(). + head_charset Sets the charset for encoded headers. See setHeadCharset(). + + + +boolean send(array recipients, string type) + + This method sends the message. The recipients array is what becomes the To: header. This + can be simply an empty array if you've set Cc: or Bcc: headers instead. The second argument + determines what method to send the mail via. This can be 'mail' (the default) or 'smtp' to + send direct via an SMTP server. In this case the smtp parameters are used to connect to the + server. The return value is true or false indicating a successful send or not. With SMTP if + there are errors they will be set in the errors property (an array) ie. $obj->errors. + + + +string getRFC822(array recipients) + + This method can be used to return a message as a string suitable for adding to another mail + object using addAttachment(). The recipients argument is as with the send() method. + + + +string getFile(string filename) + + Reads the given filename in and returns it. Use this to read files and add them + as attachments or embedded images/objects. See the examples for usages. + diff --git a/maarch_entreprise/trunk/tools/mails/docs/changelog.txt b/maarch_entreprise/trunk/tools/mails/docs/changelog.txt new file mode 100644 index 0000000000000000000000000000000000000000..58b2f9284fd12f4afccfdfdfab496def85250752 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/changelog.txt @@ -0,0 +1,169 @@ + Changelog +=========== + +27/11/2005 - 2.5.2 + + - Fixed reference bugs presented with PHP version 4.4.x + - Fixed space problem with encoded headers + + +??/??/???? 2.5.1 + + - ? + +15/07/2002 2.5.0 + + - Major API change making pretty much everything easier and nicer. Most importantly + the send() and send_smtp() have been unified into a single send(). See the examples + and API docs for more information. + +21/12/2001 2.0.3 + + - Fixed bug which prevented building when it was html, null text, embedded images and + no attachments. + + - Altered get_file() function to allow retrieval of images via urls. + +02/11/2001 2.0.2 + + - Seperated the mimePart class out to it's own file. + + - Fixed bug in build process. + +11/10/2001 2.0.1 + + - Fixed minor bugs. + +04/10/2001 2.00 + + - Complete overhaul of internal build system. Now utilises the mime_part class (which + is part of the class.html.mime.mail.inc file). + + - Removed add_header() function. Use header argument of constructor or send functions. + + - Constructor now only takes an array of headers. + + - Changed set_body() to add_text. + + - Removed the get_mime() function. + + - Changed the body member variable to text. + + - Altered add_html() function to except the $text argument as NULL. This will affect the + build system such that if the text is NULL, a multipart/alternative will not be added, + just a html part. It is however, always a good idea to supply a text version of mail. + + - Added a fourth parameter to add_attachment() to specify the encoding type. This can be + 7bit, quoted-printable or base64. For most attachments this should be base64 (default), + a notable exception being attached emails, which should be 7bit. + +26/09/2001 1.39b + + - Fixed a minor bug. Image names weren't being replaced with content ids. + +22/09/2001 1.39 + + - Added example.5.php which shows how to attach one email to another. + + - Altered code that replaces image filenames with content ids to run at build time, + this means add_html_image() can now come after add_html(). + + - Changed order of multipart/related --> multipart/alternative to be opposite way around. + Makes more sense this way as embedded images are not related to the text/plain part. + + - Fixed spurious crlfs + + - Altered smtp_send() method to use my own smtp class. + + - Removed charset function, now the charset is an option in the build parameters. + + - Altered quoted-printable encoding not to encode tabs. + +08/09/2001 1.38 + + - General tidy up. + + - Altered default length of 7bit encoded data to 998 chars (RFC821). + + - Added example.4.php, which shows how to send Bcc: emails. + +29/08/2001 1.37 + + - Added quoted-printable functionality (RFC2045). + + - Added argument to build_message() to control certain things during message building. + +27/08/2001 1.36 + + - Added new function contributed by Dan Allen. Will look through the html + code for embedded images/files and try to automatically add them. The function + is called by adding a third argument to add_html(), which is the directory + where the function will look for images. + + - smtp_send() method no longer automatically adds From: or Subject: headers. These + must be added manually. The arguments have also changed for this function. + + - Two example scripts added, making total of three. Each of which shows the various + ways you can use the class. + +17/07/2001 1.35 + + - Moved the mime version header to be the first header added to the mail. + Apparently this helps certain mail clients. + +28/01/2001 + + - Changed all \r\n to \n. Should work "out of the box" for more people now. However, + this does contravene RFC822, which states line endings should be \r\n. + +24/10/2000 + + - Added character set function. Contributed by "Matt". Also + fixed the properties' initialisation by moving it to the + constructor. Default character set is us-ascii. + +31/08/2000 + + - Couple of bugfixes. Also, due to a mis-directed + complaint from a victim of porn spam, I have removed + the link to my website from the "This is a mime encoded + email." message. Please upgrade. + +24/08/2000 + + - Changed all functions that add headers to accept either a string + of headers seperated by \r\n, a single header, or an array of headers. + + - Added get_rfc822() function. Enables you to add whole emails as attachments + to other emails. + + - Added add_header() function to add a header. This is php4 only, and takes + any number of arguments. The args must be either arrays full of headers or + a string containing a header. + + - Added get_mime() function as an accessor to get the mime class variable. + + - Added the set_body() function to set the body text class variable. This + is to be used to set the body text when it is not an HTML mail being sent. + +Previous History + + - Fixed bug; when looping with $obj->send(), From: headers + were accumulating. Bummer. Thanks to Lance Rasmussen for + notifying me. + + - Fixed bug; $html_images was tested to be an array or not + but was set to be an array during object creation, so the + test always returned true. Thanks to Bob Silva for + notifying me. + + - Fixed bug; certain mail systems (gmx.net in particular) + were rejecting mail because of a space character either + side of the equal sign on the boundary line. Thanks to + Peter Holm for notifying me. + + - Made headers terminated by CRLF instead of LF, now + compliant with RFC822. + + - Thanks to Thomas Flemming for supplying a fix + for Win32. \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/background.gif b/maarch_entreprise/trunk/tools/mails/docs/examples/background.gif new file mode 100644 index 0000000000000000000000000000000000000000..3dbe69a09a5c5bff487bc45b73db0a929b115c09 Binary files /dev/null and b/maarch_entreprise/trunk/tools/mails/docs/examples/background.gif differ diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/example.1.php b/maarch_entreprise/trunk/tools/mails/docs/examples/example.1.php new file mode 100644 index 0000000000000000000000000000000000000000..6a2f728ca48e2d20f0d159c989cb459dd4ba62d2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/examples/example.1.php @@ -0,0 +1,80 @@ +<?php +/** +* Filename.......: example.1.php +* Project........: HTML Mime Mail class +* Last Modified..: 15 July 2002 +*/ + error_reporting(E_ALL); + require_once('htmlMimeMail.php'); + +/** +* Example of usage. This example shows +* how to use the class with html, +* embedded images, and an attachment. +*/ + /** + * Create the mail object. + * No longer takes any arguments + */ + $mail = new htmlMimeMail(); + + /* + * Read the image background.gif into + * $background + */ + $background = $mail->getFile('background.gif'); + + /* + * Read the file test.zip into $attachment. + */ + $attachment = $mail->getFile('example.zip'); + + /* + * Get the contents of the example text/html files. + * Text/html data doesn't have to come from files, + * could come from anywhere. + */ + $text = $mail->getFile('example.txt'); + $html = $mail->getFile('example.html'); + + /* + * Add the text, html and embedded images. + * The name (background.gif in this case) + * of the image should match exactly + * (case-sensitive) to the name in the html. + */ + $mail->setHtml($html, $text); + $mail->addHtmlImage($background, 'background.gif', 'image/gif'); + + /* + * This is used to add an attachment to + * the email. Due to above, the $attachment + * variable contains the example zip file. + */ + $mail->addAttachment($attachment, 'example.zip', 'application/zip'); + + /* + * Set the return path of the message + */ + $mail->setReturnPath('joe@example.com'); + + /** + * Set some headers + */ + $mail->setFrom('"Joe" <joe@example.com>'); + $mail->setSubject('Test mail'); + $mail->setHeader('X-Mailer', 'HTML Mime mail class (http://www.phpguru.org)'); + + /** + * Send it using SMTP. If you're using Windows you should *always* use + * the smtp method of sending, as the mail() function is buggy. + */ + $result = $mail->send(array('postmaster@localhost'), 'smtp'); + + // These errors are only set if you're using SMTP to send the message + if (!$result) { + print_r($mail->errors); + } else { + echo 'Mail sent!'; + } +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/example.2.php b/maarch_entreprise/trunk/tools/mails/docs/examples/example.2.php new file mode 100644 index 0000000000000000000000000000000000000000..c6ab9c2b9e8bea32b9b0d63916d150e763b65671 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/examples/example.2.php @@ -0,0 +1,66 @@ +<?php +/** +* Filename.......: example.2.php +* Project........: HTML Mime Mail class +* Last Modified..: 15 July 2002 +*/ + error_reporting(E_ALL); + require_once('htmlMimeMail.php'); + +/** +* Example of usage. This example shows +* how to use the class with html, +* embedded images, no attachments, but +* using the third argument of setHtml(), +* which will try to automatically find the +* images (though not limited to images), +* and embed them. It will send the mail +* using built in php mail() functionality. +* +* Create the mail object. +* No header argument any more +*/ + $mail = new htmlMimeMail(); + +/** +* Read the image background.gif into +* $background +*/ + $background = $mail->getFile('background.gif'); + +/** +* If sending an html email, then these +* two variables specify the text and +* html versions of the mail. Don't +* have to be named as these are. Just +* make sure the names tie in to the +* $mail->setHtml() call further down. +*/ + $text = $mail->getFile('example.txt'); + $html = $mail->getFile('example.html'); + +/** +* Add the text, html and embedded images. +* Here we're using the third argument of +* setHtml(), which is the path to the +* directory that holds the images. By +* adding this third argument, the class +* will try to find all the images in the +* html, and auto load them in. Not 100% +* accurate, and you MUST enclose your +* image references in quotes, so src="img.jpg" +* and NOT src=img.jpg. Also, where possible, +* duplicates will be avoided. +*/ + $mail->setHtml($html, $text, './'); + +/** +* Sends the message. +*/ + $mail->setFrom('Joe <joe@example.com>'); + $mail->setSubject('Test mail'); + + $result = $mail->send(array('postmaster@localhost')); + + echo $result ? 'Mail sent!' : 'Failed to send mail'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/example.3.php b/maarch_entreprise/trunk/tools/mails/docs/examples/example.3.php new file mode 100644 index 0000000000000000000000000000000000000000..079f57d1d14b6732d6a3ced511061e2c9c20448f --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/examples/example.3.php @@ -0,0 +1,52 @@ +<?php +/** +* Filename.......: example.3.php +* Project........: HTML Mime Mail class +* Last Modified..: 15 July 2002 +*/ + error_reporting(E_ALL); + require_once('htmlMimeMail.php'); + +/** +* Example of usage. This example shows +* how to use the class to send a plain +* text email with an attachment. No html, +* or embedded images. +* +* Create the mail object. +*/ + $mail = new htmlMimeMail(); + +/** +* Read the file test.zip into $attachment. +*/ + $attachment = $mail->getFile('example.zip'); + +/** +* Since we're sending a plain text email, +* we only need to read in the text file. +*/ + $text = $mail->getFile('example.txt'); + +/** +* To set the text body of the email, we +* are using the setText() function. This +* is an alternative to the setHtml() function +* which would obviously be inappropriate here. +*/ + $mail->setText($text); + +/** +* This is used to add an attachment to +* the email. +*/ + $mail->addAttachment($attachment, 'example.zip', 'application/zip'); + +/** +* Sends the message. +*/ + $mail->setFrom('Joe <joe@example.com>'); + $result = $mail->send(array('"Richard" <postmaster@localhost>')); + + echo $result ? 'Mail sent!' : 'Failed to send mail'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/example.4.php b/maarch_entreprise/trunk/tools/mails/docs/examples/example.4.php new file mode 100644 index 0000000000000000000000000000000000000000..66284b501fa52bfa03a2a3b3300c1315ebe1adfd --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/examples/example.4.php @@ -0,0 +1,44 @@ +<?php +/** +* Filename.......: example.4.php +* Project........: HTML Mime Mail class +* Last Modified..: 15 July 2002 +*/ + + error_reporting(E_ALL); + require_once('htmlMimeMail.php'); + +/** +* Example of usage. This example shows +* how to use the class to send Bcc: +* and/or Cc: recipients. +* +* Create the mail object. +*/ + $mail = new htmlMimeMail(); + +/** +* We will just send a text email +*/ + $text = $mail->getFile('example.txt'); + $mail->setText($text); + +/** +* Send the email using smtp method. The setSMTPParams() +* method simply changes the HELO string to example.com +* as localhost and port 25 are the defaults. +*/ + $mail->setSMTPParams('localhost', 25, 'example.com'); + $mail->setReturnPath('joe@example.com'); + $mail->setBcc('bcc@example.com'); + $mail->setCc('Carbon Copy <cc@example.com>'); + + $result = $mail->send(array('postmaster@localhost'), 'smtp'); + + // These errors are only set if you're using SMTP to send the message + if (!$result) { + print_r($mail->errors); + } else { + echo 'Mail sent!'; + } +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/example.5.php b/maarch_entreprise/trunk/tools/mails/docs/examples/example.5.php new file mode 100644 index 0000000000000000000000000000000000000000..ad13fabb93c8368109d174a10b5091bc216df1a8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/examples/example.5.php @@ -0,0 +1,65 @@ +<?php +/** +* Filename.......: example.5.php +* Project........: HTML Mime Mail class +* Last Modified..: 15 July 2002 +*/ + + error_reporting(E_ALL); + require_once('htmlMimeMail.php'); + +/** +* Example of usage. This example shows +* how to use the class to send an email +* attached to another email. First email +* built is html/text with an embedded image +* and attachment. This is then attached +* to the second email which is plain text. +* +* Create the mail object. +*/ + $mail_1 = new htmlMimeMail(); + +/** +* This call is usually not necessary unless you're sending the final +* mail via SMTP (Qmail won't send mail with bare LFs and you must +* therefore use CRLF), but setting this explicitly doesnt hurt. +*/ + $mail_1->setCrlf("\n"); + +/** +* First email. +*/ + $mail_1->setHTML($mail_1->getFile('example.html'), $mail_1->getFile('example.txt'), dirname(__FILE__) . '/'); + +/** +* Add the attachment +*/ + $mail_1->addAttachment($mail_1->getFile('example.zip'), 'example.zip', 'application/zip'); + +/** +* Don't send this email, but use the +* get_rfc822() method to assign it to a +* variable. +*/ + $mail_1->setReturnPath('return@example.com'); + $mail_1->setFrom('John Doe <john.doe@example.com>'); + $mail_1->setSubject('Test attached email'); + $mail = $mail_1->getRFC822(array('Nobody <nobody@example.com>')); + +/** +* Now start a new mail, and add the first +* (which is now built and contained in +* $mail) to it. +*/ + $mail_2 = new htmlMimeMail(); + + $mail_2->setText('This email has an attached email'); + $mail_2->addAttachment($mail, 'Test for attached email', 'message/rfc822', '7bit'); + + $mail_2->setFrom('Foo <foo@example.com>'); + $mail_2->setSubject('Test with attached email'); + $result = $mail_2->send(array('postmaster@localhost')); + + echo $result ? 'Mail sent!' : 'Failed to send mail'; +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/example.html b/maarch_entreprise/trunk/tools/mails/docs/examples/example.html new file mode 100644 index 0000000000000000000000000000000000000000..6bbdd3af26357e52809e3779a2c237169d65ce79 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/examples/example.html @@ -0,0 +1,17 @@ +<HTML> +<HEAD> + <STYLE TYPE="text/css"> + <!-- + H1 {font-family: Verdana; font-size: 18pt} + BODY {font-family: Verdana; font-size: 10pt; margin-left: 30px} + // --> + </STYLE> +</HEAD> +<BODY BGCOLOR="beige" BACKGROUND="background.gif"> + +<H1>Success!</H1> + +You've successfully sent an HTML email. + +</BODY> +</HTML> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/example.txt b/maarch_entreprise/trunk/tools/mails/docs/examples/example.txt new file mode 100644 index 0000000000000000000000000000000000000000..7af56bea9f9f9288cf6c1959f1276dc403130b39 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/docs/examples/example.txt @@ -0,0 +1,3 @@ +Success! + +This is the plain text portion of the email. \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/docs/examples/example.zip b/maarch_entreprise/trunk/tools/mails/docs/examples/example.zip new file mode 100644 index 0000000000000000000000000000000000000000..1b8d199ccdeea27bdd8dc3584722a7e0a61a2d35 Binary files /dev/null and b/maarch_entreprise/trunk/tools/mails/docs/examples/example.zip differ diff --git a/maarch_entreprise/trunk/tools/mails/example.html b/maarch_entreprise/trunk/tools/mails/example.html new file mode 100644 index 0000000000000000000000000000000000000000..6bbdd3af26357e52809e3779a2c237169d65ce79 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/example.html @@ -0,0 +1,17 @@ +<HTML> +<HEAD> + <STYLE TYPE="text/css"> + <!-- + H1 {font-family: Verdana; font-size: 18pt} + BODY {font-family: Verdana; font-size: 10pt; margin-left: 30px} + // --> + </STYLE> +</HEAD> +<BODY BGCOLOR="beige" BACKGROUND="background.gif"> + +<H1>Success!</H1> + +You've successfully sent an HTML email. + +</BODY> +</HTML> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/example.txt b/maarch_entreprise/trunk/tools/mails/example.txt new file mode 100644 index 0000000000000000000000000000000000000000..7af56bea9f9f9288cf6c1959f1276dc403130b39 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/example.txt @@ -0,0 +1,3 @@ +Success! + +This is the plain text portion of the email. \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/mails/example.zip b/maarch_entreprise/trunk/tools/mails/example.zip new file mode 100644 index 0000000000000000000000000000000000000000..1b8d199ccdeea27bdd8dc3584722a7e0a61a2d35 Binary files /dev/null and b/maarch_entreprise/trunk/tools/mails/example.zip differ diff --git a/maarch_entreprise/trunk/tools/mails/htmlMimeMail.php b/maarch_entreprise/trunk/tools/mails/htmlMimeMail.php new file mode 100644 index 0000000000000000000000000000000000000000..d8dbe6408b11a8fa5c82cccf42ee5d68d382efe6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/htmlMimeMail.php @@ -0,0 +1,795 @@ +<?php +/** +* This file is part of the htmlMimeMail package (http://www.phpguru.org/) +* +* htmlMimeMail is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* htmlMimeMail is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with htmlMimeMail; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* © Copyright 2004 Richard Heyes +*/ + +require_once(dirname(__FILE__) . '/mimePart.php'); + +class htmlMimeMail +{ + /** + * The html part of the message + * @var string + */ + var $html; + + /** + * The text part of the message(only used in TEXT only messages) + * @var string + */ + var $text; + + /** + * The main body of the message after building + * @var string + */ + var $output; + + /** + * The alternative text to the HTML part (only used in HTML messages) + * @var string + */ + var $html_text; + + /** + * An array of embedded images/objects + * @var array + */ + var $html_images; + + /** + * An array of recognised image types for the findHtmlImages() method + * @var array + */ + var $image_types; + + /** + * Parameters that affect the build process + * @var array + */ + var $build_params; + + /** + * Array of attachments + * @var array + */ + var $attachments; + + /** + * The main message headers + * @var array + */ + var $headers; + + /** + * Whether the message has been built or not + * @var boolean + */ + var $is_built; + + /** + * The return path address. If not set the From: + * address is used instead + * @var string + */ + var $return_path; + + /** + * Array of information needed for smtp sending + * @var array + */ + var $smtp_params; + + /** + * Constructor function. Sets the headers + * if supplied. + */ + function htmlMimeMail() + { + /** + * Initialise some variables. + */ + $this->html_images = array(); + $this->headers = array(); + $this->is_built = false; + + /** + * If you want the auto load functionality + * to find other image/file types, add the + * extension and content type here. + */ + $this->image_types = array( + 'gif' => 'image/gif', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'bmp' => 'image/bmp', + 'png' => 'image/png', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'swf' => 'application/x-shockwave-flash' + ); + + /** + * Set these up + */ + $this->build_params['html_encoding'] = 'quoted-printable'; + $this->build_params['text_encoding'] = '7bit'; + $this->build_params['html_charset'] = 'ISO-8859-1'; + $this->build_params['text_charset'] = 'ISO-8859-1'; + $this->build_params['head_charset'] = 'ISO-8859-1'; + $this->build_params['text_wrap'] = 998; + + /** + * Defaults for smtp sending + */ + if (!empty($GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'])) { + $helo = $GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST']; + } elseif (!empty($GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'])) { + $helo = $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME']; + } else { + $helo = 'localhost'; + } + + $this->smtp_params['host'] = 'localhost'; + $this->smtp_params['port'] = 25; + $this->smtp_params['helo'] = $helo; + $this->smtp_params['auth'] = false; + $this->smtp_params['user'] = ''; + $this->smtp_params['pass'] = ''; + + /** + * Make sure the MIME version header is first. + */ + $this->headers['MIME-Version'] = '1.0'; + } + + /** + * This function will read a file in + * from a supplied filename and return + * it. This can then be given as the first + * argument of the the functions + * add_html_image() or add_attachment(). + */ + function getFile($filename) + { + $return = ''; + if ($fp = fopen($filename, 'rb')) { + while (!feof($fp)) { + $return .= fread($fp, 1024); + } + fclose($fp); + return $return; + + } else { + return false; + } + } + + /** + * Accessor to set the CRLF style + */ + function setCrlf($crlf = "\n") + { + if (!defined('CRLF')) { + define('CRLF', $crlf, true); + } + + if (!defined('MAIL_MIMEPART_CRLF')) { + define('MAIL_MIMEPART_CRLF', $crlf, true); + } + } + + /** + * Accessor to set the SMTP parameters + */ + function setSMTPParams($host = null, $port = null, $helo = null, $auth = null, $user = null, $pass = null) + { + if (!is_null($host)) $this->smtp_params['host'] = $host; + if (!is_null($port)) $this->smtp_params['port'] = $port; + if (!is_null($helo)) $this->smtp_params['helo'] = $helo; + if (!is_null($auth)) $this->smtp_params['auth'] = $auth; + if (!is_null($user)) $this->smtp_params['user'] = $user; + if (!is_null($pass)) $this->smtp_params['pass'] = $pass; + } + + /** + * Accessor function to set the text encoding + */ + function setTextEncoding($encoding = '7bit') + { + $this->build_params['text_encoding'] = $encoding; + } + + /** + * Accessor function to set the HTML encoding + */ + function setHtmlEncoding($encoding = 'quoted-printable') + { + $this->build_params['html_encoding'] = $encoding; + } + + /** + * Accessor function to set the text charset + */ + function setTextCharset($charset = 'ISO-8859-1') + { + $this->build_params['text_charset'] = $charset; + } + + /** + * Accessor function to set the HTML charset + */ + function setHtmlCharset($charset = 'ISO-8859-1') + { + $this->build_params['html_charset'] = $charset; + } + + /** + * Accessor function to set the header encoding charset + */ + function setHeadCharset($charset = 'ISO-8859-1') + { + $this->build_params['head_charset'] = $charset; + } + + /** + * Accessor function to set the text wrap count + */ + function setTextWrap($count = 998) + { + $this->build_params['text_wrap'] = $count; + } + + /** + * Accessor to set a header + */ + function setHeader($name, $value) + { + $this->headers[$name] = $value; + } + + /** + * Accessor to add a Subject: header + */ + function setSubject($subject) + { + $this->headers['Subject'] = $subject; + } + + /** + * Accessor to add a From: header + */ + function setFrom($from) + { + $this->headers['From'] = $from; + } + + /** + * Accessor to set the return path + */ + function setReturnPath($return_path) + { + $this->return_path = $return_path; + } + + /** + * Accessor to add a Cc: header + */ + function setCc($cc) + { + $this->headers['Cc'] = $cc; + } + + /** + * Accessor to add a Bcc: header + */ + function setBcc($bcc) + { + $this->headers['Bcc'] = $bcc; + } + + /** + * Adds plain text. Use this function + * when NOT sending html email + */ + function setText($text = '') + { + $this->text = $text; + } + + /** + * Adds a html part to the mail. + * Also replaces image names with + * content-id's. + */ + function setHtml($html, $text = null, $images_dir = null) + { + $this->html = $html; + $this->html_text = $text; + + if (isset($images_dir)) { + $this->_findHtmlImages($images_dir); + } + } + + /** + * Function for extracting images from + * html source. This function will look + * through the html code supplied by add_html() + * and find any file that ends in one of the + * extensions defined in $obj->image_types. + * If the file exists it will read it in and + * embed it, (not an attachment). + * + * @author Dan Allen + */ + function _findHtmlImages($images_dir) + { + // Build the list of image extensions + while (list($key,) = each($this->image_types)) { + $extensions[] = $key; + } + + preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $images); + + for ($i=0; $i<count($images[1]); $i++) { + if (file_exists($images_dir . $images[1][$i])) { + $html_images[] = $images[1][$i]; + $this->html = str_replace($images[1][$i], basename($images[1][$i]), $this->html); + } + } + + if (!empty($html_images)) { + + // If duplicate images are embedded, they may show up as attachments, so remove them. + $html_images = array_unique($html_images); + sort($html_images); + + for ($i=0; $i<count($html_images); $i++) { + if ($image = $this->getFile($images_dir.$html_images[$i])) { + $ext = substr($html_images[$i], strrpos($html_images[$i], '.') + 1); + $content_type = $this->image_types[strtolower($ext)]; + $this->addHtmlImage($image, basename($html_images[$i]), $content_type); + } + } + } + } + + /** + * Adds an image to the list of embedded + * images. + */ + function addHtmlImage($file, $name = '', $c_type='application/octet-stream') + { + $this->html_images[] = array( + 'body' => $file, + 'name' => $name, + 'c_type' => $c_type, + 'cid' => md5(uniqid(time())) + ); + } + + + /** + * Adds a file to the list of attachments. + */ + function addAttachment($file, $name = '', $c_type='application/octet-stream', $encoding = 'base64') + { + $this->attachments[] = array( + 'body' => $file, + 'name' => $name, + 'c_type' => $c_type, + 'encoding' => $encoding + ); + } + + /** + * Adds a text subpart to a mime_part object + */ + function &_addTextPart(&$obj, $text) + { + $params['content_type'] = 'text/plain'; + $params['encoding'] = $this->build_params['text_encoding']; + $params['charset'] = $this->build_params['text_charset']; + if (is_object($obj)) { + $return = $obj->addSubpart($text, $params); + } else { + $return = new Mail_mimePart($text, $params); + } + + return $return; + } + + /** + * Adds a html subpart to a mime_part object + */ + function &_addHtmlPart(&$obj) + { + $params['content_type'] = 'text/html'; + $params['encoding'] = $this->build_params['html_encoding']; + $params['charset'] = $this->build_params['html_charset']; + if (is_object($obj)) { + $return = $obj->addSubpart($this->html, $params); + } else { + $return = new Mail_mimePart($this->html, $params); + } + + return $return; + } + + /** + * Starts a message with a mixed part + */ + function &_addMixedPart() + { + $params['content_type'] = 'multipart/mixed'; + $return = new Mail_mimePart('', $params); + + return $return; + } + + /** + * Adds an alternative part to a mime_part object + */ + function &_addAlternativePart(&$obj) + { + $params['content_type'] = 'multipart/alternative'; + if (is_object($obj)) { + $return = $obj->addSubpart('', $params); + } else { + $return = new Mail_mimePart('', $params); + } + + return $return; + } + + /** + * Adds a html subpart to a mime_part object + */ + function &_addRelatedPart(&$obj) + { + $params['content_type'] = 'multipart/related'; + if (is_object($obj)) { + $return = $obj->addSubpart('', $params); + } else { + $return = new Mail_mimePart('', $params); + } + + return $return; + } + + /** + * Adds an html image subpart to a mime_part object + */ + function _addHtmlImagePart(&$obj, $value) + { + $params['content_type'] = $value['c_type']; + $params['encoding'] = 'base64'; + $params['disposition'] = 'inline'; + $params['dfilename'] = $value['name']; + $params['cid'] = $value['cid']; + $obj->addSubpart($value['body'], $params); + } + + /** + * Adds an attachment subpart to a mime_part object + */ + function _addAttachmentPart(&$obj, $value) + { + $params['content_type'] = $value['c_type']; + $params['encoding'] = $value['encoding']; + $params['disposition'] = 'attachment'; + $params['dfilename'] = $value['name']; + $obj->addSubpart($value['body'], $params); + } + + /** + * Builds the multipart message from the + * list ($this->_parts). $params is an + * array of parameters that shape the building + * of the message. Currently supported are: + * + * $params['html_encoding'] - The type of encoding to use on html. Valid options are + * "7bit", "quoted-printable" or "base64" (all without quotes). + * 7bit is EXPRESSLY NOT RECOMMENDED. Default is quoted-printable + * $params['text_encoding'] - The type of encoding to use on plain text Valid options are + * "7bit", "quoted-printable" or "base64" (all without quotes). + * Default is 7bit + * $params['text_wrap'] - The character count at which to wrap 7bit encoded data. + * Default this is 998. + * $params['html_charset'] - The character set to use for a html section. + * Default is ISO-8859-1 + * $params['text_charset'] - The character set to use for a text section. + * - Default is ISO-8859-1 + * $params['head_charset'] - The character set to use for header encoding should it be needed. + * - Default is ISO-8859-1 + */ + function buildMessage($params = array()) + { + if (!empty($params)) { + while (list($key, $value) = each($params)) { + $this->build_params[$key] = $value; + } + } + + if (!empty($this->html_images)) { + foreach ($this->html_images as $value) { + $this->html = str_replace($value['name'], 'cid:'.$value['cid'], $this->html); + } + } + + $null = null; + $attachments = !empty($this->attachments) ? true : false; + $html_images = !empty($this->html_images) ? true : false; + $html = !empty($this->html) ? true : false; + $text = isset($this->text) ? true : false; + + switch (true) { + case $text AND !$attachments: + $message = &$this->_addTextPart($null, $this->text); + break; + + case !$text AND $attachments AND !$html: + $message = &$this->_addMixedPart(); + + for ($i=0; $i<count($this->attachments); $i++) { + $this->_addAttachmentPart($message, $this->attachments[$i]); + } + break; + + case $text AND $attachments: + $message = &$this->_addMixedPart(); + $this->_addTextPart($message, $this->text); + + for ($i=0; $i<count($this->attachments); $i++) { + $this->_addAttachmentPart($message, $this->attachments[$i]); + } + break; + + case $html AND !$attachments AND !$html_images: + if (!is_null($this->html_text)) { + $message = &$this->_addAlternativePart($null); + $this->_addTextPart($message, $this->html_text); + $this->_addHtmlPart($message); + } else { + $message = &$this->_addHtmlPart($null); + } + break; + + case $html AND !$attachments AND $html_images: + if (!is_null($this->html_text)) { + $message = &$this->_addAlternativePart($null); + $this->_addTextPart($message, $this->html_text); + $related = &$this->_addRelatedPart($message); + } else { + $message = &$this->_addRelatedPart($null); + $related = &$message; + } + $this->_addHtmlPart($related); + for ($i=0; $i<count($this->html_images); $i++) { + $this->_addHtmlImagePart($related, $this->html_images[$i]); + } + break; + + case $html AND $attachments AND !$html_images: + $message = &$this->_addMixedPart(); + if (!is_null($this->html_text)) { + $alt = &$this->_addAlternativePart($message); + $this->_addTextPart($alt, $this->html_text); + $this->_addHtmlPart($alt); + } else { + $this->_addHtmlPart($message); + } + for ($i=0; $i<count($this->attachments); $i++) { + $this->_addAttachmentPart($message, $this->attachments[$i]); + } + break; + + case $html AND $attachments AND $html_images: + $message = &$this->_addMixedPart(); + if (!is_null($this->html_text)) { + $alt = &$this->_addAlternativePart($message); + $this->_addTextPart($alt, $this->html_text); + $rel = &$this->_addRelatedPart($alt); + } else { + $rel = &$this->_addRelatedPart($message); + } + $this->_addHtmlPart($rel); + for ($i=0; $i<count($this->html_images); $i++) { + $this->_addHtmlImagePart($rel, $this->html_images[$i]); + } + for ($i=0; $i<count($this->attachments); $i++) { + $this->_addAttachmentPart($message, $this->attachments[$i]); + } + break; + + } + + if (isset($message)) { + $output = $message->encode(); + $this->output = $output['body']; + $this->headers = array_merge($this->headers, $output['headers']); + + // Add message ID header + srand((double)microtime()*10000000); + $message_id = sprintf('<%s.%s@%s>', base_convert(time(), 10, 36), base_convert(rand(), 10, 36), !empty($GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST']) ? $GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'] : $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME']); + $this->headers['Message-ID'] = $message_id; + + $this->is_built = true; + return true; + } else { + return false; + } + } + + /** + * Function to encode a header if necessary + * according to RFC2047 + */ + function _encodeHeader($input, $charset = 'ISO-8859-1') + { + preg_match_all('/(\s?\w*[\x80-\xFF]+\w*\s?)/', $input, $matches); + foreach ($matches[1] as $value) { + $replacement = preg_replace('/([\x20\x80-\xFF])/e', '"=" . strtoupper(dechex(ord("\1")))', $value); + $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input); + } + + return $input; + } + + /** + * Sends the mail. + * + * @param array $recipients + * @param string $type OPTIONAL + * @return mixed + */ + function send($recipients, $type = 'mail') + { + if (!defined('CRLF')) { + $this->setCrlf($type == 'mail' ? "\n" : "\r\n"); + } + + if (!$this->is_built) { + $this->buildMessage(); + } + + switch ($type) { + case 'mail': + $subject = ''; + if (!empty($this->headers['Subject'])) { + $subject = $this->_encodeHeader($this->headers['Subject'], $this->build_params['head_charset']); + unset($this->headers['Subject']); + } + + // Get flat representation of headers + foreach ($this->headers as $name => $value) { + $headers[] = $name . ': ' . $this->_encodeHeader($value, $this->build_params['head_charset']); + } + + $to = $this->_encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']); + + if (!empty($this->return_path)) { + $result = mail($to, $subject, $this->output, implode(CRLF, $headers), '-f' . $this->return_path); + } else { + $result = mail($to, $subject, $this->output, implode(CRLF, $headers)); + } + + // Reset the subject in case mail is resent + if ($subject !== '') { + $this->headers['Subject'] = $subject; + } + + // Return + return $result; + break; + + case 'smtp': + require_once(dirname(__FILE__) . '/smtp.php'); + require_once(dirname(__FILE__) . '/RFC822.php'); + $smtp = &smtp::connect($this->smtp_params); + + // Parse recipients argument for internet addresses + foreach ($recipients as $recipient) { + $addresses = Mail_RFC822::parseAddressList($recipient, $this->smtp_params['helo'], null, false); + foreach ($addresses as $address) { + $smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host); + } + } + unset($addresses); // These are reused + unset($address); // These are reused + + // Get flat representation of headers, parsing + // Cc and Bcc as we go + foreach ($this->headers as $name => $value) { + if ($name == 'Cc' OR $name == 'Bcc') { + $addresses = Mail_RFC822::parseAddressList($value, $this->smtp_params['helo'], null, false); + foreach ($addresses as $address) { + $smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host); + } + } + if ($name == 'Bcc') { + continue; + } + $headers[] = $name . ': ' . $this->_encodeHeader($value, $this->build_params['head_charset']); + } + // Add To header based on $recipients argument + $headers[] = 'To: ' . $this->_encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']); + + // Add headers to send_params + $send_params['headers'] = $headers; + $send_params['recipients'] = array_values(array_unique($smtp_recipients)); + $send_params['body'] = $this->output; + + // Setup return path + if (isset($this->return_path)) { + $send_params['from'] = $this->return_path; + } elseif (!empty($this->headers['From'])) { + $from = Mail_RFC822::parseAddressList($this->headers['From']); + $send_params['from'] = sprintf('%s@%s', $from[0]->mailbox, $from[0]->host); + } else { + $send_params['from'] = 'postmaster@' . $this->smtp_params['helo']; + } + + // Send it + if (!$smtp->send($send_params)) { + $this->errors = $smtp->errors; + return false; + } + return true; + break; + } + } + + /** + * Use this method to return the email + * in message/rfc822 format. Useful for + * adding an email to another email as + * an attachment. there's a commented + * out example in example.php. + */ + function getRFC822($recipients) + { + // Make up the date header as according to RFC822 + $this->setHeader('Date', date('D, d M y H:i:s O')); + + if (!defined('CRLF')) { + $this->setCrlf($type == 'mail' ? "\n" : "\r\n"); + } + + if (!$this->is_built) { + $this->buildMessage(); + } + + // Return path ? + if (isset($this->return_path)) { + $headers[] = 'Return-Path: ' . $this->return_path; + } + + // Get flat representation of headers + foreach ($this->headers as $name => $value) { + $headers[] = $name . ': ' . $value; + } + $headers[] = 'To: ' . implode(', ', $recipients); + + return implode(CRLF, $headers) . CRLF . CRLF . $this->output; + } +} // End of class. +?> diff --git a/maarch_entreprise/trunk/tools/mails/mimePart.php b/maarch_entreprise/trunk/tools/mails/mimePart.php new file mode 100644 index 0000000000000000000000000000000000000000..feaf9ce9abcbae6779cecdd64e25152fe0e534fe --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/mimePart.php @@ -0,0 +1,333 @@ +<?php +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Richard Heyes <richard@phpguru.org> | +// +----------------------------------------------------------------------+ + +/** +* +* Raw mime encoding class +* +* What is it? +* This class enables you to manipulate and build +* a mime email from the ground up. +* +* Why use this instead of mime.php? +* mime.php is a userfriendly api to this class for +* people who aren't interested in the internals of +* mime mail. This class however allows full control +* over the email. +* +* Eg. +* +* // Since multipart/mixed has no real body, (the body is +* // the subpart), we set the body argument to blank. +* +* $params['content_type'] = 'multipart/mixed'; +* $email = new Mail_mimePart('', $params); +* +* // Here we add a text part to the multipart we have +* // already. Assume $body contains plain text. +* +* $params['content_type'] = 'text/plain'; +* $params['encoding'] = '7bit'; +* $text = $email->addSubPart($body, $params); +* +* // Now add an attachment. Assume $attach is +* the contents of the attachment +* +* $params['content_type'] = 'application/zip'; +* $params['encoding'] = 'base64'; +* $params['disposition'] = 'attachment'; +* $params['dfilename'] = 'example.zip'; +* $attach =& $email->addSubPart($body, $params); +* +* // Now build the email. Note that the encode +* // function returns an associative array containing two +* // elements, body and headers. You will need to add extra +* // headers, (eg. Mime-Version) before sending. +* +* $email = $message->encode(); +* $email['headers'][] = 'Mime-Version: 1.0'; +* +* +* Further examples are available at http://www.phpguru.org +* +* TODO: +* - Set encode() to return the $obj->encoded if encode() +* has already been run. Unless a flag is passed to specifically +* re-build the message. +* +* @author Richard Heyes <richard@phpguru.org> +* @version $Revision: 1.3 $ +* @package Mail +*/ + +class Mail_mimePart { + + /** + * The encoding type of this part + * @var string + */ + var $_encoding; + + /** + * An array of subparts + * @var array + */ + var $_subparts; + + /** + * The output of this part after being built + * @var string + */ + var $_encoded; + + /** + * Headers for this part + * @var array + */ + var $_headers; + + /** + * The body of this part (not encoded) + * @var string + */ + var $_body; + + /** + * Constructor. + * + * Sets up the object. + * + * @param $body - The body of the mime part if any. + * @param $params - An associative array of parameters: + * content_type - The content type for this part eg multipart/mixed + * encoding - The encoding to use, 7bit, 8bit, base64, or quoted-printable + * cid - Content ID to apply + * disposition - Content disposition, inline or attachment + * dfilename - Optional filename parameter for content disposition + * description - Content description + * charset - Character set to use + * @access public + */ + function Mail_mimePart($body = '', $params = array()) + { + if (!defined('MAIL_MIMEPART_CRLF')) { + define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", TRUE); + } + + foreach ($params as $key => $value) { + switch ($key) { + case 'content_type': + $headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : ''); + break; + + case 'encoding': + $this->_encoding = $value; + $headers['Content-Transfer-Encoding'] = $value; + break; + + case 'cid': + $headers['Content-ID'] = '<' . $value . '>'; + break; + + case 'disposition': + $headers['Content-Disposition'] = $value . (isset($dfilename) ? '; filename="' . $dfilename . '"' : ''); + break; + + case 'dfilename': + if (isset($headers['Content-Disposition'])) { + $headers['Content-Disposition'] .= '; filename="' . $value . '"'; + } else { + $dfilename = $value; + } + break; + + case 'description': + $headers['Content-Description'] = $value; + break; + + case 'charset': + if (isset($headers['Content-Type'])) { + $headers['Content-Type'] .= '; charset="' . $value . '"'; + } else { + $charset = $value; + } + break; + } + } + + // Default content-type + if (!isset($headers['Content-Type'])) { + $headers['Content-Type'] = 'text/plain'; + } + + //Default encoding + if (!isset($this->_encoding)) { + $this->_encoding = '7bit'; + } + + // Assign stuff to member variables + $this->_encoded = array(); + $this->_headers = $headers; + $this->_body = $body; + } + + /** + * encode() + * + * Encodes and returns the email. Also stores + * it in the encoded member variable + * + * @return An associative array containing two elements, + * body and headers. The headers element is itself + * an indexed array. + * @access public + */ + function encode() + { + $encoded =& $this->_encoded; + + if (!empty($this->_subparts)) { + srand((double)microtime()*1000000); + $boundary = '=_' . md5(uniqid(rand()) . microtime()); + $this->_headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF . "\t" . 'boundary="' . $boundary . '"'; + + // Add body parts to $subparts + for ($i = 0; $i < count($this->_subparts); $i++) { + $headers = array(); + $tmp = $this->_subparts[$i]->encode(); + foreach ($tmp['headers'] as $key => $value) { + $headers[] = $key . ': ' . $value; + } + $subparts[] = implode(MAIL_MIMEPART_CRLF, $headers) . MAIL_MIMEPART_CRLF . MAIL_MIMEPART_CRLF . $tmp['body']; + } + + $encoded['body'] = '--' . $boundary . MAIL_MIMEPART_CRLF . + implode('--' . $boundary . MAIL_MIMEPART_CRLF, $subparts) . + '--' . $boundary.'--' . MAIL_MIMEPART_CRLF; + + } else { + $encoded['body'] = $this->_getEncodedData($this->_body, $this->_encoding) . MAIL_MIMEPART_CRLF; + } + + // Add headers to $encoded + $encoded['headers'] =& $this->_headers; + + return $encoded; + } + + /** + * &addSubPart() + * + * Adds a subpart to current mime part and returns + * a reference to it + * + * @param $body The body of the subpart, if any. + * @param $params The parameters for the subpart, same + * as the $params argument for constructor. + * @return A reference to the part you just added. It is + * crucial if using multipart/* in your subparts that + * you use =& in your script when calling this function, + * otherwise you will not be able to add further subparts. + * @access public + */ + function &addSubPart($body, $params) + { + $this->_subparts[] = new Mail_mimePart($body, $params); + return $this->_subparts[count($this->_subparts) - 1]; + } + + /** + * _getEncodedData() + * + * Returns encoded data based upon encoding passed to it + * + * @param $data The data to encode. + * @param $encoding The encoding type to use, 7bit, base64, + * or quoted-printable. + * @access private + */ + function _getEncodedData($data, $encoding) + { + switch ($encoding) { + case '8bit': + case '7bit': + return $data; + break; + + case 'quoted-printable': + return $this->_quotedPrintableEncode($data); + break; + + case 'base64': + return rtrim(chunk_split(base64_encode($data), 76, MAIL_MIMEPART_CRLF)); + break; + + default: + return $data; + } + } + + /** + * quoteadPrintableEncode() + * + * Encodes data to quoted-printable standard. + * + * @param $input The data to encode + * @param $line_max Optional max line length. Should + * not be more than 76 chars + * + * @access private + */ + function _quotedPrintableEncode($input , $line_max = 76) + { + $lines = preg_split("/\r?\n/", $input); + $eol = MAIL_MIMEPART_CRLF; + $escape = '='; + $output = ''; + + while(list(, $line) = each($lines)){ + + $linlen = strlen($line); + $newline = ''; + + for ($i = 0; $i < $linlen; $i++) { + $char = substr($line, $i, 1); + $dec = ord($char); + + if (($dec == 32) AND ($i == ($linlen - 1))){ // convert space at eol only + $char = '=20'; + + } elseif($dec == 9) { + ; // Do nothing if a tab. + } elseif(($dec == 61) OR ($dec < 32 ) OR ($dec > 126)) { + $char = $escape . strtoupper(sprintf('%02s', dechex($dec))); + } + + if ((strlen($newline) + strlen($char)) >= $line_max) { // MAIL_MIMEPART_CRLF is not counted + $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay + $newline = ''; + } + $newline .= $char; + } // end of for + $output .= $newline . $eol; + } + $output = substr($output, 0, -1 * strlen($eol)); // Don't want last crlf + return $output; + } +} // End of class +?> diff --git a/maarch_entreprise/trunk/tools/mails/smtp.php b/maarch_entreprise/trunk/tools/mails/smtp.php new file mode 100644 index 0000000000000000000000000000000000000000..e04060c20386cb6a45647a60bc6e4a2f2da345e9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/mails/smtp.php @@ -0,0 +1,359 @@ +<?php +/** +* Filename.......: class.smtp.inc +* Project........: SMTP Class +* Version........: 1.0.5 +* Last Modified..: 21 December 2001 +*/ + + define('SMTP_STATUS_NOT_CONNECTED', 1, TRUE); + define('SMTP_STATUS_CONNECTED', 2, TRUE); + + class smtp{ + + var $authenticated; + var $connection; + var $recipients; + var $headers; + var $timeout; + var $errors; + var $status; + var $body; + var $from; + var $host; + var $port; + var $helo; + var $auth; + var $user; + var $pass; + + /** + * Constructor function. Arguments: + * $params - An assoc array of parameters: + * + * host - The hostname of the smtp server Default: localhost + * port - The port the smtp server runs on Default: 25 + * helo - What to send as the HELO command Default: localhost + * (typically the hostname of the + * machine this script runs on) + * auth - Whether to use basic authentication Default: FALSE + * user - Username for authentication Default: <blank> + * pass - Password for authentication Default: <blank> + * timeout - The timeout in seconds for the call Default: 5 + * to fsockopen() + */ + + function smtp($params = array()){ + + if(!defined('CRLF')) + define('CRLF', "\r\n", TRUE); + + $this->authenticated = FALSE; + $this->timeout = 5; + $this->status = SMTP_STATUS_NOT_CONNECTED; + $this->host = 'localhost'; + $this->port = 25; + $this->helo = 'localhost'; + $this->auth = FALSE; + $this->user = ''; + $this->pass = ''; + $this->errors = array(); + + foreach($params as $key => $value){ + $this->$key = $value; + } + } + + /** + * Connect function. This will, when called + * statically, create a new smtp object, + * call the connect function (ie this function) + * and return it. When not called statically, + * it will connect to the server and send + * the HELO command. + */ + + function &connect($params = array()){ + + if(!isset($this->status)){ + $obj = new smtp($params); + if($obj->connect()){ + $obj->status = SMTP_STATUS_CONNECTED; + } + + return $obj; + + }else{ + $this->connection = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout); + if(function_exists('socket_set_timeout')){ + @socket_set_timeout($this->connection, 5, 0); + } + + $greeting = $this->get_data(); + if(is_resource($this->connection)){ + return $this->auth ? $this->ehlo() : $this->helo(); + }else{ + $this->errors[] = 'Failed to connect to server: '.$errstr; + return FALSE; + } + } + } + + /** + * Function which handles sending the mail. + * Arguments: + * $params - Optional assoc array of parameters. + * Can contain: + * recipients - Indexed array of recipients + * from - The from address. (used in MAIL FROM:), + * this will be the return path + * headers - Indexed array of headers, one header per array entry + * body - The body of the email + * It can also contain any of the parameters from the connect() + * function + */ + + function send($params = array()){ + + foreach($params as $key => $value){ + $this->set($key, $value); + } + + if($this->is_connected()){ + + // Do we auth or not? Note the distinction between the auth variable and auth() function + if($this->auth AND !$this->authenticated){ + if(!$this->auth()) + return FALSE; + } + + $this->mail($this->from); + if(is_array($this->recipients)) + foreach($this->recipients as $value) + $this->rcpt($value); + else + $this->rcpt($this->recipients); + + if(!$this->data()) + return FALSE; + + // Transparency + $headers = str_replace(CRLF.'.', CRLF.'..', trim(implode(CRLF, $this->headers))); + $body = str_replace(CRLF.'.', CRLF.'..', $this->body); + $body = $body[0] == '.' ? '.'.$body : $body; + + $this->send_data($headers); + $this->send_data(''); + $this->send_data($body); + $this->send_data('.'); + + $result = (substr(trim($this->get_data()), 0, 3) === '250'); + //$this->rset(); + return $result; + }else{ + $this->errors[] = 'Not connected!'; + return FALSE; + } + } + + /** + * Function to implement HELO cmd + */ + + function helo(){ + if(is_resource($this->connection) + AND $this->send_data('HELO '.$this->helo) + AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){ + + return TRUE; + + }else{ + $this->errors[] = 'HELO command failed, output: ' . trim(substr(trim($error),3)); + return FALSE; + } + } + + /** + * Function to implement EHLO cmd + */ + + function ehlo(){ + if(is_resource($this->connection) + AND $this->send_data('EHLO '.$this->helo) + AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){ + + return TRUE; + + }else{ + $this->errors[] = 'EHLO command failed, output: ' . trim(substr(trim($error),3)); + return FALSE; + } + } + + /** + * Function to implement RSET cmd + */ + + function rset(){ + if(is_resource($this->connection) + AND $this->send_data('RSET') + AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){ + + return TRUE; + + }else{ + $this->errors[] = 'RSET command failed, output: ' . trim(substr(trim($error),3)); + return FALSE; + } + } + + /** + * Function to implement QUIT cmd + */ + + function quit(){ + if(is_resource($this->connection) + AND $this->send_data('QUIT') + AND substr(trim($error = $this->get_data()), 0, 3) === '221' ){ + + fclose($this->connection); + $this->status = SMTP_STATUS_NOT_CONNECTED; + return TRUE; + + }else{ + $this->errors[] = 'QUIT command failed, output: ' . trim(substr(trim($error),3)); + return FALSE; + } + } + + /** + * Function to implement AUTH cmd + */ + + function auth(){ + if(is_resource($this->connection) + AND $this->send_data('AUTH LOGIN') + AND substr(trim($error = $this->get_data()), 0, 3) === '334' + AND $this->send_data(base64_encode($this->user)) // Send username + AND substr(trim($error = $this->get_data()),0,3) === '334' + AND $this->send_data(base64_encode($this->pass)) // Send password + AND substr(trim($error = $this->get_data()),0,3) === '235' ){ + + $this->authenticated = TRUE; + return TRUE; + + }else{ + $this->errors[] = 'AUTH command failed: ' . trim(substr(trim($error),3)); + return FALSE; + } + } + + /** + * Function that handles the MAIL FROM: cmd + */ + + function mail($from){ + + if($this->is_connected() + AND $this->send_data('MAIL FROM:<'.$from.'>') + AND substr(trim($this->get_data()), 0, 2) === '250' ){ + + return TRUE; + + }else + return FALSE; + } + + /** + * Function that handles the RCPT TO: cmd + */ + + function rcpt($to){ + + if($this->is_connected() + AND $this->send_data('RCPT TO:<'.$to.'>') + AND substr(trim($error = $this->get_data()), 0, 2) === '25' ){ + + return TRUE; + + }else{ + $this->errors[] = trim(substr(trim($error), 3)); + return FALSE; + } + } + + /** + * Function that sends the DATA cmd + */ + + function data(){ + + if($this->is_connected() + AND $this->send_data('DATA') + AND substr(trim($error = $this->get_data()), 0, 3) === '354' ){ + + return TRUE; + + }else{ + $this->errors[] = trim(substr(trim($error), 3)); + return FALSE; + } + } + + /** + * Function to determine if this object + * is connected to the server or not. + */ + + function is_connected(){ + + return (is_resource($this->connection) AND ($this->status === SMTP_STATUS_CONNECTED)); + } + + /** + * Function to send a bit of data + */ + + function send_data($data){ + + if(is_resource($this->connection)){ + return fwrite($this->connection, $data.CRLF, strlen($data)+2); + + }else + return FALSE; + } + + /** + * Function to get data. + */ + + function &get_data(){ + + $return = ''; + $line = ''; + $loops = 0; + + if(is_resource($this->connection)){ + while((strpos($return, CRLF) === FALSE OR substr($line,3,1) !== ' ') AND $loops < 100){ + $line = fgets($this->connection, 512); + $return .= $line; + $loops++; + } + return $return; + + }else + return FALSE; + } + + /** + * Sets a variable + */ + + function set($var, $value){ + + $this->$var = $value; + return TRUE; + } + + } // End of class +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/barcode.php b/maarch_entreprise/trunk/tools/pdfb/barcode/barcode.php new file mode 100644 index 0000000000000000000000000000000000000000..538de9da66d835040dea51254461572092c49c7f --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/barcode.php @@ -0,0 +1,202 @@ +<?php +/* +Barcode Render Class for PHP using the GD graphics library +Copyright (C) 2001 Karim Mribti + + Version 0.0.7a 2001-04-01 + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt + +Source code home page: http://www.mribti.com/barcode/ +Contact author at: barcode@mribti.com + ++-----------------------------------------------------------------+ +| Modified by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + +/***************************** base class ********************************************/ + + /* Styles */ + define("BCS_BORDER" , 1); + define("BCS_TRANSPARENT" , 2); + define("BCS_ALIGN_CENTER" , 4); + define("BCS_ALIGN_LEFT" , 8); + define("BCS_ALIGN_RIGHT" , 16); + define("BCS_IMAGE_JPEG" , 32); + define("BCS_IMAGE_PNG" , 64); + define("BCS_DRAW_TEXT" , 128); + define("BCS_STRETCH_TEXT" , 256); + define("BCS_REVERSE_COLOR" , 512); + define("BCS_I25_DRAW_CHECK" , 2048); // For the I25 Only + + /* Default values */ + define("BCD_DEFAULT_BACKGROUND_COLOR", 0xFFFFFF); + define("BCD_DEFAULT_FOREGROUND_COLOR", 0x000000); + define("BCD_DEFAULT_STYLE" , BCS_ALIGN_CENTER | BCS_IMAGE_PNG | BCS_DRAW_TEXT | BCS_STRETCH_TEXT); + define("BCD_DEFAULT_WIDTH" , 216); + define("BCD_DEFAULT_HEIGHT" , 144); + define("BCD_DEFAULT_FONT" , 5); + define("BCD_DEFAULT_XRES" , 2); + /* Margins */ + define("BCD_DEFAULT_MAR_Y1" , 10); + define("BCD_DEFAULT_MAR_Y2" , 10); + define("BCD_DEFAULT_TEXT_OFFSET" , 2); + define("BCD_DEFAULT_TEXT_FILL_OFFSET", -10); + /* For the I25 Only */ + define("BCD_I25_NARROW_BAR" , 1); + define("BCD_I25_WIDE_BAR" , 2); + /* For the C39 Only */ + define("BCD_C39_NARROW_BAR" , 1); + define("BCD_C39_WIDE_BAR" , 2); + /* For Code 128 */ + define("BCD_C128_BAR_1" , 1); + define("BCD_C128_BAR_2" , 2); + define("BCD_C128_BAR_3" , 3); + define("BCD_C128_BAR_4" , 4); + + class BarcodeObject + { + var $mWidth, $mHeight, $mStyle, $mBgcolor, $mBrush; + var $mImg, $mFont; + var $mError; + + function BarcodeObject($Width = BCD_DEFAULT_WIDTH, $Height = BCD_DEFAULT_HEIGHT, $Style = BCD_DEFAULT_STYLE) + { + $this->mWidth = $Width; + $this->mHeight = $Height; + $this->mStyle = $Style; + $this->mFont = BCD_DEFAULT_FONT; + $this->mImg = ImageCreate($this->mWidth, $this->mHeight); + + $dbColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_FOREGROUND_COLOR : BCD_DEFAULT_BACKGROUND_COLOR; + $dfColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_BACKGROUND_COLOR : BCD_DEFAULT_FOREGROUND_COLOR; + + $this->mBgcolor = ImageColorAllocate($this->mImg, ($dbColor & 0xFF0000) >> 16, ($dbColor & 0x00FF00) >> 8 , $dbColor & 0x0000FF); + $this->mBrush = ImageColorAllocate($this->mImg, ($dfColor & 0xFF0000) >> 16, ($dfColor & 0x00FF00) >> 8 , $dfColor & 0x0000FF); + + if(!($this->mStyle & BCS_TRANSPARENT)) + ImageFill($this->mImg, $this->mWidth, $this->mHeight, $this->mBgcolor); + } + + function DrawObject($xres) + { + // Abstract function + return false; + } + + function DrawBorder() + { + ImageRectangle($this->mImg, 0, 0, $this->mWidth-1, $this->mHeight-1, $this->mBrush); + } + + function DrawChar($Font, $xPos, $yPos, $Char) + { + ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); + } + + function DrawText($Font, $xPos, $yPos, $Char) + { + ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); + } + + function DrawSingleBar($xPos, $yPos, $xSize, $ySize) + { + if($xPos>=0 && $xPos<=$this->mWidth && ($xPos+$xSize)<=$this->mWidth && $yPos>=0 && $yPos<=$this->mHeight && ($yPos+$ySize)<=$this->mHeight) + { + for($i=0;$i<$xSize;$i++) + ImageLine($this->mImg, $xPos+$i, $yPos, $xPos+$i, $yPos+$ySize, $this->mBrush); + return true; + } + return false; + } + + function GetError() + { + return $this->mError; + } + + function GetFontHeight($font) + { + return ImageFontHeight($font); + } + + function GetFontWidth($font) + { + return ImageFontWidth($font); + } + + function SetFont($font) + { + $this->mFont = $font; + } + + function GetStyle() + { + return $this->mStyle; + } + + function SetStyle($Style) + { + $this->mStyle = $Style; + } + + function GetImage() + { + if(($this->mStyle & BCS_BORDER)) + $this->DrawBorder(); + + ob_start(); + + if($this->mStyle & BCS_IMAGE_PNG) + ImagePng($this->mImg); + else if($this->mStyle & BCS_IMAGE_JPEG) + ImageJpeg($this->mImg, "", 100); + + $imagedata = ob_get_contents(); + ob_end_clean(); + + return $imagedata; + } + + function FlushObject() + { + if(($this->mStyle & BCS_BORDER)) + $this->DrawBorder(); + + if($this->mStyle & BCS_IMAGE_PNG) + { + Header("Content-Type: image/png"); + ImagePng($this->mImg); + } + else if($this->mStyle & BCS_IMAGE_JPEG) + { + Header("Content-Type: image/jpeg"); + ImageJpeg($this->mImg); + } + } + + function DestroyObject() + { + ImageDestroy($this->mImg); + } + } + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/barcodeimage.php b/maarch_entreprise/trunk/tools/pdfb/barcode/barcodeimage.php new file mode 100644 index 0000000000000000000000000000000000000000..28e94b262c513d303d8e964c63db300a3b4de93e --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/barcodeimage.php @@ -0,0 +1,87 @@ +<?php +/* + ++-----------------------------------------------------------------+ +| Created by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + + require("barcode.php"); + require("c39.php"); + require("c128a.php"); + require("c128b.php"); + require("c128c.php"); + require("i25.php"); + require("upca.php"); + + function generateBarCodeJPEG($code, $type = "C128B", $width = BCD_DEFAULT_WIDTH, $height = BCD_DEFAULT_HEIGHT, $style = BCD_DEFAULT_STYLE, $xres = BCD_DEFAULT_XRES, $font = BCD_DEFAULT_FONT, $flushimg = false) + { + $style = $style ^ BCS_IMAGE_PNG | BCS_IMAGE_JPEG; + return generateBarCodeImage($code, $type, $width, $height, $style, $xres, $font, $flushimg); + } + + function generateBarCodePNG($code, $type = "C128B", $width = BCD_DEFAULT_WIDTH, $height = BCD_DEFAULT_HEIGHT, $style = BCD_DEFAULT_STYLE, $xres = BCD_DEFAULT_XRES, $font = BCD_DEFAULT_FONT, $flushimg = false) + { + $style = $style ^ BCS_IMAGE_JPEG | BCS_IMAGE_PNG; + return generateBarCodeImage($code, $type, $width, $height, $style, $xres, $font, $flushimg); + } + + function generateBarCodeImage($code, $type = "C128B", $width = BCD_DEFAULT_WIDTH, $height = BCD_DEFAULT_HEIGHT, $style = BCD_DEFAULT_STYLE, $xres = BCD_DEFAULT_XRES, $font = BCD_DEFAULT_FONT, $flushimg = false) + { + $obj = false; + $barcodedata = false; + + $code = trim($code); + if($code == "") + return false; + + switch(strtoupper($type)) + { + case "C39": + $obj = new C39Object($width, $height, $style, $code); + break; + case "C128A": + $obj = new C128AObject($width, $height, $style, $code); + break; + case "C128B": + // default is C128B + default: + $obj = new C128BObject($width, $height, $style, $code); + break; + case "C128C": + $obj = new C128CObject($width, $height, $style, $code); + break; + case "I25": + $obj = new I25Object($width, $height, $style, $code); + break; + case "UPCA": + $obj = new UPCAObject($width, $height, $style, $code); + break; + } + + if($obj) + { + $obj->SetFont($font); + $obj->DrawObject($xres); + + if($flushimg) + { + $obj->FlushObject(); + $barcodedata = true; + } + else + { + $barcodedata = $obj->GetImage(); + } + + $obj->DestroyObject(); + unset($obj); + } + + return $barcodedata; + } + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/c128a.php b/maarch_entreprise/trunk/tools/pdfb/barcode/c128a.php new file mode 100644 index 0000000000000000000000000000000000000000..d779bfbcb43e5bccb9aa74015e461ee78a0a123d --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/c128a.php @@ -0,0 +1,334 @@ +<?php +/* +Barcode Render Class for PHP using the GD graphics library +Copyright (C) 2001 Karim Mribti + + Version 0.0.7a 2001-04-01 + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt + +Source code home page: http://www.mribti.com/barcode/ +Contact author at: barcode@mribti.com + ++-----------------------------------------------------------------+ +| Modified by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + + /* + Render for Code 128-A + Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters . + */ + + + class C128AObject extends BarcodeObject { + var $mCharSet, $mChars; + function C128AObject($Width, $Height, $Style, $Value) + { + $this->BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = " !\"#$%&'()*+´-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"; + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + "114131", /* 100 */ + "311141", /* 101 */ + "411131" /* 102 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<64;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + return false; + } + $ret = 0; + for ($i=0;$i<$len;$i++) { + if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) { + $this->mError = "C128A not include the char '".$this->mValue[$i]."'"; + return false; + } else { + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + } + + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + $CheckSize = 0; + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 103; // 'A' type; + for ($i=0;$i<$len;$i++) { + $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1); + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211412' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('4', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + ImageFilledRectangle($this->mImg, + $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/4, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, + $sPos-(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/4 + $size, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET + $this->GetFontHeight($this->mFont), + $this->mBgcolor + ); + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/2+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + return true; + } + } +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/c128b.php b/maarch_entreprise/trunk/tools/pdfb/barcode/c128b.php new file mode 100644 index 0000000000000000000000000000000000000000..d4791613d01df84d47b4bd0ab0d5a0fb445832f1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/c128b.php @@ -0,0 +1,335 @@ +<?php +/* +Barcode Render Class for PHP using the GD graphics library +Copyright (C) 2001 Karim Mribti + + Version 0.0.7a 2001-04-01 + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt + +Source code home page: http://www.mribti.com/barcode/ +Contact author at: barcode@mribti.com + ++-----------------------------------------------------------------+ +| Modified by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + + /* + Render for Code 128-B + Code 128-B is a continuous, multilevel and full ASCII code . + */ + + + class C128BObject extends BarcodeObject { + var $mCharSet, $mChars; + function C128BObject($Width, $Height, $Style, $Value) + { + $this->BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = " !\"#$%&'()*+´-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{ }~"; + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + "114131", /* 100 */ + "311141", /* 101 */ + "411131" /* 102 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<95;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + return false; + } + $ret = 0; + for ($i=0;$i<$len;$i++) { + if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) { + $this->mError = "C128B not include the char '".$this->mValue[$i]."'"; + return false; + } else { + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + } + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + $CheckSize = 0; + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 104; // 'B' type; + for ($i=0;$i<$len;$i++) { + $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1); + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211214' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('4', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + ImageFilledRectangle($this->mImg, + $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/4, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, + $sPos-(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/4 + $size, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET + $this->GetFontHeight($this->mFont), + $this->mBgcolor + ); + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/3+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + return true; + } + } +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/c128c.php b/maarch_entreprise/trunk/tools/pdfb/barcode/c128c.php new file mode 100644 index 0000000000000000000000000000000000000000..fa1d656abec471a1c30c0cbba3f889dbd66568d5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/c128c.php @@ -0,0 +1,357 @@ +<?php +/* +Barcode Render Class for PHP using the GD graphics library +Copyright (C) 2001 Karim Mribti + -- Written on 2001-08-03 by Sam Michaels + to add Code 128-C support. + swampgas@swampgas.org + + Version 0.0.7a 2001-08-03 + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt + +Source code home page: http://www.mribti.com/barcode/ +Contact author at: barcode@mribti.com + ++-----------------------------------------------------------------+ +| Modified by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + + /* + Render for Code 128-C + Code 128-C is numeric only and provides the most efficiency. + */ + + + class C128CObject extends BarcodeObject { + var $mCharSet, $mChars; + function C128CObject($Width, $Height, $Style, $Value) + { + $this->BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = array + ( + "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", + "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", + "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", + "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", + "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", + "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", + "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", + "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", + "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", + "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", + ); + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<100;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + return false; + } + $ret = 0; + + for ($i=0;$i<$len;$i++) { + if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) { + $this->mError = "Code-128C is numeric only"; + return false; + } + } + + if (($len%2) != 0) { + $this->mError = "The length of barcode value must be even. You must pad the number with zeros."; + return false; + } + + for ($i=0;$i<$len;$i+=2) { + $id = $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]); + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + $CheckSize = 0; + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 105; // 'C' type; + $m = 0; + for ($i=0;$i<$len;$i+=2) { + $m++; + $sum += $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]) * $m; + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211232' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos].$this->mValue[$cPos+1]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos += 2; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + ImageFilledRectangle($this->mImg, + $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/8, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, + $sPos-(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/8 + $size, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET + $this->GetFontHeight($this->mFont), + $this->mBgcolor + ); + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)/4+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + return true; + } + } +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/c39.php b/maarch_entreprise/trunk/tools/pdfb/barcode/c39.php new file mode 100644 index 0000000000000000000000000000000000000000..316f297f0a35ca46bbc8563a6b105db450a0cbb6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/c39.php @@ -0,0 +1,241 @@ +<?php +/* +Barcode Render Class for PHP using the GD graphics library +Copyright (C) 2001 Karim Mribti + + Version 0.0.7a 2001-04-01 + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt + +Source code home page: http://www.mribti.com/barcode/ +Contact author at: barcode@mribti.com + ++-----------------------------------------------------------------+ +| Modified by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + + /* + Render for Code 39 + Code 39 is an alphanumeric bar code that can encode decimal number, case alphabet and some special symbols. + */ + + + class C39Object extends BarcodeObject { + var $mCharSet, $mChars; + function C39Object($Width, $Height, $Style, $Value) + { + $this->BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; + $this->mCharSet = array + ( + /* 0 */ "000110100", + /* 1 */ "100100001", + /* 2 */ "001100001", + /* 3 */ "101100000", + /* 4 */ "000110001", + /* 5 */ "100110000", + /* 6 */ "001110000", + /* 7 */ "000100101", + /* 8 */ "100100100", + /* 9 */ "001100100", + /* A */ "100001001", + /* B */ "001001001", + /* C */ "101001000", + /* D */ "000011001", + /* E */ "100011000", + /* F */ "001011000", + /* G */ "000001101", + /* H */ "100001100", + /* I */ "001001100", + /* J */ "000011100", + /* K */ "100000011", + /* L */ "001000011", + /* M */ "101000010", + /* N */ "000010011", + /* O */ "100010010", + /* P */ "001010010", + /* Q */ "000000111", + /* R */ "100000110", + /* S */ "001000110", + /* T */ "000010110", + /* U */ "110000001", + /* V */ "011000001", + /* W */ "111000000", + /* X */ "010010001", + /* Y */ "110010000", + /* Z */ "011010000", + /* - */ "010000101", + /* . */ "110000100", + /* SP */ "011000100", + /* * */ "010010100", + /* $ */ "010101000", + /* / */ "010100010", + /* + */ "010001010", + /* % */ "000101010" + ); + } + + function GetCharIndex ($char) + { + for ($i=0;$i<44;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetSize($xres) + { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + return false; + } + + for ($i=0;$i<$len;$i++) { + if ($this->GetCharIndex($this->mValue[$i]) == -1 || $this->mValue[$i] == '*') { + /* The asterisk is only used as a start and stop code */ + $this->mError = "C39 not include the char '".$this->mValue[$i]."'"; + return false; + } + } + + /* Start, Stop is 010010100 == '*' */ + $StartSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; + $StopSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; + $CharSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; /* Same for all chars */ + + return $CharSize * $len + $StartSize + $StopSize + /* Space between chars */ BCD_C39_NARROW_BAR * $xres * ($len-1); + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '*' */ + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $wide; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; /* Space between chars */ + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '*' */ + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $wide; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize); + $DrawPos += $narrow; + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + + if (($size = $this->GetSize($xres))==0) { + return false; + } + + $cPos = 0; + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[0] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[0] == '0') ? $narrow : $wide; + $DrawPos += ($cset[1] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[2] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[2] == '0') ? $narrow : $wide; + $DrawPos += ($cset[3] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[4] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[4] == '0') ? $narrow : $wide; + $DrawPos += ($cset[5] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[6] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[6] == '0') ? $narrow : $wide; + $DrawPos += ($cset[7] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[8] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[8] == '0') ? $narrow : $wide; + $DrawPos += $narrow; /* Space between chars */ + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + ImageFilledRectangle($this->mImg, + $sPos+($narrow*6+$wide*3)/2, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, + $sPos+($narrow*6+$wide*3)/2 + $size, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET + $this->GetFontHeight($this->mFont), + $this->mBgcolor + ); + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+($narrow*6+$wide*3)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+($narrow*6+$wide*3), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + return true; + } + } +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/i25.php b/maarch_entreprise/trunk/tools/pdfb/barcode/i25.php new file mode 100644 index 0000000000000000000000000000000000000000..7e468cf3b4a9313d55a9fbcac426c542931e5f7a --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/i25.php @@ -0,0 +1,185 @@ +<?php +/* +Barcode Render Class for PHP using the GD graphics library +Copyright (C) 2001 Karim Mribti + + Version 0.0.7a 2001-04-01 + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt + +Source code home page: http://www.mribti.com/barcode/ +Contact author at: barcode@mribti.com + ++-----------------------------------------------------------------+ +| Modified by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + + /* + render for Interleaved 2 of 5 + Interleaved 2 of 5 is a numeric only bar code with a optional check number. + */ + + class I25Object extends BarcodeObject { + var $mCharSet; + function I25Object($Width, $Height, $Style, $Value) + { + $this->BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mCharSet = array + ( + /* 0 */ "00110", + /* 1 */ "10001", + /* 2 */ "01001", + /* 3 */ "11000", + /* 4 */ "00101", + /* 5 */ "10100", + /* 6 */ "01100", + /* 7 */ "00011", + /* 8 */ "10010", + /* 9 */ "01010" + ); + } + + function GetSize($xres) + { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + return false; + } + + for ($i=0;$i<$len;$i++) { + if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) { + $this->mError = "I25 is numeric only"; + return false; + } + } + + if (($len%2) != 0) { + $this->mError = "The length of barcode value must be even"; + return false; + } + $StartSize = BCD_I25_NARROW_BAR * 4 * $xres; + $StopSize = BCD_I25_WIDE_BAR * $xres + 2 * BCD_I25_NARROW_BAR * $xres; + $cPos = 0; + $sPos = 0; + do { + $c1 = $this->mValue[$cPos]; + $c2 = $this->mValue[$cPos+1]; + $cset1 = $this->mCharSet[$c1]; + $cset2 = $this->mCharSet[$c2]; + + for ($i=0;$i<5;$i++) { + $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $sPos += ($type1 + $type2); + } + $cPos+=2; + } while ($cPos<$len); + + return $sPos + $StartSize + $StopSize; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is "0000" */ + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is "100" */ + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_WIDE_BAR * $xres , $ySize); + $DrawPos += BCD_I25_WIDE_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + + if (($size = $this->GetSize($xres))==0) { + return false; + } + + $cPos = 0; + + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + $sPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); + $nsPos = $sPos; + + do { + $c1 = $this->mValue[$cPos]; + $c2 = $this->mValue[$cPos+1]; + $cset1 = $this->mCharSet[$c1]; + $cset2 = $this->mCharSet[$c2]; + + for ($i=0;$i<5;$i++) { + $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $this->DrawSingleBar($sPos, BCD_DEFAULT_MAR_Y1, $type1 , $ysize); + $sPos += ($type1 + $type2); + } + $cPos+=2; + } while ($cPos<$len); + $sPos = $this->DrawStop($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); + + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + /* Stretch */ + ImageFilledRectangle($this->mImg, + $nsPos-BCD_I25_NARROW_BAR*2*$xres, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, + $nsPos-BCD_I25_NARROW_BAR*1*$xres+$size, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET + $this->GetFontHeight($this->mFont), + $this->mBgcolor + ); + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $nsPos-BCD_I25_NARROW_BAR/2*$xres+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET , $this->mValue[$i]); + } + }else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $nsPos+(($size-$text_width)/2)+(BCD_I25_NARROW_BAR*4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + return true; + } + } +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/lesser.txt b/maarch_entreprise/trunk/tools/pdfb/barcode/lesser.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e028171d4b53546c5d53b8c3d4135c2951b2b37 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/lesser.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/maarch_entreprise/trunk/tools/pdfb/barcode/upca.php b/maarch_entreprise/trunk/tools/pdfb/barcode/upca.php new file mode 100644 index 0000000000000000000000000000000000000000..449defd2ecec9ba5becef3b919ad82fbaa518208 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/barcode/upca.php @@ -0,0 +1,223 @@ +<?php +/* + ++-----------------------------------------------------------------+ +| Created by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + + /* + Render for UPC-A + The "UPC-A barcode" is by far the most common and well-known symbology, at least in the United States. + An UPC-A barcode is the barcode you will find on virtually every consumer good on the shelves of your local supermarket, + as well as books, magazines, and newspapers. It is commonly called simply a "UPC barcode" or "UPC Symbol." + UPC-A encodes 11 digits of numeric (0 through 9) message data along with a trailing check digit, + for a total of 12 digits of barcode data. + */ + + class UPCAObject extends BarcodeObject + { + var $mCharSetL, $mCharSetR, $mChars; + + function UPCAObject($Width, $Height, $Style, $Value) + { + $this->BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = "0123456789"; + $this->mCharSetL = array + ( + /* 0 */ "0001101", + /* 1 */ "0011001", + /* 2 */ "0010011", + /* 3 */ "0111101", + /* 4 */ "0100011", + /* 5 */ "0110001", + /* 6 */ "0101111", + /* 7 */ "0111011", + /* 8 */ "0110111", + /* 9 */ "0001011" + ); + $this->mCharSetR = array + ( + /* 0 */ "1110010", + /* 1 */ "1100110", + /* 2 */ "1101100", + /* 3 */ "1000010", + /* 4 */ "1011100", + /* 5 */ "1001110", + /* 6 */ "1010000", + /* 7 */ "1000100", + /* 8 */ "1001000", + /* 9 */ "1110100" + ); + } + + function GetCharIndex($char) + { + for($i=0;$i<10;$i++) + if($this->mChars[$i] == $char) + return $i; + return -1; + } + + function GetSize($xres) + { + $len = strlen($this->mValue); + + if($len == 0) + { + $this->mError = "Null value"; + return false; + } + + for($i = 0; $i < $len; $i++) + { + if($this->GetCharIndex($this->mValue[$i]) == -1) + { + $this->mError = "UPCA not include the char '".$this->mValue[$i]."'"; + return false; + } + } + + // Start, Stop is 101 + // Middle Bar is 01010 + $StartSize = $xres * 3; + $StopSize = $xres * 3; + $MidSize = $xres * 5; + $CharSize = $xres * 7; // Same for all chars + + return $CharSize * $len + $StartSize + $MidSize + $StopSize; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { + // Start code is '101' + $this->DrawSingleBar($DrawPos, $yPos, $xres , $ySize); + $DrawPos += $xres; + $DrawPos += $xres; + $this->DrawSingleBar($DrawPos, $yPos, $xres , $ySize); + $DrawPos += $xres; + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { + // Stop code is same as Start code + return $this->DrawStart($DrawPos, $yPos, $ySize, $xres); + } + + function DrawMiddle($DrawPos, $yPos, $ySize, $xres) + { + // Middle code is '01010' + $DrawPos += $xres; + $this->DrawSingleBar($DrawPos, $yPos, $xres , $ySize); + $DrawPos += $xres; + $DrawPos += $xres; + $this->DrawSingleBar($DrawPos, $yPos, $xres , $ySize); + $DrawPos += $xres; + $DrawPos += $xres; + return $DrawPos; + } + + function DrawObject($xres) + { + $len = strlen($this->mValue); + + if(($size = $this->GetSize($xres)) == 0) + return false; + + $cPos = 0; + + if($this->mStyle & BCS_ALIGN_CENTER) + $sPos = (integer)(($this->mWidth - $size ) / 2); + else if($this->mStyle & BCS_ALIGN_RIGHT) + $sPos = $this->mWidth - $size; + else + $sPos = 0; + + // Total height of bar code -Bars only- + if($this->mStyle & BCS_DRAW_TEXT) + $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else + $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + + for($i = 0; $i < 6; $i++) + { + $c = $this->GetCharIndex($this->mValue[$i]); + $cset = $this->mCharSetL[$c]; + + for($j = 0; $j < strlen($cset); $j++) + { + if(intval(substr($cset, $j, 1)) == 1) + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $xres, $ysize); + $DrawPos += $xres; + } + } + + $DrawPos = $this->DrawMiddle($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); + + for($i = 6; $i < $len; $i++) + { + $c = $this->GetCharIndex($this->mValue[$i]); + $cset = $this->mCharSetR[$c]; + + for($j = 0; $j < strlen($cset); $j++) + { + if(intval(substr($cset, $j, 1)) == 1) + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $xres, $ysize); + $DrawPos += $xres; + } + } + + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + + // Draw text + if($this->mStyle & BCS_DRAW_TEXT) + { + $mid = $sPos + $size/2; + $len5 = (strlen($this->mCharSetL[$c])+1)*$xres*5; + $ht = $this->GetFontHeight($this->mFont); + + ImageFilledRectangle($this->mImg, + $mid-$len5-$xres*2, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, + $mid-$xres*2, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET + $ht, + $this->mBgcolor + ); + ImageFilledRectangle($this->mImg, + $mid+$xres*2, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, + $mid+$len5+$xres*2, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET + $ht, + $this->mBgcolor + ); + + $this->DrawChar(($this->mFont-2 > 1 ? $this->mFont-2 : 1), $sPos-$xres*3-$this->GetFontWidth($this->mFont > 1 ? $this->mFont - 1 : 1), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, $this->mValue[0]); + + $left = $mid-$len5; + + for ($i=1;$i<$len/2;$i++) + $this->DrawChar($this->mFont, $left+($size/$len)*($i-1), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, $this->mValue[$i]); + + $left = $mid+$xres*4; + + for ($i=$len/2;$i<$len-1;$i++) + $this->DrawChar($this->mFont, $left+($size/$len)*($i-$len/2), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, $this->mValue[$i]); + + $this->DrawChar(($this->mFont-2 > 1 ? $this->mFont-2 : 1), $sPos+$xres*6 + $size, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET + BCD_DEFAULT_TEXT_FILL_OFFSET, $this->mValue[$len-1]); + } + + return true; + } + } +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/FAQ.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/FAQ.htm new file mode 100644 index 0000000000000000000000000000000000000000..6ab9424beeb01137b19b48b2bac77ca17ad427d4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/FAQ.htm @@ -0,0 +1,291 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>FAQ</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="fpdf.css"> +</HEAD> +<BODY> +<H2>FAQ</H2> +<UL STYLE="list-style-type:none; margin-left:0; padding-left:0; margin-bottom:2.2em"> +<LI><B>1.</B> <A HREF='#1'>What's exactly the license of FPDF? Are there any usage restrictions?</A> +<LI><B>2.</B> <A HREF='#2'>When I try to create a PDF, a lot of weird characters show on the screen. Why?</A> +<LI><B>3.</B> <A HREF='#3'>I try to generate a PDF and IE displays a blank page. What happens?</A> +<LI><B>4.</B> <A HREF='#4'>I send parameters using the POST method and the values don't appear in the PDF.</A> +<LI><B>5.</B> <A HREF='#5'>When I use a PHP session, IE doesn't display my PDF any more but asks me to download it.</A> +<LI><B>6.</B> <A HREF='#6'>When I'm on SSL, IE can't open the PDF.</A> +<LI><B>7.</B> <A HREF='#7'>When I execute a script I get the message "FPDF error: Don't alter the locale before including class file".</A> +<LI><B>8.</B> <A HREF='#8'>I try to put a PNG and Acrobat says "There was an error processing a page. A drawing error occurred".</A> +<LI><B>9.</B> <A HREF='#9'>I encounter the following error when I try to generate a PDF: Warning: Cannot add header information - headers already sent by (output started at script.php:X)</A> +<LI><B>10.</B> <A HREF='#10'>I try to display a variable in the Header method but nothing prints.</A> +<LI><B>11.</B> <A HREF='#11'>I defined the Header and Footer methods in my PDF class but nothing appears.</A> +<LI><B>12.</B> <A HREF='#12'>I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.</A> +<LI><B>13.</B> <A HREF='#13'>I try to put the euro symbol but it doesn't work.</A> +<LI><B>14.</B> <A HREF='#14'>I draw a frame with very precise dimensions, but when printed I notice some differences.</A> +<LI><B>15.</B> <A HREF='#15'>I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?</A> +<LI><B>16.</B> <A HREF='#16'>What's the limit of the file sizes I can generate with FPDF?</A> +<LI><B>17.</B> <A HREF='#17'>Can I modify a PDF with FPDF?</A> +<LI><B>18.</B> <A HREF='#18'>I'd like to make a search engine in PHP and index PDF files. Can I do it with FPDF?</A> +<LI><B>19.</B> <A HREF='#19'>Can I convert an HTML page to PDF with FPDF?</A> +<LI><B>20.</B> <A HREF='#20'>Can I concatenate PDF files with FPDF?</A> +</UL> +<P><A NAME='1'><B>1.</B></A> <SPAN CLASS='st'>What's exactly the license of FPDF? Are there any usage restrictions?</SPAN></P> +FPDF is Freeware (it is stated at the beginning of the source file). There is no usage +restriction. You may embed it freely in your application (commercial or not), with or +without modification. You may redistribute it, too. +<P><A NAME='2'><B>2.</B></A> <SPAN CLASS='st'>When I try to create a PDF, a lot of weird characters show on the screen. Why?</SPAN></P> +These "weird" characters are in fact the actual content of your PDF. This behaviour is a bug of +IE. When it first receives an HTML page, then a PDF from the same URL, it displays it directly +without launching Acrobat. This happens frequently during the development stage: on the least +script error, an HTML page is sent, and after correction, the PDF arrives. +<BR> +To solve the problem, simply quit and restart IE. You can also go to another URL and come +back. +<BR> +To avoid this kind of inconvenience during the development, you can generate the PDF directly +to a file and open it through the explorer. +<P><A NAME='3'><B>3.</B></A> <SPAN CLASS='st'>I try to generate a PDF and IE displays a blank page. What happens?</SPAN></P> +First of all, check that you send nothing to the browser after the PDF (not even a space or a +carriage return). You can put an exit statement just after the call to the Output() method to +be sure. +<BR> +If it still doesn't work, it means you're a victim of the "blank page syndrome". IE used in +conjunction with the Acrobat plug-in suffers from numerous bugs, in all versions. You should +test your application with as many IE versions as possible (at least if you're on the Internet). +The problem occurs mostly with the POST method, so it is strongly advised to avoid it (all the +more that it causes other problems, see the next question). The GET works better but may fail +when the URL becomes too long: don't use a query string with more than 45 characters. However, a +tip exists to exceed this limit: end the URL with .pdf, which tricks IE. If you use a form, you +can add a hidden field at the last position: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +<INPUT TYPE="HIDDEN" NAME="ext" VALUE=".pdf"> +</TT> +</TD></TR></TABLE><BR> +The usage of PHP sessions also often causes trouble (avoid using HTTP headers preventing caching). +See question 5 for a workaround. +<BR> +<BR> +To avoid all these problems in a reliable manner, two main techniques exist: +<BR> +<BR> +- Disable the plug-in and use Acrobat as a helper application. To do this, launch Acrobat; in +the File menu, Preferences, General, uncheck the option "Web Browser Integration" (for Acrobat +5: Edit, Preferences, Options, "Display PDF in Browser"). Then, the next time you load a PDF in +IE, it displays the dialog box "Open it" or "Save it to disk". Uncheck the option "Always ask +before opening this type of file" and choose Open. From now on, PDF files will open +automatically in an external Acrobat window. +<BR> +The drawback of the method is that you need to alter the client configuration, which you can do +in an intranet environment but not for the Internet. +<BR> +<BR> +- Use a redirection technique. It consists in generating the PDF in a temporary file on the +server and redirect the client on it (by using JavaScript, not the Location HTTP header which +also causes trouble). For instance, at the end of the script, you can put the following: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +//Determine a temporary file name in the current directory<BR> +$file=basename(tempnam(getcwd(),'tmp'));<BR> +//Save PDF to file<BR> +$pdf->Output($file);<BR> +//JavaScript redirection<BR> +echo "<HTML><SCRIPT>document.location='getpdf.php?f=$file';</SCRIPT></HTML>"; +</TT> +</TD></TR></TABLE><BR> +Then create the getpdf.php file with this: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +<?php<BR> +$f=$HTTP_GET_VARS['f'];<BR> +//Check file (don't skip it!)<BR> +if(substr($f,0,3)!='tmp' or strpos($f,'/') or strpos($f,'\\'))<BR> + die('Incorrect file name');<BR> +if(!file_exists($f))<BR> + die('File does not exist');<BR> +//Handle special IE request if needed<BR> +if($HTTP_SERVER_VARS['HTTP_USER_AGENT']=='contype')<BR> +{<BR> + Header('Content-Type: application/pdf');<BR> + exit;<BR> +}<BR> +//Output PDF<BR> +Header('Content-Type: application/pdf');<BR> +Header('Content-Length: '.filesize($f));<BR> +readfile($f);<BR> +//Remove file<BR> +unlink($f);<BR> +exit;<BR> +?> +</TT> +</TD></TR></TABLE><BR> +This method works in most cases but IE6 can still experience trouble. The "ultimate" method +consists in redirecting directly to the temporary file. The file name must therefore end with .pdf: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +//Determine a temporary file name in the current directory<BR> +$file=basename(tempnam(getcwd(),'tmp'));<BR> +rename($file,$file.'.pdf');<BR> +$file.='.pdf';<BR> +//Save PDF to file<BR> +$pdf->Output($file);<BR> +//JavaScript redirection<BR> +echo "<HTML><SCRIPT>document.location='$file';</SCRIPT></HTML>"; +</TT> +</TD></TR></TABLE><BR> +This method turns the dynamic PDF into a static one and avoids all troubles. But you have to do +some cleaning in order to delete the temporary files. For instance: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +function CleanFiles($dir)<BR> +{<BR> + //Delete temporary files<BR> + $t=time();<BR> + $h=opendir($dir);<BR> + while($file=readdir($h))<BR> + {<BR> + if(substr($file,0,3)=='tmp' and substr($file,-4)=='.pdf')<BR> + {<BR> + $path=$dir.'/'.$file;<BR> + if($t-filemtime($path)>3600)<BR> + @unlink($path);<BR> + }<BR> + }<BR> + closedir($h);<BR> +} +</TT> +</TD></TR></TABLE><BR> +This function deletes all files of the form tmp*.pdf older than an hour in the specified +directory. You may call it where you want, for instance in the script which generates the PDF. +<BR> +<BR> +Remark: it is necessary to open the PDF in a new window, as you can't go backwards due to the +redirection. +<P><A NAME='4'><B>4.</B></A> <SPAN CLASS='st'>I send parameters using the POST method and the values don't appear in the PDF.</SPAN></P> +It's a problem affecting some versions of IE (especially the first 5.5). See the previous +question for the ways to work around it. +<P><A NAME='5'><B>5.</B></A> <SPAN CLASS='st'>When I use a PHP session, IE doesn't display my PDF any more but asks me to download it.</SPAN></P> +It's a problem affecting some versions of IE. To work around it, add the following line before +session_start(): +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +session_cache_limiter('private'); +</TT> +</TD></TR></TABLE><BR> +or do a redirection as explained in question 3. +<P><A NAME='6'><B>6.</B></A> <SPAN CLASS='st'>When I'm on SSL, IE can't open the PDF.</SPAN></P> +The problem may be fixed by adding this line:<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +Header('Pragma: public'); +</TT> +</TD></TR></TABLE><BR> + +<P><A NAME='7'><B>7.</B></A> <SPAN CLASS='st'>When I execute a script I get the message "FPDF error: Don't alter the locale before including class file".</SPAN></P> +When the decimal separator is configured as a comma before including a file, there is a +<A HREF="http://bugs.php.net/bug.php?id=17105" TARGET="_blank">bug</A> in some PHP versions and decimal +numbers get truncated. Therefore you shouldn't make a call to setlocale() before including the class. +On Unix, you shouldn't set the LC_ALL environment variable neither, for it is equivalent to a +setlocale() call. +<P><A NAME='8'><B>8.</B></A> <SPAN CLASS='st'>I try to put a PNG and Acrobat says "There was an error processing a page. A drawing error occurred".</SPAN></P> +Acrobat 5 has a bug and is unable to display transparent monochrome images (i.e. with 1 bit per +pixel). Remove transparency or save your image in 16 colors (4 bits per pixel) or more. +<P><A NAME='9'><B>9.</B></A> <SPAN CLASS='st'>I encounter the following error when I try to generate a PDF: Warning: Cannot add header information - headers already sent by (output started at script.php:X)</SPAN></P> +You must send nothing to the browser except the PDF itself: no HTML, no space, no carriage return, +neither before nor after. The script outputs something at line X. +<P><A NAME='10'><B>10.</B></A> <SPAN CLASS='st'>I try to display a variable in the Header method but nothing prints.</SPAN></P> +You have to use the <TT>global</TT> keyword, for instance: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +function Header()<BR> +{<BR> + global $title;<BR> +<BR> + $this->SetFont('Arial','B',15);<BR> + $this->Cell(0,10,$title,1,1,'C');<BR> +} +</TT> +</TD></TR></TABLE><BR> + +<P><A NAME='11'><B>11.</B></A> <SPAN CLASS='st'>I defined the Header and Footer methods in my PDF class but nothing appears.</SPAN></P> +You have to create an object from the PDF class, not FPDF:<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +$pdf=new PDF(); +</TT> +</TD></TR></TABLE><BR> + +<P><A NAME='12'><B>12.</B></A> <SPAN CLASS='st'>I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.</SPAN></P> +You have to enclose your string with double quotes, not single ones. +<P><A NAME='13'><B>13.</B></A> <SPAN CLASS='st'>I try to put the euro symbol but it doesn't work.</SPAN></P> +The standard fonts have the euro character at position 128. You can define a constant like this +for convenience: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +define('EURO',chr(128)); +</TT> +</TD></TR></TABLE><BR> +Note: Acrobat 4 or higher is required to display euro. +<P><A NAME='14'><B>14.</B></A> <SPAN CLASS='st'>I draw a frame with very precise dimensions, but when printed I notice some differences.</SPAN></P> +To respect dimensions, you have to uncheck the option "Fit to page" in the print dialog box. +<P><A NAME='15'><B>15.</B></A> <SPAN CLASS='st'>I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?</SPAN></P> +All printers have physical margins (different depending on the model), it is therefore impossible +to remove them and print on the totality of the paper. +<P><A NAME='16'><B>16.</B></A> <SPAN CLASS='st'>What's the limit of the file sizes I can generate with FPDF?</SPAN></P> +There is no particular limit. There are some constraints however: +<BR> +<BR> +- The maximum memory size allocated to PHP scripts defaults to 8MB. For very big documents, +especially with images, this limit may be reached (the file being built into memory). The +parameter is configured in the php.ini file. +<BR> +<BR> +- The maximum execution time allocated defaults to 30 seconds. This limit can of course be easily +reached. It is configured in php.ini and may be altered dynamically with set_time_limit(). +<BR> +<BR> +- Browsers generally have a 5 minute time-out. If you send the PDF directly to the browser and +reach the limit, it will be lost. It is therefore advised for very big documents to +generate them in a file, and to send some data to the browser from time to time (for instance +page 1, page 2... with flush() to force the output). When the document is finished, you can send +a redirection on it with JavaScript or create a link. +<BR> +Remark: even when the browser goes in time-out, the script may continue to run on the server. +<P><A NAME='17'><B>17.</B></A> <SPAN CLASS='st'>Can I modify a PDF with FPDF?</SPAN></P> +You can import an existing PDF document thanks to the FPDI extension:<BR> +<BR> +<A HREF="http://fpdi.setasign.de" TARGET="_blank">http://fpdi.setasign.de</A> +<P><A NAME='18'><B>18.</B></A> <SPAN CLASS='st'>I'd like to make a search engine in PHP and index PDF files. Can I do it with FPDF?</SPAN></P> +No. But a GPL C utility does exist, pdftotext, which is able to extract the textual content from +a PDF. It is provided with the Xpdf package:<BR> +<BR> +<A HREF="http://www.foolabs.com/xpdf/" TARGET="_blank">http://www.foolabs.com/xpdf/</A> +<P><A NAME='19'><B>19.</B></A> <SPAN CLASS='st'>Can I convert an HTML page to PDF with FPDF?</SPAN></P> +Not real-world pages. But a GPL C utility does exist, htmldoc, which allows to do it and gives good results:<BR> +<BR> +<A HREF="http://www.htmldoc.org" TARGET="_blank">http://www.htmldoc.org</A> +<P><A NAME='20'><B>20.</B></A> <SPAN CLASS='st'>Can I concatenate PDF files with FPDF?</SPAN></P> +No. But some free tools exist to perform this task:<BR> +<BR> +<A HREF="http://thierry.schmit.free.fr/dev/mbtPdfAsm/enMbtPdfAsm2.html" TARGET="_blank">http://thierry.schmit.free.fr/dev/mbtPdfAsm/enMbtPdfAsm2.html</A><BR> +<A HREF="http://www.accesspdf.com/pdftk/">http://www.accesspdf.com/pdftk/</A> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/LICENSE b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/NOTICE b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..29ec9335e10798695dc390e0d1af6769557fd61f --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/NOTICE @@ -0,0 +1,9 @@ + + This software contains code derived from an article in the magazine + php|architect by Marco Tabini. + + This software contains code derived from Oliver Plathey - The author of + FPDF. FPDF is available from: http://www.fpdf.org + + The LZW- and the ASCII85-Decoder are adapted from the iText-Library + http://www.lowagie.com/iText/ \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/changelog.txt b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/changelog.txt new file mode 100644 index 0000000000000000000000000000000000000000..a96ab2f1a44c4dc5c7fe6d086afa4ab5fefee949 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/changelog.txt @@ -0,0 +1,39 @@ +Changelog for FPDI: + +v1.1 (2005-04-06, 2005-05-06): + - added some things to free memory when objects are not longer used. + - made FPDI 1.1 compatible with FPDF 1.53 + - fixed method getPageBox() in fpdi_pdf_parser.php, which did not work + correct, when the box is an object reference. + +v1.1beta (2004-11-12): + - splitted pdf_parser in 2 classes + - Fixed major bugs for PHP Version < 4.3 + - Correct fpdi_pdf_parser::hex2String to handle big/little endian hexstrings + - Fixed pdf_parser::pdf_read_value: + - In very few situations it rans into an infinite loop. + - string-matching with escaped parenthesis is fixed + - hex-matching fixed + - included stream-matching and improved speed due using the length value + of the stream-dictionary. (pdf_context::read_stream() is removed) + - Fixes, changes in fpdi-class: + - Added own _out()-Method to disable linebreaks after _out-call + - Added "var $obj_stack;" to class + - Added LZW-Decoder + - Added ASCII85-Decoder + - renamed fpdi_functions to wrapper_functions.php + - Added methods for closing opened PDF-Documents (fclose) + +v1.02beta (2004-08-24): + - back to the roots... make FPDI usable with older php versions up 4.1+ ;-) + I used some function wrappers to do this - comments are welcome. + - fixed bug in parser, if it reaches a tab-character. + - include error handling if zlib is not supported. + - fixed a bug in pdf_parser::getPageContent() if content reference is an + array + +v1.01 (2004-08-10): + - fixed regex in php_parser::find_xref_table to handle files with + whitespaces before xref position. + - fixed php_parser::rebuildContentStream to run without notice + if error_reporting is set to all and no Filter is given. diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/ASCII85Decode.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/ASCII85Decode.php new file mode 100644 index 0000000000000000000000000000000000000000..320dba2640f56fddd359b32d7ac619d8f35ca960 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/ASCII85Decode.php @@ -0,0 +1,95 @@ +<?php +// +// FPDI - Version 1.2.1 +// +// Copyright 2004-2008 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +if (!defined("ORD_z")) + define("ORD_z",ord('z')); +if (!defined("ORD_exclmark")) + define("ORD_exclmark", ord('!')); +if (!defined("ORD_u")) + define("ORD_u", ord("u")); +if (!defined("ORD_tilde")) + define("ORD_tilde", ord('~')); + +class ASCII85Decode { + + function ASCII85Decode(&$fpdi) { + $this->fpdi =& $fpdi; + } + + + function decode($in) { + $out = ""; + $state = 0; + $chn = null; + + $l = strlen($in); + + for ($k = 0; $k < $l; ++$k) { + $ch = ord($in[$k]) & 0xff; + + if ($ch == ORD_tilde) { + break; + } + if (preg_match("/^\s$/",chr($ch))) { + continue; + } + if ($ch == ORD_z && $state == 0) { + $out .= chr(0).chr(0).chr(0).chr(0); + continue; + } + if ($ch < ORD_exclmark || $ch > ORD_u) { + $this->fpdi->error("Illegal character in ASCII85Decode."); + } + + $chn[$state++] = $ch - ORD_exclmark; + + if ($state == 5) { + $state = 0; + $r = 0; + for ($j = 0; $j < 5; ++$j) + $r = $r * 85 + $chn[$j]; + $out .= chr($r >> 24); + $out .= chr($r >> 16); + $out .= chr($r >> 8); + $out .= chr($r); + } + } + $r = 0; + + if ($state == 1) + $this->fpdi->error("Illegal length in ASCII85Decode."); + if ($state == 2) { + $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85; + $out .= chr($r >> 24); + } + else if ($state == 3) { + $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85; + $out .= chr($r >> 24); + $out .= chr($r >> 16); + } + else if ($state == 4) { + $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ; + $out .= chr($r >> 24); + $out .= chr($r >> 16); + $out .= chr($r >> 8); + } + + return $out; + } +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/LZWDecode.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/LZWDecode.php new file mode 100644 index 0000000000000000000000000000000000000000..4f8c82c67af3ec9268e70caf11ce0b07b5d57e4b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/LZWDecode.php @@ -0,0 +1,147 @@ +<?php +// +// FPDI - Version 1.2.1 +// +// Copyright 2004-2008 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +class LZWDecode { + + var $sTable = array(); + var $data = null; + var $tIdx; + var $bitsToGet = 9; + var $bytePointer; + var $bitPointer; + var $nextData = 0; + var $nextBits = 0; + var $andTable = array(511, 1023, 2047, 4095); + + function LZWDecode(&$fpdi) { + $this->fpdi =& $fpdi; + } + + /** + * Method to decode LZW compressed data. + * + * @param string data The compressed data. + */ + function decode($data) { + + if($data[0] == 0x00 && $data[1] == 0x01) { + $this->fpdi->error("LZW flavour not supported."); + } + + $this->initsTable(); + + $this->data = $data; + + // Initialize pointers + $this->bytePointer = 0; + $this->bitPointer = 0; + + $this->nextData = 0; + $this->nextBits = 0; + + $oldCode = 0; + + $string = ""; + $uncompData = ""; + + while (($code = $this->getNextCode()) != 257) { + if ($code == 256) { + $this->initsTable(); + $code = $this->getNextCode(); + + if ($code == 257) { + break; + } + + $uncompData .= $this->sTable[$code]; + $oldCode = $code; + + } else { + + if ($code < $this->tIdx) { + $string = $this->sTable[$code]; + $uncompData .= $string; + + $this->addStringToTable($this->sTable[$oldCode], $string[0]); + $oldCode = $code; + } else { + $string = $this->sTable[$oldCode]; + $string = $string.$string[0]; + $uncompData .= $string; + + $this->addStringToTable($string); + $oldCode = $code; + } + } + } + + return $uncompData; + } + + + /** + * Initialize the string table. + */ + function initsTable() { + $this->sTable = array(); + + for ($i = 0; $i < 256; $i++) + $this->sTable[$i] = chr($i); + + $this->tIdx = 258; + $this->bitsToGet = 9; + } + + /** + * Add a new string to the string table. + */ + function addStringToTable ($oldString, $newString="") { + $string = $oldString.$newString; + + // Add this new String to the table + $this->sTable[$this->tIdx++] = $string; + + if ($this->tIdx == 511) { + $this->bitsToGet = 10; + } else if ($this->tIdx == 1023) { + $this->bitsToGet = 11; + } else if ($this->tIdx == 2047) { + $this->bitsToGet = 12; + } + } + + // Returns the next 9, 10, 11 or 12 bits + function getNextCode() { + if ($this->bytePointer == strlen($this->data)) + return 257; + + $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff); + $this->nextBits += 8; + + if ($this->nextBits < $this->bitsToGet) { + $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff); + $this->nextBits += 8; + } + + $code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet-9]; + $this->nextBits -= $this->bitsToGet; + + return $code; + } +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/ascii85.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/ascii85.php new file mode 100644 index 0000000000000000000000000000000000000000..7b440620770909ff8be5cf0dcd75c721edab3edf --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/ascii85.php @@ -0,0 +1,97 @@ +<?php +// +// FPDI - Version 1.1 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +if (!defined("ORD_z")) + define("ORD_z",ord('z')); +if (!defined("ORD_!")) + define("ORD_exclmark", ord('!')); +if (!defined("ORD_u")) + define("ORD_u", ord("u")); +if (!defined("ORD_tilde")) + define("ORD_tilde", ord('~')); + +class ASCII85Decode { + + function ASCII85Decode(&$fpdi) { + $this->fpdi =& $fpdi; + } + + + function decode($in) { + $out = ""; + $state = 0; + $chn = null; + + $l = strlen($in); + + for ($k = 0; $k < $l; ++$k) { + $ch = ord($in[$k]) & 0xff; + + if ($ch == ORD_tilde) { + break; + } + if (preg_match("/^\s$/",chr($ch))) { + continue; + } + if ($ch == ORD_z && $state == 0) { + $out .= chr(0).chr(0).chr(0).chr(0); + continue; + } + if ($ch < ORD_exclmark || $ch > ORD_u) { + $this->fpdi->error("Illegal character in ASCII85Decode."); + } + + $chn[$state++] = $ch - ORD_exclmark; + + if ($state == 5) { + $state = 0; + $r = 0; + for ($j = 0; $j < 5; ++$j) + $r = $r * 85 + $chn[$j]; + $out .= chr($r >> 24); + $out .= chr($r >> 16); + $out .= chr($r >> 8); + $out .= chr($r); + } + } + $r = 0; + + if ($state == 1) + $this->fpdi->error("Illegal length in ASCII85Decode."); + if ($state == 2) { + $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85; + $out .= chr($r >> 24); + } + else if ($state == 3) { + $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85; + $out .= chr($r >> 24); + $out .= chr($r >> 16); + } + else if ($state == 4) { + $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ; + $out .= chr($r >> 24); + $out .= chr($r >> 16); + $out .= chr($r >> 8); + } + + return $out; + } +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/lzw.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/lzw.php new file mode 100644 index 0000000000000000000000000000000000000000..bc9e71cd1367a8a78fd7885db5b719cbb3e01310 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/decoders/lzw.php @@ -0,0 +1,151 @@ +<?php +// +// FPDI - Version 1.1 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +class LZWDecode { + + var $sTable = array(); + var $data = null; + var $tIdx; + var $bitsToGet = 9; + var $bytePointer; + var $bitPointer; + var $nextData = 0; + var $nextBits = 0; + var $andTable = array(511, 1023, 2047, 4095); + + function LZWDecode(&$fpdi) { + $this->fpdi =& $fpdi; + } + + /** + * Method to decode LZW compressed data. + * + * @param string data The compressed data. + */ + function decode(&$data) { + + if($data[0] == 0x00 && $data[1] == 0x01) { + $this->fpdi->error("LZW flavour not supported."); + } + + $this->initsTable(); + + $this->data =& $data; + + // Initialize pointers + $this->bytePointer = 0; + $this->bitPointer = 0; + + $this->nextData = 0; + $this->nextBits = 0; + + $oldCode = 0; + + $string = ""; + $uncompData = ""; + + while (($code = $this->getNextCode()) != 257) { + if ($code == 256) { + $this->initsTable(); + $code = $this->getNextCode(); + + if ($code == 257) { + break; + } + + $uncompData .= $this->sTable[$code]; + $oldCode = $code; + + } else { + + if ($code < $this->tIdx) { + $string = $this->sTable[$code]; + $uncompData .= $string; + + $this->addStringToTable($this->sTable[$oldCode], $string[0]); + $oldCode = $code; + } else { + $string = $this->sTable[$oldCode]; + $string = $string.$string[0]; + $uncompData .= $string; + + $this->addStringToTable($string); + $oldCode = $code; + } + } + } + + return $uncompData; + } + + + /** + * Initialize the string table. + */ + function initsTable() { + $this->sTable = array(); + + for ($i = 0; $i < 256; $i++) + $this->sTable[$i] = chr($i); + + $this->tIdx = 258; + $this->bitsToGet = 9; + } + + /** + * Add a new string to the string table. + */ + function addStringToTable ($oldString, $newString="") { + $string = $oldString.$newString; + + // Add this new String to the table + $this->sTable[$this->tIdx++] = $string; + + if ($this->tIdx == 511) { + $this->bitsToGet = 10; + } else if ($this->tIdx == 1023) { + $this->bitsToGet = 11; + } else if ($this->tIdx == 2047) { + $this->bitsToGet = 12; + } + } + + // Returns the next 9, 10, 11 or 12 bits + function getNextCode() { + if ($this->bytePointer == strlen($this->data)) + return 257; + + $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff); + $this->nextBits += 8; + + if ($this->nextBits < $this->bitsToGet) { + $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff); + $this->nextBits += 8; + } + + $code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet-9]; + $this->nextBits -= $this->bitsToGet; + + return $code; + } +} + + + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/demo.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/demo.php new file mode 100644 index 0000000000000000000000000000000000000000..e5874fa9c776e653cfcd2f3ec401adbaab545ca3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/demo.php @@ -0,0 +1,19 @@ +<?php +error_reporting (E_ALL); + +define('FPDF_FONTPATH','font/'); +require('fpdi.php'); + +$pdf= new fpdi(); + +$pagecount = $pdf->setSourceFile("pdfdoc.pdf"); + +$tplidx = $pdf->ImportPage(1); + +$pdf->addPage(); +$pdf->useTemplate($tplidx,10,10,90); + +$pdf->Output("newpdf.pdf","F"); +$pdf->closeParsers(); + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/acceptpagebreak.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/acceptpagebreak.htm new file mode 100644 index 0000000000000000000000000000000000000000..5b54992ee8f38c5cf405be952e3122fe89ec0263 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/acceptpagebreak.htm @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>AcceptPageBreak</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>AcceptPageBreak</H2> +<TT><B>boolean</B> AcceptPageBreak()</TT> +<H4 CLASS='st'>Version</H4> +1.4 +<H4 CLASS='st'>Description</H4> +Whenever a page break condition is met, the method is called, and the break is issued or not +depending on the returned value. The default implementation returns a value according to the +mode selected by SetAutoPageBreak(). +<BR> +This method is called automatically and should not be called directly by the application. +<H4 CLASS='st'>Example</H4> +The method is overriden in an inherited class in order to obtain a 3 column layout: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +class PDF extends FPDF<BR> +{<BR> +var $col=0;<BR> +<BR> +function SetCol($col)<BR> +{<BR> + //Move position to a column<BR> + $this->col=$col;<BR> + $x=10+$col*65;<BR> + $this->SetLeftMargin($x);<BR> + $this->SetX($x);<BR> +}<BR> +<BR> +function AcceptPageBreak()<BR> +{<BR> + if($this->col<2)<BR> + {<BR> + //Go to next column<BR> + $this->SetCol($this->col+1);<BR> + $this->SetY(10);<BR> + return false;<BR> + }<BR> + else<BR> + {<BR> + //Go back to first column and issue page break<BR> + $this->SetCol(0);<BR> + return true;<BR> + }<BR> +}<BR> +}<BR> +<BR> +$pdf=new PDF();<BR> +$pdf->AddPage();<BR> +$pdf->SetFont('Arial','',12);<BR> +for($i=1;$i<=300;$i++)<BR> + $pdf->Cell(0,5,"Line $i",0,1);<BR> +$pdf->Output(); +</TT> +</TD></TR></TABLE><BR> +<H4 CLASS='st'>See also</H4> +<A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addfont.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addfont.htm new file mode 100644 index 0000000000000000000000000000000000000000..7b755400b1e91f40ef90b061518361d95761ae9e --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addfont.htm @@ -0,0 +1,61 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>AddFont</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>AddFont</H2> +<TT>AddFont(<B>string</B> family [, <B>string</B> style [, <B>string</B> file]])</TT> +<H4 CLASS='st'>Version</H4> +1.5 +<H4 CLASS='st'>Description</H4> +Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font +definition file first with the makefont.php utility. +<BR> +The definition file (and the font file itself when embedding) must be present in the font directory. +If it is not found, the error "Could not include font definition file" is generated. +<H4 CLASS='st'>Parameters</H4> +<TT><U>family</U></TT> +<BLOCKQUOTE> +Font family. The name can be chosen arbitrarily. If it is a standard family name, it will +override the corresponding font. +</BLOCKQUOTE> +<TT><U>style</U></TT> +<BLOCKQUOTE> +Font style. Possible values are (case insensitive): +<UL> +<LI>empty string: regular +<LI><TT>B</TT>: bold +<LI><TT>I</TT>: italic +<LI><TT>BI</TT> or <TT>IB</TT>: bold italic +</UL> +The default value is regular. +</BLOCKQUOTE> +<TT><U>file</U></TT> +<BLOCKQUOTE> +The font definition file. +<BR> +By default, the name is built from the family and style, in lower case with no space. +</BLOCKQUOTE> +<H4 CLASS='st'>Example</H4> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +$pdf->AddFont('Comic','I'); +</TT> +</TD></TR></TABLE><BR> +is equivalent to: +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +$pdf->AddFont('Comic','I','comici.php'); +</TT> +</TD></TR></TABLE><BR> +<H4 CLASS='st'>See also</H4> +<A HREF="setfont.htm">SetFont()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addlink.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addlink.htm new file mode 100644 index 0000000000000000000000000000000000000000..4d33e103dc7d1d4d1986475c2c038cd839b2fb5b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addlink.htm @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>AddLink</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>AddLink</H2> +<TT><B>int</B> AddLink()</TT> +<H4 CLASS='st'>Version</H4> +1.5 +<H4 CLASS='st'>Description</H4> +Creates a new internal link and returns its identifier. An internal link is a clickable area +which directs to another place within the document. +<BR> +The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is +defined with SetLink(). +<H4 CLASS='st'>See also</H4> +<A HREF="cell.htm">Cell()</A>, +<A HREF="write.htm">Write()</A>, +<A HREF="image.htm">Image()</A>, +<A HREF="link.htm">Link()</A>, +<A HREF="setlink.htm">SetLink()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addpage.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addpage.htm new file mode 100644 index 0000000000000000000000000000000000000000..6641420a3be41d1a343e714637b55c51fa6c7b8e --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/addpage.htm @@ -0,0 +1,42 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>AddPage</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>AddPage</H2> +<TT>AddPage([<B>string</B> orientation])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Adds a new page to the document. If a page is already present, the Footer() method is called +first to output the footer. Then the page is added, the current position set to the top-left +corner according to the left and top margins, and Header() is called to display the header. +<BR> +The font which was set before calling is automatically restored. There is no need to call +SetFont() again if you want to continue with the same font. The same is true for colors and +line width. +<BR> +The origin of the coordinate system is at the top-left corner and increasing ordinates go +downwards. +<H4 CLASS='st'>Parameters</H4> +<TT><U>orientation</U></TT> +<BLOCKQUOTE> +Page orientation. Possible values are (case insensitive): +<UL> +<LI><TT>P</TT> or <TT>Portrait</TT> +<LI><TT>L</TT> or <TT>Landscape</TT> +</UL> +The default value is the one passed to the constructor. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="fpdf.htm">FPDF()</A>, +<A HREF="header.htm">Header()</A>, +<A HREF="footer.htm">Footer()</A>, +<A HREF="setmargins.htm">SetMargins()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/aliasnbpages.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/aliasnbpages.htm new file mode 100644 index 0000000000000000000000000000000000000000..629a1667852183f3d47913ce7e6171de04757c61 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/aliasnbpages.htm @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>AliasNbPages</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>AliasNbPages</H2> +<TT>AliasNbPages([<B>string</B> alias])</TT> +<H4 CLASS='st'>Version</H4> +1.4 +<H4 CLASS='st'>Description</H4> +Defines an alias for the total number of pages. It will be substituted as the document is +closed. +<H4 CLASS='st'>Parameters</H4> +<TT><U>alias</U></TT> +<BLOCKQUOTE> +The alias. Default value: <TT>{nb}</TT>. +</BLOCKQUOTE> +<H4 CLASS='st'>Example</H4> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +class PDF extends FPDF<BR> +{<BR> +function Footer()<BR> +{<BR> + //Go to 1.5 cm from bottom<BR> + $this->SetY(-15);<BR> + //Select Arial italic 8<BR> + $this->SetFont('Arial','I',8);<BR> + //Print current and total page numbers<BR> + $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');<BR> +}<BR> +}<BR> +<BR> +$pdf=new PDF();<BR> +$pdf->AliasNbPages(); +</TT> +</TD></TR></TABLE><BR> +<H4 CLASS='st'>See also</H4> +<A HREF="pageno.htm">PageNo()</A>, +<A HREF="footer.htm">Footer()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/cell.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/cell.htm new file mode 100644 index 0000000000000000000000000000000000000000..6becd68d5e644c21a4e8d2ad5e204e2878598b4d --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/cell.htm @@ -0,0 +1,106 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Cell</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Cell</H2> +<TT>Cell(<B>float</B> w [, <B>float</B> h [, <B>string</B> txt [, <B>mixed</B> border [, <B>int</B> ln [, <B>string</B> align [, <B>int</B> fill [, <B>mixed</B> link]]]]]]])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Prints a cell (rectangular area) with optional borders, background color and character string. +The upper-left corner of the cell corresponds to the current position. The text can be aligned +or centered. After the call, the current position moves to the right or to the next line. It is +possible to put a link on the text. +<BR> +If automatic page breaking is enabled and the cell goes beyond the limit, a page break is +done before outputting. +<H4 CLASS='st'>Parameters</H4> +<TT><U>w</U></TT> +<BLOCKQUOTE> +Cell width. If <TT>0</TT>, the cell extends up to the right margin. +</BLOCKQUOTE> +<TT><U>h</U></TT> +<BLOCKQUOTE> +Cell height. +Default value: <TT>0</TT>. +</BLOCKQUOTE> +<TT><U>txt</U></TT> +<BLOCKQUOTE> +String to print. +Default value: empty string. +</BLOCKQUOTE> +<TT><U>border</U></TT> +<BLOCKQUOTE> +Indicates if borders must be drawn around the cell. The value can be either a number: +<UL> +<LI><TT>0</TT>: no border +<LI><TT>1</TT>: frame +</UL> +or a string containing some or all of the following characters (in any order): +<UL> +<LI><TT>L</TT>: left +<LI><TT>T</TT>: top +<LI><TT>R</TT>: right +<LI><TT>B</TT>: bottom +</UL> +Default value: <TT>0</TT>. +</BLOCKQUOTE> +<TT><U>ln</U></TT> +<BLOCKQUOTE> +Indicates where the current position should go after the call. Possible values are: +<UL> +<LI><TT>0</TT>: to the right +<LI><TT>1</TT>: to the beginning of the next line +<LI><TT>2</TT>: below +</UL> +Putting <TT>1</TT> is equivalent to putting <TT>0</TT> and calling Ln() just after. +Default value: <TT>0</TT>. +</BLOCKQUOTE> +<TT><U>align</U></TT> +<BLOCKQUOTE> +Allows to center or align the text. Possible values are: +<UL> +<LI><TT>L</TT> or empty string: left align (default value) +<LI><TT>C</TT>: center +<LI><TT>R</TT>: right align +</UL> +</BLOCKQUOTE> +<TT><U>fill</U></TT> +<BLOCKQUOTE> +Indicates if the cell background must be painted (<TT>1</TT>) or transparent (<TT>0</TT>). +Default value: <TT>0</TT>. +</BLOCKQUOTE> +<TT><U>link</U></TT> +<BLOCKQUOTE> +URL or identifier returned by AddLink(). +</BLOCKQUOTE> +<H4 CLASS='st'>Example</H4> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +//Set font<BR> +$pdf->SetFont('Arial','B',16);<BR> +//Move to 8 cm to the right<BR> +$pdf->Cell(80);<BR> +//Centered text in a framed 20*10 mm cell and line break<BR> +$pdf->Cell(20,10,'Title',1,1,'C'); +</TT> +</TD></TR></TABLE><BR> +<H4 CLASS='st'>See also</H4> +<A HREF="setfont.htm">SetFont()</A>, +<A HREF="setdrawcolor.htm">SetDrawColor()</A>, +<A HREF="setfillcolor.htm">SetFillColor()</A>, +<A HREF="settextcolor.htm">SetTextColor()</A>, +<A HREF="setlinewidth.htm">SetLineWidth()</A>, +<A HREF="addlink.htm">AddLink()</A>, +<A HREF="ln.htm">Ln()</A>, +<A HREF="multicell.htm">MultiCell()</A>, +<A HREF="write.htm">Write()</A>, +<A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/close.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/close.htm new file mode 100644 index 0000000000000000000000000000000000000000..0009de86faec8b244dd4f04cb13b0090b74da787 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/close.htm @@ -0,0 +1,23 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Close</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Close</H2> +<TT>Close()</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Terminates the PDF document. It is not necessary to call this method explicitly because Output() +does it automatically. +<BR> +If the document contains no page, AddPage() is called to prevent from getting an invalid document. +<H4 CLASS='st'>See also</H4> +<A HREF="output.htm">Output()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/error.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/error.htm new file mode 100644 index 0000000000000000000000000000000000000000..e45c439cc843df6d4b9c7906e4703765856f6070 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/error.htm @@ -0,0 +1,25 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Error</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Error</H2> +<TT>Error(<B>string</B> msg)</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +This method is automatically called in case of fatal error; it simply outputs the message +and halts the execution. An inherited class may override it to customize the error handling +but should always halt the script, or the resulting document would probably be invalid. +<H4 CLASS='st'>Parameters</H4> +<TT><U>msg</U></TT> +<BLOCKQUOTE> +The error message. +</BLOCKQUOTE> +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/footer.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/footer.htm new file mode 100644 index 0000000000000000000000000000000000000000..6928333013c94cb51fb704650ae9766c24822d42 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/footer.htm @@ -0,0 +1,39 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Footer</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Footer</H2> +<TT>Footer()</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +This method is used to render the page footer. It is automatically called by AddPage() and +Close() and should not be called directly by the application. The implementation in FPDF is +empty, so you have to subclass it and override the method if you want a specific processing. +<H4 CLASS='st'>Example</H4> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +class PDF extends FPDF<BR> +{<BR> +function Footer()<BR> +{<BR> + //Go to 1.5 cm from bottom<BR> + $this->SetY(-15);<BR> + //Select Arial italic 8<BR> + $this->SetFont('Arial','I',8);<BR> + //Print centered page number<BR> + $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');<BR> +}<BR> +} +</TT> +</TD></TR></TABLE><BR> +<H4 CLASS='st'>See also</H4> +<A HREF="header.htm">Header()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/fpdf.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/fpdf.htm new file mode 100644 index 0000000000000000000000000000000000000000..14f5bb4ef921cfc0d54e15a540e1704c5ec1eacd --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/fpdf.htm @@ -0,0 +1,57 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>FPDF</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>FPDF</H2> +<TT>FPDF([<B>string</B> orientation [, <B>string</B> unit [, <B>mixed</B> format]]])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +This is the class constructor. It allows to set up the page format, the orientation and the +measure unit used in all the methods (except for the font sizes). +<H4 CLASS='st'>Parameters</H4> +<TT><U>orientation</U></TT> +<BLOCKQUOTE> +Default page orientation. Possible values are (case insensitive): +<UL> +<LI><TT>P</TT> or <TT>Portrait</TT> +<LI><TT>L</TT> or <TT>Landscape</TT> +</UL> +Default value is <TT>P</TT>. +</BLOCKQUOTE> +<TT><U>unit</U></TT> +<BLOCKQUOTE> +User measure unit. Possible values are: +<UL> +<LI><TT>pt</TT>: point +<LI><TT>mm</TT>: millimeter +<LI><TT>cm</TT>: centimeter +<LI><TT>in</TT>: inch +</UL> +A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This +is a very common unit in typography; font sizes are expressed in that unit. +<BR> +<BR> +Default value is <TT>mm</TT>. +</BLOCKQUOTE> +<TT><U>format</U></TT> +<BLOCKQUOTE> +The format used for pages. It can be either one of the following values (case insensitive): +<UL> +<LI><TT>A3</TT> +<LI><TT>A4</TT> +<LI><TT>A5</TT> +<LI><TT>Letter</TT> +<LI><TT>Legal</TT> +</UL> +or a custom format in the form of a two-element array containing the width and the height +(expressed in the unit given by <TT>unit</TT>). +</BLOCKQUOTE> +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/getstringwidth.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/getstringwidth.htm new file mode 100644 index 0000000000000000000000000000000000000000..ece22623d76661ba7d493e9f3083f0016f8e8724 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/getstringwidth.htm @@ -0,0 +1,23 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>GetStringWidth</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>GetStringWidth</H2> +<TT><B>float</B> GetStringWidth(<B>string</B> s)</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Returns the length of a string in user unit. A font must be selected. +<H4 CLASS='st'>Parameters</H4> +<TT><U>s</U></TT> +<BLOCKQUOTE> +The string whose length is to be computed. +</BLOCKQUOTE> +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/getx.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/getx.htm new file mode 100644 index 0000000000000000000000000000000000000000..9fa13eff21382a6c38fccb1b2aaa9f86155cf3e1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/getx.htm @@ -0,0 +1,22 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>GetX</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>GetX</H2> +<TT><B>float</B> GetX()</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Returns the abscissa of the current position. +<H4 CLASS='st'>See also</H4> +<A HREF="setx.htm">SetX()</A>, +<A HREF="gety.htm">GetY()</A>, +<A HREF="sety.htm">SetY()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/gety.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/gety.htm new file mode 100644 index 0000000000000000000000000000000000000000..fd689d4f372c94923c4b30ad701b64d6715f56e9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/gety.htm @@ -0,0 +1,22 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>GetY</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>GetY</H2> +<TT><B>float</B> GetY()</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Returns the ordinate of the current position. +<H4 CLASS='st'>See also</H4> +<A HREF="sety.htm">SetY()</A>, +<A HREF="getx.htm">GetX()</A>, +<A HREF="setx.htm">SetX()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/header.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/header.htm new file mode 100644 index 0000000000000000000000000000000000000000..c6b937629106a76f4917a7074d17aef85247b1a2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/header.htm @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Header</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Header</H2> +<TT>Header()</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +This method is used to render the page header. It is automatically called by AddPage() and +should not be called directly by the application. The implementation in FPDF is empty, so +you have to subclass it and override the method if you want a specific processing. +<H4 CLASS='st'>Example</H4> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +class PDF extends FPDF<BR> +{<BR> +function Header()<BR> +{<BR> + //Select Arial bold 15<BR> + $this->SetFont('Arial','B',15);<BR> + //Move to the right<BR> + $this->Cell(80);<BR> + //Framed title<BR> + $this->Cell(30,10,'Title',1,0,'C');<BR> + //Line break<BR> + $this->Ln(20);<BR> +}<BR> +} +</TT> +</TD></TR></TABLE><BR> +<H4 CLASS='st'>See also</H4> +<A HREF="footer.htm">Footer()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/image.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/image.htm new file mode 100644 index 0000000000000000000000000000000000000000..7aa5e97b98a5cffd923f5b395c00414c6995537f --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/image.htm @@ -0,0 +1,88 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Image</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Image</H2> +<TT>Image(<B>string</B> file, <B>float</B> x, <B>float</B> y [, <B>float</B> w [, <B>float</B> h [, <B>string</B> type [, <B>mixed</B> link]]]])</TT> +<H4 CLASS='st'>Version</H4> +1.1 +<H4 CLASS='st'>Description</H4> +Puts an image in the page. The upper-left corner must be given. The dimensions can be specified +in different ways: +<UL> +<LI>explicit width and height (expressed in user unit) +<LI>one explicit dimension, the other being calculated automatically in order to keep the original +proportions +<LI>no explicit dimension, in which case the image is put at 72 dpi +</UL> +Supported formats are JPEG and PNG. +<BR> +<BR> +For JPEG, all flavors are allowed: +<UL> +<LI>gray scales +<LI>true colors (24 bits) +<LI>CMYK (32 bits) +</UL> +For PNG, are allowed: +<UL> +<LI>gray scales on at most 8 bits (256 levels) +<LI>indexed colors +<LI>true colors (24 bits) +</UL> +but are not supported: +<UL> +<LI>Interlacing +<LI>Alpha channel +</UL> +If a transparent color is defined, it will be taken into account (but will be only interpreted +by Acrobat 4 and above). +<BR> +The format can be specified explicitly or inferred from the file extension. +<BR> +It is possible to put a link on the image. +<BR> +<BR> +Remark: if an image is used several times, only one copy will be embedded in the file. +<H4 CLASS='st'>Parameters</H4> +<TT><U>file</U></TT> +<BLOCKQUOTE> +Name of the file containing the image. +</BLOCKQUOTE> +<TT><U>x</U></TT> +<BLOCKQUOTE> +Abscissa of the upper-left corner. +</BLOCKQUOTE> +<TT><U>y</U></TT> +<BLOCKQUOTE> +Ordinate of the upper-left corner. +</BLOCKQUOTE> +<TT><U>w</U></TT> +<BLOCKQUOTE> +Width of the image in the page. If not specified or equal to zero, it is automatically +calculated. +</BLOCKQUOTE> +<TT><U>h</U></TT> +<BLOCKQUOTE> +Height of the image in the page. If not specified or equal to zero, it is automatically +calculated. +</BLOCKQUOTE> +<TT><U>type</U></TT> +<BLOCKQUOTE> +Image format. Possible values are (case insensitive): <TT>JPG</TT>, <TT>JPEG</TT>, <TT>PNG</TT>. +If not specified, the type is inferred from the file extension. +</BLOCKQUOTE> +<TT><U>link</U></TT> +<BLOCKQUOTE> +URL or identifier returned by AddLink(). +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="addlink.htm">AddLink()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/index.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/index.htm new file mode 100644 index 0000000000000000000000000000000000000000..fed127b9f32083ba066eaa89ab2ddb4c657dd607 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/index.htm @@ -0,0 +1,57 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>FPDF 1.53 Reference Manual</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>FPDF 1.53 Reference Manual</H2> +<A HREF="acceptpagebreak.htm">AcceptPageBreak</A> - accept or not automatic page break<BR> +<A HREF="addfont.htm">AddFont</A> - add a new font<BR> +<A HREF="addlink.htm">AddLink</A> - create an internal link<BR> +<A HREF="addpage.htm">AddPage</A> - add a new page<BR> +<A HREF="aliasnbpages.htm">AliasNbPages</A> - define an alias for number of pages<BR> +<A HREF="cell.htm">Cell</A> - print a cell<BR> +<A HREF="close.htm">Close</A> - terminate the document<BR> +<A HREF="error.htm">Error</A> - fatal error<BR> +<A HREF="footer.htm">Footer</A> - page footer<BR> +<A HREF="fpdf.htm">FPDF</A> - constructor<BR> +<A HREF="getstringwidth.htm">GetStringWidth</A> - compute string length<BR> +<A HREF="getx.htm">GetX</A> - get current x position<BR> +<A HREF="gety.htm">GetY</A> - get current y position<BR> +<A HREF="header.htm">Header</A> - page header<BR> +<A HREF="image.htm">Image</A> - output an image<BR> +<A HREF="line.htm">Line</A> - draw a line<BR> +<A HREF="link.htm">Link</A> - put a link<BR> +<A HREF="ln.htm">Ln</A> - line break<BR> +<A HREF="multicell.htm">MultiCell</A> - print text with line breaks<BR> +<A HREF="output.htm">Output</A> - save or send the document<BR> +<A HREF="pageno.htm">PageNo</A> - page number<BR> +<A HREF="rect.htm">Rect</A> - draw a rectangle<BR> +<A HREF="setauthor.htm">SetAuthor</A> - set the document author<BR> +<A HREF="setautopagebreak.htm">SetAutoPageBreak</A> - set the automatic page breaking mode<BR> +<A HREF="setcompression.htm">SetCompression</A> - turn compression on or off<BR> +<A HREF="setcreator.htm">SetCreator</A> - set document creator<BR> +<A HREF="setdisplaymode.htm">SetDisplayMode</A> - set display mode<BR> +<A HREF="setdrawcolor.htm">SetDrawColor</A> - set drawing color<BR> +<A HREF="setfillcolor.htm">SetFillColor</A> - set filling color<BR> +<A HREF="setfont.htm">SetFont</A> - set font<BR> +<A HREF="setfontsize.htm">SetFontSize</A> - set font size<BR> +<A HREF="setkeywords.htm">SetKeywords</A> - associate keywords with document<BR> +<A HREF="setleftmargin.htm">SetLeftMargin</A> - set left margin<BR> +<A HREF="setlinewidth.htm">SetLineWidth</A> - set line width<BR> +<A HREF="setlink.htm">SetLink</A> - set internal link destination<BR> +<A HREF="setmargins.htm">SetMargins</A> - set margins<BR> +<A HREF="setrightmargin.htm">SetRightMargin</A> - set right margin<BR> +<A HREF="setsubject.htm">SetSubject</A> - set document subject<BR> +<A HREF="settextcolor.htm">SetTextColor</A> - set text color<BR> +<A HREF="settitle.htm">SetTitle</A> - set document title<BR> +<A HREF="settopmargin.htm">SetTopMargin</A> - set top margin<BR> +<A HREF="setx.htm">SetX</A> - set current x position<BR> +<A HREF="setxy.htm">SetXY</A> - set current x and y positions<BR> +<A HREF="sety.htm">SetY</A> - set current y position<BR> +<A HREF="text.htm">Text</A> - print a string<BR> +<A HREF="write.htm">Write</A> - print flowing text<BR> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/line.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/line.htm new file mode 100644 index 0000000000000000000000000000000000000000..d28cdc35e309994be8390a0d5fdf4faa6ef5e550 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/line.htm @@ -0,0 +1,38 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Line</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Line</H2> +<TT>Line(<B>float</B> x1, <B>float</B> y1, <B>float</B> x2, <B>float</B> y2)</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Draws a line between two points. +<H4 CLASS='st'>Parameters</H4> +<TT><U>x1</U></TT> +<BLOCKQUOTE> +Abscissa of first point. +</BLOCKQUOTE> +<TT><U>y1</U></TT> +<BLOCKQUOTE> +Ordinate of first point. +</BLOCKQUOTE> +<TT><U>x2</U></TT> +<BLOCKQUOTE> +Abscissa of second point. +</BLOCKQUOTE> +<TT><U>y2</U></TT> +<BLOCKQUOTE> +Ordinate of second point. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setlinewidth.htm">SetLineWidth()</A>, +<A HREF="setdrawcolor.htm">SetDrawColor()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/link.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/link.htm new file mode 100644 index 0000000000000000000000000000000000000000..55acb39af027240a24219394a759ebf6a65764b5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/link.htm @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Link</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Link</H2> +<TT>Link(<B>float</B> x, <B>float</B> y, <B>float</B> w, <B>float</B> h, <B>mixed</B> link)</TT> +<H4 CLASS='st'>Version</H4> +1.5 +<H4 CLASS='st'>Description</H4> +Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(), +Write() or Image(), but this method can be useful for instance to define a clickable area inside +an image. +<H4 CLASS='st'>Parameters</H4> +<TT><U>x</U></TT> +<BLOCKQUOTE> +Abscissa of the upper-left corner of the rectangle. +</BLOCKQUOTE> +<TT><U>y</U></TT> +<BLOCKQUOTE> +Ordinate of the upper-left corner of the rectangle. +</BLOCKQUOTE> +<TT><U>w</U></TT> +<BLOCKQUOTE> +Width of the rectangle. +</BLOCKQUOTE> +<TT><U>h</U></TT> +<BLOCKQUOTE> +Height of the rectangle. +</BLOCKQUOTE> +<TT><U>link</U></TT> +<BLOCKQUOTE> +URL or identifier returned by AddLink(). +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="addlink.htm">AddLink()</A>, +<A HREF="cell.htm">Cell()</A>, +<A HREF="write.htm">Write()</A>, +<A HREF="image.htm">Image()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/ln.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/ln.htm new file mode 100644 index 0000000000000000000000000000000000000000..a65b3c5810d9cd1aa761770cddb7e70b63ff8a0a --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/ln.htm @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Ln</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Ln</H2> +<TT>Ln([<B>float</B> h])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Performs a line break. The current abscissa goes back to the left margin and the ordinate +increases by the amount passed in parameter. +<H4 CLASS='st'>Parameters</H4> +<TT><U>h</U></TT> +<BLOCKQUOTE> +The height of the break. +<BR> +By default, the value equals the height of the last printed cell. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="cell.htm">Cell()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/multicell.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/multicell.htm new file mode 100644 index 0000000000000000000000000000000000000000..783875d52c065811cc0ea87faeeeb2e787aa2512 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/multicell.htm @@ -0,0 +1,76 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>MultiCell</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>MultiCell</H2> +<TT>MultiCell(<B>float</B> w, <B>float</B> h, <B>string</B> txt [, <B>mixed</B> border [, <B>string</B> align [, <B>int</B> fill]]])</TT> +<H4 CLASS='st'>Version</H4> +1.3 +<H4 CLASS='st'>Description</H4> +This method allows printing text with line breaks. They can be automatic (as soon as the +text reaches the right border of the cell) or explicit (via the \n character). As many cells +as necessary are output, one below the other. +<BR> +Text can be aligned, centered or justified. The cell block can be framed and the background +painted. +<H4 CLASS='st'>Parameters</H4> +<TT><U>w</U></TT> +<BLOCKQUOTE> +Width of cells. If <TT>0</TT>, they extend up to the right margin of the page. +</BLOCKQUOTE> +<TT><U>h</U></TT> +<BLOCKQUOTE> +Height of cells. +</BLOCKQUOTE> +<TT><U>txt</U></TT> +<BLOCKQUOTE> +String to print. +</BLOCKQUOTE> +<TT><U>border</U></TT> +<BLOCKQUOTE> +Indicates if borders must be drawn around the cell block. The value can be either a number: +<UL> +<LI><TT>0</TT>: no border +<LI><TT>1</TT>: frame +</UL> +or a string containing some or all of the following characters (in any order): +<UL> +<LI><TT>L</TT>: left +<LI><TT>T</TT>: top +<LI><TT>R</TT>: right +<LI><TT>B</TT>: bottom +</UL> +Default value: <TT>0</TT>. +</BLOCKQUOTE> +<TT><U>align</U></TT> +<BLOCKQUOTE> +Sets the text alignment. Possible values are: +<UL> +<LI><TT>L</TT>: left alignment +<LI><TT>C</TT>: center +<LI><TT>R</TT>: right alignment +<LI><TT>J</TT>: justification (default value) +</UL> +</BLOCKQUOTE> +<TT><U>fill</U></TT> +<BLOCKQUOTE> +Indicates if the cell background must be painted (<TT>1</TT>) or transparent (<TT>0</TT>). +Default value: <TT>0</TT>. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setfont.htm">SetFont()</A>, +<A HREF="setdrawcolor.htm">SetDrawColor()</A>, +<A HREF="setfillcolor.htm">SetFillColor()</A>, +<A HREF="settextcolor.htm">SetTextColor()</A>, +<A HREF="setlinewidth.htm">SetLineWidth()</A>, +<A HREF="cell.htm">Cell()</A>, +<A HREF="write.htm">Write()</A>, +<A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/output.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/output.htm new file mode 100644 index 0000000000000000000000000000000000000000..5caa0548b3cd6070439a6e86f8d8351e563c5a27 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/output.htm @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Output</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Output</H2> +<TT><B>string</B> Output([<B>string</B> name [, <B>string</B> dest]])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Send the document to a given destination: string, local file or browser. In the last case, the +plug-in may be used (if present) or a download ("Save as" dialog box) may be forced. +<BR> +The method first calls Close() if necessary to terminate the document. +<H4 CLASS='st'>Parameters</H4> +<TT><U>name</U></TT> +<BLOCKQUOTE> +The name of the file. If not given, the document will be sent to the browser +(destination <TT>I</TT>) with the name <TT>doc.pdf</TT>. +</BLOCKQUOTE> +<TT><U>dest</U></TT> +<BLOCKQUOTE> +Destination where to send the document. It can take one of the following values: +<UL> +<LI><TT>I</TT>: send the file inline to the browser. The plug-in is used if available. +The name given by <TT>name</TT> is used when one selects the "Save as" option on the +link generating the PDF. +<LI><TT>D</TT>: send to the browser and force a file download with the name given by +<TT>name</TT>. +<LI><TT>F</TT>: save to a local file with the name given by <TT>name</TT>. +<LI><TT>S</TT>: return the document as a string. <TT>name</TT> is ignored. +</UL> +If the parameter is not specified but a name is given, destination is <TT>F</TT>. If no +parameter is specified at all, destination is <TT>I</TT>.<BR> +<BR> +Note: for compatibility with previous versions, a boolean value is also accepted +(<TT>false</TT> for <TT>F</TT> and <TT>true</TT> for <TT>D</TT>). +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="close.htm">Close()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/pageno.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/pageno.htm new file mode 100644 index 0000000000000000000000000000000000000000..0bb8a9e0bc6d6b1cae22ef26e0d14c6f7b42b497 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/pageno.htm @@ -0,0 +1,20 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>PageNo</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>PageNo</H2> +<TT><B>int</B> PageNo()</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Returns the current page number. +<H4 CLASS='st'>See also</H4> +<A HREF="aliasnbpages.htm">AliasNbPages()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/rect.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/rect.htm new file mode 100644 index 0000000000000000000000000000000000000000..9f2cd3445cb776376661a36559121cfbe2ddf89f --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/rect.htm @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Rect</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Rect</H2> +<TT>Rect(<B>float</B> x, <B>float</B> y, <B>float</B> w, <B>float</B> h [, <B>string</B> style])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Outputs a rectangle. It can be drawn (border only), filled (with no border) or both. +<H4 CLASS='st'>Parameters</H4> +<TT><U>x</U></TT> +<BLOCKQUOTE> +Abscissa of upper-left corner. +</BLOCKQUOTE> +<TT><U>y</U></TT> +<BLOCKQUOTE> +Ordinate of upper-left corner. +</BLOCKQUOTE> +<TT><U>w</U></TT> +<BLOCKQUOTE> +Width. +</BLOCKQUOTE> +<TT><U>h</U></TT> +<BLOCKQUOTE> +Height. +</BLOCKQUOTE> +<TT><U>style</U></TT> +<BLOCKQUOTE> +Style of rendering. Possible values are: +<UL> +<LI><TT>D</TT> or empty string: draw. This is the default value. +<LI><TT>F</TT>: fill +<LI><TT>DF</TT> or <TT>FD</TT>: draw and fill +</UL> +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setlinewidth.htm">SetLineWidth()</A>, +<A HREF="setdrawcolor.htm">SetDrawColor()</A>, +<A HREF="setfillcolor.htm">SetFillColor()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setauthor.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setauthor.htm new file mode 100644 index 0000000000000000000000000000000000000000..05b6ead43e49500ea3421773ada52042a7b554e0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setauthor.htm @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetAuthor</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetAuthor</H2> +<TT>SetAuthor(<B>string</B> author)</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Defines the author of the document. +<H4 CLASS='st'>Parameters</H4> +<TT><U>author</U></TT> +<BLOCKQUOTE> +The name of the author. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setcreator.htm">SetCreator()</A>, +<A HREF="setkeywords.htm">SetKeywords()</A>, +<A HREF="setsubject.htm">SetSubject()</A>, +<A HREF="settitle.htm">SetTitle()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setautopagebreak.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setautopagebreak.htm new file mode 100644 index 0000000000000000000000000000000000000000..66d5e97c41c36ee78a83c5b35805eaaed0d1f87e --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setautopagebreak.htm @@ -0,0 +1,33 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetAutoPageBreak</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetAutoPageBreak</H2> +<TT>SetAutoPageBreak(<B>boolean</B> auto [, <B>float</B> margin])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Enables or disables the automatic page breaking mode. When enabling, the second parameter is +the distance from the bottom of the page that defines the triggering limit. By default, the +mode is on and the margin is 2 cm. +<H4 CLASS='st'>Parameters</H4> +<TT><U>auto</U></TT> +<BLOCKQUOTE> +Boolean indicating if mode should be on or off. +</BLOCKQUOTE> +<TT><U>margin</U></TT> +<BLOCKQUOTE> +Distance from the bottom of the page. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="cell.htm">Cell()</A>, +<A HREF="multicell.htm">MultiCell()</A>, +<A HREF="acceptpagebreak.htm">AcceptPageBreak()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setcompression.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setcompression.htm new file mode 100644 index 0000000000000000000000000000000000000000..181922a60048fcf55c5e12c997b0b699e157acc2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setcompression.htm @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetCompression</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetCompression</H2> +<TT>SetCompression(<B>boolean</B> compress)</TT> +<H4 CLASS='st'>Version</H4> +1.4 +<H4 CLASS='st'>Description</H4> +Activates or deactivates page compression. When activated, the internal representation of +each page is compressed, which leads to a compression ratio of about 2 for the resulting +document. +<BR> +Compression is on by default. +<BR> +<BR> +<B>Note: </B>the Zlib extension is required for this feature. If not present, compression +will be turned off. +<H4 CLASS='st'>Parameters</H4> +<TT><U>compress</U></TT> +<BLOCKQUOTE> +Boolean indicating if compression must be enabled. +</BLOCKQUOTE> +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setcreator.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setcreator.htm new file mode 100644 index 0000000000000000000000000000000000000000..b3d634ea308e4644f75ce4023df8111e75d767b7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setcreator.htm @@ -0,0 +1,29 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetCreator</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetCreator</H2> +<TT>SetCreator(<B>string</B> creator)</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Defines the creator of the document. This is typically the name of the application that +generates the PDF. +<H4 CLASS='st'>Parameters</H4> +<TT><U>creator</U></TT> +<BLOCKQUOTE> +The name of the creator. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setauthor.htm">SetAuthor()</A>, +<A HREF="setkeywords.htm">SetKeywords()</A>, +<A HREF="setsubject.htm">SetSubject()</A>, +<A HREF="settitle.htm">SetTitle()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setdisplaymode.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setdisplaymode.htm new file mode 100644 index 0000000000000000000000000000000000000000..63d97932bb241ceee24d25d097768637beedf9a6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setdisplaymode.htm @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetDisplayMode</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetDisplayMode</H2> +<TT>SetDisplayMode(<B>mixed</B> zoom [, <B>string</B> layout])</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be +displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a +specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). +The page layout can be specified too: single at once, continuous display, two columns or viewer +default. +<BR> +By default, documents use the full width mode with continuous display. +<H4 CLASS='st'>Parameters</H4> +<TT><U>zoom</U></TT> +<BLOCKQUOTE> +The zoom to use. It can be one of the following string values: +<UL> +<LI><TT>fullpage</TT>: displays the entire page on screen +<LI><TT>fullwidth</TT>: uses maximum width of window +<LI><TT>real</TT>: uses real size (equivalent to 100% zoom) +<LI><TT>default</TT>: uses viewer default mode +</UL> +or a number indicating the zooming factor to use. +</BLOCKQUOTE> +<TT><U>layout</U></TT> +<BLOCKQUOTE> +The page layout. Possible values are: +<UL> +<LI><TT>single</TT>: displays one page at once +<LI><TT>continuous</TT>: displays pages continuously +<LI><TT>two</TT>: displays two pages on two columns +<LI><TT>default</TT>: uses viewer default mode +</UL> +Default value is <TT>continuous</TT>. +</BLOCKQUOTE> +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setdrawcolor.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setdrawcolor.htm new file mode 100644 index 0000000000000000000000000000000000000000..7c9948df052da447f2a6501a72b6ed89e494bdf4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setdrawcolor.htm @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetDrawColor</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetDrawColor</H2> +<TT>SetDrawColor(<B>int</B> r [, <B>int</B> g, <B>int</B> b])</TT> +<H4 CLASS='st'>Version</H4> +1.3 +<H4 CLASS='st'>Description</H4> +Defines the color used for all drawing operations (lines, rectangles and cell borders). It +can be expressed in RGB components or gray scale. The method can be called before the first +page is created and the value is retained from page to page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>r</U></TT> +<BLOCKQUOTE> +If <TT>g</TT> et <TT>b</TT> are given, red component; if not, indicates the gray level. +Value between 0 and 255. +</BLOCKQUOTE> +<TT><U>g</U></TT> +<BLOCKQUOTE> +Green component (between 0 and 255). +</BLOCKQUOTE> +<TT><U>b</U></TT> +<BLOCKQUOTE> +Blue component (between 0 and 255). +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setfillcolor.htm">SetFillColor()</A>, +<A HREF="settextcolor.htm">SetTextColor()</A>, +<A HREF="line.htm">Line()</A>, +<A HREF="rect.htm">Rect()</A>, +<A HREF="cell.htm">Cell()</A>, +<A HREF="multicell.htm">MultiCell()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfillcolor.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfillcolor.htm new file mode 100644 index 0000000000000000000000000000000000000000..f053366db0ff1149482cb3388ef0f83f9bd9c15b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfillcolor.htm @@ -0,0 +1,40 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetFillColor</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetFillColor</H2> +<TT>SetFillColor(<B>int</B> r [, <B>int</B> g, <B>int</B> b])</TT> +<H4 CLASS='st'>Version</H4> +1.3 +<H4 CLASS='st'>Description</H4> +Defines the color used for all filling operations (filled rectangles and cell backgrounds). +It can be expressed in RGB components or gray scale. The method can be called before the first +page is created and the value is retained from page to page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>r</U></TT> +<BLOCKQUOTE> +If <TT>g</TT> and <TT>b</TT> are given, red component; if not, indicates the gray level. +Value between 0 and 255. +</BLOCKQUOTE> +<TT><U>g</U></TT> +<BLOCKQUOTE> +Green component (between 0 and 255). +</BLOCKQUOTE> +<TT><U>b</U></TT> +<BLOCKQUOTE> +Blue component (between 0 and 255). +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setdrawcolor.htm">SetDrawColor()</A>, +<A HREF="settextcolor.htm">SetTextColor()</A>, +<A HREF="rect.htm">Rect()</A>, +<A HREF="cell.htm">Cell()</A>, +<A HREF="multicell.htm">MultiCell()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfont.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfont.htm new file mode 100644 index 0000000000000000000000000000000000000000..81fad9397368f6264a29c27b266493b368cd7d9d --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfont.htm @@ -0,0 +1,98 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetFont</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetFont</H2> +<TT>SetFont(<B>string</B> family [, <B>string</B> style [, <B>float</B> size]])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Sets the font used to print character strings. It is mandatory to call this method +at least once before printing text or the resulting document would not be valid. +<BR> +The font can be either a standard one or a font added via the AddFont() method. Standard fonts +use Windows encoding cp1252 (Western Europe). +<BR> +The method can be called before the first page is created and the font is retained from page +to page. +<BR> +If you just wish to change the current font size, it is simpler to call SetFontSize(). +<BR> +<BR> +<B>Note:</B> the font metric files must be accessible. They are searched successively in: +<UL> +<LI>The directory defined by the <TT>FPDF_FONTPATH</TT> constant (if this constant is defined) +<LI>The <TT>font</TT> directory located in the directory containing <TT>fpdf.php</TT> (if it exists) +<LI>The directories accessible through <TT>include()</TT> +</UL> +Example defining <TT>FPDF_FONTPATH</TT> (note the mandatory trailing slash): +<BR> +<BR> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +define('FPDF_FONTPATH','/home/www/font/');<BR> +require('fpdf.php'); +</TT> +</TD></TR></TABLE><BR> +If the file corresponding to the requested font is not found, the error "Could not include +font metric file" is issued. +<H4 CLASS='st'>Parameters</H4> +<TT><U>family</U></TT> +<BLOCKQUOTE> +Family font. It can be either a name defined by AddFont() or one of the standard families (case +insensitive): +<UL> +<LI><TT>Courier</TT> (fixed-width) +<LI><TT>Helvetica</TT> or <TT>Arial</TT> (synonymous; sans serif) +<LI><TT>Times</TT> (serif) +<LI><TT>Symbol</TT> (symbolic) +<LI><TT>ZapfDingbats</TT> (symbolic) +</UL> +It is also possible to pass an empty string. In that case, the current family is retained. +</BLOCKQUOTE> +<TT><U>style</U></TT> +<BLOCKQUOTE> +Font style. Possible values are (case insensitive): +<UL> +<LI>empty string: regular +<LI><TT>B</TT>: bold +<LI><TT>I</TT>: italic +<LI><TT>U</TT>: underline +</UL> +or any combination. The default value is regular. +Bold and italic styles do not apply to <TT>Symbol</TT> and <TT>ZapfDingbats</TT>. +</BLOCKQUOTE> +<TT><U>size</U></TT> +<BLOCKQUOTE> +Font size in points. +<BR> +The default value is the current size. If no size has been specified since the beginning of +the document, the value taken is 12. +</BLOCKQUOTE> +<H4 CLASS='st'>Example</H4> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +//Times regular 12<BR> +$pdf->SetFont('Times');<BR> +//Arial bold 14<BR> +$pdf->SetFont('Arial','B',14);<BR> +//Removes bold<BR> +$pdf->SetFont('');<BR> +//Times bold, italic and underlined 14<BR> +$pdf->SetFont('Times','BIU'); +</TT> +</TD></TR></TABLE><BR> +<H4 CLASS='st'>See also</H4> +<A HREF="addfont.htm">AddFont()</A>, +<A HREF="setfontsize.htm">SetFontSize()</A>, +<A HREF="cell.htm">Cell()</A>, +<A HREF="multicell.htm">MultiCell()</A>, +<A HREF="write.htm">Write()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfontsize.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfontsize.htm new file mode 100644 index 0000000000000000000000000000000000000000..5b1a09ed4bbb1e1053750d8963656a6ef7859004 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setfontsize.htm @@ -0,0 +1,25 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetFontSize</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetFontSize</H2> +<TT>SetFontSize(<B>float</B> size)</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Defines the size of the current font. +<H4 CLASS='st'>Parameters</H4> +<TT><U>size</U></TT> +<BLOCKQUOTE> +The size (in points). +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setfont.htm">SetFont()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setkeywords.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setkeywords.htm new file mode 100644 index 0000000000000000000000000000000000000000..801b8ce2e96e2e785c7f66b67ad04c6367444bf0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setkeywords.htm @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetKeywords</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetKeywords</H2> +<TT>SetKeywords(<B>string</B> keywords)</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'. +<H4 CLASS='st'>Parameters</H4> +<TT><U>keywords</U></TT> +<BLOCKQUOTE> +The list of keywords. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setauthor.htm">SetAuthor()</A>, +<A HREF="setcreator.htm">SetCreator()</A>, +<A HREF="setsubject.htm">SetSubject()</A>, +<A HREF="settitle.htm">SetTitle()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setleftmargin.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setleftmargin.htm new file mode 100644 index 0000000000000000000000000000000000000000..e96b77bbd9e92f744e349f950b966431a5f67035 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setleftmargin.htm @@ -0,0 +1,30 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetLeftMargin</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetLeftMargin</H2> +<TT>SetLeftMargin(<B>float</B> margin)</TT> +<H4 CLASS='st'>Version</H4> +1.4 +<H4 CLASS='st'>Description</H4> +Defines the left margin. The method can be called before creating the first page. +<BR> +If the current abscissa gets out of page, it is brought back to the margin. +<H4 CLASS='st'>Parameters</H4> +<TT><U>margin</U></TT> +<BLOCKQUOTE> +The margin. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="settopmargin.htm">SetTopMargin()</A>, +<A HREF="setrightmargin.htm">SetRightMargin()</A>, +<A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>, +<A HREF="setmargins.htm">SetMargins()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setlinewidth.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setlinewidth.htm new file mode 100644 index 0000000000000000000000000000000000000000..c9629f8d63a23a58952120bd67da1f1771dfa209 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setlinewidth.htm @@ -0,0 +1,29 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetLineWidth</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetLineWidth</H2> +<TT>SetLineWidth(<B>float</B> width)</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Defines the line width. By default, the value equals 0.2 mm. The method can be called before +the first page is created and the value is retained from page to page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>width</U></TT> +<BLOCKQUOTE> +The width. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="line.htm">Line()</A>, +<A HREF="rect.htm">Rect()</A>, +<A HREF="cell.htm">Cell()</A>, +<A HREF="multicell.htm">MultiCell()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setlink.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setlink.htm new file mode 100644 index 0000000000000000000000000000000000000000..fd76a56e59aaae5e59af9a2523a0049c19185b73 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setlink.htm @@ -0,0 +1,34 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetLink</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetLink</H2> +<TT>SetLink(<B>int</B> link [, <B>float</B> y [, <B>int</B> page]])</TT> +<H4 CLASS='st'>Version</H4> +1.5 +<H4 CLASS='st'>Description</H4> +Defines the page and position a link points to. +<H4 CLASS='st'>Parameters</H4> +<TT><U>link</U></TT> +<BLOCKQUOTE> +The link identifier returned by AddLink(). +</BLOCKQUOTE> +<TT><U>y</U></TT> +<BLOCKQUOTE> +Ordinate of target position; <TT>-1</TT> indicates the current position. +The default value is <TT>0</TT> (top of page). +</BLOCKQUOTE> +<TT><U>page</U></TT> +<BLOCKQUOTE> +Number of target page; <TT>-1</TT> indicates the current page. This is the default value. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="addlink.htm">AddLink()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setmargins.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setmargins.htm new file mode 100644 index 0000000000000000000000000000000000000000..cd29866286da2d9cbb2a8bce021339ec7349db2c --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setmargins.htm @@ -0,0 +1,37 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetMargins</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetMargins</H2> +<TT>SetMargins(<B>float</B> left, <B>float</B> top [, <B>float</B> right])</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Defines the left, top and right margins. By default, they equal 1 cm. Call this method to change +them. +<H4 CLASS='st'>Parameters</H4> +<TT><U>left</U></TT> +<BLOCKQUOTE> +Left margin. +</BLOCKQUOTE> +<TT><U>top</U></TT> +<BLOCKQUOTE> +Top margin. +</BLOCKQUOTE> +<TT><U>right</U></TT> +<BLOCKQUOTE> +Right margin. Default value is the left one. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setleftmargin.htm">SetLeftMargin()</A>, +<A HREF="settopmargin.htm">SetTopMargin()</A>, +<A HREF="setrightmargin.htm">SetRightMargin()</A>, +<A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setrightmargin.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setrightmargin.htm new file mode 100644 index 0000000000000000000000000000000000000000..0c692526b04ba77a9738329712f526b0602cc21f --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setrightmargin.htm @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetRightMargin</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetRightMargin</H2> +<TT>SetRightMargin(<B>float</B> margin)</TT> +<H4 CLASS='st'>Version</H4> +1.5 +<H4 CLASS='st'>Description</H4> +Defines the right margin. The method can be called before creating the first page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>margin</U></TT> +<BLOCKQUOTE> +The margin. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setleftmargin.htm">SetLeftMargin()</A>, +<A HREF="settopmargin.htm">SetTopMargin()</A>, +<A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>, +<A HREF="setmargins.htm">SetMargins()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setsubject.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setsubject.htm new file mode 100644 index 0000000000000000000000000000000000000000..9d2b75a833b97d2312169438b0d0d30fcbed8da0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setsubject.htm @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetSubject</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetSubject</H2> +<TT>SetSubject(<B>string</B> subject)</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Defines the subject of the document. +<H4 CLASS='st'>Parameters</H4> +<TT><U>subject</U></TT> +<BLOCKQUOTE> +The subject. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setauthor.htm">SetAuthor()</A>, +<A HREF="setcreator.htm">SetCreator()</A>, +<A HREF="setkeywords.htm">SetKeywords()</A>, +<A HREF="settitle.htm">SetTitle()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settextcolor.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settextcolor.htm new file mode 100644 index 0000000000000000000000000000000000000000..bd116b27d33fa2a870c88ed717979e916ce82dc0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settextcolor.htm @@ -0,0 +1,40 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetTextColor</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetTextColor</H2> +<TT>SetTextColor(<B>int</B> r [, <B>int</B> g, <B>int</B> b])</TT> +<H4 CLASS='st'>Version</H4> +1.3 +<H4 CLASS='st'>Description</H4> +Defines the color used for text. It can be expressed in RGB components or gray scale. The +method can be called before the first page is created and the value is retained from page to +page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>r</U></TT> +<BLOCKQUOTE> +If <TT>g</TT> et <TT>b</TT> are given, red component; if not, indicates the gray level. +Value between 0 and 255. +</BLOCKQUOTE> +<TT><U>g</U></TT> +<BLOCKQUOTE> +Green component (between 0 and 255). +</BLOCKQUOTE> +<TT><U>b</U></TT> +<BLOCKQUOTE> +Blue component (between 0 and 255). +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setdrawcolor.htm">SetDrawColor()</A>, +<A HREF="setfillcolor.htm">SetFillColor()</A>, +<A HREF="text.htm">Text()</A>, +<A HREF="cell.htm">Cell()</A>, +<A HREF="multicell.htm">MultiCell()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settitle.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settitle.htm new file mode 100644 index 0000000000000000000000000000000000000000..6cd97158c6316fe66f35c92de2f807eb13bc5333 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settitle.htm @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetTitle</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetTitle</H2> +<TT>SetTitle(<B>string</B> title)</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Defines the title of the document. +<H4 CLASS='st'>Parameters</H4> +<TT><U>title</U></TT> +<BLOCKQUOTE> +The title. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setauthor.htm">SetAuthor()</A>, +<A HREF="setcreator.htm">SetCreator()</A>, +<A HREF="setkeywords.htm">SetKeywords()</A>, +<A HREF="setsubject.htm">SetSubject()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settopmargin.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settopmargin.htm new file mode 100644 index 0000000000000000000000000000000000000000..a8e8ef945d5ffb550b4d43afca763e400e87791b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/settopmargin.htm @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetTopMargin</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetTopMargin</H2> +<TT>SetTopMargin(<B>float</B> margin)</TT> +<H4 CLASS='st'>Version</H4> +1.5 +<H4 CLASS='st'>Description</H4> +Defines the top margin. The method can be called before creating the first page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>margin</U></TT> +<BLOCKQUOTE> +The margin. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setleftmargin.htm">SetLeftMargin()</A>, +<A HREF="setrightmargin.htm">SetRightMargin()</A>, +<A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>, +<A HREF="setmargins.htm">SetMargins()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setx.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setx.htm new file mode 100644 index 0000000000000000000000000000000000000000..2c4f0ec3bc72c64e2cde05da5305e7fdc1cf6dec --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setx.htm @@ -0,0 +1,29 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetX</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetX</H2> +<TT>SetX(<B>float</B> x)</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Defines the abscissa of the current position. If the passed value is negative, it is relative +to the right of the page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>x</U></TT> +<BLOCKQUOTE> +The value of the abscissa. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="getx.htm">GetX()</A>, +<A HREF="gety.htm">GetY()</A>, +<A HREF="sety.htm">SetY()</A>, +<A HREF="setxy.htm">SetXY()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setxy.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setxy.htm new file mode 100644 index 0000000000000000000000000000000000000000..ea192c0255d921c6e870fa10a84632b54bbea669 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/setxy.htm @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetXY</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetXY</H2> +<TT>SetXY(<B>float</B> x, <B>float</B> y)</TT> +<H4 CLASS='st'>Version</H4> +1.2 +<H4 CLASS='st'>Description</H4> +Defines the abscissa and ordinate of the current position. If the passed values are negative, +they are relative respectively to the right and bottom of the page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>x</U></TT> +<BLOCKQUOTE> +The value of the abscissa. +</BLOCKQUOTE> +<TT><U>y</U></TT> +<BLOCKQUOTE> +The value of the ordinate. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setx.htm">SetX()</A>, +<A HREF="sety.htm">SetY()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/sety.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/sety.htm new file mode 100644 index 0000000000000000000000000000000000000000..f8c4e49ad15d4d027f48bd21773481af03d5b9d7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/sety.htm @@ -0,0 +1,29 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>SetY</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>SetY</H2> +<TT>SetY(<B>float</B> y)</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Moves the current abscissa back to the left margin and sets the ordinate. If the passed value +is negative, it is relative to the bottom of the page. +<H4 CLASS='st'>Parameters</H4> +<TT><U>y</U></TT> +<BLOCKQUOTE> +The value of the ordinate. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="getx.htm">GetX()</A>, +<A HREF="gety.htm">GetY()</A>, +<A HREF="setx.htm">SetX()</A>, +<A HREF="setxy.htm">SetXY()</A>. +<HR STYLE="margin-top:1.5em"> +<DIV STYLE="text-align:center"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/text.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/text.htm new file mode 100644 index 0000000000000000000000000000000000000000..11399bc0f520bd9f2e9378b66d104bfe48e37c3b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/text.htm @@ -0,0 +1,39 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Text</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Text</H2> +<TT>Text(<B>float</B> x, <B>float</B> y, <B>string</B> txt)</TT> +<H4 CLASS='st'>Version</H4> +1.0 +<H4 CLASS='st'>Description</H4> +Prints a character string. The origin is on the left of the first character, on the baseline. +This method allows to place a string precisely on the page, but it is usually easier to use +Cell(), MultiCell() or Write() which are the standard methods to print text. +<H4 CLASS='st'>Parameters</H4> +<TT><U>x</U></TT> +<BLOCKQUOTE> +Abscissa of the origin. +</BLOCKQUOTE> +<TT><U>y</U></TT> +<BLOCKQUOTE> +Ordinate of the origin. +</BLOCKQUOTE> +<TT><U>txt</U></TT> +<BLOCKQUOTE> +String to print. +</BLOCKQUOTE> +<H4 CLASS='st'>See also</H4> +<A HREF="setfont.htm">SetFont()</A>, +<A HREF="settextcolor.htm">SetTextColor()</A>, +<A HREF="cell.htm">Cell()</A>, +<A HREF="multicell.htm">MultiCell()</A>, +<A HREF="write.htm">Write()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/write.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/write.htm new file mode 100644 index 0000000000000000000000000000000000000000..3a502172c05c0988999b8dacfab6b857b98b2e89 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/doc/write.htm @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Write</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Write</H2> +<TT>Write(<B>float</B> h, <B>string</B> txt [, <B>mixed</B> link])</TT> +<H4 CLASS='st'>Version</H4> +1.5 +<H4 CLASS='st'>Description</H4> +This method prints text from the current position. When the right margin is reached (or the \n +character is met) a line break occurs and text continues from the left margin. Upon method exit, +the current position is left just at the end of the text. +<BR> +It is possible to put a link on the text. +<H4 CLASS='st'>Parameters</H4> +<TT><U>h</U></TT> +<BLOCKQUOTE> +Line height. +</BLOCKQUOTE> +<TT><U>txt</U></TT> +<BLOCKQUOTE> +String to print. +</BLOCKQUOTE> +<TT><U>link</U></TT> +<BLOCKQUOTE> +URL or identifier returned by AddLink(). +</BLOCKQUOTE> +<H4 CLASS='st'>Example</H4> +<TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> +<TT> +//Begin with regular font<BR> +$pdf->SetFont('Arial','',14);<BR> +$pdf->Write(5,'Visit ');<BR> +//Then put a blue underlined link<BR> +$pdf->SetTextColor(0,0,255);<BR> +$pdf->SetFont('','U');<BR> +$pdf->Write(5,'www.fpdf.org','http://www.fpdf.org'); +</TT> +</TD></TR></TABLE><BR> +<H4 CLASS='st'>See also</H4> +<A HREF="setfont.htm">SetFont()</A>, +<A HREF="settextcolor.htm">SetTextColor()</A>, +<A HREF="addlink.htm">AddLink()</A>, +<A HREF="multicell.htm">MultiCell()</A>, +<A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>. +<HR STYLE="margin-top:1.2em"> +<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/courier.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/courier.php new file mode 100644 index 0000000000000000000000000000000000000000..a0d81187dcac59dbe6b2d2ecb71ca82dc3fb7917 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/courier.php @@ -0,0 +1,7 @@ +<?php +for($i=0;$i<=255;$i++) + $fpdf_charwidths['courier'][chr($i)]=600; +$fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; +$fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; +$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helvetica.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helvetica.php new file mode 100644 index 0000000000000000000000000000000000000000..39921de21aaf3f30764303ad8d7916be70abd504 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helvetica.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['helvetica']=array( + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticab.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticab.php new file mode 100644 index 0000000000000000000000000000000000000000..8993db0f74364d18dd412c27e71bcd9b01070c88 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticab.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['helveticaB']=array( + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticabi.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticabi.php new file mode 100644 index 0000000000000000000000000000000000000000..751ca85cc808d2050b065140a65c53bfb1953f9e --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticabi.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['helveticaBI']=array( + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticai.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticai.php new file mode 100644 index 0000000000000000000000000000000000000000..ee43a968b8409dc62b9bbcac6d4789618df8ba91 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/helveticai.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['helveticaI']=array( + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1250.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1250.map new file mode 100644 index 0000000000000000000000000000000000000000..ec110af06108ab961c9eafd5fc45a7488ca6cce0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1250.map @@ -0,0 +1,251 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!89 U+2030 perthousand +!8A U+0160 Scaron +!8B U+2039 guilsinglleft +!8C U+015A Sacute +!8D U+0164 Tcaron +!8E U+017D Zcaron +!8F U+0179 Zacute +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!99 U+2122 trademark +!9A U+0161 scaron +!9B U+203A guilsinglright +!9C U+015B sacute +!9D U+0165 tcaron +!9E U+017E zcaron +!9F U+017A zacute +!A0 U+00A0 space +!A1 U+02C7 caron +!A2 U+02D8 breve +!A3 U+0141 Lslash +!A4 U+00A4 currency +!A5 U+0104 Aogonek +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+015E Scedilla +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+017B Zdotaccent +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+02DB ogonek +!B3 U+0142 lslash +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+0105 aogonek +!BA U+015F scedilla +!BB U+00BB guillemotright +!BC U+013D Lcaron +!BD U+02DD hungarumlaut +!BE U+013E lcaron +!BF U+017C zdotaccent +!C0 U+0154 Racute +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+0102 Abreve +!C4 U+00C4 Adieresis +!C5 U+0139 Lacute +!C6 U+0106 Cacute +!C7 U+00C7 Ccedilla +!C8 U+010C Ccaron +!C9 U+00C9 Eacute +!CA U+0118 Eogonek +!CB U+00CB Edieresis +!CC U+011A Ecaron +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+010E Dcaron +!D0 U+0110 Dcroat +!D1 U+0143 Nacute +!D2 U+0147 Ncaron +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+0150 Ohungarumlaut +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+0158 Rcaron +!D9 U+016E Uring +!DA U+00DA Uacute +!DB U+0170 Uhungarumlaut +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+0162 Tcommaaccent +!DF U+00DF germandbls +!E0 U+0155 racute +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+0103 abreve +!E4 U+00E4 adieresis +!E5 U+013A lacute +!E6 U+0107 cacute +!E7 U+00E7 ccedilla +!E8 U+010D ccaron +!E9 U+00E9 eacute +!EA U+0119 eogonek +!EB U+00EB edieresis +!EC U+011B ecaron +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+010F dcaron +!F0 U+0111 dcroat +!F1 U+0144 nacute +!F2 U+0148 ncaron +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+0151 ohungarumlaut +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+0159 rcaron +!F9 U+016F uring +!FA U+00FA uacute +!FB U+0171 uhungarumlaut +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+0163 tcommaaccent +!FF U+02D9 dotaccent diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1251.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1251.map new file mode 100644 index 0000000000000000000000000000000000000000..de6a198d99d9d17db29f02633e3b0e66c9a60e98 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1251.map @@ -0,0 +1,255 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0402 afii10051 +!81 U+0403 afii10052 +!82 U+201A quotesinglbase +!83 U+0453 afii10100 +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+20AC Euro +!89 U+2030 perthousand +!8A U+0409 afii10058 +!8B U+2039 guilsinglleft +!8C U+040A afii10059 +!8D U+040C afii10061 +!8E U+040B afii10060 +!8F U+040F afii10145 +!90 U+0452 afii10099 +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!99 U+2122 trademark +!9A U+0459 afii10106 +!9B U+203A guilsinglright +!9C U+045A afii10107 +!9D U+045C afii10109 +!9E U+045B afii10108 +!9F U+045F afii10193 +!A0 U+00A0 space +!A1 U+040E afii10062 +!A2 U+045E afii10110 +!A3 U+0408 afii10057 +!A4 U+00A4 currency +!A5 U+0490 afii10050 +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+0401 afii10023 +!A9 U+00A9 copyright +!AA U+0404 afii10053 +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+0407 afii10056 +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+0406 afii10055 +!B3 U+0456 afii10103 +!B4 U+0491 afii10098 +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+0451 afii10071 +!B9 U+2116 afii61352 +!BA U+0454 afii10101 +!BB U+00BB guillemotright +!BC U+0458 afii10105 +!BD U+0405 afii10054 +!BE U+0455 afii10102 +!BF U+0457 afii10104 +!C0 U+0410 afii10017 +!C1 U+0411 afii10018 +!C2 U+0412 afii10019 +!C3 U+0413 afii10020 +!C4 U+0414 afii10021 +!C5 U+0415 afii10022 +!C6 U+0416 afii10024 +!C7 U+0417 afii10025 +!C8 U+0418 afii10026 +!C9 U+0419 afii10027 +!CA U+041A afii10028 +!CB U+041B afii10029 +!CC U+041C afii10030 +!CD U+041D afii10031 +!CE U+041E afii10032 +!CF U+041F afii10033 +!D0 U+0420 afii10034 +!D1 U+0421 afii10035 +!D2 U+0422 afii10036 +!D3 U+0423 afii10037 +!D4 U+0424 afii10038 +!D5 U+0425 afii10039 +!D6 U+0426 afii10040 +!D7 U+0427 afii10041 +!D8 U+0428 afii10042 +!D9 U+0429 afii10043 +!DA U+042A afii10044 +!DB U+042B afii10045 +!DC U+042C afii10046 +!DD U+042D afii10047 +!DE U+042E afii10048 +!DF U+042F afii10049 +!E0 U+0430 afii10065 +!E1 U+0431 afii10066 +!E2 U+0432 afii10067 +!E3 U+0433 afii10068 +!E4 U+0434 afii10069 +!E5 U+0435 afii10070 +!E6 U+0436 afii10072 +!E7 U+0437 afii10073 +!E8 U+0438 afii10074 +!E9 U+0439 afii10075 +!EA U+043A afii10076 +!EB U+043B afii10077 +!EC U+043C afii10078 +!ED U+043D afii10079 +!EE U+043E afii10080 +!EF U+043F afii10081 +!F0 U+0440 afii10082 +!F1 U+0441 afii10083 +!F2 U+0442 afii10084 +!F3 U+0443 afii10085 +!F4 U+0444 afii10086 +!F5 U+0445 afii10087 +!F6 U+0446 afii10088 +!F7 U+0447 afii10089 +!F8 U+0448 afii10090 +!F9 U+0449 afii10091 +!FA U+044A afii10092 +!FB U+044B afii10093 +!FC U+044C afii10094 +!FD U+044D afii10095 +!FE U+044E afii10096 +!FF U+044F afii10097 diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1252.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1252.map new file mode 100644 index 0000000000000000000000000000000000000000..dd490e5961485ea47e527508691007e31e376fe9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1252.map @@ -0,0 +1,251 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8A U+0160 Scaron +!8B U+2039 guilsinglleft +!8C U+0152 OE +!8E U+017D Zcaron +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9A U+0161 scaron +!9B U+203A guilsinglright +!9C U+0153 oe +!9E U+017E zcaron +!9F U+0178 Ydieresis +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+00D0 Eth +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+00DE Thorn +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+00F0 eth +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+00FE thorn +!FF U+00FF ydieresis diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1253.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1253.map new file mode 100644 index 0000000000000000000000000000000000000000..4bd826fb2652c285e2d5ada788827e5d0085c31f --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1253.map @@ -0,0 +1,239 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!89 U+2030 perthousand +!8B U+2039 guilsinglleft +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!99 U+2122 trademark +!9B U+203A guilsinglright +!A0 U+00A0 space +!A1 U+0385 dieresistonos +!A2 U+0386 Alphatonos +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+2015 afii00208 +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+0384 tonos +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+0388 Epsilontonos +!B9 U+0389 Etatonos +!BA U+038A Iotatonos +!BB U+00BB guillemotright +!BC U+038C Omicrontonos +!BD U+00BD onehalf +!BE U+038E Upsilontonos +!BF U+038F Omegatonos +!C0 U+0390 iotadieresistonos +!C1 U+0391 Alpha +!C2 U+0392 Beta +!C3 U+0393 Gamma +!C4 U+0394 Delta +!C5 U+0395 Epsilon +!C6 U+0396 Zeta +!C7 U+0397 Eta +!C8 U+0398 Theta +!C9 U+0399 Iota +!CA U+039A Kappa +!CB U+039B Lambda +!CC U+039C Mu +!CD U+039D Nu +!CE U+039E Xi +!CF U+039F Omicron +!D0 U+03A0 Pi +!D1 U+03A1 Rho +!D3 U+03A3 Sigma +!D4 U+03A4 Tau +!D5 U+03A5 Upsilon +!D6 U+03A6 Phi +!D7 U+03A7 Chi +!D8 U+03A8 Psi +!D9 U+03A9 Omega +!DA U+03AA Iotadieresis +!DB U+03AB Upsilondieresis +!DC U+03AC alphatonos +!DD U+03AD epsilontonos +!DE U+03AE etatonos +!DF U+03AF iotatonos +!E0 U+03B0 upsilondieresistonos +!E1 U+03B1 alpha +!E2 U+03B2 beta +!E3 U+03B3 gamma +!E4 U+03B4 delta +!E5 U+03B5 epsilon +!E6 U+03B6 zeta +!E7 U+03B7 eta +!E8 U+03B8 theta +!E9 U+03B9 iota +!EA U+03BA kappa +!EB U+03BB lambda +!EC U+03BC mu +!ED U+03BD nu +!EE U+03BE xi +!EF U+03BF omicron +!F0 U+03C0 pi +!F1 U+03C1 rho +!F2 U+03C2 sigma1 +!F3 U+03C3 sigma +!F4 U+03C4 tau +!F5 U+03C5 upsilon +!F6 U+03C6 phi +!F7 U+03C7 chi +!F8 U+03C8 psi +!F9 U+03C9 omega +!FA U+03CA iotadieresis +!FB U+03CB upsilondieresis +!FC U+03CC omicrontonos +!FD U+03CD upsilontonos +!FE U+03CE omegatonos diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1254.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1254.map new file mode 100644 index 0000000000000000000000000000000000000000..829473b28c5e53c7f89c68808151f7e45d5dc89e --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1254.map @@ -0,0 +1,249 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8A U+0160 Scaron +!8B U+2039 guilsinglleft +!8C U+0152 OE +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9A U+0161 scaron +!9B U+203A guilsinglright +!9C U+0153 oe +!9F U+0178 Ydieresis +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+011E Gbreve +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+0130 Idotaccent +!DE U+015E Scedilla +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+011F gbreve +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+0131 dotlessi +!FE U+015F scedilla +!FF U+00FF ydieresis diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1255.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1255.map new file mode 100644 index 0000000000000000000000000000000000000000..079e10c61cd8e6360bb266cd95cca7672d3872f0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1255.map @@ -0,0 +1,233 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8B U+2039 guilsinglleft +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9B U+203A guilsinglright +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+20AA afii57636 +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00D7 multiply +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD sfthyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 middot +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00F7 divide +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+05B0 afii57799 +!C1 U+05B1 afii57801 +!C2 U+05B2 afii57800 +!C3 U+05B3 afii57802 +!C4 U+05B4 afii57793 +!C5 U+05B5 afii57794 +!C6 U+05B6 afii57795 +!C7 U+05B7 afii57798 +!C8 U+05B8 afii57797 +!C9 U+05B9 afii57806 +!CB U+05BB afii57796 +!CC U+05BC afii57807 +!CD U+05BD afii57839 +!CE U+05BE afii57645 +!CF U+05BF afii57841 +!D0 U+05C0 afii57842 +!D1 U+05C1 afii57804 +!D2 U+05C2 afii57803 +!D3 U+05C3 afii57658 +!D4 U+05F0 afii57716 +!D5 U+05F1 afii57717 +!D6 U+05F2 afii57718 +!D7 U+05F3 gereshhebrew +!D8 U+05F4 gershayimhebrew +!E0 U+05D0 afii57664 +!E1 U+05D1 afii57665 +!E2 U+05D2 afii57666 +!E3 U+05D3 afii57667 +!E4 U+05D4 afii57668 +!E5 U+05D5 afii57669 +!E6 U+05D6 afii57670 +!E7 U+05D7 afii57671 +!E8 U+05D8 afii57672 +!E9 U+05D9 afii57673 +!EA U+05DA afii57674 +!EB U+05DB afii57675 +!EC U+05DC afii57676 +!ED U+05DD afii57677 +!EE U+05DE afii57678 +!EF U+05DF afii57679 +!F0 U+05E0 afii57680 +!F1 U+05E1 afii57681 +!F2 U+05E2 afii57682 +!F3 U+05E3 afii57683 +!F4 U+05E4 afii57684 +!F5 U+05E5 afii57685 +!F6 U+05E6 afii57686 +!F7 U+05E7 afii57687 +!F8 U+05E8 afii57688 +!F9 U+05E9 afii57689 +!FA U+05EA afii57690 +!FD U+200E afii299 +!FE U+200F afii300 diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1257.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1257.map new file mode 100644 index 0000000000000000000000000000000000000000..2f2ecfa21dabe90c8cfa15e1738f2cd3c149d2a2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1257.map @@ -0,0 +1,244 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!89 U+2030 perthousand +!8B U+2039 guilsinglleft +!8D U+00A8 dieresis +!8E U+02C7 caron +!8F U+00B8 cedilla +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!99 U+2122 trademark +!9B U+203A guilsinglright +!9D U+00AF macron +!9E U+02DB ogonek +!A0 U+00A0 space +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00D8 Oslash +!A9 U+00A9 copyright +!AA U+0156 Rcommaaccent +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00C6 AE +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00F8 oslash +!B9 U+00B9 onesuperior +!BA U+0157 rcommaaccent +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00E6 ae +!C0 U+0104 Aogonek +!C1 U+012E Iogonek +!C2 U+0100 Amacron +!C3 U+0106 Cacute +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+0118 Eogonek +!C7 U+0112 Emacron +!C8 U+010C Ccaron +!C9 U+00C9 Eacute +!CA U+0179 Zacute +!CB U+0116 Edotaccent +!CC U+0122 Gcommaaccent +!CD U+0136 Kcommaaccent +!CE U+012A Imacron +!CF U+013B Lcommaaccent +!D0 U+0160 Scaron +!D1 U+0143 Nacute +!D2 U+0145 Ncommaaccent +!D3 U+00D3 Oacute +!D4 U+014C Omacron +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+0172 Uogonek +!D9 U+0141 Lslash +!DA U+015A Sacute +!DB U+016A Umacron +!DC U+00DC Udieresis +!DD U+017B Zdotaccent +!DE U+017D Zcaron +!DF U+00DF germandbls +!E0 U+0105 aogonek +!E1 U+012F iogonek +!E2 U+0101 amacron +!E3 U+0107 cacute +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+0119 eogonek +!E7 U+0113 emacron +!E8 U+010D ccaron +!E9 U+00E9 eacute +!EA U+017A zacute +!EB U+0117 edotaccent +!EC U+0123 gcommaaccent +!ED U+0137 kcommaaccent +!EE U+012B imacron +!EF U+013C lcommaaccent +!F0 U+0161 scaron +!F1 U+0144 nacute +!F2 U+0146 ncommaaccent +!F3 U+00F3 oacute +!F4 U+014D omacron +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+0173 uogonek +!F9 U+0142 lslash +!FA U+015B sacute +!FB U+016B umacron +!FC U+00FC udieresis +!FD U+017C zdotaccent +!FE U+017E zcaron +!FF U+02D9 dotaccent diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1258.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1258.map new file mode 100644 index 0000000000000000000000000000000000000000..fed915f7152ca24e30fb33d1922de45177d84428 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp1258.map @@ -0,0 +1,247 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8B U+2039 guilsinglleft +!8C U+0152 OE +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9B U+203A guilsinglright +!9C U+0153 oe +!9F U+0178 Ydieresis +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+0102 Abreve +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+0300 gravecomb +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+0110 Dcroat +!D1 U+00D1 Ntilde +!D2 U+0309 hookabovecomb +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+01A0 Ohorn +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+01AF Uhorn +!DE U+0303 tildecomb +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+0103 abreve +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+0301 acutecomb +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+0111 dcroat +!F1 U+00F1 ntilde +!F2 U+0323 dotbelowcomb +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+01A1 ohorn +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+01B0 uhorn +!FE U+20AB dong +!FF U+00FF ydieresis diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp874.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp874.map new file mode 100644 index 0000000000000000000000000000000000000000..1006e6b17f2a9d3cbbd8fc4fadd1c944c562cc1c --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/cp874.map @@ -0,0 +1,225 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!85 U+2026 ellipsis +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!A0 U+00A0 space +!A1 U+0E01 kokaithai +!A2 U+0E02 khokhaithai +!A3 U+0E03 khokhuatthai +!A4 U+0E04 khokhwaithai +!A5 U+0E05 khokhonthai +!A6 U+0E06 khorakhangthai +!A7 U+0E07 ngonguthai +!A8 U+0E08 chochanthai +!A9 U+0E09 chochingthai +!AA U+0E0A chochangthai +!AB U+0E0B sosothai +!AC U+0E0C chochoethai +!AD U+0E0D yoyingthai +!AE U+0E0E dochadathai +!AF U+0E0F topatakthai +!B0 U+0E10 thothanthai +!B1 U+0E11 thonangmonthothai +!B2 U+0E12 thophuthaothai +!B3 U+0E13 nonenthai +!B4 U+0E14 dodekthai +!B5 U+0E15 totaothai +!B6 U+0E16 thothungthai +!B7 U+0E17 thothahanthai +!B8 U+0E18 thothongthai +!B9 U+0E19 nonuthai +!BA U+0E1A bobaimaithai +!BB U+0E1B poplathai +!BC U+0E1C phophungthai +!BD U+0E1D fofathai +!BE U+0E1E phophanthai +!BF U+0E1F fofanthai +!C0 U+0E20 phosamphaothai +!C1 U+0E21 momathai +!C2 U+0E22 yoyakthai +!C3 U+0E23 roruathai +!C4 U+0E24 ruthai +!C5 U+0E25 lolingthai +!C6 U+0E26 luthai +!C7 U+0E27 wowaenthai +!C8 U+0E28 sosalathai +!C9 U+0E29 sorusithai +!CA U+0E2A sosuathai +!CB U+0E2B hohipthai +!CC U+0E2C lochulathai +!CD U+0E2D oangthai +!CE U+0E2E honokhukthai +!CF U+0E2F paiyannoithai +!D0 U+0E30 saraathai +!D1 U+0E31 maihanakatthai +!D2 U+0E32 saraaathai +!D3 U+0E33 saraamthai +!D4 U+0E34 saraithai +!D5 U+0E35 saraiithai +!D6 U+0E36 sarauethai +!D7 U+0E37 saraueethai +!D8 U+0E38 sarauthai +!D9 U+0E39 sarauuthai +!DA U+0E3A phinthuthai +!DF U+0E3F bahtthai +!E0 U+0E40 saraethai +!E1 U+0E41 saraaethai +!E2 U+0E42 saraothai +!E3 U+0E43 saraaimaimuanthai +!E4 U+0E44 saraaimaimalaithai +!E5 U+0E45 lakkhangyaothai +!E6 U+0E46 maiyamokthai +!E7 U+0E47 maitaikhuthai +!E8 U+0E48 maiekthai +!E9 U+0E49 maithothai +!EA U+0E4A maitrithai +!EB U+0E4B maichattawathai +!EC U+0E4C thanthakhatthai +!ED U+0E4D nikhahitthai +!EE U+0E4E yamakkanthai +!EF U+0E4F fongmanthai +!F0 U+0E50 zerothai +!F1 U+0E51 onethai +!F2 U+0E52 twothai +!F3 U+0E53 threethai +!F4 U+0E54 fourthai +!F5 U+0E55 fivethai +!F6 U+0E56 sixthai +!F7 U+0E57 seventhai +!F8 U+0E58 eightthai +!F9 U+0E59 ninethai +!FA U+0E5A angkhankhuthai +!FB U+0E5B khomutthai diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-1.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-1.map new file mode 100644 index 0000000000000000000000000000000000000000..61740a38fa3faa456159466766a92581b976d565 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-1.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+00D0 Eth +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+00DE Thorn +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+00F0 eth +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+00FE thorn +!FF U+00FF ydieresis diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-11.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-11.map new file mode 100644 index 0000000000000000000000000000000000000000..91688120667161d4acf8066f456d67d31a2bc0d9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-11.map @@ -0,0 +1,248 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0E01 kokaithai +!A2 U+0E02 khokhaithai +!A3 U+0E03 khokhuatthai +!A4 U+0E04 khokhwaithai +!A5 U+0E05 khokhonthai +!A6 U+0E06 khorakhangthai +!A7 U+0E07 ngonguthai +!A8 U+0E08 chochanthai +!A9 U+0E09 chochingthai +!AA U+0E0A chochangthai +!AB U+0E0B sosothai +!AC U+0E0C chochoethai +!AD U+0E0D yoyingthai +!AE U+0E0E dochadathai +!AF U+0E0F topatakthai +!B0 U+0E10 thothanthai +!B1 U+0E11 thonangmonthothai +!B2 U+0E12 thophuthaothai +!B3 U+0E13 nonenthai +!B4 U+0E14 dodekthai +!B5 U+0E15 totaothai +!B6 U+0E16 thothungthai +!B7 U+0E17 thothahanthai +!B8 U+0E18 thothongthai +!B9 U+0E19 nonuthai +!BA U+0E1A bobaimaithai +!BB U+0E1B poplathai +!BC U+0E1C phophungthai +!BD U+0E1D fofathai +!BE U+0E1E phophanthai +!BF U+0E1F fofanthai +!C0 U+0E20 phosamphaothai +!C1 U+0E21 momathai +!C2 U+0E22 yoyakthai +!C3 U+0E23 roruathai +!C4 U+0E24 ruthai +!C5 U+0E25 lolingthai +!C6 U+0E26 luthai +!C7 U+0E27 wowaenthai +!C8 U+0E28 sosalathai +!C9 U+0E29 sorusithai +!CA U+0E2A sosuathai +!CB U+0E2B hohipthai +!CC U+0E2C lochulathai +!CD U+0E2D oangthai +!CE U+0E2E honokhukthai +!CF U+0E2F paiyannoithai +!D0 U+0E30 saraathai +!D1 U+0E31 maihanakatthai +!D2 U+0E32 saraaathai +!D3 U+0E33 saraamthai +!D4 U+0E34 saraithai +!D5 U+0E35 saraiithai +!D6 U+0E36 sarauethai +!D7 U+0E37 saraueethai +!D8 U+0E38 sarauthai +!D9 U+0E39 sarauuthai +!DA U+0E3A phinthuthai +!DF U+0E3F bahtthai +!E0 U+0E40 saraethai +!E1 U+0E41 saraaethai +!E2 U+0E42 saraothai +!E3 U+0E43 saraaimaimuanthai +!E4 U+0E44 saraaimaimalaithai +!E5 U+0E45 lakkhangyaothai +!E6 U+0E46 maiyamokthai +!E7 U+0E47 maitaikhuthai +!E8 U+0E48 maiekthai +!E9 U+0E49 maithothai +!EA U+0E4A maitrithai +!EB U+0E4B maichattawathai +!EC U+0E4C thanthakhatthai +!ED U+0E4D nikhahitthai +!EE U+0E4E yamakkanthai +!EF U+0E4F fongmanthai +!F0 U+0E50 zerothai +!F1 U+0E51 onethai +!F2 U+0E52 twothai +!F3 U+0E53 threethai +!F4 U+0E54 fourthai +!F5 U+0E55 fivethai +!F6 U+0E56 sixthai +!F7 U+0E57 seventhai +!F8 U+0E58 eightthai +!F9 U+0E59 ninethai +!FA U+0E5A angkhankhuthai +!FB U+0E5B khomutthai diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-15.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-15.map new file mode 100644 index 0000000000000000000000000000000000000000..6c2b5712793d7eed6fec0f72e80ee3cd2ccf79ea --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-15.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+20AC Euro +!A5 U+00A5 yen +!A6 U+0160 Scaron +!A7 U+00A7 section +!A8 U+0161 scaron +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+017D Zcaron +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+017E zcaron +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+0152 OE +!BD U+0153 oe +!BE U+0178 Ydieresis +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+00D0 Eth +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+00DE Thorn +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+00F0 eth +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+00FE thorn +!FF U+00FF ydieresis diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-16.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-16.map new file mode 100644 index 0000000000000000000000000000000000000000..202c8fe594186cf762126b1265d7e2f73f7f92ac --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-16.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0104 Aogonek +!A2 U+0105 aogonek +!A3 U+0141 Lslash +!A4 U+20AC Euro +!A5 U+201E quotedblbase +!A6 U+0160 Scaron +!A7 U+00A7 section +!A8 U+0161 scaron +!A9 U+00A9 copyright +!AA U+0218 Scommaaccent +!AB U+00AB guillemotleft +!AC U+0179 Zacute +!AD U+00AD hyphen +!AE U+017A zacute +!AF U+017B Zdotaccent +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+010C Ccaron +!B3 U+0142 lslash +!B4 U+017D Zcaron +!B5 U+201D quotedblright +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+017E zcaron +!B9 U+010D ccaron +!BA U+0219 scommaaccent +!BB U+00BB guillemotright +!BC U+0152 OE +!BD U+0153 oe +!BE U+0178 Ydieresis +!BF U+017C zdotaccent +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+0102 Abreve +!C4 U+00C4 Adieresis +!C5 U+0106 Cacute +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+0110 Dcroat +!D1 U+0143 Nacute +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+0150 Ohungarumlaut +!D6 U+00D6 Odieresis +!D7 U+015A Sacute +!D8 U+0170 Uhungarumlaut +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+0118 Eogonek +!DE U+021A Tcommaaccent +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+0103 abreve +!E4 U+00E4 adieresis +!E5 U+0107 cacute +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+0111 dcroat +!F1 U+0144 nacute +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+0151 ohungarumlaut +!F6 U+00F6 odieresis +!F7 U+015B sacute +!F8 U+0171 uhungarumlaut +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+0119 eogonek +!FE U+021B tcommaaccent +!FF U+00FF ydieresis diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-2.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-2.map new file mode 100644 index 0000000000000000000000000000000000000000..65ae09f95819ca5841b87ffe81e0e9326318cd75 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-2.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0104 Aogonek +!A2 U+02D8 breve +!A3 U+0141 Lslash +!A4 U+00A4 currency +!A5 U+013D Lcaron +!A6 U+015A Sacute +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+0160 Scaron +!AA U+015E Scedilla +!AB U+0164 Tcaron +!AC U+0179 Zacute +!AD U+00AD hyphen +!AE U+017D Zcaron +!AF U+017B Zdotaccent +!B0 U+00B0 degree +!B1 U+0105 aogonek +!B2 U+02DB ogonek +!B3 U+0142 lslash +!B4 U+00B4 acute +!B5 U+013E lcaron +!B6 U+015B sacute +!B7 U+02C7 caron +!B8 U+00B8 cedilla +!B9 U+0161 scaron +!BA U+015F scedilla +!BB U+0165 tcaron +!BC U+017A zacute +!BD U+02DD hungarumlaut +!BE U+017E zcaron +!BF U+017C zdotaccent +!C0 U+0154 Racute +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+0102 Abreve +!C4 U+00C4 Adieresis +!C5 U+0139 Lacute +!C6 U+0106 Cacute +!C7 U+00C7 Ccedilla +!C8 U+010C Ccaron +!C9 U+00C9 Eacute +!CA U+0118 Eogonek +!CB U+00CB Edieresis +!CC U+011A Ecaron +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+010E Dcaron +!D0 U+0110 Dcroat +!D1 U+0143 Nacute +!D2 U+0147 Ncaron +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+0150 Ohungarumlaut +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+0158 Rcaron +!D9 U+016E Uring +!DA U+00DA Uacute +!DB U+0170 Uhungarumlaut +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+0162 Tcommaaccent +!DF U+00DF germandbls +!E0 U+0155 racute +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+0103 abreve +!E4 U+00E4 adieresis +!E5 U+013A lacute +!E6 U+0107 cacute +!E7 U+00E7 ccedilla +!E8 U+010D ccaron +!E9 U+00E9 eacute +!EA U+0119 eogonek +!EB U+00EB edieresis +!EC U+011B ecaron +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+010F dcaron +!F0 U+0111 dcroat +!F1 U+0144 nacute +!F2 U+0148 ncaron +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+0151 ohungarumlaut +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+0159 rcaron +!F9 U+016F uring +!FA U+00FA uacute +!FB U+0171 uhungarumlaut +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+0163 tcommaaccent +!FF U+02D9 dotaccent diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-4.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-4.map new file mode 100644 index 0000000000000000000000000000000000000000..a7d87bf3ef2a97e84de2aa4e1b46c4dbb9fec239 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-4.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0104 Aogonek +!A2 U+0138 kgreenlandic +!A3 U+0156 Rcommaaccent +!A4 U+00A4 currency +!A5 U+0128 Itilde +!A6 U+013B Lcommaaccent +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+0160 Scaron +!AA U+0112 Emacron +!AB U+0122 Gcommaaccent +!AC U+0166 Tbar +!AD U+00AD hyphen +!AE U+017D Zcaron +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+0105 aogonek +!B2 U+02DB ogonek +!B3 U+0157 rcommaaccent +!B4 U+00B4 acute +!B5 U+0129 itilde +!B6 U+013C lcommaaccent +!B7 U+02C7 caron +!B8 U+00B8 cedilla +!B9 U+0161 scaron +!BA U+0113 emacron +!BB U+0123 gcommaaccent +!BC U+0167 tbar +!BD U+014A Eng +!BE U+017E zcaron +!BF U+014B eng +!C0 U+0100 Amacron +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+012E Iogonek +!C8 U+010C Ccaron +!C9 U+00C9 Eacute +!CA U+0118 Eogonek +!CB U+00CB Edieresis +!CC U+0116 Edotaccent +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+012A Imacron +!D0 U+0110 Dcroat +!D1 U+0145 Ncommaaccent +!D2 U+014C Omacron +!D3 U+0136 Kcommaaccent +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+0172 Uogonek +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+0168 Utilde +!DE U+016A Umacron +!DF U+00DF germandbls +!E0 U+0101 amacron +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+012F iogonek +!E8 U+010D ccaron +!E9 U+00E9 eacute +!EA U+0119 eogonek +!EB U+00EB edieresis +!EC U+0117 edotaccent +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+012B imacron +!F0 U+0111 dcroat +!F1 U+0146 ncommaaccent +!F2 U+014D omacron +!F3 U+0137 kcommaaccent +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+0173 uogonek +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+0169 utilde +!FE U+016B umacron +!FF U+02D9 dotaccent diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-5.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-5.map new file mode 100644 index 0000000000000000000000000000000000000000..f9cd4edcf85de8e6206ff0ad32d64356101ce723 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-5.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+0401 afii10023 +!A2 U+0402 afii10051 +!A3 U+0403 afii10052 +!A4 U+0404 afii10053 +!A5 U+0405 afii10054 +!A6 U+0406 afii10055 +!A7 U+0407 afii10056 +!A8 U+0408 afii10057 +!A9 U+0409 afii10058 +!AA U+040A afii10059 +!AB U+040B afii10060 +!AC U+040C afii10061 +!AD U+00AD hyphen +!AE U+040E afii10062 +!AF U+040F afii10145 +!B0 U+0410 afii10017 +!B1 U+0411 afii10018 +!B2 U+0412 afii10019 +!B3 U+0413 afii10020 +!B4 U+0414 afii10021 +!B5 U+0415 afii10022 +!B6 U+0416 afii10024 +!B7 U+0417 afii10025 +!B8 U+0418 afii10026 +!B9 U+0419 afii10027 +!BA U+041A afii10028 +!BB U+041B afii10029 +!BC U+041C afii10030 +!BD U+041D afii10031 +!BE U+041E afii10032 +!BF U+041F afii10033 +!C0 U+0420 afii10034 +!C1 U+0421 afii10035 +!C2 U+0422 afii10036 +!C3 U+0423 afii10037 +!C4 U+0424 afii10038 +!C5 U+0425 afii10039 +!C6 U+0426 afii10040 +!C7 U+0427 afii10041 +!C8 U+0428 afii10042 +!C9 U+0429 afii10043 +!CA U+042A afii10044 +!CB U+042B afii10045 +!CC U+042C afii10046 +!CD U+042D afii10047 +!CE U+042E afii10048 +!CF U+042F afii10049 +!D0 U+0430 afii10065 +!D1 U+0431 afii10066 +!D2 U+0432 afii10067 +!D3 U+0433 afii10068 +!D4 U+0434 afii10069 +!D5 U+0435 afii10070 +!D6 U+0436 afii10072 +!D7 U+0437 afii10073 +!D8 U+0438 afii10074 +!D9 U+0439 afii10075 +!DA U+043A afii10076 +!DB U+043B afii10077 +!DC U+043C afii10078 +!DD U+043D afii10079 +!DE U+043E afii10080 +!DF U+043F afii10081 +!E0 U+0440 afii10082 +!E1 U+0441 afii10083 +!E2 U+0442 afii10084 +!E3 U+0443 afii10085 +!E4 U+0444 afii10086 +!E5 U+0445 afii10087 +!E6 U+0446 afii10088 +!E7 U+0447 afii10089 +!E8 U+0448 afii10090 +!E9 U+0449 afii10091 +!EA U+044A afii10092 +!EB U+044B afii10093 +!EC U+044C afii10094 +!ED U+044D afii10095 +!EE U+044E afii10096 +!EF U+044F afii10097 +!F0 U+2116 afii61352 +!F1 U+0451 afii10071 +!F2 U+0452 afii10099 +!F3 U+0453 afii10100 +!F4 U+0454 afii10101 +!F5 U+0455 afii10102 +!F6 U+0456 afii10103 +!F7 U+0457 afii10104 +!F8 U+0458 afii10105 +!F9 U+0459 afii10106 +!FA U+045A afii10107 +!FB U+045B afii10108 +!FC U+045C afii10109 +!FD U+00A7 section +!FE U+045E afii10110 +!FF U+045F afii10193 diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-7.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-7.map new file mode 100644 index 0000000000000000000000000000000000000000..e163796b1cad3004dc8f80315217c838a6df77aa --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-7.map @@ -0,0 +1,250 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+2018 quoteleft +!A2 U+2019 quoteright +!A3 U+00A3 sterling +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AF U+2015 afii00208 +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+0384 tonos +!B5 U+0385 dieresistonos +!B6 U+0386 Alphatonos +!B7 U+00B7 periodcentered +!B8 U+0388 Epsilontonos +!B9 U+0389 Etatonos +!BA U+038A Iotatonos +!BB U+00BB guillemotright +!BC U+038C Omicrontonos +!BD U+00BD onehalf +!BE U+038E Upsilontonos +!BF U+038F Omegatonos +!C0 U+0390 iotadieresistonos +!C1 U+0391 Alpha +!C2 U+0392 Beta +!C3 U+0393 Gamma +!C4 U+0394 Delta +!C5 U+0395 Epsilon +!C6 U+0396 Zeta +!C7 U+0397 Eta +!C8 U+0398 Theta +!C9 U+0399 Iota +!CA U+039A Kappa +!CB U+039B Lambda +!CC U+039C Mu +!CD U+039D Nu +!CE U+039E Xi +!CF U+039F Omicron +!D0 U+03A0 Pi +!D1 U+03A1 Rho +!D3 U+03A3 Sigma +!D4 U+03A4 Tau +!D5 U+03A5 Upsilon +!D6 U+03A6 Phi +!D7 U+03A7 Chi +!D8 U+03A8 Psi +!D9 U+03A9 Omega +!DA U+03AA Iotadieresis +!DB U+03AB Upsilondieresis +!DC U+03AC alphatonos +!DD U+03AD epsilontonos +!DE U+03AE etatonos +!DF U+03AF iotatonos +!E0 U+03B0 upsilondieresistonos +!E1 U+03B1 alpha +!E2 U+03B2 beta +!E3 U+03B3 gamma +!E4 U+03B4 delta +!E5 U+03B5 epsilon +!E6 U+03B6 zeta +!E7 U+03B7 eta +!E8 U+03B8 theta +!E9 U+03B9 iota +!EA U+03BA kappa +!EB U+03BB lambda +!EC U+03BC mu +!ED U+03BD nu +!EE U+03BE xi +!EF U+03BF omicron +!F0 U+03C0 pi +!F1 U+03C1 rho +!F2 U+03C2 sigma1 +!F3 U+03C3 sigma +!F4 U+03C4 tau +!F5 U+03C5 upsilon +!F6 U+03C6 phi +!F7 U+03C7 chi +!F8 U+03C8 psi +!F9 U+03C9 omega +!FA U+03CA iotadieresis +!FB U+03CB upsilondieresis +!FC U+03CC omicrontonos +!FD U+03CD upsilontonos +!FE U+03CE omegatonos diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-9.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-9.map new file mode 100644 index 0000000000000000000000000000000000000000..48c123ae6f6b6bee1186517e7d6557fb2fee8055 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/iso-8859-9.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+011E Gbreve +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+0130 Idotaccent +!DE U+015E Scedilla +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+011F gbreve +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+0131 dotlessi +!FE U+015F scedilla +!FF U+00FF ydieresis diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/koi8-r.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/koi8-r.map new file mode 100644 index 0000000000000000000000000000000000000000..6ad5d05d0dacf74138044384c23f319f830482ae --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/koi8-r.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+2500 SF100000 +!81 U+2502 SF110000 +!82 U+250C SF010000 +!83 U+2510 SF030000 +!84 U+2514 SF020000 +!85 U+2518 SF040000 +!86 U+251C SF080000 +!87 U+2524 SF090000 +!88 U+252C SF060000 +!89 U+2534 SF070000 +!8A U+253C SF050000 +!8B U+2580 upblock +!8C U+2584 dnblock +!8D U+2588 block +!8E U+258C lfblock +!8F U+2590 rtblock +!90 U+2591 ltshade +!91 U+2592 shade +!92 U+2593 dkshade +!93 U+2320 integraltp +!94 U+25A0 filledbox +!95 U+2219 periodcentered +!96 U+221A radical +!97 U+2248 approxequal +!98 U+2264 lessequal +!99 U+2265 greaterequal +!9A U+00A0 space +!9B U+2321 integralbt +!9C U+00B0 degree +!9D U+00B2 twosuperior +!9E U+00B7 periodcentered +!9F U+00F7 divide +!A0 U+2550 SF430000 +!A1 U+2551 SF240000 +!A2 U+2552 SF510000 +!A3 U+0451 afii10071 +!A4 U+2553 SF520000 +!A5 U+2554 SF390000 +!A6 U+2555 SF220000 +!A7 U+2556 SF210000 +!A8 U+2557 SF250000 +!A9 U+2558 SF500000 +!AA U+2559 SF490000 +!AB U+255A SF380000 +!AC U+255B SF280000 +!AD U+255C SF270000 +!AE U+255D SF260000 +!AF U+255E SF360000 +!B0 U+255F SF370000 +!B1 U+2560 SF420000 +!B2 U+2561 SF190000 +!B3 U+0401 afii10023 +!B4 U+2562 SF200000 +!B5 U+2563 SF230000 +!B6 U+2564 SF470000 +!B7 U+2565 SF480000 +!B8 U+2566 SF410000 +!B9 U+2567 SF450000 +!BA U+2568 SF460000 +!BB U+2569 SF400000 +!BC U+256A SF540000 +!BD U+256B SF530000 +!BE U+256C SF440000 +!BF U+00A9 copyright +!C0 U+044E afii10096 +!C1 U+0430 afii10065 +!C2 U+0431 afii10066 +!C3 U+0446 afii10088 +!C4 U+0434 afii10069 +!C5 U+0435 afii10070 +!C6 U+0444 afii10086 +!C7 U+0433 afii10068 +!C8 U+0445 afii10087 +!C9 U+0438 afii10074 +!CA U+0439 afii10075 +!CB U+043A afii10076 +!CC U+043B afii10077 +!CD U+043C afii10078 +!CE U+043D afii10079 +!CF U+043E afii10080 +!D0 U+043F afii10081 +!D1 U+044F afii10097 +!D2 U+0440 afii10082 +!D3 U+0441 afii10083 +!D4 U+0442 afii10084 +!D5 U+0443 afii10085 +!D6 U+0436 afii10072 +!D7 U+0432 afii10067 +!D8 U+044C afii10094 +!D9 U+044B afii10093 +!DA U+0437 afii10073 +!DB U+0448 afii10090 +!DC U+044D afii10095 +!DD U+0449 afii10091 +!DE U+0447 afii10089 +!DF U+044A afii10092 +!E0 U+042E afii10048 +!E1 U+0410 afii10017 +!E2 U+0411 afii10018 +!E3 U+0426 afii10040 +!E4 U+0414 afii10021 +!E5 U+0415 afii10022 +!E6 U+0424 afii10038 +!E7 U+0413 afii10020 +!E8 U+0425 afii10039 +!E9 U+0418 afii10026 +!EA U+0419 afii10027 +!EB U+041A afii10028 +!EC U+041B afii10029 +!ED U+041C afii10030 +!EE U+041D afii10031 +!EF U+041E afii10032 +!F0 U+041F afii10033 +!F1 U+042F afii10049 +!F2 U+0420 afii10034 +!F3 U+0421 afii10035 +!F4 U+0422 afii10036 +!F5 U+0423 afii10037 +!F6 U+0416 afii10024 +!F7 U+0412 afii10019 +!F8 U+042C afii10046 +!F9 U+042B afii10045 +!FA U+0417 afii10025 +!FB U+0428 afii10042 +!FC U+042D afii10047 +!FD U+0429 afii10043 +!FE U+0427 afii10041 +!FF U+042A afii10044 diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/koi8-u.map b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/koi8-u.map new file mode 100644 index 0000000000000000000000000000000000000000..40a7e4fd7e52a0433e42b5502cf4d9a23cf11e2e --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/koi8-u.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+2500 SF100000 +!81 U+2502 SF110000 +!82 U+250C SF010000 +!83 U+2510 SF030000 +!84 U+2514 SF020000 +!85 U+2518 SF040000 +!86 U+251C SF080000 +!87 U+2524 SF090000 +!88 U+252C SF060000 +!89 U+2534 SF070000 +!8A U+253C SF050000 +!8B U+2580 upblock +!8C U+2584 dnblock +!8D U+2588 block +!8E U+258C lfblock +!8F U+2590 rtblock +!90 U+2591 ltshade +!91 U+2592 shade +!92 U+2593 dkshade +!93 U+2320 integraltp +!94 U+25A0 filledbox +!95 U+2022 bullet +!96 U+221A radical +!97 U+2248 approxequal +!98 U+2264 lessequal +!99 U+2265 greaterequal +!9A U+00A0 space +!9B U+2321 integralbt +!9C U+00B0 degree +!9D U+00B2 twosuperior +!9E U+00B7 periodcentered +!9F U+00F7 divide +!A0 U+2550 SF430000 +!A1 U+2551 SF240000 +!A2 U+2552 SF510000 +!A3 U+0451 afii10071 +!A4 U+0454 afii10101 +!A5 U+2554 SF390000 +!A6 U+0456 afii10103 +!A7 U+0457 afii10104 +!A8 U+2557 SF250000 +!A9 U+2558 SF500000 +!AA U+2559 SF490000 +!AB U+255A SF380000 +!AC U+255B SF280000 +!AD U+0491 afii10098 +!AE U+255D SF260000 +!AF U+255E SF360000 +!B0 U+255F SF370000 +!B1 U+2560 SF420000 +!B2 U+2561 SF190000 +!B3 U+0401 afii10023 +!B4 U+0404 afii10053 +!B5 U+2563 SF230000 +!B6 U+0406 afii10055 +!B7 U+0407 afii10056 +!B8 U+2566 SF410000 +!B9 U+2567 SF450000 +!BA U+2568 SF460000 +!BB U+2569 SF400000 +!BC U+256A SF540000 +!BD U+0490 afii10050 +!BE U+256C SF440000 +!BF U+00A9 copyright +!C0 U+044E afii10096 +!C1 U+0430 afii10065 +!C2 U+0431 afii10066 +!C3 U+0446 afii10088 +!C4 U+0434 afii10069 +!C5 U+0435 afii10070 +!C6 U+0444 afii10086 +!C7 U+0433 afii10068 +!C8 U+0445 afii10087 +!C9 U+0438 afii10074 +!CA U+0439 afii10075 +!CB U+043A afii10076 +!CC U+043B afii10077 +!CD U+043C afii10078 +!CE U+043D afii10079 +!CF U+043E afii10080 +!D0 U+043F afii10081 +!D1 U+044F afii10097 +!D2 U+0440 afii10082 +!D3 U+0441 afii10083 +!D4 U+0442 afii10084 +!D5 U+0443 afii10085 +!D6 U+0436 afii10072 +!D7 U+0432 afii10067 +!D8 U+044C afii10094 +!D9 U+044B afii10093 +!DA U+0437 afii10073 +!DB U+0448 afii10090 +!DC U+044D afii10095 +!DD U+0449 afii10091 +!DE U+0447 afii10089 +!DF U+044A afii10092 +!E0 U+042E afii10048 +!E1 U+0410 afii10017 +!E2 U+0411 afii10018 +!E3 U+0426 afii10040 +!E4 U+0414 afii10021 +!E5 U+0415 afii10022 +!E6 U+0424 afii10038 +!E7 U+0413 afii10020 +!E8 U+0425 afii10039 +!E9 U+0418 afii10026 +!EA U+0419 afii10027 +!EB U+041A afii10028 +!EC U+041B afii10029 +!ED U+041C afii10030 +!EE U+041D afii10031 +!EF U+041E afii10032 +!F0 U+041F afii10033 +!F1 U+042F afii10049 +!F2 U+0420 afii10034 +!F3 U+0421 afii10035 +!F4 U+0422 afii10036 +!F5 U+0423 afii10037 +!F6 U+0416 afii10024 +!F7 U+0412 afii10019 +!F8 U+042C afii10046 +!F9 U+042B afii10045 +!FA U+0417 afii10025 +!FB U+0428 afii10042 +!FC U+042D afii10047 +!FD U+0429 afii10043 +!FE U+0427 afii10041 +!FF U+042A afii10044 diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/makefont.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/makefont.php new file mode 100644 index 0000000000000000000000000000000000000000..45e4bd7dd87205c270de7bdde4bc12c96e55af90 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/makefont/makefont.php @@ -0,0 +1,416 @@ +<?php +/******************************************************************************* +* Utility to generate font definition files * +* Version: 1.13 * +* Date: 2004-12-31 * +*******************************************************************************/ + +function ReadMap($enc) +{ + //Read a map file + $file=dirname(__FILE__).'/'.strtolower($enc).'.map'; + $a=file($file); + if(empty($a)) + die('<B>Error:</B> encoding not found: '.$enc); + $cc2gn=array(); + foreach($a as $l) + { + if($l{0}=='!') + { + $e=preg_split('/[ \\t]+/',rtrim($l)); + $cc=hexdec(substr($e[0],1)); + $gn=$e[2]; + $cc2gn[$cc]=$gn; + } + } + for($i=0;$i<=255;$i++) + { + if(!isset($cc2gn[$i])) + $cc2gn[$i]='.notdef'; + } + return $cc2gn; +} + +function ReadAFM($file,&$map) +{ + //Read a font metric file + $a=file($file); + if(empty($a)) + die('File not found'); + $widths=array(); + $fm=array(); + $fix=array('Edot'=>'Edotaccent','edot'=>'edotaccent','Idot'=>'Idotaccent','Zdot'=>'Zdotaccent','zdot'=>'zdotaccent', + 'Odblacute'=>'Ohungarumlaut','odblacute'=>'ohungarumlaut','Udblacute'=>'Uhungarumlaut','udblacute'=>'uhungarumlaut', + 'Gcedilla'=>'Gcommaaccent','gcedilla'=>'gcommaaccent','Kcedilla'=>'Kcommaaccent','kcedilla'=>'kcommaaccent', + 'Lcedilla'=>'Lcommaaccent','lcedilla'=>'lcommaaccent','Ncedilla'=>'Ncommaaccent','ncedilla'=>'ncommaaccent', + 'Rcedilla'=>'Rcommaaccent','rcedilla'=>'rcommaaccent','Scedilla'=>'Scommaaccent','scedilla'=>'scommaaccent', + 'Tcedilla'=>'Tcommaaccent','tcedilla'=>'tcommaaccent','Dslash'=>'Dcroat','dslash'=>'dcroat','Dmacron'=>'Dcroat','dmacron'=>'dcroat', + 'combininggraveaccent'=>'gravecomb','combininghookabove'=>'hookabovecomb','combiningtildeaccent'=>'tildecomb', + 'combiningacuteaccent'=>'acutecomb','combiningdotbelow'=>'dotbelowcomb','dongsign'=>'dong'); + foreach($a as $l) + { + $e=explode(' ',rtrim($l)); + if(count($e)<2) + continue; + $code=$e[0]; + $param=$e[1]; + if($code=='C') + { + //Character metrics + $cc=(int)$e[1]; + $w=$e[4]; + $gn=$e[7]; + if(substr($gn,-4)=='20AC') + $gn='Euro'; + if(isset($fix[$gn])) + { + //Fix incorrect glyph name + foreach($map as $c=>$n) + { + if($n==$fix[$gn]) + $map[$c]=$gn; + } + } + if(empty($map)) + { + //Symbolic font: use built-in encoding + $widths[$cc]=$w; + } + else + { + $widths[$gn]=$w; + if($gn=='X') + $fm['CapXHeight']=$e[13]; + } + if($gn=='.notdef') + $fm['MissingWidth']=$w; + } + elseif($code=='FontName') + $fm['FontName']=$param; + elseif($code=='Weight') + $fm['Weight']=$param; + elseif($code=='ItalicAngle') + $fm['ItalicAngle']=(double)$param; + elseif($code=='Ascender') + $fm['Ascender']=(int)$param; + elseif($code=='Descender') + $fm['Descender']=(int)$param; + elseif($code=='UnderlineThickness') + $fm['UnderlineThickness']=(int)$param; + elseif($code=='UnderlinePosition') + $fm['UnderlinePosition']=(int)$param; + elseif($code=='IsFixedPitch') + $fm['IsFixedPitch']=($param=='true'); + elseif($code=='FontBBox') + $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); + elseif($code=='CapHeight') + $fm['CapHeight']=(int)$param; + elseif($code=='StdVW') + $fm['StdVW']=(int)$param; + } + if(!isset($fm['FontName'])) + die('FontName not found'); + if(!empty($map)) + { + if(!isset($widths['.notdef'])) + $widths['.notdef']=600; + if(!isset($widths['Delta']) and isset($widths['increment'])) + $widths['Delta']=$widths['increment']; + //Order widths according to map + for($i=0;$i<=255;$i++) + { + if(!isset($widths[$map[$i]])) + { + echo '<B>Warning:</B> character '.$map[$i].' is missing<BR>'; + $widths[$i]=$widths['.notdef']; + } + else + $widths[$i]=$widths[$map[$i]]; + } + } + $fm['Widths']=$widths; + return $fm; +} + +function MakeFontDescriptor($fm,$symbolic) +{ + //Ascent + $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000); + $fd="array('Ascent'=>".$asc; + //Descent + $desc=(isset($fm['Descender']) ? $fm['Descender'] : -200); + $fd.=",'Descent'=>".$desc; + //CapHeight + if(isset($fm['CapHeight'])) + $ch=$fm['CapHeight']; + elseif(isset($fm['CapXHeight'])) + $ch=$fm['CapXHeight']; + else + $ch=$asc; + $fd.=",'CapHeight'=>".$ch; + //Flags + $flags=0; + if(isset($fm['IsFixedPitch']) and $fm['IsFixedPitch']) + $flags+=1<<0; + if($symbolic) + $flags+=1<<2; + if(!$symbolic) + $flags+=1<<5; + if(isset($fm['ItalicAngle']) and $fm['ItalicAngle']!=0) + $flags+=1<<6; + $fd.=",'Flags'=>".$flags; + //FontBBox + if(isset($fm['FontBBox'])) + $fbb=$fm['FontBBox']; + else + $fbb=array(0,$des-100,1000,$asc+100); + $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; + //ItalicAngle + $ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); + $fd.=",'ItalicAngle'=>".$ia; + //StemV + if(isset($fm['StdVW'])) + $stemv=$fm['StdVW']; + elseif(isset($fm['Weight']) and preg_match('/(bold|black)/i',$fm['Weight'])) + $stemv=120; + else + $stemv=70; + $fd.=",'StemV'=>".$stemv; + //MissingWidth + if(isset($fm['MissingWidth'])) + $fd.=",'MissingWidth'=>".$fm['MissingWidth']; + $fd.=')'; + return $fd; +} + +function MakeWidthArray($fm) +{ + //Make character width array + $s="array(\n\t"; + $cw=$fm['Widths']; + for($i=0;$i<=255;$i++) + { + if(chr($i)=="'") + $s.="'\\''"; + elseif(chr($i)=="\\") + $s.="'\\\\'"; + elseif($i>=32 and $i<=126) + $s.="'".chr($i)."'"; + else + $s.="chr($i)"; + $s.='=>'.$fm['Widths'][$i]; + if($i<255) + $s.=','; + if(($i+1)%22==0) + $s.="\n\t"; + } + $s.=')'; + return $s; +} + +function MakeFontEncoding($map) +{ + //Build differences from reference encoding + $ref=ReadMap('cp1252'); + $s=''; + $last=0; + for($i=32;$i<=255;$i++) + { + if($map[$i]!=$ref[$i]) + { + if($i!=$last+1) + $s.=$i.' '; + $last=$i; + $s.='/'.$map[$i].' '; + } + } + return rtrim($s); +} + +function SaveToFile($file,$s,$mode='t') +{ + $f=fopen($file,'w'.$mode); + if(!$f) + die('Can\'t write to file '.$file); + fwrite($f,$s,strlen($s)); + fclose($f); +} + +function ReadShort($f) +{ + $a=unpack('n1n',fread($f,2)); + return $a['n']; +} + +function ReadLong($f) +{ + $a=unpack('N1N',fread($f,4)); + return $a['N']; +} + +function CheckTTF($file) +{ + //Check if font license allows embedding + $f=fopen($file,'rb'); + if(!$f) + die('<B>Error:</B> Can\'t open '.$file); + //Extract number of tables + fseek($f,4,SEEK_CUR); + $nb=ReadShort($f); + fseek($f,6,SEEK_CUR); + //Seek OS/2 table + $found=false; + for($i=0;$i<$nb;$i++) + { + if(fread($f,4)=='OS/2') + { + $found=true; + break; + } + fseek($f,12,SEEK_CUR); + } + if(!$found) + { + fclose($f); + return; + } + fseek($f,4,SEEK_CUR); + $offset=ReadLong($f); + fseek($f,$offset,SEEK_SET); + //Extract fsType flags + fseek($f,8,SEEK_CUR); + $fsType=ReadShort($f); + $rl=($fsType & 0x02)!=0; + $pp=($fsType & 0x04)!=0; + $e=($fsType & 0x08)!=0; + fclose($f); + if($rl and !$pp and !$e) + echo '<B>Warning:</B> font license does not allow embedding'; +} + +/******************************************************************************* +* $fontfile : chemin du fichier TTF (ou chaîne vide si pas d'incorporation) * +* $afmfile : chemin du fichier AFM * +* $enc : encodage (ou chaîne vide si la police est symbolique) * +* $patch : patch optionnel pour l'encodage * +* $type : type de la police si $fontfile est vide * +*******************************************************************************/ +function MakeFont($fontfile,$afmfile,$enc='cp1252',$patch=array(),$type='TrueType') +{ + //Generate a font definition file + set_magic_quotes_runtime(0); + ini_set('auto_detect_line_endings','1'); + if($enc) + { + $map=ReadMap($enc); + foreach($patch as $cc=>$gn) + $map[$cc]=$gn; + } + else + $map=array(); + if(!file_exists($afmfile)) + die('<B>Error:</B> AFM file not found: '.$afmfile); + $fm=ReadAFM($afmfile,$map); + if($enc) + $diff=MakeFontEncoding($map); + else + $diff=''; + $fd=MakeFontDescriptor($fm,empty($map)); + //Find font type + if($fontfile) + { + $ext=strtolower(substr($fontfile,-3)); + if($ext=='ttf') + $type='TrueType'; + elseif($ext=='pfb') + $type='Type1'; + else + die('<B>Error:</B> unrecognized font file extension: '.$ext); + } + else + { + if($type!='TrueType' and $type!='Type1') + die('<B>Error:</B> incorrect font type: '.$type); + } + //Start generation + $s='<?php '."\n"; + $s.='$type=\''.$type."';\n"; + $s.='$name=\''.$fm['FontName']."';\n"; + $s.='$desc='.$fd.";\n"; + if(!isset($fm['UnderlinePosition'])) + $fm['UnderlinePosition']=-100; + if(!isset($fm['UnderlineThickness'])) + $fm['UnderlineThickness']=50; + $s.='$up='.$fm['UnderlinePosition'].";\n"; + $s.='$ut='.$fm['UnderlineThickness'].";\n"; + $w=MakeWidthArray($fm); + $s.='$cw='.$w.";\n"; + $s.='$enc=\''.$enc."';\n"; + $s.='$diff=\''.$diff."';\n"; + $basename=substr(basename($afmfile),0,-4); + if($fontfile) + { + //Embedded font + if(!file_exists($fontfile)) + die('<B>Error:</B> font file not found: '.$fontfile); + if($type=='TrueType') + CheckTTF($fontfile); + $f=fopen($fontfile,'rb'); + if(!$f) + die('<B>Error:</B> Can\'t open '.$fontfile); + $file=fread($f,filesize($fontfile)); + fclose($f); + if($type=='Type1') + { + //Find first two sections and discard third one + $header=(ord($file{0})==128); + if($header) + { + //Strip first binary header + $file=substr($file,6); + } + $pos=strpos($file,'eexec'); + if(!$pos) + die('<B>Error:</B> font file does not seem to be valid Type1'); + $size1=$pos+6; + if($header and ord($file{$size1})==128) + { + //Strip second binary header + $file=substr($file,0,$size1).substr($file,$size1+6); + } + $pos=strpos($file,'00000000'); + if(!$pos) + die('<B>Error:</B> font file does not seem to be valid Type1'); + $size2=$pos-$size1; + $file=substr($file,0,$size1+$size2); + } + if(function_exists('gzcompress')) + { + $cmp=$basename.'.z'; + SaveToFile($cmp,gzcompress($file),'b'); + $s.='$file=\''.$cmp."';\n"; + echo 'Font file compressed ('.$cmp.')<BR>'; + } + else + { + $s.='$file=\''.basename($fontfile)."';\n"; + echo '<B>Notice:</B> font file could not be compressed (zlib extension not available)<BR>'; + } + if($type=='Type1') + { + $s.='$size1='.$size1.";\n"; + $s.='$size2='.$size2.";\n"; + } + else + $s.='$originalsize='.filesize($fontfile).";\n"; + } + else + { + //Not embedded font + $s.='$file='."'';\n"; + } + $s.="?>\n"; + SaveToFile($basename.'.php',$s); + echo 'Font definition file generated ('.$basename.'.php'.')<BR>'; +} +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/symbol.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/symbol.php new file mode 100644 index 0000000000000000000000000000000000000000..ebf9cac4ed69d886e430b6941b0e7dc8df6eb7f8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/symbol.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['symbol']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, + ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, + 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, + 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, + 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, + chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, + chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, + chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, + chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, + chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/times.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/times.php new file mode 100644 index 0000000000000000000000000000000000000000..57d6336c45544c9b5ae7182c1f59b180de39408b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/times.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['times']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, + 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, + 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesb.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesb.php new file mode 100644 index 0000000000000000000000000000000000000000..04b530a155b47b60e5c8b854ec7a8dd0fb45d4c6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesb.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['timesB']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, + 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, + 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesbi.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesbi.php new file mode 100644 index 0000000000000000000000000000000000000000..eb0a6617985242f557fb32ed45e286faf40a8510 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesbi.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['timesBI']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, + 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, + 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesi.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesi.php new file mode 100644 index 0000000000000000000000000000000000000000..4be3faabe8da512c0fa82a08a74b82bb3dbe417b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/timesi.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['timesI']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, + 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, + 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/zapfdingbats.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/zapfdingbats.php new file mode 100644 index 0000000000000000000000000000000000000000..9c69cea2616dfc3d53debb5deb706a562bf377ed --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/font/zapfdingbats.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['zapfdingbats']=array( + chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, + chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, + ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, + 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, + 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, + 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, + chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, + chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, + chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, + chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, + chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf.css b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf.css new file mode 100644 index 0000000000000000000000000000000000000000..045a32e3722b6d458ff92e31fd4593c1eca136d0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf.css @@ -0,0 +1,11 @@ +BODY {font-family:times new roman,serif} +H2 {color:#4000A0} +P.demo {text-align:center; margin-top:-10px} +A.demo {text-decoration:none; font-weight:bold; color:#0000CC} +A.demo:link {text-decoration:none; font-weight:bold; color:#0000CC} +A.demo:hover {text-decoration:none; font-weight:bold; color:#0000FF} +A.demo:active {text-decoration:none; font-weight:bold; color:#0000FF} +.st {font-weight:bold; color:#900000} +.kw {color:#000080; font-weight:bold} +.str {color:#CC0000} +.cmt {color:#008000} diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf.php new file mode 100644 index 0000000000000000000000000000000000000000..6f718e619699ed7cc76b02671753d38ac7b8fc14 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf.php @@ -0,0 +1,1647 @@ +<?php +/******************************************************************************* +* Software: FPDF * +* Version: 1.53 * +* Date: 2004-12-31 * +* Author: Olivier PLATHEY * +* License: Freeware * +* * +* You may use, modify and redistribute this software as you wish. * +*******************************************************************************/ + +if(!class_exists('FPDF')) +{ +define('FPDF_VERSION','1.53'); + +class FPDF +{ +//Private properties +var $page; //current page number +var $n; //current object number +var $offsets; //array of object offsets +var $buffer; //buffer holding in-memory PDF +var $pages; //array containing pages +var $state; //current document state +var $compress; //compression flag +var $DefOrientation; //default orientation +var $CurOrientation; //current orientation +var $OrientationChanges; //array indicating orientation changes +var $k; //scale factor (number of points in user unit) +var $fwPt,$fhPt; //dimensions of page format in points +var $fw,$fh; //dimensions of page format in user unit +var $wPt,$hPt; //current dimensions of page in points +var $w,$h; //current dimensions of page in user unit +var $lMargin; //left margin +var $tMargin; //top margin +var $rMargin; //right margin +var $bMargin; //page break margin +var $cMargin; //cell margin +var $x,$y; //current position in user unit for cell positioning +var $lasth; //height of last cell printed +var $LineWidth; //line width in user unit +var $CoreFonts; //array of standard font names +var $fonts; //array of used fonts +var $FontFiles; //array of font files +var $diffs; //array of encoding differences +var $images; //array of used images +var $PageLinks; //array of links in pages +var $links; //array of internal links +var $FontFamily; //current font family +var $FontStyle; //current font style +var $underline; //underlining flag +var $CurrentFont; //current font info +var $FontSizePt; //current font size in points +var $FontSize; //current font size in user unit +var $DrawColor; //commands for drawing color +var $FillColor; //commands for filling color +var $TextColor; //commands for text color +var $ColorFlag; //indicates whether fill and text colors are different +var $ws; //word spacing +var $AutoPageBreak; //automatic page breaking +var $PageBreakTrigger; //threshold used to trigger page breaks +var $InFooter; //flag set when processing footer +var $ZoomMode; //zoom display mode +var $LayoutMode; //layout display mode +var $title; //title +var $subject; //subject +var $author; //author +var $keywords; //keywords +var $creator; //creator +var $AliasNbPages; //alias for total number of pages +var $PDFVersion; //PDF version number + +/******************************************************************************* +* * +* Public methods * +* * +*******************************************************************************/ +function FPDF($orientation='P',$unit='mm',$format='A4') +{ + //Some checks + $this->_dochecks(); + //Initialization of properties + $this->page=0; + $this->n=2; + $this->buffer=''; + $this->pages=array(); + $this->OrientationChanges=array(); + $this->state=0; + $this->fonts=array(); + $this->FontFiles=array(); + $this->diffs=array(); + $this->images=array(); + $this->links=array(); + $this->InFooter=false; + $this->lasth=0; + $this->FontFamily=''; + $this->FontStyle=''; + $this->FontSizePt=12; + $this->underline=false; + $this->DrawColor='0 G'; + $this->FillColor='0 g'; + $this->TextColor='0 g'; + $this->ColorFlag=false; + $this->ws=0; + //Standard fonts + $this->CoreFonts=array('courier'=>'Courier','courierB'=>'Courier-Bold','courierI'=>'Courier-Oblique','courierBI'=>'Courier-BoldOblique', + 'helvetica'=>'Helvetica','helveticaB'=>'Helvetica-Bold','helveticaI'=>'Helvetica-Oblique','helveticaBI'=>'Helvetica-BoldOblique', + 'times'=>'Times-Roman','timesB'=>'Times-Bold','timesI'=>'Times-Italic','timesBI'=>'Times-BoldItalic', + 'symbol'=>'Symbol','zapfdingbats'=>'ZapfDingbats'); + //Scale factor + if($unit=='pt') + $this->k=1; + elseif($unit=='mm') + $this->k=72/25.4; + elseif($unit=='cm') + $this->k=72/2.54; + elseif($unit=='in') + $this->k=72; + else + $this->Error('Incorrect unit: '.$unit); + //Page format + if(is_string($format)) + { + $format=strtolower($format); + if($format=='a3') + $format=array(841.89,1190.55); + elseif($format=='a4') + $format=array(595.28,841.89); + elseif($format=='a5') + $format=array(420.94,595.28); + elseif($format=='letter') + $format=array(612,792); + elseif($format=='legal') + $format=array(612,1008); + else + $this->Error('Unknown page format: '.$format); + $this->fwPt=$format[0]; + $this->fhPt=$format[1]; + } + else + { + $this->fwPt=$format[0]*$this->k; + $this->fhPt=$format[1]*$this->k; + } + $this->fw=$this->fwPt/$this->k; + $this->fh=$this->fhPt/$this->k; + //Page orientation + $orientation=strtolower($orientation); + if($orientation=='p' || $orientation=='portrait') + { + $this->DefOrientation='P'; + $this->wPt=$this->fwPt; + $this->hPt=$this->fhPt; + } + elseif($orientation=='l' || $orientation=='landscape') + { + $this->DefOrientation='L'; + $this->wPt=$this->fhPt; + $this->hPt=$this->fwPt; + } + else + $this->Error('Incorrect orientation: '.$orientation); + $this->CurOrientation=$this->DefOrientation; + $this->w=$this->wPt/$this->k; + $this->h=$this->hPt/$this->k; + //Page margins (1 cm) + $margin=28.35/$this->k; + $this->SetMargins($margin,$margin); + //Interior cell margin (1 mm) + $this->cMargin=$margin/10; + //Line width (0.2 mm) + $this->LineWidth=.567/$this->k; + //Automatic page break + $this->SetAutoPageBreak(true,2*$margin); + //Full width display mode + $this->SetDisplayMode('fullwidth'); + //Enable compression + $this->SetCompression(true); + //Set default PDF version number + $this->PDFVersion='1.3'; +} + +function SetMargins($left,$top,$right=-1) +{ + //Set left, top and right margins + $this->lMargin=$left; + $this->tMargin=$top; + if($right==-1) + $right=$left; + $this->rMargin=$right; +} + +function SetLeftMargin($margin) +{ + //Set left margin + $this->lMargin=$margin; + if($this->page>0 && $this->x<$margin) + $this->x=$margin; +} + +function SetTopMargin($margin) +{ + //Set top margin + $this->tMargin=$margin; +} + +function SetRightMargin($margin) +{ + //Set right margin + $this->rMargin=$margin; +} + +function SetAutoPageBreak($auto,$margin=0) +{ + //Set auto page break mode and triggering margin + $this->AutoPageBreak=$auto; + $this->bMargin=$margin; + $this->PageBreakTrigger=$this->h-$margin; +} + +function SetDisplayMode($zoom,$layout='continuous') +{ + //Set display mode in viewer + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) + $this->ZoomMode=$zoom; + else + $this->Error('Incorrect zoom display mode: '.$zoom); + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') + $this->LayoutMode=$layout; + else + $this->Error('Incorrect layout display mode: '.$layout); +} + +function SetCompression($compress) +{ + //Set page compression + if(function_exists('gzcompress')) + $this->compress=$compress; + else + $this->compress=false; +} + +function SetTitle($title) +{ + //Title of document + $this->title=$title; +} + +function SetSubject($subject) +{ + //Subject of document + $this->subject=$subject; +} + +function SetAuthor($author) +{ + //Author of document + $this->author=$author; +} + +function SetKeywords($keywords) +{ + //Keywords of document + $this->keywords=$keywords; +} + +function SetCreator($creator) +{ + //Creator of document + $this->creator=$creator; +} + +function AliasNbPages($alias='{nb}') +{ + //Define an alias for total number of pages + $this->AliasNbPages=$alias; +} + +function Error($msg) +{ + //Fatal error + die('<B>FPDF error: </B>'.$msg); +} + +function Open() +{ + //Begin document + $this->state=1; +} + +function Close() +{ + //Terminate document + if($this->state==3) + return; + if($this->page==0) + $this->AddPage(); + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + //Close document + $this->_enddoc(); +} + +function AddPage($orientation='') +{ + //Start a new page + if($this->state==0) + $this->Open(); + $family=$this->FontFamily; + $style=$this->FontStyle.($this->underline ? 'U' : ''); + $size=$this->FontSizePt; + $lw=$this->LineWidth; + $dc=$this->DrawColor; + $fc=$this->FillColor; + $tc=$this->TextColor; + $cf=$this->ColorFlag; + if($this->page>0) + { + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + } + //Start new page + $this->_beginpage($orientation); + //Set line cap style to square + $this->_out('2 J'); + //Set line width + $this->LineWidth=$lw; + $this->_out(sprintf('%.2f w',$lw*$this->k)); + //Set font + if($family) + $this->SetFont($family,$style,$size); + //Set colors + $this->DrawColor=$dc; + if($dc!='0 G') + $this->_out($dc); + $this->FillColor=$fc; + if($fc!='0 g') + $this->_out($fc); + $this->TextColor=$tc; + $this->ColorFlag=$cf; + //Page header + $this->Header(); + //Restore line width + if($this->LineWidth!=$lw) + { + $this->LineWidth=$lw; + $this->_out(sprintf('%.2f w',$lw*$this->k)); + } + //Restore font + if($family) + $this->SetFont($family,$style,$size); + //Restore colors + if($this->DrawColor!=$dc) + { + $this->DrawColor=$dc; + $this->_out($dc); + } + if($this->FillColor!=$fc) + { + $this->FillColor=$fc; + $this->_out($fc); + } + $this->TextColor=$tc; + $this->ColorFlag=$cf; +} + +function Header() +{ + //To be implemented in your own inherited class +} + +function Footer() +{ + //To be implemented in your own inherited class +} + +function PageNo() +{ + //Get current page number + return $this->page; +} + +function SetDrawColor($r,$g=-1,$b=-1) +{ + //Set color for all stroking operations + if(($r==0 && $g==0 && $b==0) || $g==-1) + $this->DrawColor=sprintf('%.3f G',$r/255); + else + $this->DrawColor=sprintf('%.3f %.3f %.3f RG',$r/255,$g/255,$b/255); + if($this->page>0) + $this->_out($this->DrawColor); +} + +function SetFillColor($r,$g=-1,$b=-1) +{ + //Set color for all filling operations + if(($r==0 && $g==0 && $b==0) || $g==-1) + $this->FillColor=sprintf('%.3f g',$r/255); + else + $this->FillColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); + if($this->page>0) + $this->_out($this->FillColor); +} + +function SetTextColor($r,$g=-1,$b=-1) +{ + //Set color for text + if(($r==0 && $g==0 && $b==0) || $g==-1) + $this->TextColor=sprintf('%.3f g',$r/255); + else + $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); +} + +function GetStringWidth($s) +{ + //Get width of a string in the current font + $s=(string)$s; + $cw=&$this->CurrentFont['cw']; + $w=0; + $l=strlen($s); + for($i=0;$i<$l;$i++) + $w+=$cw[$s{$i}]; + return $w*$this->FontSize/1000; +} + +function SetLineWidth($width) +{ + //Set line width + $this->LineWidth=$width; + if($this->page>0) + $this->_out(sprintf('%.2f w',$width*$this->k)); +} + +function Line($x1,$y1,$x2,$y2) +{ + //Draw a line + $this->_out(sprintf('%.2f %.2f m %.2f %.2f l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); +} + +function Rect($x,$y,$w,$h,$style='') +{ + //Draw a rectangle + if($style=='F') + $op='f'; + elseif($style=='FD' || $style=='DF') + $op='B'; + else + $op='S'; + $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); +} + +function AddFont($family,$style='',$file='') +{ + //Add a TrueType or Type1 font + $family=strtolower($family); + if($file=='') + $file=str_replace(' ','',$family).strtolower($style).'.php'; + if($family=='arial') + $family='helvetica'; + $style=strtoupper($style); + if($style=='IB') + $style='BI'; + $fontkey=$family.$style; + if(isset($this->fonts[$fontkey])) + $this->Error('Font already added: '.$family.' '.$style); + include($this->_getfontpath().$file); + if(!isset($name)) + $this->Error('Could not include font definition file'); + $i=count($this->fonts)+1; + $this->fonts[$fontkey]=array('i'=>$i,'type'=>$type,'name'=>$name,'desc'=>$desc,'up'=>$up,'ut'=>$ut,'cw'=>$cw,'enc'=>$enc,'file'=>$file); + if($diff) + { + //Search existing encodings + $d=0; + $nb=count($this->diffs); + for($i=1;$i<=$nb;$i++) + { + if($this->diffs[$i]==$diff) + { + $d=$i; + break; + } + } + if($d==0) + { + $d=$nb+1; + $this->diffs[$d]=$diff; + } + $this->fonts[$fontkey]['diff']=$d; + } + if($file) + { + if($type=='TrueType') + $this->FontFiles[$file]=array('length1'=>$originalsize); + else + $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2); + } +} + +function SetFont($family,$style='',$size=0) +{ + //Select a font; size given in points + global $fpdf_charwidths; + + $family=strtolower($family); + if($family=='') + $family=$this->FontFamily; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' || $family=='zapfdingbats') + $style=''; + $style=strtoupper($style); + if(strpos($style,'U')!==false) + { + $this->underline=true; + $style=str_replace('U','',$style); + } + else + $this->underline=false; + if($style=='IB') + $style='BI'; + if($size==0) + $size=$this->FontSizePt; + //Test if font is already selected + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) + return; + //Test if used for the first time + $fontkey=$family.$style; + if(!isset($this->fonts[$fontkey])) + { + //Check if one of the standard fonts + if(isset($this->CoreFonts[$fontkey])) + { + if(!isset($fpdf_charwidths[$fontkey])) + { + //Load metric file + $file=$family; + if($family=='times' || $family=='helvetica') + $file.=strtolower($style); + include($this->_getfontpath().$file.'.php'); + if(!isset($fpdf_charwidths[$fontkey])) + $this->Error('Could not include font metric file'); + } + $i=count($this->fonts)+1; + $this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + //Select it + $this->FontFamily=$family; + $this->FontStyle=$style; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + $this->CurrentFont=&$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function SetFontSize($size) +{ + //Set font size in points + if($this->FontSizePt==$size) + return; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function AddLink() +{ + //Create a new internal link + $n=count($this->links)+1; + $this->links[$n]=array(0,0); + return $n; +} + +function SetLink($link,$y=0,$page=-1) +{ + //Set destination of internal link + if($y==-1) + $y=$this->y; + if($page==-1) + $page=$this->page; + $this->links[$link]=array($page,$y); +} + +function Link($x,$y,$w,$h,$link) +{ + //Put a link on the page + $this->PageLinks[$this->page][]=array($x*$this->k,$this->hPt-$y*$this->k,$w*$this->k,$h*$this->k,$link); +} + +function Text($x,$y,$txt) +{ + //Output a string + $s=sprintf('BT %.2f %.2f Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); + if($this->underline && $txt!='') + $s.=' '.$this->_dounderline($x,$y,$txt); + if($this->ColorFlag) + $s='q '.$this->TextColor.' '.$s.' Q'; + $this->_out($s); +} + +function AcceptPageBreak() +{ + //Accept automatic page break or not + return $this->AutoPageBreak; +} + +function Cell($w,$h=0,$txt='',$border=0,$ln=0,$align='',$fill=0,$link='') +{ + //Output a cell + $k=$this->k; + if($this->y+$h>$this->PageBreakTrigger && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x=$this->x; + $ws=$this->ws; + if($ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->AddPage($this->CurOrientation); + $this->x=$x; + if($ws>0) + { + $this->ws=$ws; + $this->_out(sprintf('%.3f Tw',$ws*$k)); + } + } + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $s=''; + if($fill==1 || $border==1) + { + if($fill==1) + $op=($border==1) ? 'B' : 'f'; + else + $op='S'; + $s=sprintf('%.2f %.2f %.2f %.2f re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); + } + if(is_string($border)) + { + $x=$this->x; + $y=$this->y; + if(strpos($border,'L')!==false) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); + if(strpos($border,'T')!==false) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); + if(strpos($border,'R')!==false) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + if(strpos($border,'B')!==false) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + } + if($txt!=='') + { + if($align=='R') + $dx=$w-$this->cMargin-$this->GetStringWidth($txt); + elseif($align=='C') + $dx=($w-$this->GetStringWidth($txt))/2; + else + $dx=$this->cMargin; + if($this->ColorFlag) + $s.='q '.$this->TextColor.' '; + $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + $s.=sprintf('BT %.2f %.2f Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); + if($this->underline) + $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->ColorFlag) + $s.=' Q'; + if($link) + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); + } + if($s) + $this->_out($s); + $this->lasth=$h; + if($ln>0) + { + //Go to next line + $this->y+=$h; + if($ln==1) + $this->x=$this->lMargin; + } + else + $this->x+=$w; +} + +function MultiCell($w,$h,$txt,$border=0,$align='J',$fill=0) +{ + //Output text with automatic or explicit line breaks + $cw=&$this->CurrentFont['cw']; + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + if($nb>0 && $s[$nb-1]=="\n") + $nb--; + $b=0; + if($border) + { + if($border==1) + { + $border='LTRB'; + $b='LRT'; + $b2='LR'; + } + else + { + $b2=''; + if(strpos($border,'L')!==false) + $b2.='L'; + if(strpos($border,'R')!==false) + $b2.='R'; + $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; + } + } + $sep=-1; + $i=0; + $j=0; + $l=0; + $ns=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s{$i}; + if($c=="\n") + { + //Explicit line break + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $i++; + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + continue; + } + if($c==' ') + { + $sep=$i; + $ls=$l; + $ns++; + } + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($i==$j) + $i++; + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + } + else + { + if($align=='J') + { + $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); + } + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + } + else + $i++; + } + //Last chunk + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + if($border && strpos($border,'B')!==false) + $b.='B'; + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $this->x=$this->lMargin; +} + +function Write($h,$txt,$link='') +{ + //Output text in flowing mode + $cw=&$this->CurrentFont['cw']; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + $sep=-1; + $i=0; + $j=0; + $l=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s{$i}; + if($c=="\n") + { + //Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $i++; + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + continue; + } + if($c==' ') + $sep=$i; + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($this->x>$this->lMargin) + { + //Move to next line + $this->x=$this->lMargin; + $this->y+=$h; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $i++; + $nl++; + continue; + } + if($i==$j) + $i++; + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + } + else + $i++; + } + //Last chunk + if($i!=$j) + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); +} + +function Image($file,$x,$y,$w=0,$h=0,$type='',$link='') +{ + //Put an image on the page + if(!isset($this->images[$file])) + { + //First use of image, get info + if($type=='') + { + $pos=strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type=substr($file,$pos+1); + } + $type=strtolower($type); + $mqr=get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + if($type=='jpg' || $type=='jpeg') + $info=$this->_parsejpg($file); + elseif($type=='png') + $info=$this->_parsepng($file); + else + { + //Allow for additional formats + $mtd='_parse'.$type; + if(!method_exists($this,$mtd)) + $this->Error('Unsupported image type: '.$type); + $info=$this->$mtd($file); + } + set_magic_quotes_runtime($mqr); + $info['i']=count($this->images)+1; + $this->images[$file]=$info; + } + else + $info=$this->images[$file]; + //Automatic width and height calculation if needed + if($w==0 && $h==0) + { + //Put image at 72 dpi + $w=$info['w']/$this->k; + $h=$info['h']/$this->k; + } + if($w==0) + $w=$h*$info['w']/$info['h']; + if($h==0) + $h=$w*$info['h']/$info['w']; + $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) + $this->Link($x,$y,$w,$h,$link); +} + +function Ln($h='') +{ + //Line feed; default value is last cell height + $this->x=$this->lMargin; + if(is_string($h)) + $this->y+=$this->lasth; + else + $this->y+=$h; +} + +function GetX() +{ + //Get x position + return $this->x; +} + +function SetX($x) +{ + //Set x position + if($x>=0) + $this->x=$x; + else + $this->x=$this->w+$x; +} + +function GetY() +{ + //Get y position + return $this->y; +} + +function SetY($y) +{ + //Set y position and reset x + $this->x=$this->lMargin; + if($y>=0) + $this->y=$y; + else + $this->y=$this->h+$y; +} + +function SetXY($x,$y) +{ + //Set x and y positions + $this->SetY($y); + $this->SetX($x); +} + +function Output($name='',$dest='') +{ + //Output PDF to some destination + //Finish document if necessary + if($this->state<3) + $this->Close(); + //Normalize parameters + if(is_bool($dest)) + $dest=$dest ? 'D' : 'F'; + $dest=strtoupper($dest); + if($dest=='') + { + if($name=='') + { + $name='doc.pdf'; + $dest='I'; + } + else + $dest='F'; + } + switch($dest) + { + case 'I': + //Send to standard output + if(ob_get_contents()) + $this->Error('Some data has already been output, can\'t send PDF file'); + if(php_sapi_name()!='cli') + { + //We send to a browser + header('Content-Type: application/pdf'); + if(headers_sent()) + $this->Error('Some data has already been output to browser, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-disposition: inline; filename="'.$name.'"'); + } + echo $this->buffer; + break; + case 'D': + //Download file + if(ob_get_contents()) + $this->Error('Some data has already been output, can\'t send PDF file'); + if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) + header('Content-Type: application/force-download'); + else + header('Content-Type: application/octet-stream'); + if(headers_sent()) + $this->Error('Some data has already been output to browser, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-disposition: attachment; filename="'.$name.'"'); + echo $this->buffer; + break; + case 'F': + //Save to local file + $f=fopen($name,'wb'); + if(!$f) + $this->Error('Unable to create output file: '.$name); + fwrite($f,$this->buffer,strlen($this->buffer)); + fclose($f); + break; + case 'S': + //Return as a string + return $this->buffer; + default: + $this->Error('Incorrect output destination: '.$dest); + } + return ''; +} + +/******************************************************************************* +* * +* Protected methods * +* * +*******************************************************************************/ +function _dochecks() +{ + //Check for locale-related bug + if(1.1==1) + $this->Error('Don\'t alter the locale before including class file'); + //Check for decimal separator + if(sprintf('%.1f',1.0)!='1.0') + setlocale(LC_NUMERIC,'C'); +} + +function _getfontpath() +{ + if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) + define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); + return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; +} + +function _putpages() +{ + $nb=$this->page; + if(!empty($this->AliasNbPages)) + { + //Replace number of pages + for($n=1;$n<=$nb;$n++) + $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); + } + if($this->DefOrientation=='P') + { + $wPt=$this->fwPt; + $hPt=$this->fhPt; + } + else + { + $wPt=$this->fhPt; + $hPt=$this->fwPt; + } + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + for($n=1;$n<=$nb;$n++) + { + //Page + $this->_newobj(); + $this->_out('<</Type /Page'); + $this->_out('/Parent 1 0 R'); + if(isset($this->OrientationChanges[$n])) + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt)); + $this->_out('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) + { + //Links + $annots='/Annots ['; + foreach($this->PageLinks[$n] as $pl) + { + $rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; + if(is_string($pl[4])) + $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; + else + { + $l=$this->links[$pl[4]]; + $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; + $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k); + } + } + $this->_out($annots.']'); + } + $this->_out('/Contents '.($this->n+1).' 0 R>>'); + $this->_out('endobj'); + //Page content + $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); + $this->_putstream($p); + $this->_out('endobj'); + } + //Pages root + $this->offsets[1]=strlen($this->buffer); + $this->_out('1 0 obj'); + $this->_out('<</Type /Pages'); + $kids='/Kids ['; + for($i=0;$i<$nb;$i++) + $kids.=(3+2*$i).' 0 R '; + $this->_out($kids.']'); + $this->_out('/Count '.$nb); + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt)); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putfonts() +{ + $nf=$this->n; + foreach($this->diffs as $diff) + { + //Encodings + $this->_newobj(); + $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); + $this->_out('endobj'); + } + $mqr=get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + foreach($this->FontFiles as $file=>$info) + { + //Font file embedding + $this->_newobj(); + $this->FontFiles[$file]['n']=$this->n; + $font=''; + $f=fopen($this->_getfontpath().$file,'rb',1); + if(!$f) + $this->Error('Font file not found'); + while(!feof($f)) + $font.=fread($f,8192); + fclose($f); + $compressed=(substr($file,-2)=='.z'); + if(!$compressed && isset($info['length2'])) + { + $header=(ord($font{0})==128); + if($header) + { + //Strip first binary header + $font=substr($font,6); + } + if($header && ord($font{$info['length1']})==128) + { + //Strip second binary header + $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); + } + } + $this->_out('<</Length '.strlen($font)); + if($compressed) + $this->_out('/Filter /FlateDecode'); + $this->_out('/Length1 '.$info['length1']); + if(isset($info['length2'])) + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); + $this->_out('>>'); + $this->_putstream($font); + $this->_out('endobj'); + } + set_magic_quotes_runtime($mqr); + foreach($this->fonts as $k=>$font) + { + //Font objects + $this->fonts[$k]['n']=$this->n+1; + $type=$font['type']; + $name=$font['name']; + if($type=='core') + { + //Standard font + $this->_newobj(); + $this->_out('<</Type /Font'); + $this->_out('/BaseFont /'.$name); + $this->_out('/Subtype /Type1'); + if($name!='Symbol' && $name!='ZapfDingbats') + $this->_out('/Encoding /WinAnsiEncoding'); + $this->_out('>>'); + $this->_out('endobj'); + } + elseif($type=='Type1' || $type=='TrueType') + { + //Additional Type1 or TrueType font + $this->_newobj(); + $this->_out('<</Type /Font'); + $this->_out('/BaseFont /'.$name); + $this->_out('/Subtype /'.$type); + $this->_out('/FirstChar 32 /LastChar 255'); + $this->_out('/Widths '.($this->n+1).' 0 R'); + $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); + if($font['enc']) + { + if(isset($font['diff'])) + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); + else + $this->_out('/Encoding /WinAnsiEncoding'); + } + $this->_out('>>'); + $this->_out('endobj'); + //Widths + $this->_newobj(); + $cw=&$font['cw']; + $s='['; + for($i=32;$i<=255;$i++) + $s.=$cw[chr($i)].' '; + $this->_out($s.']'); + $this->_out('endobj'); + //Descriptor + $this->_newobj(); + $s='<</Type /FontDescriptor /FontName /'.$name; + foreach($font['desc'] as $k=>$v) + $s.=' /'.$k.' '.$v; + $file=$font['file']; + if($file) + $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; + $this->_out($s.'>>'); + $this->_out('endobj'); + } + else + { + //Allow for additional types + $mtd='_put'.strtolower($type); + if(!method_exists($this,$mtd)) + $this->Error('Unsupported font type: '.$type); + $this->$mtd($font); + } + } +} + +function _putimages() +{ + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->images); + while(list($file,$info)=each($this->images)) + { + $this->_newobj(); + $this->images[$file]['n']=$this->n; + $this->_out('<</Type /XObject'); + $this->_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + if(isset($info['f'])) + $this->_out('/Filter /'.$info['f']); + if(isset($info['parms'])) + $this->_out($info['parms']); + if(isset($info['trns']) && is_array($info['trns'])) + { + $trns=''; + for($i=0;$i<count($info['trns']);$i++) + $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; + $this->_out('/Mask ['.$trns.']'); + } + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + unset($this->images[$file]['data']); + $this->_out('endobj'); + //Palette + if($info['cs']=='Indexed') + { + $this->_newobj(); + $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } + } +} + +function _putxobjectdict() +{ + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); +} + +function _putresourcedict() +{ + $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + $this->_out('/XObject <<'); + $this->_putxobjectdict(); + $this->_out('>>'); +} + +function _putresources() +{ + $this->_putfonts(); + $this->_putimages(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<<'); + $this->_putresourcedict(); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putinfo() +{ + $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); + if(!empty($this->title)) + $this->_out('/Title '.$this->_textstring($this->title)); + if(!empty($this->subject)) + $this->_out('/Subject '.$this->_textstring($this->subject)); + if(!empty($this->author)) + $this->_out('/Author '.$this->_textstring($this->author)); + if(!empty($this->keywords)) + $this->_out('/Keywords '.$this->_textstring($this->keywords)); + if(!empty($this->creator)) + $this->_out('/Creator '.$this->_textstring($this->creator)); + $this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis'))); +} + +function _putcatalog() +{ + $this->_out('/Type /Catalog'); + $this->_out('/Pages 1 0 R'); + if($this->ZoomMode=='fullpage') + $this->_out('/OpenAction [3 0 R /Fit]'); + elseif($this->ZoomMode=='fullwidth') + $this->_out('/OpenAction [3 0 R /FitH null]'); + elseif($this->ZoomMode=='real') + $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); + elseif(!is_string($this->ZoomMode)) + $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); + if($this->LayoutMode=='single') + $this->_out('/PageLayout /SinglePage'); + elseif($this->LayoutMode=='continuous') + $this->_out('/PageLayout /OneColumn'); + elseif($this->LayoutMode=='two') + $this->_out('/PageLayout /TwoColumnLeft'); +} + +function _putheader() +{ + $this->_out('%PDF-'.$this->PDFVersion); +} + +function _puttrailer() +{ + $this->_out('/Size '.($this->n+1)); + $this->_out('/Root '.$this->n.' 0 R'); + $this->_out('/Info '.($this->n-1).' 0 R'); +} + +function _enddoc() +{ + $this->_putheader(); + $this->_putpages(); + $this->_putresources(); + //Info + $this->_newobj(); + $this->_out('<<'); + $this->_putinfo(); + $this->_out('>>'); + $this->_out('endobj'); + //Catalog + $this->_newobj(); + $this->_out('<<'); + $this->_putcatalog(); + $this->_out('>>'); + $this->_out('endobj'); + //Cross-ref + $o=strlen($this->buffer); + $this->_out('xref'); + $this->_out('0 '.($this->n+1)); + $this->_out('0000000000 65535 f '); + for($i=1;$i<=$this->n;$i++) + $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); + //Trailer + $this->_out('trailer'); + $this->_out('<<'); + $this->_puttrailer(); + $this->_out('>>'); + $this->_out('startxref'); + $this->_out($o); + $this->_out('%%EOF'); + $this->state=3; +} + +function _beginpage($orientation) +{ + $this->page++; + $this->pages[$this->page]=''; + $this->state=2; + $this->x=$this->lMargin; + $this->y=$this->tMargin; + $this->FontFamily=''; + //Page orientation + if(!$orientation) + $orientation=$this->DefOrientation; + else + { + $orientation=strtoupper($orientation{0}); + if($orientation!=$this->DefOrientation) + $this->OrientationChanges[$this->page]=true; + } + if($orientation!=$this->CurOrientation) + { + //Change orientation + if($orientation=='P') + { + $this->wPt=$this->fwPt; + $this->hPt=$this->fhPt; + $this->w=$this->fw; + $this->h=$this->fh; + } + else + { + $this->wPt=$this->fhPt; + $this->hPt=$this->fwPt; + $this->w=$this->fh; + $this->h=$this->fw; + } + $this->PageBreakTrigger=$this->h-$this->bMargin; + $this->CurOrientation=$orientation; + } +} + +function _endpage() +{ + //End of page contents + $this->state=1; +} + +function _newobj() +{ + //Begin a new object + $this->n++; + $this->offsets[$this->n]=strlen($this->buffer); + $this->_out($this->n.' 0 obj'); +} + +function _dounderline($x,$y,$txt) +{ + //Underline text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); + return sprintf('%.2f %.2f %.2f %.2f re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); +} + +function _parsejpg($file) +{ + //Extract info from a JPEG file + $a=GetImageSize($file); + if(!$a) + $this->Error('Missing or incorrect image file: '.$file); + if($a[2]!=2) + $this->Error('Not a JPEG file: '.$file); + if(!isset($a['channels']) || $a['channels']==3) + $colspace='DeviceRGB'; + elseif($a['channels']==4) + $colspace='DeviceCMYK'; + else + $colspace='DeviceGray'; + $bpc=isset($a['bits']) ? $a['bits'] : 8; + //Read whole file + $f=fopen($file,'rb'); + $data=''; + while(!feof($f)) + $data.=fread($f,4096); + fclose($f); + return array('w'=>$a[0],'h'=>$a[1],'cs'=>$colspace,'bpc'=>$bpc,'f'=>'DCTDecode','data'=>$data); +} + +function _parsepng($file) +{ + //Extract info from a PNG file + $f=fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + //Check signature + if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + fread($f,4); + if(fread($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w=$this->_freadint($f); + $h=$this->_freadint($f); + $bpc=ord(fread($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct=ord(fread($f,1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else + $this->Error('Alpha channel not supported: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + fread($f,4); + $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_freadint($f); + $type=fread($f,4); + if($type=='PLTE') + { + //Read palette + $pal=fread($f,$n); + fread($f,4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=fread($f,$n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if($pos!==false) + $trns=array($pos); + } + fread($f,4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=fread($f,$n); + fread($f,4); + } + elseif($type=='IEND') + break; + else + fread($f,$n+4); + } + while($n); + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + fclose($f); + return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data); +} + +function _freadint($f) +{ + //Read a 4-byte integer from file + $a=unpack('Ni',fread($f,4)); + return $a['i']; +} + +function _textstring($s) +{ + //Format a text string + return '('.$this->_escape($s).')'; +} + +function _escape($s) +{ + //Add \ before \, ( and ) + return str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$s))); +} + +function _putstream($s) +{ + $this->_out('stream'); + $this->_out($s); + $this->_out('endstream'); +} + +function _out($s) +{ + //Add a line to the document + if($this->state==2) + $this->pages[$this->page].=$s."\n"; + else + $this->buffer.=$s."\n"; +} +//End of class +} + +//Handle special IE contype request +if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') +{ + header('Content-Type: application/pdf'); + exit; +} + +} +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf_tpl.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf_tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..118cc3a1b52e7d2c8cf044d3580e347d35cae893 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdf_tpl.php @@ -0,0 +1,447 @@ +<?php +// +// fpdf_tpl - Version 1.0.2 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +require_once("fpdf.php"); + +class fpdf_tpl extends fpdf { + /** + * Array of Tpl-Data + * @var array + */ + var $tpls = array(); + + /** + * Current Template-ID + * @var int + */ + var $tpl = 0; + + /** + * "In Template"-Flag + * @var boolean + */ + var $intpl = false; + + /** + * Nameprefix of Templates used in Resources-Dictonary + * @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an / + */ + var $tplprefix = "/TPL"; + + /** + * Nameprefix of Fonts used in Resources-Dictonary + * (not realy needed, but for future versions with import-function needed) + * @var string + */ + var $fontprefix = "/F"; + + /** + * Resources used By Templates and Pages + * @var array + */ + var $res = array(); + + /** + * Constructor + * See FPDF-Documentation + * @param string $orientation + * @param string $unit + * @param mixed $format + */ + function fpdf_tpl($orientation='P',$unit='mm',$format='A4') { + parent::fpdf($orientation,$unit,$format); + } + + /** + * Start a Template + * + * This method starts a template. You can give own coordinates to build an own sized + * Template. Pay attention, that the margins are adapted to the new templatesize. + * If you want to write outside the template, for example to build a clipped Template, + * you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call. + * + * If no parameter is given, the template uses the current page-size. + * The Method returns an ID of the current Template. This ID is used later for using this template. + * Warning: A created Template is used in PDF at all events. Still if you don't use it after creation! + * + * @param int $x The x-coordinate given in user-unit + * @param int $y The y-coordinate given in user-unit + * @param int $w The width given in user-unit + * @param int $h The height given in user-unit + * @return int The ID of new created Template + */ + function beginTemplate($x=null,$y=null,$w=null,$h=null) { + if ($this->page <= 0) + $this->error("You have to add a page to fpdf first!"); + + // Save settings + $this->tpl++; + $this->tpls[$this->tpl]['o_x'] = $this->x; + $this->tpls[$this->tpl]['o_y'] = $this->y; + $this->tpls[$this->tpl]['o_AutoPageBreak'] = $this->AutoPageBreak; + $this->tpls[$this->tpl]['o_bMargin'] = $this->bMargin; + $this->tpls[$this->tpl]['o_tMargin'] = $this->tMargin; + $this->tpls[$this->tpl]['o_lMargin'] = $this->lMargin; + $this->tpls[$this->tpl]['o_rMargin'] = $this->rMargin; + $this->tpls[$this->tpl]['o_h'] = $this->h; + $this->tpls[$this->tpl]['o_w'] = $this->w; + + $this->SetAutoPageBreak(false); + + if ($x == null) + $x = 0; + if ($y == null) + $y = 0; + if ($w == null) + $w = $this->w; + if ($h == null) + $h = $this->h; + + // Define own high and width to calculate possitions correct + $this->h = $h; + $this->w = $w; + + $this->tpls[$this->tpl]['buffer'] = ""; + $this->tpls[$this->tpl]['x'] = $x; + $this->tpls[$this->tpl]['y'] = $y; + $this->tpls[$this->tpl]['w'] = $w; + $this->tpls[$this->tpl]['h'] = $h; + + $this->intpl = true; + $this->SetXY($x+$this->lMargin,$y+$this->tMargin); + $this->SetRightMargin($this->w-$w+$this->rMargin); + + return $this->tpl; + } + + /** + * End Template + * + * This method ends a template and reset initiated variables on beginTemplate. + * + * @return mixed If a template is opened, the ID is returned. If not a false is returned. + */ + function endTemplate() { + if ($this->intpl) { + $this->intpl = false; + $this->SetAutoPageBreak($this->tpls[$this->tpl]['o_AutoPageBreak'],$this->tpls[$this->tpl]['o_bMargin']); + $this->SetXY($this->tpls[$this->tpl]['o_x'],$this->tpls[$this->tpl]['o_y']); + $this->tMargin = $this->tpls[$this->tpl]['o_tMargin']; + $this->lMargin = $this->tpls[$this->tpl]['o_lMargin']; + $this->rMargin = $this->tpls[$this->tpl]['o_rMargin']; + $this->h = $this->tpls[$this->tpl]['o_h']; + $this->w = $this->tpls[$this->tpl]['o_w']; + return $this->tpl; + } else { + return false; + } + } + + /** + * Use a Template in current Page or other Template + * + * You can use a template in a page or in another template. + * You can give the used template a new size like you use the Image()-method. + * All parameters are optional. The width or height is calculated automaticaly + * if one is given. If no parameter is given the origin size as defined in + * beginTemplate() is used. + * The calculated or used width and height are returned as an array. + * + * @param int $tplidx A valid template-Id + * @param int $_x The x-position + * @param int $_y The y-position + * @param int $_w The new width of the template + * @param int $_h The new height of the template + * @retrun array The height and width of the template + */ + function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) { + if ($this->page <= 0) + $this->error("You have to add a page to fpdf first!"); + + if (!$this->tpls[$tplidx]) + $this->error("Template does not exist!"); + + if ($this->intpl) { + $this->res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; + } + extract($this->tpls[$tplidx]); + + if ($_x == null) + $_x = $x; + if ($_y == null) + $_y = $y; + $wh = $this->getTemplateSize($tplidx,$_w,$_h); + $_w = $wh['w']; + $_h = $wh['h']; + + $this->_out(sprintf("q %.4f 0 0 %.4f %.2f %.2f cm", ($_w/$w), ($_h/$h), $_x*$this->k, ($this->h-($_y+$_h))*$this->k)); // Translate + $this->_out($this->tplprefix.$tplidx." Do Q"); + + return array("w" => $_w, "h" => $_h); + } + + /** + * Get The calculated Size of a Template + * + * If one size is given, this method calculates the other one. + * + * @param int $tplidx A valid template-Id + * @param int $_w The width of the template + * @param int $_h The height of the template + * @return array The height and width of the template + */ + function getTemplateSize($tplidx, $_w=0, $_h=0) { + if (!$this->tpls[$tplidx]) + return false; + + extract($this->tpls[$tplidx]); + if ($_w == 0 and $_h == 0) { + $_w = $w; + $_h = $h; + } + + if($_w==0) + $_w=$_h*$w/$h; + if($_h==0) + $_h=$_w*$h/$w; + + return array("w" => $_w, "h" => $_h); + } + + /** + * See FPDF-Documentation ;-) + */ + function SetFont($family,$style='',$size=0) { + //Select a font; size given in points + global $fpdf_charwidths; + + $family=strtolower($family); + if($family=='') + $family=$this->FontFamily; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' or $family=='zapfdingbats') + $style=''; + $style=strtoupper($style); + if(is_int(strpos($style,'U'))) + { + $this->underline=true; + $style=str_replace('U','',$style); + } + else + $this->underline=false; + if($style=='IB') + $style='BI'; + if($size==0) + $size=$this->FontSizePt; + //Test if font is already selected + if($this->FontFamily==$family and $this->FontStyle==$style and $this->FontSizePt==$size and !$this->intpl) + return; + //Test if used for the first time + $fontkey=$family.$style; + if(!isset($this->fonts[$fontkey])) + { + //Check if one of the standard fonts + if(isset($this->CoreFonts[$fontkey])) + { + if(!isset($fpdf_charwidths[$fontkey])) + { + //Load metric file + $file=$family; + if($family=='times' or $family=='helvetica') + $file.=strtolower($style); + $file.='.php'; + if(defined('FPDF_FONTPATH')) + $file=FPDF_FONTPATH.$file; + include($file); + if(!isset($fpdf_charwidths[$fontkey])) + $this->Error('Could not include font metric file'); + } + $i = $this->findNextAvailFont(); + $this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + //Select it + $this->FontFamily=$family; + $this->FontStyle=$style; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + $this->CurrentFont=&$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT '.$this->fontprefix.'%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); + + + if ($this->intpl) { + $this->res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + } else { + $this->res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + } + } + + /** + * Find the next available Font-No. + * + * @return int + */ + function findNextAvailFont() { + return count($this->fonts)+1; + } + + /** + * See FPDF-Documentation ;-) + */ + function Image($file,$x,$y,$w=0,$h=0,$type='',$link='') { + parent::Image($file,$x,$y,$w,$h,$type,$link); + if ($this->intpl) { + $this->res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; + } else { + $this->res['page'][$this->page]['images'][$file] =& $this->images[$file]; + } + } + + /** + * See FPDF-Documentation ;-) + * + * AddPage is not available when you're "in" a template. + */ + function AddPage($orientation='') { + if ($this->intpl) + $this->Error('Adding pages in templates isn\'t possible!'); + parent::AddPage($orientation); + } + + /** + * Preserve adding Links in Templates ...won't work + */ + function Link($x,$y,$w,$h,$link) { + if ($this->intpl) + $this->Error('Using links in templates aren\'t possible!'); + parent::Link($x,$y,$w,$h,$link); + } + + function AddLink() { + if ($this->intpl) + $this->Error('Adding links in templates aren\'t possible!'); + return parent::AddLink(); + } + + function SetLink($link,$y=0,$page=-1) { + if ($this->intpl) + $this->Error('Setting links in templates aren\'t possible!'); + parent::SetLink($link,$y,$page); + } + + /** + * Private Method that writes the Resources-Objects + */ + function _puttemplates() { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->tpls); + foreach($this->tpls AS $tplidx => $tpl) { + + $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + $this->_newobj(); + $this->tpls[$tplidx]['n'] = $this->n; + $this->_out('<<'.$filter.'/Type /XObject'); + $this->_out('/Subtype /Form'); + $this->_out('/FormType 1'); + $this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k)); // ($this->h-$tpl['y'])*$this->k + $this->_out('/Resources '); + + $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + if (count($this->res['tpl'][$tplidx]['fonts'])) { + $this->_out('/Font <<'); + foreach($this->res['tpl'][$tplidx]['fonts'] as $font) + $this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + } + if(count($this->res['tpl'][$tplidx]['images']) || count($this->res['tpl'][$tplidx]['tpls'])) + { + $this->_out('/XObject <<'); + if (count($this->res['tpl'][$tplidx]['images'])) { + foreach($this->res['tpl'][$tplidx]['images'] as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + } + if (count($this->res['tpl'][$tplidx]['tpls'])) { + foreach($this->res['tpl'][$tplidx]['tpls'] as $i => $tpl) + $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + + $this->_out('/Length '.strlen($p).' >>'); + $this->_putstream($p); + $this->_out('endobj'); + } + } + + /** + * Private Method + */ + function _putresources() { + $this->_putfonts(); + $this->_putimages(); + $this->_puttemplates(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + if(count($this->images) || count($this->tpls)) + { + $this->_out('/XObject <<'); + if (count($this->images)) { + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + } + if (count($this->tpls)) { + foreach($this->tpls as $tplidx => $tpl) + $this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + $this->_out('endobj'); + } + + + /** + * Private Method + */ + function _out($s) { + //Add a line to the document + if ($this->state==2) { + if (!$this->intpl) + $this->pages[$this->page].=$s."\n"; + else + $this->tpls[$this->tpl]['buffer'] .= $s."\n"; + } else { + $this->buffer.=$s."\n"; + } + } +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi.php new file mode 100644 index 0000000000000000000000000000000000000000..22933a5814394314f68906f006cacab0f9932f66 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi.php @@ -0,0 +1,500 @@ +<?php +// +// FPDI - Version 1.2.1 +// +// Copyright 2004-2008 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +define('FPDI_VERSION','1.2.1'); + +// Check for TCPDF and remap TCPDF to FPDF +if (class_exists('TCPDF')) { + require_once('fpdi2tcpdf_bridge.php'); +} + +require_once("fpdf_tpl.php"); +require_once("fpdi_pdf_parser.php"); + + +class FPDI extends FPDF_TPL { + /** + * Actual filename + * @var string + */ + var $current_filename; + + /** + * Parser-Objects + * @var array + */ + var $parsers; + + /** + * Current parser + * @var object + */ + var $current_parser; + + /** + * object stack + * @var array + */ + var $_obj_stack; + + /** + * done object stack + * @var array + */ + var $_don_obj_stack; + + /** + * Current Object Id. + * @var integer + */ + var $_current_obj_id; + + /** + * The name of the last imported page box + * @var string + */ + var $lastUsedPageBox; + + var $_importedPages = array(); + + + /** + * Set a source-file + * + * @param string $filename a valid filename + * @return int number of available pages + */ + function setSourceFile($filename) { + $this->current_filename = $filename; + $fn =& $this->current_filename; + + if (!isset($this->parsers[$fn])) + $this->parsers[$fn] =& new fpdi_pdf_parser($fn,$this); + $this->current_parser =& $this->parsers[$fn]; + + return $this->parsers[$fn]->getPageCount(); + } + + /** + * Import a page + * + * @param int $pageno pagenumber + * @return int Index of imported page - to use with fpdf_tpl::useTemplate() + */ + function importPage($pageno, $boxName='/CropBox') { + if ($this->_intpl) { + return $this->error("Please import the desired pages before creating a new template."); + } + + $fn =& $this->current_filename; + + // check if page already imported + $pageKey = $fn.((int)$pageno).$boxName; + if (isset($this->_importedPages[$pageKey])) + return $this->_importedPages[$pageKey]; + + $parser =& $this->parsers[$fn]; + $parser->setPageno($pageno); + + $this->tpl++; + $this->tpls[$this->tpl] = array(); + $tpl =& $this->tpls[$this->tpl]; + $tpl['parser'] =& $parser; + $tpl['resources'] = $parser->getPageResources(); + $tpl['buffer'] = $parser->getContent(); + + if (!in_array($boxName, $parser->availableBoxes)) + return $this->Error(sprintf("Unknown box: %s", $boxName)); + $pageboxes = $parser->getPageBoxes($pageno); + + /** + * MediaBox + * CropBox: Default -> MediaBox + * BleedBox: Default -> CropBox + * TrimBox: Default -> CropBox + * ArtBox: Default -> CropBox + */ + if (!isset($pageboxes[$boxName]) && ($boxName == "/BleedBox" || $boxName == "/TrimBox" || $boxName == "/ArtBox")) + $boxName = "/CropBox"; + if (!isset($pageboxes[$boxName]) && $boxName == "/CropBox") + $boxName = "/MediaBox"; + + if (!isset($pageboxes[$boxName])) + return false; + $this->lastUsedPageBox = $boxName; + + $box = $pageboxes[$boxName]; + $tpl['box'] = $box; + + // To build an array that can be used by PDF_TPL::useTemplate() + $this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl],$box); + // An imported page will start at 0,0 everytime. Translation will be set in _putformxobjects() + $tpl['x'] = 0; + $tpl['y'] = 0; + + $page =& $parser->pages[$parser->pageno]; + + // fix for rotated pages + $rotation = $parser->getPageRotation($pageno); + if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) { + $steps = $angle / 90; + + $_w = $tpl['w']; + $_h = $tpl['h']; + $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; + $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; + + if ($steps % 2 != 0) { + $x = $y = ($steps == 1 || $steps == -3) ? $tpl['h'] : $tpl['w']; + } else { + $x = $tpl['w']; + $y = $tpl['h']; + } + + $cx=($x/2+$tpl['box']['x'])*$this->k; + $cy=($y/2+$tpl['box']['y'])*$this->k; + + $angle*=-1; + + $angle*=M_PI/180; + $c=cos($angle); + $s=sin($angle); + + $tpl['buffer'] = sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm %s Q',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy, $tpl['buffer']); + } + + $this->_importedPages[$pageKey] = $this->tpl; + + return $this->tpl; + } + + function getLastUsedPageBox() { + return $this->lastUsedPageBox; + } + + function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) { + $this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values + $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h); + $this->_out('Q'); + return $s; + } + + /** + * Private method, that rebuilds all needed objects of source files + */ + function _putimportedobjects() { + if (is_array($this->parsers) && count($this->parsers) > 0) { + foreach($this->parsers AS $filename => $p) { + $this->current_parser =& $this->parsers[$filename]; + if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) { + while($n = key($this->_obj_stack[$filename])) { + $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c,$this->_obj_stack[$filename][$n][1]); + + $this->_newobj($this->_obj_stack[$filename][$n][0]); + + if ($nObj[0] == PDF_TYPE_STREAM) { + $this->pdf_write_value ($nObj); + } else { + $this->pdf_write_value ($nObj[1]); + } + + $this->_out('endobj'); + $this->_obj_stack[$filename][$n] = null; // free memory + unset($this->_obj_stack[$filename][$n]); + reset($this->_obj_stack[$filename]); + } + } + } + } + } + + /** + * Put resources + */ + function _putresources() { + if (!is_subclass_of($this, 'TCPDF')) { + $this->_putfonts(); + $this->_putimages(); + $this->_putformxobjects(); + $this->_putimportedobjects(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<<'); + $this->_putresourcedict(); + $this->_out('>>'); + $this->_out('endobj'); + + } else { // TCPDF - Part + $this->_putextgstates(); + $this->_putocg(); + $this->_putfonts(); + $this->_putimages(); + $this->_putshaders(); + $this->_putformxobjects(); + $this->_putimportedobjects(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<<'); + $this->_putresourcedict(); + $this->_out('>>'); + $this->_out('endobj'); + $this->_putjavascript(); + $this->_putbookmarks(); + // encryption + if ($this->encrypted) { + $this->_newobj(); + $this->enc_obj_id = $this->n; + $this->_out('<<'); + $this->_putencryption(); + $this->_out('>>'); + $this->_out('endobj'); + } + } + } + + /** + * Private Method that writes the form xobjects + */ + function _putformxobjects() { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->tpls); + foreach($this->tpls AS $tplidx => $tpl) { + $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + $this->_newobj(); + $cN = $this->n; // TCPDF/Protection: rem current "n" + + $this->tpls[$tplidx]['n'] = $this->n; + $this->_out('<<'.$filter.'/Type /XObject'); + $this->_out('/Subtype /Form'); + $this->_out('/FormType 1'); + + $this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]', + ($tpl['x'] + (isset($tpl['box']['x'])?$tpl['box']['x']:0))*$this->k, + ($tpl['h'] + (isset($tpl['box']['y'])?$tpl['box']['y']:0) - $tpl['y'])*$this->k, + ($tpl['w'] + (isset($tpl['box']['x'])?$tpl['box']['x']:0))*$this->k, + ($tpl['h'] + (isset($tpl['box']['y'])?$tpl['box']['y']:0) - $tpl['y']-$tpl['h'])*$this->k) + ); + + if (isset($tpl['box'])) + $this->_out(sprintf('/Matrix [1 0 0 1 %.5f %.5f]',-$tpl['box']['x']*$this->k, -$tpl['box']['y']*$this->k)); + + $this->_out('/Resources '); + + if (isset($tpl['resources'])) { + $this->current_parser =& $tpl['parser']; + $this->pdf_write_value($tpl['resources']); // "n" will be changed + } else { + $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { + $this->_out('/Font <<'); + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + } + if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || + isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) + { + $this->_out('/XObject <<'); + if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { + foreach($this->_res['tpl'][$tplidx]['images'] as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + } + if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) + $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + } + + $nN = $this->n; // TCPDF: rem new "n" + $this->n = $cN; // TCPDF: reset to current "n" + $this->_out('/Length '.strlen($p).' >>'); + $this->_putstream($p); + $this->_out('endobj'); + $this->n = $nN; // TCPDF: reset to new "n" + } + } + + /** + * Rewritten to handle existing own defined objects + */ + function _newobj($obj_id=false,$onlynewobj=false) { + if (!$obj_id) { + $obj_id = ++$this->n; + } + + //Begin a new object + if (!$onlynewobj) { + $this->offsets[$obj_id] = strlen($this->buffer); + $this->_out($obj_id.' 0 obj'); + $this->_current_obj_id = $obj_id; // for later use with encryption + } + } + + /** + * Writes a value + * Needed to rebuild the source document + * + * @param mixed $value A PDF-Value. Structure of values see cases in this method + */ + function pdf_write_value(&$value) + { + if (is_subclass_of($this, 'TCPDF')) { + parent::pdf_write_value($value); + } + + switch ($value[0]) { + + case PDF_TYPE_NUMERIC : + case PDF_TYPE_TOKEN : + case PDF_TYPE_REAL : + // A numeric value or a token. + // Simply output them + $this->_out($value[1]." ", false); + break; + + case PDF_TYPE_ARRAY : + + // An array. Output the proper + // structure and move on. + + $this->_out("[",false); + for ($i = 0; $i < count($value[1]); $i++) { + $this->pdf_write_value($value[1][$i]); + } + + $this->_out("]"); + break; + + case PDF_TYPE_DICTIONARY : + + // A dictionary. + $this->_out("<<",false); + + reset ($value[1]); + + while (list($k, $v) = each($value[1])) { + $this->_out($k . " ",false); + $this->pdf_write_value($v); + } + + $this->_out(">>"); + break; + + case PDF_TYPE_OBJREF : + + // An indirect object reference + // Fill the object stack if needed + $cpfn =& $this->current_parser->filename; + if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) { + $this->_newobj(false,true); + $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value); + $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!! + } + $objid = $this->_don_obj_stack[$cpfn][$value[1]][0]; + + $this->_out("{$objid} 0 R"); + break; + + case PDF_TYPE_STRING : + + // A string. + $this->_out('('.$value[1].')'); + + break; + + case PDF_TYPE_STREAM : + + // A stream. First, output the + // stream dictionary, then the + // stream data itself. + $this->pdf_write_value($value[1]); + $this->_out("stream"); + $this->_out($value[2][1]); + $this->_out("endstream"); + break; + case PDF_TYPE_HEX : + + $this->_out("<".$value[1].">"); + break; + + case PDF_TYPE_BOOLEAN : + $this->_out($value[1] ? 'true ' : 'false ', false); + break; + + case PDF_TYPE_NULL : + // The null object. + + $this->_out("null"); + break; + } + } + + + /** + * Modified so not each call will add a newline to the output. + */ + function _out($s, $ln=true) { + //Add a line to the document + if ($this->state==2) { + if (!$this->_intpl) { + if (is_subclass_of($this, 'TCPDF') && isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) { + // puts data before page footer + $page = substr($this->pages[$this->page], 0, -$this->footerlen[$this->page]); + $footer = substr($this->pages[$this->page], -$this->footerlen[$this->page]); + $this->pages[$this->page] = $page." ".$s."\n".$footer; + } else { + $this->pages[$this->page] .= $s.($ln == true ? "\n" : ''); + } + } else + $this->tpls[$this->tpl]['buffer'] .= $s.($ln == true ? "\n" : ''); + } else { + $this->buffer.=$s.($ln == true ? "\n" : ''); + } + } + + /** + * rewritten to close opened parsers + * + */ + function _enddoc() { + parent::_enddoc(); + $this->_closeParsers(); + } + + /** + * close all files opened by parsers + */ + function _closeParsers() { + if ($this->state > 2 && count($this->parsers) > 0) { + foreach ($this->parsers as $k => $_){ + $this->parsers[$k]->closeFile(); + $this->parsers[$k] = null; + unset($this->parsers[$k]); + } + return true; + } + return false; + } + +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi2tcpdf_bridge.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi2tcpdf_bridge.php new file mode 100644 index 0000000000000000000000000000000000000000..60277aff6f4507c3ed962992f01a4188d9a76f86 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi2tcpdf_bridge.php @@ -0,0 +1,134 @@ +<?php +// +// FPDI - Version 1.2.1 +// +// Copyright 2004-2008 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * This class is used as a bridge between TCPDF and FPDI + * and will create the possibility to use both FPDF and TCPDF + * via one FPDI version. + * + * We'll simply remap TCPDF to FPDF again. + * + * It'll be loaded and extended by FPDF_TPL. + */ +class FPDF extends TCPDF { + + /** + * Missing in TCPDF + * + * @var string + */ + var $padding; + + function __get($name) { + switch ($name) { + case 'PDFVersion': + return $this->PDFVersion; + case 'k': + return $this->k; + case 'lastUsedPageBox': + return $this->lastUsedPageBox; + default: + // Error handling + $this->Error('Cannot access protected property '.get_class($this).':$'.$name.' / Undefined property: '.get_class($this).'::$'.$name); + } + } + + function __set($name, $value) { + switch ($name) { + case 'PDFVersion': + $this->PDFVersion = $value; + break; + default: + // Error handling + $this->Error('Cannot access protected property '.get_class($this).':$'.$name.' / Undefined property: '.get_class($this).'::$'.$name); + } + } + + /** + * Encryption of imported data by FPDI + * + * @param array $value + */ + function pdf_write_value(&$value) { + switch ($value[0]) { + case PDF_TYPE_STRING : + if ($this->encrypted) { + $value[1] = $this->_unescape($value[1]); + $value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]); + $value[1] = $this->_escape($value[1]); + } + break; + + case PDF_TYPE_STREAM : + if ($this->encrypted) { + $value[2][1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[2][1]); + } + break; + + case PDF_TYPE_HEX : + if ($this->encrypted) { + $value[1] = $this->hex2str($value[1]); + $value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]); + + // remake hexstring of encrypted string + $value[1] = $this->str2hex($value[1]); + } + break; + } + } + + /** + * Unescapes a PDF string + * + * @param string $s + * @return string + */ + function _unescape($s) { + return strtr($s, array( + '\\\\' => "\\", + '\)' => ')', + '\(' => '(', + '\\f' => chr(0x0C), + '\\b' => chr(0x08), + '\\t' => chr(0x09), + '\\r' => chr(0x0D), + '\\n' => chr(0x0A), + )); + } + + /** + * Hexadecimal to string + * + * @param string $hex + * @return string + */ + function hex2str($hex) { + return pack("H*", str_replace(array("\r", "\n", " "), "", $hex)); + } + + /** + * String to hexadecimal + * + * @param string $str + * @return string + */ + function str2hex($str) { + return current(unpack("H*", $str)); + } +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi_pdf_parser.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi_pdf_parser.php new file mode 100644 index 0000000000000000000000000000000000000000..3269fe702f1b89a8589dc3beab44d96629b07c13 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/fpdi_pdf_parser.php @@ -0,0 +1,380 @@ +<?php +// +// FPDI - Version 1.2.1 +// +// Copyright 2004-2008 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +require_once("pdf_parser.php"); + +class fpdi_pdf_parser extends pdf_parser { + + /** + * Pages + * Index beginns at 0 + * + * @var array + */ + var $pages; + + /** + * Page count + * @var integer + */ + var $page_count; + + /** + * actual page number + * @var integer + */ + var $pageno; + + /** + * PDF Version of imported Document + * @var string + */ + var $pdfVersion; + + /** + * FPDI Reference + * @var object + */ + var $fpdi; + + /** + * Available BoxTypes + * + * @var array + */ + var $availableBoxes = array("/MediaBox","/CropBox","/BleedBox","/TrimBox","/ArtBox"); + + /** + * Constructor + * + * @param string $filename Source-Filename + * @param object $fpdi Object of type fpdi + */ + function fpdi_pdf_parser($filename,&$fpdi) { + $this->fpdi =& $fpdi; + $this->filename = $filename; + + parent::pdf_parser($filename); + + // resolve Pages-Dictonary + $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']); + + // Read pages + $this->read_pages($this->c, $pages, $this->pages); + + // count pages; + $this->page_count = count($this->pages); + } + + /** + * Overwrite parent::error() + * + * @param string $msg Error-Message + */ + function error($msg) { + $this->fpdi->error($msg); + } + + /** + * Get pagecount from sourcefile + * + * @return int + */ + function getPageCount() { + return $this->page_count; + } + + + /** + * Set pageno + * + * @param int $pageno Pagenumber to use + */ + function setPageno($pageno) { + $pageno = ((int) $pageno) - 1; + + if ($pageno < 0 || $pageno >= $this->getPageCount()) { + $this->fpdi->error("Pagenumber is wrong!"); + } + + $this->pageno = $pageno; + } + + /** + * Get page-resources from current page + * + * @return array + */ + function getPageResources() { + return $this->_getPageResources($this->pages[$this->pageno]); + } + + /** + * Get page-resources from /Page + * + * @param array $obj Array of pdf-data + */ + function _getPageResources ($obj) { // $obj = /Page + $obj = $this->pdf_resolve_object($this->c, $obj); + + // If the current object has a resources + // dictionary associated with it, we use + // it. Otherwise, we move back to its + // parent object. + if (isset ($obj[1][1]['/Resources'])) { + $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } else { + if (!isset ($obj[1][1]['/Parent'])) { + return false; + } else { + $res = $this->_getPageResources($obj[1][1]['/Parent']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } + } + } + + + /** + * Get content of current page + * + * If more /Contents is an array, the streams are concated + * + * @return string + */ + function getContent() { + $buffer = ""; + + if (isset($this->pages[$this->pageno][1][1]['/Contents'])) { + $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']); + foreach($contents AS $tmp_content) { + $buffer .= $this->_rebuildContentStream($tmp_content).' '; + } + } + + return $buffer; + } + + + /** + * Resolve all content-objects + * + * @param array $content_ref + * @return array + */ + function _getPageContent($content_ref) { + $contents = array(); + + if ($content_ref[0] == PDF_TYPE_OBJREF) { + $content = $this->pdf_resolve_object($this->c, $content_ref); + if ($content[1][0] == PDF_TYPE_ARRAY) { + $contents = $this->_getPageContent($content[1]); + } else { + $contents[] = $content; + } + } else if ($content_ref[0] == PDF_TYPE_ARRAY) { + foreach ($content_ref[1] AS $tmp_content_ref) { + $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref)); + } + } + + return $contents; + } + + + /** + * Rebuild content-streams + * + * @param array $obj + * @return string + */ + function _rebuildContentStream($obj) { + $filters = array(); + + if (isset($obj[1][1]['/Filter'])) { + $_filter = $obj[1][1]['/Filter']; + + if ($_filter[0] == PDF_TYPE_TOKEN) { + $filters[] = $_filter; + } else if ($_filter[0] == PDF_TYPE_ARRAY) { + $filters = $_filter[1]; + } + } + + $stream = $obj[2][1]; + + foreach ($filters AS $_filter) { + switch ($_filter[1]) { + case "/FlateDecode": + if (function_exists('gzuncompress')) { + $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : ''; + } else { + $this->fpdi->error(sprintf("To handle %s filter, please compile php with zlib support.",$_filter[1])); + } + if ($stream === false) { + $this->fpdi->error("Error while decompressing stream."); + } + break; + case null: + $stream = $stream; + break; + default: + if (preg_match("/^\/[a-z85]*$/i", $_filter[1], $filterName) && @include_once('decoders'.$_filter[1].'.php')) { + $filterName = substr($_filter[1],1); + if (class_exists($filterName)) { + $decoder =& new $filterName($this->fpdi); + $stream = $decoder->decode(trim($stream)); + } else { + $this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1])); + } + } else { + $this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1])); + } + } + } + + return $stream; + } + + + /** + * Get a Box from a page + * Arrayformat is same as used by fpdf_tpl + * + * @param array $page a /Page + * @param string $box_index Type of Box @see $availableBoxes + * @return array + */ + function getPageBox($page, $box_index) { + $page = $this->pdf_resolve_object($this->c,$page); + $box = null; + if (isset($page[1][1][$box_index])) + $box =& $page[1][1][$box_index]; + + if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { + $tmp_box = $this->pdf_resolve_object($this->c,$box); + $box = $tmp_box[1]; + } + + if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { + $b =& $box[1]; + return array("x" => $b[0][1]/$this->fpdi->k, + "y" => $b[1][1]/$this->fpdi->k, + "w" => abs($b[0][1]-$b[2][1])/$this->fpdi->k, + "h" => abs($b[1][1]-$b[3][1])/$this->fpdi->k); + } else if (!isset ($page[1][1]['/Parent'])) { + return false; + } else { + return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index); + } + } + + function getPageBoxes($pageno) { + return $this->_getPageBoxes($this->pages[$pageno-1]); + } + + /** + * Get all Boxes from /Page + * + * @param array a /Page + * @return array + */ + function _getPageBoxes($page) { + $boxes = array(); + + foreach($this->availableBoxes AS $box) { + if ($_box = $this->getPageBox($page,$box)) { + $boxes[$box] = $_box; + } + } + + return $boxes; + } + + /** + * Get the page rotation by pageno + * + * @param integer $pageno + * @return array + */ + function getPageRotation($pageno) { + return $this->_getPageRotation($this->pages[$pageno-1]); + } + + function _getPageRotation ($obj) { // $obj = /Page + $obj = $this->pdf_resolve_object($this->c, $obj); + if (isset ($obj[1][1]['/Rotate'])) { + $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } else { + if (!isset ($obj[1][1]['/Parent'])) { + return false; + } else { + $res = $this->_getPageRotation($obj[1][1]['/Parent']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } + } + } + + /** + * Read all /Page(es) + * + * @param object pdf_context + * @param array /Pages + * @param array the result-array + */ + function read_pages (&$c, &$pages, &$result) { + // Get the kids dictionary + $kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']); + + if (!is_array($kids)) + $this->fpdi->Error("Cannot find /Kids in current /Page-Dictionary"); + foreach ($kids[1] as $v) { + $pg = $this->pdf_resolve_object ($c, $v); + if ($pg[1][1]['/Type'][1] === '/Pages') { + // If one of the kids is an embedded + // /Pages array, resolve it as well. + $this->read_pages ($c, $pg, $result); + } else { + $result[] = $pg; + } + } + } + + + + /** + * Get PDF-Version + * + * And reset the PDF Version used in FPDI if needed + */ + function getPDFVersion() { + parent::getPDFVersion(); + $this->fpdi->PDFVersion = max($this->fpdi->PDFVersion, $this->pdfVersion); + } + +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/histo.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/histo.htm new file mode 100644 index 0000000000000000000000000000000000000000..77c2f0c678ac796e54dec91508da7ee14b3c5f59 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/histo.htm @@ -0,0 +1,111 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>History</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="fpdf.css"> +</HEAD> +<BODY> +<H2>History</H2> +<B>v1.53</B> (2004-12-31) +<BLOCKQUOTE> +- When the font subdirectory is in the same directory as fpdf.php, it is no longer necessary to define the FPDF_FONTPATH constant.<BR> +- The array $HTTP_SERVER_VARS is no longer used. It could cause trouble on PHP5-based configurations with the register_long_arrays option disabled.<BR> +- Fixed a problem related to Type1 font embedding which caused trouble to some PDF processors.<BR> +- The file name sent to the browser could not contain a space character.<BR> +- The Cell() method could not print the number 0 (you had to pass the string '0').<BR> +</BLOCKQUOTE> +<B>v1.52</B> (2003-12-30) +<BLOCKQUOTE> +- Image() now displays the image at 72 dpi if no dimension is given.<BR> +- Output() takes a string as second parameter to indicate destination.<BR> +- Open() is now called automatically by AddPage().<BR> +- Inserting remote JPEG images doesn't generate an error any longer.<BR> +- Decimal separator is forced to dot in the constructor.<BR> +- Added several encodings (Turkish, Thai, Hebrew, Ukrainian and Vietnamese).<BR> +- The last line of a right-aligned MultiCell() was not correctly aligned if it was terminated by a carriage return.<BR> +- No more error message about already sent headers when outputting the PDF to the standard output from the command line.<BR> +- The underlining was going too far for text containing characters \, ( or ).<BR> +- $HTTP_ENV_VARS has been replaced by $HTTP_SERVER_VARS.<BR> +</BLOCKQUOTE> +<B>v1.51</B> (2002-08-03) +<BLOCKQUOTE> +- Type1 font support.<BR> +- Added Baltic encoding.<BR> +- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5 :<BR> * The line thickness was too large when printed under Windows 98 SE and ME.<BR> * TrueType fonts didn't appear immediately inside the plug-in (a substitution font was used), one had to cause a window refresh to make them show up.<BR> +- It is no longer necessary to set the decimal separator as dot to produce valid documents.<BR> +- The clickable area in a cell was always on the left independently from the text alignment.<BR> +- JPEG images in CMYK mode appeared in inverted colors.<BR> +- Transparent PNG images in grayscale or true color mode were incorrectly handled.<BR> +- Adding new fonts now works correctly even with the magic_quotes_runtime option set to on.<BR> +</BLOCKQUOTE> +<B>v1.5</B> (2002-05-28) +<BLOCKQUOTE> +- TrueType font (AddFont()) and encoding support (Western and Eastern Europe, Cyrillic and Greek).<BR> +- Added Write() method.<BR> +- Added underlined style.<BR> +- Internal and external link support (AddLink(), SetLink(), Link()).<BR> +- Added right margin management and methods SetRightMargin(), SetTopMargin().<BR> +- Modification of SetDisplayMode() to select page layout.<BR> +- The border parameter of MultiCell() now lets choose borders to draw as Cell().<BR> +- When a document contains no page, Close() now calls AddPage() instead of causing a fatal error.<BR> +</BLOCKQUOTE> +<B>v1.41</B> (2002-03-13) +<BLOCKQUOTE> +- Fixed SetDisplayMode() which no longer worked (the PDF viewer used its default display).<BR> +</BLOCKQUOTE> +<B>v1.4</B> (2002-03-02) +<BLOCKQUOTE> +- PHP3 is no longer supported.<BR> +- Page compression (SetCompression()).<BR> +- Choice of page format and possibility to change orientation inside document.<BR> +- Added AcceptPageBreak() method.<BR> +- Ability to print the total number of pages (AliasNbPages()).<BR> +- Choice of cell borders to draw.<BR> +- New mode for Cell(): the current position can now move under the cell.<BR> +- Ability to include an image by specifying height only (width is calculated automatically).<BR> +- Fixed a bug: when a justified line triggered a page break, the footer inherited the corresponding word spacing.<BR> +</BLOCKQUOTE> +<B>v1.31</B> (2002-01-12) +<BLOCKQUOTE> +- Fixed a bug in drawing frame with MultiCell(): the last line always started from the left margin.<BR> +- Removed Expires HTTP header (gives trouble in some situations).<BR> +- Added Content-disposition HTTP header (seems to help in some situations).<BR> +</BLOCKQUOTE> +<B>v1.3</B> (2001-12-03) +<BLOCKQUOTE> +- Line break and text justification support (MultiCell()).<BR> +- Color support (SetDrawColor(), SetFillColor(), SetTextColor()). Possibility to draw filled rectangles and paint cell background.<BR> +- A cell whose width is declared null extends up to the right margin of the page.<BR> +- Line width is now retained from page to page and defaults to 0.2 mm.<BR> +- Added SetXY() method.<BR> +- Fixed a passing by reference done in a deprecated manner for PHP4.<BR> +</BLOCKQUOTE> +<B>v1.2</B> (2001-11-11) +<BLOCKQUOTE> +- Added font metric files and GetStringWidth() method.<BR> +- Centering and right-aligning text in cells.<BR> +- Display mode control (SetDisplayMode()).<BR> +- Added methods to set document properties (SetAuthor(), SetCreator(), SetKeywords(), SetSubject(), SetTitle()).<BR> +- Possibility to force PDF download by browser.<BR> +- Added SetX() and GetX() methods.<BR> +- During automatic page break, current abscissa is now retained.<BR> +</BLOCKQUOTE> +<B>v1.11</B> (2001-10-20) +<BLOCKQUOTE> +- PNG support doesn't require PHP4/Zlib any more. Data are now put directly into PDF without any decompression/recompression stage.<BR> +- Image insertion now works correctly even with magic_quotes_runtime option set to on.<BR> +</BLOCKQUOTE> +<B>v1.1</B> (2001-10-07) +<BLOCKQUOTE> +- JPEG and PNG image support.<BR> +</BLOCKQUOTE> +<B>v1.01</B> (2001-10-03) +<BLOCKQUOTE> +- Fixed a bug involving page break: in case when Header() doesn't specify a font, the one from previous page was not restored and produced an incorrect document.<BR> +</BLOCKQUOTE> +<B>v1.0</B> (2001-09-17) +<BLOCKQUOTE> +- First version.<BR> +</BLOCKQUOTE> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/install.txt b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/install.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ee326b05c18654536c3cd468526399e0e47ff28 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/install.txt @@ -0,0 +1,26 @@ +The FPDF library is made up of the following elements: + +- the main file, fpdf.php, which contains the class +- the font metric files (located in the font directory of this archive) + +The metric files are necessary as soon as you want to output some text in a document. +They can be accessed from three different locations: + +- the directory defined by the FPDF_FONTPATH constant (if this constant is defined) +- the font directory located in the directory containing fpdf.php (as it is the case in this archive) +- the directories accessible through include() + +Here is an example defining FPDF_FONTPATH (note the mandatory final slash): + +define('FPDF_FONTPATH','/home/www/font/'); +require('fpdf.php'); + +If the files are not accessible, the SetFont() method will produce the following error: + +FPDF error: Could not include font metric file + + +Remarks: + +- Only the files corresponding to the fonts actually used are necessary +- The tutorials provided in this package are ready to be executed diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdf_context.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdf_context.php new file mode 100644 index 0000000000000000000000000000000000000000..c15ec04d7440cdcd74c3c9c07ff8def767eef7a5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdf_context.php @@ -0,0 +1,82 @@ +<?php +// +// FPDI - Version 1.2.1 +// +// Copyright 2004-2008 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +class pdf_context { + + var $file; + var $buffer; + var $offset; + var $length; + + var $stack; + + // Constructor + + function pdf_context($f) { + $this->file = $f; + $this->reset(); + } + + // Optionally move the file + // pointer to a new location + // and reset the buffered data + + function reset($pos = null, $l = 100) { + if (!is_null ($pos)) { + fseek ($this->file, $pos); + } + + $this->buffer = $l > 0 ? fread($this->file, $l) : ''; + $this->length = strlen($this->buffer); + if ($this->length < $l) + $this->increase_length($l - $this->length); + $this->offset = 0; + $this->stack = array(); + } + + // Make sure that there is at least one + // character beyond the current offset in + // the buffer to prevent the tokenizer + // from attempting to access data that does + // not exist + + function ensure_content() { + if ($this->offset >= $this->length - 1) { + return $this->increase_length(); + } else { + return true; + } + } + + // Forcefully read more data into the buffer + + function increase_length($l=100) { + if (feof($this->file)) { + return false; + } else { + $totalLength = $this->length + $l; + do { + $this->buffer .= fread($this->file, $totalLength-$this->length); + } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file)); + + return true; + } + } + +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdf_parser.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdf_parser.php new file mode 100644 index 0000000000000000000000000000000000000000..c72c5b43289f74e2b65e22156c4305f6f6e856c3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdf_parser.php @@ -0,0 +1,690 @@ +<?php +// +// FPDI - Version 1.2.1 +// +// Copyright 2004-2008 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +if (!defined ('PDF_TYPE_NULL')) + define ('PDF_TYPE_NULL', 0); +if (!defined ('PDF_TYPE_NUMERIC')) + define ('PDF_TYPE_NUMERIC', 1); +if (!defined ('PDF_TYPE_TOKEN')) + define ('PDF_TYPE_TOKEN', 2); +if (!defined ('PDF_TYPE_HEX')) + define ('PDF_TYPE_HEX', 3); +if (!defined ('PDF_TYPE_STRING')) + define ('PDF_TYPE_STRING', 4); +if (!defined ('PDF_TYPE_DICTIONARY')) + define ('PDF_TYPE_DICTIONARY', 5); +if (!defined ('PDF_TYPE_ARRAY')) + define ('PDF_TYPE_ARRAY', 6); +if (!defined ('PDF_TYPE_OBJDEC')) + define ('PDF_TYPE_OBJDEC', 7); +if (!defined ('PDF_TYPE_OBJREF')) + define ('PDF_TYPE_OBJREF', 8); +if (!defined ('PDF_TYPE_OBJECT')) + define ('PDF_TYPE_OBJECT', 9); +if (!defined ('PDF_TYPE_STREAM')) + define ('PDF_TYPE_STREAM', 10); +if (!defined ('PDF_TYPE_BOOLEAN')) + define ('PDF_TYPE_BOOLEAN', 11); +if (!defined ('PDF_TYPE_REAL')) + define ('PDF_TYPE_REAL', 12); + +require_once("pdf_context.php"); +require_once("wrapper_functions.php"); + +class pdf_parser { + + /** + * Filename + * @var string + */ + var $filename; + + /** + * File resource + * @var resource + */ + var $f; + + /** + * PDF Context + * @var object pdf_context-Instance + */ + var $c; + + /** + * xref-Data + * @var array + */ + var $xref; + + /** + * root-Object + * @var array + */ + var $root; + + /** + * PDF version of the loaded document + * @var string + */ + var $pdfVersion; + + /** + * Constructor + * + * @param string $filename Source-Filename + */ + function pdf_parser($filename) { + $this->filename = $filename; + + $this->f = @fopen($this->filename, "rb"); + + if (!$this->f) + $this->error(sprintf("Cannot open %s !", $filename)); + + $this->getPDFVersion(); + + $this->c =& new pdf_context($this->f); + // Read xref-Data + $this->pdf_read_xref($this->xref, $this->pdf_find_xref()); + + // Check for Encryption + $this->getEncryption(); + + // Read root + $this->pdf_read_root(); + } + + /** + * Close the opened file + */ + function closeFile() { + if (isset($this->f)) { + fclose($this->f); + unset($this->f); + } + } + + /** + * Print Error and die + * + * @param string $msg Error-Message + */ + function error($msg) { + die("<b>PDF-Parser Error:</b> ".$msg); + } + + /** + * Check Trailer for Encryption + */ + function getEncryption() { + if (isset($this->xref['trailer'][1]['/Encrypt'])) { + $this->error("File is encrypted!"); + } + } + + /** + * Find/Return /Root + * + * @return array + */ + function pdf_find_root() { + if ($this->xref['trailer'][1]['/Root'][0] != PDF_TYPE_OBJREF) { + $this->error("Wrong Type of Root-Element! Must be an indirect reference"); + } + return $this->xref['trailer'][1]['/Root']; + } + + /** + * Read the /Root + */ + function pdf_read_root() { + // read root + $this->root = $this->pdf_resolve_object($this->c, $this->pdf_find_root()); + } + + /** + * Get PDF-Version + * + * And reset the PDF Version used in FPDI if needed + */ + function getPDFVersion() { + fseek($this->f, 0); + preg_match("/\d\.\d/",fread($this->f,16),$m); + if (isset($m[0])) + $this->pdfVersion = $m[0]; + return $this->pdfVersion; + } + + /** + * Find the xref-Table + */ + function pdf_find_xref() { + $toRead = 1500; + + $stat = fseek ($this->f, -$toRead, SEEK_END); + if ($stat === -1) { + fseek ($this->f, 0); + } + $data = fread($this->f, $toRead); + + $pos = strlen($data) - strpos(strrev($data), strrev('startxref')); + $data = substr($data, $pos); + + if (!preg_match('/\s*(\d+).*$/s', $data, $matches)) { + $this->error("Unable to find pointer to xref table"); + } + + return (int) $matches[1]; + } + + /** + * Read xref-table + * + * @param array $result Array of xref-table + * @param integer $offset of xref-table + */ + function pdf_read_xref(&$result, $offset) { + fseek($this->f, $o_pos = $offset-20); // set some bytes backwards to fetch errorious docs + + $data = fread($this->f, 100); + + $xrefPos = strpos($data, 'xref'); + + if ($xrefPos === false) { + $this->error('Unable to find xref table.'); + } + + if (!isset($result['xref_location'])) { + $result['xref_location'] = $o_pos+$xrefPos; + $result['max_object'] = 0; + } + + $cylces = -1; + $bytesPerCycle = 100; + + fseek($this->f, $o_pos = $o_pos+$xrefPos+4); // set the handle directly after the "xref"-keyword + $data = fread($this->f, $bytesPerCycle); + + while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle*$cylces++, 0))) === false && !feof($this->f)) { + $data .= fread($this->f, $bytesPerCycle); + } + + if ($trailerPos === false) { + $this->error('Trailer keyword not found after xref table'); + } + + $data = substr($data, 0, $trailerPos); + + // get Line-Ending + preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for linebreaks + + $differentLineEndings = count(array_unique($m[0])); + if ($differentLineEndings > 1) { + $lines = preg_split("/(\r\n|\n|\r)/", $data, -1, PREG_SPLIT_NO_EMPTY); + } else { + $lines = explode($m[0][1], $data); + } + + $data = $differentLineEndings = $m = null; + unset($data, $differentLineEndings, $m); + + $linesCount = count($lines); + + $start = 1; + + for ($i = 0; $i < $linesCount; $i++) { + $line = trim($lines[$i]); + if ($line) { + $pieces = explode(" ", $line); + $c = count($pieces); + switch($c) { + case 2: + $start = (int)$pieces[0]; + $end = $start+(int)$pieces[1]; + if ($end > $result['max_object']) + $result['max_object'] = $end; + break; + case 3: + if (!isset($result['xref'][$start])) + $result['xref'][$start] = array(); + + if (!array_key_exists($gen = (int) $pieces[1], $result['xref'][$start])) { + $result['xref'][$start][$gen] = $pieces[2] == 'n' ? (int) $pieces[0] : null; + } + $start++; + break; + default: + $this->error('Unexpected data in xref table'); + } + } + } + + $lines = $pieces = $line = $start = $end = $gen = null; + unset($lines, $pieces, $line, $start, $end, $gen); + + fseek($this->f, $o_pos+$trailerPos+7); + + $c =& new pdf_context($this->f); + $trailer = $this->pdf_read_value($c); + + $c = null; + unset($c); + + if (!isset($result['trailer'])) { + $result['trailer'] = $trailer; + } + + if (isset($trailer[1]['/Prev'])) { + $this->pdf_read_xref($result, $trailer[1]['/Prev'][1]); + } + + $trailer = null; + unset($trailer); + + return true; + } + + /** + * Reads an Value + * + * @param object $c pdf_context + * @param string $token a Token + * @return mixed + */ + function pdf_read_value(&$c, $token = null) { + if (is_null($token)) { + $token = $this->pdf_read_token($c); + } + + if ($token === false) { + return false; + } + + switch ($token) { + case '<': + // This is a hex string. + // Read the value, then the terminator + + $pos = $c->offset; + + while(1) { + + $match = strpos ($c->buffer, '>', $pos); + + // If you can't find it, try + // reading more data from the stream + + if ($match === false) { + if (!$c->increase_length()) { + return false; + } else { + continue; + } + } + + $result = substr ($c->buffer, $c->offset, $match - $c->offset); + $c->offset = $match + 1; + + return array (PDF_TYPE_HEX, $result); + } + + break; + case '<<': + // This is a dictionary. + + $result = array(); + + // Recurse into this function until we reach + // the end of the dictionary. + while (($key = $this->pdf_read_token($c)) !== '>>') { + if ($key === false) { + return false; + } + + if (($value = $this->pdf_read_value($c)) === false) { + return false; + } + $result[$key] = $value; + } + + return array (PDF_TYPE_DICTIONARY, $result); + + case '[': + // This is an array. + + $result = array(); + + // Recurse into this function until we reach + // the end of the array. + while (($token = $this->pdf_read_token($c)) !== ']') { + if ($token === false) { + return false; + } + + if (($value = $this->pdf_read_value($c, $token)) === false) { + return false; + } + + $result[] = $value; + } + + return array (PDF_TYPE_ARRAY, $result); + + case '(' : + // This is a string + $pos = $c->offset; + + $openBrackets = 1; + do { + for (; $openBrackets != 0 && $pos < $c->length; $pos++) { + switch (ord($c->buffer[$pos])) { + case 0x28: // '(' + $openBrackets++; + break; + case 0x29: // ')' + $openBrackets--; + break; + case 0x5C: // backslash + $pos++; + } + } + } while($openBrackets != 0 && $c->increase_length()); + + $result = substr($c->buffer, $c->offset, $pos - $c->offset - 1); + $c->offset = $pos; + + return array (PDF_TYPE_STRING, $result); + + + case "stream": + $o_pos = ftell($c->file)-strlen($c->buffer); + $o_offset = $c->offset; + + $c->reset($startpos = $o_pos + $o_offset); + + $e = 0; // ensure line breaks in front of the stream + if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13)) + $e++; + if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10)) + $e++; + + if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) { + $tmp_c =& new pdf_context($this->f); + $tmp_length = $this->pdf_resolve_object($tmp_c,$this->actual_obj[1][1]['/Length']); + $length = $tmp_length[1][1]; + } else { + $length = $this->actual_obj[1][1]['/Length'][1]; + } + + if ($length > 0) { + $c->reset($startpos+$e,$length); + $v = $c->buffer; + } else { + $v = ''; + } + $c->reset($startpos+$e+$length+9); // 9 = strlen("endstream") + + return array(PDF_TYPE_STREAM, $v); + + case '%': + // this is a comment - just jump over it + $pos = $c->offset; + while(1) { + // PHP 4.3.3 required + #$match = preg_match("/(\r\n|\r|\n)/", $c->buffer, $m, PREG_OFFSET_CAPTURE, $pos); + // alternative + $match = preg_match("/(\r\n|\r|\n)/", substr($c->buffer, $pos), $m); + if ($match === false) { + if (!$c->increase_length()) { + return false; + } else { + continue; + } + } + + // PHP 4.3.3 required + #$c->offset = $m[0][1]+strlen($m[0][0]); + // alternative + $c->offset = strpos($c->buffer, $m[0], $pos)+strlen($m[0]); + + return $this->pdf_read_value($c); + } + + default : + if (is_numeric ($token)) { + // A numeric token. Make sure that + // it is not part of something else. + if (($tok2 = $this->pdf_read_token ($c)) !== false) { + if (is_numeric ($tok2)) { + + // Two numeric tokens in a row. + // In this case, we're probably in + // front of either an object reference + // or an object specification. + // Determine the case and return the data + if (($tok3 = $this->pdf_read_token ($c)) !== false) { + switch ($tok3) { + case 'obj' : + return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2); + case 'R' : + return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2); + } + // If we get to this point, that numeric value up + // there was just a numeric value. Push the extra + // tokens back into the stack and return the value. + array_push ($c->stack, $tok3); + } + } + + array_push ($c->stack, $tok2); + } + + if ($token === (string)((int)$token)) + return array (PDF_TYPE_NUMERIC, (int)$token); + else + return array (PDF_TYPE_REAL, (float)$token); + } else if ($token == 'true' || $token == 'false') { + return array (PDF_TYPE_BOOLEAN, $token == 'true'); + } else { + + // Just a token. Return it. + return array (PDF_TYPE_TOKEN, $token); + } + + } + } + + /** + * Resolve an object + * + * @param object $c pdf_context + * @param array $obj_spec The object-data + * @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para + */ + function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true) { + // Exit if we get invalid data + if (!is_array($obj_spec)) { + return false; + } + + if ($obj_spec[0] == PDF_TYPE_OBJREF) { + + // This is a reference, resolve it + if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) { + + // Save current file position + // This is needed if you want to resolve + // references while you're reading another object + // (e.g.: if you need to determine the length + // of a stream) + + $old_pos = ftell($c->file); + + // Reposition the file pointer and + // load the object header. + + $c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]); + + $header = $this->pdf_read_value($c,null,true); + + if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) { + $this->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location"); + } + + // If we're being asked to store all the information + // about the object, we add the object ID and generation + // number for later use + $this->actual_obj =& $result; + if ($encapsulate) { + $result = array ( + PDF_TYPE_OBJECT, + 'obj' => $obj_spec[1], + 'gen' => $obj_spec[2] + ); + } else { + $result = array(); + } + + // Now simply read the object data until + // we encounter an end-of-object marker + while(1) { + $value = $this->pdf_read_value($c); + if ($value === false || count($result) > 4) { + // in this case the parser coudn't find an endobj so we break here + break; + } + + if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') { + break; + } + + $result[] = $value; + } + + $c->reset($old_pos); + + if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) { + $result[0] = PDF_TYPE_STREAM; + } + + return $result; + } + } else { + return $obj_spec; + } + } + + + + /** + * Reads a token from the file + * + * @param object $c pdf_context + * @return mixed + */ + function pdf_read_token(&$c) + { + // If there is a token available + // on the stack, pop it out and + // return it. + + if (count($c->stack)) { + return array_pop($c->stack); + } + + // Strip away any whitespace + + do { + if (!$c->ensure_content()) { + return false; + } + $c->offset += _strspn($c->buffer, " \n\r\t", $c->offset); + } while ($c->offset >= $c->length - 1); + + // Get the first character in the stream + + $char = $c->buffer[$c->offset++]; + + switch ($char) { + + case '[' : + case ']' : + case '(' : + case ')' : + + // This is either an array or literal string + // delimiter, Return it + + return $char; + + case '<' : + case '>' : + + // This could either be a hex string or + // dictionary delimiter. Determine the + // appropriate case and return the token + + if ($c->buffer[$c->offset] == $char) { + if (!$c->ensure_content()) { + return false; + } + $c->offset++; + return $char . $char; + } else { + return $char; + } + + default : + + // This is "another" type of token (probably + // a dictionary entry or a numeric value) + // Find the end and return it. + + if (!$c->ensure_content()) { + return false; + } + + while(1) { + + // Determine the length of the token + + $pos = _strcspn($c->buffer, " []<>()\r\n\t/", $c->offset); + if ($c->offset + $pos <= $c->length - 1) { + break; + } else { + // If the script reaches this point, + // the token may span beyond the end + // of the current buffer. Therefore, + // we increase the size of the buffer + // and try again--just to be safe. + + $c->increase_length(); + } + } + + $result = substr($c->buffer, $c->offset - 1, $pos + 1); + + $c->offset += $pos; + return $result; + } + } + + +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdfdoc.pdf b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdfdoc.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ae2e236decff495dff8df405797f3e58514e4371 Binary files /dev/null and b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/pdfdoc.pdf differ diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/LICENSE b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/NOTICE b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..29ec9335e10798695dc390e0d1af6769557fd61f --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/NOTICE @@ -0,0 +1,9 @@ + + This software contains code derived from an article in the magazine + php|architect by Marco Tabini. + + This software contains code derived from Oliver Plathey - The author of + FPDF. FPDF is available from: http://www.fpdf.org + + The LZW- and the ASCII85-Decoder are adapted from the iText-Library + http://www.lowagie.com/iText/ \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf.css b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf.css new file mode 100644 index 0000000000000000000000000000000000000000..045a32e3722b6d458ff92e31fd4593c1eca136d0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf.css @@ -0,0 +1,11 @@ +BODY {font-family:times new roman,serif} +H2 {color:#4000A0} +P.demo {text-align:center; margin-top:-10px} +A.demo {text-decoration:none; font-weight:bold; color:#0000CC} +A.demo:link {text-decoration:none; font-weight:bold; color:#0000CC} +A.demo:hover {text-decoration:none; font-weight:bold; color:#0000FF} +A.demo:active {text-decoration:none; font-weight:bold; color:#0000FF} +.st {font-weight:bold; color:#900000} +.kw {color:#000080; font-weight:bold} +.str {color:#CC0000} +.cmt {color:#008000} diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf.php new file mode 100644 index 0000000000000000000000000000000000000000..6f718e619699ed7cc76b02671753d38ac7b8fc14 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf.php @@ -0,0 +1,1647 @@ +<?php +/******************************************************************************* +* Software: FPDF * +* Version: 1.53 * +* Date: 2004-12-31 * +* Author: Olivier PLATHEY * +* License: Freeware * +* * +* You may use, modify and redistribute this software as you wish. * +*******************************************************************************/ + +if(!class_exists('FPDF')) +{ +define('FPDF_VERSION','1.53'); + +class FPDF +{ +//Private properties +var $page; //current page number +var $n; //current object number +var $offsets; //array of object offsets +var $buffer; //buffer holding in-memory PDF +var $pages; //array containing pages +var $state; //current document state +var $compress; //compression flag +var $DefOrientation; //default orientation +var $CurOrientation; //current orientation +var $OrientationChanges; //array indicating orientation changes +var $k; //scale factor (number of points in user unit) +var $fwPt,$fhPt; //dimensions of page format in points +var $fw,$fh; //dimensions of page format in user unit +var $wPt,$hPt; //current dimensions of page in points +var $w,$h; //current dimensions of page in user unit +var $lMargin; //left margin +var $tMargin; //top margin +var $rMargin; //right margin +var $bMargin; //page break margin +var $cMargin; //cell margin +var $x,$y; //current position in user unit for cell positioning +var $lasth; //height of last cell printed +var $LineWidth; //line width in user unit +var $CoreFonts; //array of standard font names +var $fonts; //array of used fonts +var $FontFiles; //array of font files +var $diffs; //array of encoding differences +var $images; //array of used images +var $PageLinks; //array of links in pages +var $links; //array of internal links +var $FontFamily; //current font family +var $FontStyle; //current font style +var $underline; //underlining flag +var $CurrentFont; //current font info +var $FontSizePt; //current font size in points +var $FontSize; //current font size in user unit +var $DrawColor; //commands for drawing color +var $FillColor; //commands for filling color +var $TextColor; //commands for text color +var $ColorFlag; //indicates whether fill and text colors are different +var $ws; //word spacing +var $AutoPageBreak; //automatic page breaking +var $PageBreakTrigger; //threshold used to trigger page breaks +var $InFooter; //flag set when processing footer +var $ZoomMode; //zoom display mode +var $LayoutMode; //layout display mode +var $title; //title +var $subject; //subject +var $author; //author +var $keywords; //keywords +var $creator; //creator +var $AliasNbPages; //alias for total number of pages +var $PDFVersion; //PDF version number + +/******************************************************************************* +* * +* Public methods * +* * +*******************************************************************************/ +function FPDF($orientation='P',$unit='mm',$format='A4') +{ + //Some checks + $this->_dochecks(); + //Initialization of properties + $this->page=0; + $this->n=2; + $this->buffer=''; + $this->pages=array(); + $this->OrientationChanges=array(); + $this->state=0; + $this->fonts=array(); + $this->FontFiles=array(); + $this->diffs=array(); + $this->images=array(); + $this->links=array(); + $this->InFooter=false; + $this->lasth=0; + $this->FontFamily=''; + $this->FontStyle=''; + $this->FontSizePt=12; + $this->underline=false; + $this->DrawColor='0 G'; + $this->FillColor='0 g'; + $this->TextColor='0 g'; + $this->ColorFlag=false; + $this->ws=0; + //Standard fonts + $this->CoreFonts=array('courier'=>'Courier','courierB'=>'Courier-Bold','courierI'=>'Courier-Oblique','courierBI'=>'Courier-BoldOblique', + 'helvetica'=>'Helvetica','helveticaB'=>'Helvetica-Bold','helveticaI'=>'Helvetica-Oblique','helveticaBI'=>'Helvetica-BoldOblique', + 'times'=>'Times-Roman','timesB'=>'Times-Bold','timesI'=>'Times-Italic','timesBI'=>'Times-BoldItalic', + 'symbol'=>'Symbol','zapfdingbats'=>'ZapfDingbats'); + //Scale factor + if($unit=='pt') + $this->k=1; + elseif($unit=='mm') + $this->k=72/25.4; + elseif($unit=='cm') + $this->k=72/2.54; + elseif($unit=='in') + $this->k=72; + else + $this->Error('Incorrect unit: '.$unit); + //Page format + if(is_string($format)) + { + $format=strtolower($format); + if($format=='a3') + $format=array(841.89,1190.55); + elseif($format=='a4') + $format=array(595.28,841.89); + elseif($format=='a5') + $format=array(420.94,595.28); + elseif($format=='letter') + $format=array(612,792); + elseif($format=='legal') + $format=array(612,1008); + else + $this->Error('Unknown page format: '.$format); + $this->fwPt=$format[0]; + $this->fhPt=$format[1]; + } + else + { + $this->fwPt=$format[0]*$this->k; + $this->fhPt=$format[1]*$this->k; + } + $this->fw=$this->fwPt/$this->k; + $this->fh=$this->fhPt/$this->k; + //Page orientation + $orientation=strtolower($orientation); + if($orientation=='p' || $orientation=='portrait') + { + $this->DefOrientation='P'; + $this->wPt=$this->fwPt; + $this->hPt=$this->fhPt; + } + elseif($orientation=='l' || $orientation=='landscape') + { + $this->DefOrientation='L'; + $this->wPt=$this->fhPt; + $this->hPt=$this->fwPt; + } + else + $this->Error('Incorrect orientation: '.$orientation); + $this->CurOrientation=$this->DefOrientation; + $this->w=$this->wPt/$this->k; + $this->h=$this->hPt/$this->k; + //Page margins (1 cm) + $margin=28.35/$this->k; + $this->SetMargins($margin,$margin); + //Interior cell margin (1 mm) + $this->cMargin=$margin/10; + //Line width (0.2 mm) + $this->LineWidth=.567/$this->k; + //Automatic page break + $this->SetAutoPageBreak(true,2*$margin); + //Full width display mode + $this->SetDisplayMode('fullwidth'); + //Enable compression + $this->SetCompression(true); + //Set default PDF version number + $this->PDFVersion='1.3'; +} + +function SetMargins($left,$top,$right=-1) +{ + //Set left, top and right margins + $this->lMargin=$left; + $this->tMargin=$top; + if($right==-1) + $right=$left; + $this->rMargin=$right; +} + +function SetLeftMargin($margin) +{ + //Set left margin + $this->lMargin=$margin; + if($this->page>0 && $this->x<$margin) + $this->x=$margin; +} + +function SetTopMargin($margin) +{ + //Set top margin + $this->tMargin=$margin; +} + +function SetRightMargin($margin) +{ + //Set right margin + $this->rMargin=$margin; +} + +function SetAutoPageBreak($auto,$margin=0) +{ + //Set auto page break mode and triggering margin + $this->AutoPageBreak=$auto; + $this->bMargin=$margin; + $this->PageBreakTrigger=$this->h-$margin; +} + +function SetDisplayMode($zoom,$layout='continuous') +{ + //Set display mode in viewer + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) + $this->ZoomMode=$zoom; + else + $this->Error('Incorrect zoom display mode: '.$zoom); + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') + $this->LayoutMode=$layout; + else + $this->Error('Incorrect layout display mode: '.$layout); +} + +function SetCompression($compress) +{ + //Set page compression + if(function_exists('gzcompress')) + $this->compress=$compress; + else + $this->compress=false; +} + +function SetTitle($title) +{ + //Title of document + $this->title=$title; +} + +function SetSubject($subject) +{ + //Subject of document + $this->subject=$subject; +} + +function SetAuthor($author) +{ + //Author of document + $this->author=$author; +} + +function SetKeywords($keywords) +{ + //Keywords of document + $this->keywords=$keywords; +} + +function SetCreator($creator) +{ + //Creator of document + $this->creator=$creator; +} + +function AliasNbPages($alias='{nb}') +{ + //Define an alias for total number of pages + $this->AliasNbPages=$alias; +} + +function Error($msg) +{ + //Fatal error + die('<B>FPDF error: </B>'.$msg); +} + +function Open() +{ + //Begin document + $this->state=1; +} + +function Close() +{ + //Terminate document + if($this->state==3) + return; + if($this->page==0) + $this->AddPage(); + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + //Close document + $this->_enddoc(); +} + +function AddPage($orientation='') +{ + //Start a new page + if($this->state==0) + $this->Open(); + $family=$this->FontFamily; + $style=$this->FontStyle.($this->underline ? 'U' : ''); + $size=$this->FontSizePt; + $lw=$this->LineWidth; + $dc=$this->DrawColor; + $fc=$this->FillColor; + $tc=$this->TextColor; + $cf=$this->ColorFlag; + if($this->page>0) + { + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + } + //Start new page + $this->_beginpage($orientation); + //Set line cap style to square + $this->_out('2 J'); + //Set line width + $this->LineWidth=$lw; + $this->_out(sprintf('%.2f w',$lw*$this->k)); + //Set font + if($family) + $this->SetFont($family,$style,$size); + //Set colors + $this->DrawColor=$dc; + if($dc!='0 G') + $this->_out($dc); + $this->FillColor=$fc; + if($fc!='0 g') + $this->_out($fc); + $this->TextColor=$tc; + $this->ColorFlag=$cf; + //Page header + $this->Header(); + //Restore line width + if($this->LineWidth!=$lw) + { + $this->LineWidth=$lw; + $this->_out(sprintf('%.2f w',$lw*$this->k)); + } + //Restore font + if($family) + $this->SetFont($family,$style,$size); + //Restore colors + if($this->DrawColor!=$dc) + { + $this->DrawColor=$dc; + $this->_out($dc); + } + if($this->FillColor!=$fc) + { + $this->FillColor=$fc; + $this->_out($fc); + } + $this->TextColor=$tc; + $this->ColorFlag=$cf; +} + +function Header() +{ + //To be implemented in your own inherited class +} + +function Footer() +{ + //To be implemented in your own inherited class +} + +function PageNo() +{ + //Get current page number + return $this->page; +} + +function SetDrawColor($r,$g=-1,$b=-1) +{ + //Set color for all stroking operations + if(($r==0 && $g==0 && $b==0) || $g==-1) + $this->DrawColor=sprintf('%.3f G',$r/255); + else + $this->DrawColor=sprintf('%.3f %.3f %.3f RG',$r/255,$g/255,$b/255); + if($this->page>0) + $this->_out($this->DrawColor); +} + +function SetFillColor($r,$g=-1,$b=-1) +{ + //Set color for all filling operations + if(($r==0 && $g==0 && $b==0) || $g==-1) + $this->FillColor=sprintf('%.3f g',$r/255); + else + $this->FillColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); + if($this->page>0) + $this->_out($this->FillColor); +} + +function SetTextColor($r,$g=-1,$b=-1) +{ + //Set color for text + if(($r==0 && $g==0 && $b==0) || $g==-1) + $this->TextColor=sprintf('%.3f g',$r/255); + else + $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); +} + +function GetStringWidth($s) +{ + //Get width of a string in the current font + $s=(string)$s; + $cw=&$this->CurrentFont['cw']; + $w=0; + $l=strlen($s); + for($i=0;$i<$l;$i++) + $w+=$cw[$s{$i}]; + return $w*$this->FontSize/1000; +} + +function SetLineWidth($width) +{ + //Set line width + $this->LineWidth=$width; + if($this->page>0) + $this->_out(sprintf('%.2f w',$width*$this->k)); +} + +function Line($x1,$y1,$x2,$y2) +{ + //Draw a line + $this->_out(sprintf('%.2f %.2f m %.2f %.2f l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); +} + +function Rect($x,$y,$w,$h,$style='') +{ + //Draw a rectangle + if($style=='F') + $op='f'; + elseif($style=='FD' || $style=='DF') + $op='B'; + else + $op='S'; + $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); +} + +function AddFont($family,$style='',$file='') +{ + //Add a TrueType or Type1 font + $family=strtolower($family); + if($file=='') + $file=str_replace(' ','',$family).strtolower($style).'.php'; + if($family=='arial') + $family='helvetica'; + $style=strtoupper($style); + if($style=='IB') + $style='BI'; + $fontkey=$family.$style; + if(isset($this->fonts[$fontkey])) + $this->Error('Font already added: '.$family.' '.$style); + include($this->_getfontpath().$file); + if(!isset($name)) + $this->Error('Could not include font definition file'); + $i=count($this->fonts)+1; + $this->fonts[$fontkey]=array('i'=>$i,'type'=>$type,'name'=>$name,'desc'=>$desc,'up'=>$up,'ut'=>$ut,'cw'=>$cw,'enc'=>$enc,'file'=>$file); + if($diff) + { + //Search existing encodings + $d=0; + $nb=count($this->diffs); + for($i=1;$i<=$nb;$i++) + { + if($this->diffs[$i]==$diff) + { + $d=$i; + break; + } + } + if($d==0) + { + $d=$nb+1; + $this->diffs[$d]=$diff; + } + $this->fonts[$fontkey]['diff']=$d; + } + if($file) + { + if($type=='TrueType') + $this->FontFiles[$file]=array('length1'=>$originalsize); + else + $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2); + } +} + +function SetFont($family,$style='',$size=0) +{ + //Select a font; size given in points + global $fpdf_charwidths; + + $family=strtolower($family); + if($family=='') + $family=$this->FontFamily; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' || $family=='zapfdingbats') + $style=''; + $style=strtoupper($style); + if(strpos($style,'U')!==false) + { + $this->underline=true; + $style=str_replace('U','',$style); + } + else + $this->underline=false; + if($style=='IB') + $style='BI'; + if($size==0) + $size=$this->FontSizePt; + //Test if font is already selected + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) + return; + //Test if used for the first time + $fontkey=$family.$style; + if(!isset($this->fonts[$fontkey])) + { + //Check if one of the standard fonts + if(isset($this->CoreFonts[$fontkey])) + { + if(!isset($fpdf_charwidths[$fontkey])) + { + //Load metric file + $file=$family; + if($family=='times' || $family=='helvetica') + $file.=strtolower($style); + include($this->_getfontpath().$file.'.php'); + if(!isset($fpdf_charwidths[$fontkey])) + $this->Error('Could not include font metric file'); + } + $i=count($this->fonts)+1; + $this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + //Select it + $this->FontFamily=$family; + $this->FontStyle=$style; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + $this->CurrentFont=&$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function SetFontSize($size) +{ + //Set font size in points + if($this->FontSizePt==$size) + return; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function AddLink() +{ + //Create a new internal link + $n=count($this->links)+1; + $this->links[$n]=array(0,0); + return $n; +} + +function SetLink($link,$y=0,$page=-1) +{ + //Set destination of internal link + if($y==-1) + $y=$this->y; + if($page==-1) + $page=$this->page; + $this->links[$link]=array($page,$y); +} + +function Link($x,$y,$w,$h,$link) +{ + //Put a link on the page + $this->PageLinks[$this->page][]=array($x*$this->k,$this->hPt-$y*$this->k,$w*$this->k,$h*$this->k,$link); +} + +function Text($x,$y,$txt) +{ + //Output a string + $s=sprintf('BT %.2f %.2f Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); + if($this->underline && $txt!='') + $s.=' '.$this->_dounderline($x,$y,$txt); + if($this->ColorFlag) + $s='q '.$this->TextColor.' '.$s.' Q'; + $this->_out($s); +} + +function AcceptPageBreak() +{ + //Accept automatic page break or not + return $this->AutoPageBreak; +} + +function Cell($w,$h=0,$txt='',$border=0,$ln=0,$align='',$fill=0,$link='') +{ + //Output a cell + $k=$this->k; + if($this->y+$h>$this->PageBreakTrigger && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x=$this->x; + $ws=$this->ws; + if($ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->AddPage($this->CurOrientation); + $this->x=$x; + if($ws>0) + { + $this->ws=$ws; + $this->_out(sprintf('%.3f Tw',$ws*$k)); + } + } + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $s=''; + if($fill==1 || $border==1) + { + if($fill==1) + $op=($border==1) ? 'B' : 'f'; + else + $op='S'; + $s=sprintf('%.2f %.2f %.2f %.2f re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); + } + if(is_string($border)) + { + $x=$this->x; + $y=$this->y; + if(strpos($border,'L')!==false) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); + if(strpos($border,'T')!==false) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); + if(strpos($border,'R')!==false) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + if(strpos($border,'B')!==false) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + } + if($txt!=='') + { + if($align=='R') + $dx=$w-$this->cMargin-$this->GetStringWidth($txt); + elseif($align=='C') + $dx=($w-$this->GetStringWidth($txt))/2; + else + $dx=$this->cMargin; + if($this->ColorFlag) + $s.='q '.$this->TextColor.' '; + $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + $s.=sprintf('BT %.2f %.2f Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); + if($this->underline) + $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->ColorFlag) + $s.=' Q'; + if($link) + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); + } + if($s) + $this->_out($s); + $this->lasth=$h; + if($ln>0) + { + //Go to next line + $this->y+=$h; + if($ln==1) + $this->x=$this->lMargin; + } + else + $this->x+=$w; +} + +function MultiCell($w,$h,$txt,$border=0,$align='J',$fill=0) +{ + //Output text with automatic or explicit line breaks + $cw=&$this->CurrentFont['cw']; + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + if($nb>0 && $s[$nb-1]=="\n") + $nb--; + $b=0; + if($border) + { + if($border==1) + { + $border='LTRB'; + $b='LRT'; + $b2='LR'; + } + else + { + $b2=''; + if(strpos($border,'L')!==false) + $b2.='L'; + if(strpos($border,'R')!==false) + $b2.='R'; + $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; + } + } + $sep=-1; + $i=0; + $j=0; + $l=0; + $ns=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s{$i}; + if($c=="\n") + { + //Explicit line break + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $i++; + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + continue; + } + if($c==' ') + { + $sep=$i; + $ls=$l; + $ns++; + } + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($i==$j) + $i++; + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + } + else + { + if($align=='J') + { + $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); + } + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + } + else + $i++; + } + //Last chunk + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + if($border && strpos($border,'B')!==false) + $b.='B'; + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $this->x=$this->lMargin; +} + +function Write($h,$txt,$link='') +{ + //Output text in flowing mode + $cw=&$this->CurrentFont['cw']; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + $sep=-1; + $i=0; + $j=0; + $l=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s{$i}; + if($c=="\n") + { + //Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $i++; + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + continue; + } + if($c==' ') + $sep=$i; + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($this->x>$this->lMargin) + { + //Move to next line + $this->x=$this->lMargin; + $this->y+=$h; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $i++; + $nl++; + continue; + } + if($i==$j) + $i++; + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + } + else + $i++; + } + //Last chunk + if($i!=$j) + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); +} + +function Image($file,$x,$y,$w=0,$h=0,$type='',$link='') +{ + //Put an image on the page + if(!isset($this->images[$file])) + { + //First use of image, get info + if($type=='') + { + $pos=strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type=substr($file,$pos+1); + } + $type=strtolower($type); + $mqr=get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + if($type=='jpg' || $type=='jpeg') + $info=$this->_parsejpg($file); + elseif($type=='png') + $info=$this->_parsepng($file); + else + { + //Allow for additional formats + $mtd='_parse'.$type; + if(!method_exists($this,$mtd)) + $this->Error('Unsupported image type: '.$type); + $info=$this->$mtd($file); + } + set_magic_quotes_runtime($mqr); + $info['i']=count($this->images)+1; + $this->images[$file]=$info; + } + else + $info=$this->images[$file]; + //Automatic width and height calculation if needed + if($w==0 && $h==0) + { + //Put image at 72 dpi + $w=$info['w']/$this->k; + $h=$info['h']/$this->k; + } + if($w==0) + $w=$h*$info['w']/$info['h']; + if($h==0) + $h=$w*$info['h']/$info['w']; + $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) + $this->Link($x,$y,$w,$h,$link); +} + +function Ln($h='') +{ + //Line feed; default value is last cell height + $this->x=$this->lMargin; + if(is_string($h)) + $this->y+=$this->lasth; + else + $this->y+=$h; +} + +function GetX() +{ + //Get x position + return $this->x; +} + +function SetX($x) +{ + //Set x position + if($x>=0) + $this->x=$x; + else + $this->x=$this->w+$x; +} + +function GetY() +{ + //Get y position + return $this->y; +} + +function SetY($y) +{ + //Set y position and reset x + $this->x=$this->lMargin; + if($y>=0) + $this->y=$y; + else + $this->y=$this->h+$y; +} + +function SetXY($x,$y) +{ + //Set x and y positions + $this->SetY($y); + $this->SetX($x); +} + +function Output($name='',$dest='') +{ + //Output PDF to some destination + //Finish document if necessary + if($this->state<3) + $this->Close(); + //Normalize parameters + if(is_bool($dest)) + $dest=$dest ? 'D' : 'F'; + $dest=strtoupper($dest); + if($dest=='') + { + if($name=='') + { + $name='doc.pdf'; + $dest='I'; + } + else + $dest='F'; + } + switch($dest) + { + case 'I': + //Send to standard output + if(ob_get_contents()) + $this->Error('Some data has already been output, can\'t send PDF file'); + if(php_sapi_name()!='cli') + { + //We send to a browser + header('Content-Type: application/pdf'); + if(headers_sent()) + $this->Error('Some data has already been output to browser, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-disposition: inline; filename="'.$name.'"'); + } + echo $this->buffer; + break; + case 'D': + //Download file + if(ob_get_contents()) + $this->Error('Some data has already been output, can\'t send PDF file'); + if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) + header('Content-Type: application/force-download'); + else + header('Content-Type: application/octet-stream'); + if(headers_sent()) + $this->Error('Some data has already been output to browser, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-disposition: attachment; filename="'.$name.'"'); + echo $this->buffer; + break; + case 'F': + //Save to local file + $f=fopen($name,'wb'); + if(!$f) + $this->Error('Unable to create output file: '.$name); + fwrite($f,$this->buffer,strlen($this->buffer)); + fclose($f); + break; + case 'S': + //Return as a string + return $this->buffer; + default: + $this->Error('Incorrect output destination: '.$dest); + } + return ''; +} + +/******************************************************************************* +* * +* Protected methods * +* * +*******************************************************************************/ +function _dochecks() +{ + //Check for locale-related bug + if(1.1==1) + $this->Error('Don\'t alter the locale before including class file'); + //Check for decimal separator + if(sprintf('%.1f',1.0)!='1.0') + setlocale(LC_NUMERIC,'C'); +} + +function _getfontpath() +{ + if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) + define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); + return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; +} + +function _putpages() +{ + $nb=$this->page; + if(!empty($this->AliasNbPages)) + { + //Replace number of pages + for($n=1;$n<=$nb;$n++) + $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); + } + if($this->DefOrientation=='P') + { + $wPt=$this->fwPt; + $hPt=$this->fhPt; + } + else + { + $wPt=$this->fhPt; + $hPt=$this->fwPt; + } + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + for($n=1;$n<=$nb;$n++) + { + //Page + $this->_newobj(); + $this->_out('<</Type /Page'); + $this->_out('/Parent 1 0 R'); + if(isset($this->OrientationChanges[$n])) + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt)); + $this->_out('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) + { + //Links + $annots='/Annots ['; + foreach($this->PageLinks[$n] as $pl) + { + $rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; + if(is_string($pl[4])) + $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; + else + { + $l=$this->links[$pl[4]]; + $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; + $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k); + } + } + $this->_out($annots.']'); + } + $this->_out('/Contents '.($this->n+1).' 0 R>>'); + $this->_out('endobj'); + //Page content + $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); + $this->_putstream($p); + $this->_out('endobj'); + } + //Pages root + $this->offsets[1]=strlen($this->buffer); + $this->_out('1 0 obj'); + $this->_out('<</Type /Pages'); + $kids='/Kids ['; + for($i=0;$i<$nb;$i++) + $kids.=(3+2*$i).' 0 R '; + $this->_out($kids.']'); + $this->_out('/Count '.$nb); + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt)); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putfonts() +{ + $nf=$this->n; + foreach($this->diffs as $diff) + { + //Encodings + $this->_newobj(); + $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); + $this->_out('endobj'); + } + $mqr=get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + foreach($this->FontFiles as $file=>$info) + { + //Font file embedding + $this->_newobj(); + $this->FontFiles[$file]['n']=$this->n; + $font=''; + $f=fopen($this->_getfontpath().$file,'rb',1); + if(!$f) + $this->Error('Font file not found'); + while(!feof($f)) + $font.=fread($f,8192); + fclose($f); + $compressed=(substr($file,-2)=='.z'); + if(!$compressed && isset($info['length2'])) + { + $header=(ord($font{0})==128); + if($header) + { + //Strip first binary header + $font=substr($font,6); + } + if($header && ord($font{$info['length1']})==128) + { + //Strip second binary header + $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); + } + } + $this->_out('<</Length '.strlen($font)); + if($compressed) + $this->_out('/Filter /FlateDecode'); + $this->_out('/Length1 '.$info['length1']); + if(isset($info['length2'])) + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); + $this->_out('>>'); + $this->_putstream($font); + $this->_out('endobj'); + } + set_magic_quotes_runtime($mqr); + foreach($this->fonts as $k=>$font) + { + //Font objects + $this->fonts[$k]['n']=$this->n+1; + $type=$font['type']; + $name=$font['name']; + if($type=='core') + { + //Standard font + $this->_newobj(); + $this->_out('<</Type /Font'); + $this->_out('/BaseFont /'.$name); + $this->_out('/Subtype /Type1'); + if($name!='Symbol' && $name!='ZapfDingbats') + $this->_out('/Encoding /WinAnsiEncoding'); + $this->_out('>>'); + $this->_out('endobj'); + } + elseif($type=='Type1' || $type=='TrueType') + { + //Additional Type1 or TrueType font + $this->_newobj(); + $this->_out('<</Type /Font'); + $this->_out('/BaseFont /'.$name); + $this->_out('/Subtype /'.$type); + $this->_out('/FirstChar 32 /LastChar 255'); + $this->_out('/Widths '.($this->n+1).' 0 R'); + $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); + if($font['enc']) + { + if(isset($font['diff'])) + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); + else + $this->_out('/Encoding /WinAnsiEncoding'); + } + $this->_out('>>'); + $this->_out('endobj'); + //Widths + $this->_newobj(); + $cw=&$font['cw']; + $s='['; + for($i=32;$i<=255;$i++) + $s.=$cw[chr($i)].' '; + $this->_out($s.']'); + $this->_out('endobj'); + //Descriptor + $this->_newobj(); + $s='<</Type /FontDescriptor /FontName /'.$name; + foreach($font['desc'] as $k=>$v) + $s.=' /'.$k.' '.$v; + $file=$font['file']; + if($file) + $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; + $this->_out($s.'>>'); + $this->_out('endobj'); + } + else + { + //Allow for additional types + $mtd='_put'.strtolower($type); + if(!method_exists($this,$mtd)) + $this->Error('Unsupported font type: '.$type); + $this->$mtd($font); + } + } +} + +function _putimages() +{ + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->images); + while(list($file,$info)=each($this->images)) + { + $this->_newobj(); + $this->images[$file]['n']=$this->n; + $this->_out('<</Type /XObject'); + $this->_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + if(isset($info['f'])) + $this->_out('/Filter /'.$info['f']); + if(isset($info['parms'])) + $this->_out($info['parms']); + if(isset($info['trns']) && is_array($info['trns'])) + { + $trns=''; + for($i=0;$i<count($info['trns']);$i++) + $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; + $this->_out('/Mask ['.$trns.']'); + } + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + unset($this->images[$file]['data']); + $this->_out('endobj'); + //Palette + if($info['cs']=='Indexed') + { + $this->_newobj(); + $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } + } +} + +function _putxobjectdict() +{ + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); +} + +function _putresourcedict() +{ + $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + $this->_out('/XObject <<'); + $this->_putxobjectdict(); + $this->_out('>>'); +} + +function _putresources() +{ + $this->_putfonts(); + $this->_putimages(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<<'); + $this->_putresourcedict(); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putinfo() +{ + $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); + if(!empty($this->title)) + $this->_out('/Title '.$this->_textstring($this->title)); + if(!empty($this->subject)) + $this->_out('/Subject '.$this->_textstring($this->subject)); + if(!empty($this->author)) + $this->_out('/Author '.$this->_textstring($this->author)); + if(!empty($this->keywords)) + $this->_out('/Keywords '.$this->_textstring($this->keywords)); + if(!empty($this->creator)) + $this->_out('/Creator '.$this->_textstring($this->creator)); + $this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis'))); +} + +function _putcatalog() +{ + $this->_out('/Type /Catalog'); + $this->_out('/Pages 1 0 R'); + if($this->ZoomMode=='fullpage') + $this->_out('/OpenAction [3 0 R /Fit]'); + elseif($this->ZoomMode=='fullwidth') + $this->_out('/OpenAction [3 0 R /FitH null]'); + elseif($this->ZoomMode=='real') + $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); + elseif(!is_string($this->ZoomMode)) + $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); + if($this->LayoutMode=='single') + $this->_out('/PageLayout /SinglePage'); + elseif($this->LayoutMode=='continuous') + $this->_out('/PageLayout /OneColumn'); + elseif($this->LayoutMode=='two') + $this->_out('/PageLayout /TwoColumnLeft'); +} + +function _putheader() +{ + $this->_out('%PDF-'.$this->PDFVersion); +} + +function _puttrailer() +{ + $this->_out('/Size '.($this->n+1)); + $this->_out('/Root '.$this->n.' 0 R'); + $this->_out('/Info '.($this->n-1).' 0 R'); +} + +function _enddoc() +{ + $this->_putheader(); + $this->_putpages(); + $this->_putresources(); + //Info + $this->_newobj(); + $this->_out('<<'); + $this->_putinfo(); + $this->_out('>>'); + $this->_out('endobj'); + //Catalog + $this->_newobj(); + $this->_out('<<'); + $this->_putcatalog(); + $this->_out('>>'); + $this->_out('endobj'); + //Cross-ref + $o=strlen($this->buffer); + $this->_out('xref'); + $this->_out('0 '.($this->n+1)); + $this->_out('0000000000 65535 f '); + for($i=1;$i<=$this->n;$i++) + $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); + //Trailer + $this->_out('trailer'); + $this->_out('<<'); + $this->_puttrailer(); + $this->_out('>>'); + $this->_out('startxref'); + $this->_out($o); + $this->_out('%%EOF'); + $this->state=3; +} + +function _beginpage($orientation) +{ + $this->page++; + $this->pages[$this->page]=''; + $this->state=2; + $this->x=$this->lMargin; + $this->y=$this->tMargin; + $this->FontFamily=''; + //Page orientation + if(!$orientation) + $orientation=$this->DefOrientation; + else + { + $orientation=strtoupper($orientation{0}); + if($orientation!=$this->DefOrientation) + $this->OrientationChanges[$this->page]=true; + } + if($orientation!=$this->CurOrientation) + { + //Change orientation + if($orientation=='P') + { + $this->wPt=$this->fwPt; + $this->hPt=$this->fhPt; + $this->w=$this->fw; + $this->h=$this->fh; + } + else + { + $this->wPt=$this->fhPt; + $this->hPt=$this->fwPt; + $this->w=$this->fh; + $this->h=$this->fw; + } + $this->PageBreakTrigger=$this->h-$this->bMargin; + $this->CurOrientation=$orientation; + } +} + +function _endpage() +{ + //End of page contents + $this->state=1; +} + +function _newobj() +{ + //Begin a new object + $this->n++; + $this->offsets[$this->n]=strlen($this->buffer); + $this->_out($this->n.' 0 obj'); +} + +function _dounderline($x,$y,$txt) +{ + //Underline text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); + return sprintf('%.2f %.2f %.2f %.2f re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); +} + +function _parsejpg($file) +{ + //Extract info from a JPEG file + $a=GetImageSize($file); + if(!$a) + $this->Error('Missing or incorrect image file: '.$file); + if($a[2]!=2) + $this->Error('Not a JPEG file: '.$file); + if(!isset($a['channels']) || $a['channels']==3) + $colspace='DeviceRGB'; + elseif($a['channels']==4) + $colspace='DeviceCMYK'; + else + $colspace='DeviceGray'; + $bpc=isset($a['bits']) ? $a['bits'] : 8; + //Read whole file + $f=fopen($file,'rb'); + $data=''; + while(!feof($f)) + $data.=fread($f,4096); + fclose($f); + return array('w'=>$a[0],'h'=>$a[1],'cs'=>$colspace,'bpc'=>$bpc,'f'=>'DCTDecode','data'=>$data); +} + +function _parsepng($file) +{ + //Extract info from a PNG file + $f=fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + //Check signature + if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + fread($f,4); + if(fread($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w=$this->_freadint($f); + $h=$this->_freadint($f); + $bpc=ord(fread($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct=ord(fread($f,1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else + $this->Error('Alpha channel not supported: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + fread($f,4); + $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_freadint($f); + $type=fread($f,4); + if($type=='PLTE') + { + //Read palette + $pal=fread($f,$n); + fread($f,4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=fread($f,$n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if($pos!==false) + $trns=array($pos); + } + fread($f,4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=fread($f,$n); + fread($f,4); + } + elseif($type=='IEND') + break; + else + fread($f,$n+4); + } + while($n); + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + fclose($f); + return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data); +} + +function _freadint($f) +{ + //Read a 4-byte integer from file + $a=unpack('Ni',fread($f,4)); + return $a['i']; +} + +function _textstring($s) +{ + //Format a text string + return '('.$this->_escape($s).')'; +} + +function _escape($s) +{ + //Add \ before \, ( and ) + return str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$s))); +} + +function _putstream($s) +{ + $this->_out('stream'); + $this->_out($s); + $this->_out('endstream'); +} + +function _out($s) +{ + //Add a line to the document + if($this->state==2) + $this->pages[$this->page].=$s."\n"; + else + $this->buffer.=$s."\n"; +} +//End of class +} + +//Handle special IE contype request +if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') +{ + header('Content-Type: application/pdf'); + exit; +} + +} +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf_tpl.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf_tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..24b17b0d4043ec47a09a9a99caf1fd6b58e4b59b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdf_tpl.php @@ -0,0 +1,446 @@ +<?php +// +// fpdf_tpl - Version 1.0.2 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +require_once("fpdf.php"); + +class fpdf_tpl extends fpdf { + /** + * Array of Tpl-Data + * @var array + */ + var $tpls = array(); + + /** + * Current Template-ID + * @var int + */ + var $tpl = 0; + + /** + * "In Template"-Flag + * @var boolean + */ + var $intpl = false; + + /** + * Nameprefix of Templates used in Resources-Dictonary + * @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an / + */ + var $tplprefix = "/TPL"; + + /** + * Nameprefix of Fonts used in Resources-Dictonary + * (not realy needed, but for future versions with import-function needed) + * @var string + */ + var $fontprefix = "/F"; + + /** + * Resources used By Templates and Pages + * @var array + */ + var $res = array(); + + /** + * Constructor + * See FPDF-Documentation + * @param string $orientation + * @param string $unit + * @param mixed $format + */ + function fpdf_tpl($orientation='P',$unit='mm',$format='A4') { + parent::fpdf($orientation,$unit,$format); + } + + /** + * Start a Template + * + * This method starts a template. You can give own coordinates to build an own sized + * Template. Pay attention, that the margins are adapted to the new templatesize. + * If you want to write outside the template, for example to build a clipped Template, + * you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call. + * + * If no parameter is given, the template uses the current page-size. + * The Method returns an ID of the current Template. This ID is used later for using this template. + * Warning: A created Template is used in PDF at all events. Still if you don't use it after creation! + * + * @param int $x The x-coordinate given in user-unit + * @param int $y The y-coordinate given in user-unit + * @param int $w The width given in user-unit + * @param int $h The height given in user-unit + * @return int The ID of new created Template + */ + function beginTemplate($x=null,$y=null,$w=null,$h=null) { + if ($this->page <= 0) + $this->error("You have to add a page to fpdf first!"); + + // Save settings + $this->tpl++; + $this->tpls[$this->tpl]['o_x'] = $this->x; + $this->tpls[$this->tpl]['o_y'] = $this->y; + $this->tpls[$this->tpl]['o_AutoPageBreak'] = $this->AutoPageBreak; + $this->tpls[$this->tpl]['o_bMargin'] = $this->bMargin; + $this->tpls[$this->tpl]['o_tMargin'] = $this->tMargin; + $this->tpls[$this->tpl]['o_lMargin'] = $this->lMargin; + $this->tpls[$this->tpl]['o_rMargin'] = $this->rMargin; + $this->tpls[$this->tpl]['o_h'] = $this->h; + $this->tpls[$this->tpl]['o_w'] = $this->w; + + $this->SetAutoPageBreak(false); + + if ($x == null) + $x = 0; + if ($y == null) + $y = 0; + if ($w == null) + $w = $this->w; + if ($h == null) + $h = $this->h; + + // Define own high and width to calculate possitions correct + $this->h = $h; + $this->w = $w; + + $this->tpls[$this->tpl]['buffer'] = ""; + $this->tpls[$this->tpl]['x'] = $x; + $this->tpls[$this->tpl]['y'] = $y; + $this->tpls[$this->tpl]['w'] = $w; + $this->tpls[$this->tpl]['h'] = $h; + + $this->intpl = true; + $this->SetXY($x+$this->lMargin,$y+$this->tMargin); + $this->SetRightMargin($this->w-$w+$this->rMargin); + + return $this->tpl; + } + + /** + * End Template + * + * This method ends a template and reset initiated variables on beginTemplate. + * + * @return mixed If a template is opened, the ID is returned. If not a false is returned. + */ + function endTemplate() { + if ($this->intpl) { + $this->intpl = false; + $this->SetAutoPageBreak($this->tpls[$this->tpl]['o_AutoPageBreak'],$this->tpls[$this->tpl]['o_bMargin']); + $this->SetXY($this->tpls[$this->tpl]['o_x'],$this->tpls[$this->tpl]['o_y']); + $this->tMargin = $this->tpls[$this->tpl]['o_tMargin']; + $this->lMargin = $this->tpls[$this->tpl]['o_lMargin']; + $this->rMargin = $this->tpls[$this->tpl]['o_rMargin']; + $this->h = $this->tpls[$this->tpl]['o_h']; + $this->w = $this->tpls[$this->tpl]['o_w']; + return $this->tpl; + } else { + return false; + } + } + + /** + * Use a Template in current Page or other Template + * + * You can use a template in a page or in another template. + * You can give the used template a new size like you use the Image()-method. + * All parameters are optional. The width or height is calculated automaticaly + * if one is given. If no parameter is given the origin size as defined in + * beginTemplate() is used. + * The calculated or used width and height are returned as an array. + * + * @param int $tplidx A valid template-Id + * @param int $_x The x-position + * @param int $_y The y-position + * @param int $_w The new width of the template + * @param int $_h The new height of the template + * @retrun array The height and width of the template + */ + function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) { + if ($this->page <= 0) + $this->error("You have to add a page to fpdf first!"); + + if (!$this->tpls[$tplidx]) + $this->error("Template does not exist!"); + + if ($this->intpl) { + $this->res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; + } + extract($this->tpls[$tplidx]); + + if ($_x == null) + $_x = $x; + if ($_y == null) + $_y = $y; + $wh = $this->getTemplateSize($tplidx,$_w,$_h); + $_w = $wh['w']; + $_h = $wh['h']; + + $this->_out(sprintf("q %.4f 0 0 %.4f %.2f %.2f cm", ($_w/$w), ($_h/$h), $_x*$this->k, ($this->h-($_y+$_h))*$this->k)); // Translate + $this->_out($this->tplprefix.$tplidx." Do Q"); + + return array("w" => $_w, "h" => $_h); + } + + /** + * Get The calculated Size of a Template + * + * If one size is given, this method calculates the other one. + * + * @param int $tplidx A valid template-Id + * @param int $_w The width of the template + * @param int $_h The height of the template + * @return array The height and width of the template + */ + function getTemplateSize($tplidx, $_w=0, $_h=0) { + if (!$this->tpls[$tplidx]) + return false; + + extract($this->tpls[$tplidx]); + if ($_w == 0 and $_h == 0) { + $_w = $w; + $_h = $h; + } + + if($_w==0) + $_w=$_h*$w/$h; + if($_h==0) + $_h=$_w*$h/$w; + + return array("w" => $_w, "h" => $_h); + } + + /** + * See FPDF-Documentation ;-) + */ + function SetFont($family,$style='',$size=0) { + //Select a font; size given in points + global $fpdf_charwidths; + + $family=strtolower($family); + if($family=='') + $family=$this->FontFamily; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' or $family=='zapfdingbats') + $style=''; + $style=strtoupper($style); + if(is_int(strpos($style,'U'))) + { + $this->underline=true; + $style=str_replace('U','',$style); + } + else + $this->underline=false; + if($style=='IB') + $style='BI'; + if($size==0) + $size=$this->FontSizePt; + //Test if font is already selected + if($this->FontFamily==$family and $this->FontStyle==$style and $this->FontSizePt==$size and !$this->intpl) + return; + //Test if used for the first time + $fontkey=$family.$style; + if(!isset($this->fonts[$fontkey])) + { + //Check if one of the standard fonts + if(isset($this->CoreFonts[$fontkey])) + { + if(!isset($fpdf_charwidths[$fontkey])) + { + //Load metric file + $file=$family; + if($family=='times' or $family=='helvetica') + $file.=strtolower($style); + $file.='.php'; + if(defined('FPDF_FONTPATH')) + $file=FPDF_FONTPATH.$file; + include($file); + if(!isset($fpdf_charwidths[$fontkey])) + $this->Error('Could not include font metric file'); + } + $i = $this->findNextAvailFont(); + $this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + //Select it + $this->FontFamily=$family; + $this->FontStyle=$style; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + $this->CurrentFont=&$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT '.$this->fontprefix.'%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); + + + if ($this->intpl) { + $this->res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + } else { + $this->res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + } + } + + /** + * Find the next available Font-No. + * + * @return int + */ + function findNextAvailFont() { + return count($this->fonts)+1; + } + + /** + * See FPDF-Documentation ;-) + */ + function Image($file,$x,$y,$w=0,$h=0,$type='',$link='') { + parent::Image($file,$x,$y,$w,$h,$type,$link); + if ($this->intpl) { + $this->res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; + } else { + $this->res['page'][$this->page]['images'][$file] =& $this->images[$file]; + } + } + + /** + * See FPDF-Documentation ;-) + * + * AddPage is not available when you're "in" a template. + */ + function AddPage($orientation='') { + if ($this->intpl) + $this->Error('Adding pages in templates isn\'t possible!'); + parent::AddPage($orientation); + } + + /** + * Preserve adding Links in Templates ...won't work + */ + function Link($x,$y,$w,$h,$link) { + if ($this->intpl) + $this->Error('Using links in templates aren\'t possible!'); + parent::Link($x,$y,$w,$h,$link); + } + + function AddLink() { + if ($this->intpl) + $this->Error('Adding links in templates aren\'t possible!'); + return parent::AddLink(); + } + + function SetLink($link,$y=0,$page=-1) { + if ($this->intpl) + $this->Error('Setting links in templates aren\'t possible!'); + parent::SetLink($link,$y,$page); + } + + /** + * Private Method that writes the Resources-Objects + */ + function _puttemplates() { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->tpls); + foreach($this->tpls AS $tplidx => $tpl) { + + $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + $this->_newobj(); + $this->tpls[$tplidx]['n'] = $this->n; + $this->_out('<<'.$filter.'/Type /XObject'); + $this->_out('/Subtype /Form'); + $this->_out('/FormType 1'); + $this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k)); // ($this->h-$tpl['y'])*$this->k + $this->_out('/Resources '); + + $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + if (count($this->res['tpl'][$tplidx]['fonts'])) { + $this->_out('/Font <<'); + foreach($this->res['tpl'][$tplidx]['fonts'] as $font) + $this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + } + if(count($this->res['tpl'][$tplidx]['images']) || count($this->res['tpl'][$tplidx]['tpls'])) + { + $this->_out('/XObject <<'); + if (count($this->res['tpl'][$tplidx]['images'])) { + foreach($this->res['tpl'][$tplidx]['images'] as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + } + if (count($this->res['tpl'][$tplidx]['tpls'])) { + foreach($this->res['tpl'][$tplidx]['tpls'] as $i => $tpl) + $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + + $this->_out('/Length '.strlen($p).' >>'); + $this->_putstream($p); + $this->_out('endobj'); + } + } + + /** + * Private Method + */ + function _putresources() { + $this->_putfonts(); + $this->_putimages(); + $this->_puttemplates(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + if(count($this->images) || count($this->tpls)) + { + $this->_out('/XObject <<'); + if (count($this->images)) { + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + } + if (count($this->tpls)) { + foreach($this->tpls as $tplidx => $tpl) + $this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + $this->_out('endobj'); + } + + + /** + * Private Method + */ + function _out($s) { + //Add a line to the document + if ($this->state==2) { + if (!$this->intpl) + $this->pages[$this->page].=$s."\n"; + else + $this->tpls[$this->tpl]['buffer'] .= $s."\n"; + } else { + $this->buffer.=$s."\n"; + } + } +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdi.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdi.php new file mode 100644 index 0000000000000000000000000000000000000000..0586a378ed6be9dd9ab4d93460d2e92d45ca60fc --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdi.php @@ -0,0 +1,413 @@ +<?php +// +// FPDI - Version 1.1 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +define ('PDF_TYPE_NULL', 0); +define ('PDF_TYPE_NUMERIC', 1); +define ('PDF_TYPE_TOKEN', 2); +define ('PDF_TYPE_HEX', 3); +define ('PDF_TYPE_STRING', 4); +define ('PDF_TYPE_DICTIONARY', 5); +define ('PDF_TYPE_ARRAY', 6); +define ('PDF_TYPE_OBJDEC', 7); +define ('PDF_TYPE_OBJREF', 8); +define ('PDF_TYPE_OBJECT', 9); +define ('PDF_TYPE_STREAM', 10); + +ini_set('auto_detect_line_endings',1); // Strongly required! + +require_once("fpdf_tpl.php"); +require_once("fpdi_pdf_parser.php"); + + +class fpdi extends fpdf_tpl { + /** + * Actual filename + * @var string + */ + var $current_filename; + + /** + * Parser-Objects + * @var array + */ + var $parsers; + + /** + * Current parser + * @var object + */ + var $current_parser; + + /** + * FPDF/FPDI - PDF-Version + * @var double + */ + var $PDFVersion = 1.3; + + /** + * Highest version of imported PDF + * @var double + */ + var $importVersion = 1.3; + + /** + * object stack + * @var array + */ + var $obj_stack; + + /** + * done object stack + * @var array + */ + var $don_obj_stack; + + /** + * Current Object Id. + * @var integer + */ + var $current_obj_id; + + /** + * Constructor + * See FPDF-Manual + */ + function fpdi($orientation='P',$unit='mm',$format='A4') { + parent::fpdf_tpl($orientation,$unit,$format); + } + + /** + * Set a source-file + * + * @param string $filename a valid filename + * @return int number of available pages + */ + function setSourceFile($filename) { + $this->current_filename = $filename; + $fn =& $this->current_filename; + + $this->parsers[$fn] = new fpdi_pdf_parser($fn,$this); + $this->current_parser =& $this->parsers[$fn]; + + return $this->parsers[$fn]->getPageCount(); + } + + /** + * Import a page + * + * @param int $pageno pagenumber + * @return int Index of imported page - to use with fpdf_tpl::useTemplate() + */ + function ImportPage($pageno) { + $fn =& $this->current_filename; + + $this->parsers[$fn]->setPageno($pageno); + + $this->tpl++; + $this->tpls[$this->tpl] = array(); + $this->tpls[$this->tpl]['parser'] =& $this->parsers[$fn]; + $this->tpls[$this->tpl]['resources'] = $this->parsers[$fn]->getPageResources(); + $this->tpls[$this->tpl]['buffer'] = $this->parsers[$fn]->getContent(); + // $mediabox holds the dimensions of the source page + $mediabox = $this->parsers[$fn]->getPageMediaBox($pageno); + + // To build array that can used by pdf_tpl::useTemplate() + $this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl],$mediabox); + + return $this->tpl; + } + + /** + * Private method, that rebuilds all needed objects of source files + */ + function _putOobjects() { + if (is_array($this->parsers) && count($this->parsers) > 0) { + foreach($this->parsers AS $filename => $p) { + $this->current_parser =& $this->parsers[$filename]; + if (is_array($this->obj_stack[$filename])) { + while($n = key($this->obj_stack[$filename])) { + $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c,$this->obj_stack[$filename][$n][1]); + + $this->_newobj($this->obj_stack[$filename][$n][0]); + + if ($nObj[0] == PDF_TYPE_STREAM) { + $this->pdf_write_value ($nObj); + } else { + $this->pdf_write_value ($nObj[1]); + } + + $this->_out('endobj'); + $this->obj_stack[$filename][$n] = null; // free memory + unset($this->obj_stack[$filename][$n]); + reset($this->obj_stack[$filename]); + } + } + } + } + } + + /** + * Rewritten for handling own defined PDF-Versions + * only needed by FPDF 1.52 + */ + function _begindoc() { + //Start document + $this->state=1; + } + + /** + * Sets the PDF Version to the highest of imported documents + */ + function setVersion() { + if ($this->importVersion > $this->PDFVersion) + $this->PDFVersion = $this->importVersion; + + if (!method_exists($this, '_putheader')) { + $this->buffer = '%PDF-'.$this->PDFVersion."\n".$this->buffer; + } + } + + /** + * rewritten for handling higher PDF Versions + */ + function _enddoc() { + $this->setVersion(); + parent::_enddoc(); + } + + + /** + * Put resources + */ + function _putresources() { + $this->_putfonts(); + $this->_putimages(); + $this->_puttemplates(); + $this->_putOobjects(); + + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + if(count($this->images) || count($this->tpls)) + { + $this->_out('/XObject <<'); + if (count($this->images)) { + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + } + if (count($this->tpls)) { + foreach($this->tpls as $tplidx => $tpl) + $this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + $this->_out('endobj'); + } + + /** + * Private Method that writes /XObjects - "Templates" + */ + function _puttemplates() { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->tpls); + foreach($this->tpls AS $tplidx => $tpl) { + + $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + $this->_newobj(); + $this->tpls[$tplidx]['n'] = $this->n; + $this->_out('<<'.$filter.'/Type /XObject'); + $this->_out('/Subtype /Form'); + $this->_out('/FormType 1'); + $this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k)); + $this->_out('/Resources '); + + if ($tpl['resources']) { + $this->current_parser =& $tpl['parser']; + $this->pdf_write_value($tpl['resources']); + } else { + $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + if (count($this->res['tpl'][$tplidx]['fonts'])) { + $this->_out('/Font <<'); + foreach($this->res['tpl'][$tplidx]['fonts'] as $font) + $this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + } + if(count($this->res['tpl'][$tplidx]['images']) || count($this->res['tpl'][$tplidx]['tpls'])) + { + $this->_out('/XObject <<'); + if (count($this->res['tpl'][$tplidx]['images'])) { + foreach($this->res['tpl'][$tplidx]['images'] as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + } + if (count($this->res['tpl'][$tplidx]['tpls'])) { + foreach($this->res['tpl'][$tplidx]['tpls'] as $i => $tpl) + $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + } + + $this->_out('/Length '.strlen($p).' >>'); + $this->_putstream($p); + $this->_out('endobj'); + } + } + + /** + * Rewritten to handle existing own defined objects + */ + function _newobj($obj_id=false,$onlynewobj=false) { + if (!$obj_id) { + $obj_id = ++$this->n; + } + + //Begin a new object + if (!$onlynewobj) { + $this->offsets[$obj_id]=strlen($this->buffer); + $this->_out($obj_id.' 0 obj'); + $this->current_obj_id = $obj_id; // for later use with encryption + } + + } + + /** + * Writes a value + * Needed to rebuild the source document + * + * @param mixed $value A PDF-Value. Structure of values see cases in this method + */ + function pdf_write_value(&$value) + { + + switch ($value[0]) { + + case PDF_TYPE_NUMERIC : + case PDF_TYPE_TOKEN : + // A numeric value or a token. + // Simply output them + $this->_out($value[1]." "); + break; + + case PDF_TYPE_ARRAY : + + // An array. Output the proper + // structure and move on. + + $this->_out("[",false); + for ($i = 0; $i < count($value[1]); $i++) { + $this->pdf_write_value($value[1][$i]); + } + + $this->_out("]"); + break; + + case PDF_TYPE_DICTIONARY : + + // A dictionary. + $this->_out("<<",false); + + reset ($value[1]); + + while (list($k, $v) = each($value[1])) { + $this->_out($k . " ",false); + $this->pdf_write_value($v); + } + + $this->_out(">>"); + break; + + case PDF_TYPE_OBJREF : + + // An indirect object reference + // Fill the object stack if needed + if (!isset($this->don_obj_stack[$this->current_parser->filename][$value[1]])) { + $this->_newobj(false,true); + $this->obj_stack[$this->current_parser->filename][$value[1]] = array($this->n,$value); + $this->don_obj_stack[$this->current_parser->filename][$value[1]] = array($this->n,$value); + } + $objid = $this->don_obj_stack[$this->current_parser->filename][$value[1]][0]; + + $this->_out("{$objid} 0 R"); //{$value[2]} + break; + + case PDF_TYPE_STRING : + + // A string. + $this->_out('(' . $value[1] . ')'); + + break; + + case PDF_TYPE_STREAM : + + // A stream. First, output the + // stream dictionary, then the + // stream data itself. + $this->pdf_write_value($value[1]); + $this->_out("stream"); + $this->_out($value[2][1]); + $this->_out("endstream"); + break; + case PDF_TYPE_HEX : + + $this->_out("<" . $value[1] . ">"); + break; + + case PDF_TYPE_NULL : + // The null object. + + $this->_out("null"); + break; + } + } + + + /** + * Private Method + */ + function _out($s,$ln=true) { + //Add a line to the document + if ($this->state==2) { + if (!$this->intpl) + $this->pages[$this->page].=$s.($ln == true ? "\n" : ''); + else + $this->tpls[$this->tpl]['buffer'] .= $s.($ln == true ? "\n" : ''); + } else { + $this->buffer.=$s.($ln == true ? "\n" : ''); + } + } + + /** + * close all files opened by parsers + */ + function closeParsers() { + foreach ($this->parsers as $parser){ + $parser->closeFile(); + } + } + +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdi_pdf_parser.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdi_pdf_parser.php new file mode 100644 index 0000000000000000000000000000000000000000..a6826fc9fb0facd7213459ff9e24c132968660cc --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/fpdi_pdf_parser.php @@ -0,0 +1,482 @@ +<?php +// +// FPDI - Version 1.1 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +if (!defined ('PDF_TYPE_NULL')) + define ('PDF_TYPE_NULL', 0); +if (!defined ('PDF_TYPE_NUMERIC')) + define ('PDF_TYPE_NUMERIC', 1); +if (!defined ('PDF_TYPE_TOKEN')) + define ('PDF_TYPE_TOKEN', 2); +if (!defined ('PDF_TYPE_HEX')) + define ('PDF_TYPE_HEX', 3); +if (!defined ('PDF_TYPE_STRING')) + define ('PDF_TYPE_STRING', 4); +if (!defined ('PDF_TYPE_DICTIONARY')) + define ('PDF_TYPE_DICTIONARY', 5); +if (!defined ('PDF_TYPE_ARRAY')) + define ('PDF_TYPE_ARRAY', 6); +if (!defined ('PDF_TYPE_OBJDEC')) + define ('PDF_TYPE_OBJDEC', 7); +if (!defined ('PDF_TYPE_OBJREF')) + define ('PDF_TYPE_OBJREF', 8); +if (!defined ('PDF_TYPE_OBJECT')) + define ('PDF_TYPE_OBJECT', 9); +if (!defined ('PDF_TYPE_STREAM')) + define ('PDF_TYPE_STREAM', 10); + + +require_once("wrapper_functions.php"); +require_once("pdf_parser.php"); + +class fpdi_pdf_parser extends pdf_parser { + + /** + * Pages + * Index beginns at 0 + * + * @var array + */ + var $pages; + + /** + * Page count + * @var integer + */ + var $page_count; + + /** + * actual page number + * @var integer + */ + var $pageno; + + /** + * PDF Version of imported Document + * @var string + */ + var $pdfVersion; + + /** + * FPDI Reference + * @var object + */ + var $fpdi; + + /** + * Constructor + * + * @param string $filename Source-Filename + * @param object $fpdi Object of type fpdi + */ + function fpdi_pdf_parser($filename,&$fpdi) { + $this->fpdi =& $fpdi; + $this->filename = $filename; + + parent::pdf_parser($filename); + + // Get Info + $this->getInfo(); + + // resolve Pages-Dictonary + $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']); + + // Read pages + $this->read_pages($this->c, $pages, $this->pages); + + // count pages; + $this->page_count = count($this->pages); + } + + /** + * Overwrite parent::error() + * + * @param string $msg Error-Message + */ + function error($msg) { + $this->fpdi->error($msg); + } + + /** + * Get pagecount from sourcefile + * + * @return int + */ + function getPageCount() { + return $this->page_count; + } + + + /** + * Set pageno + * + * @param int $pageno Pagenumber to use + */ + function setPageno($pageno) { + $pageno-=1; + + if ($pageno < 0 || $pageno >= $this->getPageCount()) { + $this->fpdi->error("Pagenumber is wrong!"); + } + + $this->pageno = $pageno; + } + + /** + * Get page-resources from current page + * + * @return array + */ + function getPageResources() { + return $this->_getPageResources($this->pages[$this->pageno]); + } + + /** + * Get page-resources from /Page + * + * @param array $obj Array of pdf-data + */ + function _getPageResources ($obj) { // $obj = /Page + $obj = $this->pdf_resolve_object($this->c, $obj); + + // If the current object has a resources + // dictionary associated with it, we use + // it. Otherwise, we move back to its + // parent object. + if (isset ($obj[1][1]['/Resources'])) { + $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } else { + if (!isset ($obj[1][1]['/Parent'])) { + return false; + } else { + $res = $this->_getPageResources($obj[1][1]['/Parent']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } + } + } + + + function getInfo() { + $avail_infos = array("Title", "Author", "Subject", "Keywords", "Creator", "Producer", "CreationDate", "ModDate", "Trapped"); + + $_infos = $this->pdf_resolve_object($this->c,$this->xref['trailer'][1]['/Info']); + $infos = array(); + + foreach ($avail_infos AS $info) { + if (isset($_infos[1][1]["/".$info])) { + if ($_infos[1][1]["/".$info][0] == PDF_TYPE_STRING) { + $infos[$info] = $this->deescapeString($_infos[1][1]["/".$info][1]); + } else if ($_infos[1][1]["/".$info][0] == PDF_TYPE_HEX) { + $infos[$info] = $this->hex2String($_infos[1][1]["/".$info][1]); + } + } + } + $this->infos = $infos; + } + + /** + * Rebuilds a hexstring to string + * + * @param string $hex hexstring + * @return string + */ + function hex2String($hex) { + $endian = false; + + if (preg_match("/^FEFF/",$hex)) { // is utf-16 aka big endian + $i = 4; + $endian = "big"; + } else if (preg_match("/^FFFE/",$hex)) { // is utf-16 aka little endian + $i = 4; + $endian = "little"; + } else { + $i = 0; + } + + $s = ""; + $l = strlen($hex); + for (; $i < $l; $i+=2) { + if (!$endian) { + $s .= chr(hexdec($hex[$i].(isset($hex[$i+1]) ? $hex[$i+1] : '0'))); + } else { + if ($endian == "big") { + $_c = $hex[$i].$hex[$i+1]; + $i+=2; + $c = $hex[$i].$hex[$i+1]; + + if ($_c != "00") { + $s .= "?"; + continue; + } else { + $s .= chr(hexdec($c)); + continue; + } + } else if ($endian == "little") { + $c = $hex[$i].$hex[$i+1]; + $i+=2; + $_c = $hex[$i].$hex[$i+1]; + + if ($_c != "00") { + $s .= "?"; + continue; + } else { + $s .= chr(hexdec($c)); + continue; + } + } + } + } + + return $s; + } + + function deescapeString($s) { + $torepl = array("/\\\(\d{1,3})/e" => "chr(octdec(\\1))", + "/\\\\\(/" => "(", + "/\\\\\)/" => ")"); + return preg_replace(array_keys($torepl),$torepl,$s); + } + + + + /** + * Get content of current page + * + * If more /Contents is an array, the streams are concated + * + * @return string + */ + function getContent() { + $buffer = ""; + + $contents = $this->getPageContent($this->pages[$this->pageno][1][1]['/Contents']); + foreach($contents AS $tmp_content) { + $buffer .= $this->rebuildContentStream($tmp_content); + } + + return $buffer; + } + + + /** + * Resolve all content-objects + * + * @param array $content_ref + * @return array + */ + function getPageContent($content_ref) { + $contents = array(); + + if ($content_ref[0] == PDF_TYPE_OBJREF) { + $content = $this->pdf_resolve_object($this->c, $content_ref); + if ($content[1][0] == PDF_TYPE_ARRAY) { + $contents = $this->getPageContent($content[1]); + } else { + $contents[] = $content; + } + } else if ($content_ref[0] == PDF_TYPE_ARRAY) { + foreach ($content_ref[1] AS $tmp_content_ref) { + $contents = array_merge($contents,$this->getPageContent($tmp_content_ref)); + } + } + + return $contents; + } + + + /** + * Rebuild content-streams + * only non-compressed streams and /FlateDecode are ready! + * + * @param array $obj + * @return string + */ + function rebuildContentStream($obj) { + $filters = array(); + + if (isset($obj[1][1]['/Filter'])) { + $_filter = $obj[1][1]['/Filter']; + + if ($_filter[0] == PDF_TYPE_TOKEN) { + $filters[] = $_filter; + } else if ($_filter[0] == PDF_TYPE_ARRAY) { + $filters = $_filter[1]; + } + } + + $stream = $obj[2][1]; + + foreach ($filters AS $_filter) { + switch ($_filter[1]) { + case "/FlateDecode": + if (function_exists('gzuncompress')) { + $stream = @gzuncompress($stream); + } else { + $this->fpdi->error(sprintf("To handle %s filter, please compile php with zlib support.",$_filter[1])); + } + if ($stream === false) { + $this->fpdi->error("Error while decompressing string."); + } + + break; + case "/LZWDecode": + @include_once("decoders/lzw.php"); + if (class_exists("LZWDecode")) { + $lzwdec = new LZWDecode($this->fpdi); + $stream = $lzwdec->decode($stream); + } else { + $this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1])); + } + break; + case "/ASCII85Decode": + @include_once("decoders/ascii85.php"); + if (class_exists("ASCII85Decode")) { + $ascii85 = new ASCII85Decode($this->fpdi); + $stream = $ascii85->decode(trim($stream)); + } else { + $this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1])); + } + break; + case null: + $stream = $stream; + break; + default: + $this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1])); + } + } + + return $stream; + } + + /** + * Get MediaBox + * + * gets an array that describes the size of a page. + * + * @param integer $pageno + * @return array @see getPageBox() + */ + function getPageMediaBox($pageno) { + return $this->getPageBox($this->pages[$pageno-1],"/MediaBox"); + } + + + /** + * Get a Box from a page + * Arrayformat is same as used by fpdf_tpl + * + * @param array $page a /Page + * @param string $box_index Type of Box @see getPageBoxes() + * @return array + */ + function getPageBox($page, $box_index) { + $page = $this->pdf_resolve_object($this->c,$page); + + $box = null; + if (isset($page[1][1][$box_index])) + $box =& $page[1][1][$box_index]; + + if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { + $tmp_box = $this->pdf_resolve_object($this->c,$box); + $box = $tmp_box[1]; + } + + if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { + $b =& $box[1]; + return array("x" => $b[0][1]/$this->fpdi->k, + "y" => $b[1][1]/$this->fpdi->k, + "w" => $b[2][1]/$this->fpdi->k, + "h" => $b[3][1]/$this->fpdi->k); + } else if (!isset ($page[1][1]['/Parent'])) { + return false; + } else { + return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index); + } + } + + /** + * Get all Boxes from /Page + * + * @param array a /Page + * @return array + */ + function getPageBoxes($page) { + $_boxes = array("/MediaBox","/CropBox","/BleedBox","/TrimBox","/ArtBox"); + $boxes = array(); + + foreach($_boxes AS $box) { + if ($_box = $this->getPageBox($page,$box)) { + $boxes[$box] = $_box; + } + } + + return $boxes; + } + + + /** + * Read all /Page(es) + * + * @param object pdf_context + * @param array /Pages + * @param array the result-array + */ + function read_pages (&$c, &$pages, &$result) { + + // Get the kids dictionary + $kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']); + + if (!is_array($kids)) + $this->fpdi->Error("Cannot find /Kids in current /Page-Dictionary"); + foreach ($kids[1] as $v) { + $pg = $this->pdf_resolve_object ($c, $v); + #print_r($pg); + + if ($pg[1][1]['/Type'][1] === '/Pages') { + // If one of the kids is an embedded + // /Pages array, resolve it as well. + $this->read_pages ($c, $pg, $result); + } else { + $result[] = $pg; + } + } + } + + + + /** + * Get PDF-Version + * + * And reset the PDF Version used in FPDI if needed + */ + function getPDFVersion() { + parent::getPDFVersion(); + + if (isset($this->fpdi->importVersion) && $this->pdfVersion > $this->fpdi->importVersion) { + $this->fpdi->importVersion = $this->pdfVersion; + } + } + +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/pdf_context.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/pdf_context.php new file mode 100644 index 0000000000000000000000000000000000000000..148190279cdb84a0c4bfc0e9ddcb16386b35e0aa --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/pdf_context.php @@ -0,0 +1,78 @@ +<?php +// +// FPDI - Version 1.1 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +class pdf_context { + + var $file; + var $buffer; + var $offset; + var $length; + + var $stack; + + // Constructor + + function pdf_context($f) { + $this->file = $f; + $this->reset(); + } + + // Optionally move the file + // pointer to a new location + // and reset the buffered data + + function reset($pos = null, $l = 100) { + if (!is_null ($pos)) { + fseek ($this->file, $pos); + } + + $this->buffer = fread($this->file, $l); + $this->offset = 0; + $this->length = strlen($this->buffer); + $this->stack = array(); + } + + // Make sure that there is at least one + // character beyond the current offset in + // the buffer to prevent the tokenizer + // from attempting to access data that does + // not exist + + function ensure_content() { + if ($this->offset >= $this->length - 1) { + return $this->increase_length(); + } else { + return true; + } + } + + // Forcefully read more data into the buffer + + function increase_length($l=100) { + if (feof($this->file)) { + return false; + } else { + $this->buffer .= fread($this->file, $l); + $this->length = strlen($this->buffer); + return true; + } + } + +} +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/pdf_parser.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/pdf_parser.php new file mode 100644 index 0000000000000000000000000000000000000000..c7747236bda88f79d5cd8f3ffd6f18664b62102a --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/pdf_parser.php @@ -0,0 +1,634 @@ +<?php +// +// FPDI - Version 1.1 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +if (!defined ('PDF_TYPE_NULL')) + define ('PDF_TYPE_NULL', 0); +if (!defined ('PDF_TYPE_NUMERIC')) + define ('PDF_TYPE_NUMERIC', 1); +if (!defined ('PDF_TYPE_TOKEN')) + define ('PDF_TYPE_TOKEN', 2); +if (!defined ('PDF_TYPE_HEX')) + define ('PDF_TYPE_HEX', 3); +if (!defined ('PDF_TYPE_STRING')) + define ('PDF_TYPE_STRING', 4); +if (!defined ('PDF_TYPE_DICTIONARY')) + define ('PDF_TYPE_DICTIONARY', 5); +if (!defined ('PDF_TYPE_ARRAY')) + define ('PDF_TYPE_ARRAY', 6); +if (!defined ('PDF_TYPE_OBJDEC')) + define ('PDF_TYPE_OBJDEC', 7); +if (!defined ('PDF_TYPE_OBJREF')) + define ('PDF_TYPE_OBJREF', 8); +if (!defined ('PDF_TYPE_OBJECT')) + define ('PDF_TYPE_OBJECT', 9); +if (!defined ('PDF_TYPE_STREAM')) + define ('PDF_TYPE_STREAM', 10); + +require_once("pdf_context.php"); + +class pdf_parser { + + /** + * Filename + * @var string + */ + var $filename; + + /** + * File resource + * @var resource + */ + var $f; + + /** + * PDF Context + * @var object pdf_context-Instance + */ + var $c; + + /** + * xref-Data + * @var array + */ + var $xref; + + /** + * root-Object + * @var array + */ + var $root; + + + /** + * Constructor + * + * @param string $filename Source-Filename + */ + function pdf_parser($filename) { + $this->filename = $filename; + + $this->f = @fopen($this->filename,"rb"); + + if (!$this->f) + $this->error(sprintf("Cannot open %s !",$filename)); + + $this->getPDFVersion(); + + $this->c = new pdf_context($this->f); + // Read xref-Data + $this->pdf_read_xref($this->xref, $this->pdf_find_xref()); + + // Check for Encryption + $this->getEncryption(); + + // Read root + $this->pdf_read_root(); + } + + /** + * Close the opened file + */ + function closeFile() { + if (isset($this->f)) { + fclose($this->f); + } + } + + /** + * Print Error and die + * + * @param string $msg Error-Message + */ + function error($msg) { + die("<b>PDF-Parser Error:</b> ".$msg); + } + + /** + * Check Trailer for Encryption + */ + function getEncryption() { + if (isset($this->xref['trailer'][1]['/Encrypt'])) { + $this->error("File is encrypted!"); + } + } + + /** + * Find/Return /Root + * + * @return array + */ + function pdf_find_root() { + if ($this->xref['trailer'][1]['/Root'][0] != PDF_TYPE_OBJREF) { + $this->Error("Wrong Type of Root-Element! Must be an indirect reference"); + } + return $this->xref['trailer'][1]['/Root']; + } + + /** + * Read the /Root + */ + function pdf_read_root() { + // read root + $this->root = $this->pdf_resolve_object($this->c, $this->pdf_find_root()); + } + + /** + * Get PDF-Version + * + * And reset the PDF Version used in FPDI if needed + */ + function getPDFVersion() { + fseek($this->f, 0); + preg_match("/\d\.\d/",fread($this->f,16),$m); + $this->pdfVersion = $m[0]; + } + + /** + * Find the xref-Table + */ + function pdf_find_xref() { + fseek ($this->f, -50, SEEK_END); + $data = fread($this->f, 50); + + if (!preg_match('/startxref\s*(\d+)\s*%%EOF\s*$/', $data, $matches)) { + $this->error("Unable to find pointer to xref table"); + } + + return (int) $matches[1]; + } + + /** + * Read xref-table + * + * @param array $result Array of xref-table + * @param integer $offset of xref-table + * @param integer $start start-position in xref-table + * @param integer $end end-position in xref-table + */ + function pdf_read_xref(&$result, $offset, $start = null, $end = null) { + if (is_null ($start) || is_null ($end)) { + fseek($this->f, $o_pos = $offset); + $data = trim(fgets($this->f)); + + if ($data !== 'xref') { + fseek($this->f, $o_pos); + $data = trim(_fgets($this->f, true)); + + /*if ($data !== 'xref') { + $this->error("Unable to find xref table - Maybe a Problem with 'auto_detect_line_endings'"); + }*/ + } + + $o_pos = ftell($this->f); + $data = explode(' ', trim(fgets($this->f))); + if (count($data) != 2) { + fseek($this->f, $o_pos); + $data = explode(' ', trim(_fgets($this->f, true))); + + /*if (count($data) != 2) + $this->error("Unexpected header in xref table");*/ + } + $start = $data[0]; + $end = $start + $data[1]; + } + + if (!isset($result['xref_location'])) { + $result['xref_location'] = $offset; + } + + if (!isset($result['max_object']) || $end > $result['max_object']) { + $result['max_object'] = $end; + } + + for (; $start < $end; $start++) { + $data = fread($this->f, 20); // Spezifications says: 20 bytes including newlines + $offset = substr($data, 0, 10); + $generation = substr($data, 11, 5); + + if (!isset ($result['xref'][$start][(int) $generation])) { + $result['xref'][$start][(int) $generation] = (int) $offset; + } + } + + $o_pos = ftell($this->f); + $data = fgets($this->f); + + if (preg_match("/trailer/",$data)) { + if (preg_match("/(.*trailer[ \n\r]+)/",$data,$m)) { + fseek($this->f, $o_pos+strlen($m[1])); + } + + $c =& new pdf_context($this->f); + $trailer = $this->pdf_read_value($c); + + if (isset($trailer[1]['/Prev'])) { + $this->pdf_read_xref($result, $trailer[1]['/Prev'][1]); + $result['trailer'][1] = array_merge($result['trailer'][1], $trailer[1]); + } else { + $result['trailer'] = $trailer; + } + } else { + $data = explode(' ', trim($data)); + + if (count($data) != 2) { + fseek($this->f, $o_pos); + $data = explode(' ', trim (_fgets ($this->f, true))); + + if (count($data) != 2) { + $this->error("Unexpected data in xref table"); + } + } + + $this->pdf_read_xref($result, null, (int) $data[0], (int) $data[0] + (int) $data[1]); + } + } + + + /** + * Reads an Value + * + * @param object $c pdf_context + * @param string $token a Token + * @return mixed + */ + function pdf_read_value(&$c, $token = null) { + if (is_null($token)) { + $token = $this->pdf_read_token($c); + } + + if ($token === false) { + return false; + } + + switch ($token) { + case '<': + // This is a hex string. + // Read the value, then the terminator + + $pos = $c->offset; + + while(1) { + + $match = strpos ($c->buffer, '>', $pos); + + // If you can't find it, try + // reading more data from the stream + + if ($match === false) { + if (!$c->increase_length()) { + return false; + } else { + continue; + } + } + + $result = substr ($c->buffer, $c->offset, $match - $c->offset); + $c->offset = $match+1; + + return array (PDF_TYPE_HEX, $result); + } + + break; + case '<<': + // This is a dictionary. + + $result = array(); + + // Recurse into this function until we reach + // the end of the dictionary. + while (($key = $this->pdf_read_token($c)) !== '>>') { + if ($key === false) { + return false; + } + + if (($value = $this->pdf_read_value($c)) === false) { + return false; + } + $result[$key] = $value; + } + + return array (PDF_TYPE_DICTIONARY, $result); + + case '[': + // This is an array. + + $result = array(); + + // Recurse into this function until we reach + // the end of the array. + while (($token = $this->pdf_read_token($c)) !== ']') { + if ($token === false) { + return false; + } + + if (($value = $this->pdf_read_value($c, $token)) === false) { + return false; + } + + $result[] = $value; + } + + return array (PDF_TYPE_ARRAY, $result); + + case '(' : + // This is a string + + $pos = $c->offset; + + while(1) { + + // Start by finding the next closed + // parenthesis + + $match = strpos ($c->buffer, ')', $pos); + + // If you can't find it, try + // reading more data from the stream + + if ($match === false) { + if (!$c->increase_length()) { + return false; + } else { + continue; + } + } + + // Make sure that there is no backslash + // before the parenthesis. If there is, + // move on. Otherwise, return the string. + + if (isset($c->buffer[$match - 1]) && $c->buffer[$match - 1] !== '\\' || + isset($c->buffer[$match - 1]) && $c->buffer[$match - 1] === '\\' && isset($c->buffer[$match - 2]) && $c->buffer[$match - 2] === '\\') { + $result = substr ($c->buffer, $c->offset, $match - $c->offset); + $c->offset = $match + 1; + return array (PDF_TYPE_STRING, $result); + } else { + $pos = $match + 1; + + if ($pos > $c->offset + $c->length) { + $c->increase_length(); + } + } + } + + case "stream": + $o_pos = ftell($c->file)-strlen($c->buffer); + $o_offset = $c->offset; + + $c->reset($startpos = $o_pos + $o_offset); + + $e = 0; // ensure line breaks in front of the stream + if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13)) + $e++; + if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10)) + $e++; + + if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) { + $tmp_c = new pdf_context($this->f); + $tmp_length = $this->pdf_resolve_object($tmp_c,$this->actual_obj[1][1]['/Length']); + $length = $tmp_length[1][1]; + } else { + $length = $this->actual_obj[1][1]['/Length'][1]; + } + + $c->reset($startpos+$e,$length); + $v = $c->buffer; + $c->reset($startpos+$e+$length+strlen("endstream")); + + return array(PDF_TYPE_STREAM, $v); + + default : + if (is_numeric ($token)) { + // A numeric token. Make sure that + // it is not part of something else. + if (($tok2 = $this->pdf_read_token ($c)) !== false) { + if (is_numeric ($tok2)) { + + // Two numeric tokens in a row. + // In this case, we're probably in + // front of either an object reference + // or an object specification. + // Determine the case and return the data + if (($tok3 = $this->pdf_read_token ($c)) !== false) { + switch ($tok3) { + case 'obj' : + return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2); + case 'R' : + return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2); + } + // If we get to this point, that numeric value up + // there was just a numeric value. Push the extra + // tokens back into the stack and return the value. + array_push ($c->stack, $tok3); + } + } + + array_push ($c->stack, $tok2); + } + + return array (PDF_TYPE_NUMERIC, $token); + } else { + + // Just a token. Return it. + return array (PDF_TYPE_TOKEN, $token); + } + + } + } + + /** + * Resolve an object + * + * @param object $c pdf_context + * @param array $obj_spec The object-data + * @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para + */ + function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true) { + // Exit if we get invalid data + if (!is_array($obj_spec)) { + return false; + } + + if ($obj_spec[0] == PDF_TYPE_OBJREF) { + + // This is a reference, resolve it + if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) { + + // Save current file position + // This is needed if you want to resolve + // references while you're reading another object + // (e.g.: if you need to determine the length + // of a stream) + + $old_pos = ftell($c->file); + + // Reposition the file pointer and + // load the object header. + + $c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]); + + $header = $this->pdf_read_value($c,null,true); + + if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) { + $this->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location"); + } + + // If we're being asked to store all the information + // about the object, we add the object ID and generation + // number for later use + $this->actual_obj =& $result; + if ($encapsulate) { + $result = array ( + PDF_TYPE_OBJECT, + 'obj' => $obj_spec[1], + 'gen' => $obj_spec[2] + ); + } else { + $result = array(); + } + + // Now simply read the object data until + // we encounter an end-of-object marker + while(1) { + $value = $this->pdf_read_value($c); + if ($value === false || count($result) > 4) { + // in this case the parser coudn't find an endobj so we break here + break; + } + + if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') { + break; + } + + $result[] = $value; + } + + $c->reset($old_pos); + + if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) { + $result[0] = PDF_TYPE_STREAM; + } + + return $result; + } + } else { + return $obj_spec; + } + } + + + + /** + * Reads a token from the file + * + * @param object $c pdf_context + * @return mixed + */ + function pdf_read_token(&$c) + { + // If there is a token available + // on the stack, pop it out and + // return it. + + if (count($c->stack)) { + return array_pop($c->stack); + } + + // Strip away any whitespace + + do { + if (!$c->ensure_content()) { + return false; + } + $c->offset += _strspn($c->buffer, " \n\r", $c->offset); + } while ($c->offset >= $c->length - 1); + + // Get the first character in the stream + + $char = $c->buffer[$c->offset++]; + + switch ($char) { + + case '[' : + case ']' : + case '(' : + case ')' : + + // This is either an array or literal string + // delimiter, Return it + + return $char; + + case '<' : + case '>' : + + // This could either be a hex string or + // dictionary delimiter. Determine the + // appropriate case and return the token + + if ($c->buffer[$c->offset] == $char) { + if (!$c->ensure_content()) { + return false; + } + $c->offset++; + return $char . $char; + } else { + return $char; + } + + default : + + // This is "another" type of token (probably + // a dictionary entry or a numeric value) + // Find the end and return it. + + if (!$c->ensure_content()) { + return false; + } + + while(1) { + + // Determine the length of the token + + $pos = _strcspn($c->buffer, " []<>()\r\n\t/", $c->offset); + + if ($c->offset + $pos <= $c->length - 1) { + break; + } else { + // If the script reaches this point, + // the token may span beyond the end + // of the current buffer. Therefore, + // we increase the size of the buffer + // and try again--just to be safe. + + $c->increase_length(); + } + } + + $result = substr($c->buffer, $c->offset - 1, $pos + 1); + + $c->offset += $pos; + return $result; + } + } + + +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/wrapper_functions.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/wrapper_functions.php new file mode 100644 index 0000000000000000000000000000000000000000..5077d2d6a9557a759218d1ed5058dddcfb42500b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/previous_version/wrapper_functions.php @@ -0,0 +1,88 @@ +<?php +// +// FPDI - Version 1.1 +// +// Copyright 2004,2005 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +if (!defined("PHP_VER_LOWER43")) + define("PHP_VER_LOWER43", version_compare(PHP_VERSION, "4.3", "<")); + + +/** + * ensure that strspn works correct if php-version < 4.3 + */ +function _strspn($str1, $str2, $start=null, $length=null) { + $numargs = func_num_args(); + + if (PHP_VER_LOWER43 == 1) { + if (isset($length)) { + $str1 = substr($str1, $start, $length); + } else { + $str1 = substr($str1, $start); + } + } + + if ($numargs == 2 || PHP_VER_LOWER43 == 1) { + return strspn($str1, $str2); + } else if ($numargs == 3) { + return strspn($str1, $str2, $start); + } else { + return strspn($str1, $str2, $start, $length); + } +} + + +/** + * ensure that strcspn works correct if php-version < 4.3 + */ +function _strcspn($str1, $str2, $start=null, $length=null) { + $numargs = func_num_args(); + + if (PHP_VER_LOWER43 == 1) { + if (isset($length)) { + $str1 = substr($str1, $start, $length); + } else { + $str1 = substr($str1, $start); + } + } + + if ($numargs == 2 || PHP_VER_LOWER43 == 1) { + return strcspn($str1, $str2); + } else if ($numargs == 3) { + return strcspn($str1, $str2, $start); + } else { + return strcspn($str1, $str2, $start, $length); + } +} + + +/** + * ensure that fgets works correct if php-version < 4.3 + */ +function _fgets (&$h, $force=false) { + $startpos = ftell($h); + $s = fgets($h, 1024); + + if ((PHP_VER_LOWER43 == 1 || $force) && preg_match("/^([^\r\n]*[\r\n]{1,2})(.)/",trim($s), $ns)) { + $s = $ns[1]; + fseek($h,$startpos+strlen($s)); + } + + return $s; +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/20k_c1.txt b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/20k_c1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b09f265f4026c4dc97eb35785770dac0e05793d --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/20k_c1.txt @@ -0,0 +1,10 @@ +The year 1866 was marked by a bizarre development, an unexplained and downright inexplicable phenomenon that surely no one has forgotten. Without getting into those rumors that upset civilians in the seaports and deranged the public mind even far inland, it must be said that professional seamen were especially alarmed. Traders, shipowners, captains of vessels, skippers, and master mariners from Europe and America, naval officers from every country, and at their heels the various national governments on these two continents, were all extremely disturbed by the business. +In essence, over a period of time several ships had encountered "an enormous thing" at sea, a long spindle-shaped object, sometimes giving off a phosphorescent glow, infinitely bigger and faster than any whale. +The relevant data on this apparition, as recorded in various logbooks, agreed pretty closely as to the structure of the object or creature in question, its unprecedented speed of movement, its startling locomotive power, and the unique vitality with which it seemed to be gifted. If it was a cetacean, it exceeded in bulk any whale previously classified by science. No naturalist, neither Cuvier nor Lacépède, neither Professor Dumeril nor Professor de Quatrefages, would have accepted the existence of such a monster sight unseen -- specifically, unseen by their own scientific eyes. +Striking an average of observations taken at different times -- rejecting those timid estimates that gave the object a length of 200 feet, and ignoring those exaggerated views that saw it as a mile wide and three long--you could still assert that this phenomenal creature greatly exceeded the dimensions of anything then known to ichthyologists, if it existed at all. +Now then, it did exist, this was an undeniable fact; and since the human mind dotes on objects of wonder, you can understand the worldwide excitement caused by this unearthly apparition. As for relegating it to the realm of fiction, that charge had to be dropped. +In essence, on July 20, 1866, the steamer Governor Higginson, from the Calcutta & Burnach Steam Navigation Co., encountered this moving mass five miles off the eastern shores of Australia. Captain Baker at first thought he was in the presence of an unknown reef; he was even about to fix its exact position when two waterspouts shot out of this inexplicable object and sprang hissing into the air some 150 feet. So, unless this reef was subject to the intermittent eruptions of a geyser, the Governor Higginson had fair and honest dealings with some aquatic mammal, until then unknown, that could spurt from its blowholes waterspouts mixed with air and steam. +Similar events were likewise observed in Pacific seas, on July 23 of the same year, by the Christopher Columbus from the West India & Pacific Steam Navigation Co. Consequently, this extraordinary cetacean could transfer itself from one locality to another with startling swiftness, since within an interval of just three days, the Governor Higginson and the Christopher Columbus had observed it at two positions on the charts separated by a distance of more than 700 nautical leagues. +Fifteen days later and 2,000 leagues farther, the Helvetia from the Compagnie Nationale and the Shannon from the Royal Mail line, running on opposite tacks in that part of the Atlantic lying between the United States and Europe, respectively signaled each other that the monster had been sighted in latitude 42 degrees 15' north and longitude 60 degrees 35' west of the meridian of Greenwich. From their simultaneous observations, they were able to estimate the mammal's minimum length at more than 350 English feet; this was because both the Shannon and the Helvetia were of smaller dimensions, although each measured 100 meters stem to stern. Now then, the biggest whales, those rorqual whales that frequent the waterways of the Aleutian Islands, have never exceeded a length of 56 meters--if they reach even that. +One after another, reports arrived that would profoundly affect public opinion: new observations taken by the transatlantic liner Pereire, the Inman line's Etna running afoul of the monster, an official report drawn up by officers on the French frigate Normandy, dead-earnest reckonings obtained by the general staff of Commodore Fitz-James aboard the Lord Clyde. In lighthearted countries, people joked about this phenomenon, but such serious, practical countries as England, America, and Germany were deeply concerned. +In every big city the monster was the latest rage; they sang about it in the coffee houses, they ridiculed it in the newspapers, they dramatized it in the theaters. The tabloids found it a fine opportunity for hatching all sorts of hoaxes. In those newspapers short of copy, you saw the reappearance of every gigantic imaginary creature, from "Moby Dick," that dreadful white whale from the High Arctic regions, to the stupendous kraken whose tentacles could entwine a 500-ton craft and drag it into the ocean depths. They even reprinted reports from ancient times: the views of Aristotle and Pliny accepting the existence of such monsters, then the Norwegian stories of Bishop Pontoppidan, the narratives of Paul Egede, and finally the reports of Captain Harrington -- whose good faith is above suspicion--in which he claims he saw, while aboard the Castilian in 1857, one of those enormous serpents that, until then, had frequented only the seas of France's old extremist newspaper, The Constitutionalist. diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/20k_c2.txt b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/20k_c2.txt new file mode 100644 index 0000000000000000000000000000000000000000..096dbd193ba0d523a483b75017062e41fedb8084 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/20k_c2.txt @@ -0,0 +1,23 @@ +During the period in which these developments were occurring, I had returned from a scientific undertaking organized to explore the Nebraska badlands in the United States. In my capacity as Assistant Professor at the Paris Museum of Natural History, I had been attached to this expedition by the French government. After spending six months in Nebraska, I arrived in New York laden with valuable collections near the end of March. My departure for France was set for early May. In the meantime, then, I was busy classifying my mineralogical, botanical, and zoological treasures when that incident took place with the Scotia. +I was perfectly abreast of this question, which was the big news of the day, and how could I not have been? I had read and reread every American and European newspaper without being any farther along. This mystery puzzled me. Finding it impossible to form any views, I drifted from one extreme to the other. Something was out there, that much was certain, and any doubting Thomas was invited to place his finger on the Scotia's wound. +When I arrived in New York, the question was at the boiling point. The hypothesis of a drifting islet or an elusive reef, put forward by people not quite in their right minds, was completely eliminated. And indeed, unless this reef had an engine in its belly, how could it move about with such prodigious speed? +Also discredited was the idea of a floating hull or some other enormous wreckage, and again because of this speed of movement. +So only two possible solutions to the question were left, creating two very distinct groups of supporters: on one side, those favoring a monster of colossal strength; on the other, those favoring an "underwater boat" of tremendous motor power. +Now then, although the latter hypothesis was completely admissible, it couldn't stand up to inquiries conducted in both the New World and the Old. That a private individual had such a mechanism at his disposal was less than probable. Where and when had he built it, and how could he have built it in secret? +Only some government could own such an engine of destruction, and in these disaster-filled times, when men tax their ingenuity to build increasingly powerful aggressive weapons, it was possible that, unknown to the rest of the world, some nation could have been testing such a fearsome machine. The Chassepot rifle led to the torpedo, and the torpedo has led to this underwater battering ram, which in turn will lead to the world putting its foot down. At least I hope it will. +But this hypothesis of a war machine collapsed in the face of formal denials from the various governments. Since the public interest was at stake and transoceanic travel was suffering, the sincerity of these governments could not be doubted. Besides, how could the assembly of this underwater boat have escaped public notice? Keeping a secret under such circumstances would be difficult enough for an individual, and certainly impossible for a nation whose every move is under constant surveillance by rival powers. +So, after inquiries conducted in England, France, Russia, Prussia, Spain, Italy, America, and even Turkey, the hypothesis of an underwater Monitor was ultimately rejected. +After I arrived in New York, several people did me the honor of consulting me on the phenomenon in question. In France I had published a two-volume work, in quarto, entitled The Mysteries of the Great Ocean Depths. Well received in scholarly circles, this book had established me as a specialist in this pretty obscure field of natural history. My views were in demand. As long as I could deny the reality of the business, I confined myself to a flat "no comment." But soon, pinned to the wall, I had to explain myself straight out. And in this vein, "the honorable Pierre Aronnax, Professor at the Paris Museum," was summoned by The New York Herald to formulate his views no matter what. +I complied. Since I could no longer hold my tongue, I let it wag. I discussed the question in its every aspect, both political and scientific, and this is an excerpt from the well-padded article I published in the issue of April 30. + +"Therefore," I wrote, "after examining these different hypotheses one by one, we are forced, every other supposition having been refuted, to accept the existence of an extremely powerful marine animal. +"The deepest parts of the ocean are totally unknown to us. No soundings have been able to reach them. What goes on in those distant depths? What creatures inhabit, or could inhabit, those regions twelve or fifteen miles beneath the surface of the water? What is the constitution of these animals? It's almost beyond conjecture. +"However, the solution to this problem submitted to me can take the form of a choice between two alternatives. +"Either we know every variety of creature populating our planet, or we do not. +"If we do not know every one of them, if nature still keeps ichthyological secrets from us, nothing is more admissible than to accept the existence of fish or cetaceans of new species or even new genera, animals with a basically 'cast-iron' constitution that inhabit strata beyond the reach of our soundings, and which some development or other, an urge or a whim if you prefer, can bring to the upper level of the ocean for long intervals. +"If, on the other hand, we do know every living species, we must look for the animal in question among those marine creatures already cataloged, and in this event I would be inclined to accept the existence of a giant narwhale. +"The common narwhale, or sea unicorn, often reaches a length of sixty feet. Increase its dimensions fivefold or even tenfold, then give this cetacean a strength in proportion to its size while enlarging its offensive weapons, and you have the animal we're looking for. It would have the proportions determined by the officers of the Shannon, the instrument needed to perforate the Scotia, and the power to pierce a steamer's hull. +"In essence, the narwhale is armed with a sort of ivory sword, or lance, as certain naturalists have expressed it. It's a king-sized tooth as hard as steel. Some of these teeth have been found buried in the bodies of baleen whales, which the narwhale attacks with invariable success. Others have been wrenched, not without difficulty, from the undersides of vessels that narwhales have pierced clean through, as a gimlet pierces a wine barrel. The museum at the Faculty of Medicine in Paris owns one of these tusks with a length of 2.25 meters and a width at its base of forty-eight centimeters! +"All right then! Imagine this weapon to be ten times stronger and the animal ten times more powerful, launch it at a speed of twenty miles per hour, multiply its mass times its velocity, and you get just the collision we need to cause the specified catastrophe. +"So, until information becomes more abundant, I plump for a sea unicorn of colossal dimensions, no longer armed with a mere lance but with an actual spur, like ironclad frigates or those warships called 'rams,' whose mass and motor power it would possess simultaneously. +"This inexplicable phenomenon is thus explained away--unless it's something else entirely, which, despite everything that has been sighted, studied, explored and experienced, is still possible!" diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.afm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.afm new file mode 100644 index 0000000000000000000000000000000000000000..806685eaea091a9204707853d8f2f27a4439ddd3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.afm @@ -0,0 +1,275 @@ +StartFontMetrics 4.1 +FontName Calligrapher-Regular +FullName Calligrapher Regular +Notice Generated by Fontographer 3.5 +EncodingScheme FontSpecific +FamilyName Calligrapher +Weight Regular +Version (Altsys Fontographer 3.5 5/26/92) +Characters 215 +ItalicAngle 0.0 +Ascender 899 +Descender -234 +UnderlineThickness 20 +UnderlinePosition -200 +IsFixedPitch false +FontBBox -50 -234 1328 899 +StartCharMetrics 256 +C 0 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 1 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 2 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 3 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 4 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 5 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 6 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 7 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 8 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 9 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 10 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 11 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 12 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 13 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 14 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 15 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 16 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 17 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 18 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 19 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 20 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 21 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 22 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 23 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 24 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 25 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 26 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 27 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 28 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 29 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 30 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 31 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 32 ; WX 282 ; N space ; B 67 -16 251 718 ; +C 33 ; WX 324 ; N exclam ; B 67 -16 251 718 ; +C 34 ; WX 405 ; N quotedbl ; B 60 460 353 718 ; +C 35 ; WX 584 ; N numbersign ; B 35 0 549 701 ; +C 36 ; WX 632 ; N dollar ; B 32 -126 595 814 ; +C 37 ; WX 980 ; N percent ; B 35 -16 945 703 ; +C 38 ; WX 776 ; N ampersand ; B 41 -17 811 670 ; +C 39 ; WX 259 ; N quotesingle ; B 72 460 206 718 ; +C 40 ; WX 299 ; N parenleft ; B 57 -119 299 785 ; +C 41 ; WX 299 ; N parenright ; B 0 -119 242 785 ; +C 42 ; WX 377 ; N asterisk ; B 35 407 342 714 ; +C 43 ; WX 600 ; N plus ; B 47 0 553 506 ; +C 44 ; WX 259 ; N comma ; B 35 -67 224 162 ; +C 45 ; WX 432 ; N hyphen ; B 28 249 404 377 ; +C 46 ; WX 254 ; N period ; B 43 -16 227 162 ; +C 47 ; WX 597 ; N slash ; B 7 -14 591 714 ; +C 48 ; WX 529 ; N zero ; B 21 -18 508 583 ; +C 49 ; WX 298 ; N one ; B 8 -15 233 582 ; +C 50 ; WX 451 ; N two ; B 17 -8 430 588 ; +C 51 ; WX 359 ; N three ; B 11 -54 337 582 ; +C 52 ; WX 525 ; N four ; B 18 -20 519 602 ; +C 53 ; WX 423 ; N five ; B 10 -55 420 582 ; +C 54 ; WX 464 ; N six ; B 23 -14 447 589 ; +C 55 ; WX 417 ; N seven ; B 8 -18 415 589 ; +C 56 ; WX 457 ; N eight ; B 19 -16 432 583 ; +C 57 ; WX 479 ; N nine ; B 26 -16 450 588 ; +C 58 ; WX 275 ; N colon ; B 59 -16 242 491 ; +C 59 ; WX 282 ; N semicolon ; B 54 -67 245 491 ; +C 60 ; WX 600 ; N less ; B 47 -8 553 514 ; +C 61 ; WX 600 ; N equal ; B 47 98 553 408 ; +C 62 ; WX 600 ; N greater ; B 47 -8 553 514 ; +C 63 ; WX 501 ; N question ; B 21 -16 473 721 ; +C 64 ; WX 800 ; N at ; B 29 -12 771 730 ; +C 65 ; WX 743 ; N A ; B -23 -14 754 723 ; +C 66 ; WX 636 ; N B ; B -42 -7 608 706 ; +C 67 ; WX 598 ; N C ; B 27 -12 572 712 ; +C 68 ; WX 712 ; N D ; B -42 -11 684 705 ; +C 69 ; WX 608 ; N E ; B -21 0 608 708 ; +C 70 ; WX 562 ; N F ; B -21 -18 584 716 ; +C 71 ; WX 680 ; N G ; B 29 -8 668 714 ; +C 72 ; WX 756 ; N H ; B 70 -17 777 728 ; +C 73 ; WX 308 ; N I ; B 14 -15 238 718 ; +C 74 ; WX 314 ; N J ; B 7 -223 244 727 ; +C 75 ; WX 676 ; N K ; B 14 -16 683 725 ; +C 76 ; WX 552 ; N L ; B 14 -8 580 713 ; +C 77 ; WX 1041 ; N M ; B 42 -17 1017 739 ; +C 78 ; WX 817 ; N N ; B -42 -17 747 736 ; +C 79 ; WX 729 ; N O ; B 32 -16 698 709 ; +C 80 ; WX 569 ; N P ; B -35 -15 570 716 ; +C 81 ; WX 698 ; N Q ; B 27 -201 1328 715 ; +C 82 ; WX 674 ; N R ; B -35 -20 696 712 ; +C 83 ; WX 618 ; N S ; B 31 -16 589 709 ; +C 84 ; WX 673 ; N T ; B -21 -20 702 714 ; +C 85 ; WX 805 ; N U ; B 0 -19 804 722 ; +C 86 ; WX 753 ; N V ; B -28 -20 788 729 ; +C 87 ; WX 1238 ; N W ; B -28 -17 1273 736 ; +C 88 ; WX 716 ; N X ; B 7 -38 709 731 ; +C 89 ; WX 754 ; N Y ; B -35 -17 789 747 ; +C 90 ; WX 599 ; N Z ; B 30 -5 584 748 ; +C 91 ; WX 315 ; N bracketleft ; B 93 -124 322 718 ; +C 92 ; WX 463 ; N backslash ; B -21 -18 484 736 ; +C 93 ; WX 315 ; N bracketright ; B -7 -124 222 718 ; +C 94 ; WX 600 ; N asciicircum ; B 63 266 537 658 ; +C 95 ; WX 547 ; N underscore ; B -7 -198 554 -163 ; +C 96 ; WX 278 ; N grave ; B -1 541 214 693 ; +C 97 ; WX 581 ; N a ; B 21 -16 581 494 ; +C 98 ; WX 564 ; N b ; B -24 -17 543 793 ; +C 99 ; WX 440 ; N c ; B 21 -17 422 490 ; +C 100 ; WX 571 ; N d ; B 0 -15 550 659 ; +C 101 ; WX 450 ; N e ; B 28 -23 428 493 ; +C 102 ; WX 347 ; N f ; B -35 -14 474 785 ; +C 103 ; WX 628 ; N g ; B 19 -219 612 496 ; +C 104 ; WX 611 ; N h ; B -29 -18 569 785 ; +C 105 ; WX 283 ; N i ; B -14 -15 241 679 ; +C 106 ; WX 283 ; N j ; B -14 -234 241 679 ; +C 107 ; WX 560 ; N k ; B -24 -15 582 789 ; +C 108 ; WX 252 ; N l ; B -28 -15 210 789 ; +C 109 ; WX 976 ; N m ; B -21 -16 927 494 ; +C 110 ; WX 595 ; N n ; B -28 -15 574 493 ; +C 111 ; WX 508 ; N o ; B 27 -17 485 490 ; +C 112 ; WX 549 ; N p ; B -28 -216 526 496 ; +C 113 ; WX 540 ; N q ; B 28 -219 491 493 ; +C 114 ; WX 395 ; N r ; B -21 -19 430 492 ; +C 115 ; WX 441 ; N s ; B 34 -15 413 493 ; +C 116 ; WX 307 ; N t ; B -21 -16 378 621 ; +C 117 ; WX 614 ; N u ; B -14 -18 558 501 ; +C 118 ; WX 556 ; N v ; B -28 -20 569 483 ; +C 119 ; WX 915 ; N w ; B -28 -17 928 495 ; +C 120 ; WX 559 ; N x ; B 14 -17 546 500 ; +C 121 ; WX 597 ; N y ; B -21 -227 541 500 ; +C 122 ; WX 452 ; N z ; B 28 -5 442 515 ; +C 123 ; WX 315 ; N braceleft ; B 6 -118 309 718 ; +C 124 ; WX 222 ; N bar ; B 63 -18 159 730 ; +C 125 ; WX 315 ; N braceright ; B 6 -118 309 718 ; +C 126 ; WX 600 ; N asciitilde ; B 69 166 531 340 ; +C 127 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 128 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 129 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 130 ; WX 0 ; N quotesinglbase ; B -23 -14 754 877 ; +C 131 ; WX 0 ; N florin ; B 0 -19 804 854 ; +C 132 ; WX 0 ; N quotedblbase ; B -23 -14 754 877 ; +C 133 ; WX 780 ; N ellipsis ; B 43 -16 747 162 ; +C 134 ; WX 0 ; N dagger ; B 27 -122 437 592 ; +C 135 ; WX 0 ; N daggerdbl ; B 43 278 227 456 ; +C 136 ; WX 278 ; N circumflex ; B -14 557 292 677 ; +C 137 ; WX 0 ; N perthousand ; B -23 -14 754 877 ; +C 138 ; WX 0 ; N Scaron ; B 0 0 0 100 ; +C 139 ; WX 0 ; N guilsinglleft ; B 43 278 227 456 ; +C 140 ; WX 1064 ; N OE ; B 32 -16 1055 709 ; +C 141 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 142 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 143 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 144 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 145 ; WX 259 ; N quoteleft ; B 35 489 224 717 ; +C 146 ; WX 259 ; N quoteright ; B 35 489 224 717 ; +C 147 ; WX 470 ; N quotedblleft ; B 35 489 443 717 ; +C 148 ; WX 470 ; N quotedblright ; B 35 487 443 717 ; +C 149 ; WX 500 ; N bullet ; B 70 179 430 539 ; +C 150 ; WX 300 ; N endash ; B 0 245 300 350 ; +C 151 ; WX 600 ; N emdash ; B 0 245 600 350 ; +C 152 ; WX 278 ; N tilde ; B -44 563 326 689 ; +C 153 ; WX 990 ; N trademark ; B 62 306 928 718 ; +C 154 ; WX 0 ; N scaron ; B 0 0 0 100 ; +C 155 ; WX 0 ; N guilsinglright ; B 43 278 227 456 ; +C 156 ; WX 790 ; N oe ; B 27 -23 764 493 ; +C 157 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 158 ; WX 800 ; N .notdef ; B 50 0 750 800 ; +C 159 ; WX 754 ; N Ydieresis ; B -35 -17 789 882 ; +C 160 ; WX 282 ; N nbspace ; B -23 -14 754 893 ; +C 161 ; WX 324 ; N exclamdown ; B 69 -203 253 531 ; +C 162 ; WX 450 ; N cent ; B 27 -122 437 592 ; +C 163 ; WX 640 ; N sterling ; B 0 -9 619 716 ; +C 164 ; WX 518 ; N currency ; B 3 72 515 586 ; +C 165 ; WX 603 ; N yen ; B -28 -65 631 747 ; +C 166 ; WX 0 ; N brokenbar ; B 0 0 0 100 ; +C 167 ; WX 519 ; N section ; B -50 -216 524 762 ; +C 168 ; WX 254 ; N dieresis ; B -20 554 308 682 ; +C 169 ; WX 800 ; N copyright ; B 29 -12 771 730 ; +C 170 ; WX 349 ; N ordfeminine ; B 13 385 349 717 ; +C 171 ; WX 0 ; N guillemotleft ; B 43 -16 747 162 ; +C 172 ; WX 0 ; N logicalnot ; B 30 0 730 700 ; +C 173 ; WX 432 ; N hyphen ; B 28 249 404 377 ; +C 174 ; WX 800 ; N registered ; B 29 -12 771 730 ; +C 175 ; WX 278 ; N macron ; B -47 584 325 665 ; +C 176 ; WX 0 ; N degree ; B 27 -122 437 592 ; +C 177 ; WX 0 ; N plusminus ; B 29 -8 668 877 ; +C 178 ; WX 0 ; N twosuperior ; B 0 0 0 100 ; +C 179 ; WX 0 ; N threesuperior ; B 0 0 0 100 ; +C 180 ; WX 278 ; N acute ; B 49 536 279 693 ; +C 181 ; WX 614 ; N mu ; B -14 -231 558 501 ; +C 182 ; WX 0 ; N paragraph ; B -35 -15 668 785 ; +C 183 ; WX 254 ; N periodcentered ; B 43 278 227 456 ; +C 184 ; WX 278 ; N cedilla ; B -8 -216 231 6 ; +C 185 ; WX 0 ; N onesuperior ; B 0 0 0 100 ; +C 186 ; WX 305 ; N ordmasculine ; B 16 373 291 702 ; +C 187 ; WX 0 ; N guillemotright ; B 43 -16 747 162 ; +C 188 ; WX 0 ; N onequarter ; B 0 0 0 100 ; +C 189 ; WX 0 ; N onehalf ; B 0 0 0 100 ; +C 190 ; WX 0 ; N threequarters ; B 0 0 0 100 ; +C 191 ; WX 501 ; N questiondown ; B 15 -196 467 541 ; +C 192 ; WX 743 ; N Agrave ; B -23 -14 754 893 ; +C 193 ; WX 743 ; N Aacute ; B -23 -14 754 893 ; +C 194 ; WX 743 ; N Acircumflex ; B -23 -14 754 877 ; +C 195 ; WX 743 ; N Atilde ; B -23 -14 754 889 ; +C 196 ; WX 743 ; N Adieresis ; B -23 -14 754 882 ; +C 197 ; WX 743 ; N Aring ; B -23 -14 754 899 ; +C 198 ; WX 1060 ; N AE ; B -29 -14 1053 708 ; +C 199 ; WX 598 ; N Ccedilla ; B 27 -183 572 712 ; +C 200 ; WX 608 ; N Egrave ; B -21 0 608 893 ; +C 201 ; WX 608 ; N Eacute ; B -21 0 608 893 ; +C 202 ; WX 608 ; N Ecircumflex ; B -21 0 608 877 ; +C 203 ; WX 608 ; N Edieresis ; B -21 0 608 882 ; +C 204 ; WX 308 ; N Igrave ; B 14 -15 264 893 ; +C 205 ; WX 308 ; N Iacute ; B 14 -15 274 893 ; +C 206 ; WX 308 ; N Icircumflex ; B 1 -15 307 877 ; +C 207 ; WX 308 ; N Idieresis ; B -15 -15 313 882 ; +C 208 ; WX 0 ; N Eth ; B 0 0 0 100 ; +C 209 ; WX 817 ; N Ntilde ; B -42 -17 747 889 ; +C 210 ; WX 729 ; N Ograve ; B 32 -16 698 893 ; +C 211 ; WX 729 ; N Oacute ; B 32 -16 698 893 ; +C 212 ; WX 729 ; N Ocircumflex ; B 32 -16 698 877 ; +C 213 ; WX 729 ; N Otilde ; B 32 -16 698 889 ; +C 214 ; WX 729 ; N Odieresis ; B 32 -16 698 882 ; +C 215 ; WX 0 ; N multiply ; B 0 0 0 100 ; +C 216 ; WX 729 ; N Oslash ; B 14 -24 724 709 ; +C 217 ; WX 805 ; N Ugrave ; B 0 -19 804 893 ; +C 218 ; WX 805 ; N Uacute ; B 0 -19 804 893 ; +C 219 ; WX 805 ; N Ucircumflex ; B 0 -19 804 877 ; +C 220 ; WX 805 ; N Udieresis ; B 0 -19 804 882 ; +C 221 ; WX 0 ; N _235 ; B 0 0 0 100 ; +C 222 ; WX 0 ; N Thorn ; B 0 0 0 100 ; +C 223 ; WX 688 ; N germandbls ; B -35 -15 668 785 ; +C 224 ; WX 581 ; N agrave ; B 21 -16 581 693 ; +C 225 ; WX 581 ; N aacute ; B 21 -16 581 693 ; +C 226 ; WX 581 ; N acircumflex ; B 21 -16 581 677 ; +C 227 ; WX 581 ; N atilde ; B 21 -16 581 689 ; +C 228 ; WX 581 ; N adieresis ; B 21 -16 581 682 ; +C 229 ; WX 581 ; N aring ; B 21 -16 581 734 ; +C 230 ; WX 792 ; N ae ; B 21 -23 773 494 ; +C 231 ; WX 440 ; N ccedilla ; B 21 -183 422 490 ; +C 232 ; WX 450 ; N egrave ; B 28 -23 428 693 ; +C 233 ; WX 450 ; N eacute ; B 28 -23 428 693 ; +C 234 ; WX 450 ; N ecircumflex ; B 28 -23 432 677 ; +C 235 ; WX 450 ; N edieresis ; B 28 -23 428 682 ; +C 236 ; WX 283 ; N igrave ; B -14 -15 244 693 ; +C 237 ; WX 283 ; N iacute ; B -14 -15 269 693 ; +C 238 ; WX 283 ; N icircumflex ; B -14 -15 297 677 ; +C 239 ; WX 283 ; N idieresis ; B -25 -15 303 682 ; +C 240 ; WX 0 ; N Yacute ; B 0 0 0 100 ; +C 241 ; WX 595 ; N ntilde ; B -28 -15 574 689 ; +C 242 ; WX 508 ; N ograve ; B 27 -17 485 693 ; +C 243 ; WX 508 ; N oacute ; B 27 -17 485 693 ; +C 244 ; WX 508 ; N ocircumflex ; B 27 -17 485 677 ; +C 245 ; WX 508 ; N otilde ; B 27 -17 485 689 ; +C 246 ; WX 508 ; N odieresis ; B 27 -17 485 682 ; +C 247 ; WX 0 ; N divide ; B 35 0 760 727 ; +C 248 ; WX 508 ; N oslash ; B -8 -54 496 589 ; +C 249 ; WX 614 ; N ugrave ; B -14 -18 558 693 ; +C 250 ; WX 614 ; N uacute ; B -14 -18 558 693 ; +C 251 ; WX 614 ; N ucircumflex ; B -14 -18 558 677 ; +C 252 ; WX 614 ; N udieresis ; B -14 -18 558 682 ; +C 253 ; WX 0 ; N yacute ; B 0 0 0 100 ; +C 254 ; WX 0 ; N thorn ; B 0 0 0 100 ; +C 255 ; WX 597 ; N ydieresis ; B -21 -227 541 682 ; +EndCharMetrics +EndFontMetrics diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.php new file mode 100644 index 0000000000000000000000000000000000000000..69f35180053b5c434df504ffb497ca92496ff709 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.php @@ -0,0 +1,24 @@ +<?php +$type='TrueType'; +$name='Calligrapher-Regular'; +$desc=array('Ascent'=>899,'Descent'=>-234,'CapHeight'=>731,'Flags'=>32,'FontBBox'=>'[-50 -234 1328 899]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>800); +$up=-200; +$ut=20; +$cw=array( + chr(0)=>800,chr(1)=>800,chr(2)=>800,chr(3)=>800,chr(4)=>800,chr(5)=>800,chr(6)=>800,chr(7)=>800,chr(8)=>800,chr(9)=>800,chr(10)=>800,chr(11)=>800,chr(12)=>800,chr(13)=>800,chr(14)=>800,chr(15)=>800,chr(16)=>800,chr(17)=>800,chr(18)=>800,chr(19)=>800,chr(20)=>800,chr(21)=>800, + chr(22)=>800,chr(23)=>800,chr(24)=>800,chr(25)=>800,chr(26)=>800,chr(27)=>800,chr(28)=>800,chr(29)=>800,chr(30)=>800,chr(31)=>800,' '=>282,'!'=>324,'"'=>405,'#'=>584,'$'=>632,'%'=>980,'&'=>776,'\''=>259,'('=>299,')'=>299,'*'=>377,'+'=>600, + ','=>259,'-'=>432,'.'=>254,'/'=>597,'0'=>529,'1'=>298,'2'=>451,'3'=>359,'4'=>525,'5'=>423,'6'=>464,'7'=>417,'8'=>457,'9'=>479,':'=>275,';'=>282,'<'=>600,'='=>600,'>'=>600,'?'=>501,'@'=>800,'A'=>743, + 'B'=>636,'C'=>598,'D'=>712,'E'=>608,'F'=>562,'G'=>680,'H'=>756,'I'=>308,'J'=>314,'K'=>676,'L'=>552,'M'=>1041,'N'=>817,'O'=>729,'P'=>569,'Q'=>698,'R'=>674,'S'=>618,'T'=>673,'U'=>805,'V'=>753,'W'=>1238, + 'X'=>716,'Y'=>754,'Z'=>599,'['=>315,'\\'=>463,']'=>315,'^'=>600,'_'=>547,'`'=>278,'a'=>581,'b'=>564,'c'=>440,'d'=>571,'e'=>450,'f'=>347,'g'=>628,'h'=>611,'i'=>283,'j'=>283,'k'=>560,'l'=>252,'m'=>976, + 'n'=>595,'o'=>508,'p'=>549,'q'=>540,'r'=>395,'s'=>441,'t'=>307,'u'=>614,'v'=>556,'w'=>915,'x'=>559,'y'=>597,'z'=>452,'{'=>315,'|'=>222,'}'=>315,'~'=>600,chr(127)=>800,chr(128)=>800,chr(129)=>800,chr(130)=>0,chr(131)=>0, + chr(132)=>0,chr(133)=>780,chr(134)=>0,chr(135)=>0,chr(136)=>278,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>1064,chr(141)=>800,chr(142)=>800,chr(143)=>800,chr(144)=>800,chr(145)=>259,chr(146)=>259,chr(147)=>470,chr(148)=>470,chr(149)=>500,chr(150)=>300,chr(151)=>600,chr(152)=>278,chr(153)=>990, + chr(154)=>0,chr(155)=>0,chr(156)=>790,chr(157)=>800,chr(158)=>800,chr(159)=>754,chr(160)=>282,chr(161)=>324,chr(162)=>450,chr(163)=>640,chr(164)=>518,chr(165)=>603,chr(166)=>0,chr(167)=>519,chr(168)=>254,chr(169)=>800,chr(170)=>349,chr(171)=>0,chr(172)=>0,chr(173)=>432,chr(174)=>800,chr(175)=>278, + chr(176)=>0,chr(177)=>0,chr(178)=>0,chr(179)=>0,chr(180)=>278,chr(181)=>614,chr(182)=>0,chr(183)=>254,chr(184)=>278,chr(185)=>0,chr(186)=>305,chr(187)=>0,chr(188)=>0,chr(189)=>0,chr(190)=>0,chr(191)=>501,chr(192)=>743,chr(193)=>743,chr(194)=>743,chr(195)=>743,chr(196)=>743,chr(197)=>743, + chr(198)=>1060,chr(199)=>598,chr(200)=>608,chr(201)=>608,chr(202)=>608,chr(203)=>608,chr(204)=>308,chr(205)=>308,chr(206)=>308,chr(207)=>308,chr(208)=>0,chr(209)=>817,chr(210)=>729,chr(211)=>729,chr(212)=>729,chr(213)=>729,chr(214)=>729,chr(215)=>0,chr(216)=>729,chr(217)=>805,chr(218)=>805,chr(219)=>805, + chr(220)=>805,chr(221)=>0,chr(222)=>0,chr(223)=>688,chr(224)=>581,chr(225)=>581,chr(226)=>581,chr(227)=>581,chr(228)=>581,chr(229)=>581,chr(230)=>792,chr(231)=>440,chr(232)=>450,chr(233)=>450,chr(234)=>450,chr(235)=>450,chr(236)=>283,chr(237)=>283,chr(238)=>283,chr(239)=>283,chr(240)=>800,chr(241)=>595, + chr(242)=>508,chr(243)=>508,chr(244)=>508,chr(245)=>508,chr(246)=>508,chr(247)=>0,chr(248)=>508,chr(249)=>614,chr(250)=>614,chr(251)=>614,chr(252)=>614,chr(253)=>0,chr(254)=>0,chr(255)=>597); +$enc='cp1252'; +$diff=''; +$file='calligra.z'; +$originalsize=40120; +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.ttf b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.ttf new file mode 100644 index 0000000000000000000000000000000000000000..9713c468ca29f5bfcecb65d96e52711aaa5f50e7 Binary files /dev/null and b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.ttf differ diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.z b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.z new file mode 100644 index 0000000000000000000000000000000000000000..1c0bebd20b3f68fe84a44520cc93c7cee39f2792 Binary files /dev/null and b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/calligra.z differ diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/countries.txt b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/countries.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa8886cc339d74dce401e61ad9eb11dcdbe14d39 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/countries.txt @@ -0,0 +1,15 @@ +Austria;Vienna;83859;8075 +Belgium;Brussels;30518;10192 +Denmark;Copenhagen;43094;5295 +Finland;Helsinki;304529;5147 +France;Paris;543965;58728 +Germany;Berlin;357022;82057 +Greece;Athens;131625;10511 +Ireland;Dublin;70723;3694 +Italy;Roma;301316;57563 +Luxembourg;Luxembourg;2586;424 +Netherlands;Amsterdam;41526;15654 +Portugal;Lisbon;91906;9957 +Spain;Madrid;504790;39348 +Sweden;Stockholm;410934;8839 +United Kingdom;London;243820;58862 diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/index.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/index.htm new file mode 100644 index 0000000000000000000000000000000000000000..6df359643b9394cbb4830101fc7664df52b6e2b6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/index.htm @@ -0,0 +1,18 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Tutorials</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Tutorials</H2> +The different examples rapidly show how to use FPDF. You will find all main features explained.<BR><BR> +<A HREF="tuto1.htm">Tutorial 1</A>: Minimal example<BR> +<A HREF="tuto2.htm">Tutorial 2</A>: Header, footer, page break and image<BR> +<A HREF="tuto3.htm">Tutorial 3</A>: Line breaks and colors<BR> +<A HREF="tuto4.htm">Tutorial 4</A>: Multi-columns<BR> +<A HREF="tuto5.htm">Tutorial 5</A>: Tables<BR> +<A HREF="tuto6.htm">Tutorial 6</A>: Links and flowing text<BR> +<A HREF="tuto7.htm">Tutorial 7</A>: Adding new fonts and encoding support<BR> +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/logo.png b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..284a0071c850b5a2f1ba86f16775c5c0da9fe082 Binary files /dev/null and b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/logo.png differ diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/logo_pb.png b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/logo_pb.png new file mode 100644 index 0000000000000000000000000000000000000000..e6827c15e151a1d6be908ad786e6212df43b154f Binary files /dev/null and b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/logo_pb.png differ diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/makefont.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/makefont.php new file mode 100644 index 0000000000000000000000000000000000000000..91f18390f72acc278cb4c0fa4ea4b361de7b86a1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/makefont.php @@ -0,0 +1,6 @@ +<?php +//Generation of font definition file for tutorial 7 +require('../font/makefont/makefont.php'); + +MakeFont('calligra.ttf','calligra.afm'); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto1.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto1.htm new file mode 100644 index 0000000000000000000000000000000000000000..3cf194b201a2c6bc3294c63104e7bd197bc4777e --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto1.htm @@ -0,0 +1,91 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Minimal example</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Minimal example</H2> +Let's start with the classic example: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +<?php<br><font class="kw">require(</font><font class="str">'fpdf.php'</font><font class="kw">);<br><br></font>$pdf<font class="kw">=new </font>FPDF<font class="kw">();<br></font>$pdf<font class="kw">-></font>AddPage<font class="kw">();<br></font>$pdf<font class="kw">-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'B'</font><font class="kw">,</font>16<font class="kw">);<br></font>$pdf<font class="kw">-></font>Cell<font class="kw">(</font>40<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Hello World!'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>Output<font class="kw">();<br></font>?> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<SCRIPT> +<!-- +if(document.location.href.indexOf('http:')==0) +{ +document.write("<P CLASS='demo'><A HREF='tuto1.php' TARGET='_blank' CLASS='demo'>[Demo]</A></P>"); +} +//--> +</SCRIPT> +After including the library file, we create an FPDF object. +The <A HREF='../doc/fpdf.htm'>FPDF()</A> constructor is used here with the default values: pages are in A4 portrait and +the measure unit is millimeter. It could have been specified explicitly with: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$pdf<font class="kw">=new </font>FPDF<font class="kw">(</font><font class="str">'P'</font><font class="kw">,</font><font class="str">'mm'</font><font class="kw">,</font><font class="str">'A4'</font><font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +It is possible to use landscape (<TT>L</TT>), other page formats (such as <TT>Letter</TT> and +<TT>Legal</TT>) and measure units (<TT>pt</TT>, <TT>cm</TT>, <TT>in</TT>). +<BR> +<BR> +There is no page for the moment, so we have to add one with <A HREF='../doc/addpage.htm'>AddPage()</A>. The origin +is at the upper-left corner and the current position is by default placed at 1 cm from the +borders; the margins can be changed with <A HREF='../doc/setmargins.htm'>SetMargins()</A>. +<BR> +<BR> +Before we can print text, it is mandatory to select a font with <A HREF='../doc/setfont.htm'>SetFont()</A>, otherwise the +document would be invalid. We choose Arial bold 16: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$pdf<font class="kw">-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'B'</font><font class="kw">,</font>16<font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +We could have specified italics with I, underlined with U or a regular font with an empty string +(or any combination). Note that the font size is given in points, not millimeters (or another +user unit); it is the only exception. The other standard fonts are Times, Courier, Symbol and +ZapfDingbats. +<BR> +<BR> +We can now print a cell with <A HREF='../doc/cell.htm'>Cell()</A>. A cell is a rectangular area, possibly framed, +which contains some text. It is output at the current position. We specify its dimensions, +its text (centered or aligned), if borders should be drawn, and where the current position +moves after it (to the right, below or to the beginning of the next line). To add a frame, we would do this: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$pdf<font class="kw">-></font>Cell<font class="kw">(</font>40<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Hello World !'</font><font class="kw">,</font>1<font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +To add a new cell next to it with centered text and go to the next line, we would do: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$pdf<font class="kw">-></font>Cell<font class="kw">(</font>60<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Powered by FPDF.'</font><font class="kw">,</font>0<font class="kw">,</font>1<font class="kw">,</font><font class="str">'C'</font><font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +Remark : the line break can also be done with <A HREF='../doc/ln.htm'>Ln()</A>. This method allows to specify +in addition the height of the break. +<BR> +<BR> +Finally, the document is closed and sent to the browser with <A HREF='../doc/output.htm'>Output()</A>. We could have saved +it in a file by passing the desired file name. +<BR> +<BR> +Caution: in case when the PDF is sent to the browser, nothing else must be output, not before +nor after (the least space or carriage return matters). If you send some data before, you will +get the error message: "Some data has already been output to browser, can't send PDF file". If +you send after, your browser may display a blank page. +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto1.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto1.php new file mode 100644 index 0000000000000000000000000000000000000000..03a06840789c85194137c7acfc2da487b726ad20 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto1.php @@ -0,0 +1,9 @@ +<?php +require('../fpdf.php'); + +$pdf=new FPDF(); +$pdf->AddPage(); +$pdf->SetFont('Arial','B',16); +$pdf->Cell(40,10,'Hello World!'); +$pdf->Output(); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto2.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto2.htm new file mode 100644 index 0000000000000000000000000000000000000000..3a1ba2749762eb2ea44cc376fd4983c7a932202c --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto2.htm @@ -0,0 +1,50 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Header, footer, page break and image</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Header, footer, page break and image</H2> +Here is a two page example with header, footer and logo: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +<?php<br><font class="kw">require(</font><font class="str">'fpdf.php'</font><font class="kw">);<br><br>class </font>PDF <font class="kw">extends </font>FPDF<br><font class="kw">{<br></font><font class="cmt">//Page header<br></font><font class="kw">function </font>Header<font class="kw">()<br>{<br> </font><font class="cmt">//Logo<br> </font>$<font class="kw">this-></font>Image<font class="kw">(</font><font class="str">'logo_pb.png'</font><font class="kw">,</font>10<font class="kw">,</font>8<font class="kw">,</font>33<font class="kw">);<br> </font><font class="cmt">//Arial bold 15<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'B'</font><font class="kw">,</font>15<font class="kw">);<br> </font><font class="cmt">//Move to the right<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>80<font class="kw">);<br> </font><font class="cmt">//Title<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>30<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Title'</font><font class="kw">,</font>1<font class="kw">,</font>0<font class="kw">,</font><font class="str">'C'</font><font class="kw">);<br> </font><font class="cmt">//Line break<br> </font>$<font class="kw">this-></font>Ln<font class="kw">(</font>20<font class="kw">);<br>}<br><br></font><font class="cmt">//Page footer<br></font><font class="kw">function </font>Footer<font class="kw">()<br>{<br> </font><font class="cmt">//Position at 1.5 cm from bottom<br> </font>$<font class="kw">this-></font>SetY<font class="kw">(-</font>15<font class="kw">);<br> </font><font class="cmt">//Arial italic 8<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">,</font>8<font class="kw">);<br> </font><font class="cmt">//Page number<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Page '</font><font class="kw">.</font>$<font class="kw">this-></font>PageNo<font class="kw">().</font><font class="str">'/{nb}'</font><font class="kw">,</font>0<font class="kw">,</font>0<font class="kw">,</font><font class="str">'C'</font><font class="kw">);<br>}<br>}<br><br></font><font class="cmt">//Instanciation of inherited class<br></font>$pdf<font class="kw">=new </font>PDF<font class="kw">();<br></font>$pdf<font class="kw">-></font>AliasNbPages<font class="kw">();<br></font>$pdf<font class="kw">-></font>AddPage<font class="kw">();<br></font>$pdf<font class="kw">-></font>SetFont<font class="kw">(</font><font class="str">'Times'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>12<font class="kw">);<br>for(</font>$i<font class="kw">=</font>1<font class="kw">;</font>$i<font class="kw"><=</font>40<font class="kw">;</font>$i<font class="kw">++)<br> </font>$pdf<font class="kw">-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Printing line number '</font><font class="kw">.</font>$i<font class="kw">,</font>0<font class="kw">,</font>1<font class="kw">);<br></font>$pdf<font class="kw">-></font>Output<font class="kw">();<br></font>?> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<SCRIPT> +<!-- +if(document.location.href.indexOf('http:')==0) +{ +document.write("<P CLASS='demo'><A HREF='tuto2.php' TARGET='_blank' CLASS='demo'>[Demo]</A></P>"); +} +//--> +</SCRIPT> +This example makes use of the <A HREF='../doc/header.htm'>Header()</A> and <A HREF='../doc/footer.htm'>Footer()</A> methods to process page headers and +footers. They are called automatically. They already exist in the FPDF class but do nothing, +therefore we have to extend the class and override them. +<BR> +<BR> +The logo is printed with the <A HREF='../doc/image.htm'>Image()</A> method by specifying its upper-left corner and +its width. The height is calculated automatically to respect the image proportions. +<BR> +<BR> +To print the page number, a null value is passed as the cell width. It means that the cell +should extend up to the right margin of the page; it is handy to center text. The current page +number is returned by the <A HREF='../doc/pageno.htm'>PageNo()</A> method; as for the total number of pages, it is obtained +by means of the special value <TT>{nb}</TT> which will be substituted on document closure +(provided you first called <A HREF='../doc/aliasnbpages.htm'>AliasNbPages()</A>). +<BR> +Note the use of the <A HREF='../doc/sety.htm'>SetY()</A> method which allows to set position at an absolute location in +the page, starting from the top or the bottom. +<BR> +<BR> +Another interesting feature is used here: the automatic page breaking. As soon as a cell would +cross a limit in the page (at 2 centimeters from the bottom by default), a break is performed +and the font restored. Although the header and footer select their own font (Arial), the body +continues with Times. This mechanism of automatic restoration also applies to colors and line +width. The limit which triggers page breaks can be set with <A HREF='../doc/setautopagebreak.htm'>SetAutoPageBreak()</A>. +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto2.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto2.php new file mode 100644 index 0000000000000000000000000000000000000000..e11b3f6852432b0aa3e1d338a215bce72fb9f053 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto2.php @@ -0,0 +1,41 @@ +<?php +require('../fpdf.php'); + +class PDF extends FPDF +{ +//Page header +function Header() +{ + //Logo + $this->Image('logo_pb.png',10,8,33); + //Arial bold 15 + $this->SetFont('Arial','B',15); + //Move to the right + $this->Cell(80); + //Title + $this->Cell(30,10,'Title',1,0,'C'); + //Line break + $this->Ln(20); +} + +//Page footer +function Footer() +{ + //Position at 1.5 cm from bottom + $this->SetY(-15); + //Arial italic 8 + $this->SetFont('Arial','I',8); + //Page number + $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); +} +} + +//Instanciation of inherited class +$pdf=new PDF(); +$pdf->AliasNbPages(); +$pdf->AddPage(); +$pdf->SetFont('Times','',12); +for($i=1;$i<=40;$i++) + $pdf->Cell(0,10,'Printing line number '.$i,0,1); +$pdf->Output(); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto3.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto3.htm new file mode 100644 index 0000000000000000000000000000000000000000..175d303516e0e418ebeeb0dce0e2e69b962447aa --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto3.htm @@ -0,0 +1,43 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Line breaks and colors</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Line breaks and colors</H2> +Let's continue with an example which prints justified paragraphs. It also illustrates the use +of colors. +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +<?php<br><font class="kw">require(</font><font class="str">'fpdf.php'</font><font class="kw">);<br><br>class </font>PDF <font class="kw">extends </font>FPDF<br><font class="kw">{<br>function </font>Header<font class="kw">()<br>{<br> global </font>$title<font class="kw">;<br><br> </font><font class="cmt">//Arial bold 15<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'B'</font><font class="kw">,</font>15<font class="kw">);<br> </font><font class="cmt">//Calculate width of title and position<br> </font>$w<font class="kw">=</font>$<font class="kw">this-></font>GetStringWidth<font class="kw">(</font>$title<font class="kw">)+</font>6<font class="kw">;<br> </font>$<font class="kw">this-></font>SetX<font class="kw">((</font>210<font class="kw">-</font>$w<font class="kw">)/</font>2<font class="kw">);<br> </font><font class="cmt">//Colors of frame, background and text<br> </font>$<font class="kw">this-></font>SetDrawColor<font class="kw">(</font>0<font class="kw">,</font>80<font class="kw">,</font>180<font class="kw">);<br> </font>$<font class="kw">this-></font>SetFillColor<font class="kw">(</font>230<font class="kw">,</font>230<font class="kw">,</font>0<font class="kw">);<br> </font>$<font class="kw">this-></font>SetTextColor<font class="kw">(</font>220<font class="kw">,</font>50<font class="kw">,</font>50<font class="kw">);<br> </font><font class="cmt">//Thickness of frame (1 mm)<br> </font>$<font class="kw">this-></font>SetLineWidth<font class="kw">(</font>1<font class="kw">);<br> </font><font class="cmt">//Title<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">,</font>9<font class="kw">,</font>$title<font class="kw">,</font>1<font class="kw">,</font>1<font class="kw">,</font><font class="str">'C'</font><font class="kw">,</font>1<font class="kw">);<br> </font><font class="cmt">//Line break<br> </font>$<font class="kw">this-></font>Ln<font class="kw">(</font>10<font class="kw">);<br>}<br><br>function </font>Footer<font class="kw">()<br>{<br> </font><font class="cmt">//Position at 1.5 cm from bottom<br> </font>$<font class="kw">this-></font>SetY<font class="kw">(-</font>15<font class="kw">);<br> </font><font class="cmt">//Arial italic 8<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">,</font>8<font class="kw">);<br> </font><font class="cmt">//Text color in gray<br> </font>$<font class="kw">this-></font>SetTextColor<font class="kw">(</font>128<font class="kw">);<br> </font><font class="cmt">//Page number<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Page '</font><font class="kw">.</font>$<font class="kw">this-></font>PageNo<font class="kw">(),</font>0<font class="kw">,</font>0<font class="kw">,</font><font class="str">'C'</font><font class="kw">);<br>}<br><br>function </font>ChapterTitle<font class="kw">(</font>$num<font class="kw">,</font>$label<font class="kw">)<br>{<br> </font><font class="cmt">//Arial 12<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>12<font class="kw">);<br> </font><font class="cmt">//Background color<br> </font>$<font class="kw">this-></font>SetFillColor<font class="kw">(</font>200<font class="kw">,</font>220<font class="kw">,</font>255<font class="kw">);<br> </font><font class="cmt">//Title<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>6<font class="kw">,</font><font class="str">"Chapter $num : $label"</font><font class="kw">,</font>0<font class="kw">,</font>1<font class="kw">,</font><font class="str">'L'</font><font class="kw">,</font>1<font class="kw">);<br> </font><font class="cmt">//Line break<br> </font>$<font class="kw">this-></font>Ln<font class="kw">(</font>4<font class="kw">);<br>}<br><br>function </font>ChapterBody<font class="kw">(</font>$file<font class="kw">)<br>{<br> </font><font class="cmt">//Read text file<br> </font>$f<font class="kw">=</font>fopen<font class="kw">(</font>$file<font class="kw">,</font><font class="str">'r'</font><font class="kw">);<br> </font>$txt<font class="kw">=</font>fread<font class="kw">(</font>$f<font class="kw">,</font>filesize<font class="kw">(</font>$file<font class="kw">));<br> </font>fclose<font class="kw">(</font>$f<font class="kw">);<br> </font><font class="cmt">//Times 12<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Times'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>12<font class="kw">);<br> </font><font class="cmt">//Output justified text<br> </font>$<font class="kw">this-></font>MultiCell<font class="kw">(</font>0<font class="kw">,</font>5<font class="kw">,</font>$txt<font class="kw">);<br> </font><font class="cmt">//Line break<br> </font>$<font class="kw">this-></font>Ln<font class="kw">();<br> </font><font class="cmt">//Mention in italics<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">''</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>5<font class="kw">,</font><font class="str">'(end of excerpt)'</font><font class="kw">);<br>}<br><br>function </font>PrintChapter<font class="kw">(</font>$num<font class="kw">,</font>$title<font class="kw">,</font>$file<font class="kw">)<br>{<br> </font>$<font class="kw">this-></font>AddPage<font class="kw">();<br> </font>$<font class="kw">this-></font>ChapterTitle<font class="kw">(</font>$num<font class="kw">,</font>$title<font class="kw">);<br> </font>$<font class="kw">this-></font>ChapterBody<font class="kw">(</font>$file<font class="kw">);<br>}<br>}<br><br></font>$pdf<font class="kw">=new </font>PDF<font class="kw">();<br></font>$title<font class="kw">=</font><font class="str">'20000 Leagues Under the Seas'</font><font class="kw">;<br></font>$pdf<font class="kw">-></font>SetTitle<font class="kw">(</font>$title<font class="kw">);<br></font>$pdf<font class="kw">-></font>SetAuthor<font class="kw">(</font><font class="str">'Jules Verne'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>PrintChapter<font class="kw">(</font>1<font class="kw">,</font><font class="str">'A RUNAWAY REEF'</font><font class="kw">,</font><font class="str">'20k_c1.txt'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>PrintChapter<font class="kw">(</font>2<font class="kw">,</font><font class="str">'THE PROS AND CONS'</font><font class="kw">,</font><font class="str">'20k_c2.txt'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>Output<font class="kw">();<br></font>?> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<SCRIPT> +<!-- +if(document.location.href.indexOf('http:')==0) +{ +document.write("<P CLASS='demo'><A HREF='tuto3.php' TARGET='_blank' CLASS='demo'>[Demo]</A></P>"); +} +//--> +</SCRIPT> +The <A HREF='../doc/getstringwidth.htm'>GetStringWidth()</A> method allows to determine the length of a string in the current font, +which is used here to calculate the position and the width of the frame surrounding the title. +Then colors are set (via <A HREF='../doc/setdrawcolor.htm'>SetDrawColor()</A>, <A HREF='../doc/setfillcolor.htm'>SetFillColor()</A> and <A HREF='../doc/settextcolor.htm'>SetTextColor()</A>) and the +thickness of the line is set to 1 mm (against 0.2 by default) with <A HREF='../doc/setlinewidth.htm'>SetLineWidth()</A>. Finally, +we output the cell (the last parameter to 1 indicates that the background must be filled). +<BR> +<BR> +The method used to print the paragraphs is <A HREF='../doc/multicell.htm'>MultiCell()</A>. Each time a line reaches the +right extremity of the cell or a carriage-return character is met, a line break is issued +and a new cell automatically created under the current one. Text is justified by default. +<BR> +<BR> +Two document properties are defined: title (<A HREF='../doc/settitle.htm'>SetTitle()</A>) and author (<A HREF='../doc/setauthor.htm'>SetAuthor()</A>). +Properties can be viewed by two means. First is open the document directly with Acrobat Reader, +go to the File menu, Document info, General. Second, also available from the plug-in, is click +on the triangle just above the right scrollbar and choose Document info. +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto3.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto3.php new file mode 100644 index 0000000000000000000000000000000000000000..b9f8810036e5f51b1228a9bb18bf15434a013bd5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto3.php @@ -0,0 +1,83 @@ +<?php +require('../fpdf.php'); + +class PDF extends FPDF +{ +function Header() +{ + global $title; + + //Arial bold 15 + $this->SetFont('Arial','B',15); + //Calculate width of title and position + $w=$this->GetStringWidth($title)+6; + $this->SetX((210-$w)/2); + //Colors of frame, background and text + $this->SetDrawColor(0,80,180); + $this->SetFillColor(230,230,0); + $this->SetTextColor(220,50,50); + //Thickness of frame (1 mm) + $this->SetLineWidth(1); + //Title + $this->Cell($w,9,$title,1,1,'C',1); + //Line break + $this->Ln(10); +} + +function Footer() +{ + //Position at 1.5 cm from bottom + $this->SetY(-15); + //Arial italic 8 + $this->SetFont('Arial','I',8); + //Text color in gray + $this->SetTextColor(128); + //Page number + $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C'); +} + +function ChapterTitle($num,$label) +{ + //Arial 12 + $this->SetFont('Arial','',12); + //Background color + $this->SetFillColor(200,220,255); + //Title + $this->Cell(0,6,"Chapter $num : $label",0,1,'L',1); + //Line break + $this->Ln(4); +} + +function ChapterBody($file) +{ + //Read text file + $f=fopen($file,'r'); + $txt=fread($f,filesize($file)); + fclose($f); + //Times 12 + $this->SetFont('Times','',12); + //Output justified text + $this->MultiCell(0,5,$txt); + //Line break + $this->Ln(); + //Mention in italics + $this->SetFont('','I'); + $this->Cell(0,5,'(end of excerpt)'); +} + +function PrintChapter($num,$title,$file) +{ + $this->AddPage(); + $this->ChapterTitle($num,$title); + $this->ChapterBody($file); +} +} + +$pdf=new PDF(); +$title='20000 Leagues Under the Seas'; +$pdf->SetTitle($title); +$pdf->SetAuthor('Jules Verne'); +$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt'); +$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt'); +$pdf->Output(); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto4.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto4.htm new file mode 100644 index 0000000000000000000000000000000000000000..04fd9c5d2896546fd49095937d0be1bcde97f0d8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto4.htm @@ -0,0 +1,34 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Multi-columns</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Multi-columns</H2> +This example is a variant of the previous one showing how to lay the text across multiple +columns. +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +<?php<br><font class="kw">require(</font><font class="str">'fpdf.php'</font><font class="kw">);<br><br>class </font>PDF <font class="kw">extends </font>FPDF<br><font class="kw">{<br></font><font class="cmt">//Current column<br></font><font class="kw">var </font>$col<font class="kw">=</font>0<font class="kw">;<br></font><font class="cmt">//Ordinate of column start<br></font><font class="kw">var </font>$y0<font class="kw">;<br><br>function </font>Header<font class="kw">()<br>{<br> </font><font class="cmt">//Page header<br> </font><font class="kw">global </font>$title<font class="kw">;<br><br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'B'</font><font class="kw">,</font>15<font class="kw">);<br> </font>$w<font class="kw">=</font>$<font class="kw">this-></font>GetStringWidth<font class="kw">(</font>$title<font class="kw">)+</font>6<font class="kw">;<br> </font>$<font class="kw">this-></font>SetX<font class="kw">((</font>210<font class="kw">-</font>$w<font class="kw">)/</font>2<font class="kw">);<br> </font>$<font class="kw">this-></font>SetDrawColor<font class="kw">(</font>0<font class="kw">,</font>80<font class="kw">,</font>180<font class="kw">);<br> </font>$<font class="kw">this-></font>SetFillColor<font class="kw">(</font>230<font class="kw">,</font>230<font class="kw">,</font>0<font class="kw">);<br> </font>$<font class="kw">this-></font>SetTextColor<font class="kw">(</font>220<font class="kw">,</font>50<font class="kw">,</font>50<font class="kw">);<br> </font>$<font class="kw">this-></font>SetLineWidth<font class="kw">(</font>1<font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">,</font>9<font class="kw">,</font>$title<font class="kw">,</font>1<font class="kw">,</font>1<font class="kw">,</font><font class="str">'C'</font><font class="kw">,</font>1<font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">(</font>10<font class="kw">);<br> </font><font class="cmt">//Save ordinate<br> </font>$<font class="kw">this-></font>y0<font class="kw">=</font>$<font class="kw">this-></font>GetY<font class="kw">();<br>}<br><br>function </font>Footer<font class="kw">()<br>{<br> </font><font class="cmt">//Page footer<br> </font>$<font class="kw">this-></font>SetY<font class="kw">(-</font>15<font class="kw">);<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">,</font>8<font class="kw">);<br> </font>$<font class="kw">this-></font>SetTextColor<font class="kw">(</font>128<font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Page '</font><font class="kw">.</font>$<font class="kw">this-></font>PageNo<font class="kw">(),</font>0<font class="kw">,</font>0<font class="kw">,</font><font class="str">'C'</font><font class="kw">);<br>}<br><br>function </font>SetCol<font class="kw">(</font>$col<font class="kw">)<br>{<br> </font><font class="cmt">//Set position at a given column<br> </font>$<font class="kw">this-></font>col<font class="kw">=</font>$col<font class="kw">;<br> </font>$x<font class="kw">=</font>10<font class="kw">+</font>$col<font class="kw">*</font>65<font class="kw">;<br> </font>$<font class="kw">this-></font>SetLeftMargin<font class="kw">(</font>$x<font class="kw">);<br> </font>$<font class="kw">this-></font>SetX<font class="kw">(</font>$x<font class="kw">);<br>}<br><br>function </font>AcceptPageBreak<font class="kw">()<br>{<br> </font><font class="cmt">//Method accepting or not automatic page break<br> </font><font class="kw">if(</font>$<font class="kw">this-></font>col<font class="kw"><</font>2<font class="kw">)<br> {<br> </font><font class="cmt">//Go to next column<br> </font>$<font class="kw">this-></font>SetCol<font class="kw">(</font>$<font class="kw">this-></font>col<font class="kw">+</font>1<font class="kw">);<br> </font><font class="cmt">//Set ordinate to top<br> </font>$<font class="kw">this-></font>SetY<font class="kw">(</font>$<font class="kw">this-></font>y0<font class="kw">);<br> </font><font class="cmt">//Keep on page<br> </font><font class="kw">return </font>false<font class="kw">;<br> }<br> else<br> {<br> </font><font class="cmt">//Go back to first column<br> </font>$<font class="kw">this-></font>SetCol<font class="kw">(</font>0<font class="kw">);<br> </font><font class="cmt">//Page break<br> </font><font class="kw">return </font>true<font class="kw">;<br> }<br>}<br><br>function </font>ChapterTitle<font class="kw">(</font>$num<font class="kw">,</font>$label<font class="kw">)<br>{<br> </font><font class="cmt">//Title<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>12<font class="kw">);<br> </font>$<font class="kw">this-></font>SetFillColor<font class="kw">(</font>200<font class="kw">,</font>220<font class="kw">,</font>255<font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>6<font class="kw">,</font><font class="str">"Chapter $num : $label"</font><font class="kw">,</font>0<font class="kw">,</font>1<font class="kw">,</font><font class="str">'L'</font><font class="kw">,</font>1<font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">(</font>4<font class="kw">);<br> </font><font class="cmt">//Save ordinate<br> </font>$<font class="kw">this-></font>y0<font class="kw">=</font>$<font class="kw">this-></font>GetY<font class="kw">();<br>}<br><br>function </font>ChapterBody<font class="kw">(</font>$fichier<font class="kw">)<br>{<br> </font><font class="cmt">//Read text file<br> </font>$f<font class="kw">=</font>fopen<font class="kw">(</font>$fichier<font class="kw">,</font><font class="str">'r'</font><font class="kw">);<br> </font>$txt<font class="kw">=</font>fread<font class="kw">(</font>$f<font class="kw">,</font>filesize<font class="kw">(</font>$fichier<font class="kw">));<br> </font>fclose<font class="kw">(</font>$f<font class="kw">);<br> </font><font class="cmt">//Font<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">'Times'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>12<font class="kw">);<br> </font><font class="cmt">//Output text in a 6 cm width column<br> </font>$<font class="kw">this-></font>MultiCell<font class="kw">(</font>60<font class="kw">,</font>5<font class="kw">,</font>$txt<font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">();<br> </font><font class="cmt">//Mention<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">''</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>5<font class="kw">,</font><font class="str">'(end of excerpt)'</font><font class="kw">);<br> </font><font class="cmt">//Go back to first column<br> </font>$<font class="kw">this-></font>SetCol<font class="kw">(</font>0<font class="kw">);<br>}<br><br>function </font>PrintChapter<font class="kw">(</font>$num<font class="kw">,</font>$title<font class="kw">,</font>$file<font class="kw">)<br>{<br> </font><font class="cmt">//Add chapter<br> </font>$<font class="kw">this-></font>AddPage<font class="kw">();<br> </font>$<font class="kw">this-></font>ChapterTitle<font class="kw">(</font>$num<font class="kw">,</font>$title<font class="kw">);<br> </font>$<font class="kw">this-></font>ChapterBody<font class="kw">(</font>$file<font class="kw">);<br>}<br>}<br><br></font>$pdf<font class="kw">=new </font>PDF<font class="kw">();<br></font>$title<font class="kw">=</font><font class="str">'20000 Leagues Under the Seas'</font><font class="kw">;<br></font>$pdf<font class="kw">-></font>SetTitle<font class="kw">(</font>$title<font class="kw">);<br></font>$pdf<font class="kw">-></font>SetAuthor<font class="kw">(</font><font class="str">'Jules Verne'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>PrintChapter<font class="kw">(</font>1<font class="kw">,</font><font class="str">'A RUNAWAY REEF'</font><font class="kw">,</font><font class="str">'20k_c1.txt'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>PrintChapter<font class="kw">(</font>2<font class="kw">,</font><font class="str">'THE PROS AND CONS'</font><font class="kw">,</font><font class="str">'20k_c2.txt'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>Output<font class="kw">();<br></font>?> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<SCRIPT> +<!-- +if(document.location.href.indexOf('http:')==0) +{ +document.write("<P CLASS='demo'><A HREF='tuto4.php' TARGET='_blank' CLASS='demo'>[Demo]</A></P>"); +} +//--> +</SCRIPT> +The key method used is <A HREF='../doc/acceptpagebreak.htm'>AcceptPageBreak()</A>. It allows to accept or not an automatic page +break. By refusing it and altering the margin and current position, the desired column layout +is achieved. +<BR> +For the rest, not much change; two properties have been added to the class to save the current +column number and the position where columns begin, and the MultiCell() call specifies a +6 centimeter width. +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto4.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto4.php new file mode 100644 index 0000000000000000000000000000000000000000..d40e0782cc4531822fc2c5015820783a434506dc --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto4.php @@ -0,0 +1,113 @@ +<?php +require('../fpdf.php'); + +class PDF extends FPDF +{ +//Current column +var $col=0; +//Ordinate of column start +var $y0; + +function Header() +{ + //Page header + global $title; + + $this->SetFont('Arial','B',15); + $w=$this->GetStringWidth($title)+6; + $this->SetX((210-$w)/2); + $this->SetDrawColor(0,80,180); + $this->SetFillColor(230,230,0); + $this->SetTextColor(220,50,50); + $this->SetLineWidth(1); + $this->Cell($w,9,$title,1,1,'C',1); + $this->Ln(10); + //Save ordinate + $this->y0=$this->GetY(); +} + +function Footer() +{ + //Page footer + $this->SetY(-15); + $this->SetFont('Arial','I',8); + $this->SetTextColor(128); + $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C'); +} + +function SetCol($col) +{ + //Set position at a given column + $this->col=$col; + $x=10+$col*65; + $this->SetLeftMargin($x); + $this->SetX($x); +} + +function AcceptPageBreak() +{ + //Method accepting or not automatic page break + if($this->col<2) + { + //Go to next column + $this->SetCol($this->col+1); + //Set ordinate to top + $this->SetY($this->y0); + //Keep on page + return false; + } + else + { + //Go back to first column + $this->SetCol(0); + //Page break + return true; + } +} + +function ChapterTitle($num,$label) +{ + //Title + $this->SetFont('Arial','',12); + $this->SetFillColor(200,220,255); + $this->Cell(0,6,"Chapter $num : $label",0,1,'L',1); + $this->Ln(4); + //Save ordinate + $this->y0=$this->GetY(); +} + +function ChapterBody($fichier) +{ + //Read text file + $f=fopen($fichier,'r'); + $txt=fread($f,filesize($fichier)); + fclose($f); + //Font + $this->SetFont('Times','',12); + //Output text in a 6 cm width column + $this->MultiCell(60,5,$txt); + $this->Ln(); + //Mention + $this->SetFont('','I'); + $this->Cell(0,5,'(end of excerpt)'); + //Go back to first column + $this->SetCol(0); +} + +function PrintChapter($num,$title,$file) +{ + //Add chapter + $this->AddPage(); + $this->ChapterTitle($num,$title); + $this->ChapterBody($file); +} +} + +$pdf=new PDF(); +$title='20000 Leagues Under the Seas'; +$pdf->SetTitle($title); +$pdf->SetAuthor('Jules Verne'); +$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt'); +$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt'); +$pdf->Output(); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto5.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto5.htm new file mode 100644 index 0000000000000000000000000000000000000000..362a4741a8c7040753fa57ec40b4dc64c1c76bf9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto5.htm @@ -0,0 +1,43 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Tables</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Tables</H2> +This tutorial shows how to make tables easily. +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +<?php<br><font class="kw">require(</font><font class="str">'fpdf.php'</font><font class="kw">);<br><br>class </font>PDF <font class="kw">extends </font>FPDF<br><font class="kw">{<br></font><font class="cmt">//Load data<br></font><font class="kw">function </font>LoadData<font class="kw">(</font>$file<font class="kw">)<br>{<br> </font><font class="cmt">//Read file lines<br> </font>$lines<font class="kw">=</font>file<font class="kw">(</font>$file<font class="kw">);<br> </font>$data<font class="kw">=array();<br> foreach(</font>$lines <font class="kw">as </font>$line<font class="kw">)<br> </font>$data<font class="kw">[]=</font>explode<font class="kw">(</font><font class="str">';'</font><font class="kw">,</font>chop<font class="kw">(</font>$line<font class="kw">));<br> return </font>$data<font class="kw">;<br>}<br><br></font><font class="cmt">//Simple table<br></font><font class="kw">function </font>BasicTable<font class="kw">(</font>$header<font class="kw">,</font>$data<font class="kw">)<br>{<br> </font><font class="cmt">//Header<br> </font><font class="kw">foreach(</font>$header <font class="kw">as </font>$col<font class="kw">)<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>40<font class="kw">,</font>7<font class="kw">,</font>$col<font class="kw">,</font>1<font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">();<br> </font><font class="cmt">//Data<br> </font><font class="kw">foreach(</font>$data <font class="kw">as </font>$row<font class="kw">)<br> {<br> foreach(</font>$row <font class="kw">as </font>$col<font class="kw">)<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>40<font class="kw">,</font>6<font class="kw">,</font>$col<font class="kw">,</font>1<font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">();<br> }<br>}<br><br></font><font class="cmt">//Better table<br></font><font class="kw">function </font>ImprovedTable<font class="kw">(</font>$header<font class="kw">,</font>$data<font class="kw">)<br>{<br> </font><font class="cmt">//Column widths<br> </font>$w<font class="kw">=array(</font>40<font class="kw">,</font>35<font class="kw">,</font>40<font class="kw">,</font>45<font class="kw">);<br> </font><font class="cmt">//Header<br> </font><font class="kw">for(</font>$i<font class="kw">=</font>0<font class="kw">;</font>$i<font class="kw"><</font>count<font class="kw">(</font>$header<font class="kw">);</font>$i<font class="kw">++)<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>$i<font class="kw">],</font>7<font class="kw">,</font>$header<font class="kw">[</font>$i<font class="kw">],</font>1<font class="kw">,</font>0<font class="kw">,</font><font class="str">'C'</font><font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">();<br> </font><font class="cmt">//Data<br> </font><font class="kw">foreach(</font>$data <font class="kw">as </font>$row<font class="kw">)<br> {<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>0<font class="kw">],</font>6<font class="kw">,</font>$row<font class="kw">[</font>0<font class="kw">],</font><font class="str">'LR'</font><font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>1<font class="kw">],</font>6<font class="kw">,</font>$row<font class="kw">[</font>1<font class="kw">],</font><font class="str">'LR'</font><font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>2<font class="kw">],</font>6<font class="kw">,</font>number_format<font class="kw">(</font>$row<font class="kw">[</font>2<font class="kw">]),</font><font class="str">'LR'</font><font class="kw">,</font>0<font class="kw">,</font><font class="str">'R'</font><font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>3<font class="kw">],</font>6<font class="kw">,</font>number_format<font class="kw">(</font>$row<font class="kw">[</font>3<font class="kw">]),</font><font class="str">'LR'</font><font class="kw">,</font>0<font class="kw">,</font><font class="str">'R'</font><font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">();<br> }<br> </font><font class="cmt">//Closure line<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>array_sum<font class="kw">(</font>$w<font class="kw">),</font>0<font class="kw">,</font><font class="str">''</font><font class="kw">,</font><font class="str">'T'</font><font class="kw">);<br>}<br><br></font><font class="cmt">//Colored table<br></font><font class="kw">function </font>FancyTable<font class="kw">(</font>$header<font class="kw">,</font>$data<font class="kw">)<br>{<br> </font><font class="cmt">//Colors, line width and bold font<br> </font>$<font class="kw">this-></font>SetFillColor<font class="kw">(</font>255<font class="kw">,</font>0<font class="kw">,</font>0<font class="kw">);<br> </font>$<font class="kw">this-></font>SetTextColor<font class="kw">(</font>255<font class="kw">);<br> </font>$<font class="kw">this-></font>SetDrawColor<font class="kw">(</font>128<font class="kw">,</font>0<font class="kw">,</font>0<font class="kw">);<br> </font>$<font class="kw">this-></font>SetLineWidth<font class="kw">(</font>.3<font class="kw">);<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">''</font><font class="kw">,</font><font class="str">'B'</font><font class="kw">);<br> </font><font class="cmt">//Header<br> </font>$w<font class="kw">=array(</font>40<font class="kw">,</font>35<font class="kw">,</font>40<font class="kw">,</font>45<font class="kw">);<br> for(</font>$i<font class="kw">=</font>0<font class="kw">;</font>$i<font class="kw"><</font>count<font class="kw">(</font>$header<font class="kw">);</font>$i<font class="kw">++)<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>$i<font class="kw">],</font>7<font class="kw">,</font>$header<font class="kw">[</font>$i<font class="kw">],</font>1<font class="kw">,</font>0<font class="kw">,</font><font class="str">'C'</font><font class="kw">,</font>1<font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">();<br> </font><font class="cmt">//Color and font restoration<br> </font>$<font class="kw">this-></font>SetFillColor<font class="kw">(</font>224<font class="kw">,</font>235<font class="kw">,</font>255<font class="kw">);<br> </font>$<font class="kw">this-></font>SetTextColor<font class="kw">(</font>0<font class="kw">);<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">''</font><font class="kw">);<br> </font><font class="cmt">//Data<br> </font>$fill<font class="kw">=</font>0<font class="kw">;<br> foreach(</font>$data <font class="kw">as </font>$row<font class="kw">)<br> {<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>0<font class="kw">],</font>6<font class="kw">,</font>$row<font class="kw">[</font>0<font class="kw">],</font><font class="str">'LR'</font><font class="kw">,</font>0<font class="kw">,</font><font class="str">'L'</font><font class="kw">,</font>$fill<font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>1<font class="kw">],</font>6<font class="kw">,</font>$row<font class="kw">[</font>1<font class="kw">],</font><font class="str">'LR'</font><font class="kw">,</font>0<font class="kw">,</font><font class="str">'L'</font><font class="kw">,</font>$fill<font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>2<font class="kw">],</font>6<font class="kw">,</font>number_format<font class="kw">(</font>$row<font class="kw">[</font>2<font class="kw">]),</font><font class="str">'LR'</font><font class="kw">,</font>0<font class="kw">,</font><font class="str">'R'</font><font class="kw">,</font>$fill<font class="kw">);<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>$w<font class="kw">[</font>3<font class="kw">],</font>6<font class="kw">,</font>number_format<font class="kw">(</font>$row<font class="kw">[</font>3<font class="kw">]),</font><font class="str">'LR'</font><font class="kw">,</font>0<font class="kw">,</font><font class="str">'R'</font><font class="kw">,</font>$fill<font class="kw">);<br> </font>$<font class="kw">this-></font>Ln<font class="kw">();<br> </font>$fill<font class="kw">=!</font>$fill<font class="kw">;<br> }<br> </font>$<font class="kw">this-></font>Cell<font class="kw">(</font>array_sum<font class="kw">(</font>$w<font class="kw">),</font>0<font class="kw">,</font><font class="str">''</font><font class="kw">,</font><font class="str">'T'</font><font class="kw">);<br>}<br>}<br><br></font>$pdf<font class="kw">=new </font>PDF<font class="kw">();<br></font><font class="cmt">//Column titles<br></font>$header<font class="kw">=array(</font><font class="str">'Country'</font><font class="kw">,</font><font class="str">'Capital'</font><font class="kw">,</font><font class="str">'Area (sq km)'</font><font class="kw">,</font><font class="str">'Pop. (thousands)'</font><font class="kw">);<br></font><font class="cmt">//Data loading<br></font>$data<font class="kw">=</font>$pdf<font class="kw">-></font>LoadData<font class="kw">(</font><font class="str">'countries.txt'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>14<font class="kw">);<br></font>$pdf<font class="kw">-></font>AddPage<font class="kw">();<br></font>$pdf<font class="kw">-></font>BasicTable<font class="kw">(</font>$header<font class="kw">,</font>$data<font class="kw">);<br></font>$pdf<font class="kw">-></font>AddPage<font class="kw">();<br></font>$pdf<font class="kw">-></font>ImprovedTable<font class="kw">(</font>$header<font class="kw">,</font>$data<font class="kw">);<br></font>$pdf<font class="kw">-></font>AddPage<font class="kw">();<br></font>$pdf<font class="kw">-></font>FancyTable<font class="kw">(</font>$header<font class="kw">,</font>$data<font class="kw">);<br></font>$pdf<font class="kw">-></font>Output<font class="kw">();<br></font>?> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<SCRIPT> +<!-- +if(document.location.href.indexOf('http:')==0) +{ +document.write("<P CLASS='demo'><A HREF='tuto5.php' TARGET='_blank' CLASS='demo'>[Demo]</A></P>"); +} +//--> +</SCRIPT> +A table being just a collection of cells, it is natural to build one from them. The first +example is achieved in the most basic way possible: simple framed cells, all of the same size +and left aligned. The result is rudimentary but very quick to obtain. +<BR> +<BR> +The second table brings some improvements: each column has its own width, titles are centered +and figures right aligned. Moreover, horizontal lines have been removed. This is done by means +of the <TT>border</TT> parameter of the <A HREF='../doc/cell.htm'>Cell()</A> method, which specifies which sides of the +cell must be drawn. Here we want the left (<TT>L</TT>) and right (<TT>R</TT>) ones. It remains +the problem of the horizontal line to finish the table. There are two possibilities: either +check for the last line in the loop, in which case we use <TT>LRB</TT> for the <TT>border</TT> +parameter; or, as done here, add the line once the loop is over. +<BR> +<BR> +The third table is similar to the second one but uses colors. Fill, text and line colors are +simply specified. Alternate coloring for rows is obtained by using alternatively transparent +and filled cells. +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto5.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto5.php new file mode 100644 index 0000000000000000000000000000000000000000..feaad366531417a93e65cddbd9ca6fbf8a1611ff --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto5.php @@ -0,0 +1,101 @@ +<?php +require('../fpdf.php'); + +class PDF extends FPDF +{ +//Load data +function LoadData($file) +{ + //Read file lines + $lines=file($file); + $data=array(); + foreach($lines as $line) + $data[]=explode(';',chop($line)); + return $data; +} + +//Simple table +function BasicTable($header,$data) +{ + //Header + foreach($header as $col) + $this->Cell(40,7,$col,1); + $this->Ln(); + //Data + foreach($data as $row) + { + foreach($row as $col) + $this->Cell(40,6,$col,1); + $this->Ln(); + } +} + +//Better table +function ImprovedTable($header,$data) +{ + //Column widths + $w=array(40,35,40,45); + //Header + for($i=0;$i<count($header);$i++) + $this->Cell($w[$i],7,$header[$i],1,0,'C'); + $this->Ln(); + //Data + foreach($data as $row) + { + $this->Cell($w[0],6,$row[0],'LR'); + $this->Cell($w[1],6,$row[1],'LR'); + $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R'); + $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R'); + $this->Ln(); + } + //Closure line + $this->Cell(array_sum($w),0,'','T'); +} + +//Colored table +function FancyTable($header,$data) +{ + //Colors, line width and bold font + $this->SetFillColor(255,0,0); + $this->SetTextColor(255); + $this->SetDrawColor(128,0,0); + $this->SetLineWidth(.3); + $this->SetFont('','B'); + //Header + $w=array(40,35,40,45); + for($i=0;$i<count($header);$i++) + $this->Cell($w[$i],7,$header[$i],1,0,'C',1); + $this->Ln(); + //Color and font restoration + $this->SetFillColor(224,235,255); + $this->SetTextColor(0); + $this->SetFont(''); + //Data + $fill=0; + foreach($data as $row) + { + $this->Cell($w[0],6,$row[0],'LR',0,'L',$fill); + $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill); + $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill); + $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill); + $this->Ln(); + $fill=!$fill; + } + $this->Cell(array_sum($w),0,'','T'); +} +} + +$pdf=new PDF(); +//Column titles +$header=array('Country','Capital','Area (sq km)','Pop. (thousands)'); +//Data loading +$data=$pdf->LoadData('countries.txt'); +$pdf->SetFont('Arial','',14); +$pdf->AddPage(); +$pdf->BasicTable($header,$data); +$pdf->AddPage(); +$pdf->ImprovedTable($header,$data); +$pdf->AddPage(); +$pdf->FancyTable($header,$data); +$pdf->Output(); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto6.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto6.htm new file mode 100644 index 0000000000000000000000000000000000000000..a2d3db645c974765f1ecd86847ba8bea43c11907 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto6.htm @@ -0,0 +1,68 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Links and flowing text</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Links and flowing text</H2> +This tutorial explains how to insert links (internal and external) and shows a new text writing +mode. It also contains a rudimentary HTML parser. +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +<?php<br><font class="kw">require(</font><font class="str">'fpdf.php'</font><font class="kw">);<br><br>class </font>PDF <font class="kw">extends </font>FPDF<br><font class="kw">{<br>var </font>$B<font class="kw">;<br>var </font>$I<font class="kw">;<br>var </font>$U<font class="kw">;<br>var </font>$HREF<font class="kw">;<br><br>function </font>PDF<font class="kw">(</font>$orientation<font class="kw">=</font><font class="str">'P'</font><font class="kw">,</font>$unit<font class="kw">=</font><font class="str">'mm'</font><font class="kw">,</font>$format<font class="kw">=</font><font class="str">'A4'</font><font class="kw">)<br>{<br> </font><font class="cmt">//Call parent constructor<br> </font>$<font class="kw">this-></font>FPDF<font class="kw">(</font>$orientation<font class="kw">,</font>$unit<font class="kw">,</font>$format<font class="kw">);<br> </font><font class="cmt">//Initialization<br> </font>$<font class="kw">this-></font>B<font class="kw">=</font>0<font class="kw">;<br> </font>$<font class="kw">this-></font>I<font class="kw">=</font>0<font class="kw">;<br> </font>$<font class="kw">this-></font>U<font class="kw">=</font>0<font class="kw">;<br> </font>$<font class="kw">this-></font>HREF<font class="kw">=</font><font class="str">''</font><font class="kw">;<br>}<br><br>function </font>WriteHTML<font class="kw">(</font>$html<font class="kw">)<br>{<br> </font><font class="cmt">//HTML parser<br> </font>$html<font class="kw">=</font>str_replace<font class="kw">(</font><font class="str">"\n"</font><font class="kw">,</font><font class="str">' '</font><font class="kw">,</font>$html<font class="kw">);<br> </font>$a<font class="kw">=</font>preg_split<font class="kw">(</font><font class="str">'/<(.*)>/U'</font><font class="kw">,</font>$html<font class="kw">,-</font>1<font class="kw">,</font>PREG_SPLIT_DELIM_CAPTURE<font class="kw">);<br> foreach(</font>$a <font class="kw">as </font>$i<font class="kw">=></font>$e<font class="kw">)<br> {<br> if(</font>$i<font class="kw">%</font>2<font class="kw">==</font>0<font class="kw">)<br> {<br> </font><font class="cmt">//Text<br> </font><font class="kw">if(</font>$<font class="kw">this-></font>HREF<font class="kw">)<br> </font>$<font class="kw">this-></font>PutLink<font class="kw">(</font>$<font class="kw">this-></font>HREF<font class="kw">,</font>$e<font class="kw">);<br> else<br> </font>$<font class="kw">this-></font>Write<font class="kw">(</font>5<font class="kw">,</font>$e<font class="kw">);<br> }<br> else<br> {<br> </font><font class="cmt">//Tag<br> </font><font class="kw">if(</font>$e<font class="kw">{</font>0<font class="kw">}==</font><font class="str">'/'</font><font class="kw">)<br> </font>$<font class="kw">this-></font>CloseTag<font class="kw">(</font>strtoupper<font class="kw">(</font>substr<font class="kw">(</font>$e<font class="kw">,</font>1<font class="kw">)));<br> else<br> {<br> </font><font class="cmt">//Extract attributes<br> </font>$a2<font class="kw">=</font>explode<font class="kw">(</font><font class="str">' '</font><font class="kw">,</font>$e<font class="kw">);<br> </font>$tag<font class="kw">=</font>strtoupper<font class="kw">(</font>array_shift<font class="kw">(</font>$a2<font class="kw">));<br> </font>$attr<font class="kw">=array();<br> foreach(</font>$a2 <font class="kw">as </font>$v<font class="kw">)<br> if(</font>ereg<font class="kw">(</font><font class="str">'^([^=]*)=["\']?([^"\']*)["\']?$'</font><font class="kw">,</font>$v<font class="kw">,</font>$a3<font class="kw">))<br> </font>$attr<font class="kw">[</font>strtoupper<font class="kw">(</font>$a3<font class="kw">[</font>1<font class="kw">])]=</font>$a3<font class="kw">[</font>2<font class="kw">];<br> </font>$<font class="kw">this-></font>OpenTag<font class="kw">(</font>$tag<font class="kw">,</font>$attr<font class="kw">);<br> }<br> }<br> }<br>}<br><br>function </font>OpenTag<font class="kw">(</font>$tag<font class="kw">,</font>$attr<font class="kw">)<br>{<br> </font><font class="cmt">//Opening tag<br> </font><font class="kw">if(</font>$tag<font class="kw">==</font><font class="str">'B' </font><font class="kw">or </font>$tag<font class="kw">==</font><font class="str">'I' </font><font class="kw">or </font>$tag<font class="kw">==</font><font class="str">'U'</font><font class="kw">)<br> </font>$<font class="kw">this-></font>SetStyle<font class="kw">(</font>$tag<font class="kw">,</font>true<font class="kw">);<br> if(</font>$tag<font class="kw">==</font><font class="str">'A'</font><font class="kw">)<br> </font>$<font class="kw">this-></font>HREF<font class="kw">=</font>$attr<font class="kw">[</font><font class="str">'HREF'</font><font class="kw">];<br> if(</font>$tag<font class="kw">==</font><font class="str">'BR'</font><font class="kw">)<br> </font>$<font class="kw">this-></font>Ln<font class="kw">(</font>5<font class="kw">);<br>}<br><br>function </font>CloseTag<font class="kw">(</font>$tag<font class="kw">)<br>{<br> </font><font class="cmt">//Closing tag<br> </font><font class="kw">if(</font>$tag<font class="kw">==</font><font class="str">'B' </font><font class="kw">or </font>$tag<font class="kw">==</font><font class="str">'I' </font><font class="kw">or </font>$tag<font class="kw">==</font><font class="str">'U'</font><font class="kw">)<br> </font>$<font class="kw">this-></font>SetStyle<font class="kw">(</font>$tag<font class="kw">,</font>false<font class="kw">);<br> if(</font>$tag<font class="kw">==</font><font class="str">'A'</font><font class="kw">)<br> </font>$<font class="kw">this-></font>HREF<font class="kw">=</font><font class="str">''</font><font class="kw">;<br>}<br><br>function </font>SetStyle<font class="kw">(</font>$tag<font class="kw">,</font>$enable<font class="kw">)<br>{<br> </font><font class="cmt">//Modify style and select corresponding font<br> </font>$<font class="kw">this-></font>$tag<font class="kw">+=(</font>$enable <font class="kw">? </font>1 <font class="kw">: -</font>1<font class="kw">);<br> </font>$style<font class="kw">=</font><font class="str">''</font><font class="kw">;<br> foreach(array(</font><font class="str">'B'</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">,</font><font class="str">'U'</font><font class="kw">) as </font>$s<font class="kw">)<br> if(</font>$<font class="kw">this-></font>$s<font class="kw">></font>0<font class="kw">)<br> </font>$style<font class="kw">.=</font>$s<font class="kw">;<br> </font>$<font class="kw">this-></font>SetFont<font class="kw">(</font><font class="str">''</font><font class="kw">,</font>$style<font class="kw">);<br>}<br><br>function </font>PutLink<font class="kw">(</font>$URL<font class="kw">,</font>$txt<font class="kw">)<br>{<br> </font><font class="cmt">//Put a hyperlink<br> </font>$<font class="kw">this-></font>SetTextColor<font class="kw">(</font>0<font class="kw">,</font>0<font class="kw">,</font>255<font class="kw">);<br> </font>$<font class="kw">this-></font>SetStyle<font class="kw">(</font><font class="str">'U'</font><font class="kw">,</font>true<font class="kw">);<br> </font>$<font class="kw">this-></font>Write<font class="kw">(</font>5<font class="kw">,</font>$txt<font class="kw">,</font>$URL<font class="kw">);<br> </font>$<font class="kw">this-></font>SetStyle<font class="kw">(</font><font class="str">'U'</font><font class="kw">,</font>false<font class="kw">);<br> </font>$<font class="kw">this-></font>SetTextColor<font class="kw">(</font>0<font class="kw">);<br>}<br>}<br><br></font>$html<font class="kw">=</font><font class="str">'You can now easily print text mixing different<br>styles : <B>bold</B>, <I>italic</I>, <U>underlined</U>, or<br><B><I><U>all at once</U></I></B>!<BR>You can also insert links<br>on text, such as <A HREF="http://www.fpdf.org">www.fpdf.org</A>,<br>or on an image: click on the logo.'</font><font class="kw">;<br><br></font>$pdf<font class="kw">=new </font>PDF<font class="kw">();<br></font><font class="cmt">//First page<br></font>$pdf<font class="kw">-></font>AddPage<font class="kw">();<br></font>$pdf<font class="kw">-></font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>20<font class="kw">);<br></font>$pdf<font class="kw">-></font>Write<font class="kw">(</font>5<font class="kw">,</font><font class="str">'To find out what\'s new in this tutorial, click '</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>SetFont<font class="kw">(</font><font class="str">''</font><font class="kw">,</font><font class="str">'U'</font><font class="kw">);<br></font>$link<font class="kw">=</font>$pdf<font class="kw">-></font>AddLink<font class="kw">();<br></font>$pdf<font class="kw">-></font>Write<font class="kw">(</font>5<font class="kw">,</font><font class="str">'here'</font><font class="kw">,</font>$link<font class="kw">);<br></font>$pdf<font class="kw">-></font>SetFont<font class="kw">(</font><font class="str">''</font><font class="kw">);<br></font><font class="cmt">//Second page<br></font>$pdf<font class="kw">-></font>AddPage<font class="kw">();<br></font>$pdf<font class="kw">-></font>SetLink<font class="kw">(</font>$link<font class="kw">);<br></font>$pdf<font class="kw">-></font>Image<font class="kw">(</font><font class="str">'logo.png'</font><font class="kw">,</font>10<font class="kw">,</font>10<font class="kw">,</font>30<font class="kw">,</font>0<font class="kw">,</font><font class="str">''</font><font class="kw">,</font><font class="str">'http://www.fpdf.org'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>SetLeftMargin<font class="kw">(</font>45<font class="kw">);<br></font>$pdf<font class="kw">-></font>SetFontSize<font class="kw">(</font>14<font class="kw">);<br></font>$pdf<font class="kw">-></font>WriteHTML<font class="kw">(</font>$html<font class="kw">);<br></font>$pdf<font class="kw">-></font>Output<font class="kw">();<br></font>?> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<SCRIPT> +<!-- +if(document.location.href.indexOf('http:')==0) +{ +document.write("<P CLASS='demo'><A HREF='tuto6.php' TARGET='_blank' CLASS='demo'>[Demo]</A></P>"); +} +//--> +</SCRIPT> +The new method to print text is <A HREF='../doc/write.htm'>Write()</A>. It is very close to <A HREF='../doc/multicell.htm'>MultiCell()</A>; the differences +are: +<UL> +<LI>The end of line is at the right margin and the next line begins at the left one +<LI>The current position moves at the end of the text +</UL> +So it allows to write a chunk of text, alter the font style, then continue from the exact +place we left it. On the other hand, you cannot full justify it. +<BR> +<BR> +The method is used on the first page to put a link pointing to the second one. The beginning of +the sentence is written in regular style, then we switch to underline and finish it. The link +is created with <A HREF='../doc/addlink.htm'>AddLink()</A>, which returns a link identifier. The identifier is +passed as third parameter of Write(). Once the second page is created, we use <A HREF='../doc/setlink.htm'>SetLink()</A> to +make the link point to the beginning of the current page. +<BR> +<BR> +Then we put an image with a link on it. An external link points to an URL (HTTP, mailto...). +The URL is simply passed as last parameter of <A HREF='../doc/image.htm'>Image()</A>. +Note that external links do not work when the PDF is displayed inside Netscape's plug-in. +<BR> +<BR> +Finally, the left margin is moved after the image with <A HREF='../doc/setleftmargin.htm'>SetLeftMargin()</A> and some text in +HTML format is output. An HTML parser is used for this, based on the regular expression splitting +function preg_split() and the option PREG_SPLIT_DELIM_CAPTURE (introduced in PHP 4.0.5) which +allows to fetch the separators as well (in this case the tags). If you use an older version of +PHP, replace the line with this one: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$a<font class="kw">=</font>preg_split<font class="kw">(</font><font class="str">'/[<>]/'</font><font class="kw">,</font>$html<font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +which is less strict but gives the same results with valid HTML. +<BR> +Recognized tags are <B>, <I>, <U>, <A> and <BR>; the others are +ignored. The parser also makes use of the Write() method. An external link is put the same way as +an internal one (third parameter of Write()). +<BR> +Note that <A HREF='../doc/cell.htm'>Cell()</A> also allows to put links. +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto6.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto6.php new file mode 100644 index 0000000000000000000000000000000000000000..f28747e7276362528fd65803a1faab4ed889d1b5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto6.php @@ -0,0 +1,122 @@ +<?php +require('../fpdf.php'); + +class PDF extends FPDF +{ +var $B; +var $I; +var $U; +var $HREF; + +function PDF($orientation='P',$unit='mm',$format='A4') +{ + //Call parent constructor + $this->FPDF($orientation,$unit,$format); + //Initialization + $this->B=0; + $this->I=0; + $this->U=0; + $this->HREF=''; +} + +function WriteHTML($html) +{ + //HTML parser + $html=str_replace("\n",' ',$html); + $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE); + foreach($a as $i=>$e) + { + if($i%2==0) + { + //Text + if($this->HREF) + $this->PutLink($this->HREF,$e); + else + $this->Write(5,$e); + } + else + { + //Tag + if($e{0}=='/') + $this->CloseTag(strtoupper(substr($e,1))); + else + { + //Extract attributes + $a2=explode(' ',$e); + $tag=strtoupper(array_shift($a2)); + $attr=array(); + foreach($a2 as $v) + if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3)) + $attr[strtoupper($a3[1])]=$a3[2]; + $this->OpenTag($tag,$attr); + } + } + } +} + +function OpenTag($tag,$attr) +{ + //Opening tag + if($tag=='B' or $tag=='I' or $tag=='U') + $this->SetStyle($tag,true); + if($tag=='A') + $this->HREF=$attr['HREF']; + if($tag=='BR') + $this->Ln(5); +} + +function CloseTag($tag) +{ + //Closing tag + if($tag=='B' or $tag=='I' or $tag=='U') + $this->SetStyle($tag,false); + if($tag=='A') + $this->HREF=''; +} + +function SetStyle($tag,$enable) +{ + //Modify style and select corresponding font + $this->$tag+=($enable ? 1 : -1); + $style=''; + foreach(array('B','I','U') as $s) + if($this->$s>0) + $style.=$s; + $this->SetFont('',$style); +} + +function PutLink($URL,$txt) +{ + //Put a hyperlink + $this->SetTextColor(0,0,255); + $this->SetStyle('U',true); + $this->Write(5,$txt,$URL); + $this->SetStyle('U',false); + $this->SetTextColor(0); +} +} + +$html='You can now easily print text mixing different +styles : <B>bold</B>, <I>italic</I>, <U>underlined</U>, or +<B><I><U>all at once</U></I></B>!<BR>You can also insert links +on text, such as <A HREF="http://www.fpdf.org">www.fpdf.org</A>, +or on an image: click on the logo.'; + +$pdf=new PDF(); +//First page +$pdf->AddPage(); +$pdf->SetFont('Arial','',20); +$pdf->Write(5,'To find out what\'s new in this tutorial, click '); +$pdf->SetFont('','U'); +$link=$pdf->AddLink(); +$pdf->Write(5,'here',$link); +$pdf->SetFont(''); +//Second page +$pdf->AddPage(); +$pdf->SetLink($link); +$pdf->Image('logo.png',10,10,30,0,'','http://www.fpdf.org'); +$pdf->SetLeftMargin(45); +$pdf->SetFontSize(14); +$pdf->WriteHTML($html); +$pdf->Output(); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto7.htm b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto7.htm new file mode 100644 index 0000000000000000000000000000000000000000..d2216a9f7d994e1ad0aa5ec8d26a1ff0900f16e1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto7.htm @@ -0,0 +1,315 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> +<TITLE>Adding new fonts and encoding support</TITLE> +<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> +</HEAD> +<BODY> +<H2>Adding new fonts and encoding support</H2> +This tutorial explains how to use TrueType or Type1 fonts so that you are not limited to the standard +fonts any more. The other interest is that you can choose the font encoding, which allows you to +use other languages than the Western ones (the standard fonts having too few available characters). +<BR> +<BR> +There are two ways to use a new font: embedding it in the PDF or not. When a font is not +embedded, it is sought in the system. The advantage is that the PDF file is lighter; on the other +hand, if it is not available, a substitution font is used. So it is preferable to ensure that the +needed font is installed on the client systems. If the file is to be viewed by a large audience, +it is better to embed. +<BR> +<BR> +Adding a new font requires three steps for TrueTypes: +<UL> +<LI>Generation of the metric file (.afm) +<LI>Generation of the font definition file (.php) +<LI>Declaration of the font in the script +</UL> +For Type1, the first one is theoretically not necessary because the AFM file is usually shipped +with the font. In case you have only a metric file in PFM format, use the convertor available +<A HREF="http://www.fpdf.org/fr/dl.php?id=34">here</A>. +<H4 CLASS='st'>Generation of the metric file</H4> +The first step for a TrueType consists in generating the AFM file. A utility exists to do this +task: <A HREF="http://ttf2pt1.sourceforge.net" TARGET="_blank">ttf2pt1</A>. The Windows binary +is available <A HREF="http://www.fpdf.org/fr/dl.php?id=22">here</A>. The command line to use is +the following: +<BR> +<BR> +<TT>ttf2pt1 -a font.ttf font</TT> +<BR> +<BR> +For example, for Comic Sans MS Regular: +<BR> +<BR> +<TT>ttf2pt1 -a c:\windows\fonts\comic.ttf comic</TT> +<BR> +<BR> +Two files are created; the one we are interested in is comic.afm. +<H4 CLASS='st'>Generation of the font definition file</H4> +The second step consists in generating a PHP file containing all the information needed by FPDF; +in addition, the font file is compressed. To do this, a helper script is provided in the font/makefont/ +directory of the package: makefont.php. It contains the following function: +<BR> +<BR> +<TT>MakeFont(<B>string</B> fontfile, <B>string</B> afmfile [, <B>string</B> enc [, <B>array</B> patch [, <B>string</B> type]]])</TT> +<BR> +<BR> +<TT><U>fontfile</U></TT> +<BLOCKQUOTE> +Path to the .ttf or .pfb file. +</BLOCKQUOTE> +<TT><U>afmfile</U></TT> +<BLOCKQUOTE> +Path to the .afm file. +</BLOCKQUOTE> +<TT><U>enc</U></TT> +<BLOCKQUOTE> +Name of the encoding to use. Default value: <TT>cp1252</TT>. +</BLOCKQUOTE> +<TT><U>patch</U></TT> +<BLOCKQUOTE> +Optional modification of the encoding. Empty by default. +</BLOCKQUOTE> +<TT><U>type</U></TT> +<BLOCKQUOTE> +Type of the font (<TT>TrueType</TT> or <TT>Type1</TT>). Default value: <TT>TrueType</TT>. +</BLOCKQUOTE> +<BR> +The first parameter is the name of the font file. The extension must be either .ttf or .pfb and +determines the font type. If you own a Type1 font in ASCII format (.pfa), you can convert it to +binary format with <A HREF="http://www.lcdf.org/~eddietwo/type/#t1utils" TARGET="_blank">t1utils</A>. +<BR> +If you don't want to embed the font, pass an empty string. In this case, type is given by the +<TT>type</TT> parameter. +<BR> +Note: in the case of a font with the same name as a standard one, for instance arial.ttf, it is +mandatory to embed. If you don't, Acrobat will use its own font. +<BR> +<BR> +The AFM file is the one previously generated. +<BR> +<BR> +The encoding defines the association between a code (from 0 to 255) and a character. The first +128 are fixed and correspond to ASCII; the following are variable. The encodings are stored in +.map files. Those available are: +<UL> +<LI>cp1250 (Central Europe) +<LI>cp1251 (Cyrillic) +<LI>cp1252 (Western Europe) +<LI>cp1253 (Greek) +<LI>cp1254 (Turkish) +<LI>cp1255 (Hebrew) +<LI>cp1257 (Baltic) +<LI>cp1258 (Vietnamese) +<LI>cp874 (Thai) +<LI>ISO-8859-1 (Western Europe) +<LI>ISO-8859-2 (Central Europe) +<LI>ISO-8859-4 (Baltic) +<LI>ISO-8859-5 (Cyrillic) +<LI>ISO-8859-7 (Greek) +<LI>ISO-8859-9 (Turkish) +<LI>ISO-8859-11 (Thai) +<LI>ISO-8859-15 (Western Europe) +<LI>ISO-8859-16 (Central Europe) +<LI>KOI8-R (Russian) +<LI>KOI8-U (Ukrainian) +</UL> +Of course, the font must contain the characters corresponding to the chosen encoding. +<BR> +In the particular case of a symbolic font (that is to say which does not contain letters, such +as Symbol or ZapfDingbats), pass an empty string. +<BR> +The encodings which begin with cp are those used by Windows; Linux systems usually use ISO. +<BR> +Remark: the standard fonts use cp1252. +<BR> +<BR> +The fourth parameter gives the possibility to alter the encoding. Sometimes you may want to add +some characters. For instance, ISO-8859-1 does not contain the euro symbol. To add it at position +164, pass <TT>array(164=>'Euro')</TT>. +<BR> +<BR> +The last parameter is used to give the type of the font in case it is not embedded (that is to +say the first parameter is empty). +<BR> +<BR> +After you have called the function (create a new file for this and include makefont.php, or +simply add the call directly inside), a .php file is created, with the same name as the .afm one. +You may rename it if you wish. If the case of embedding, the font file is compressed and gives a +second file with .z as extension (except if the compression function is not available, it +requires zlib). You may rename it too, but in this case you have to alter the variable <TT>$file</TT> +in the .php file accordingly. +<BR> +<BR> +Example: +<BR> +<BR> +<TT>MakeFont('c:\\windows\\fonts\\comic.ttf','comic.afm','cp1252');</TT> +<BR> +<BR> +which gives the files comic.php and comic.z. +<BR> +<BR> +Then you have to copy the generated file(s) to the font directory. If the font file +could not be compressed, copy the .ttf or .pfb instead of the .z. +<H4 CLASS='st'>Declaration of the font in the script</H4> +The last step is the most simple. You just need to call the <A HREF='../doc/addfont.htm'>AddFont()</A> method. For instance: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$pdf<font class="kw">-></font>AddFont<font class="kw">(</font><font class="str">'Comic'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font><font class="str">'comic.php'</font><font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +or simply: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$pdf<font class="kw">-></font>AddFont<font class="kw">(</font><font class="str">'Comic'</font><font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +And the font is now available (in regular and underlined styles), usable like the others. If we +had worked with Comic Sans MS Bold (comicbd.ttf), we would have put: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$pdf<font class="kw">-></font>AddFont<font class="kw">(</font><font class="str">'Comic'</font><font class="kw">,</font><font class="str">'B'</font><font class="kw">,</font><font class="str">'comicbd.php'</font><font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<H4 CLASS='st'>Example</H4> +Let's now see a small complete example. The font used is Calligrapher, available at +<A HREF="http://www.abstractfonts.com/fonts/" TARGET="_blank">www.abstractfonts.com</A> (a site +offering numerous free TrueType fonts). The first step is the generation of the AFM file: +<BR> +<BR> +<TT>ttf2pt1 -a calligra.ttf calligra</TT> +<BR> +<BR> +which gives calligra.afm (and calligra.t1a that we can delete). Then we generate the definition +file: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +<?php<br><font class="kw">require(</font><font class="str">'font/makefont/makefont.php'</font><font class="kw">);<br><br></font>MakeFont<font class="kw">(</font><font class="str">'calligra.ttf'</font><font class="kw">,</font><font class="str">'calligra.afm'</font><font class="kw">);<br></font>?> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +The function call gives the following report: +<BR> +<BR> +<B>Warning:</B> character Euro is missing<BR> +<B>Warning:</B> character Zcaron is missing<BR> +<B>Warning:</B> character zcaron is missing<BR> +<B>Warning:</B> character eth is missing<BR> +Font file compressed (calligra.z)<BR> +Font definition file generated (calligra.php)<BR> +<BR> +The euro character is not present in the font (it is too old). Three other characters are missing +too, but we are not interested in them anyway. +<BR> +We can now copy the two files to the font directory and write the script: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +<?php<br><font class="kw">require(</font><font class="str">'fpdf.php'</font><font class="kw">);<br><br></font>$pdf<font class="kw">=new </font>FPDF<font class="kw">();<br></font>$pdf<font class="kw">-></font>AddFont<font class="kw">(</font><font class="str">'Calligrapher'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font><font class="str">'calligra.php'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>AddPage<font class="kw">();<br></font>$pdf<font class="kw">-></font>SetFont<font class="kw">(</font><font class="str">'Calligrapher'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>35<font class="kw">);<br></font>$pdf<font class="kw">-></font>Cell<font class="kw">(</font>0<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Enjoy new fonts with FPDF!'</font><font class="kw">);<br></font>$pdf<font class="kw">-></font>Output<font class="kw">();<br></font>?> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<SCRIPT> +<!-- +if(document.location.href.indexOf('http:')==0) +{ +document.write("<P CLASS='demo'><A HREF='tuto7.php' TARGET='_blank' CLASS='demo'>[Demo]</A></P>"); +} +//--> +</SCRIPT> +<H4 CLASS='st'>About the euro symbol</H4> +The euro character is not present in all encodings, and is not always placed at the same position: +<BR> +<BR> +<STYLE> +TH {text-align:left; background:#E0EBFF} +TH, TD {padding-left:10px; padding-right:10px; border-bottom-width:0px; border-left-width:1px; border-right-width:0px; border-top-width:1px} +TR.alt0 {background:#FFFFEE} +TR.alt1 {background:#FFFFDF} +</STYLE> +<TABLE STYLE="margin-left:15px; border-style:outset" BORDER="2" CELLSPACING="0" CELLPADDING="2" BGCOLOR2="#FFFFEE"> +<TR><TH CLASS="st">Encoding</TH><TH CLASS="st">Position</TH></TR> +<TR CLASS="alt0"><TD>cp1250</TD><TD>128<BR></TD></TR> +<TR CLASS="alt1"><TD>cp1251</TD><TD>136<BR></TD></TR> +<TR CLASS="alt0"><TD>cp1252</TD><TD>128<BR></TD></TR> +<TR CLASS="alt1"><TD>cp1253</TD><TD>128<BR></TD></TR> +<TR CLASS="alt0"><TD>cp1254</TD><TD>128<BR></TD></TR> +<TR CLASS="alt1"><TD>cp1255</TD><TD>128<BR></TD></TR> +<TR CLASS="alt0"><TD>cp1257</TD><TD>128<BR></TD></TR> +<TR CLASS="alt1"><TD>cp1258</TD><TD>128<BR></TD></TR> +<TR CLASS="alt0"><TD>cp874</TD><TD>128<BR></TD></TR> +<TR CLASS="alt1"><TD>ISO-8859-1</TD><TD>absent<BR></TD></TR> +<TR CLASS="alt0"><TD>ISO-8859-2</TD><TD>absent<BR></TD></TR> +<TR CLASS="alt1"><TD>ISO-8859-4</TD><TD>absent<BR></TD></TR> +<TR CLASS="alt0"><TD>ISO-8859-5</TD><TD>absent<BR></TD></TR> +<TR CLASS="alt1"><TD>ISO-8859-7</TD><TD>absent<BR></TD></TR> +<TR CLASS="alt0"><TD>ISO-8859-9</TD><TD>absent<BR></TD></TR> +<TR CLASS="alt1"><TD>ISO-8859-11</TD><TD>absent<BR></TD></TR> +<TR CLASS="alt0"><TD>ISO-8859-15</TD><TD>164<BR></TD></TR> +<TR CLASS="alt1"><TD>ISO-8859-16</TD><TD>164<BR></TD></TR> +<TR CLASS="alt0"><TD>KOI8-R</TD><TD>absent<BR></TD></TR> +<TR CLASS="alt1"><TD>KOI8-U</TD><TD>absent<BR></TD></TR> +</TABLE> +<BR> +ISO-8859-1 is widespread but does not include the euro sign. If you need it, the simplest thing +to do is using cp1252 or ISO-8859-15 instead, which are nearly identical but contain the precious +symbol. +<BR> +As for ISO-8859-2, it is possible to use ISO-8859-16 instead, but it contains many differences. +It is therefore simpler to patch the encoding to add the symbol to it, as explained above. The +same is true for the other encodings. +<H4 CLASS='st'>Font synthesis under Windows</H4> +When a TrueType font is not available in a given style, Windows is able to synthesize it from the +regular version. For instance, there is no Comic Sans MS Italic, but it can be built from Comic +Sans MS Regular. This feature can be used in a PDF file, but unfortunately requires that the +regular font be present in the system (you must not embed it). Here is how to do it: +<UL> +<LI>Generate the definition file for the regular font without embedding (you may rename it to +reflect the desired style) +<LI>Open it and append to the variable <TT>$name</TT> a comma followed by the desired style +(<TT>Italic</TT>, <TT>Bold</TT> or <TT>BoldItalic</TT>) +</UL> +For instance, for the file comici.php: +<BR> +<BR> +<TT>$name='ComicSansMS,Italic';</TT> +<BR> +<BR> +It can then be used normally: +<BR> +<BR> +<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px"> +<NOBR><code><font color="#000000"> +$pdf<font class="kw">-></font>AddFont<font class="kw">(</font><font class="str">'Comic'</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">,</font><font class="str">'comici.php'</font><font class="kw">);</font><br> +</font> +</code></NOBR></TD></TR></TABLE><P></P> +<H4 CLASS='st'>Reducing the size of TrueType fonts</H4> +Font files are often quite voluminous (more than 100, even 200KB); this is due to the fact that +they contain the characters corresponding to many encodings. zlib compression reduces them but +they remain fairly big. A technique exists to reduce them further. It consists in converting the +font to the Type1 format with ttf2pt1 by specifying the encoding you are interested in; all other +characters will be discarded. +<BR> +For instance, the arial.ttf font shipped with Windows 98 is 267KB (it contains 1296 characters). +After compression it gives 147. Let's convert it to Type1 by keeping only cp1250 characters: +<BR> +<BR> +<TT>ttf2pt1 -b -L cp1250.map c:\windows\fonts\arial.ttf arial</TT> +<BR> +<BR> +The .map files are located in the font/makefont/ directory of the package. The command produces +arial.pfb and arial.afm. The arial.pfb file is only 35KB, and 30KB after compression. +<BR> +<BR> +It is possible to go even further. If you are interested only by a subset of the encoding (you +probably don't need all 217 characters), you can open the .map file and remove the lines you are +not interested in. This will reduce the file size accordingly. +</BODY> +</HTML> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto7.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto7.php new file mode 100644 index 0000000000000000000000000000000000000000..7c191154b4754a151578ad896e8048ff18467d73 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/tutorial/tuto7.php @@ -0,0 +1,11 @@ +<?php +define('FPDF_FONTPATH','./'); +require('../fpdf.php'); + +$pdf=new FPDF(); +$pdf->AddFont('Calligrapher','','calligra.php'); +$pdf->AddPage(); +$pdf->SetFont('Calligrapher','',35); +$pdf->Cell(0,10,'Enjoy new fonts with FPDF!'); +$pdf->Output(); +?> diff --git a/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/wrapper_functions.php b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/wrapper_functions.php new file mode 100644 index 0000000000000000000000000000000000000000..01783a1e00073a85541638c31b72cac5a9479ac3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/fpdf_fpdi/wrapper_functions.php @@ -0,0 +1,70 @@ +<?php +// +// FPDI - Version 1.2.1 +// +// Copyright 2004-2008 Setasign - Jan Slabon +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +if (!defined("PHP_VER_LOWER43")) + define("PHP_VER_LOWER43", version_compare(PHP_VERSION, "4.3", "<")); + + +/** + * ensure that strspn works correct if php-version < 4.3 + */ +function _strspn($str1, $str2, $start=null, $length=null) { + $numargs = func_num_args(); + + if (PHP_VER_LOWER43 == 1) { + if (isset($length)) { + $str1 = substr($str1, $start, $length); + } else { + $str1 = substr($str1, $start); + } + } + + if ($numargs == 2 || PHP_VER_LOWER43 == 1) { + return strspn($str1, $str2); + } else if ($numargs == 3) { + return strspn($str1, $str2, $start); + } else { + return strspn($str1, $str2, $start, $length); + } +} + + +/** + * ensure that strcspn works correct if php-version < 4.3 + */ +function _strcspn($str1, $str2, $start=null, $length=null) { + $numargs = func_num_args(); + + if (PHP_VER_LOWER43 == 1) { + if (isset($length)) { + $str1 = substr($str1, $start, $length); + } else { + $str1 = substr($str1, $start); + } + } + + if ($numargs == 2 || PHP_VER_LOWER43 == 1) { + return strcspn($str1, $str2); + } else if ($numargs == 3) { + return strcspn($str1, $str2, $start); + } else { + return strcspn($str1, $str2, $start, $length); + } +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdfb/pdfb.php b/maarch_entreprise/trunk/tools/pdfb/pdfb.php new file mode 100644 index 0000000000000000000000000000000000000000..53ec31517f4e5b0e703da3fb45ff6e35eff7b64b --- /dev/null +++ b/maarch_entreprise/trunk/tools/pdfb/pdfb.php @@ -0,0 +1,190 @@ +<?php + +/* + ++-----------------------------------------------------------------+ +| Created by Chirag Mehta - http://chir.ag/tech/download/pdfb | +|-----------------------------------------------------------------| +| For PDFB Library | ++-----------------------------------------------------------------+ + +*/ + + define('FPDF_FONTPATH','pdfb/fpdf_fpdi/font/'); + require('fpdf_fpdi/previous_version/fpdi.php'); + require('barcode/barcodeimage.php'); + + class PDFB extends FPDI + { + var $barcodeData; + var $freaddata; + var $freadcursor; + + // $barcode = any alphanumber string or UPC-A valid numeric code + // $type = one of "C39", "C128A", "C128B", "C128C", "I25", "UPCA" + // $x, $y = position on the PDF page + // $w, $h = dimensions of the BarCode image + // $sx, $sy = X & Y scaling of the BarCode image + // $xres = thickness of the Bars in the Barcode - X-Resolution (1,2,3) + // $font = Font size for BarCode value (1,2,3,4,5) + // $link = URL to link the BarCode to + // $format = "PNG" (default) or "JPEG" + + // If you wish to make high-resolution barcodes: + // -> use $xres = 2 or $xres = 3 + // -> use $font = 5 + // -> use $w, $h = large dimensions + // -> use $sx, $sy = (0.5, 0.5) or (0.25, 0.25) to scale it down to desire size. + // Then zooming into the image you will see that it's quite scalable and high-resolution + + function BarCode($barcode, $type="", $x=0, $y=0, $w=0, $h=0, $sx=1, $sy=1, $xres=2, $font=5, $link="", $format="PNG") + { + $barcode = substr(trim($barcode), 0, 32); + $type = strtoupper(trim($type)); + if($w == 0) $w = 216/$this->k; + if($h == 0) $h = 144/$this->k; + $bw = $w*$this->k; + $bh = $h*$this->k; + + if($barcode == "") + $this->Error('Invalid Barcode Text.'); + if($bw < 10 || $bw > 4096 || $bh < 10 || $bh > 4096) + $this->Error('Invalid Barcode Size: ' . $w . "x" . $h); + if($bw*$sx < 10 || $bw*$sx > 4096 || $bh*$sy < 10 || $bh*$sy > 4096) + $this->Error('Invalid Barcode Scaling: ' . $sx . "x" . $sy); + + // If Bar Code hasn't been generated yet, generate it + if(!isset($this->barcodeData[$barcode])) + { + if($format == "PNG") + { + $data = generateBarCodePNG($barcode, $type, $bw, $bh, BCD_DEFAULT_STYLE, $xres, $font, false); + $this->barcodeData[$barcode] = $this->_parsepngfromstring($data); + } + else + { + $data = generateBarCodeJPEG($barcode, $type, $bw, $bh, BCD_DEFAULT_STYLE, $xres, $font, false); + $this->barcodeData[$barcode] = array('w'=>$bw,'h'=>$bh,'cs'=>'DeviceRGB','bpc'=>8,'f'=>'DCTDecode','data'=>$data); + } + } + + // If Bar Code generated, show it + if(isset($this->barcodeData[$barcode])) + { + $this->Image($barcode, $x, $y, $w*$sx, $h*$sy, "barcode", $link); + } + else + $this->Error('Error creating Bar Code Image: ' . $barcode); + } + + function _parsebarcode($barcode) + { + if(!isset($this->barcodeData[$barcode])) + $this->Error('Error reading Bar Code Image: ' . $barcode); + return $this->barcodeData[$barcode]; + } + + function _parseread($ln) + { + $st = substr($this->freaddata, $this->freadcursor, $ln); + $this->freadcursor += $ln; + return $st; + } + + function _parsepngfromstring($f) + { + $this->freaddata = $f; + $this->freadcursor = 0; + + //Check signature + if($this->_parseread(8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + $this->_parseread(4); + if($this->_parseread(4)!='IHDR') + $this->Error('Incorrect PNG info.'); + $w=$this->_parsereadint(); + $h=$this->_parsereadint(); + $bpc=ord($this->_parseread(1)); + if($bpc>8) + $this->Error('16-bit depth not supported.'); + $ct=ord($this->_parseread(1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else + $this->Error('Alpha channel not supported.'); + if(ord($this->_parseread(1))!=0) + $this->Error('Unknown compression method.'); + if(ord($this->_parseread(1))!=0) + $this->Error('Unknown filter method.'); + if(ord($this->_parseread(1))!=0) + $this->Error('Interlacing not supported.'); + $this->_parseread(4); + $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_parsereadint(); + $type=$this->_parseread(4); + if($type=='PLTE') + { + //Read palette + $pal=$this->_parseread($n); + $this->_parseread(4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=$this->_parseread($n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if($pos!==false) + $trns=array($pos); + } + $this->_parseread(4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=$this->_parseread($n); + $this->_parseread(4); + } + elseif($type=='IEND') + break; + else + $this->_parseread($n+4); + } + while($n); + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data); + } + + function _parsereadint() + { + //Read a 4-byte integer from file + $a=unpack('Ni',$this->_parseread(4)); + return $a['i']; + } + + function closeParsers() + { + if($this->parsers) + foreach($this->parsers as $parser) + $parser->closeFile(); + } + } + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/pdftotext/pdftotext.exe b/maarch_entreprise/trunk/tools/pdftotext/pdftotext.exe new file mode 100644 index 0000000000000000000000000000000000000000..8b84feb9cb1d1edb9b407337f03f389abb93266f Binary files /dev/null and b/maarch_entreprise/trunk/tools/pdftotext/pdftotext.exe differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/.cvsignore b/maarch_entreprise/trunk/tools/tafelTree/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..dbdc74905c3b3f618416d1eb6f4b4f9649a3aa7c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/.cvsignore @@ -0,0 +1,3 @@ +_notes +test2.html +Tree2.js \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/CHANGELOG.txt b/maarch_entreprise/trunk/tools/tafelTree/CHANGELOG.txt new file mode 100644 index 0000000000000000000000000000000000000000..34f9b494fedb2c913e19a3eb9e5ebfba52928eb1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/CHANGELOG.txt @@ -0,0 +1,102 @@ +2007.07.23 +- added "select" : true/false for branch + +2007.01.15 : +- branch function switchWith and replace +- tree function switchWith and replace +- disabling checkbox on certain branches +- branch function insert (alias of insertIntoLast) +- branch function moveAfter, moveIntoFirst and moveIntoLast +- tree.getBranchById() optimized +- changes on clone() function +- debug setIconsSelected() + +2007.01.03 : +- Changement d'icône à la sélection de la branche +- Retour de la branche copiée après un drag&drop +- Fonction enableCopyDrag() + +2006.12.04 : +- Gestion de droite à gauche (RTL mode) +- Ajout des images pour le RTL mode +- Fonction disableDropALT() + +2006.11.13 : +- Le nom des fonctions peuvent être entre guillemets +- Gestion coté serveur PHP4 +- Gestion coté serveur PHP5 + +2006.11.03 : +- Correction bug ScriptFragment pour les UL/LI +- Amélioration du F2 +- TafelTreeManager : keyboardStructuralEvents +- Ajout effectif de la touche POMME pour les couper-copier-coller + +2006.10.21 : +- Touches Home et End +- Correction bugs +- getNext(Previous)Branch +- correction unselect sous IE + +2006.10.08 : +- Tous les événements et fonctions sur les roots (sauf drag) +- Création du TafelTreeManager +- Optimisation de la gestion clavier +- Ajout de onErrorAjax() +- Changement de comportement du ondrop +- Optimisation du code + +2006.10.02 : +- Correction du removeDragDrop (plantage IE) +- Typeof dans setOptions() + +2006.09.19 +- gestion des images par défaut +- Fonctionnalité : drag&drop "as sibling" +- Fonctionnalité : moveBefore +- paramètre "options" dans le constructeur +- lors d'un drop sur une branche onopenpopulate, la population se fait, puis le drop ensuite + +2006.09.10 +- la sérialisation retourne les parametres persos +- le toString retourne les paramètres persos + +2006.09.08 +- Fonctionnalité : changeId +- gestion de la multisélection +- attention : getSelectedBranches remplace getSelectedBranch + +2006.09.07 +- Fonctionnalité : getLevel +- Fonctionnalité : removeChildren + +2006.09.06 +- les multilines sont gérées par javascript +- correction de bug oneditajax + +2006.09.04 +- Evénement : oneditajax +- Fonctionnalité : title +- correction de bug cookies +- ouverture des branches qui proviennent du serveur + +2006.09.01 +- Fonctionnalité : tooltip +- Fonctionnalité : getters et setters pour les branches +- correction bug root + +2006.08.31 +- Fonctionnalité : serialize + +2006.08.29 +- Fonctionnalité : canhavechildren +- Evénement : setOnOpenPopulate +- Evénement : onopenpopulate + +2006.08.26 +- Fonctionnalité : last +- Toncheck et Tonbeforecheck disponibles pour les <ul><li> + +2006.08.19 +- version Beta +- Mise en service diff --git a/maarch_entreprise/trunk/tools/tafelTree/Tree-optimized.js b/maarch_entreprise/trunk/tools/tafelTree/Tree-optimized.js new file mode 100644 index 0000000000000000000000000000000000000000..9878a1acaaeba01f3c6eb3d2c6e2e893b1822e9c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/Tree-optimized.js @@ -0,0 +1,3641 @@ + +var TAFELTREE_WRONG_BRANCH_STRUCTURE="La structure de la branche n'est pas correcte. Il faut au moins un id et un texte"; +var TAFELTREE_NO_BODY_TAG="Il n'y a pas de balise BODY!"; +var TAFELTREE_DEBUG=false; +var TafelTree=Class.create(); +TafelTree.version='1.9.1'; +TafelTree.lastUpdate='2007-07-21'; +TafelTree.scriptFragment=/[\s]*<[/]?[ul|li].*>.*/ig; +TafelTree.debugReturn='<br />'; +TafelTree.debugTab=' '; +TafelTree.prefixAttribute='T'; +TafelTree.textAttributes=[ +TafelTree.prefixAttribute+'img', +TafelTree.prefixAttribute+'imgopen', +TafelTree.prefixAttribute+'imgclose', +TafelTree.prefixAttribute+'imgselect', +TafelTree.prefixAttribute+'imgselectopen', +TafelTree.prefixAttribute+'imgselectclose', +TafelTree.prefixAttribute+'style', +TafelTree.prefixAttribute+'droplink', +TafelTree.prefixAttribute+'openlink', +TafelTree.prefixAttribute+'editlink', +TafelTree.prefixAttribute+'tooltip', +TafelTree.prefixAttribute+'title' +]; +TafelTree.numericAttributes=[ +TafelTree.prefixAttribute+'canhavechildren', +TafelTree.prefixAttribute+'acceptdrop', +TafelTree.prefixAttribute+'draggable', +TafelTree.prefixAttribute+'editable', +TafelTree.prefixAttribute+'open', +TafelTree.prefixAttribute+'check', +TafelTree.prefixAttribute+'checkbox', +TafelTree.prefixAttribute+'select', +TafelTree.prefixAttribute+'last' +]; +TafelTree.functionAttributes=[ +TafelTree.prefixAttribute+'onbeforecheck', +TafelTree.prefixAttribute+'oncheck', +TafelTree.prefixAttribute+'onclick', +TafelTree.prefixAttribute+'ondblclick', +TafelTree.prefixAttribute+'onbeforeopen', +TafelTree.prefixAttribute+'onopen', +TafelTree.prefixAttribute+'onedit', +TafelTree.prefixAttribute+'oneditajax', +TafelTree.prefixAttribute+'onmouseover', +TafelTree.prefixAttribute+'onmouseout', +TafelTree.prefixAttribute+'onmousedown', +TafelTree.prefixAttribute+'onmouseup', +TafelTree.prefixAttribute+'ondrop', +TafelTree.prefixAttribute+'ondragstarteffect', +TafelTree.prefixAttribute+'ondragendeffect', +TafelTree.prefixAttribute+'onerrorajax', +TafelTree.prefixAttribute+'ondropajax', +TafelTree.prefixAttribute+'onopenpopulate' +]; +TafelTree.loadFromUL=function(id,imgBase,width,height,options,debug){ +if(typeof(imgBase)== 'object'){ +options=imgBase; +debug=width; +imgBase =(options.imgBase)? options.imgBase:'imgs/'; +width =(options.width)? options.width:'100%'; +height =(options.height)? options.height:'auto'; +} +var obj=$(id); +var load=document.createElement('img'); +load.setAttribute('title','load'); +load.setAttribute('alt','load'); +load.src =((imgBase)? imgBase:'imgs/')+ 'load.gif'; +obj.parentNode.insertBefore(load,obj); +Element.hide(obj); +var tab=''; +var tabModel =(debug)? TafelTree.debugTab:''; +var rt =(debug)? TafelTree.debugReturn:''; +var virgule=''; +var str =(debug)? 'var struct=[':'(['; +for(var i=0;i<obj.childNodes.length;i++){ +if(obj.childNodes[i].nodeName.toLowerCase()== 'li'){ +str += this._loadFromUL(obj.childNodes[i],virgule,rt,tab,tabModel); +virgule=','; +} +} +str += rt +((debug)? '];':'])'); +var div=document.createElement('div'); +div.id=obj.id; +obj.id += '____todelete'; +obj.parentNode.insertBefore(div,obj); +if(!debug){ +var m=TafelTree.prefixAttribute; +var struct=eval(str); +var _tree=new TafelTree(id,struct,options); +} else{ +div.innerHTML=str.replace(/</img,'<'); +var _tree=str; +} +obj.parentNode.removeChild(load); +obj.parentNode.removeChild(obj); +return _tree; +}; +TafelTree._loadFromUL=function(obj,virgule,rt,tab,tabModel){ +tab += tabModel; +var contenu=TafelTree.trim(obj.innerHTML.replace(TafelTree.scriptFragment,'')); +var str=virgule+rt+tab+'{'+rt; +str += tab+"'id':'"+obj.id+"'"; +if(contenu){ +str += ","+rt+tab+"'txt':'"+contenu+"'"; +} +TafelTree.textAttributes.each(function(attr){ +if(obj.getAttribute(attr))str += ","+rt+tab+"'"+attr.replace(TafelTree.prefixAttribute,'')+ "':'"+obj.getAttribute(attr)+ "'"; +}); +TafelTree.numericAttributes.each(function(attr){ +if(obj.getAttribute(attr))str += ","+rt+tab+"'"+attr.replace(TafelTree.prefixAttribute,'')+ "':"+obj.getAttribute(attr); +}); +TafelTree.functionAttributes.each(function(attr){ +if(obj.getAttribute(attr))str += ","+rt+tab+"'"+attr.replace(TafelTree.prefixAttribute,'')+ "':"+obj.getAttribute(attr); +}); +for(var i=0;i<obj.childNodes.length;i++){ +if(obj.childNodes[i].nodeName.toLowerCase()== 'ul'){ +virgule=''; +str += ','+rt+tab+"'items':["; +for(var j=0;j<obj.childNodes[i].childNodes.length;j++){ +if(obj.childNodes[i].childNodes[j].nodeName.toLowerCase()== 'li'){ +str += this._loadFromUL(obj.childNodes[i].childNodes[j],virgule,rt,tab,tabModel); +virgule=','; +} +} +str += rt+tab+']'; +} +} +str += rt+tab+'}'; +return str; +}; +TafelTree.trim=function(string){ +return string.replace(/(^\s*)|(\s*$)|\n|\r|\t/g,''); +}; +TafelTree.prototype ={ +initialize:function(id,struct,imgBase,width,height,options){ +if(typeof(imgBase)== 'object'){ +options=imgBase; +imgBase =(options.imgBase)? options.imgBase:'imgs/'; +width =(options.width)? options.width:'100%'; +height =(options.height)? options.height:'auto'; +} +this.imgBase =(imgBase)? imgBase:'imgs/'; +this.setLineStyle('line'); +this.options =(options)? options :{}; +this.copyName='(%n)'; +this.copyNameBreak='_'; +this.classTree='tafelTree'; +this.classTreeRoot=this.classTree+'_root'; +this.classTreeBranch=this.classTree+'_row'; +this.classCopy =(this.options.copyCSS)? this.options.copyCSS:null; +this.classCut =(this.options.cutCSS)? this.options.cutCSS:null; +this.classDrag='tafelTreedrag'; +this.classSelected='tafelTreeselected'; +this.classEditable='tafelTreeeditable'; +this.classContent='tafelTreecontent'; +this.classCanevas='tafelTreecanevas'; +this.classDragOver='tafelTreedragOver'; +this.classTooltip='tafelTreetooltip'; +this.classOpenable='tafelTreeopenable'; +this.defaultStruct=[]; +this.idTree=0; +this.behaviourDrop=0; +this.durationTooltipShow=1000; +this.durationTooltipHide=100; +this.baseStruct=struct; +this.width =(width)? width:'100%'; +this.height =(height)? height:'auto'; +this.div=$(id); +this.div.style.width=this.width; +this.div.style.height=this.height; +this.id=this.div.id; +this.isTree=true; +this.dropALT=true; +this.openAll=false; +this.rtlMode=false; +this.dropCTRL=true; +this.multiline=false; +this.checkboxes=false; +this.propagation=true; +this.dragRevert=true; +this.dragGhosting=true; +this.bigTreeLoading=-1; +this.dropAsSibling=true; +this.onlyOneOpened=false; +this.openedAfterAdd=true; +this.editableBranches=true; +this.reopenFromServer=true; +this.selectedBranchShowed=true, +this.checkboxesThreeState=false; +this.roots=[]; +this.icons=[null,null,null]; +this.iconsSelected=[null,null,null]; +this.otherTrees=[]; +this.cuttedBranches=[]; +this.copiedBranches=[]; +this.checkedBranches=[]; +this.selectedBranches=[]; +this.idTreeBranch=this.classTree+'_'+this.id+'_id_'; +this.loaded=false; +Element.addClassName(this.div,this.classTree); +this.useCookie=true; +this.cookieSeparator='|'; +this.cookieCheckSeparator='[check]'; +this.cookieOpened=null; +this.cookieChecked=null; +this.setOptions(this.options); +var fromCookie=this.getCookie(this.classTree+this.id); +if(fromCookie){ +var branches=fromCookie.split(this.cookieCheckSeparator); +this.cookieOpened=[]; +this.cookieOpened=branches[0].split(this.cookieSeparator); +this.cookieOpened.shift(); +this.cookieChecked=[]; +if(branches.length>1){ +this.cookieChecked=branches[1].split(this.cookieSeparator); +} +} +this.debugObj=document.createElement('div'); +this.debugObj.setAttribute('id',this.classTree+'_debug'); +Element.hide(this.debugObj); +this.div.appendChild(this.debugObj); +this.ajaxObj=document.createElement('div'); +this.ajaxObj.setAttribute('id',this.classTree+'_ajax'); +Element.hide(this.ajaxObj); +this.div.appendChild(this.ajaxObj); +Event.observe(this.div,'mousedown',this.evt_setAsCurrent.bindAsEventListener(this),false); +Event.observe(this.div,'focus',this.evt_setAsCurrent.bindAsEventListener(this),false); +if(!this.serverCookie){ +if(this.options.generate){ +this.generate(); +} +if(this.options.generateBigTree){ +this.generate(true); +} +} +TafelTreeManager.add(this); +}, +evt_setAsCurrent:function(ev){ +var obj=Event.element(ev); +TafelTreeManager.setCurrentTree(this); +}, +orderListBranches:function(list){ +var ordered=[]; +var level=[]; +var nivmin=100; +var nivmax=0; +var niv=0; +for(var i=0;i<list.length;i++){ +niv=list[i].getLevel(); +if(typeof(level[niv])== 'undefined'){ +level[niv]=[]; +} +level[niv].push(list[i]); +if(niv>nivmax)nivmax=niv; +if(niv<nivmin)nivmin=niv; +} +for(var i=nivmin;i<=nivmax;i++){ +if(level[i]){ +ordered.push(level[i]); +} +} +return ordered; +}, +getCopiedBranches:function(){ +var branches=this.copiedBranches; +if(branches.length==0){ +for(var i=0;i<this.otherTrees.length;i++){ +branches=this.otherTrees[i].copiedBranches; +if(branches.length>0)break; +} +} +return branches; +}, +getCuttedBranches:function(){ +var branches=this.cuttedBranches; +if(branches.length==0){ +for(var i=0;i<this.otherTrees.length;i++){ +branches=this.otherTrees[i].cuttedBranches; +if(branches.length>0)break; +} +} +return branches; +}, +cut:function(){ +this.unsetCut(); +this.unsetCopy(); +var level=this.orderListBranches(this.selectedBranches); +var sel=null; +for(var i=0;i<level.length;i++){ +for(var j=0;j<level[i].length;j++){ +sel=level[i][j]; +this._cut(sel); +this.cuttedBranches.push(sel); +} +} +return true; +}, +copy:function(){ +this.unsetCut(); +this.unsetCopy(); +var level=this.orderListBranches(this.selectedBranches); +var sel=null; +for(var i=0;i<this.selectedBranches.length;i++){ +sel=this.selectedBranches[i]; +this._copy(sel); +this.copiedBranches[i]=sel; +} +return true; +}, +paste:function(){ +if(this.selectedBranches.length!=1)return false; +var branch=this.selectedBranches[0]; +var copied=this.getCopiedBranches(); +var cutted=this.getCuttedBranches(); +var nbCopy=copied.length; +var nbCut=cutted.length; +if(nbCopy>0){ +var list=copied; +var b=null; +for(var i=0;i<list.length;i++){ +if(this._okForPaste(branch,list,i)){ +b=branch.insertIntoLast(list[i].clone()); +} +} +} +if(nbCut>0){ +var list=cutted; +for(var i=0;i<list.length;i++){ +if(this._okForPaste(branch,list,i)){ +list[i].move(branch); +} +} +} +this.unsetCut(); +return true; +}, +_okForPaste:function(branch,list,i){ +var ok=true; +if(!branch.isChild(list[i])){ +for(var j=0;j<i;j++){ +if(list[i].isChild(list[j])){ +ok=false; +break; +} +} +} else{ +ok=false; +} +return ok; +}, +unsetCut:function(){ +var _tree=null; +var branches=null; +for(var i=0;i<this.otherTrees.length;i++){ +_tree=this.otherTrees[i]; +branches=_tree.cuttedBranches; +for(var t=0;t<branches.length;t++){ +_tree._unsetCut(branches[t]); +} +_tree.cuttedBranches=[]; +} +var cut=null; +for(var i=0;i<this.cuttedBranches.length;i++){ +cut=this.cuttedBranches[i]; +this._unsetCut(cut); +} +this.cuttedBranches=[]; +}, +unsetCopy:function(){ +var _tree=null; +var branches=null; +for(var i=0;i<this.otherTrees.length;i++){ +_tree=this.otherTrees[i]; +branches=_tree.copiedBranches; +for(var t=0;t<branches.length;t++){ +_tree._unsetCopy(branches[t]); +} +_tree.copiedBranches=[]; +} +var copy=null; +for(var i=0;i<this.copiedBranches.length;i++){ +copy=this.copiedBranches[i]; +this._unsetCopy(copy); +} +this.copiedBranches=[]; +}, +undo:function(){ +}, +_cut:function(branch){ +if(!this.classCut){ +new Effect.Opacity(branch.txt,{ +duration: 0.1, +transition: Effect.Transitions.linear, +from: 1.0,to: 0.4 +}); +new Effect.Opacity(branch.img,{ +duration: 0.1, +transition: Effect.Transitions.linear, +from: 1.0,to: 0.4 +}); +} else{ +Element.addClassName(branch.txt,this.classCut); +Element.addClassName(branch.img,this.classCut); +} +if(branch.hasChildren()){ +for(var i=0;i<branch.children.length;i++){ +this._cut(branch.children[i]); +} +} +}, +_unsetCut:function(branch){ +if(!this.classCut){ +new Effect.Opacity(branch.txt,{ +duration: 0.1, +transition: Effect.Transitions.linear, +from: 0.4,to: 1.0 +}); +new Effect.Opacity(branch.img,{ +duration: 0.1, +transition: Effect.Transitions.linear, +from: 0.4,to: 1.0 +}); +} else{ +Element.removeClassName(branch.txt,this.classCut); +Element.removeClassName(branch.img,this.classCut); +} +if(branch.hasChildren()){ +for(var i=0;i<branch.children.length;i++){ +this._unsetCut(branch.children[i]); +} +} +}, +_copy:function(branch){ +if(this.classCopy){ +Element.addClassName(branch.txt,this.classCopy); +Element.addClassName(branch.img,this.classCopy); +} +if(branch.hasChildren()){ +for(var i=0;i<branch.children.length;i++){ +this._copy(branch.children[i]); +} +} +}, +_unsetCopy:function(branch){ +if(this.classCopy){ +Element.removeClassName(branch.txt,this.classCopy); +Element.removeClassName(branch.img,this.classCopy); +} +if(branch.hasChildren()){ +for(var i=0;i<branch.children.length;i++){ +this._unsetCopy(branch.children[i]); +} +} +}, +enableMultiline:function(multiline){ +this.multiline =(multiline)? true:false; +}, +enableRTL:function(rtl){ +this.rtlMode =(rtl)? true:false; +if(this.rtlMode){ +this.div.style.textAlign='right'; +this.div.style.direction='rtl'; +} else{ +this.div.style.textAlign='left'; +this.div.style.direction='ltr'; +} +this.setLineStyle(this.lineStyle); +}, +isRTL:function(){ +return this.rtlMode; +}, +disableDropALT:function(alt){ +this.dropALT =(alt)? true:false; +}, +disableDropCTRL:function(copy){ +this.dropCTRL =(copy)? true:false; +}, +enableCheckboxes:function(enable){ +this.checkboxes =(enable)? true:false; +}, +enableCheckboxesThreeState:function(enable){ +this.enableCheckboxes(enable); +this.checkboxesThreeState =(enable)? true:false; +}, +enableCookies:function(enable,separator){ +this.useCookie =(enable)? true:false; +if(typeof(separator)!= 'undefined'){ +this.cookieSeparator=separator; +} +}, +openOneAtOnce:function(yes){ +this.onlyOneOpened =(yes)? true:false; +}, +openAfterAdd:function(yes){ +this.openedAfterAdd =(yes)? true:false; +}, +reopenFromServerAfterLoad:function(yes){ +this.reopenFromServer =(yes)? true:false; +}, +openAtLoad:function(open){ +this.openAll =(open)? true:false; +}, +showSelectedBranch:function(show){ +this.selectedBranchShowed =(show)? true:false; +}, +setBehaviourDrop:function(def){ +switch(def){ +case 'sibling':this.behaviourDrop=1;break; +case 'childcopy':this.behaviourDrop=2;break; +case 'siblingcopy':this.behaviourDrop=3;break; +case 'child' : +default : +this.behaviourDrop=0; +} +}, +setIcons:function(img,imgopen,imgclose){ +this.icons[0]=img; +this.icons[1] =(imgopen)? imgopen:img; +this.icons[2] =(imgclose)? imgclose:img; +}, +setIconsSelected:function(img,imgopen,imgclose){ +this.iconsSelected[0]=img; +this.iconsSelected[1] =(imgopen)? imgopen:null; +this.iconsSelected[2] =(imgclose)? imgclose:null; +}, +setLineStyle:function(style){ +this.lineStyle=style; +switch(style){ +case 'none' : +this.imgLine0='empty.gif';this.imgLine1='empty.gif';this.imgLine2='empty.gif'; +this.imgLine3='empty.gif';this.imgLine4='empty.gif';this.imgLine5='empty.gif'; +this.imgWait='wait.gif';this.imgEmpty='empty.gif'; +this.imgMinus1='minus0.gif';this.imgMinus2='minus0.gif';this.imgMinus3='minus0.gif'; +this.imgMinus4='minus0.gif';this.imgMinus5='minus0.gif'; +this.imgPlus1='plus0.gif';this.imgPlus2='plus0.gif';this.imgPlus3='plus0.gif'; +this.imgPlus4='plus0.gif';this.imgPlus5='plus0.gif'; +this.imgCheck1='check1.gif';this.imgCheck2='check2.gif';this.imgCheck3='check3.gif'; +this.imgMulti1='empty.gif';this.imgMulti2='empty.gif'; +this.imgMulti3='';this.imgMulti4=''; +break; +case 'full' : +if(this.isRTL()){ +this.imgLine0='rtl_linefull0.gif';this.imgLine1='rtl_linefull1.gif';this.imgLine2='rtl_linefull2.gif'; +this.imgLine3='rtl_linefull3.gif';this.imgLine4='rtl_linefull4.gif';this.imgLine5='rtl_linefull5.gif'; +this.imgWait='wait.gif';this.imgEmpty='empty.gif'; +this.imgMinus1='rtl_minusfull1.gif';this.imgMinus2='rtl_minusfull2.gif';this.imgMinus3='rtl_minusfull3.gif'; +this.imgMinus4='rtl_minusfull4.gif';this.imgMinus5='rtl_minusfull5.gif'; +this.imgPlus1='rtl_plusfull1.gif';this.imgPlus2='rtl_plusfull2.gif';this.imgPlus3='rtl_plusfull3.gif'; +this.imgPlus4='rtl_plusfull4.gif';this.imgPlus5='rtl_plusfull5.gif'; +this.imgCheck1='check1.gif';this.imgCheck2='check2.gif';this.imgCheck3='check3.gif'; +this.imgMulti1='rtl_linebgfull.gif';this.imgMulti2='rtl_linebgfull2.gif'; +this.imgMulti3='multiline';this.imgMulti4='multiline2'; +} else{ +this.imgLine0='linefull0.gif';this.imgLine1='linefull1.gif';this.imgLine2='linefull2.gif'; +this.imgLine3='linefull3.gif';this.imgLine4='linefull4.gif';this.imgLine5='linefull5.gif'; +this.imgWait='wait.gif';this.imgEmpty='empty.gif'; +this.imgMinus1='minusfull1.gif';this.imgMinus2='minusfull2.gif';this.imgMinus3='minusfull3.gif'; +this.imgMinus4='minusfull4.gif';this.imgMinus5='minusfull5.gif'; +this.imgPlus1='plusfull1.gif';this.imgPlus2='plusfull2.gif';this.imgPlus3='plusfull3.gif'; +this.imgPlus4='plusfull4.gif';this.imgPlus5='plusfull5.gif'; +this.imgCheck1='check1.gif';this.imgCheck2='check2.gif';this.imgCheck3='check3.gif'; +this.imgMulti1='linebgfull.gif';this.imgMulti2='linebgfull2.gif'; +this.imgMulti3='multiline';this.imgMulti4='multiline2'; +} +break; +case 'line' : +default : +if(this.isRTL()){ +this.imgLine0='rtl_line0.gif';this.imgLine1='rtl_line1.gif';this.imgLine2='rtl_line2.gif'; +this.imgLine3='rtl_line3.gif';this.imgLine4='rtl_line4.gif';this.imgLine5='rtl_line5.gif'; +this.imgWait='wait.gif';this.imgEmpty='empty.gif'; +this.imgMinus1='rtl_minus1.gif';this.imgMinus2='rtl_minus2.gif';this.imgMinus3='rtl_minus3.gif'; +this.imgMinus4='rtl_minus4.gif';this.imgMinus5='rtl_minus5.gif'; +this.imgPlus1='rtl_plus1.gif';this.imgPlus2='rtl_plus2.gif';this.imgPlus3='rtl_plus3.gif'; +this.imgPlus4='rtl_plus4.gif';this.imgPlus5='rtl_plus5.gif'; +this.imgCheck1='check1.gif';this.imgCheck2='check2.gif';this.imgCheck3='check3.gif'; +this.imgMulti1='rtl_linebg.gif';this.imgMulti2='rtl_linebg2.gif'; +this.imgMulti3='multiline';this.imgMulti4='multiline2'; +} else{ +this.imgLine0='line0.gif';this.imgLine1='line1.gif';this.imgLine2='line2.gif'; +this.imgLine3='line3.gif';this.imgLine4='line4.gif';this.imgLine5='line5.gif'; +this.imgWait='wait.gif';this.imgEmpty='empty.gif'; +this.imgMinus1='minus1.gif';this.imgMinus2='minus2.gif';this.imgMinus3='minus3.gif'; +this.imgMinus4='minus4.gif';this.imgMinus5='minus5.gif'; +this.imgPlus1='plus1.gif';this.imgPlus2='plus2.gif';this.imgPlus3='plus3.gif'; +this.imgPlus4='plus4.gif';this.imgPlus5='plus5.gif'; +this.imgCheck1='check1.gif';this.imgCheck2='check2.gif';this.imgCheck3='check3.gif'; +this.imgMulti1='linebg.gif';this.imgMulti2='linebg2.gif'; +this.imgMulti3='multiline';this.imgMulti4='multiline2'; +} +} +}, +setTooltipDuration:function(show,hide){ +this.durationTooltipShow=show; +this.durationTooltipHide=hide; +}, +propagateRestriction:function(propagate){ +this.propagation =(typeof(propagate)== 'undefined')? true:propagate; +}, +getSelectedBranches:function(){ +return this.selectedBranches; +}, +setContextMenu:function(menu){ +var div=document.createElement('div'); +div.innerHTML=menu; +this.div.appendChild(div); +}, +generate:function(bigTree){ +if(!bigTree){ +var isNotFirst=false; +var isNotLast=false; +for(var i=0;i<this.baseStruct.length;i++){ +isNotFirst =(i>0)? true:false; +isNotLast =(i<this.baseStruct.length-1)? true:false; +this.roots[i]=new TafelTreeRoot(this,this.baseStruct[i],0,isNotFirst,isNotLast,i); +this.div.appendChild(this.roots[i].obj); +} +this.loadComplete(); +} else{ +this.bigTreeLoading=0; +setTimeout(this._checkLoad.bind(this),100); +setTimeout(this._generateBigTree.bind(this),10); +} +}, +setOptions:function(options){ +if(options.onLoad)this.setOnLoad(options.onLoad); +if(options.onDebug)this.setOnDebug(options.onDebug); +if(options.onCheck)this.setOnCheck(options.onCheck); +if(options.onBeforeCheck)this.setOnBeforeCheck(options.onBeforeCheck); +if(options.onClick)this.setOnClick(options.onClick); +if(options.onMouseDown)this.setOnMouseDown(options.onMouseDown); +if(options.onMouseUp)this.setOnMouseUp(options.onMouseUp); +if(options.onDblClick)this.setOnDblClick(options.onDblClick); +if(options.onBeforeOpen)this.setOnBeforeOpen(options.onBeforeOpen); +if(options.onOpen)this.setOnOpen(options.onOpen); +if(options.onMouseOver)this.setOnMouseOver(options.onMouseOver); +if(options.onMouseOut)this.setOnMouseOut(options.onMouseOut); +if(options.onDrop)this.setOnDrop(options.onDrop); +if(options.onDragStartEffect)this.setOnDragStartEffect(options.onDragStartEffect); +if(options.onDragEndEffect)this.setOnDragEndEffect(options.onDragEndEffect); +if(options.onErrorAjax)this.setOnDropAfter(options.onErrorAjax); +if(options.onEdit)this.setOnEdit(options.onEdit); +if(options.onEditAjax)this.setOnEditAjax(options.onEditAjax[0],options.onEditAjax[1]); +if(options.onDropAjax)this.setOnDropAjax(options.onDropAjax[0],options.onDropAjax[1]); +if(options.onOpenPopulate)this.setOnOpenPopulate(options.onOpenPopulate[0],options.onOpenPopulate[1]); +if(typeof(options.rtlMode)!= 'undefined')this.enableRTL(options.rtlMode); +if(typeof(options.dropALT)!= 'undefined')this.disableDropALT(options.dropALT); +if(typeof(options.dropCTRL)!= 'undefined')this.disableDropCTRL(options.dropCTRL); +if(typeof(options.multiline)!= 'undefined')this.enableMultiline(options.multiline); +if(typeof(options.checkboxes)!= 'undefined')this.enableCheckboxes(options.checkboxes); +if(typeof(options.checkboxesThreeState)!= 'undefined')this.enableCheckboxesThreeState(options.checkboxesThreeState); +if(typeof(options.cookies)!= 'undefined')this.enableCookies(options.cookies); +if(typeof(options.openOneAtOnce)!= 'undefined')this.openOneAtOnce(options.openOneAtOnce); +if(typeof(options.openAtLoad)!= 'undefined')this.openAtLoad(options.openAtLoad); +if(typeof(options.openAfterAdd)!= 'undefined')this.openAfterAdd(options.openAfterAdd); +if(typeof(options.showSelectedBranch)!= 'undefined')this.showSelectedBranch(options.showSelectedBranch); +if(typeof(options.reopenFromServer)!= 'undefined')this.reopenFromServerAfterLoad(options.reopenFromServer); +if(typeof(options.propagateRestriction)!= 'undefined')this.propagateRestriction(options.propagateRestriction); +if(options.lineStyle)this.setLineStyle(options.lineStyle); +if(options.behaviourDrop)this.setBehaviourDrop(options.behaviourDrop); +if(options.contextMenu)this.setContextMenu(options.contextMenu); +if(options.bind){ +for(var i=0;i<options.bind.length;i++){ +this.bind(options.bind[i]); +} +} +if(options.bindAsUnidirectional){ +for(var i=0;i<options.bindAsUnidirectional.length;i++){ +this.bind(options.bindAsUnidirectional[i]); +} +} +if(options.defaultImg){ +var imgopen =(options.defaultImgOpen)? options.defaultImgOpen:options.defaultImg; +var imgclose =(options.defaultImgClose)? options.defaultImgClose:options.defaultImg; +this.setIcons(options.defaultImg,imgopen,imgclose); +} +if(options.defaultImgSelected||options.defaultImgOpenSelected||options.defaultImgCloseSelected){ +var img =(options.defaultImgSelected)? options.defaultImgSelected:null; +var imgopen =(options.defaultImgOpenSelected)? options.defaultImgOpenSelected:null; +var imgclose =(options.defaultImgCloseSelected)? options.defaultImgCloseSelected :null; +this.setIconsSelected(img,imgopen,imgclose); +} +this.serverCookie =(options.serverCookie)? options.serverCookie:false; +}, +loadComplete:function(){ +this._adjustOpening(); +this._adjustCheck(); +this.setCookie(this.classTree+this.id); +this.loaded=true; +if(typeof(this.onLoad)== 'function'){ +this.onLoad(); +} +}, +loadRunning:function(loaded){ +if(typeof(this.onLoading)== 'function'){ +this.onLoading(loaded); +} +}, +replace:function(modelBranch,replacedBranch,copy){ +var branch1=this.getBranchById(modelBranch); +if(!branch1)return false; +return branch1.replace(replacedBranch,copy); +}, +switchBranches:function(branch1,branch2){ +var branch1=this.getBranchById(branch1); +if(!branch1)return false; +branch1.switchWith(branch2); +}, +restoreDefault:function(type){ +var s=this.defaultStruct; +this._restaureDefault(s,type); +}, +_restaureDefault:function(s,type){ +var b=null; +var open=false; +var check=0; +for(var i=0;i<s.length;i++){ +b=this.getBranchById(s[i].id); +if(b){ +open =(s[i].open)? true:this.openAll; +check =(s[i].check==1)? 1:0; +switch(type){ +case 'open' : +if(b.hasChildren()){ +b.openIt(open); +} +break; +case 'check' : +b.check(check); +b._adjustParentCheck(); +break; +case 'all' : +default : +if(b.hasChildren()){ +b.openIt(open); +} +b.check(check); +b._adjustParentCheck(); +} +if(typeof(s[i].items)!= 'undefined'){ +this._restaureDefault(s[i].items,type); +} +} +} +}, +bind:function(){ +var trees=this.bind.arguments; +for(var i=0;i<trees.length;i++){ +if(!this.isBindedWith(trees[i])){ +this.otherTrees.push(trees[i]); +if(!trees[i].isBindedWith(this)){ +trees[i].bind(this); +} +} +} +}, +bindAsUnidirectional:function(){ +var trees=this.bindAsUnidirectional.arguments; +for(var i=0;i<trees.length;i++){ +if(!this.isBindedWith(trees[i])){ +this.otherTrees.push(trees[i]); +} +} +}, +isBindedWith:function(_tree){ +var binded=false; +for(var i=0;i<this.otherTrees.length;i++){ +if(this.otherTrees[i].id==_tree.id){ +binded=true; +break; +} +} +return binded; +}, +unselect:function(){ +var branch=null; +for(var i=0;i<this.selectedBranches.length;i++){ +branch=this.selectedBranches[i]; +Element.removeClassName(branch.txt,this.classSelected); +if(branch.getIconSelected()|| branch.getOpenIconSelected()|| branch.getCloseIconSelected()){ +if(branch.hasChildren()){ +branch.img.src =(branch.isOpened())? branch.tree.imgBase+branch.struct.imgopen:branch.tree.imgBase+branch.struct.imgclose; +} else{ +branch.img.src=branch.tree.imgBase+branch.struct.img; +} +} +} +this.selectedBranches=[]; +}, +getBranchesBetween:function(branch1,branch2){ +var branch1=this.getBranchById(branch1); +var branch2=this.getBranchById(branch2); +if(!branch1||!branch2)return false; +if(branch1.tree.id!=branch2.tree.id)return false; +var found=false; +var selected=[]; +var pos1=branch1.getWithinOffset(); +var pos2=branch2.getWithinOffset(); +var next =(pos1[1]<=pos2[1])? true:false; +branch =(next)? branch1.getNextBranch(): branch1.getPreviousBranch(); +while(branch){ +selected.push(branch); +if(branch.getId()== branch2.getId()){ +found=true; +break; +} +branch =(next)? branch.getNextBranch(): branch.getPreviousBranch(); +} +return(found)? selected:false; +}, +countBranches:function(){ +var nb=this.roots.length; +for(var i=0;i<this.roots.length;i++){ +nb += this.roots[i].countBranches(); +} +return nb; +}, +getBranches:function(filter){ +var branches=[]; +for(var i=0;i<this.roots.length;i++){ +if(typeof(filter)== 'function'){ +if(filter(this.roots[i])){ +branches.push(this.roots[i]); +} +} else{ +branches.push(this.roots[i]); +} +branches=this.roots[i].getBranches(filter,branches); +} +return branches; +}, +getOpenedBranches:function(){ +var openedBranches=[]; +for(var i=0;i<this.roots.length;i++){ +if(this.roots[i].isOpened()&& this.roots[i].hasChildren()){ +openedBranches.push(this.roots[i]); +} +openedBranches=this.roots[i].getOpenedBranches(openedBranches); +} +return openedBranches; +}, +getCheckedBranches:function(){ +var checkedBranches=[]; +for(var i=0;i<this.roots.length;i++){ +if(this.roots[i].isChecked()== 1){ +checkedBranches.push(this.roots[i]); +} +checkedBranches=this.roots[i].getCheckedBranches(checkedBranches); +} +return checkedBranches; +}, +getUnCheckedBranches:function(){ +var uncheckedBranches=[]; +for(var i=0;i<this.roots.length;i++){ +if(this.roots[i].isChecked()== 0){ +uncheckedBranches.push(this.roots[i]); +} +uncheckedBranches=this.roots[i].getUnCheckedBranches(uncheckedBranches); +} +return uncheckedBranches; +}, +getPartCheckedBranches:function(){ +var uncheckedBranches=[]; +for(var i=0;i<this.roots.length;i++){ +if(this.roots[i].isChecked()== -1){ +uncheckedBranches.push(this.roots[i]); +} +uncheckedBranches=this.roots[i].getPartCheckedBranches(uncheckedBranches); +} +return uncheckedBranches; +}, +getParentBranches:function(){ +var parents=[]; +for(var i=0;i<this.roots.length;i++){ +if(this.roots[i].hasChildren()){ +parents.push(this.roots[i]); +} +parents=this.roots[i].getParentBranches(parents); +} +return parents; +}, +getLeafBranches:function(){ +var leafs=[]; +for(var i=0;i<this.roots.length;i++){ +if(!this.roots[i].hasChildren()){ +leafs.push(this.roots[i]); +} +leafs=this.roots[i].getLeafBranches(leafs); +} +return leafs; +}, +expend:function(){ +for(var i=0;i<this.roots.length;i++){ +this.roots[i].expend(); +} +}, +collapse:function(){ +for(var i=0;i<this.roots.length;i++){ +this.roots[i].collapse(); +} +}, +insertBranch:function(position,item,sibling,isFirst){ +var position=this.getBranchById(position); +if(!position)return false; +if(!sibling){ +if(!isFirst){ +position.insertIntoLast(item); +} else{ +position.insertIntoFirst(item); +} +} else{ +if(!isFirst){ +position.insertAfter(item); +} else{ +position.insertBefore(item); +} +} +}, +moveBranch:function(position,item,sibling,isFirst){ +var position=this.getBranchById(position); +if(!position)return false; +if(!sibling){ +if(!isFirst){ +position.moveIntoLast(item); +} else{ +position.moveIntoFirst(item); +} +} else{ +if(!isFirst){ +position.moveAfter(item); +} else{ +position.moveBefore(item); +} +} +}, +removeBranch:function(branch){ +try{ +var branch=this.getBranchById(branch); +if(!branch)return false; +if(branch.objDrag){ +branch.removeDragDrop(); +} +if(!branch.isRoot){ +branch.parent.obj.removeChild(branch.obj); +branch.parent.children.splice(branch.pos,1); +branch.parent.struct.items.splice(branch.pos,1); +if(branch.parent.children.length==0){ +branch.parent.setOpenableIcon(false); +if(branch.tree.multiline){ +branch._manageMultiline(branch.parent.tdImg,2,false); +} +} +branch.parent._manageLine(); +} else{ +this.div.removeChild(branch.obj); +this.roots.splice(branch.pos,1); +if(this.roots[branch.pos-1]){ +this.roots[branch.pos-1]._manageAfterRootInsert(); +} +} +branch=null; +} catch(err){ +throw new Error('remove(base): '+err.message); +} +}, +getBranchByIdObj:function(id){ +try{ +var obj=null; +for(var r=0;r<this.roots.length;r++){ +obj=this._getBranchByIdObj(id,this.roots[r]); +if(obj){ +break; +} +} +return obj; +} catch(err){ +throw new Error('getBranchByIdObj(func): '+err.message); +} +}, +getBranchById:function(id){ +try{ +if(typeof(id)== 'object')return id; +var obj=null; +for(var r=0;r<this.roots.length;r++){ +obj=this._getBranchById(id,this.roots[r]); +if(obj)break; +} +if(!obj){ +var ro=null; +for(var i=0;i<this.otherTrees.length;i++){ +ro=this.otherTrees[i].roots; +for(var r=0;r<ro.length;r++){ +obj=this.otherTrees[i]._getBranchById(id,ro[r]); +if(obj)break; +} +if(obj)break; +} +} +return obj; +} catch(err){ +throw new Error('getBranchById(func): '+err.message); +} +}, +debug:function(str){ +try{ +this.debugObj.style.display='block'; +if(typeof(this.onDebug)== 'function'){ +this.onDebug(this,this.debugObj,(str)? str:''); +} else{ +this.debugObj.innerHTML += str; +} +} catch(err){ +throw new Error('debug(func): '+err.message); +} +}, +toString:function(){ +var obj ={ +'id':this.id, +'width':this.div.offsetWidth, +'height':this.div.offsetHeight, +'imgPath':this.imgBase, +'roots':this.roots.length +}; +var str='TafelTree{'; +for(var i in obj){ +str += TafelTree.debugReturn+TafelTree.debugTab+i+':'+obj[i]; +} +str += TafelTree.debugReturn+'}'; +return str; +}, +serialize:function(debug){ +var rt =(debug)? TafelTree.debugReturn:''; +var str =(debug)? 'TafelTree('+this.id+')[':'['; +for(var i=0;i<this.roots.length;i++){ +str += this.roots[i].serialize(debug,true); +if(i<this.roots.length-1){ +str += ','; +} +} +str += rt +((debug)? '];':']'); +if(debug){ +return str; +} else{ +return encodeURIComponent(str); +} +}, +getURLParams:function(url){ +var params=[]; +if(url.indexOf('?')> -1){ +var a1=url.split('?'); +var a2=a1[1].split('&'); +var a3=''; +for(var i=0;i<a2.length;i++){ +a3=a2[i].split('='); +if(a3.length==2){ +params.push({ +'name':a3[0], +'value': a3[1] +}) +} +} +} +return params; +}, +_generateBigTree:function(){ +var i=this.bigTreeLoading; +var isNotFirst=false; +var isNotLast=false; +if(i<this.baseStruct.length){ +isNotFirst =(i>0)? true:false; +isNotLast =(i<this.baseStruct.length-1)? true:false; +this.roots[i]=new TafelTreeRoot(this,this.baseStruct[i],0,isNotFirst,isNotLast,i); +this.div.appendChild(this.roots[i].obj); +this.loadRunning(this.roots[i]); +this.bigTreeLoading++; +setTimeout(this._generateBigTree.bind(this),10); +} else{ +this.loaded=true; +} +}, +_checkLoad:function(){ +var complete=true; +if(this.loaded){ +for(var i=0;i<this.roots.length;i++){ +if(!this.roots[i].loaded||!this._checkLoadChildren(this.roots[i])){ +complete=false; +break; +} +} +} else{ +complete=false; +} +if(!complete){ +setTimeout(this._checkLoad.bind(this),100); +} else{ +this.loadComplete(); +} +}, +_checkLoadChildren:function(branch){ +var complete=true; +if(branch.loaded){ +for(var i=0;i<branch.children.length;i++){ +if(!branch.children[i].loaded||!this._checkLoadChildren(branch.children[i])){ +complete=false; +break; +} +} +} else{ +complete=false; +} +return complete; +}, +_adjustOpening:function(){ +if(this.useCookie&&this.cookieOpened){ +var branch=null; +for(var i=0;i<this.cookieOpened.length;i++){ +branch=this.getBranchById(this.cookieOpened[i]); +if(typeof(branch)== 'object'&&branch.hasChildren()){ +if(branch.children.length>0){ +branch.openIt(true); +} else{ +if(typeof(branch.struct.onopenpopulate)== 'function'&&branch.eventable){ +branch._openPopulate(); +branch.openIt(true); +} +} +} +} +} +}, +_adjustCheck:function(){ +var branch=null; +if(this.checkboxes&&this.useCookie&&this.cookieChecked){ +for(var i=0;i<this.cookieChecked.length;i++){ +branch=this.getBranchById(this.cookieChecked[i]); +if(typeof(branch)== 'object'){ +branch.check(1); +} +} +} +if(this.checkboxes&&this.checkboxesThreeState){ +var checked=this.getCheckedBranches(); +for(var i=0;i<checked.length;i++){ +checked[i]._adjustParentCheck(); +} +} +}, +_getBranchByIdObj:function(id,obj){ +try{ +var ob=''; +if(obj.idObj==id){ +return obj; +} +if(typeof(obj.children)== 'object'){ +for(var c=0;c<obj.children.length;c++){ +ob=this._getBranchByIdObj(id,obj.children[c]); +if(ob){ +return ob; +} +} +} +return ob; +} catch(err){ +throw new Error('_getBranchByIdObj(func): '+err.message); +} +}, +_getBranchById:function(id,obj){ +try{ +var ob=''; +if(obj.getId()== id){ +return obj; +} +if(typeof(obj.children)== 'object'){ +for(var c=0;c<obj.children.length;c++){ +ob=this._getBranchById(id,obj.children[c]); +if(ob){ +return ob; +} +} +} +return ob; +} catch(err){ +throw new Error('_getBranchById(func): '+err.message); +} +}, +_changeStruct:function(branch){ +try{ +while(typeof(branch.parent)!= 'undefined'){ +branch.parent.struct.items.splice(branch.pos,1,branch.struct); +if(typeof(branch.parent)!= 'undefined'){ +branch=branch.parent; +} +} +} catch(err){ +throw new Error('_changeStruct(func): '+err.message); +} +}, +_addTree:function(){ +var div=document.createElement('div'); +div.className=this.classTree; +return div; +}, +setCookie:function(name){ +try{ +var str='cookieactivate'+this.cookieSeparator; +var arr=this.getOpenedBranches(); +for(var i=0;i<arr.length;i++){ +str=str+arr[i].getId()+ this.cookieSeparator; +} +str += this.cookieCheckSeparator; +var arr=this.getCheckedBranches(); +for(var i=0;i<arr.length;i++){ +str=str+arr[i].getId()+ this.cookieSeparator; +} +if(!this.serverCookie){ +this._saveCookie(name,str,'','/','',''); +} else{ +if(this.loaded){ +new Ajax.Request(this.serverCookie,{ +'method':'post', +'parameters':'type=set&cookieString='+str, +'onComplete':this._cookieSend.bind(this), +'onFailure':this._cookieFailure.bind(this) +}); +} +} +} catch(err){ +throw new Error('setCookie(func): '+err.message); +} +}, +getCookie:function(name){ +try{ +if(!this.serverCookie){ +if(name!=''){ +var start=document.cookie.indexOf(name+'='); +var len=start+name.length+1; +if((!start)&&(name!=document.cookie.substring(0,name.length))){ +return null; +} +if( start==-1 )return null; +var end=document.cookie.indexOf(';',len); +if(end==-1){ +end=document.cookie.length; +} +return unescape(document.cookie.substring(len,end)); +} +} else{ +new Ajax.Request(this.serverCookie,{ +'method':'post', +'parameters':'type=get', +'onComplete':this._getCookieComplete.bind(this), +'onFailure':this._cookieFailure.bind(this) +}); +} +return null; +} catch(err){ +throw new Error('getCookie(func): '+err.message); +} +}, +_cookieSend:function(response){ +alert('ok'); +}, +_getCookieComplete:function(response){ +var fromCookie=response.responseText; +if(fromCookie){ +var branches=fromCookie.split(this.cookieCheckSeparator); +this.cookieOpened=[]; +this.cookieOpened=branches[0].split(this.cookieSeparator); +this.cookieOpened.shift(); +this.cookieChecked=[]; +if(branches.length>1){ +this.cookieChecked=branches[1].split(this.cookieSeparator); +} +} +if(this.options.generate){ +this.generate(); +} +if(this.options.generateBigTree){ +this.generate(true); +} +}, +_cookieFailure:function(response){ +}, +deleteCookie:function(name,path,domain){ +try{ +if(get_cookie(name))document.cookie=name+'=' + +(( path )? ';path='+path:"")+ +(( domain )? ';domain='+domain:'')+ +';expires=Thu,01-Jan-1970 00:00:01 GMT'; +} catch(err){ +throw new Error('deleteCookie(func): '+err.message); +} +}, +_saveCookie:function(name,value,expires,path,domain,secure){ +try{ +var today=new Date(); +today.setTime(today.getTime()); +if(expires){ +expires=expires * 1000 * 60 * 60 * 24; +} +var expires_date=new Date(today.getTime()+(expires)); +document.cookie=name+'=' +escape(value)+ +(( expires )? ';expires='+expires_date.toGMTString(): '')+ +(( path )? ';path='+path:'')+ +(( domain )? ';domain='+domain:'')+ +(( secure )? ';secure':''); +} catch(err){ +throw new Error('_saveCookie(func): '+err.message); +} +}, +setOnLoad:function(func){ +this.onLoad=eval(func); +}, +setOnLoading:function(func){ +this.onLoading=eval(func); +}, +setOnOpen:function(func){ +this.onOpen=eval(func); +}, +setOnBeforeOpen:function(func){ +this.onBeforeOpen=eval(func); +}, +setOnMouseOver:function(func){ +this.onMouseOver=eval(func); +}, +setOnMouseOut:function(func){ +this.onMouseOut=eval(func); +}, +setOnClick:function(func){ +this.onClick=eval(func); +}, +setOnMouseDown:function(func){ +this.onMouseDown=eval(func); +}, +setOnMouseUp:function(func){ +this.onMouseUp=eval(func); +}, +setOnDblClick:function(func){ +this.onDblClick=eval(func); +}, +setOnEdit:function(func,link){ +if(link){ +this.onEditAjax ={ +'func':eval(func), +'link':link +}; +} else{ +this.onEdit=eval(func); +} +this.editableBranches=true; +}, +setOnBeforeCheck:function(func){ +this.onBeforeCheck=eval(func); +}, +setOnCheck:function(func){ +this.onCheck=eval(func); +}, +setOnDrop:function(func){ +this.onDrop=eval(func); +}, +setOnDropAfter:function(func){ +this.onErrorAjax=eval(func); +}, +setOnDropAjax:function(func,link){ +this.onDropAjax ={ +'func':eval(func), +'link':link +}; +}, +setOnOpenPopulate:function(func,link){ +this.onOpenPopulate ={ +'func':eval(func), +'link':link +}; +}, +setOnEditAjax:function(func,link){ +this.onEditAjax ={ +'func':eval(func), +'link':link +}; +this.editableBranches=true; +}, +setOnDragStartEffect:function(func){ +this.onDragStartEffect=eval(func); +}, +setOnDragEndEffect:function(func){ +this.onDragEndEffect=eval(func); +} +}; +var TafelTreeBaseBranch=Class.create(); +TafelTreeBaseBranch.prototype ={ +initialize:function(){}, +getId:function(){ +return this.struct.id; +}, +getText:function(){ +return this.struct.txt; +}, +getLevel:function(){ +return this.level; +}, +getTree:function(){ +return this.tree; +}, +getParent:function(){ +return(this.isRoot)? null:this.parent; +}, +getAncestor:function(){ +return(this.isRoot)? null:this.root; +}, +getParents:function(){ +var parents=[]; +var branch=this; +while(branch.parent){ +parents.push(branch.parent); +branch=branch.parent; +} +return parents; +}, +getChildren:function(){ +return this.children; +}, +getIcon:function(){ +return this.struct.img; +}, +getOpenIcon:function(){ +return this.struct.imgopen; +}, +getCloseIcon:function(){ +return this.struct.imgclose; +}, +getIconSelected:function(){ +return this.struct.imgselected; +}, +getOpenIconSelected:function(){ +return this.struct.imgopenselected; +}, +getCloseIconSelected:function(){ +return this.struct.imgcloseselected; +}, +getCurrentIcon:function(){ +var img=this._getImgInfo(this.img); +return img.fullName; +}, +setText:function(text){ +this.struct.txt=text; +this.txt.innerHTML=text; +}, +setIcons:function(icon,iconOpen,iconClose){ +this.struct.img=icon; +this.struct.imgopen =(iconOpen)? iconOpen:icon; +this.struct.imgclose =(iconClose)? iconClose:icon; +if(this.hasChildren()){ +this.img.src =(this.isOpened())? this.tree.imgBase+this.struct.imgopen:this.tree.imgBase+this.struct.imgclose; +} else{ +this.img.src=this.tree.imgBase+this.struct.img; +} +}, +setIconsSelected:function(icon,iconOpen,iconClose){ +this.struct.imgselected=icon; +this.struct.imgopenselected =(iconOpen)? iconOpen:null; +this.struct.imgcloseselected =(iconClose)? iconClose:null; +if(this.isSelected()){ +if(this.hasChildren()){ +this.img.src =(this.isOpened())? this.tree.imgBase+this.struct.imgopenselected:this.tree.imgBase+this.struct.imgcloseselected; +} else{ +this.img.src=this.tree.imgBase+this.struct.imgselected; +} +} +}, +changeId:function(newId){ +var used=this.tree.getBranchById(newId); +if(!used){ +this.struct.id=newId; +this.tree._changeStruct(this); +return true; +} else{ +return false; +} +}, +hasChildren:function(){ +return(this.struct.items.length>0||this.struct.canhavechildren)? true:false; +}, +isOpened:function(){ +return(this.struct.open)? true:false; +}, +isAlwaysLast:function(){ +return(this.struct.last)? true:false; +}, +isOpenedInCookie:function(){ +if(this.tree.useCookie&&this.tree.cookieOpened){ +for(var i=0;i<this.tree.cookieOpened.length;i++){ +if(this.getId()== this.tree.cookieOpened[i])return true; +} +} +return false; +}, +isVisible:function(){ +var visible=true; +var branch=this; +while(branch.parent){ +if(branch.parent.isOpened()){ +branch=branch.parent; +} else{ +visible=false; +break; +} +} +return visible; +}, +isSelected:function(){ +return(Element.hasClassName(this.txt,this.tree.classSelected))? true:false; +}, +refreshChildren:function(){ +this.removeChildren(); +this._openPopulate(); +}, +clone:function(withDefaultFunc){ +var struct ={}; +for(var property in this.struct){ +if(property!='items'){ +if(!withDefaultFunc&&typeof(this.struct[property])== 'function'){ +if(!eval('this.'+property+'Default')){ +struct[property]=this.struct[property]; +} +} else{ +struct[property]=this.struct[property]; +} +} +} +if(this.hasChildren()){ +struct.items=[]; +for(var i=0;i<this.children.length;i++){ +struct.items.push(this.children[i].clone(withDefaultFunc)); +} +} +this.copiedTimes++; +struct.id=struct.id+this.tree.copyNameBreak+this.tree.idTree; +struct.txt=struct.txt+this.tree.copyName.replace('%n',this.copiedTimes); +return struct; +}, +getFirstBranch:function(){ +return(this.children.length>0)? this.children[0]:null; +}, +getLastBranch:function(){ +var pos=this.children.length-1; +return(pos>=0)? this.children[pos]:null; +}, +getPreviousSibling:function(){ +var pos=this.pos-1; +var branch=null; +if(this.isRoot){ +if(pos>=0)branch=this.tree.roots[pos]; +} else{ +if(pos>=0)branch=this.parent.children[pos]; +} +return branch; +}, +getNextSibling:function(){ +var pos=this.pos+1; +var branch=null; +if(this.isRoot){ +if(pos<this.tree.roots.length)branch=this.tree.roots[pos]; +} else{ +if(pos<this.parent.children.length)branch=this.parent.children[pos]; +} +return branch; +}, +getPreviousBranch:function(){ +var branch=null; +var previous=this.getPreviousSibling(); +if(previous){ +if(previous.hasChildren()){ +while(previous.hasChildren()){ +previous=previous.getLastBranch(); +} +branch=previous; +} else{ +branch=previous; +} +} else{ +if(this.parent){ +branch=this.parent; +} +} +return branch; +}, +getNextBranch:function(){ +var branch=null; +branch=this.getFirstBranch(); +if(!branch){ +branch=this.getNextSibling(); +if(!branch){ +var b=null; +branch=this.parent; +while(!b&&branch){ +b=branch.getNextSibling(); +branch=branch.parent; +} +branch=b; +} +} +return branch; +}, +getPreviousOpenedBranch:function(){ +var branch=null; +var previous=this.getPreviousSibling(); +if(previous){ +if(previous.hasChildren()&& previous.isOpened()){ +while(previous.hasChildren()&& previous.isOpened()){ +previous=previous.getLastBranch(); +} +branch=previous; +} else{ +branch=previous; +} +} else{ +if(this.parent){ +branch=this.parent; +} +} +return branch; +}, +getNextOpenedBranch:function(){ +var branch=null; +if(this.hasChildren()&& this.isOpened()){ +branch=this.getFirstBranch(); +} else{ +var next=this; +while(!branch){ +branch=next.getNextSibling(); +next=next.parent; +if(!next)break; +} +} +return branch; +}, +removeChildren:function(){ +var children=this.children.concat(); +for(var i=0;i<children.length;i++){ +this.tree.removeBranch(children[i]); +} +}, +isChild:function(elem){ +var elem=this.tree.getBranchById(elem); +if(!elem)return false; +return this._isChild(this,elem); +}, +openIt:function(open){ +try{ +if(!open){ +this._closeChild(); +if(this.tree.multiline){ +this._manageMultiline(this.tdImg,2,false); +} +} else{ +if(this.tree.onlyOneOpened){ +this.closeSiblings(); +} +this._openChild(); +if(this.tree.multiline){ +this._manageMultiline(this.tdImg,2,true); +} +} +if(this.tree.useCookie){ +this.tree.setCookie(this.tree.classTree+this.tree.id); +} +} catch(err){ +throw new Error('openIt(base): '+err.message); +} +}, +insert:function(item){ +return this.insertIntoLast(item); +}, +insertIntoLast:function(item){ +var pos=this.children.length; +var isNotFirst =(this.hasChildren())? true:false; +this.children[pos]=new TafelTreeBranch((this.isRoot)? this:this.root,this,item,this.level+1,isNotFirst,false,pos); +this.struct.items[pos]=item; +this.obj.appendChild(this.children[pos].obj); +this._manageAfterInsert(pos); +return this.children[pos]; +}, +insertIntoFirst:function(item){ +var pos=0; +var posBefore=1; +var isNotLast =(this.hasChildren())? false:true; +this._movePartStruct(pos); +this.struct.items[pos]=item; +this.children[pos]=new TafelTreeBranch((this.isRoot)? this:this.root,this,item,this.level+1,false,isNotLast,pos); +try{ +this.obj.insertBefore(this.children[pos].obj,this.children[posBefore].obj); +} catch(err){ +this.obj.appendChild(this.children[pos].obj); +} +this._manageAfterInsert(pos); +return this.children[pos]; +}, +closeSiblings:function(){ +var obj=null; +if(this.parent){ +for(var i=0;i<this.parent.children.length;i++){ +obj=this.parent.children[i]; +if(obj.idObj!=this.idObj&&obj.hasChildren()){ +obj.openIt(false); +} +} +} else if(this.isRoot){ +for(var i=0;i<this.tree.roots.length;i++){ +obj=this.tree.roots[i]; +if(obj.idObj!=this.idObj&&obj.hasChildren()){ +obj.openIt(false); +} +} +} +}, +addClass:function(style){ +Element.addClassName(this.txt,style); +}, +removeClass:function(style){ +Element.removeClassName(this.txt,style); +}, +getImgBeforeIcon:function(){ +try{ +var img=this.beforeIcon.getElementsByTagName('img')[0]; +return this._getImgInfo(img); +} catch(err){ +throw new Error('getImgBeforeIcon(base): '+err.message); +} +}, +setOpenableIcon:function(openable){ +var im=this.getImgBeforeIcon(); +var img=im.img; +if(openable){ +this.struct.open=true; +this.img.src=this.tree.imgBase+this.struct.imgopen; +if(!this.isRoot){ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgMinus3:this.tree.imgBase+this.tree.imgMinus2; +} else{ +if(this.hasSiblingsBefore){ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgMinus3:this.tree.imgBase+this.tree.imgMinus2; +} else{ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgMinus4:this.tree.imgBase+this.tree.imgMinus5; +} +} +Event.observe(img,'click',this.setOpen.bindAsEventListener(this),false); +Event.observe(img,'mouseover',this.evt_openMouseOver.bindAsEventListener(this),false); +Event.observe(img,'mouseout',this.evt_openMouseOut.bindAsEventListener(this),false); +} else{ +this.struct.open=false; +this.struct.canhavechildren=false; +this.img.src=this.tree.imgBase+this.struct.img; +var td=img.parentNode; +var newImg=document.createElement('img'); +td.removeChild(img); +if(!this.isRoot){ +newImg.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgLine3:this.tree.imgBase+this.tree.imgLine2; +} else{ +if(this.hasSiblingsBefore){ +newImg.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgLine3:this.tree.imgBase+this.tree.imgLine2; +} else{ +newImg.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgLine4:this.tree.imgBase+this.tree.imgLine5; +} +} +td.appendChild(newImg); +} +}, +toString:function(){ +var str =(this.isRoot)? 'TafelTreeRoot{':'TafelTreeBranch{'; +var strSave=''; +for(var attr in this.struct){ +if(attr!='items'){ +strSave =(typeof(this.struct[attr])!= 'function')? this.struct[attr]:true; +str += TafelTree.debugReturn+TafelTree.debugTab+attr+':'+strSave; +} +} +str += TafelTree.debugReturn+TafelTree.debugTab+'children:'+this.children.length; +str += TafelTree.debugReturn+'}'; +return str; +}, +isChecked:function(dbg){ +if(this.tree.checkboxes&&this.checkbox){ +var img=this._getImgInfo(this.checkbox); +if(img.fullName.replace('_over','')== this.tree.imgCheck2){ +return 1; +} +if(img.fullName.replace('_over','')== this.tree.imgCheck3){ +return -1; +} +return 0; +} +return 0; +}, +getCheckbox:function(){ +return(this.checkbox)? this.checkbox:false; +}, +check:function(checked){ +if(this.checkbox){ +if(checked==-1){ +this.checkbox.src=this.tree.imgBase+this.tree.imgCheck3; +this.struct.check=-1; +} else if(checked){ +this.checkbox.src=this.tree.imgBase+this.tree.imgCheck2; +this.struct.check=1; +if(this.tree.useCookie){ +this.tree.setCookie(this.tree.classTree+this.tree.id); +} +} else{ +this.checkbox.src=this.tree.imgBase+this.tree.imgCheck1; +this.struct.check=0; +if(this.tree.useCookie){ +this.tree.setCookie(this.tree.classTree+this.tree.id); +} +} +} +}, +hasAllChildrenChecked:function(){ +var allChecked=false; +var anyChecked=false; +for(var i=0;i<this.children.length;i++){ +if(this.children[i].isChecked()== -1){ +allChecked=true; +anyChecked=true; +break; +} +if(this.children[i].isChecked()== 1)allChecked=true; +else anyChecked=true; +} +if(allChecked&&anyChecked)return -1; +if(allChecked)return 1; +else return 0; +}, +switchWith:function(branchId){ +var branch=this.tree.getBranchById(branchId); +if(!branch)return false; +var copyThis=this.copiedTimes; +var newThis=this.clone(); +var txtThis=this.getText(); +var idThis=this.getId(); +var copyBanch=branch.copiedTimes; +var newBranch=branch.clone(); +var txtBranch=branch.getText(); +var idBranch=branch.getId(); +this.changeId('temp_switch_change_'+this.tree.idTree); +var n1=branch.insertBefore(newThis); +this.tree.removeBranch(branch); +n1.setText(txtThis); +n1.changeId(idThis); +n1.copiedTimes=copyThis; +var n2=this.insertBefore(newBranch); +this.tree.removeBranch(this); +n2.setText(txtBranch); +n2.changeId(idBranch); +n2.copiedTimes=copyBranch; +}, +replace:function(branchId,copy){ +var branch=this.tree.getBranchById(branchId); +if(!branch)return false; +var copyThis=this.copiedTimes; +var newThis=this.clone(); +var n1=branch.insertBefore(newThis); +this.tree.removeBranch(branch); +if(!copy){ +var idThis=this.getId(); +n1.setText(this.getText()) +this.tree.removeBranch(this); +n1.changeId(idThis); +n1.copiedTimes=copyThis; +} +return n1; +}, +expend:function(){ +if(this.isOpened()!= true&&this.hasChildren()){ +this.openIt(true); +} +for(var i=0;i<this.children.length;i++){ +this.children[i].expend(); +} +}, +collapse:function(){ +if(this.isOpened()!= false&&this.hasChildren()){ +this.openIt(false); +} +for(var i=0;i<this.children.length;i++){ +this.children[i].collapse(); +} +}, +getBranches:function(filter,branches){ +if(!branches)branches=[]; +for(var i=0;i<this.children.length;i++){ +if(typeof(filter)== 'function'){ +if(filter(this.children[i])){ +branches.push(this.children[i]); +} +} else{ +branches.push(this.children[i]); +} +branches=this.children[i].getBranches(filter,branches); +} +return branches; +}, +getParentBranches:function(parents){ +if(!parents)parents=[]; +for(var i=0;i<this.children.length;i++){ +if(this.children[i].hasChildren()){ +parents.push(this.children[i]); +} +parents=this.children[i].getParentBranches(parents); +} +return parents; +}, +getLeafBranches:function(leafs){ +if(!leafs)leafs=[]; +for(var i=0;i<this.children.length;i++){ +if(!this.children[i].hasChildren()){ +leafs.push(this.children[i]); +} +leafs=this.children[i].getLeafBranches(leafs); +} +return leafs; +}, +countBranches:function(){ +var nb=this.children.length; +for(var i=0;i<this.children.length;i++){ +nb += this.children[i].countBranches(); +} +return nb; +}, +getOpenedBranches:function(openedBranches){ +if(!openedBranches)openedBranches=[]; +for(var i=0;i<this.children.length;i++){ +if(this.children[i].isOpened()&& this.children[i].hasChildren()){ +openedBranches.push(this.children[i]); +} +openedBranches=this.children[i].getOpenedBranches(openedBranches); +} +return openedBranches; +}, +getCheckedBranches:function(checkedBranches){ +return this._getCheckedBranches(checkedBranches,1); +}, +getUnCheckedBranches:function(checkedBranches){ +return this._getCheckedBranches(checkedBranches,0); +}, +getPartCheckedBranches:function(checkedBranches){ +return this._getCheckedBranches(checkedBranches,-1); +}, +select:function(ev){ +var ctrl =(ev)? TafelTreeManager.ctrlOn(ev): false; +var shift =(ev)? TafelTreeManager.shiftOn(ev): false; +if(ctrl){ +this.tree.selectedBranches.push(this); +} else if(shift&&this.tree.selectedBranches.length>0){ +var last=this.tree.selectedBranches.length-1; +var sel=this.tree.getBranchesBetween(this.tree.selectedBranches[last],this); +for(var i=0;i<sel.length;i++){ +this.tree.selectedBranches.push(sel[i]); +Element.addClassName(sel[i].txt,this.tree.classSelected); +} +} else{ +this.tree.unselect(); +this.tree.selectedBranches.push(this); +} +Element.addClassName(this.txt,this.tree.classSelected); +if(this.isOpened()&& this.hasChildren()&& this.getOpenIconSelected()){ +this.img.src=this.tree.imgBase+this.getOpenIconSelected(); +} else if(!this.isOpened()&& this.hasChildren()&& this.getCloseIconSelected()){ +this.img.src=this.tree.imgBase+this.getCloseIconSelected(); +} else if(!this.hasChildren()&& this.getIconSelected()){ +this.img.src=this.tree.imgBase+this.getIconSelected(); +} +if(ev)Event.stop(ev); +}, +unselect:function(){ +var ln=this.tree.selectedBranches.length; +if(ln>0){ +for(var i=0;i<ln;i++){ +if(this.tree.selectedBranches[i].getId()== this.getId()){ +this.tree.selectedBranches.splice(i,1); +Element.removeClassName(this.txt,this.tree.classSelected); +if(this.hasChildren()){ +this.img.src =(this.isOpened())? this.tree.imgBase+this.struct.imgopen:this.tree.imgBase+this.struct.imgclose; +} else{ +this.img.src=this.tree.imgBase+this.struct.img; +} +return true; +} +} +} +return false; +}, +getWithinOffset:function(){ +var realPos=Position.positionedOffset(this.txt); +var posTree=Position.positionedOffset(this.tree.div); +var pos=[ +realPos[0]-posTree[0], +realPos[1]-posTree[1] +]; +return pos; +}, +getAbsoluteOffset:function(){ +return Position.positionedOffset(this.txt); +}, +serialize:function(debug,noEncoding){ +var tab=''; +var rt=''; +if(debug){ +rt=TafelTree.debugReturn; +for(var i=0;i<this.level;i++){ +tab += TafelTree.debugTab; +} +} +var strSave=''; +var str=rt+tab+'{'+rt; +str += tab+'"id":"'+this._encode(this.struct.id)+ '"'; +for(var attr in this.struct){ +if(attr!='items'&&attr!='id'){ +strSave =(typeof(this.struct[attr])!= 'function')? this.struct[attr]:true; +if(this.isBool(strSave)){ +str += ","+rt+tab+'"'+attr+'":'+this._encode(strSave); +} else{ +str += ","+rt+tab+'"'+attr+'":"'+this._encode(strSave)+ '"'; +} +} +} +if(this.hasChildren()){ +str += ','+rt+tab+'"items":['; +for(var i=0;i<this.children.length;i++){ +str += this.children[i].serialize(debug,true); +if(i<this.children.length-1){ +str += ','; +} +} +str += rt+tab+']'; +} +str += rt+tab+'}'; +if(!noEncoding){ +return encodeURIComponent(str); +} else{ +return str; +} +}, +isBool:function(str){ +switch(str){ +case 'true':case 'false': +case true:case false: +case '1':case '0' : +case 1:case 0 : +return true; +default : +return false; +} +}, +showTooltip:function(){ +if(this.displayTooltip){ +this.tooltip.style.display='block'; +} +}, +hideTooltip:function(){ +if(!this.displayTooltip){ +Element.hide(this.tooltip); +} +}, +removeDragDrop:function(){ +if(this.objDrag){ +this.objDrag.destroy(); +} +Droppables.remove(this.txt); +for(var i=0;i<this.children.length;i++){ +this.children[i].removeDragDrop(); +} +}, +_manageMultiline:function(element,type,add){ +switch(type){ +case 2 : +if(!add){ +Element.removeClassName(element,this.tree.imgMulti4); +element.style.background='none'; +} else{ +Element.addClassName(element,this.tree.imgMulti4); +element.style.background='url("'+this.tree.imgBase+this.tree.imgMulti2+'")'; +element.style.backgroundRepeat='repeat-y'; +} +break; +case 1 : +default : +if(!add){ +Element.removeClassName(element,this.tree.imgMulti3); +element.style.background='none'; +} else{ +Element.addClassName(element,this.tree.imgMulti3); +element.style.background='url("'+this.tree.imgBase+this.tree.imgMulti1+'")'; +element.style.backgroundRepeat='repeat-y'; +} +} +}, +_createTooltip:function(){ +var div=document.createElement('div'); +div.className=this.tree.classTooltip; +div.innerHTML =(this.struct.tooltip)? this.struct.tooltip:' '; +Event.observe(div,'mouseover',this.showTooltip.bindAsEventListener(this),false); +return div; +}, +_manageAfterInsert:function(pos){ +this.tree._changeStruct(this); +this._manageLine(); +if(this.tree.checkboxes&&this.tree.checkboxesThreeState){ +this.children[pos]._adjustParentCheck(); +} +if(this.children.length==1&&!this.struct.canhavechildren){ +this.setOpenableIcon(true); +} +this.openIt((!this.tree.openedAfterAdd&&!this.isOpened())? false:true); +}, +_movePartStruct:function(pos){ +var nb=this.struct.items.length-1; +var newPos=0; +for(var i=nb;i>=pos;i--){ +newPos=i+1; +this.struct.items[newPos]=this.struct.items[i]; +this.children[newPos]=this.children[i]; +this.children[newPos].pos=newPos; +} +}, +_getCheckedBranches:function(checkedBranches,checked){ +if(!checkedBranches)checkedBranches=[]; +for(var i=0;i<this.children.length;i++){ +if(this.children[i].isChecked()== checked){ +checkedBranches.push(this.children[i]); +} +checkedBranches=this.children[i]._getCheckedBranches(checkedBranches,checked); +} +return checkedBranches; +}, +_generate:function(){ +var i=this.bigTreeLoading; +if(i<this.struct.items.length){ +if(this.tree.checkboxesThreeState&&this.struct.check&&typeof(this.struct.items[i].check)== 'undefined'){ +this.struct.items[i].check=1; +} +isNotFirst =(i>0)? true:false; +isNotLast =(i<this.struct.items.length-1)? true:false; +this.children[i]=new TafelTreeBranch((this.isRoot)? this:this.root,this,this.struct.items[i],this.level+1,isNotFirst,isNotLast,i); +this.obj.appendChild(this.children[i].obj); +this.openIt((this.tree.useCookie)? this.isOpenedInCookie:this.struct.open); +this.tree.loadRunning(this.children[i]); +this.bigTreeLoading++; +setTimeout(this._generate.bind(this),10); +} else{ +this.loaded=true; +} +}, +_getPos:function(){ +pos=this.children.length; +for(var i=0;i<this.children.length;i++){ +if(this.children[i].isAlwaysLast()){ +pos--; +} +} +if(pos<0 )pos=0; +return pos; +}, +_adjustParentCheck:function(fromBranch){ +if(this.parent){ +var branch =(!fromBranch)? this.parent:this; +while(branch&&branch.checkbox){ +branch.check(branch.hasAllChildrenChecked()); +branch=branch.parent; +} +} +}, +_manageCheckThreeState:function(branch,checked){ +for(var i=0;i<branch.children.length;i++){ +if(branch.tree.checkboxes&&branch.children[i].checkbox){ +branch.children[i].check(checked); +branch._manageCheckThreeState(branch.children[i],checked); +} +} +}, +_getImgInfo:function(img){ +var url=img.src.split('/'); +var name=url[url.length-1].split('.'); +var obj ={ +'img': img, +'number': name[0].charAt(name[0].length-1), +'type': name[0].substr(0,name[0].length-1), +'name': name[0], +'fullName': url[url.length-1] +}; +return obj; +}, +_encode:function(str){ +var obj =(str === null)? '':str; +return obj.toString().replace(/\"/g,'\\"'); +}, +_closeChild:function(img){ +try{ +img=this.getImgBeforeIcon().img; +this.struct.open=false; +if(this.isSelected()&& this.getCloseIconSelected()){ +this.img.src=this.tree.imgBase+this.getCloseIconSelected(); +} else{ +this.img.src=this.tree.imgBase+this.struct.imgclose; +} +for(var i=0;i<this.obj.childNodes.length;i++){ +if(this.obj.childNodes[i].nodeName.toLowerCase()== 'div'){ +Element.hide(this.obj.childNodes[i]); +} +} +if(!this.isRoot){ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgPlus3:this.tree.imgBase+this.tree.imgPlus2; +} else{ +if(this.hasSiblingsBefore){ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgPlus3:this.tree.imgBase+this.tree.imgPlus2; +} else{ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgPlus4:this.tree.imgBase+this.tree.imgPlus5; +} +} +} catch(err){ +throw new Error('_closeChild(base): '+err.message); +} +}, +_openChild:function(img){ +try{ +img=this.getImgBeforeIcon().img; +this.struct.open=true; +if(this.isSelected()&& this.getOpenIconSelected()){ +this.img.src=this.tree.imgBase+this.getOpenIconSelected(); +} else{ +this.img.src=this.tree.imgBase+this.struct.imgopen; +} +for(var i=0;i<this.obj.childNodes.length;i++){ +if(this.obj.childNodes[i].nodeName.toLowerCase()== 'div'){ +this.obj.childNodes[i].style.display=''; +} +} +if(!this.isRoot){ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgMinus3:this.tree.imgBase+this.tree.imgMinus2; +} else{ +if(this.hasSiblingsBefore){ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgMinus3:this.tree.imgBase+this.tree.imgMinus2; +} else{ +img.src =(this.hasSiblingsAfter)? this.tree.imgBase+this.tree.imgMinus4:this.tree.imgBase+this.tree.imgMinus5; +} +} +} catch(err){ +throw new Error('_openChild(base): '+err.message); +} +}, +_manageLine:function(){ +try{ +for(var i=0;i<this.children.length;i++){ +this.children[i].pos=i; +if(i==this.children.length-1&&this.children[i].hasSiblingsAfter){ +this.children[i].hasSiblingsAfter=false; +this._manageMultiline(this.children[i].beforeIcon,1,false); +this._clearLine(this.children[i],this.level); +} +if(i<this.children.length-1&&!this.children[i].hasSiblingsAfter){ +this.children[i].hasSiblingsAfter=true; +this._manageMultiline(this.children[i].beforeIcon,1,true); +this._addLine(this.children[i],this.level); +} +} +this.tree._changeStruct(this); +} catch(err){ +throw new Error('_manageLine(base): '+err.message); +} +}, +_manageLineForRoot:function(add){ +for(var i=0;i<this.children.length;i++){ +this.children[i]._manageLineForRoot(add); +} +var td=this.table.getElementsByTagName('td')[0]; +var img=td.getElementsByTagName('img')[0]; +if(add){ +img.src=this.tree.imgBase+this.tree.imgLine1; +} else{ +img.src=this.tree.imgBase+this.tree.imgEmpty; +} +}, +_clearLine:function(obj,level,ok){ +try{ +for(var i=0;i<obj.children.length;i++){ +this._clearLine(obj.children[i],level,true); +} +var img=obj.table.getElementsByTagName('img')[level+1]; +if(ok){ +img.src=this.tree.imgBase+this.tree.imgEmpty; +if(this.tree.multiline){ +this._manageMultiline(img.parentNode,1,false); +} +} else{ +var old=obj.getImgBeforeIcon(); +switch(old.fullName.replace('_over','')){ +case this.tree.imgLine1 : +case this.tree.imgLine3:newImg=this.tree.imgLine2;break; +case this.tree.imgPlus1 : +case this.tree.imgPlus3:newImg=this.tree.imgPlus2;break; +case this.tree.imgMinus1: +case this.tree.imgMinus3: newImg=this.tree.imgMinus2;break; +default: +newImg=obj.fullName; +} +img.src=this.tree.imgBase+newImg; +} +} catch(err){ +throw new Error('_clearLine(base): '+err.message); +} +}, +_addLine:function(obj,level,ok){ +try{ +for(var i=0;i<obj.children.length;i++){ +this._addLine(obj.children[i],level,true); +} +var img=obj.table.getElementsByTagName('img')[level+1]; +if(ok){ +img.src=this.tree.imgBase+this.tree.imgLine1; +if(this.tree.multiline){ +this._manageMultiline(img.parentNode,1,true); +} +} else{ +var old=obj.getImgBeforeIcon(); +switch(old.fullName.replace('_over','')){ +case this.tree.imgLine1 : +case this.tree.imgLine2:newImg=this.tree.imgLine3;break; +case this.tree.imgPlus1 : +case this.tree.imgPlus2:newImg=this.tree.imgPlus3;break; +case this.tree.imgMinus1: +case this.tree.imgMinus2: newImg=this.tree.imgMinus3;break; +default: +newImg=obj.fullName; +} +img.src=this.tree.imgBase+newImg; +} +} catch(err){ +throw new Error('_addLine(base): '+err.message); +} +}, +_isChild:function(child,parent){ +try{ +if(parent.idObj==child.idObj)return true; +if(child.parent){ +return this._isChild(child.parent,parent); +} +return false; +} catch(err){ +throw new Error('_isChild(base): '+err.message); +} +}, +_setProperties:function(){ +if((typeof(this.struct.img)== 'undefined')){ +this.struct.img =(this.tree.icons[0])? this.tree.icons[0]:this.tree.imgLine0; +} +if((typeof(this.struct.imgopen)== 'undefined')){ +this.struct.imgopen =(this.tree.icons[1])? this.tree.icons[1]:this.struct.img; +} +if((typeof(this.struct.imgclose)== 'undefined')){ +this.struct.imgclose =(this.tree.icons[2])? this.tree.icons[2]:this.struct.img; +} +if((typeof(this.struct.imgselected)== 'undefined')){ +this.struct.imgselected =(this.tree.iconsSelected[0])? this.tree.iconsSelected[0]:null; +} +if((typeof(this.struct.imgopenselected)== 'undefined')){ +this.struct.imgopenselected =(this.tree.iconsSelected[1])? this.tree.iconsSelected[1]:null; +} +if((typeof(this.struct.imgcloseselected)== 'undefined')){ +this.struct.imgcloseselected =(this.tree.iconsSelected[2])? this.tree.iconsSelected[2]:null; +} +if(typeof(this.struct.open)== 'undefined'){ +this.struct.open =(this.tree.useCookie&&this.tree.cookieOpened)? false:this.tree.openAll; +} else if(this.tree.useCookie&&this.tree.cookieOpened){ +this.struct.open=false; +} +if(typeof(this.struct.check)== 'undefined' ||(this.tree.useCookie&&this.tree.cookieChecked))this.struct.check=0; +if(typeof(this.struct.items)== 'undefined'){ +this.struct.items=[]; +} +if(typeof(this.struct.canhavechildren)== 'undefined')this.struct.canhavechildren=false; +if(typeof(this.struct.id)== 'undefined')this.struct.id=this.idObj; +if(typeof(this.struct.acceptdrop)== 'undefined')this.struct.acceptdrop=true; +if(typeof(this.struct.last)== 'undefined')this.struct.last=false; +if(typeof(this.struct.editable)== 'undefined')this.struct.editable=this.tree.editableBranches; +if(typeof(this.struct.checkbox)== 'undefined')this.struct.checkbox=true; +}, +_setFunctions:function(){ +if(typeof(this.struct.ondragstarteffect)== 'undefined'){ +if(typeof(this.tree.onDragStartEffect)== 'function'){ +this.struct.ondragstarteffect=this.tree.onDragStartEffect; +this.ondragstarteffectDefault=true; +} +} else{this.struct.ondragstarteffect=eval(this.struct.ondragstarteffect);} +if(typeof(this.struct.ondragendeffect)== 'undefined'){ +if(typeof(this.tree.onDragEndEffect)== 'function'){ +this.struct.ondragendeffect=this.tree.onDragEndEffect; +this.ondragendeffectDefault=true; +} +} else{this.struct.ondragendeffect=eval(this.struct.ondragendeffect);} +if(typeof(this.struct.onerrorajax)== 'undefined'){ +if(typeof(this.tree.onErrorAjax)== 'function'){ +this.struct.onerrorajax=this.tree.onErrorAjax; +this.onerrorajaxDefault=true; +} +} else{this.struct.onerrorajax=eval(this.struct.onerrorajax);} +if(typeof(this.struct.oneditajax)== 'undefined'){ +if(this.tree.onEditAjax&&typeof(this.tree.onEditAjax.func)== 'function'){ +this.struct.oneditajax=this.tree.onEditAjax.func; +this.struct.editlink=this.tree.onEditAjax.link; +this.oneditajaxDefault=true; +} +} else{this.struct.oneditajax=eval(this.struct.oneditajax);} +if(typeof(this.struct.onopenpopulate)== 'undefined'){ +if(this.tree.onOpenPopulate&&typeof(this.tree.onOpenPopulate.func)== 'function'){ +this.struct.onopenpopulate=this.tree.onOpenPopulate.func; +this.struct.openlink=this.tree.onOpenPopulate.link; +this.onopenpopulateDefault=true; +} +} else{this.struct.onopenpopulate=eval(this.struct.onopenpopulate);} +if(typeof(this.struct.onedit)== 'undefined'){ +if(typeof(this.tree.onEdit)== 'function'){ +this.struct.onedit=this.tree.onEdit; +this.oneditDefault=true; +} +} else{this.struct.onedit=eval(this.struct.onedit);} +if(typeof(this.struct.oncheck)== 'undefined'){ +if(typeof(this.tree.onCheck)== 'function'){ +this.struct.oncheck=this.tree.onCheck; +this.oncheckDefault=true; +} +} else{this.struct.oncheck=eval(this.struct.oncheck);} +if(typeof(this.struct.onbeforecheck)== 'undefined'){ +if(typeof(this.tree.onBeforeCheck)== 'function'){ +this.struct.onbeforecheck=this.tree.onBeforeCheck; +this.onbeforecheckDefault=true; +} +} else{this.struct.onbeforecheck=eval(this.struct.onbeforecheck);} +if(typeof(this.struct.onopen)== 'undefined'){ +if(typeof(this.tree.onOpen)== 'function'){ +this.struct.onopen=this.tree.onOpen; +this.onopenDefault=true; +} +} else{this.struct.onopen=eval(this.struct.onopen);} +if(typeof(this.struct.onbeforeopen)== 'undefined'){ +if(typeof(this.tree.onBeforeOpen)== 'function'){ +this.struct.onbeforeopen=this.tree.onBeforeOpen; +this.onbeforeopenDefault=true; +} +} else{this.struct.onbeforeopen=eval(this.struct.onbeforeopen);} +if(typeof(this.struct.onmouseover)== 'undefined'){ +if(typeof(this.tree.onMouseOver)== 'function'){ +this.struct.onmouseover=this.tree.onMouseOver; +this.onmouseoverDefault=true; +} +} else{this.struct.onmouseover=eval(this.struct.onmouseover);} +if(typeof(this.struct.onmouseout)== 'undefined'){ +if(typeof(this.tree.onMouseOut)== 'function'){ +this.struct.onmouseout=this.tree.onMouseOut; +this.onmouseoutDefault=true; +} +} else{this.struct.onmouseout=eval(this.struct.onmouseout);} +if(typeof(this.struct.onmousedown)== 'undefined'){ +if(typeof(this.tree.onMouseDown)== 'function'){ +this.struct.onmousedown=this.tree.onMouseDown; +this.onmousedownDefault=true; +} +} else{this.struct.onmousedown=eval(this.struct.onmousedown);} +if(typeof(this.struct.onmouseup)== 'undefined'){ +if(typeof(this.tree.onMouseUp)== 'function'){ +this.struct.onmouseup=this.tree.onMouseUp; +this.onmouseupDefault=true; +} +} else{this.struct.onmouseup=eval(this.struct.onmouseup);} +if(typeof(this.struct.onclick)== 'undefined'){ +if(typeof(this.tree.onClick)== 'function'){ +this.struct.onclick=this.tree.onClick; +this.onclickDefault=true; +} +} else{this.struct.onclick=eval(this.struct.onclick);} +if(typeof(this.struct.ondblclick)== 'undefined'){ +if(typeof(this.tree.onDblClick)== 'function'){ +this.struct.ondblclick=this.tree.onDblClick; +this.ondblclickDefault=true; +} +} else{this.struct.ondblclick=eval(this.struct.ondblclick);} +}, +_setActions:function(){ +if(this.struct.select){ +this.select(); +} +}, +_setEvents:function(event,tdImg){ +Event.observe(this.txt,'mousedown',this.setMouseDown.bindAsEventListener(this),false); +Event.observe(this.txt,'mouseup',this.setMouseUp.bindAsEventListener(this),false); +if(typeof(this.struct.onclick)== 'function'){ +Event.observe(event,'click',this.setClick.bindAsEventListener(this),false); +} +if(typeof(this.struct.ondblclick)== 'function'||this.struct.editable){ +Event.observe(event,'dblclick',this.setDblClick.bindAsEventListener(this),false); +} +if(typeof(this.struct.onmouseover)== 'function'){ +Event.observe(event,'mouseover',this.setMouseOver.bindAsEventListener(this),false); +} +if(typeof(this.struct.onmouseout)== 'function'){ +Event.observe(event,'mouseout',this.setMouseOut.bindAsEventListener(this),false); +} +if(this.struct.editable &&(typeof(this.struct.onedit)== 'function'||typeof(this.struct.oneditajax)== 'function')){ +this.editableInput=document.createElement('input'); +this.editableInput.setAttribute('type','text'); +this.editableInput.setAttribute('autocomplete','off'); +this.editableInput.className=this.tree.classEditable; +event.appendChild(this.editableInput); +Event.observe(this.editableInput,'blur',this.hideEditable.bindAsEventListener(this),false); +} +if(!this.isRoot){ +if(this.struct.draggable &&(typeof(this.struct.ondrop)== 'function'||typeof(this.struct.ondropajax)== 'function')){ +this.objDrag=new Draggable(this.txt,{ +revert: this.tree.dragRevert, +starteffect:this.ondragstarteffect.bindAsEventListener(this), +endeffect:this.ondragendeffect.bindAsEventListener(this) +}); +Element.addClassName(this.txt,this.tree.classDrag); +} +} +if(this.struct.acceptdrop){ +Droppables.add(this.txt,{hoverclass: this.tree.classDragOver,onDrop: this.setDrop.bindAsEventListener(this)}); +} +if(this.struct.tooltip){ +Event.observe(event,'mouseover',this.evt_showTooltip.bindAsEventListener(this),false); +Event.observe(event,'mouseout',this.evt_hideTooltip.bindAsEventListener(this),false); +} +if(this.tree.checkboxes&&this.struct.checkbox){ +if(this.struct.check==1)imgc=this.tree.imgCheck2; +else if(this.struct.check==-1)imgc=this.tree.imgCheck3; +else imgc=this.tree.imgCheck1; +this.checkbox=document.createElement('img'); +this.checkbox.src=this.tree.imgBase+imgc; +tdImg.appendChild(this.checkbox); +Event.observe(this.checkbox,'click',this.checkOnClick.bindAsEventListener(this),false); +Event.observe(this.checkbox,'mouseover',this.evt_openMouseOver.bindAsEventListener(this),false); +Event.observe(this.checkbox,'mouseout',this.evt_openMouseOut.bindAsEventListener(this),false); +} else if(this.tree.checkboxes){ +var vide=document.createElement('img'); +vide.src=this.tree.imgBase+this.tree.imgEmpty; +tdImg.appendChild(vide); +} +}, +_getImgBeforeIcon:function(){ +try{ +var td=document.createElement('td'); +var img=document.createElement('img'); +Element.addClassName(img,this.tree.classOpenable); +if(this.hasSiblingsAfter){ +if(!this.hasChildren()){ +if(this.isRoot){ +img.src=this.tree.imgBase +((this.hasSiblingsBefore)? this.tree.imgLine3:this.tree.imgLine4); +} else{ +img.src=this.tree.imgBase+this.tree.imgLine3; +} +} else{ +Event.observe(img,'click',this.setOpen.bindAsEventListener(this),false); +Event.observe(img,'mouseover',this.evt_openMouseOver.bindAsEventListener(this),false); +Event.observe(img,'mouseout',this.evt_openMouseOut.bindAsEventListener(this),false); +if(this.isRoot){ +img.src=this.tree.imgBase +((this.hasSiblingsBefore)? this.tree.imgMinus3:this.tree.imgMinus4); +} else{ +img.src=this.tree.imgBase+this.tree.imgMinus3; +} +} +if(this.tree.multiline){ +this._manageMultiline(td,(this.isRoot ? 2:1),true); +} +} else{ +if(!this.hasChildren()){ +if(this.isRoot){ +img.src=this.tree.imgBase +((this.hasSiblingsBefore)? this.tree.imgLine2:this.tree.imgEmpty); +} else{ +img.src=this.tree.imgBase+this.tree.imgLine2; +} +} else{ +Event.observe(img,'click',this.setOpen.bindAsEventListener(this),false); +Event.observe(img,'mouseover',this.evt_openMouseOver.bindAsEventListener(this),false); +Event.observe(img,'mouseout',this.evt_openMouseOut.bindAsEventListener(this),false); +if(this.isRoot){ +img.src=this.tree.imgBase +((this.hasSiblingsBefore)? this.tree.imgMinus2:this.tree.imgMinus5); +} else{ +img.src=this.tree.imgBase+this.tree.imgMinus2; +} +} +} +td.appendChild(img); +return td; +} catch(err){ +throw new Error('_getImgBeforeIcon(base): '+err.message); +} +}, +_setChildren:function(root){ +if(this.hasChildren()){ +if(this.tree.bigTreeLoading>=0){ +this.loaded=false; +this.bigTreeLoading=0; +setTimeout(this._generate.bind(this),10); +} else{ +for(var i=0;i<this.struct.items.length;i++){ +if(this.tree.checkboxesThreeState&&this.struct.check&&typeof(this.struct.items[i].check)== 'undefined'){ +this.struct.items[i].check=1; +} +isNotFirst =(i>0)? true:false; +isNotLast =(i<this.struct.items.length-1)? true:false; +this.children[i]=new TafelTreeBranch(root,this,this.struct.items[i],this.level+1,isNotFirst,isNotLast,i); +this.obj.appendChild(this.children[i].obj); +} +this.openIt(this.struct.open); +} +} +}, +_setWaitImg:function(branch,wait,localPropagationStop){ +try{ +this.inProcess=wait; +if(wait){ +branch.oldImgSrc=branch.img.src; +branch.img.src=branch.tree.imgBase+branch.tree.imgWait; +branch.eventable=false; +} else{ +branch.eventable=true; +branch.img.src=branch.oldImgSrc; +} +if(this.tree.propagation&&!localPropagationStop){ +for(var i=0;i<branch.children.length;i++){ +this._setWaitImg(branch.children[i],wait); +} +} +} catch(err){ +throw new Error('_setWaitImg(base): '+err.message); +} +}, +_openPopulate:function(ev){ +try{ +this._setWaitImg(this,true); +var params='branch='+this.serialize()+ '&branch_id='+this.getId()+ '&tree_id='+this.tree.id; +var otherParams=this.tree.getURLParams(this.struct.openlink); +for(var i=0;i<otherParams.length;i++){ +params += '&'+otherParams[i].name+'='+otherParams[i].value; +} +new Ajax.Updater( +this.tree.ajaxObj, +this.struct.openlink, +{ +'method' :'post', +'parameters':params, +'evalScripts': true, +'onComplete':function(event){this._completeOpenPopulate(event);}.bind(this), +'onFailure':function(event){this._failureOpenPopulate(event);}.bind(this) +} +); +} catch(err){ +this._setWaitImg(this,false); +throw('_openPopulate(base): '+err.message); +} +}, +_failureOpenPopulate:function(){ +this._setWaitImg(this,false); +if(typeof(this.struct.onerrorajax)== 'function'){ +this.struct.onerrorajax('open','failure request',this); +} +}, +_completeOpenPopulate:function(response){ +try{ +this._setWaitImg(this,false); +var rep=this.struct.onopenpopulate(this,response.responseText); +if(rep){ +rep =(rep === true)? response.responseText:rep; +var items=eval(rep); +if(items){ +var ok=[]; +for(var i=0 ;i<items.length;i++){ +if(this.tree.getBranchById(items[i].id))continue; +if(typeof(items[i].id)== 'undefined'||typeof(items[i].txt)== 'undefined'){ +throw new Error(TAFELTREE_WRONG_BRANCH_STRUCTURE); +} +ok.push(this.insertIntoLast(items[i])); +} +if(this.tree.useCookie&&this.tree.cookieOpened&&this.tree.reopenFromServer){ +var okay=false; +for(var o=0;o<ok.length;o++){ +okay=false; +for(var i=0;i<this.tree.cookieOpened.length;i++){ +if(this.tree.cookieOpened[i]==ok[o].getId()){ +okay=true; +break; +} +} +if(okay){ +if(typeof(ok[o].struct.onopenpopulate)== 'function'&&ok[o].eventable){ +ok[o]._openPopulate(); +ok[o].openIt(true); +} +} +} +} +} +} +} catch(err){ +this._setWaitImg(this,false); +if(typeof(this.struct.onerrorajax)== 'function'){ +this.struct.onerrorajax('open',response.responseText,this); +} else{ +alert('_completeOpenPopulate('+response.responseText+'): '+err.message); +} +} +}, +_setDropAjax:function(newParentObj,asSibling,copydrag,ev){ +try{ +this._setWaitImg(this,true); +var sibling =(asSibling)? 1:0; +var cdrag =(copydrag)? 1:0; +var params='drag='+this.serialize()+ '&drag_id='+this.getId()+ '&drop='+newParentObj.serialize()+ '&drop_id='+newParentObj.getId(); +params += '&treedrag_id='+this.tree.id+'&treedrop_id='+newParentObj.tree.id+'&sibling='+sibling+'©drag='+cdrag; +if(cdrag){ +var cdragId=this.id+this.tree.copyNameBreak+this.tree.idTree; +params += '©drag_id='+cdragId; +} +var otherParams=this.tree.getURLParams(this.struct.droplink); +for(var i=0;i<otherParams.length;i++){ +params += '&'+otherParams[i].name+'='+otherParams[i].value; +} +this.newParent=newParentObj; +this.asSibling=asSibling; +this.copyDrag=cdrag; +new Ajax.Updater( +this.tree.ajaxObj, +this.struct.droplink, +{ +'method' :'post', +'parameters':params, +'evalScripts': true, +'onComplete':function(event){this._completeDropAjax(event);}.bind(this), +'onFailure':function(event){this._failureDropAjax(event);}.bind(this) +} +); +} catch(err){ +this._setWaitImg(this,false); +throw('_setDropAjax(base): '+err.message); +} +}, +_failureDropAjax:function(){ +this._setWaitImg(this,false); +if(typeof(this.struct.onerrorajax)== 'function'){ +this.struct.onerrorajax('drop','failure request',this,this.newParent); +} +}, +_completeDropAjax:function(response){ +try{ +if(this.struct.ondropajax(this,this.newParent,response.responseText,false,null)){ +var newBranch=null; +if(!this.asSibling){ +if(!this.copyDrag){ +this.move(this.newParent); +} else{ +newBranch=this.newParent.insertIntoLast(this.clone()); +} +} else{ +if(!this.copyDrag){ +this.moveBefore(this.newParent); +} else{ +newBranch=this.newParent.insertBefore(this.clone()); +} +} +this.struct.ondropajax(this,this.newParent,response.responseText,true,newBranch); +} +this._setWaitImg(this,false); +} catch(err){ +if(typeof(this.struct.onerrorajax)== 'function'){ +this.struct.onerrorajax('drop',response.responseText,this,this.newParent); +} else{ +alert('_completeDropAjax(base): '+err.message); +} +} +}, +_editAjax:function(newValue,oldValue,ev){ +try{ +this._setWaitImg(this,true,true); +var params='branch='+this.serialize()+ '&branch_id='+this.getId()+ '&tree_id='+this.tree.id; +params += '&new_value='+newValue+'&old_value='+oldValue; +var otherParams=this.tree.getURLParams(this.struct.editlink); +for(var i=0;i<otherParams.length;i++){ +params += '&'+otherParams[i].name+'='+otherParams[i].value; +} +new Ajax.Updater( +this.tree.ajaxObj, +this.struct.editlink, +{ +'method' :'post', +'parameters':params, +'evalScripts': true, +'onComplete':function(event){this._completeEditAjax(event);}.bind(this), +'onFailure':function(event){this._failureEditAjax(event);}.bind(this) +} +); +} catch(err){ +this._setWaitImg(this,false,true); +throw('_editAjax(base): '+err.message); +} +}, +_failureEditAjax:function(){ +this._setWaitImg(this,false); +if(typeof(this.struct.onerrorajax)== 'function'){ +this.struct.onerrorajax('edit','failure request',this); +} +}, +_completeEditAjax:function(response){ +try{ +this._setWaitImg(this,false,true); +var rep=this.struct.oneditajax(this,response.responseText,this.txt.innerHTML); +if(rep){ +this.setText((rep === true ? response.responseText:rep)); +} +this.hideEditableElement(); +} catch(err){ +this._setWaitImg(this,false,true); +if(typeof(this.struct.onerrorajax)== 'function'){ +this.struct.onerrorajax('edit',response.responseText,this); +} else{ +alert('_completeOpenPopulate('+response.responseText+'): '+err.message); +} +} +}, +evt_openMouseOver:function(ev){ +if(Event.element){ +var obj=Event.element(ev); +var img=this._getImgInfo(obj); +obj.src=this.tree.imgBase+img.type+'_over'+img.number+'.gif'; +} +}, +evt_openMouseOut:function(ev){ +if(Event.element){ +var obj=Event.element(ev); +var img=this._getImgInfo(obj); +obj.src=this.tree.imgBase+img.type.replace(/_over/g,'')+ img.number+'.gif'; +} +}, +evt_showTooltip:function(ev){ +this.displayTooltip=true; +setTimeout(this.showTooltip.bind(this),this.tree.durationTooltipShow); +}, +evt_hideTooltip:function(ev){ +this.displayTooltip=false; +setTimeout(this.hideTooltip.bind(this),this.tree.durationTooltipHide); +}, +setMouseOver:function(ev){ +if(typeof(this.struct.onmouseover)== 'function'){ +return this.struct.onmouseover(this,ev); +} +}, +setMouseOut:function(ev){ +if(typeof(this.struct.onmouseout)== 'function'){ +return this.struct.onmouseout(this,ev); +} +}, +setMouseDown:function(ev){ +this.tree.evt_setAsCurrent(ev); +if(this.tree.selectedBranchShowed){ +if(!this.isSelected()){ +this.select(ev); +this.okayForUnselect=false; +} else{ +this.okayForUnselect=true; +} +} +if(this.tooltip){ +this.displayTooltip=false; +this.hideTooltip(); +} +if(typeof(this.struct.onmousedown)== 'function'){ +this.struct.onmousedown(this,ev); +} +}, +setMouseUp:function(ev){ +if(this.tree.lastEdited){ +this.tree.lastEdited.hideEditable(ev); +} +if(this.isSelected()&& this.okayForUnselect){ +return true; +} +this.okayForUnselect=true; +if(typeof(this.struct.onmouseup)== 'function'){ +this.struct.onmouseup(this,ev); +} +}, +setClick:function(ev){ +if(this.tree.lastEdited)return false; +if(typeof(this.struct.onclick)== 'function'){ +return this.struct.onclick(this,ev); +} +}, +checkOnClick:function(ev){ +if(this.tree.checkboxes&&this.checkbox){ +var checked =(this.isChecked()> 0)? 0:1; +var ok=true; +if(typeof(this.struct.onbeforecheck)== 'function'){ +ok=this.struct.onbeforecheck(this,checked,ev); +} +if(ok){ +this.check(checked); +if(this.tree.checkboxesThreeState){ +this._manageCheckThreeState(this,checked); +this._adjustParentCheck(); +} +if(typeof(this.struct.oncheck)== 'function'){ +this.struct.oncheck(this,checked,ev); +} +} +} +}, +setOpen:function(ev){ +if(!this.hasChildren())return false; +var ok=true; +if(typeof(this.struct.onbeforeopen)== 'function'){ +ok=this.struct.onbeforeopen(this,this.struct.open,ev); +} +if(!ok)return false; +if(typeof(this.struct.onopenpopulate)== 'function'&&!this.eventable)return false; +this.openIt((this.isOpened())? false:true); +if(typeof(this.struct.onopen)== 'function'){ +return this.struct.onopen(this,this.struct.open,ev); +} else if(typeof(this.struct.onopenpopulate)== 'function'&&this.isOpened()&& this.children.length==0){ +if(!this.eventable)return false; +return this._openPopulate(ev); +} +return true; +}, +ondragstarteffect:function(drag,dragbis){ +var dragObj=this.tree.getBranchByIdObj(drag.id); +if(!dragObj){ +for(var i=0;i<this.tree.otherTrees.length;i++){ +dragObj=this.tree.otherTrees[i].getBranchByIdObj(drag.id); +if(dragObj)break; +} +if(!dragObj)return false; +} +if(typeof(dragObj.struct.ondragstarteffect)== 'function'){ +var ok=dragObj.struct.ondragstarteffect(dragObj); +} +}, +ondragendeffect:function(drag,dragbis){ +var dragObj=this.tree.getBranchByIdObj(drag.id); +if(!dragObj){ +for(var i=0;i<this.tree.otherTrees.length;i++){ +dragObj=this.tree.otherTrees[i].getBranchByIdObj(drag.id); +if(dragObj)break; +} +if(!dragObj)return false; +} +if(typeof(dragObj.struct.ondragendeffect)== 'function'){ +var ok=dragObj.struct.ondragendeffect(dragObj); +} +}, +setDrop:function(drag,html,html2,ev){ +var dragObj=this.tree.getBranchByIdObj(drag.id); +if(!dragObj){ +for(var i=0;i<this.tree.otherTrees.length;i++){ +dragObj=this.tree.otherTrees[i].getBranchByIdObj(drag.id); +if(dragObj)break; +} +if(!dragObj)return false; +} +var alt =(dragObj.tree.dropALT)? TafelTreeManager.altOn(ev): false; +var ctrl =(dragObj.tree.dropCTRL)? TafelTreeManager.ctrlOn(ev)|| TafelTreeManager.metaOn(ev): false; +var ok=true; +if((this.tree.id==dragObj.tree.id&&this.isChild(dragObj))|| !dragObj.eventable||!this.eventable)return false; +if(typeof(dragObj.struct.ondrop)== 'function'){ +ok=dragObj.struct.ondrop(dragObj,this,false,null,ev); +} +if(ok){ +var asSibling =((dragObj.tree.behaviourDrop==1||dragObj.tree.behaviourDrop==3)&& !alt ||(dragObj.tree.behaviourDrop==0||dragObj.tree.behaviourDrop==2)&& alt)? true:false; +var copyDrag =((dragObj.tree.behaviourDrop==2||dragObj.tree.behaviourDrop==3)&& !ctrl ||(dragObj.tree.behaviourDrop==0||dragObj.tree.behaviourDrop==1)&& ctrl)? true:false; +if(!asSibling&&typeof(this.struct.onopenpopulate)== 'function'&&!this.isOpened()&& this.children.length==0){ +this._openPopulate(ev); +} +if(typeof(dragObj.struct.ondropajax)== 'function'){ +dragObj._setDropAjax(this,asSibling,copyDrag,ev); +} else{ +var newBranch=null; +if(!asSibling){ +if(!copyDrag){ +dragObj.move(this); +} else{ +newBranch=this.insertIntoLast(dragObj.clone()); +} +} else{ +if(!copyDrag){ +dragObj.moveBefore(this); +} else{ +newBranch=this.insertBefore(dragObj.clone()); +} +} +if(typeof(dragObj.struct.ondrop)== 'function'){ +ok=dragObj.struct.ondrop(dragObj,this,true,newBranch,ev); +} +} +} +}, +setDblClick:function(ev){ +if(this.tree.lastEdited)return false; +if(typeof(this.struct.ondblclick)== 'function'){ +this.struct.ondblclick(this,ev); +} +if(this.struct.editable&&this.editableInput){ +if(!this.tree.lastEdited||this.tree.lastEdited.getId()!= this.getId()){ +this.editableInput.style.width =(this.txt.offsetWidth+20)+ 'px'; +} +Element.hide(this.txt); +this.editableInput.value=this.txt.innerHTML; +this.editableInput.style.display='block'; +this.editableInput.focus(); +this.tree.lastEdited=this; +} +}, +hideEditable:function(ev){ +if(this.editableInput&&this.struct.editable){ +var obj=this.editableInput; +var value=obj.value; +if(this.struct.oneditajax){ +if(!this.eventable)return false; +this._editAjax(obj.value,this.txt.innerHTML,ev); +} else{ +if(typeof(this.struct.onedit)== 'function'){ +value=this.struct.onedit(this,obj.value,this.txt.innerHTML,ev); +} +this.setText(value); +this.hideEditableElement(); +} +return true; +} +return false; +}, +hideEditableElement:function(){ +Element.hide(this.editableInput); +this.editableInput.value=this.getText(); +this.txt.style.display='block'; +this.tree.lastEdited=null; +} +}; +var TafelTreeRoot=Class.create(); +TafelTreeRoot.prototype=Object.extend(new TafelTreeBaseBranch,{ +initialize:function(tree,struct,level,before,after,pos){ +this.isRoot=true; +this.tree=tree; +this.pos=pos; +this.level=level; +this.struct=struct; +this.tree.idTree++; +this.idObj=this.tree.idTreeBranch+this.tree.idTree; +this.hasSiblingsBefore=before; +this.hasSiblingsAfter=after; +this.eventable=true; +this.loaded=true; +this.children=[]; +this.copiedTimes=0; +this._setProperties(); +this._setFunctions(); +this.obj=this._addRoot(); +this.content=this._addContent(); +this.obj.appendChild(this.table); +this._setChildren(this); +this._setActions(); +}, +insertBefore:function(item){ +if(this.parent)return false; +var pos=this.pos; +var posBefore=pos+1; +var isNotFirst =(pos==0)? false:true; +this._movePartStructRoot(pos); +this.tree.roots[pos]=new TafelTreeRoot(this.tree,item,this.level,isNotFirst,true,pos); +this.tree.div.insertBefore(this.tree.roots[pos].obj,this.obj); +this._manageAfterRootInsert(pos); +return this.tree.roots[pos]; +}, +insertAfter:function(item){ +if(this.parent)return false; +var pos=this.pos+1; +var posBefore=pos+1; +var isNotLast =(pos==this.tree.roots.length)? false:true; +this._movePartStructRoot(pos); +this.tree.roots[pos]=new TafelTreeRoot(this.tree,item,this.level,true,isNotLast,pos); +try{ +this.tree.div.insertBefore(this.tree.roots[pos].obj,this.tree.roots[posBefore].obj); +} catch(err){ +this.tree.div.appendChild(this.tree.roots[pos].obj); +} +this._manageAfterRootInsert(pos); +return this.tree.roots[pos]; +}, +_manageAfterRootInsert:function(pos){ +for(var i=0;i<this.tree.roots.length;i++){ +if(i<this.tree.roots.length-1){ +this.tree.roots[i].hasSiblingsAfter=true; +} +if(i>0){ +this.tree.roots[i].hasSiblingsBefore=true; +} +} +for(var i=0;i<this.children.length;i++){ +this.children[i]._manageLineForRoot(this.hasSiblingsAfter); +} +}, +_movePartStructRoot:function(pos){ +var nb=this.tree.roots.length-1; +var newPos=0; +for(var i=nb;i>=pos;i--){ +newPos=i+1; +this.tree.roots[newPos]=this.tree.roots[i]; +this.tree.roots[newPos].pos=newPos; +} +}, +_addRoot:function(){ +var div=document.createElement('div'); +div.className=this.tree.classTreeRoot; +return div; +}, +_addContent:function(){ +var table=document.createElement('table'); +var tbody=document.createElement('tbody'); +var tr=document.createElement('tr'); +var tdImg=document.createElement('td'); +var tdTxt=document.createElement('td'); +var img=document.createElement('img'); +var span=document.createElement('div'); +var txt=document.createTextNode(txt); +img.src=this.tree.imgBase+this.struct.img; +span.innerHTML=this.struct.txt; +if(this.struct.title){ +span.setAttribute('title',this.struct.title); +} +span.setAttribute('id',this.idObj); +Element.addClassName(span,this.tree.classContent); +Element.addClassName(tdTxt,this.tree.classCanevas); +tdTxt.appendChild(span); +tdImg.appendChild(img); +if(this.struct.tooltip){ +this.tooltip=this._createTooltip(); +tdTxt.appendChild(this.tooltip); +} +this.tdImg=tdImg; +this.beforeIcon=this._getImgBeforeIcon(); +tr.appendChild(this.beforeIcon); +tr.appendChild(tdImg); +tr.appendChild(tdTxt); +tbody.appendChild(tr); +table.appendChild(tbody); +if(this.tree.multiline){ +tdTxt.style.whiteSpace='normal'; +if(this.hasChildren())this._manageMultiline(this.tdImg,2,true); +} +if(this.struct.style){ +Element.addClassName(tdTxt,this.struct.style); +} +this.txt=span; +this.img=img; +this.table=table; +this._setEvents(tdTxt,tdImg); +return tbody; +} +}); +var TafelTreeBranch=Class.create(); +TafelTreeBranch.prototype=Object.extend(new TafelTreeBaseBranch,{ +initialize:function(root,parent,struct,level,before,after,pos){ +this.tree=root.tree; +this.root=root; +this.level=level; +this.pos=pos; +this.parent=parent; +this.tree.idTree++; +this.idObj=this.tree.idTreeBranch+this.tree.idTree; +this.hasSiblingsBefore=before; +this.hasSiblingsAfter=after; +this.struct=struct; +this.eventable=true; +this.loaded=true; +this.inProcess=false; +this.children=[]; +this.copiedTimes=0; +if(typeof(this.struct.draggable)== 'undefined')this.struct.draggable=1; +this._setProperties(); +if(typeof(this.struct.ondrop)== 'undefined'){ +if(typeof(this.tree.onDrop)== 'function'){ +this.struct.ondrop=this.tree.onDrop; +this.ondropDefault=true; +} +} else{this.struct.ondrop=eval(this.struct.ondrop);} +if(typeof(this.struct.ondropajax)== 'undefined'){ +if(this.tree.onDropAjax&&typeof(this.tree.onDropAjax.func)== 'function'){ +this.struct.ondropajax=this.tree.onDropAjax.func; +this.struct.droplink=this.tree.onDropAjax.link; +this.ondropajaxDefault=true; +} +} else{this.struct.ondropajax=eval(this.struct.ondropajax);} +this._setFunctions(); +this.obj=this._addBranch(); +this.content=this._addContent(); +this.obj.appendChild(this.table); +this._setChildren(root); +this._setActions(); +}, +insertBefore:function(item){ +if(!this.parent)return false; +var pos=this.pos; +var posBefore=pos+1; +var isNotFirst =(pos==0)? false:true; +this.parent._movePartStruct(pos); +this.parent.struct.items[pos]=item; +this.parent.children[pos]=new TafelTreeBranch(this.root,this.parent,item,this.level,isNotFirst,true,pos); +this.parent.obj.insertBefore(this.parent.children[pos].obj,this.obj); +this.parent._manageAfterInsert(pos); +return this.parent.children[pos]; +}, +insertAfter:function(item){ +if(!this.parent)return false; +var pos=this.pos+1; +var posBefore=pos+1; +var isNotLast =(pos==this.parent.children.length)? false:true; +this.parent._movePartStruct(pos); +this.parent.struct.items[pos]=item; +this.parent.children[pos]=new TafelTreeBranch(this.root,this.parent,item,this.level,true,isNotLast,pos); +try{ +this.parent.obj.insertBefore(this.parent.children[pos].obj,this.parent.children[posBefore].obj); +} catch(err){ +this.parent.obj.appendChild(this.parent.children[pos].obj); +} +this.parent._manageAfterInsert(pos); +return this.parent.children[pos]; +}, +move:function(hereb){ +return this.moveIntoLast(hereb); +}, +moveIntoLast:function(hereb){ +var here=this.tree.getBranchById(hereb); +if(!here)return false +var pos=here._getPos(); +var id=this.getId(); +var txt=this.getText(); +if(pos==here.children.length){ +obj=here.insertIntoLast(this.struct); +} else{ +obj=here.children[pos].insertBefore(this.struct); +} +this.tree.removeBranch(this); +return obj; +}, +moveIntoFirst:function(hereb){ +var here=this.tree.getBranchById(hereb); +if(!here)return false +var id=this.getId(); +var txt=this.getText(); +var obj=here.insertIntoFirst(this.struct); +this.tree.removeBranch(this); +return obj; +}, +moveBefore:function(hereb){ +var here=this.tree.getBranchById(hereb); +if(!here)return false; +var id=this.getId(); +var txt=this.getText(); +var obj=here.insertBefore(this.struct); +this.tree.removeBranch(this); +return obj; +}, +moveAfter:function(hereb){ +var here=this.tree.getBranchById(hereb); +if(!here)return false; +var id=this.getId(); +var txt=this.getText(); +var obj=here.insertAfter(this.struct); +this.tree.removeBranch(this); +return obj; +}, +_addBranch:function(){ +var div=document.createElement('div'); +div.className=this.tree.classTreeBranch; +return div; +}, +_addContent:function(){ +var table=document.createElement('table'); +var tbody=document.createElement('tbody'); +var tr=document.createElement('tr'); +var img=document.createElement('img'); +var imgs=this._addImgs(); +var nbImgs=imgs.length; +for(var i=nbImgs-1;i>=0;i--){ +tr.appendChild(imgs[i]); +} +this.beforeIcon=this._getImgBeforeIcon(); +tr.appendChild(this.beforeIcon); +var tdImg=document.createElement('td'); +var tdTxt=document.createElement('td'); +var img=document.createElement('img'); +var span=document.createElement('div'); +span.innerHTML=this.struct.txt; +if(this.struct.title){ +span.setAttribute('title',this.struct.title); +} +span.setAttribute('id',this.idObj); +Element.addClassName(span,this.tree.classContent); +Element.addClassName(tdTxt,this.tree.classCanevas); +img.src=this.tree.imgBase+this.struct.img; +this.tdImg=tdImg; +if(this.tree.multiline){ +tdTxt.style.whiteSpace='normal'; +if(this.hasChildren())this._manageMultiline(this.tdImg,2,true); +} +if(this.struct.style){ +Element.addClassName(tdTxt,this.struct.style); +} +tdTxt.appendChild(span); +if(this.struct.tooltip){ +this.tooltip=this._createTooltip(); +tdTxt.appendChild(this.tooltip); +} +tdImg.appendChild(img); +tr.appendChild(tdImg); +tr.appendChild(tdTxt); +tbody.appendChild(tr); +table.appendChild(tbody); +this.tdImg=tdImg; +this.txt=span; +this.img=img; +this.table=table; +this._setEvents(tdTxt,tdImg); +return tbody; +}, +_addImgs:function(){ +var obj=this.parent; +var cpt=0; +var imgs=[]; +var img=null; +var td=null; +while(obj.parent){ +td=document.createElement('td'); +img=document.createElement('img'); +if(!obj.hasSiblingsAfter){ +img.src=this.tree.imgBase+this.tree.imgEmpty; +} else{ +img.src=this.tree.imgBase+this.tree.imgLine1; +if(this.tree.multiline){ +this._manageMultiline(td,1,true); +} +} +td.appendChild(img); +imgs[cpt]=td; +cpt++; +obj=obj.parent; +} +td=document.createElement('td'); +img=document.createElement('img'); +if(!this.root.hasSiblingsAfter){ +img.src=this.tree.imgBase+this.tree.imgEmpty; +} else{ +img.src=this.tree.imgBase+this.tree.imgLine1; +if(this.tree.multiline){ +this._manageMultiline(td,1,true); +} +} +td.appendChild(img); +imgs[cpt]=td; +return imgs; +} +}); +var TafelTreeManager ={ +stopEvent:true, +keyboardEvents:true, +keyboardStructuralEvents:true, +trees:[], +currentTree:null, +userKeys:[], +setKeys:function(keys){ +this.userKeys=keys; +}, +add:function(tree){ +this.trees.push(tree); +}, +disableKeyboardEvents:function(){ +this.keyboardEvents=false; +}, +disableKeyboardStructuralEvents:function(){ +this.keyboardStructuralEvents=false; +}, +getCurrentTree:function(){ +return this.currentTree; +}, +setCurrentTree:function(tree){ +this.currentTree=tree; +}, +metaOn:function(ev){ +var ok=false; +if(ev &&(ev.metaKey)){ +ok=true; +} +return ok; +}, +ctrlOn:function(ev){ +var ok=false; +if(ev &&(ev.ctrlKey||ev.modifier==2)){ +ok=true; +} +return ok; +}, +altOn:function(ev){ +var ok=false; +if(ev &&(ev.altKey||ev.modifier==1)){ +ok=true; +} +return ok; +}, +shiftOn:function(ev){ +var ok=false; +if(ev &&(ev.shiftKey||ev.modifier==3)){ +ok=true; +} +return ok; +}, +getCode:function(ev){ +return(ev.which)? ev.which:ev.keyCode; +}, +setControlEvents:function(){ +Event.observe(document,'keypress',this.evt_keyPress.bindAsEventListener(this),false); +var body=document.getElementsByTagName('body'); +if(!body||!body[0]){ +throw new Error(TAFELTREE_NO_BODY_TAG); +} else{ +Event.observe(body[0],'mouseup',this.evt_unselect.bindAsEventListener(this),false); +} +}, +evt_unselect:function(ev){ +var obj=Event.element(ev); +var current=this.getCurrentTree(); +if(current){ +if(!Element.hasClassName(obj,current.classSelected)&& !Element.hasClassName(obj,current.classOpenable)){ +current.unselect(); +this.setCurrentTree(null); +} +} +}, +enter:function(tree,code,keys,ev){ +if(tree.lastEdited){ +tree.lastEdited.editableInput.blur(); +if(this.stopEvent)Event.stop(ev); +} +}, +escape:function(tree,code,keys,ev){ +var selected=tree.getSelectedBranches(); +var lastPos=selected.length-1; +var nounselect=false; +if(lastPos==0&&tree.lastEdited){ +if(tree.lastEdited.hideEditable(ev)){ +nounselect=true; +} +} +if(!nounselect){ +tree.unselect(); +} +tree.unsetCut(); +tree.unsetCopy(); +if(this.stopEvent)Event.stop(ev); +}, +moveStart:function(tree,code,keys,ev){ +if(!tree.lastEdited){ +tree.unselect(); +if(tree.roots.length>0){ +var branch=tree.roots[0]; +branch.select(); +} +if(this.stopEvent)Event.stop(ev); +} +}, +moveEnd:function(tree,code,keys,ev){ +if(!tree.lastEdited){ +tree.unselect(); +if(tree.roots.length>0){ +var last=tree.roots.length-1; +var branch=tree.roots[last]; +while(branch.hasChildren()){ +branch=branch.getLastBranch(); +} +branch.select(); +} +if(this.stopEvent)Event.stop(ev); +} +}, +moveUp:function(tree,code,keys,ev){ +var selected=tree.getSelectedBranches(); +var lastPos=selected.length-1; +if(!tree.lastEdited){ +if(lastPos>=0){ +var branch=selected[lastPos].getPreviousOpenedBranch(); +if(branch)branch.select(ev); +} else{ +if(typeof(tree.roots[0])!= 'undefined')tree.roots[0].select(); +} +if(this.stopEvent)Event.stop(ev); +} +}, +moveDown:function(tree,code,keys,ev){ +var selected=tree.getSelectedBranches(); +var lastPos=selected.length-1; +if(!tree.lastEdited){ +if(lastPos>=0){ +var branch=selected[lastPos].getNextOpenedBranch(); +if(branch)branch.select(ev); +} else{ +if(typeof(tree.roots[0])!= 'undefined')tree.roots[0].select(); +} +if(this.stopEvent)Event.stop(ev); +} +}, +moveRight:function(tree,code,keys,ev){ +var selected=tree.getSelectedBranches(); +var lastPos=selected.length-1; +if(!tree.lastEdited){ +if(lastPos>=0){ +var branch=selected[lastPos]; +if(branch.hasChildren()&& !branch.isOpened()){ +branch.setOpen(ev); +} else{ +if(branch.hasChildren()){ +var sel=branch.getFirstBranch(); +var sel=sel.select(ev); +} +} +} else{ +if(typeof(tree.roots[0])!= 'undefined')tree.roots[0].select(); +} +if(this.stopEvent)Event.stop(ev); +} +}, +moveLeft:function(tree,code,keys,ev){ +var selected=tree.getSelectedBranches(); +var lastPos=selected.length-1; +if(!tree.lastEdited){ +if(lastPos>=0){ +var branch=selected[lastPos]; +if(lastPos==0&&branch.hasChildren()&& branch.isOpened()){ +branch.openIt(false); +} else{ +if(!branch.isRoot)branch.parent.select(ev); +} +} else{ +if(typeof(tree.roots[0])!= 'undefined')tree.roots[0].select(); +} +if(this.stopEvent)Event.stop(ev); +} +}, +edit:function(tree,code,keys,ev){ +var selected=tree.getSelectedBranches(); +var lastPos=selected.length-1; +if(lastPos==0){ +selected[lastPos].setDblClick(ev); +} +if(this.stopEvent)Event.stop(ev); +}, +remove:function(tree,code,keys,ev){ +if(!tree.lastEdited){ +var selected=tree.getSelectedBranches(); +for(var i=0;i<selected.length;i++){ +tree.removeBranch(selected[i]); +} +if(this.stopEvent)Event.stop(ev); +} +}, +cut:function(tree,code,keys,ev){ +if(keys.ctrlKey||keys.metaKey){ +tree.cut(); +if(this.stopEvent)Event.stop(ev); +} +}, +copy:function(tree,code,keys,ev){ +if(keys.ctrlKey||keys.metaKey){ +tree.copy(); +if(this.stopEvent)Event.stop(ev); +} +}, +paste:function(tree,code,keys,ev){ +if(keys.ctrlKey||keys.metaKey){ +tree.paste(); +if(this.stopEvent)Event.stop(ev); +} +}, +undo:function(tree,code,keys,ev){ +if(keys.ctrlKey||keys.metaKey){ +tree.undo(); +if(this.stopEvent)Event.stop(ev); +} +}, +evt_keyPress:function(ev){ +var current=this.getCurrentTree(); +if(current&&this.keyboardEvents){ +var keys ={ +'ctrlKey' :this.ctrlOn(ev), +'metaKey' :this.metaOn(ev), +'altKey' :this.altOn(ev), +'shiftKey':this.shiftOn(ev) +}; +var code=this.getCode(ev); +for(var i=0;i<this.userKeys.length;i++){ +if(code==this.userKeys[i].key&&typeof(this.userKeys[i].func)== 'function'){ +if(!this.userKeys[i].func(current,code,keys,ev)){ +return false; +} +break; +} +} +switch(code){ +case Event.KEY_HOME:this.moveStart(current,code,keys,ev);break; +case Event.KEY_END:this.moveEnd(current,code,keys,ev);break; +case Event.KEY_UP:this.moveUp(current,code,keys,ev);break; +case Event.KEY_DOWN:this.moveDown(current,code,keys,ev);break; +case Event.KEY_RIGHT:this.moveRight(current,code,keys,ev);break; +case Event.KEY_LEFT:this.moveLeft(current,code,keys,ev);break; +} +if(this.keyboardStructuralEvents){ +switch(code){ +case Event.KEY_RETURN:this.enter(current,code,keys,ev);break; +case Event.KEY_ESC:this.escape(current,code,keys,ev);break; +case Event.KEY_DELETE:this.remove(current,code,keys,ev);break; +case 113: this.edit(current,code,keys,ev);break; +case 120: case 88: this.cut(current,code,keys,ev);break; +case 99:case 67: this.copy(current,code,keys,ev);break; +case 118: case 86: this.paste(current,code,keys,ev);break; +case 122: case 90: this.undo(current,code,keys,ev);break; +} +} +} +} +}; +function TafelTreeInitBase(ev){ +TafelTreeManager.setControlEvents(); +if(typeof(TafelTreeInit)== 'function'){ +TafelTreeInit(); +} +}; +Event.observe(window,'load',TafelTreeInitBase,false); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/Tree.js b/maarch_entreprise/trunk/tools/tafelTree/Tree.js new file mode 100644 index 0000000000000000000000000000000000000000..96c23dcf86f0415e38a192f43a2e69a9021c21e1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/Tree.js @@ -0,0 +1,5874 @@ +// Copyright (c) 2006 Tafel, Fabien Tafelmacher +// +// See http://membres.lycos.fr/tafelmak/arbre.php for more info +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// This is distributed under Free-BSD licence. + +/* +@todo +------------------ +check-restore default +gestion xml (load + save) +multidrop +scrolldrop +*/ + + + + + + +/** + *------------------------------------------------------------------------------ + * TafelTree Class + *------------------------------------------------------------------------------ + */ + +var TAFELTREE_WRONG_BRANCH_STRUCTURE = "La structure de la branche n'est pas correcte. Il faut au moins un id et un texte"; +var TAFELTREE_NO_BODY_TAG = "Il n'y a pas de balise BODY!"; +var TAFELTREE_DEBUG = false; + +var TafelTree = Class.create(); + +/** + * Fragment de script pour supprimer les <ul></ul> lors du loadFromUL() + */ +//TafelTree.scriptFragment = /(?:<ul.*?>)((\n|\r|.)*)*/img; + +TafelTree.version = '1.9.1'; +TafelTree.lastUpdate = '2007-07-21'; + +TafelTree.scriptFragment = /[\s]*<[/]?[ul|li].*>.*/ig; + +TafelTree.debugReturn = '<br />'; +TafelTree.debugTab = ' '; + +/** + * Attributs des LI + */ +TafelTree.prefixAttribute = 'T'; +TafelTree.textAttributes = [ + TafelTree.prefixAttribute + 'img', + TafelTree.prefixAttribute + 'imgopen', + TafelTree.prefixAttribute + 'imgclose', + TafelTree.prefixAttribute + 'imgselect', + TafelTree.prefixAttribute + 'imgselectopen', + TafelTree.prefixAttribute + 'imgselectclose', + TafelTree.prefixAttribute + 'style', + TafelTree.prefixAttribute + 'droplink', + TafelTree.prefixAttribute + 'openlink', + TafelTree.prefixAttribute + 'editlink', + TafelTree.prefixAttribute + 'tooltip', + TafelTree.prefixAttribute + 'title' +]; +TafelTree.numericAttributes = [ + TafelTree.prefixAttribute + 'canhavechildren', + TafelTree.prefixAttribute + 'acceptdrop', + TafelTree.prefixAttribute + 'draggable', + TafelTree.prefixAttribute + 'editable', + TafelTree.prefixAttribute + 'open', + TafelTree.prefixAttribute + 'check', + TafelTree.prefixAttribute + 'checkbox', + TafelTree.prefixAttribute + 'select', + TafelTree.prefixAttribute + 'last' +]; +TafelTree.functionAttributes = [ + TafelTree.prefixAttribute + 'onbeforecheck', + TafelTree.prefixAttribute + 'oncheck', + TafelTree.prefixAttribute + 'onclick', + TafelTree.prefixAttribute + 'ondblclick', + TafelTree.prefixAttribute + 'onbeforeopen', + TafelTree.prefixAttribute + 'onopen', + TafelTree.prefixAttribute + 'onedit', + TafelTree.prefixAttribute + 'oneditajax', + TafelTree.prefixAttribute + 'onmouseover', + TafelTree.prefixAttribute + 'onmouseout', + TafelTree.prefixAttribute + 'onmousedown', + TafelTree.prefixAttribute + 'onmouseup', + TafelTree.prefixAttribute + 'ondrop', + TafelTree.prefixAttribute + 'ondragstarteffect', + TafelTree.prefixAttribute + 'ondragendeffect', + TafelTree.prefixAttribute + 'onerrorajax', + TafelTree.prefixAttribute + 'ondropajax', + TafelTree.prefixAttribute + 'onopenpopulate' +]; + + + +/** + *------------------------------------------------------------------------------ + * TafelTree static methods + *------------------------------------------------------------------------------ + */ + +/** + * Constructeur d'un nouvel arbre via UL + * + * @access public + * @param string id L'id de l'élément HTML conteneur + * @param string imgBase Le path vers les images, ou les options + * @param integer width La largeur de l'arbre + * @param integer height La hauteur de l'arbre + * @param object options Les options de génération + * @return TafelTree L'arbre créé sur la base des UL - LI + */ +TafelTree.loadFromUL = function (id, imgBase, width, height, options, debug) { + // 2006-11-25 : "options" est maintenant à la place de "imgBase" + if (typeof(imgBase) == 'object') { + options = imgBase; + debug = width; + imgBase = (options.imgBase) ? options.imgBase : 'imgs/'; + width = (options.width) ? options.width : '100%'; + height = (options.height) ? options.height : 'auto'; + } + + // Suite + var obj = $(id); + var load = document.createElement('img'); + load.setAttribute('title', 'load'); + load.setAttribute('alt', 'load'); + load.src = ((imgBase) ? imgBase : 'imgs/') + 'load.gif'; + obj.parentNode.insertBefore(load, obj); + Element.hide(obj); + + var tab = ''; + var tabModel = (debug) ? TafelTree.debugTab : ''; + var rt = (debug) ? TafelTree.debugReturn : ''; + var virgule = ''; + var str = (debug) ? 'var struct = [' : '(['; + for (var i = 0; i < obj.childNodes.length; i++) { + if (obj.childNodes[i].nodeName.toLowerCase() == 'li') { + str += this._loadFromUL(obj.childNodes[i], virgule, rt, tab, tabModel); + virgule = ','; + } + } + str += rt + ((debug) ? '];' : '])'); + + var div = document.createElement('div'); + div.id = obj.id; + obj.id += '____todelete'; + obj.parentNode.insertBefore(div, obj); + if (!debug) { + var m = TafelTree.prefixAttribute; + var struct = eval(str); + var _tree = new TafelTree(id, struct, options); + } else { + div.innerHTML = str.replace(/</img, '<'); + var _tree = str; + } + obj.parentNode.removeChild(load); + obj.parentNode.removeChild(obj); + return _tree; +}; + +/** + * Méthode récursive qui va récupérer les infos de tous les LI + * + * @access private + * @param HTMLLiElement obj La LI courante + * @param string virgule Détermine s'il y a une virgule avant l'accolade ouvrante + * @param string rt Retour de ligne (pour le debug) + * @param string tab La tabulation courante (pour le debug) + * @param string tabModel La grandeur d'une tabulation (pour le debug) + * @return string La string JSON dérivée de la structure UL - LI + */ +TafelTree._loadFromUL = function (obj, virgule, rt, tab, tabModel) { + tab += tabModel; + var contenu = TafelTree.trim(obj.innerHTML.replace(TafelTree.scriptFragment, '')); + var str = virgule + rt + tab + '{' + rt; + // Définition de toutes les propriétés + str += tab + "'id' : '" + obj.id + "'"; + if (contenu) { + str += "," + rt + tab + "'txt' : '" + contenu + "'"; + } + TafelTree.textAttributes.each(function (attr) { + if (obj.getAttribute(attr)) str += "," + rt + tab + "'" + attr.replace(TafelTree.prefixAttribute, '') + "' : '" + obj.getAttribute(attr) + "'"; + }); + TafelTree.numericAttributes.each(function (attr) { + if (obj.getAttribute(attr)) str += "," + rt + tab + "'" + attr.replace(TafelTree.prefixAttribute, '') + "' : " + obj.getAttribute(attr); + }); + TafelTree.functionAttributes.each(function (attr) { + if (obj.getAttribute(attr)) str += "," + rt + tab + "'" + attr.replace(TafelTree.prefixAttribute, '') + "' : " + obj.getAttribute(attr); + }); + // Définition des enfants + for (var i = 0; i < obj.childNodes.length; i++) { + if (obj.childNodes[i].nodeName.toLowerCase() == 'ul') { + virgule = ''; + str += ',' + rt + tab + "'items' : ["; + for (var j = 0; j < obj.childNodes[i].childNodes.length; j++) { + if (obj.childNodes[i].childNodes[j].nodeName.toLowerCase() == 'li') { + str += this._loadFromUL(obj.childNodes[i].childNodes[j], virgule, rt, tab, tabModel); + virgule = ','; + } + } + str += rt + tab + ']'; + } + } + str += rt + tab + '}'; + return str; +}; + +TafelTree.trim = function (string) { + return string.replace(/(^\s*)|(\s*$)|\n|\r|\t/g,''); +}; + + + + +/** + *------------------------------------------------------------------------------ + * TafelTree Class Constructor + *------------------------------------------------------------------------------ + */ + +TafelTree.prototype = { + /** + * Constructeur d'un nouvel arbre. Supporte facilement 700 éléments + * + * 2006-11-25 : changement des paramètres dans le constructeur. On peut mettre les options + * à la place de "imgBase". Les autres paramètres peuvent maintenant être passé via + * "options" + * + * @access public + * @param string id L'id de l'élément HTML conteneur + * @param object struct La structure de l'arbre + * @param string imgBase Le path vers les images (ou les options) + * @param integer width La largeur de l'arbre + * @param integer height La hauteur de l'arbre + * @param object options Les fonctions de load et autres binz de génération + */ + initialize : function (id, struct, imgBase, width, height, options) { + // 2006-11-25 : "options" est maintenant à la place de "imgBase" + if (typeof(imgBase) == 'object') { + options = imgBase; + imgBase = (options.imgBase) ? options.imgBase : 'imgs/'; + width = (options.width) ? options.width : '100%'; + height = (options.height) ? options.height : 'auto'; + } + // Variables images + this.imgBase = (imgBase) ? imgBase : 'imgs/'; + this.setLineStyle('line'); + this.options = (options) ? options : {}; + this.copyName = ' (%n)'; + this.copyNameBreak = '_'; + + // Variables CSS + this.classTree = 'tafelTree'; + this.classTreeRoot = this.classTree + '_root'; + this.classTreeBranch = this.classTree + '_row'; + this.classCopy = (this.options.copyCSS) ? this.options.copyCSS : null; + this.classCut = (this.options.cutCSS) ? this.options.cutCSS : null; + this.classDrag = 'tafelTreedrag'; + this.classSelected = 'tafelTreeselected'; + this.classEditable = 'tafelTreeeditable'; + this.classContent = 'tafelTreecontent'; + this.classCanevas = 'tafelTreecanevas'; + this.classDragOver = 'tafelTreedragOver'; + this.classTooltip = 'tafelTreetooltip'; + this.classOpenable = 'tafelTreeopenable'; + + // Default structure + this.defaultStruct = []; + /*for (var i = 0; i < struct.length; i++) { + this.defaultStruct.push(Object.clone(struct[i])); + }*/ + + // Autres variables + this.idTree = 0; + this.behaviourDrop = 0; + this.durationTooltipShow = 1000; + this.durationTooltipHide = 100; + this.baseStruct = struct; + this.width = (width) ? width : '100%'; + this.height = (height) ? height : 'auto'; + this.div = $(id); + this.div.style.width = this.width; + this.div.style.height = this.height; + this.id = this.div.id; + this.isTree = true; + this.dropALT = true; + this.openAll = false; + this.rtlMode = false; + this.dropCTRL = true; + this.multiline = false; + this.checkboxes = false; + this.propagation = true; + this.dragRevert = true; + this.dragGhosting = true; + this.bigTreeLoading = -1; + this.dropAsSibling = true; + this.onlyOneOpened = false; + this.openedAfterAdd = true; + this.editableBranches = true; + this.reopenFromServer = true; + this.selectedBranchShowed = true, + this.checkboxesThreeState = false; + this.roots = []; + this.icons = [null, null, null]; + this.iconsSelected = [null, null, null]; + this.otherTrees = []; + this.cuttedBranches = []; + this.copiedBranches = []; + this.checkedBranches = []; + this.selectedBranches = []; + this.idTreeBranch = this.classTree + '_' + this.id + '_id_'; + this.loaded = false; + Element.addClassName(this.div, this.classTree); + + // Cookie + this.useCookie = true; + this.cookieSeparator = '|'; + this.cookieCheckSeparator = '[check]'; + this.cookieOpened = null; + this.cookieChecked = null; + this.setOptions(this.options); + var fromCookie = this.getCookie(this.classTree + this.id); + if (fromCookie) { + var branches = fromCookie.split(this.cookieCheckSeparator); + // Branches ouvertes + this.cookieOpened = []; + this.cookieOpened = branches[0].split(this.cookieSeparator); + this.cookieOpened.shift(); + // Branches checkées (avec anti-bug pour les anciennes versions et anciens cookies) + this.cookieChecked = []; + if (branches.length > 1) { + this.cookieChecked = branches[1].split(this.cookieSeparator); + } + } + + // Instance de debug + this.debugObj = document.createElement('div'); + this.debugObj.setAttribute('id', this.classTree + '_debug'); + Element.hide(this.debugObj); + this.div.appendChild(this.debugObj); + // Instance Ajax + this.ajaxObj = document.createElement('div'); + this.ajaxObj.setAttribute('id', this.classTree + '_ajax'); + Element.hide(this.ajaxObj); + this.div.appendChild(this.ajaxObj); + Event.observe(this.div, 'mousedown', this.evt_setAsCurrent.bindAsEventListener(this), false); + Event.observe(this.div, 'focus', this.evt_setAsCurrent.bindAsEventListener(this), false); + // don't generate if cookie is on server side + if (!this.serverCookie) { + if (this.options.generate) { + this.generate(); + } + if (this.options.generateBigTree) { + this.generate(true); + } + } + TafelTreeManager.add(this); + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTree global events management + *------------------------------------------------------------------------------ + */ + + /** + * Set l'arbre comme étant l'arbre courant + * + * Toutes les actions claviers auront effet seulement sur cet arbre et non sur les autres* + * + * @access public + * @param Event ev L'événement déclencheur + * @return void + */ + evt_setAsCurrent : function (ev) { + var obj = Event.element(ev); + TafelTreeManager.setCurrentTree(this); + }, + + /** + * Retourne une liste de branches ordrée (en fonction de leur position dans l'arbre) + * + * @access public + * @param array list Un tableau de TafelTreeBranch + * @return array Un tableau ordré de TafelTreeBranch + */ + orderListBranches : function (list) { + var ordered = []; + var level = []; + var nivmin = 100; + var nivmax = 0; + // On ordre par niveau + var niv = 0; + for (var i = 0; i < list.length; i++) { + niv = list[i].getLevel(); + if (typeof(level[niv]) == 'undefined') { + level[niv] = []; + } + level[niv].push(list[i]); + if (niv > nivmax) nivmax = niv; + if (niv < nivmin) nivmin = niv; + } + // On enlève le cheni de m... à cause de la gestion tableau javascript + for (var i = nivmin; i <= nivmax; i++) { + if (level[i]) { + ordered.push(level[i]); + } + } + // Pour chaque niveau, on ordre par position dans l'arbre + + // On ne récupère que les 1er niveaux. S'il y a des enfants, on les ignore + return ordered; + }, + + /** + * Retourne les branches copiées de l'arbre, ou d'un arbre lié + * + * Si le tableau n'a pas de branches, la méthode va voir dans les arbres liés + * pour récupérer les branches qui seraient copiées dans l'autre arbre + * + * @access public + * @return array Les branches copiées + */ + getCopiedBranches : function () { + var branches = this.copiedBranches; + if (branches.length == 0) { + for (var i = 0; i < this.otherTrees.length; i++) { + branches = this.otherTrees[i].copiedBranches; + if (branches.length > 0) break; + } + } + return branches; + }, + + /** + * Retourne les branches coupées de l'arbre, ou d'un arbre lié + * + * Si le tableau n'a pas de branches, la méthode va voir dans les arbres liés + * pour récupérer les branches qui seraient coupées dans l'autre arbre + * + * @access public + * @return array Les branches coupées + */ + getCuttedBranches : function () { + var branches = this.cuttedBranches; + if (branches.length == 0) { + for (var i = 0; i < this.otherTrees.length; i++) { + branches = this.otherTrees[i].cuttedBranches; + if (branches.length > 0) break; + } + } + return branches; + }, + + /** + * Fonction qui coupe la sélection et la met dans un cache + * + * @access public + * @return return True si ça coupe, false sinon + */ + cut : function () { + this.unsetCut(); + this.unsetCopy(); + var level = this.orderListBranches(this.selectedBranches); + //this.debug(level); + var sel = null; + for (var i = 0; i < level.length; i++) { + for (var j = 0; j < level[i].length; j++) { + sel = level[i][j]; + this._cut(sel); + this.cuttedBranches.push(sel); + } + } + return true; + }, + + /** + * Fonction qui copie la sélection dans un cache + * + * @access public + * @return return True si ça copie, false sinon + */ + copy : function () { + this.unsetCut(); + this.unsetCopy(); + var level = this.orderListBranches(this.selectedBranches); + var sel = null; + for (var i = 0; i < this.selectedBranches.length; i++) { + sel = this.selectedBranches[i]; + this._copy(sel); + this.copiedBranches[i] = sel; + } + return true; + }, + + /** + * Fonction qui colle le cache à l'endroit sélectionné. Il ne doit y avoir qu'une sélection + * + * @access public + * @return return True si ça colle, false sinon + */ + paste : function () { + if (this.selectedBranches.length != 1) return false; + var branch = this.selectedBranches[0]; + var copied = this.getCopiedBranches(); + var cutted = this.getCuttedBranches(); + var nbCopy = copied.length; + var nbCut = cutted.length; + if (nbCopy > 0) { + var list = copied; + var b = null; + for (var i = 0; i < list.length; i++) { + if (this._okForPaste(branch, list, i)) { + b = branch.insertIntoLast(list[i].clone()); + } + } + } + if (nbCut > 0) { + var list = cutted; + for (var i = 0; i < list.length; i++) { + if (this._okForPaste(branch, list, i)) { + list[i].move(branch); + } + } + } + //this.unsetCopy(); + this.unsetCut(); + return true; + }, + + /** + * Détermine si on peut coller la partie courante du cache ou non + * + * @access private + * @param TafelTreeBranch branch La branche dans laquelle on colle + * @param array list Le tableau de cache ordré par niveau + * @param integer i La position courante dans le cache + * @return boolean True si on peut coller, false sinon + */ + _okForPaste : function (branch, list, i) { + var ok = true; + if (!branch.isChild(list[i])) { + for (var j = 0; j < i; j++) { + if (list[i].isChild(list[j])) { + ok = false; + break; + } + } + } else { + ok = false; + } + return ok; + }, + + unsetCut : function () { + // On enlève les branches coupées des autres arbres (suppression du "presse-papier") + var _tree = null; + var branches = null; + for (var i = 0; i < this.otherTrees.length; i++) { + _tree = this.otherTrees[i]; + branches = _tree.cuttedBranches; + for (var t = 0; t < branches.length; t++) { + _tree._unsetCut(branches[t]); + } + _tree.cuttedBranches = []; + } + var cut = null; + for (var i = 0; i < this.cuttedBranches.length; i++) { + cut = this.cuttedBranches[i]; + this._unsetCut(cut); + } + this.cuttedBranches = []; + }, + + unsetCopy : function () { + // On enlève les branches copiées des autres arbres (suppression du "presse-papier") + var _tree = null; + var branches = null; + for (var i = 0; i < this.otherTrees.length; i++) { + _tree = this.otherTrees[i]; + branches = _tree.copiedBranches; + for (var t = 0; t < branches.length; t++) { + _tree._unsetCopy(branches[t]); + } + _tree.copiedBranches = []; + } + var copy = null; + for (var i = 0; i < this.copiedBranches.length; i++) { + copy = this.copiedBranches[i]; + this._unsetCopy(copy); + } + this.copiedBranches = []; + }, + + /** + * Annule les [n] dernières actions (todo...) + * + * @access public + * @return boolean True si quelque chose a été annulé + */ + undo : function () { + + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTree private keyboard methods + *------------------------------------------------------------------------------ + */ + + /** + * Méthode récursive qui fait l'effet "couper" sur toutes les sous-branches + * + * @access private + * @param TafelTreeBranch branch La branche courante + * @return void + */ + _cut : function (branch) { + if (!this.classCut) { + new Effect.Opacity(branch.txt, { + duration: 0.1, + transition: Effect.Transitions.linear, + from: 1.0, to: 0.4 + }); + new Effect.Opacity(branch.img, { + duration: 0.1, + transition: Effect.Transitions.linear, + from: 1.0, to: 0.4 + }); + } else { + Element.addClassName(branch.txt, this.classCut); + Element.addClassName(branch.img, this.classCut); + } + if (branch.hasChildren()) { + for (var i = 0; i < branch.children.length; i++) { + this._cut(branch.children[i]); + } + } + }, + + /** + * Méthode récursive qui enlève l'effet "couper" sur toutes les sous-branches + * + * @access private + * @param TafelTreeBranch branch La branche courante + * @return void + */ + _unsetCut : function (branch) { + if (!this.classCut) { + new Effect.Opacity(branch.txt, { + duration: 0.1, + transition: Effect.Transitions.linear, + from: 0.4, to: 1.0 + }); + new Effect.Opacity(branch.img, { + duration: 0.1, + transition: Effect.Transitions.linear, + from: 0.4, to: 1.0 + }); + } else { + Element.removeClassName(branch.txt, this.classCut); + Element.removeClassName(branch.img, this.classCut); + } + if (branch.hasChildren()) { + for (var i = 0; i < branch.children.length; i++) { + this._unsetCut(branch.children[i]); + } + } + }, + + /** + * Méthode récursive qui fait l'effet "copier" sur toutes les sous-branches + * + * @access private + * @param TafelTreeBranch branch La branche courante + * @return void + */ + _copy : function (branch) { + if (this.classCopy) { + Element.addClassName(branch.txt, this.classCopy); + Element.addClassName(branch.img, this.classCopy); + } + if (branch.hasChildren()) { + for (var i = 0; i < branch.children.length; i++) { + this._copy(branch.children[i]); + } + } + }, + + /** + * Méthode récursive qui enlève l'effet "copier" sur toutes les sous-branches + * + * @access private + * @param TafelTreeBranch branch La branche courante + * @return void + */ + _unsetCopy : function (branch) { + if (this.classCopy) { + Element.removeClassName(branch.txt, this.classCopy); + Element.removeClassName(branch.img, this.classCopy); + } + if (branch.hasChildren()) { + for (var i = 0; i < branch.children.length; i++) { + this._unsetCopy(branch.children[i]); + } + } + }, + + /** + *------------------------------------------------------------------------------ + * TafelTree getters and setters methods + *------------------------------------------------------------------------------ + */ + + enableMultiline : function (multiline) { + this.multiline = (multiline) ? true : false; + }, + + enableRTL : function (rtl) { + this.rtlMode = (rtl) ? true : false; + if (this.rtlMode) { + // plante sous Safari... + //this.div.style.float = 'right'; + this.div.style.textAlign = 'right'; + this.div.style.direction = 'rtl'; + } else { + // plante sous Safari + //this.div.style.float = 'left'; + this.div.style.textAlign = 'left'; + this.div.style.direction = 'ltr'; + } + this.setLineStyle(this.lineStyle); + }, + + isRTL : function () { + return this.rtlMode; + }, + + disableDropALT : function (alt) { + this.dropALT = (alt) ? true : false; + }, + + disableDropCTRL : function (copy) { + this.dropCTRL = (copy) ? true : false; + }, + + enableCheckboxes : function (enable) { + this.checkboxes = (enable) ? true : false; + }, + + enableCheckboxesThreeState : function (enable) { + this.enableCheckboxes(enable); + this.checkboxesThreeState = (enable) ? true : false; + }, + + /** + * Permet d'utiliser les cookies ou non. Le séparateur est optionnel, '|' par défaut + * + * @access public + * @param boolean enable True (par défaut) pour gérer les cookies + * @param string separator Le séparateur dans le cookie ) + */ + enableCookies : function (enable, separator) { + this.useCookie = (enable) ? true : false; + if (typeof(separator) != 'undefined') { + this.cookieSeparator = separator; + } + }, + + openOneAtOnce : function (yes) { + this.onlyOneOpened = (yes) ? true : false; + }, + + openAfterAdd : function (yes) { + this.openedAfterAdd = (yes) ? true : false; + }, + + reopenFromServerAfterLoad : function (yes) { + this.reopenFromServer = (yes) ? true : false; + }, + + /** + * Fonction qui set par défaut l'état des branches (ouvert ou fermé) + * + * @access public + * @param boolean open True pour tout ouvrir, false pour tout fermer + * @return void + */ + openAtLoad : function (open) { + this.openAll = (open) ? true : false; + }, + + showSelectedBranch : function (show) { + this.selectedBranchShowed = (show) ? true : false; + }, + + /** + * Permet de choisir quel comportement par defaut le drop aura + * + * L'autre comportement s'obtient en gardant la touche ALT appuyée et/ou CTRL + * + * @access public + * @param string def 'sibling', 'siblingcopy', 'child' ou 'childcopy' + * @return void + */ + setBehaviourDrop : function (def) { + switch (def) { + case 'sibling' : this.behaviourDrop = 1; break; + case 'childcopy' : this.behaviourDrop = 2; break; + case 'siblingcopy' : this.behaviourDrop = 3; break; + case 'child' : + default : + this.behaviourDrop = 0; + } + }, + + /** + * Set les icônes par défaut pour toutes les branches + * + * Si imgopen n'est pas défini, il prend la valeur d'img. Pareil pour imgclose. + * + * @access public + * @param string img L'image quand la branche n'a pas d'enfants + * @param string imgopen L'image quand la branche des enfants et est ouverte + * @param string imgclose L'image quand la branche a des enfants et est fermée + * @return void + */ + setIcons : function (img, imgopen, imgclose) { + this.icons[0] = img; + this.icons[1] = (imgopen) ? imgopen : img; + this.icons[2] = (imgclose) ? imgclose : img; + }, + + /** + * Set les icônes de sélection par défaut pour toutes les branches + * + * @access public + * @param string img L'image quand la branche n'a pas d'enfants + * @param string imgopen L'image quand la branche des enfants et est ouverte + * @param string imgclose L'image quand la branche a des enfants et est fermée + * @return void + */ + setIconsSelected : function (img, imgopen, imgclose) { + this.iconsSelected[0] = img; + this.iconsSelected[1] = (imgopen) ? imgopen : null; + this.iconsSelected[2] = (imgclose) ? imgclose : null; + }, + + /** + * Fonction qui permet de choisir le style des lignes entre les branches + * + * @access public + * @param string style LE style des lignes, 'none' ou 'line' + * @return void + */ + setLineStyle : function (style) { + this.lineStyle = style; + switch (style) { + case 'none' : + this.imgLine0 = 'empty.gif'; this.imgLine1 = 'empty.gif'; this.imgLine2 = 'empty.gif'; + this.imgLine3 = 'empty.gif'; this.imgLine4 = 'empty.gif'; this.imgLine5 = 'empty.gif'; + this.imgWait = 'wait.gif'; this.imgEmpty = 'empty.gif'; + this.imgMinus1 = 'minus0.gif'; this.imgMinus2 = 'minus0.gif'; this.imgMinus3 = 'minus0.gif'; + this.imgMinus4 = 'minus0.gif'; this.imgMinus5 = 'minus0.gif'; + this.imgPlus1 = 'plus0.gif'; this.imgPlus2 = 'plus0.gif'; this.imgPlus3 = 'plus0.gif'; + this.imgPlus4 = 'plus0.gif'; this.imgPlus5 = 'plus0.gif'; + this.imgCheck1 = 'check1.gif'; this.imgCheck2 = 'check2.gif'; this.imgCheck3 = 'check3.gif'; + // Les 2 premiers sont des noms d'images, les 2 autres de classes CSS + this.imgMulti1 = 'empty.gif'; this.imgMulti2 = 'empty.gif'; + this.imgMulti3 = ''; this.imgMulti4 = ''; + break; + case 'full' : + if (this.isRTL()) { + this.imgLine0 = 'rtl_linefull0.gif'; this.imgLine1 = 'rtl_linefull1.gif'; this.imgLine2 = 'rtl_linefull2.gif'; + this.imgLine3 = 'rtl_linefull3.gif'; this.imgLine4 = 'rtl_linefull4.gif'; this.imgLine5 = 'rtl_linefull5.gif'; + this.imgWait = 'wait.gif'; this.imgEmpty = 'empty.gif'; + this.imgMinus1 = 'rtl_minusfull1.gif'; this.imgMinus2 = 'rtl_minusfull2.gif'; this.imgMinus3 = 'rtl_minusfull3.gif'; + this.imgMinus4 = 'rtl_minusfull4.gif'; this.imgMinus5 = 'rtl_minusfull5.gif'; + this.imgPlus1 = 'rtl_plusfull1.gif'; this.imgPlus2 = 'rtl_plusfull2.gif'; this.imgPlus3 = 'rtl_plusfull3.gif'; + this.imgPlus4 = 'rtl_plusfull4.gif'; this.imgPlus5 = 'rtl_plusfull5.gif'; + this.imgCheck1 = 'check1.gif'; this.imgCheck2 = 'check2.gif'; this.imgCheck3 = 'check3.gif'; + // Les 2 premiers sont des noms d'images, les 2 autres de classes CSS + this.imgMulti1 = 'rtl_linebgfull.gif'; this.imgMulti2 = 'rtl_linebgfull2.gif'; + this.imgMulti3 = 'multiline'; this.imgMulti4 = 'multiline2'; + } else { + this.imgLine0 = 'linefull0.gif'; this.imgLine1 = 'linefull1.gif'; this.imgLine2 = 'linefull2.gif'; + this.imgLine3 = 'linefull3.gif'; this.imgLine4 = 'linefull4.gif'; this.imgLine5 = 'linefull5.gif'; + this.imgWait = 'wait.gif'; this.imgEmpty = 'empty.gif'; + this.imgMinus1 = 'minusfull1.gif'; this.imgMinus2 = 'minusfull2.gif'; this.imgMinus3 = 'minusfull3.gif'; + this.imgMinus4 = 'minusfull4.gif'; this.imgMinus5 = 'minusfull5.gif'; + this.imgPlus1 = 'plusfull1.gif'; this.imgPlus2 = 'plusfull2.gif'; this.imgPlus3 = 'plusfull3.gif'; + this.imgPlus4 = 'plusfull4.gif'; this.imgPlus5 = 'plusfull5.gif'; + this.imgCheck1 = 'check1.gif'; this.imgCheck2 = 'check2.gif'; this.imgCheck3 = 'check3.gif'; + // Les 2 premiers sont des noms d'images, les 2 autres de classes CSS + this.imgMulti1 = 'linebgfull.gif'; this.imgMulti2 = 'linebgfull2.gif'; + this.imgMulti3 = 'multiline'; this.imgMulti4 = 'multiline2'; + } + break; + case 'line' : + default : + if (this.isRTL()) { + this.imgLine0 = 'rtl_line0.gif'; this.imgLine1 = 'rtl_line1.gif'; this.imgLine2 = 'rtl_line2.gif'; + this.imgLine3 = 'rtl_line3.gif'; this.imgLine4 = 'rtl_line4.gif'; this.imgLine5 = 'rtl_line5.gif'; + this.imgWait = 'wait.gif'; this.imgEmpty = 'empty.gif'; + this.imgMinus1 = 'rtl_minus1.gif'; this.imgMinus2 = 'rtl_minus2.gif'; this.imgMinus3 = 'rtl_minus3.gif'; + this.imgMinus4 = 'rtl_minus4.gif'; this.imgMinus5 = 'rtl_minus5.gif'; + this.imgPlus1 = 'rtl_plus1.gif'; this.imgPlus2 = 'rtl_plus2.gif'; this.imgPlus3 = 'rtl_plus3.gif'; + this.imgPlus4 = 'rtl_plus4.gif'; this.imgPlus5 = 'rtl_plus5.gif'; + this.imgCheck1 = 'check1.gif'; this.imgCheck2 = 'check2.gif'; this.imgCheck3 = 'check3.gif'; + // Les 2 premiers sont des noms d'images, les 2 autres de classes CSS + this.imgMulti1 = 'rtl_linebg.gif'; this.imgMulti2 = 'rtl_linebg2.gif'; + this.imgMulti3 = 'multiline'; this.imgMulti4 = 'multiline2'; + } else { + this.imgLine0 = 'line0.gif'; this.imgLine1 = 'line1.gif'; this.imgLine2 = 'line2.gif'; + this.imgLine3 = 'line3.gif'; this.imgLine4 = 'line4.gif'; this.imgLine5 = 'line5.gif'; + this.imgWait = 'wait.gif'; this.imgEmpty = 'empty.gif'; + this.imgMinus1 = 'minus1.gif'; this.imgMinus2 = 'minus2.gif'; this.imgMinus3 = 'minus3.gif'; + this.imgMinus4 = 'minus4.gif'; this.imgMinus5 = 'minus5.gif'; + this.imgPlus1 = 'plus1.gif'; this.imgPlus2 = 'plus2.gif'; this.imgPlus3 = 'plus3.gif'; + this.imgPlus4 = 'plus4.gif'; this.imgPlus5 = 'plus5.gif'; + this.imgCheck1 = 'check1.gif'; this.imgCheck2 = 'check2.gif'; this.imgCheck3 = 'check3.gif'; + // Les 2 premiers sont des noms d'images, les 2 autres de classes CSS + this.imgMulti1 = 'linebg.gif'; this.imgMulti2 = 'linebg2.gif'; + this.imgMulti3 = 'multiline'; this.imgMulti4 = 'multiline2'; + } + } + }, + + setTooltipDuration : function (show, hide) { + this.durationTooltipShow = show; + this.durationTooltipHide = hide; + }, + + /** + * Méthode qui permet d'interdir les mouvements dans la branche dragguée + * + * @access public + * @param boolean propagateRestiction True pour interdir le mouvement des enfants de la branche droppée + * @return void + */ + propagateRestriction : function (propagate) { + this.propagation = (typeof(propagate) == 'undefined') ? true : propagate; + }, + + getSelectedBranches : function () { + return this.selectedBranches; + }, + + setContextMenu : function (menu) { + var div = document.createElement('div'); + div.innerHTML = menu; + this.div.appendChild(div); + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTree public methods + *------------------------------------------------------------------------------ + */ + + /** + * Fonction pour générer l'arbre + * + * @access public + * @param boolean bigTree True pour spécifier que c'est un gros arbre + * @return void + */ + generate : function (bigTree) { + if (!bigTree) { + var isNotFirst = false; + var isNotLast = false; + for (var i = 0; i < this.baseStruct.length; i++) { + isNotFirst = (i > 0) ? true : false; + isNotLast = (i < this.baseStruct.length - 1) ? true : false; + this.roots[i] = new TafelTreeRoot(this, this.baseStruct[i], 0, isNotFirst, isNotLast, i); + this.div.appendChild(this.roots[i].obj); + } + this.loadComplete(); + } else { + this.bigTreeLoading = 0; + setTimeout(this._checkLoad.bind(this), 100); + setTimeout(this._generateBigTree.bind(this), 10); + } + }, + + /** + * Lance les fonctions générales de l'arbre + * + * @access public + * @param object options Les fonctions et autres ouvertures automatiques* + * @return void + */ + setOptions : function (options) { + // Fonctions événementielles + if (options.onLoad) this.setOnLoad(options.onLoad); + if (options.onDebug) this.setOnDebug(options.onDebug); + if (options.onCheck) this.setOnCheck(options.onCheck); + if (options.onBeforeCheck) this.setOnBeforeCheck(options.onBeforeCheck); + if (options.onClick) this.setOnClick(options.onClick); + if (options.onMouseDown) this.setOnMouseDown(options.onMouseDown); + if (options.onMouseUp) this.setOnMouseUp(options.onMouseUp); + if (options.onDblClick) this.setOnDblClick(options.onDblClick); + if (options.onBeforeOpen) this.setOnBeforeOpen(options.onBeforeOpen); + if (options.onOpen) this.setOnOpen(options.onOpen); + if (options.onMouseOver) this.setOnMouseOver(options.onMouseOver); + if (options.onMouseOut) this.setOnMouseOut(options.onMouseOut); + if (options.onDrop) this.setOnDrop(options.onDrop); + if (options.onDragStartEffect) this.setOnDragStartEffect(options.onDragStartEffect); + if (options.onDragEndEffect) this.setOnDragEndEffect(options.onDragEndEffect); + if (options.onErrorAjax) this.setOnDropAfter(options.onErrorAjax); + if (options.onEdit) this.setOnEdit(options.onEdit); + if (options.onEditAjax) this.setOnEditAjax(options.onEditAjax[0], options.onEditAjax[1]); + if (options.onDropAjax) this.setOnDropAjax(options.onDropAjax[0], options.onDropAjax[1]); + if (options.onOpenPopulate) this.setOnOpenPopulate(options.onOpenPopulate[0], options.onOpenPopulate[1]); + // Fonctions avancées + if (typeof(options.rtlMode) != 'undefined') this.enableRTL(options.rtlMode); + if (typeof(options.dropALT) != 'undefined') this.disableDropALT(options.dropALT); + if (typeof(options.dropCTRL) != 'undefined') this.disableDropCTRL(options.dropCTRL); + if (typeof(options.multiline) != 'undefined') this.enableMultiline(options.multiline); + if (typeof(options.checkboxes) != 'undefined') this.enableCheckboxes(options.checkboxes); + if (typeof(options.checkboxesThreeState) != 'undefined') this.enableCheckboxesThreeState(options.checkboxesThreeState); + if (typeof(options.cookies) != 'undefined') this.enableCookies(options.cookies); + if (typeof(options.openOneAtOnce) != 'undefined') this.openOneAtOnce(options.openOneAtOnce); + if (typeof(options.openAtLoad) != 'undefined') this.openAtLoad(options.openAtLoad); + if (typeof(options.openAfterAdd) != 'undefined') this.openAfterAdd(options.openAfterAdd); + if (typeof(options.showSelectedBranch) != 'undefined') this.showSelectedBranch(options.showSelectedBranch); + if (typeof(options.reopenFromServer) != 'undefined') this.reopenFromServerAfterLoad(options.reopenFromServer); + if (typeof(options.propagateRestriction) != 'undefined') this.propagateRestriction(options.propagateRestriction); + if (options.lineStyle) this.setLineStyle(options.lineStyle); + if (options.behaviourDrop) this.setBehaviourDrop(options.behaviourDrop); + if (options.contextMenu) this.setContextMenu(options.contextMenu); + // Fonctions diverses + if (options.bind) { + for (var i = 0; i < options.bind.length; i++) { + this.bind(options.bind[i]); + } + } + if (options.bindAsUnidirectional) { + for (var i = 0; i < options.bindAsUnidirectional.length; i++) { + this.bind(options.bindAsUnidirectional[i]); + } + } + if (options.defaultImg) { + var imgopen = (options.defaultImgOpen) ? options.defaultImgOpen : options.defaultImg; + var imgclose = (options.defaultImgClose) ? options.defaultImgClose : options.defaultImg; + this.setIcons(options.defaultImg, imgopen, imgclose); + } + if (options.defaultImgSelected || options.defaultImgOpenSelected || options.defaultImgCloseSelected) { + var img = (options.defaultImgSelected) ? options.defaultImgSelected : null; + var imgopen = (options.defaultImgOpenSelected) ? options.defaultImgOpenSelected : null; + var imgclose = (options.defaultImgCloseSelected) ? options.defaultImgCloseSelected :null; + this.setIconsSelected(img, imgopen, imgclose); + } + this.serverCookie = (options.serverCookie) ? options.serverCookie : false; + }, + + loadComplete : function () { + this._adjustOpening(); + this._adjustCheck(); + this.setCookie(this.classTree + this.id); + this.loaded = true; + if (typeof(this.onLoad) == 'function') { + this.onLoad(); + } + }, + + loadRunning : function (loaded) { + if (typeof(this.onLoading) == 'function') { + this.onLoading(loaded); + } + }, + + replace : function (modelBranch, replacedBranch, copy) { + var branch1 = this.getBranchById(modelBranch); + if (!branch1) return false; + return branch1.replace(replacedBranch, copy); + }, + + switchBranches : function (branch1, branch2) { + var branch1 = this.getBranchById(branch1); + if (!branch1) return false; + branch1.switchWith(branch2); + }, + + /** + * Restaure les valeurs par défaut d'ouverture et check (selon type) + * + * Le type peut prendre la valeur "open", "check" ou "all" + * + * @access public + * @param string type Le type de default (open, check ou all) + * @return void + */ + restoreDefault : function (type) { + var s = this.defaultStruct; + this._restaureDefault(s, type); + }, + + _restaureDefault : function (s, type) { + var b = null; + var open = false; + var check = 0; + for (var i = 0; i < s.length; i++) { + b = this.getBranchById(s[i].id); + if (b) { + open = (s[i].open) ? true : this.openAll; + check = (s[i].check == 1) ? 1 : 0; + switch (type) { + case 'open' : + if (b.hasChildren()) { + b.openIt(open); + } + break; + case 'check' : + b.check(check); + b._adjustParentCheck(); + break; + case 'all' : + default : + if (b.hasChildren()) { + b.openIt(open); + } + //alert(b.getText() + ' : ' + check); + b.check(check); + b._adjustParentCheck(); + } + // S'il y a des enfants, on va les restaurer aussi + if (typeof(s[i].items) != 'undefined') { + this._restaureDefault(s[i].items, type); + } + } + } + }, + + /** + * Fonction qui lie des arbres TafelTree entre eux, bidirecitonnellement + * + * On lui passe autant de TafelTree voulu, en les séparant par des virgules + * + * @access public + * @param TafelTree argument Un ou plusieurs TafelTree + * @return void + */ + bind : function () { + var trees = this.bind.arguments; + for (var i = 0; i < trees.length; i++) { + if (!this.isBindedWith(trees[i])) { + this.otherTrees.push(trees[i]); + if (!trees[i].isBindedWith(this)) { + trees[i].bind(this); + } + } + } + }, + + /** + * Fonction qui lie des arbres TafelTree entre eux, mais unnidirecitonnel + * + * On lui passe autant de TafelTree voulu, en les séparant par des virgules + * + * @access public + * @param TafelTree argument Un ou plusieurs TafelTree + * @return void + */ + bindAsUnidirectional : function () { + var trees = this.bindAsUnidirectional.arguments; + for (var i = 0; i < trees.length; i++) { + if (!this.isBindedWith(trees[i])) { + this.otherTrees.push(trees[i]); + } + } + }, + + isBindedWith : function (_tree) { + var binded = false; + for (var i = 0; i < this.otherTrees.length; i++) { + if (this.otherTrees[i].id == _tree.id) { + binded = true; + break; + } + } + return binded; + }, + + unselect : function () { + var branch = null; + for (var i = 0; i < this.selectedBranches.length; i++) { + branch = this.selectedBranches[i]; + Element.removeClassName(branch.txt, this.classSelected); + // On set l'icône s'il doit changer + if (branch.getIconSelected() || branch.getOpenIconSelected() || branch.getCloseIconSelected()) { + if (branch.hasChildren()) { + branch.img.src = (branch.isOpened()) ? branch.tree.imgBase + branch.struct.imgopen : branch.tree.imgBase + branch.struct.imgclose; + } else { + branch.img.src = branch.tree.imgBase + branch.struct.img; + } + } + } + this.selectedBranches = []; + }, + + /** + * Retourne toutes les branches contenues entre deux d'entre-elles + * + * @access public + * @param TafelTreeBranch branch1 La première borne + * @param TafelTreeBranch branch2 La deuxième borne + * @return array Un tableau de branche, ou false si rien n'a été trouvé + */ + getBranchesBetween : function (branch1, branch2) { + var branch1 = this.getBranchById(branch1); + var branch2 = this.getBranchById(branch2); + if (!branch1 || !branch2) return false; + // On quitte si ce n'est pas le même arbre + if (branch1.tree.id != branch2.tree.id) return false; + var found = false; + var selected = []; + var pos1 = branch1.getWithinOffset(); + var pos2 = branch2.getWithinOffset(); + var next = (pos1[1] <= pos2[1]) ? true : false; + // On va chercher l'autre branche plus bas + branch = (next) ? branch1.getNextBranch() : branch1.getPreviousBranch(); + while (branch) { + selected.push(branch); + if (branch.getId() == branch2.getId()) { + found = true; + break; + } + branch = (next) ? branch.getNextBranch() : branch.getPreviousBranch(); + } + return (found) ? selected : false; + }, + + /** + * Retourne le nombre de branche comprises dans l'arbre + * + * @access public + * @return integer Le nombre de branches + */ + countBranches : function () { + var nb = this.roots.length; + for (var i = 0; i < this.roots.length; i++) { + nb += this.roots[i].countBranches(); + } + return nb; + }, + + /** + * Retourne toutes les branches de l'arbre + * + * @access public + * @param function filter Le filtre des branches + * @return array Un tableau des branches de l'arbre + */ + getBranches : function (filter) { + var branches = []; + for (var i = 0; i < this.roots.length; i++) { + if (typeof(filter) == 'function') { + if (filter(this.roots[i])) { + branches.push(this.roots[i]); + } + } else { + branches.push(this.roots[i]); + } + branches = this.roots[i].getBranches(filter, branches); + } + return branches; + }, + + /** + * Récupère toutes les branches ouvertes + * + * @access public + * @return void + */ + getOpenedBranches : function () { + var openedBranches = []; + for (var i = 0; i < this.roots.length; i++) { + if (this.roots[i].isOpened() && this.roots[i].hasChildren()) { + openedBranches.push(this.roots[i]); + } + openedBranches = this.roots[i].getOpenedBranches(openedBranches); + } + return openedBranches; + }, + + /** + * Récupère toutes les branches checkées + * + * @access public + * @return void + */ + getCheckedBranches : function () { + var checkedBranches = []; + for (var i = 0; i < this.roots.length; i++) { + if (this.roots[i].isChecked() == 1) { + checkedBranches.push(this.roots[i]); + } + checkedBranches = this.roots[i].getCheckedBranches(checkedBranches); + } + return checkedBranches; + }, + + /** + * Récupère toutes les branches non checkées + * + * @access public + * @return void + */ + getUnCheckedBranches : function () { + var uncheckedBranches = []; + for (var i = 0; i < this.roots.length; i++) { + if (this.roots[i].isChecked() == 0) { + uncheckedBranches.push(this.roots[i]); + } + uncheckedBranches = this.roots[i].getUnCheckedBranches(uncheckedBranches); + } + return uncheckedBranches; + }, + + /** + * Récupère toutes les branches partiellement checkées + * + * @access public + * @return void + */ + getPartCheckedBranches : function () { + var uncheckedBranches = []; + for (var i = 0; i < this.roots.length; i++) { + if (this.roots[i].isChecked() == -1) { + uncheckedBranches.push(this.roots[i]); + } + uncheckedBranches = this.roots[i].getPartCheckedBranches(uncheckedBranches); + } + return uncheckedBranches; + }, + + getParentBranches : function () { + var parents = []; + for (var i = 0; i < this.roots.length; i++) { + if (this.roots[i].hasChildren()) { + parents.push(this.roots[i]); + } + parents = this.roots[i].getParentBranches(parents); + } + return parents; + }, + + getLeafBranches : function () { + var leafs = []; + for (var i = 0; i < this.roots.length; i++) { + if (!this.roots[i].hasChildren()) { + leafs.push(this.roots[i]); + } + leafs = this.roots[i].getLeafBranches(leafs); + } + return leafs; + }, + + /** + * Fonction qui ouvre tout l'arbre d'un coup + * + * @access public + * @return void + */ + expend : function () { + for (var i = 0; i < this.roots.length; i++) { + this.roots[i].expend(); + } + }, + + /** + * Fonction qui ferme tout l'arbre d'un coup + * + * @access public + * @return void + */ + collapse : function () { + for (var i = 0; i < this.roots.length; i++) { + this.roots[i].collapse(); + } + }, + + /** + * Méthode pour récupérer une branche en fonction de son id + * + * @access public + * @param string position L'id de la branche soeur ou parente, ou l'objet + * @param object item La nouvelle branche + * @param boolean sibling True pour 'sibling', false pour 'child' + * @param boolean isFirst True pour l'insérer, soit comme 1er enfant, soit avant la soeur + * @return void + */ + insertBranch : function (position, item, sibling, isFirst) { + var position = this.getBranchById(position); + if (!position) return false; + if (!sibling) { + if (!isFirst) { + position.insertIntoLast(item); + } else { + position.insertIntoFirst(item); + } + } else { + if (!isFirst) { + position.insertAfter(item); + } else { + position.insertBefore(item); + } + } + }, + + moveBranch : function (position, item, sibling, isFirst) { + var position = this.getBranchById(position); + if (!position) return false; + if (!sibling) { + if (!isFirst) { + position.moveIntoLast(item); + } else { + position.moveIntoFirst(item); + } + } else { + if (!isFirst) { + position.moveAfter(item); + } else { + position.moveBefore(item); + } + } + }, + + /** + * Fonction qui efface la branche + * + * @access public + * @return void + */ + removeBranch : function (branch) { + try { + var branch = this.getBranchById(branch); + if (!branch) return false; + // On enlève le drag&drop + if (branch.objDrag) { + branch.removeDragDrop(); + } + if (!branch.isRoot) { + // On supprime le noeud HTML + branch.parent.obj.removeChild(branch.obj); + // On l'enlève de la structure Javacript + branch.parent.children.splice(branch.pos, 1); + branch.parent.struct.items.splice(branch.pos, 1); + if (branch.parent.children.length == 0) { + branch.parent.setOpenableIcon(false); + if (branch.tree.multiline) { + branch._manageMultiline(branch.parent.tdImg, 2, false); + } + } + // On repositionne la structure + branch.parent._manageLine(); + } else { + // On supprime le noeud HTML + this.div.removeChild(branch.obj); + // On l'enlève de la structure Javacript + this.roots.splice(branch.pos, 1); + if (this.roots[branch.pos-1]) { + this.roots[branch.pos-1]._manageAfterRootInsert(); + } + } + branch = null; + } catch (err) { + throw new Error ('remove(base) : ' + err.message); + } + }, + + /** + * Méthode pour récupérer une branche en fonction de son id généré + * + * @access public + * @param string id L'id généré de la branche + * @return TafelBranch La branche sélectionnée + */ + getBranchByIdObj : function (id) { + try { + var obj = null; + for (var r = 0; r < this.roots.length; r++) { + obj = this._getBranchByIdObj(id, this.roots[r]); + if (obj) { + break; + } + } + return obj; + } catch (err) { + throw new Error ('getBranchByIdObj(func) : ' + err.message); + } + }, + + /** + * Méthode pour récupérer une branche en fonction de son id utilisateur + * + * @access public + * @param string id L'id utilisateur de la branche + * @return TafelBranch La branche sélectionnée + */ + getBranchById : function (id) { + try { + if (typeof(id) == 'object') return id; + var obj = null; + for (var r = 0; r < this.roots.length; r++) { + obj = this._getBranchById(id, this.roots[r]); + if (obj) break; + } + if (!obj) { + // On magouille avec les roots pour ne pas passer + // dans une boucle infinie (à cause du getBranchById) + var ro = null; + for (var i = 0; i < this.otherTrees.length; i++) { + ro = this.otherTrees[i].roots; + for (var r = 0; r < ro.length; r++) { + obj = this.otherTrees[i]._getBranchById(id, ro[r]); + if (obj) break; + } + if (obj) break; + } + } + return obj; + } catch (err) { + throw new Error ('getBranchById(func) : ' + err.message); + } + }, + + /** + * Méthode de gestion de debug + * + * @access public + * @param string str Une string à afficher (optionnel) + * @return void + */ + debug : function (str) { + try { + this.debugObj.style.display = 'block'; + if (typeof(this.onDebug) == 'function') { + this.onDebug(this, this.debugObj, (str) ? str : ''); + } else { + this.debugObj.innerHTML += str; + } + } catch (err) { + throw new Error ('debug(func) : ' + err.message); + } + }, + + /** + * Fonction pour afficher l'ojbet de manière cool + * + * @access public + * @return string La string de l'objet + */ + toString : function () { + var obj = { + 'id' : this.id, + 'width' : this.div.offsetWidth, + 'height' : this.div.offsetHeight, + 'imgPath' : this.imgBase, + 'roots' : this.roots.length + }; + var str = 'TafelTree {'; + for (var i in obj) { + str += TafelTree.debugReturn + TafelTree.debugTab + i + ' : ' + obj[i]; + } + str += TafelTree.debugReturn + '}'; + return str; + }, + + /** + * Fonction qui sérialise l'arbre pour en faire une string JSON + * + * @access public + * @return string La string de l'objet + */ + serialize : function (debug) { + var rt = (debug) ? TafelTree.debugReturn : ''; + var str = (debug) ? 'TafelTree (' + this.id + ') [' : '['; + for (var i = 0; i < this.roots.length; i++) { + str += this.roots[i].serialize(debug, true); + if (i < this.roots.length - 1) { + str += ','; + } + } + str += rt + ((debug) ? '];' : ']'); + if (debug) { + return str; + } else { + return encodeURIComponent(str); + } + }, + + /** + * Fonction qui renvoie les paramètres de l'URL + * + * ils sont renvoyés sous cette forme : + params[0] = { + 'name' : 'paramName', + 'value': 'paramValue' + } + * + * @access public + * @param string url L'url à decomposer + * @return array Le tableau de paramètres + */ + getURLParams : function (url) { + var params = []; + if (url.indexOf('?') > -1) { + var a1 = url.split('?'); + var a2 = a1[1].split('&'); + var a3 = ''; + for (var i = 0; i < a2.length; i++) { + a3 = a2[i].split('='); + if (a3.length == 2) { + params.push({ + 'name' : a3[0], + 'value': a3[1] + }) + } + } + } + return params; + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTree private methods + *------------------------------------------------------------------------------ + */ + + _generateBigTree : function () { + var i = this.bigTreeLoading; + var isNotFirst = false; + var isNotLast = false; + if (i < this.baseStruct.length) { + isNotFirst = (i > 0) ? true : false; + isNotLast = (i < this.baseStruct.length - 1) ? true : false; + this.roots[i] = new TafelTreeRoot(this, this.baseStruct[i], 0, isNotFirst, isNotLast, i); + this.div.appendChild(this.roots[i].obj); + this.loadRunning(this.roots[i]); + this.bigTreeLoading++; + setTimeout(this._generateBigTree.bind(this), 10); + } else { + this.loaded = true; + } + }, + + _checkLoad : function () { + var complete = true; + if (this.loaded) { + for (var i = 0; i < this.roots.length; i++) { + if (!this.roots[i].loaded || !this._checkLoadChildren(this.roots[i])) { + complete = false; + break; + } + } + } else { + complete = false; + } + if (!complete){ + setTimeout(this._checkLoad.bind(this), 100); + } else { + this.loadComplete(); + } + }, + + _checkLoadChildren : function (branch) { + var complete = true; + if (branch.loaded) { + for (var i = 0; i < branch.children.length; i++) { + if (!branch.children[i].loaded || !this._checkLoadChildren(branch.children[i])) { + complete = false; + break; + } + } + } else { + complete = false; + } + return complete; + }, + + _adjustOpening : function () { + // Si on utilise les cookies, on s'en sert pour ouvrir ou fermer les branches + if (this.useCookie && this.cookieOpened) { + var branch = null; + for (var i = 0; i < this.cookieOpened.length; i++) { + branch = this.getBranchById(this.cookieOpened[i]); + if (typeof(branch) == 'object' && branch.hasChildren()) { + if (branch.children.length > 0) { + // Cette branche est une branche normale + branch.openIt(true); + } else { + // Cette branche est une branche qui a ses enfants sur le serveur + // On va donc les récupérer + if (typeof(branch.struct.onopenpopulate) == 'function' && branch.eventable) { + branch._openPopulate(); + branch.openIt(true); + } + } + } + } + } + }, + + _adjustCheck : function () { + // On ajuste les checks d'après les cookies + var branch = null; + if (this.checkboxes && this.useCookie && this.cookieChecked) { + for (var i = 0; i < this.cookieChecked.length; i++) { + branch = this.getBranchById(this.cookieChecked[i]); + if (typeof(branch) == 'object') { + branch.check(1); + } + } + } + // Si on a des checkboxes, on corrige les images en fonction des checks + if (this.checkboxes && this.checkboxesThreeState) { + var checked = this.getCheckedBranches(); + for (var i = 0; i < checked.length; i++) { + checked[i]._adjustParentCheck(); + } + } + }, + + /** + * Méthode récursive pour récupérer une branche en fonction de son id généré + * + * @access private + * @param string id L'id généré de la branche recherchée + * @param TafelTreeBranch obj La branche courante + * @return TafelBranch La branche sélectionnée + */ + _getBranchByIdObj : function (id, obj) { + try { + var ob = ''; + if (obj.idObj == id) { + return obj; + } + if (typeof(obj.children) == 'object') { + for (var c = 0; c < obj.children.length; c++) { + ob = this._getBranchByIdObj(id, obj.children[c]); + if (ob) { + return ob; + } + } + } + return ob; + } catch (err) { + throw new Error ('_getBranchByIdObj(func) : ' + err.message); + } + }, + + /** + * Méthode récursive pour récupérer une branche en fonction de son id utilisateur + * + * @access private + * @param string id L'id utilisateur de la branche recherchée + * @param TafelTreeBranch obj La branche courante + * @return TafelBranch La branche sélectionnée + */ + _getBranchById : function (id, obj) { + try { + var ob = ''; + if (obj.getId() == id) { + return obj; + } + if (typeof(obj.children) == 'object') { + for (var c = 0; c < obj.children.length; c++) { + ob = this._getBranchById(id, obj.children[c]); + if (ob) { + return ob; + } + } + } + return ob; + } catch (err) { + throw new Error ('_getBranchById(func) : ' + err.message); + } + }, + + /** + * Fonction qui change la structure de la branche + * + * @access private + * @param TafelTreeBranch branch La nouvelle structure + * @return void + */ + _changeStruct : function (branch) { + try { + while (typeof(branch.parent) != 'undefined') { + branch.parent.struct.items.splice(branch.pos, 1, branch.struct); + if (typeof(branch.parent) != 'undefined') { + branch = branch.parent; + } + } + } catch (err) { + throw new Error ('_changeStruct(func) : ' + err.message); + } + }, + + /** + * Méthode pour ajouter l'élément principal + * + * @access private + * @return HTMLDivElement L'élément DIV créé + */ + _addTree : function () { + var div = document.createElement('div'); + div.className = this.classTree; + return div; + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTree Cookies Management + *------------------------------------------------------------------------------ + */ + + /** + * Méthode qui sauve le contenu dans le cookie. Propre à l'application + * + * @access public + * @param string name Nom du cookie + * @return void + */ + setCookie : function (name) { + try { + var str = 'cookieactivate' + this.cookieSeparator; + // Les branches ouvertes + var arr = this.getOpenedBranches(); + for (var i = 0; i < arr.length; i++) { + str = str + arr[i].getId() + this.cookieSeparator; + } + // Les branches checkées + str += this.cookieCheckSeparator; + var arr = this.getCheckedBranches(); + for (var i = 0; i < arr.length; i++) { + str = str + arr[i].getId() + this.cookieSeparator; + } + if (!this.serverCookie) { + this._saveCookie(name, str, '', '/', '', ''); + } else { + // send cookie server only if tree is loaded (optimization) + if (this.loaded) { + new Ajax.Request(this.serverCookie, { + 'method' : 'post', + 'parameters' : 'type=set&cookieString=' + str, + 'onComplete' : this._cookieSend.bind(this), + 'onFailure' : this._cookieFailure.bind(this) + }); + } + } + } catch (err) { + throw new Error ('setCookie(func) : ' + err.message); + } + }, + + /** + * Méthode qui récupère le contenu d'un cookie en fonction du nom + * + * @access public + * @param string name Nom du cookie + * @return string Le contenu du cookie + */ + getCookie : function (name) { + try { + if (!this.serverCookie) { + if (name != ''){ + var start = document.cookie.indexOf(name + '='); + var len = start + name.length + 1; + if ((!start) && (name != document.cookie.substring(0, name.length))){ + return null; + } + if ( start == -1 ) return null; + var end = document.cookie.indexOf(';', len); + if (end == -1){ + end = document.cookie.length; + } + return unescape(document.cookie.substring(len, end)); + } + } else { + new Ajax.Request(this.serverCookie, { + 'method' : 'post', + 'parameters' : 'type=get', + 'onComplete' : this._getCookieComplete.bind(this), + 'onFailure' : this._cookieFailure.bind(this) + }); + } + return null; + } catch (err) { + throw new Error ('getCookie(func) : ' + err.message); + } + }, + + _cookieSend : function (response) { + alert('ok'); + }, + + _getCookieComplete : function (response) { + var fromCookie = response.responseText; + if (fromCookie) { + var branches = fromCookie.split(this.cookieCheckSeparator); + // Branches ouvertes + this.cookieOpened = []; + this.cookieOpened = branches[0].split(this.cookieSeparator); + this.cookieOpened.shift(); + // Branches checkées (avec anti-bug pour les anciennes versions et anciens cookies) + this.cookieChecked = []; + if (branches.length > 1) { + this.cookieChecked = branches[1].split(this.cookieSeparator); + } + } + if (this.options.generate) { + this.generate(); + } + if (this.options.generateBigTree) { + this.generate(true); + } + }, + + _cookieFailure : function (response) { + // do nothing + }, + + /** + * Méthode qui supprime un cookie. Seul le nom est obligatoire + * + * @access public + * @param string name Nom du cookie + * @param string path Le chemin + * @param string domain Le domaine + * @return void + */ + deleteCookie : function (name, path, domain) { + try { + if (get_cookie(name)) document.cookie = name + '=' + + ( ( path ) ? ';path=' + path : "") + + ( ( domain ) ? ';domain=' + domain : '') + + ';expires=Thu, 01-Jan-1970 00:00:01 GMT'; + } catch (err) { + throw new Error ('deleteCookie(func) : ' + err.message); + } + }, + + /** + * Méthode qui sauve le contenu dans le cookie. Propre à toute application + * + * @access private + * @param string name Nom du cookie + * @param string value La valeur à enregistrer + * @param integer expires La durée de vie du cookie, en jour + * @param string path Le chemin + * @param string domain Le domaine + * @param string secure ? + * @return void + */ + _saveCookie : function (name, value, expires, path, domain, secure) { + try { + // set time, it's in milliseconds + var today = new Date(); + today.setTime(today.getTime()); + if (expires){ + expires = expires * 1000 * 60 * 60 * 24; + } + var expires_date = new Date(today.getTime() + (expires)); + + document.cookie = name + '=' +escape(value) + + ( ( expires ) ? ';expires=' + expires_date.toGMTString() : '') + + ( ( path ) ? ';path=' + path : '') + + ( ( domain ) ? ';domain=' + domain : '') + + ( ( secure ) ? ';secure' : ''); + } catch (err) { + throw new Error ('_saveCookie(func) : ' + err.message); + } + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTree Events Management + *------------------------------------------------------------------------------ + */ + + /** + * Méthode qui appelle la méthode utilisateur après le load de l'arbre + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnLoad : function (func) { + this.onLoad = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur pendant le load de l'arbre + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnLoading : function (func) { + this.onLoading = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur après l'ouverture ou fermeture d'un noeud + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnOpen : function (func) { + this.onOpen = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur avant l'ouverture ou fermeture d'un noeud + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnBeforeOpen : function (func) { + this.onBeforeOpen = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur lorsque la souris est sur un noeud + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnMouseOver : function (func) { + this.onMouseOver = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur lorsque la souris quitte le noeud + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnMouseOut : function (func) { + this.onMouseOut = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur après un clic sur un noeud + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnClick : function (func) { + this.onClick = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur après un mouse down + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnMouseDown : function (func) { + this.onMouseDown = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur après un mouse up + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnMouseUp : function (func) { + this.onMouseUp = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur lors d'un double-clic sur un noeud + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnDblClick : function (func) { + this.onDblClick = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur lors de la fin de l'édition d'une branche + * + * @access public + * @param function func La fonction utilisateur + * @param string link Le lien de la page ajax + * @return void + */ + setOnEdit : function (func, link) { + if (link) { + this.onEditAjax = { + 'func' : eval(func), + 'link' : link + }; + } else { + this.onEdit = eval(func); + } + this.editableBranches = true; + }, + + /** + * Méthode qui appelle la méthode utilisateur lorsqu'on clique sur une checkbox, avant que celle-ci change de status + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnBeforeCheck : function (func) { + this.onBeforeCheck = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur lorsqu'on clique sur une checkbox, après qu'elle ait changé de status + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnCheck : function (func) { + this.onCheck = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur lors d'un drop sur un noeud + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnDrop : function (func) { + this.onDrop = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur après un drop sur un noeud + * + * @access public + * @param function func La fonction utilisateur + * @return void + */ + setOnDropAfter : function (func) { + this.onErrorAjax = eval(func); + }, + + /** + * Méthode qui appelle la méthode utilisateur lors d'un drop sur un noeud + * + * @access public + * @param function func La fonction utilisateur + * @param string link Le lien de la page ajax + * @param boolean propagateRestiction True pour interdir le mouvement des enfants de la branche droppée + * @return void + */ + setOnDropAjax : function (func, link) { + this.onDropAjax = { + 'func' : eval(func), + 'link' : link + }; + }, + + /** + * Fonction appelée au retour de la requête Ajax après un open de la branche + * + * @access public + * @param function|boolean func La fonction utilisateur ou true + * @param string link Le lien de la page ajax + * @return void + */ + setOnOpenPopulate : function (func, link) { + this.onOpenPopulate = { + 'func' : eval(func), + 'link' : link + }; + }, + + /** + * Méthode qui appelle la méthode utilisateur lors de la fin de l'édition d'une branche + * + * @access public + * @param function func La fonction utilisateur + * @param string link Le lien de la page ajax + * @return void + */ + setOnEditAjax : function (func, link) { + this.onEditAjax = { + 'func' : eval(func), + 'link' : link + }; + this.editableBranches = true; + }, + + setOnDragStartEffect : function (func) { + this.onDragStartEffect = eval(func); + }, + + setOnDragEndEffect : function (func) { + this.onDragEndEffect = eval(func); + } +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + *------------------------------------------------------------------------------ + * Abstract TafelTreeBaseBranch Class + *------------------------------------------------------------------------------ + */ + +var TafelTreeBaseBranch = Class.create(); + +TafelTreeBaseBranch.prototype = { + + initialize : function () {}, + + + /** + *------------------------------------------------------------------------------ + * TafelTreeBaseBranch getters & setters + *------------------------------------------------------------------------------ + */ + + getId : function () { + return this.struct.id; + }, + + getText : function () { + return this.struct.txt; + }, + + getLevel : function () { + return this.level; + }, + + getTree : function () { + return this.tree; + }, + + getParent : function () { + return (this.isRoot) ? null : this.parent; + }, + + /** + * Retourne la racine parente, null s'il n'y en a pas + * + * @access public + * @return TafelTreeRoot La racine parente + */ + getAncestor : function () { + return (this.isRoot) ? null : this.root; + }, + + /** + * Retourne tous les parents, racine comprise. + * + * Le 1er élément du tableau est le parent direct, le dernier étant + * la racine + * + * @access public + * @return array Les parents + */ + getParents : function () { + var parents = []; + var branch = this; + while (branch.parent) { + parents.push(branch.parent); + branch = branch.parent; + } + return parents; + }, + + getChildren : function () { + return this.children; + }, + + getIcon : function () { + return this.struct.img; + }, + + getOpenIcon : function () { + return this.struct.imgopen; + }, + + getCloseIcon : function () { + return this.struct.imgclose; + }, + + getIconSelected : function () { + return this.struct.imgselected; + }, + + getOpenIconSelected : function () { + return this.struct.imgopenselected; + }, + + getCloseIconSelected : function () { + return this.struct.imgcloseselected; + }, + + getCurrentIcon : function () { + var img = this._getImgInfo(this.img); + return img.fullName; + }, + + setText : function (text) { + this.struct.txt = text; + this.txt.innerHTML = text; + }, + + setIcons : function (icon, iconOpen, iconClose) { + this.struct.img = icon; + this.struct.imgopen = (iconOpen) ? iconOpen : icon; + this.struct.imgclose = (iconClose) ? iconClose : icon; + if (this.hasChildren()) { + this.img.src = (this.isOpened()) ? this.tree.imgBase + this.struct.imgopen : this.tree.imgBase + this.struct.imgclose; + } else { + this.img.src = this.tree.imgBase + this.struct.img; + } + }, + + setIconsSelected : function (icon, iconOpen, iconClose) { + this.struct.imgselected = icon; + this.struct.imgopenselected = (iconOpen) ? iconOpen : null; + this.struct.imgcloseselected = (iconClose) ? iconClose : null; + if (this.isSelected()) { + if (this.hasChildren()) { + this.img.src = (this.isOpened()) ? this.tree.imgBase + this.struct.imgopenselected : this.tree.imgBase + this.struct.imgcloseselected; + } else { + this.img.src = this.tree.imgBase + this.struct.imgselected; + } + } + }, + + /** + * Méthode qui change l'id de l'élément. A utiliser avec parcimonie + * + * @access public + * @param string newId Le nouvel id + * @return boolean True si tout est ok, false si l'id existe déjà dans l'arbre + */ + changeId : function (newId) { + var used = this.tree.getBranchById(newId); + if (!used) { + this.struct.id = newId; + this.tree._changeStruct(this); + return true; + } else { + return false; + } + }, + + /** + * Méthode qui détermine si l'élément a des enfants ou non* + * + * @access public + * @return boolean True s'il a des enfants, false sinon + */ + hasChildren : function () { + return (this.struct.items.length > 0 || this.struct.canhavechildren) ? true : false; + }, + + isOpened : function () { + return (this.struct.open) ? true : false; + }, + + isAlwaysLast : function () { + return (this.struct.last) ? true : false; + }, + + isOpenedInCookie : function () { + if (this.tree.useCookie && this.tree.cookieOpened) { + for (var i = 0; i < this.tree.cookieOpened.length; i++) { + if (this.getId() == this.tree.cookieOpened[i]) return true; + } + } + return false; + }, + + /** + * Retourne true si la branche est visible + * + * @access public + * @return boolean True si la branche est visible, false sinon + */ + isVisible : function () { + var visible = true; + var branch = this; + while (branch.parent) { + if (branch.parent.isOpened()) { + branch = branch.parent; + } else { + visible = false; + break; + } + } + return visible; + }, + + /** + * Retourne TRUE si la branche est sélectionnée + * + * @access public + * @return boolean True si la branche est sélectionnée, false sinon + */ + isSelected : function () { + return (Element.hasClassName(this.txt, this.tree.classSelected)) ? true : false; + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTreeBaseBranch public functions + *------------------------------------------------------------------------------ + */ + + /** + * Rafraichit les enfants de la branche en fonction de ce qu'il y a sur le serveur + * + * @access public + * @return void + */ + refreshChildren : function () { + this.removeChildren(); + this._openPopulate(); + }, + + /** + * Clone toute la structure de la branche + * + * @access public* + * @param boolean withDefaultFunc True pour copier les fonctions par defaut de l'arbre + * @return object La structure JSON de la branche + */ + clone : function (withDefaultFunc) { + var struct = {}; + for (var property in this.struct) { + if (property != 'items') { + // On prend les fonctions seulement si elles sont définies pour la branche + if (!withDefaultFunc && typeof(this.struct[property]) == 'function') { + if (!eval('this.' + property + 'Default')) { + struct[property] = this.struct[property]; + } + } else { + struct[property] = this.struct[property]; + } + } + } + if (this.hasChildren()) { + struct.items = []; + for (var i = 0; i < this.children.length; i++) { + struct.items.push(this.children[i].clone(withDefaultFunc)); + } + } + this.copiedTimes++; + struct.id = struct.id + this.tree.copyNameBreak + this.tree.idTree; + struct.txt = struct.txt + this.tree.copyName.replace('%n', this.copiedTimes); + return struct; + }, + + /** + * Retourne le premier enfant de la branche, ou null s'il y en a pas + * + * @access public + * @return TafelTreeBranch Le premier enfant de la branche + */ + getFirstBranch : function () { + return (this.children.length > 0) ? this.children[0] : null; + }, + + /** + * Retourne le dernier enfant de la branche, ou null s'il y en a pas + * + * @access public + * @return TafelTreeBranch Le dernier enfant de la branche + */ + getLastBranch : function () { + var pos = this.children.length - 1; + return (pos >= 0) ? this.children[pos] : null; + }, + + /** + * Fonction qui récupère la branche précédente du même niveau + * + * @access public + * @return TafelTreeBranch La branche si elle existe, null sinon + */ + getPreviousSibling : function () { + var pos = this.pos - 1; + var branch = null; + if (this.isRoot) { + if (pos >= 0) branch = this.tree.roots[pos]; + } else { + if (pos >= 0) branch = this.parent.children[pos]; + } + return branch; + }, + + /** + * Fonction qui récupère la branche suivante du même niveau + * + * @access public + * @return TafelTreeBranch La branche si elle existe, null sinon + */ + getNextSibling : function () { + var pos = this.pos + 1; + var branch = null; + if (this.isRoot) { + if (pos < this.tree.roots.length) branch = this.tree.roots[pos]; + } else { + if (pos < this.parent.children.length) branch = this.parent.children[pos]; + } + return branch; + }, + + /** + * Retourne la branche précédente dans l'arbre, pas forcément de même niveau + * + * @access public + * @return TafelTreeBranch La branche précédente, null s'il n'y en a pas + */ + getPreviousBranch : function () { + var branch = null; + var previous = this.getPreviousSibling(); + // Si elle a une soeur précédente + if (previous) { + // On regarde si elle a des enfants et est ouverte + if (previous.hasChildren()) { + // Si oui, on prend son dernier enfant + while (previous.hasChildren()) { + previous = previous.getLastBranch(); + } + branch = previous; + } else { + // Si ce n'est pas le cas, on la prend elle + branch = previous; + } + } else { + // Si elle n'a pas de soeur précédente, on prend le parent (s'il existe) + if (this.parent) { + branch = this.parent; + } + } + return branch; + }, + + /** + * Retourne la branche suivante dans l'arbre, pas forcément de même niveau + * + * @access public + * @return TafelTreeBranch La branche suivante, null s'il n'y en a pas + */ + getNextBranch : function () { + var branch = null; + // Récupère le premier enfant, s'il y en a un + branch = this.getFirstBranch(); + if (!branch) { + // Récupère sa prochaine soeur + branch = this.getNextSibling(); + if (!branch) { + // Récupère la soeur du parent ou tout du moins d'un ancêtre + var b = null; + branch = this.parent; + while (!b && branch) { + b = branch.getNextSibling(); + branch = branch.parent; + } + branch = b; + } + } + return branch; + }, + + /** + * Retourne la branch ouverte précédente (pas forcément du même niveau) + * + * @access public + * @return TafelTreeBranch La branche précédente ouverte, null s'il n'y en a pas + */ + getPreviousOpenedBranch : function () { + var branch = null; + var previous = this.getPreviousSibling(); + // Si elle a une soeur précédente + if (previous) { + // On regarde si elle a des enfants et est ouverte + if (previous.hasChildren() && previous.isOpened()) { + // Si oui, on prend son dernier enfant + while (previous.hasChildren() && previous.isOpened()) { + previous = previous.getLastBranch(); + } + branch = previous; + } else { + // Si ce n'est pas le cas, on la prend elle + branch = previous; + } + } else { + // Si elle n'a pas de soeur précédente, on prend le parent (s'il existe) + if (this.parent) { + branch = this.parent; + } + } + return branch; + }, + + /** + * Retourne la branch ouverte suivante (pas forcément du même niveau) + * + * @access public + * @return TafelTreeBranch La branche suivante ouverte, null s'il n'y en a pas + */ + getNextOpenedBranch : function () { + var branch = null; + // Si elle a des enfants et qu'elle est ouverte, on prend le 1er + if (this.hasChildren() && this.isOpened()) { + branch = this.getFirstBranch(); + } else { + // Si elle a pas d'enfants, on prend sa prochaine soeur + var next = this; + while (!branch) { + branch = next.getNextSibling(); + next = next.parent; + if (!next) break; + } + } + return branch; + }, + + /** + * Fonction qui supprime tous les enfants + * + * @access public + * @return boolean True si la branche est un enfant de elem + */ + removeChildren : function () { + // On utilise concat() pour ne pas faire de référence sur this.children + var children = this.children.concat(); + for (var i = 0; i < children.length; i++) { + this.tree.removeBranch(children[i]); + } + }, + + /** + * Fonction qui détermine si la branche est enfant de elem + * + * @access public + * @param TafelTreeBranch elem La branche dont on veut savoir si elle est un ancêtre + * @return boolean True si la branche est un enfant de elem + */ + isChild : function (elem) { + var elem = this.tree.getBranchById(elem); + if (!elem) return false; + return this._isChild(this, elem); + }, + + /** + * Fonction qui ouvre ou ferme la branche + * + * @access public + * @param boolean open True pour ouvrir la branche + * @return void + */ + openIt : function (open) { + try { + if (!open) { + this._closeChild(); + if (this.tree.multiline) { + this._manageMultiline(this.tdImg, 2, false); + } + } else { + if (this.tree.onlyOneOpened) { + this.closeSiblings(); + } + this._openChild(); + if (this.tree.multiline) { + this._manageMultiline(this.tdImg, 2, true); + } + } + if (this.tree.useCookie) { + this.tree.setCookie(this.tree.classTree + this.tree.id); + } + } catch (err) { + throw new Error ('openIt(base) : ' + err.message); + } + }, + + /** + * Fonction qui insère une branche comme enfant, en fin de liste + * + * @access public + * @param object item La nouvelle branche + * @return void + */ + insert : function (item) { + return this.insertIntoLast(item); + }, + insertIntoLast : function (item) { + var pos = this.children.length; + var isNotFirst = (this.hasChildren()) ? true : false; + this.children[pos] = new TafelTreeBranch((this.isRoot) ? this : this.root, this, item, this.level + 1, isNotFirst, false, pos); + this.struct.items[pos] = item; + this.obj.appendChild(this.children[pos].obj); + this._manageAfterInsert(pos); + return this.children[pos]; + }, + + insertIntoFirst : function (item) { + var pos = 0; + var posBefore = 1; + var isNotLast = (this.hasChildren()) ? false : true; + this._movePartStruct(pos); + this.struct.items[pos] = item; + this.children[pos] = new TafelTreeBranch((this.isRoot) ? this : this.root, this, item, this.level + 1, false, isNotLast, pos); + try { + this.obj.insertBefore(this.children[pos].obj, this.children[posBefore].obj); + } catch (err) { + this.obj.appendChild(this.children[pos].obj); + } + this._manageAfterInsert(pos); + return this.children[pos]; + }, + + /** + * Fonction qui ferme toutes les branches soeurs + * + * @access public + * @return void + */ + closeSiblings : function () { + var obj = null; + if (this.parent) { + for (var i = 0; i < this.parent.children.length; i++) { + obj = this.parent.children[i]; + if (obj.idObj != this.idObj && obj.hasChildren()) { + obj.openIt(false); + } + } + } else if (this.isRoot) { + for (var i = 0; i < this.tree.roots.length; i++) { + obj = this.tree.roots[i]; + if (obj.idObj != this.idObj && obj.hasChildren()) { + obj.openIt(false); + } + } + } + }, + + /** + * Ajoute une classe CSS au texte + * + * @access public + * @param string style Le style CSS à ajouter + * @return void + */ + addClass : function (style) { + Element.addClassName(this.txt, style); + }, + + /** + * Retire une classe CSS du texte + * + * @access public + * @param string style Le style CSS à enlever + * @return void + */ + removeClass : function (style) { + Element.removeClassName(this.txt, style); + }, + + /** + * Retourne un objet anonyme représentant l'image précédant l'icône (un plus, par ex.) + * + * L'objet a cette structure : + var obj = { + 'img' : HTMLimgElement, + 'number' : Le numéro de l'image (juste avant l'extension), + 'type' : le nom de l'image sans le numéro et sans l'extension + 'name' : Le nom de l'image sans l'extension, + 'fullName': Le nom de l'image avec l'extension + }; + * + * @access public + * @return object L'objet anonyme de l'image + */ + getImgBeforeIcon : function () { + try { + var img = this.beforeIcon.getElementsByTagName('img')[0]; + return this._getImgInfo(img); + } catch (err) { + throw new Error ('getImgBeforeIcon(base) : ' + err.message); + } + }, + + /** + * Fonction change l'icône en fonction des enfants, s'il y en a ou pas + * + * @access public + * @param boolean openable True pour mettre l'icone d'ouverture + * @return void + */ + setOpenableIcon : function (openable) { + var im = this.getImgBeforeIcon(); + var img = im.img; + if (openable) { + this.struct.open = true; + this.img.src = this.tree.imgBase + this.struct.imgopen; + if (!this.isRoot) { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgMinus3 : this.tree.imgBase + this.tree.imgMinus2; + } else { + if (this.hasSiblingsBefore) { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgMinus3 : this.tree.imgBase + this.tree.imgMinus2; + } else { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgMinus4 : this.tree.imgBase + this.tree.imgMinus5; + } + } + Event.observe(img, 'click', this.setOpen.bindAsEventListener(this), false); + Event.observe(img, 'mouseover', this.evt_openMouseOver.bindAsEventListener(this), false); + Event.observe(img, 'mouseout', this.evt_openMouseOut.bindAsEventListener(this), false); + } else { + this.struct.open = false; + this.struct.canhavechildren = false; + this.img.src = this.tree.imgBase + this.struct.img; + var td = img.parentNode; + var newImg = document.createElement('img'); + td.removeChild(img); + if (!this.isRoot) { + newImg.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgLine3 : this.tree.imgBase + this.tree.imgLine2; + } else { + if (this.hasSiblingsBefore) { + newImg.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgLine3 : this.tree.imgBase + this.tree.imgLine2; + } else { + newImg.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgLine4 : this.tree.imgBase + this.tree.imgLine5; + } + } + td.appendChild(newImg); + } + }, + + /** + * Fonction qui affiche la branche de manière cool + * + * @access public + * @return string La string à afficher + */ + toString : function () { + var str = (this.isRoot) ? 'TafelTreeRoot {' : 'TafelTreeBranch {'; + // Définition de toutes les propriétés + var strSave = ''; + for (var attr in this.struct) { + if (attr != 'items') { + strSave = (typeof(this.struct[attr]) != 'function') ? this.struct[attr] : true; + str += TafelTree.debugReturn + TafelTree.debugTab + attr + ' : ' + strSave; + } + } + str += TafelTree.debugReturn + TafelTree.debugTab + 'children : ' + this.children.length; + str += TafelTree.debugReturn + '}'; + return str; + }, + + isChecked : function (dbg) { + if (this.tree.checkboxes && this.checkbox) { + var img = this._getImgInfo(this.checkbox); + if (img.fullName.replace('_over', '') == this.tree.imgCheck2) { + return 1; + } + if (img.fullName.replace('_over', '') == this.tree.imgCheck3) { + return -1; + } + return 0; + } + return 0; + }, + + getCheckbox : function () { + return (this.checkbox) ? this.checkbox : false; + }, + + check : function (checked) { + if (this.checkbox) { + if (checked == -1) { + this.checkbox.src = this.tree.imgBase + this.tree.imgCheck3; + this.struct.check = -1; + } else if (checked) { + this.checkbox.src = this.tree.imgBase + this.tree.imgCheck2; + this.struct.check = 1; + if (this.tree.useCookie) { + this.tree.setCookie(this.tree.classTree + this.tree.id); + } + } else { + this.checkbox.src = this.tree.imgBase + this.tree.imgCheck1; + this.struct.check = 0; + if (this.tree.useCookie) { + this.tree.setCookie(this.tree.classTree + this.tree.id); + } + } + } + }, + + /** + * Fonction qui retourne 1 si tous les enfants sont checkés, 0 si aucun et -1 si quelques uns + * + * @access public + * @return integer 1 si tout check, 0 si aucun, -1 si pas tous + */ + hasAllChildrenChecked : function () { + var allChecked = false; + var anyChecked = false; + for (var i = 0; i < this.children.length; i++) { + if (this.children[i].isChecked() == -1) { + allChecked = true; + anyChecked = true; + break; + } + if (this.children[i].isChecked() == 1) allChecked = true; + else anyChecked = true; + } + if (allChecked && anyChecked) return -1; + if (allChecked) return 1; + else return 0; + }, + + /** + * Permet d'intervertir les deux branches. Elles conserveront toutes leurs + * caractéristiques (heureusement) + * + * @access public + * @param TafelTreeBranch branchId L'id de l'autre branche ou l'autre branche elle-même + * @return void + */ + switchWith : function (branchId) { + var branch = this.tree.getBranchById(branchId); + if (!branch) return false; + + var copyThis = this.copiedTimes; + var newThis = this.clone(); + var txtThis = this.getText(); + var idThis = this.getId(); + var copyBanch = branch.copiedTimes; + var newBranch = branch.clone(); + var txtBranch = branch.getText(); + var idBranch = branch.getId(); + // On change l'id de la branche courante + this.changeId('temp_switch_change_' + this.tree.idTree); + // Inversion des branches + var n1 = branch.insertBefore(newThis); + this.tree.removeBranch(branch); + n1.setText(txtThis); + n1.changeId(idThis); + n1.copiedTimes = copyThis; + var n2 = this.insertBefore(newBranch); + this.tree.removeBranch(this); + n2.setText(txtBranch); + n2.changeId(idBranch); + n2.copiedTimes = copyBranch; + }, + + /** + * Remplace la branche passée en paramètre par l'autre. + * + * @access public + * @param TafelTreeBranch branchId L'id de la branche à remplacer ou l'objet lui-même + * @param boolean copy True pour faire une copie de la branche qui remplace + * @return TafelTreeBranch La branche remplacée + */ + replace : function (branchId, copy) { + var branch = this.tree.getBranchById(branchId); + if (!branch) return false; + + // Préparation du remplacement + var copyThis = this.copiedTimes; + var newThis = this.clone(); + var n1 = branch.insertBefore(newThis); + this.tree.removeBranch(branch); + if (!copy) { + var idThis = this.getId(); + n1.setText(this.getText()) + this.tree.removeBranch(this); + n1.changeId(idThis); + n1.copiedTimes = copyThis; + } + return n1; + }, + + /** + * Méthode récursive qui ouvre la branche + * + * @access public + * @return void + */ + expend : function () { + if (this.isOpened() != true && this.hasChildren()) { + this.openIt(true); + } + for (var i = 0; i < this.children.length; i++) { + this.children[i].expend(); + } + }, + + /** + * Méthode récursive qui ferme la branche + * + * @access public + * @return void + */ + collapse : function () { + if (this.isOpened() != false && this.hasChildren()) { + this.openIt(false); + } + for (var i = 0; i < this.children.length; i++) { + this.children[i].collapse(); + } + }, + + /** + * Retourne toutes les branches de l'arbre + * + * @access public + * @param function filter Le filtre des branches + * @param array [branches] Optionnel, le tableau des branches incomplet + * @return array Un tableau des branches de l'arbre + */ + getBranches : function (filter, branches) { + if (!branches) branches = []; + for (var i = 0; i < this.children.length; i++) { + if (typeof(filter) == 'function') { + if (filter(this.children[i])) { + branches.push(this.children[i]); + } + } else { + branches.push(this.children[i]); + } + branches = this.children[i].getBranches(filter, branches); + } + return branches; + }, + + /** + * Retourne les branches parentes (qui ont des enfants) + * + * @access public + * @param array [parent] Optionnel, le tableau des branches parentes incomplet + * @return array Le tableau des branches parentes complet + */ + getParentBranches : function (parents) { + if (!parents) parents = []; + for (var i = 0; i < this.children.length; i++) { + if (this.children[i].hasChildren()) { + parents.push(this.children[i]); + } + parents = this.children[i].getParentBranches(parents); + } + return parents; + }, + + /** + * Retourne les branches qui n'ont pas d'enfants + * + * @access public + * @param array [leafs] Optionnel, le tableau des branches incomplet + * @return array Le tableau des branches complet + */ + getLeafBranches : function (leafs) { + if (!leafs) leafs = []; + for (var i = 0; i < this.children.length; i++) { + if (!this.children[i].hasChildren()) { + leafs.push(this.children[i]); + } + leafs = this.children[i].getLeafBranches(leafs); + } + return leafs; + }, + + /** + * Retourne le nombre de branche comprises dans la branche courante + * + * @access public + * @return integer Le nombre de branches + */ + countBranches : function () { + var nb = this.children.length; + for (var i = 0; i < this.children.length; i++) { + nb += this.children[i].countBranches(); + } + return nb; + }, + + /** + * Méthode récursive qui détermine si la branche est ouverte ou non + * + * @access public + * @param array openedBranches Le tableau des branches ouvertes + * @return void + */ + getOpenedBranches : function (openedBranches) { + if (!openedBranches) openedBranches = []; + for (var i = 0; i < this.children.length; i++) { + if (this.children[i].isOpened() && this.children[i].hasChildren()) { + openedBranches.push(this.children[i]); + } + openedBranches = this.children[i].getOpenedBranches(openedBranches); + } + return openedBranches; + }, + + /** + * Méthode récursive qui détermine si la branche est checkée + * + * @access private + * @param array checkedBranches Le tableau des branches checkées + * @return void + */ + getCheckedBranches : function (checkedBranches) { + return this._getCheckedBranches(checkedBranches, 1); + }, + + /** + * Méthode récursive qui détermine si la branche est checkée + * + * @access private + * @param array checkedBranches Le tableau des branches checkées + * @return void + */ + getUnCheckedBranches : function (checkedBranches) { + return this._getCheckedBranches(checkedBranches, 0); + }, + + /** + * Méthode récursive qui détermine si la branche est checkée + * + * @access private + * @param array checkedBranches Le tableau des branches checkées + * @return void + */ + getPartCheckedBranches : function (checkedBranches) { + return this._getCheckedBranches(checkedBranches, -1); + }, + + /** + * Sélectionne la branche + * + * @access public + * @param Event ev L'événement déclencheur + * @return void + */ + select : function (ev) { + var ctrl = (ev) ? TafelTreeManager.ctrlOn(ev) : false; + var shift = (ev) ? TafelTreeManager.shiftOn(ev) : false; + if (ctrl) { + this.tree.selectedBranches.push(this); + } else if (shift && this.tree.selectedBranches.length > 0) { + var last = this.tree.selectedBranches.length - 1; + var sel = this.tree.getBranchesBetween(this.tree.selectedBranches[last], this); + for (var i = 0; i < sel.length; i++) { + this.tree.selectedBranches.push(sel[i]); + Element.addClassName(sel[i].txt, this.tree.classSelected); + } + } else { + this.tree.unselect(); + this.tree.selectedBranches.push(this); + } + Element.addClassName(this.txt, this.tree.classSelected); + // On set l'icône s'il doit changer + if (this.isOpened() && this.hasChildren() && this.getOpenIconSelected()) { + this.img.src = this.tree.imgBase + this.getOpenIconSelected(); + } else if (!this.isOpened() && this.hasChildren() && this.getCloseIconSelected()) { + this.img.src = this.tree.imgBase + this.getCloseIconSelected(); + } else if (!this.hasChildren() && this.getIconSelected()) { + this.img.src = this.tree.imgBase + this.getIconSelected(); + } + if (ev) Event.stop(ev); + }, + + /** + * Désélectionne la branche + * + * @access public + * @return boolean True si la branche a pu être déselectionnée, false sinon + */ + unselect : function () { + var ln = this.tree.selectedBranches.length; + if (ln > 0) { + for (var i = 0; i < ln; i++) { + if (this.tree.selectedBranches[i].getId() == this.getId()) { + this.tree.selectedBranches.splice(i, 1); + Element.removeClassName(this.txt, this.tree.classSelected); + // On set l'icône s'il doit changer + if (this.hasChildren()) { + this.img.src = (this.isOpened()) ? this.tree.imgBase + this.struct.imgopen : this.tree.imgBase + this.struct.imgclose; + } else { + this.img.src = this.tree.imgBase + this.struct.img; + } + return true; + } + } + } + return false; + }, + + /** + * Calcule la position de la branche à l'intérieur de l'arbre + * + * @access public + * @return array [0] Left pos, [1] Top pos + */ + getWithinOffset : function () { + var realPos = Position.positionedOffset(this.txt); + var posTree = Position.positionedOffset(this.tree.div); + var pos = [ + realPos[0] - posTree[0], + realPos[1] - posTree[1] + ]; + return pos; + }, + + /** + * Calcule la position de la branche dans l'écran + * + * @access public + * @return array [0] Left pos, [1] Top pos + */ + getAbsoluteOffset : function () { + return Position.positionedOffset(this.txt); + }, + + /** + * Permet de sérialiser la branche, pour en faire une string au format JSON + * + * Les fonctions ne sont pas encodées dans la string (comme onopen, onclick, etc.). Par contre, on indique + * true si la fonction existe bel et bien pour la branche + * + * @access public + * @param boolean debug True pour afficher le debug de la string + * @param boolean noEncoding True pour ne pas encoder la string automatiquement + * @return string La string JSON de la branche + */ + serialize : function (debug, noEncoding) { + var tab = ''; + var rt = ''; + if (debug) { + rt = TafelTree.debugReturn; + for (var i = 0; i < this.level; i++) { + tab += TafelTree.debugTab; + } + } + var strSave = ''; + var str = rt + tab + '{' + rt; + // Définition de toutes les propriétés + str += tab + '"id":"' + this._encode(this.struct.id) + '"'; + for (var attr in this.struct) { + if (attr != 'items' && attr != 'id') { + strSave = (typeof(this.struct[attr]) != 'function') ? this.struct[attr] : true; + if (this.isBool(strSave)) { + str += "," + rt + tab + '"' + attr + '":' + this._encode(strSave); + } else { + str += "," + rt + tab + '"' + attr + '":"' + this._encode(strSave) + '"'; + } + } + } + // Définition des enfants + if (this.hasChildren()) { + str += ',' + rt + tab + '"items":['; + for (var i = 0; i < this.children.length; i++) { + str += this.children[i].serialize(debug, true); + if (i < this.children.length - 1) { + str += ','; + } + } + str += rt + tab + ']'; + } + str += rt + tab + '}'; + if (!noEncoding) { + return encodeURIComponent(str); + } else { + return str; + } + }, + + isBool : function (str) { + switch (str) { + case 'true': case 'false': + case true: case false: + case '1': case '0' : + case 1: case 0 : + return true; + default : + return false; + } + }, + + showTooltip : function () { + if (this.displayTooltip) { + this.tooltip.style.display = 'block'; + } + }, + + hideTooltip : function () { + if (!this.displayTooltip) { + Element.hide(this.tooltip); + } + }, + + /** + * Fonction récursive qui supprime les liens avec Droppables et Draggable + * + * @access public + * @param TafelTreeBranch obj La branche courante + * @return void + */ + removeDragDrop : function () { + if (this.objDrag) { + this.objDrag.destroy(); + } + Droppables.remove(this.txt); + for (var i = 0; i < this.children.length; i++) { + this.children[i].removeDragDrop(); + } + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTreeBaseBranch private methods + *------------------------------------------------------------------------------ + */ + + /** + * Fonction qui met à jour l'élément en terme de multiline + * + * @access private + * @param HTMLElement element L'élément HTML incriminé + * @param integer type 1 ou 2 (suivant le type de ligne) + * @param boolean add True si on ajoute le multiline, false si on l'enlève + * @return void + */ + _manageMultiline : function (element, type, add) { + switch (type) { + case 2 : + if (!add) { + Element.removeClassName(element, this.tree.imgMulti4); + element.style.background = 'none'; + } else { + Element.addClassName(element, this.tree.imgMulti4); + element.style.background = 'url("' + this.tree.imgBase + this.tree.imgMulti2 + '")'; + element.style.backgroundRepeat = 'repeat-y'; + } + break; + case 1 : + default : + if (!add) { + Element.removeClassName(element, this.tree.imgMulti3); + element.style.background = 'none'; + } else { + Element.addClassName(element, this.tree.imgMulti3); + element.style.background = 'url("' + this.tree.imgBase + this.tree.imgMulti1 + '")'; + element.style.backgroundRepeat = 'repeat-y'; + } + } + }, + + _createTooltip : function () { + var div = document.createElement('div'); + div.className = this.tree.classTooltip; + div.innerHTML = (this.struct.tooltip) ? this.struct.tooltip : ' '; + Event.observe(div, 'mouseover', this.showTooltip.bindAsEventListener(this), false); + return div; + }, + + _manageAfterInsert : function (pos) { + this.tree._changeStruct(this); + this._manageLine(); + // Si on a des checkboxes, on corrige les images en fonction des checks par défaut + if (this.tree.checkboxes && this.tree.checkboxesThreeState) { + this.children[pos]._adjustParentCheck(); + } + if (this.children.length == 1 && !this.struct.canhavechildren) { + this.setOpenableIcon(true); + } + this.openIt((!this.tree.openedAfterAdd && !this.isOpened()) ? false : true); + }, + + _movePartStruct : function (pos) { + var nb = this.struct.items.length - 1; + var newPos = 0; + for (var i = nb; i >= pos; i--) { + newPos = i + 1; + this.struct.items[newPos] = this.struct.items[i]; + this.children[newPos] = this.children[i]; + this.children[newPos].pos = newPos; + } + }, + + /** + * Méthode récursive qui détermine si la branche est checkée ou non + * + * @access private + * @param array checkedBranches Le tableau des branches checkées + * @param boolean checked 1 pour récupérer les branches checkées + * @return void + */ + _getCheckedBranches : function (checkedBranches, checked) { + if (!checkedBranches) checkedBranches = []; + for (var i = 0; i < this.children.length; i++) { + if (this.children[i].isChecked() == checked) { + checkedBranches.push(this.children[i]); + } + checkedBranches = this.children[i]._getCheckedBranches(checkedBranches, checked); + } + return checkedBranches; + }, + + _generate : function () { + var i = this.bigTreeLoading; + if (i < this.struct.items.length) { + if (this.tree.checkboxesThreeState && this.struct.check && typeof(this.struct.items[i].check) == 'undefined') { + this.struct.items[i].check = 1; + } + isNotFirst = (i > 0) ? true : false; + isNotLast = (i < this.struct.items.length - 1) ? true : false; + this.children[i] = new TafelTreeBranch((this.isRoot) ? this : this.root, this, this.struct.items[i], this.level + 1, isNotFirst, isNotLast, i); + this.obj.appendChild(this.children[i].obj); + this.openIt((this.tree.useCookie) ? this.isOpenedInCookie : this.struct.open); + this.tree.loadRunning(this.children[i]); + this.bigTreeLoading++; + setTimeout(this._generate.bind(this), 10); + } else { + this.loaded = true; + } + }, + + _getPos : function () { + pos = this.children.length; + for (var i = 0; i < this.children.length; i++) { + if (this.children[i].isAlwaysLast()) { + pos--; + } + } + if (pos < 0 ) pos = 0; + return pos; + }, + + /** + * Fonction qui ajuste le check des parent de la branche, suite à un changement + * + * @access private + * @param boolean fromBranch True pour commencer l'ajustement depuis la branche même + * @return void + */ + _adjustParentCheck : function (fromBranch) { + if (this.parent) { + var branch = (!fromBranch) ? this.parent : this; + while (branch && branch.checkbox) { + branch.check(branch.hasAllChildrenChecked()); + branch = branch.parent; + } + } + }, + + /** + * Fonction récursive qui va changer le status des checkboxes enfants + * + * @access private + * @param TafelTreeBranch branch La branche courante + * @param boolean checked True ou false + * @return void + */ + _manageCheckThreeState : function (branch, checked) { + for (var i = 0; i < branch.children.length; i++) { + if (branch.tree.checkboxes && branch.children[i].checkbox) { + branch.children[i].check(checked); + branch._manageCheckThreeState(branch.children[i], checked); + } + } + }, + + _getImgInfo : function (img) { + var url = img.src.split('/'); + var name = url[url.length-1].split('.'); + var obj = { + 'img': img, + 'number': name[0].charAt(name[0].length-1), + 'type': name[0].substr(0, name[0].length-1), + 'name': name[0], + 'fullName': url[url.length-1] + }; + return obj; + }, + + /** + * Permet d'encoder la string avant l'envoi en JSON + * + * @access private + * @param string str La string correspondant à la propriété (this.struct.*) + * @return string La valeur de la propriété encodée + */ + _encode : function (str) { + //var obj = eval(str); + var obj = (str === null) ? '' : str; + return obj.toString().replace(/\"/g, '\\"'); + }, + + _closeChild : function (img) { + try { + img = this.getImgBeforeIcon().img; + this.struct.open = false; + if (this.isSelected() && this.getCloseIconSelected()) { + this.img.src = this.tree.imgBase + this.getCloseIconSelected(); + } else { + this.img.src = this.tree.imgBase + this.struct.imgclose; + } + for (var i = 0; i < this.obj.childNodes.length; i++) { + if (this.obj.childNodes[i].nodeName.toLowerCase() == 'div') { + Element.hide(this.obj.childNodes[i]); + } + } + if (!this.isRoot) { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgPlus3 : this.tree.imgBase + this.tree.imgPlus2; + } else { + if (this.hasSiblingsBefore) { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgPlus3 : this.tree.imgBase + this.tree.imgPlus2; + } else { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgPlus4 : this.tree.imgBase + this.tree.imgPlus5; + } + } + } catch (err) { + throw new Error ('_closeChild(base) : ' + err.message); + } + }, + + _openChild : function (img) { + try { + img = this.getImgBeforeIcon().img; + this.struct.open = true; + if (this.isSelected() && this.getOpenIconSelected()) { + this.img.src = this.tree.imgBase + this.getOpenIconSelected(); + } else { + this.img.src = this.tree.imgBase + this.struct.imgopen; + } + for (var i = 0; i < this.obj.childNodes.length; i++) { + if (this.obj.childNodes[i].nodeName.toLowerCase() == 'div') { + this.obj.childNodes[i].style.display = ''; + } + } + if (!this.isRoot) { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgMinus3 : this.tree.imgBase + this.tree.imgMinus2; + } else { + if (this.hasSiblingsBefore) { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgMinus3 : this.tree.imgBase + this.tree.imgMinus2; + } else { + img.src = (this.hasSiblingsAfter) ? this.tree.imgBase + this.tree.imgMinus4 : this.tree.imgBase + this.tree.imgMinus5; + } + } + } catch (err) { + throw new Error ('_openChild(base) : ' + err.message); + } + }, + + /** + * Fonction qui gère les lignes verticales après un drag and drop + * + * @access private + * @return void + */ + _manageLine : function () { + try { + for (var i = 0; i < this.children.length; i++) { + this.children[i].pos = i; + // Si on est au dernier enfant et que celui-ci n'était pas le dernier avant le remove + if (i == this.children.length - 1 && this.children[i].hasSiblingsAfter) { + this.children[i].hasSiblingsAfter = false; + this._manageMultiline(this.children[i].beforeIcon, 1, false); + this._clearLine(this.children[i], this.level); + } + // Si on n'est pas au dernier enfant et que celui-ci était le dernier avant le remove + if (i < this.children.length - 1 && !this.children[i].hasSiblingsAfter) { + this.children[i].hasSiblingsAfter = true; + this._manageMultiline(this.children[i].beforeIcon, 1, true); + this._addLine(this.children[i], this.level); + } + } + this.tree._changeStruct(this); + } catch (err) { + throw new Error ('_manageLine(base) : ' + err.message); + } + }, + + _manageLineForRoot : function (add) { + for (var i = 0; i < this.children.length; i++) { + this.children[i]._manageLineForRoot(add); + } + var td = this.table.getElementsByTagName('td')[0]; + var img = td.getElementsByTagName('img')[0]; + if (add) { + img.src = this.tree.imgBase + this.tree.imgLine1; + } else { + img.src = this.tree.imgBase + this.tree.imgEmpty; + } + }, + + /** + * Fonction qui supprime des lignes au bon endroit* + * + * @param TafelTreeBranch obj La branche courante + * @param integer level Le niveau où supprimer des lignes + * @param boolean ok False pour le 1er niveau de branche + * @return void + */ + _clearLine : function (obj, level, ok) { + try { + for (var i = 0; i < obj.children.length; i++) { + this._clearLine(obj.children[i], level, true); + } + // On récupère la bonne TD et la bonne image + var img = obj.table.getElementsByTagName('img')[level+1]; + if (ok) { + img.src = this.tree.imgBase + this.tree.imgEmpty; + if (this.tree.multiline) { + this._manageMultiline(img.parentNode, 1, false); + } + } else { + var old = obj.getImgBeforeIcon(); + switch (old.fullName.replace('_over', '')) { + case this.tree.imgLine1 : + case this.tree.imgLine3 : newImg = this.tree.imgLine2; break; + case this.tree.imgPlus1 : + case this.tree.imgPlus3 : newImg = this.tree.imgPlus2; break; + case this.tree.imgMinus1: + case this.tree.imgMinus3: newImg = this.tree.imgMinus2; break; + default: + newImg = obj.fullName; + } + img.src = this.tree.imgBase + newImg; + } + } catch (err) { + throw new Error ('_clearLine(base) : ' + err.message); + } + }, + + /** + * Fonction qui ajoute des lignes au bon endroit* + * + * @param TafelTreeBranch obj La branche courante + * @param integer level Le niveau où ajouter des lignes + * @param boolean ok False pour le 1er niveau de branche + * @return void + */ + _addLine : function (obj, level, ok) { + try { + for (var i = 0; i < obj.children.length; i++) { + this._addLine(obj.children[i], level, true); + } + // On récupère la bonne TD et la bonne image + var img = obj.table.getElementsByTagName('img')[level+1]; + if (ok) { + img.src = this.tree.imgBase + this.tree.imgLine1; + if (this.tree.multiline) { + this._manageMultiline(img.parentNode, 1, true); + } + } else { + var old = obj.getImgBeforeIcon(); + switch (old.fullName.replace('_over', '')) { + case this.tree.imgLine1 : + case this.tree.imgLine2 : newImg = this.tree.imgLine3; break; + case this.tree.imgPlus1 : + case this.tree.imgPlus2 : newImg = this.tree.imgPlus3; break; + case this.tree.imgMinus1: + case this.tree.imgMinus2: newImg = this.tree.imgMinus3; break; + default: + newImg = obj.fullName; + } + img.src = this.tree.imgBase + newImg; + } + } catch (err) { + throw new Error ('_addLine(base) : ' + err.message); + } + }, + + _isChild : function (child, parent) { + try { + if (parent.idObj == child.idObj) return true; + if (child.parent) { + return this._isChild(child.parent, parent); + } + return false; + } catch (err) { + throw new Error ('_isChild(base) : ' + err.message); + } + }, + + /** + * Set les propriétés utilisateur de la branche, ou celles par défaut + * + * @access private + * @return void + */ + _setProperties : function () { + // Images + if ((typeof(this.struct.img) == 'undefined')) { + this.struct.img = (this.tree.icons[0]) ? this.tree.icons[0] : this.tree.imgLine0; + } + if ((typeof(this.struct.imgopen) == 'undefined')) { + this.struct.imgopen = (this.tree.icons[1]) ? this.tree.icons[1] : this.struct.img; + } + if ((typeof(this.struct.imgclose) == 'undefined')) { + this.struct.imgclose = (this.tree.icons[2]) ? this.tree.icons[2] : this.struct.img; + } + if ((typeof(this.struct.imgselected) == 'undefined')) { + this.struct.imgselected = (this.tree.iconsSelected[0]) ? this.tree.iconsSelected[0] : null; + } + if ((typeof(this.struct.imgopenselected) == 'undefined')) { + this.struct.imgopenselected = (this.tree.iconsSelected[1]) ? this.tree.iconsSelected[1] : null; + } + if ((typeof(this.struct.imgcloseselected) == 'undefined')) { + this.struct.imgcloseselected = (this.tree.iconsSelected[2]) ? this.tree.iconsSelected[2] : null; + } + // Fonctions + if (typeof(this.struct.open) == 'undefined') { + this.struct.open = (this.tree.useCookie && this.tree.cookieOpened) ? false : this.tree.openAll; + } else if (this.tree.useCookie && this.tree.cookieOpened) { + this.struct.open = false; + } + + if (typeof(this.struct.check) == 'undefined' || (this.tree.useCookie && this.tree.cookieChecked)) this.struct.check = 0; + + if (typeof(this.struct.items) == 'undefined') { + this.struct.items = []; + } + if (typeof(this.struct.canhavechildren) == 'undefined') this.struct.canhavechildren = false; + if (typeof(this.struct.id) == 'undefined') this.struct.id = this.idObj; + if (typeof(this.struct.acceptdrop) == 'undefined') this.struct.acceptdrop = true; + if (typeof(this.struct.last) == 'undefined') this.struct.last = false; + if (typeof(this.struct.editable) == 'undefined') this.struct.editable = this.tree.editableBranches; + if (typeof(this.struct.checkbox) == 'undefined') this.struct.checkbox = true; + }, + + /** + * Set les fonctions utilisateur et les fonctions par défaut, s'il y en a + * + * @access private + * @return void + */ + _setFunctions : function () { + if (typeof(this.struct.ondragstarteffect) == 'undefined') { + if (typeof(this.tree.onDragStartEffect) == 'function') { + this.struct.ondragstarteffect = this.tree.onDragStartEffect; + this.ondragstarteffectDefault = true; + } + } else {this.struct.ondragstarteffect = eval(this.struct.ondragstarteffect);} + if (typeof(this.struct.ondragendeffect) == 'undefined') { + if (typeof(this.tree.onDragEndEffect) == 'function') { + this.struct.ondragendeffect = this.tree.onDragEndEffect; + this.ondragendeffectDefault = true; + } + } else {this.struct.ondragendeffect = eval(this.struct.ondragendeffect);} + if (typeof(this.struct.onerrorajax) == 'undefined') { + if (typeof(this.tree.onErrorAjax) == 'function') { + this.struct.onerrorajax = this.tree.onErrorAjax; + this.onerrorajaxDefault = true; + } + } else {this.struct.onerrorajax = eval(this.struct.onerrorajax);} + if (typeof(this.struct.oneditajax) == 'undefined') { + if (this.tree.onEditAjax && typeof(this.tree.onEditAjax.func) == 'function') { + this.struct.oneditajax = this.tree.onEditAjax.func; + this.struct.editlink = this.tree.onEditAjax.link; + this.oneditajaxDefault = true; + } + } else {this.struct.oneditajax = eval(this.struct.oneditajax);} + if (typeof(this.struct.onopenpopulate) == 'undefined') { + if (this.tree.onOpenPopulate && typeof(this.tree.onOpenPopulate.func) == 'function') { + this.struct.onopenpopulate = this.tree.onOpenPopulate.func; + this.struct.openlink = this.tree.onOpenPopulate.link; + this.onopenpopulateDefault = true; + } + } else {this.struct.onopenpopulate = eval(this.struct.onopenpopulate);} + if (typeof(this.struct.onedit) == 'undefined') { + if (typeof(this.tree.onEdit) == 'function') { + this.struct.onedit = this.tree.onEdit; + this.oneditDefault = true; + } + } else {this.struct.onedit = eval(this.struct.onedit);} + if (typeof(this.struct.oncheck) == 'undefined') { + if (typeof(this.tree.onCheck) == 'function') { + this.struct.oncheck = this.tree.onCheck; + this.oncheckDefault = true; + } + } else {this.struct.oncheck = eval(this.struct.oncheck);} + if (typeof(this.struct.onbeforecheck) == 'undefined') { + if (typeof(this.tree.onBeforeCheck) == 'function') { + this.struct.onbeforecheck = this.tree.onBeforeCheck; + this.onbeforecheckDefault = true; + } + } else {this.struct.onbeforecheck = eval(this.struct.onbeforecheck);} + if (typeof(this.struct.onopen) == 'undefined') { + if (typeof(this.tree.onOpen) == 'function') { + this.struct.onopen = this.tree.onOpen; + this.onopenDefault = true; + } + } else {this.struct.onopen = eval(this.struct.onopen);} + if (typeof(this.struct.onbeforeopen) == 'undefined') { + if (typeof(this.tree.onBeforeOpen) == 'function') { + this.struct.onbeforeopen = this.tree.onBeforeOpen; + this.onbeforeopenDefault = true; + } + } else {this.struct.onbeforeopen = eval(this.struct.onbeforeopen);} + if (typeof(this.struct.onmouseover) == 'undefined') { + if (typeof(this.tree.onMouseOver) == 'function') { + this.struct.onmouseover = this.tree.onMouseOver; + this.onmouseoverDefault = true; + } + } else {this.struct.onmouseover = eval(this.struct.onmouseover);} + if (typeof(this.struct.onmouseout) == 'undefined') { + if (typeof(this.tree.onMouseOut) == 'function') { + this.struct.onmouseout = this.tree.onMouseOut; + this.onmouseoutDefault = true; + } + } else {this.struct.onmouseout = eval(this.struct.onmouseout);} + if (typeof(this.struct.onmousedown) == 'undefined') { + if (typeof(this.tree.onMouseDown) == 'function') { + this.struct.onmousedown = this.tree.onMouseDown; + this.onmousedownDefault = true; + } + } else {this.struct.onmousedown = eval(this.struct.onmousedown);} + if (typeof(this.struct.onmouseup) == 'undefined') { + if (typeof(this.tree.onMouseUp) == 'function') { + this.struct.onmouseup = this.tree.onMouseUp; + this.onmouseupDefault = true; + } + } else {this.struct.onmouseup = eval(this.struct.onmouseup);} + if (typeof(this.struct.onclick) == 'undefined') { + if (typeof(this.tree.onClick) == 'function') { + this.struct.onclick = this.tree.onClick; + this.onclickDefault = true; + } + } else {this.struct.onclick = eval(this.struct.onclick);} + if (typeof(this.struct.ondblclick) == 'undefined') { + if (typeof(this.tree.onDblClick) == 'function') { + this.struct.ondblclick = this.tree.onDblClick; + this.ondblclickDefault = true; + } + } else {this.struct.ondblclick = eval(this.struct.ondblclick);} + }, + + /** + * Set actions like selecting node + * + * @access private + * @return void + */ + _setActions : function () { + if (this.struct.select) { + this.select(); + } + }, + + /** + * Fonction qui set les divers événements en fonction des données utilisateur + * + * @access private + * @param HTMLTdElement event La cellule qui contient le texte + * @param HTMLTdElement tdImg La cellule qui contient l'icône + * @return void + */ + _setEvents : function (event, tdImg) { + // Le onclick se fait de toutes façon + Event.observe(this.txt, 'mousedown', this.setMouseDown.bindAsEventListener(this), false); + Event.observe(this.txt, 'mouseup', this.setMouseUp.bindAsEventListener(this), false); + // On set les événements + if (typeof(this.struct.onclick) == 'function') { + Event.observe(event, 'click', this.setClick.bindAsEventListener(this), false); + } + if (typeof(this.struct.ondblclick) == 'function' || this.struct.editable) { + Event.observe(event, 'dblclick', this.setDblClick.bindAsEventListener(this), false); + } + if (typeof(this.struct.onmouseover) == 'function') { + Event.observe(event, 'mouseover', this.setMouseOver.bindAsEventListener(this), false); + } + if (typeof(this.struct.onmouseout) == 'function') { + Event.observe(event, 'mouseout', this.setMouseOut.bindAsEventListener(this), false); + } + if (this.struct.editable && (typeof(this.struct.onedit) == 'function' || typeof(this.struct.oneditajax) == 'function')) { + this.editableInput = document.createElement('input'); + this.editableInput.setAttribute('type', 'text'); + this.editableInput.setAttribute('autocomplete', 'off'); + this.editableInput.className = this.tree.classEditable; + event.appendChild(this.editableInput); + Event.observe(this.editableInput, 'blur', this.hideEditable.bindAsEventListener(this), false); + } + // On set l'option drag and drop + if (!this.isRoot) { + if (this.struct.draggable && (typeof(this.struct.ondrop) == 'function' || typeof(this.struct.ondropajax) == 'function')) { + //this.objDrag = new Draggable(this.txt, {revert: this.tree.dragRevert, scroll: this.tree.div, ghosting: this.tree.dragGhosting}); + this.objDrag = new Draggable(this.txt, { + revert: this.tree.dragRevert, + starteffect:this.ondragstarteffect.bindAsEventListener(this), + endeffect:this.ondragendeffect.bindAsEventListener(this) + }); + Element.addClassName(this.txt, this.tree.classDrag); + } + } + if (this.struct.acceptdrop) { + Droppables.add(this.txt, {hoverclass: this.tree.classDragOver, onDrop: this.setDrop.bindAsEventListener(this)}); + } + if (this.struct.tooltip) { + Event.observe(event, 'mouseover', this.evt_showTooltip.bindAsEventListener(this), false); + Event.observe(event, 'mouseout', this.evt_hideTooltip.bindAsEventListener(this), false); + } + // On s'occupe des checkboxes, le cas échéant + if (this.tree.checkboxes && this.struct.checkbox) { + if (this.struct.check == 1) imgc = this.tree.imgCheck2; + else if (this.struct.check == -1) imgc = this.tree.imgCheck3; + else imgc = this.tree.imgCheck1; + this.checkbox = document.createElement('img'); + this.checkbox.src = this.tree.imgBase + imgc; + tdImg.appendChild(this.checkbox); + Event.observe(this.checkbox, 'click', this.checkOnClick.bindAsEventListener(this), false); + Event.observe(this.checkbox, 'mouseover', this.evt_openMouseOver.bindAsEventListener(this), false); + Event.observe(this.checkbox, 'mouseout', this.evt_openMouseOut.bindAsEventListener(this), false); + } else if (this.tree.checkboxes) { + // On met éventuellement une image vide au lieu de la checkbox + var vide = document.createElement('img'); + vide.src = this.tree.imgBase + this.tree.imgEmpty; + tdImg.appendChild(vide); + } + }, + + _getImgBeforeIcon : function () { + try { + var td = document.createElement('td'); + var img = document.createElement('img'); + Element.addClassName(img, this.tree.classOpenable); + // On détermine s'il y a des frères + if (this.hasSiblingsAfter) { + // On détermine s'il y a des enfants + if (!this.hasChildren()) { + if (this.isRoot) { + img.src = this.tree.imgBase + ((this.hasSiblingsBefore) ? this.tree.imgLine3 : this.tree.imgLine4); + } else { + img.src = this.tree.imgBase + this.tree.imgLine3; + } + } else { + Event.observe(img, 'click', this.setOpen.bindAsEventListener(this), false); + Event.observe(img, 'mouseover', this.evt_openMouseOver.bindAsEventListener(this), false); + Event.observe(img, 'mouseout', this.evt_openMouseOut.bindAsEventListener(this), false); + if (this.isRoot) { + img.src = this.tree.imgBase + ((this.hasSiblingsBefore) ? this.tree.imgMinus3 : this.tree.imgMinus4); + } else { + img.src = this.tree.imgBase + this.tree.imgMinus3; + } + } + if (this.tree.multiline) { + this._manageMultiline(td, (this.isRoot ? 2 : 1), true); + } + } else { + // On détermine s'il y a des enfants + if (!this.hasChildren()) { + if (this.isRoot) { + img.src = this.tree.imgBase + ((this.hasSiblingsBefore) ? this.tree.imgLine2 : this.tree.imgEmpty); + } else { + img.src = this.tree.imgBase + this.tree.imgLine2; + } + } else { + Event.observe(img, 'click', this.setOpen.bindAsEventListener(this), false); + Event.observe(img, 'mouseover', this.evt_openMouseOver.bindAsEventListener(this), false); + Event.observe(img, 'mouseout', this.evt_openMouseOut.bindAsEventListener(this), false); + if (this.isRoot) { + img.src = this.tree.imgBase + ((this.hasSiblingsBefore) ? this.tree.imgMinus2 : this.tree.imgMinus5); + } else { + img.src = this.tree.imgBase + this.tree.imgMinus2; + } + } + } + td.appendChild(img); + return td; + } catch (err) { + throw new Error ('_getImgBeforeIcon(base) : ' + err.message); + } + }, + + /** + * Insère les enfants de la branche + * + * @access private + * @param TafelTreeRoot root L'élément racine parent + * @return void + */ + _setChildren : function (root) { + if (this.hasChildren()) { + if (this.tree.bigTreeLoading >= 0) { + this.loaded = false; + this.bigTreeLoading = 0; + setTimeout(this._generate.bind(this), 10); + } else { + for (var i = 0; i < this.struct.items.length; i++) { + if (this.tree.checkboxesThreeState && this.struct.check && typeof(this.struct.items[i].check) == 'undefined') { + this.struct.items[i].check = 1; + } + isNotFirst = (i > 0) ? true : false; + isNotLast = (i < this.struct.items.length - 1) ? true : false; + this.children[i] = new TafelTreeBranch(root, this, this.struct.items[i], this.level + 1, isNotFirst, isNotLast, i); + this.obj.appendChild(this.children[i].obj); + } + this.openIt(this.struct.open); + } + } + }, + + /** + * Set l'image de la branche à wait ainsi que ses enfants + * + * @access private + * @param TafelTreeBranch branch La branche courante + * @param boolean wait True pour afficher l'image d'attente + * @param boolean localPropagationStop True pour ne pas avoir de propagation, false par défaut + * @return void + */ + _setWaitImg : function (branch, wait, localPropagationStop) { + try { + this.inProcess = wait; + if (wait) { + branch.oldImgSrc = branch.img.src; + branch.img.src = branch.tree.imgBase + branch.tree.imgWait; + branch.eventable = false; + } else { + branch.eventable = true; + branch.img.src = branch.oldImgSrc; + } + if (this.tree.propagation && !localPropagationStop) { + for (var i = 0; i < branch.children.length; i++) { + this._setWaitImg(branch.children[i], wait); + } + } + } catch (err) { + throw new Error ('_setWaitImg(base) : ' + err.message); + } + }, + + /** + * Envoi d'une requête Ajax suite à une ouverture de branche + * + * @access private + * @return void + */ + _openPopulate : function (ev) { + try { + this._setWaitImg(this, true); + var params = 'branch=' + this.serialize() + '&branch_id=' + this.getId() + '&tree_id=' + this.tree.id; + var otherParams = this.tree.getURLParams(this.struct.openlink); + for (var i = 0; i < otherParams.length; i++) { + params += '&' + otherParams[i].name + '=' + otherParams[i].value; + } + new Ajax.Updater ( + this.tree.ajaxObj, + this.struct.openlink, + { + 'method' : 'post', + 'parameters' : params, + 'evalScripts': true, + 'onComplete' : function(event){this._completeOpenPopulate(event);}.bind(this), + 'onFailure' : function(event){this._failureOpenPopulate(event);}.bind(this) + } + ); + } catch (err) { + this._setWaitImg(this, false); + throw ('_openPopulate(base) : ' + err.message); + } + }, + + _failureOpenPopulate : function () { + this._setWaitImg(this, false); + if (typeof(this.struct.onerrorajax) == 'function') { + this.struct.onerrorajax('open', 'failure request', this); + } + }, + + /** + * Méthode appelée lorsque le retour ajax est effectué + * + * Pour pailler aux éventualités : str.match(/(?:\(\[)((\n|\r|.)*?)(?:\]\))/)[0] + * + * @access private + * @param XMLhttpResquest response L'objet Ajax + * @return void + */ + _completeOpenPopulate : function (response) { + try { + this._setWaitImg(this, false); + var rep = this.struct.onopenpopulate(this, response.responseText); + if (rep) { + rep = (rep === true) ? response.responseText : rep; + var items = eval(rep); + if (items) { + var ok = []; + for (var i = 0 ; i < items.length; i++) { + // unicity test + if (this.tree.getBranchById(items[i].id)) continue; + if (typeof(items[i].id) == 'undefined' || typeof(items[i].txt) == 'undefined') { + throw new Error (TAFELTREE_WRONG_BRANCH_STRUCTURE); + } + ok.push(this.insertIntoLast(items[i])); + } + // Permet d'ouvrir les branches qui viennent du serveur au load de la page + if (this.tree.useCookie && this.tree.cookieOpened && this.tree.reopenFromServer) { + var okay = false; + for (var o = 0; o < ok.length; o++) { + okay = false; + for (var i = 0; i < this.tree.cookieOpened.length; i++) { + if (this.tree.cookieOpened[i] == ok[o].getId()) { + okay = true; + break; + } + } + if (okay) { + if (typeof(ok[o].struct.onopenpopulate) == 'function' && ok[o].eventable) { + ok[o]._openPopulate(); + ok[o].openIt(true); + } + } + } + } + } + } + } catch (err) { + this._setWaitImg(this, false); + if (typeof(this.struct.onerrorajax) == 'function') { + this.struct.onerrorajax('open', response.responseText, this); + } else { + alert ('_completeOpenPopulate(' + response.responseText + ') : ' + err.message); + } + } + }, + + /** + * Envoi d'une requête Ajax suite à un drop + * + * @access private + * @param TafelTreeBranch newParentObj Le nouveau parent + * @param boolean asSibling True pour dropper l'élément comme frère + * @param boolean copydrag True si on fait un copy-drag + * @return void + */ + _setDropAjax : function (newParentObj, asSibling, copydrag, ev) { + try { + this._setWaitImg(this, true); + var sibling = (asSibling) ? 1 : 0; + var cdrag = (copydrag) ? 1 : 0; + var params = 'drag=' + this.serialize() + '&drag_id=' + this.getId() + '&drop=' + newParentObj.serialize() + '&drop_id=' + newParentObj.getId(); + params += '&treedrag_id=' + this.tree.id + '&treedrop_id=' + newParentObj.tree.id + '&sibling=' + sibling + '©drag=' + cdrag; + // On passe le futur id de l'élément copié s'il s'agit d'une copie + if (cdrag) { + var cdragId = this.id + this.tree.copyNameBreak + this.tree.idTree; + params += '©drag_id=' + cdragId; + } + var otherParams = this.tree.getURLParams(this.struct.droplink); + for (var i = 0; i < otherParams.length; i++) { + params += '&' + otherParams[i].name + '=' + otherParams[i].value; + } + this.newParent = newParentObj; + this.asSibling = asSibling; + this.copyDrag = cdrag; + new Ajax.Updater ( + this.tree.ajaxObj, + this.struct.droplink, + { + 'method' : 'post', + 'parameters' : params, + 'evalScripts': true, + 'onComplete' : function(event){this._completeDropAjax(event);}.bind(this), + 'onFailure' : function(event){this._failureDropAjax(event);}.bind(this) + } + ); + } catch (err) { + this._setWaitImg(this, false); + throw ('_setDropAjax(base) : ' + err.message); + } + }, + + _failureDropAjax : function () { + this._setWaitImg(this, false); + if (typeof(this.struct.onerrorajax) == 'function') { + this.struct.onerrorajax('drop', 'failure request', this, this.newParent); + } + }, + + /** + * Méthode appelée lorsque le retour ajax est effectué + * + * @access private + * @param XMLhttpResquest response L'objet Ajax + * @return void + */ + _completeDropAjax : function (response) { + try { + if (this.struct.ondropajax(this, this.newParent, response.responseText, false, null)) { + var newBranch = null; + if (!this.asSibling) { + if (!this.copyDrag) { + this.move(this.newParent); + } else { + newBranch = this.newParent.insertIntoLast(this.clone()); + } + } else { + if (!this.copyDrag) { + this.moveBefore(this.newParent); + } else { + newBranch = this.newParent.insertBefore(this.clone()); + } + } + this.struct.ondropajax(this, this.newParent, response.responseText, true, newBranch); + } + this._setWaitImg(this, false); + } catch (err) { + if (typeof(this.struct.onerrorajax) == 'function') { + this.struct.onerrorajax('drop', response.responseText, this, this.newParent); + } else { + alert ('_completeDropAjax(base) : ' + err.message); + } + } + }, + + /** + * Envoi d'une requête Ajax suite à une édition de branche + * + * @access private + * @return void + */ + _editAjax : function (newValue, oldValue, ev) { + try { + this._setWaitImg(this, true, true); + var params = 'branch=' + this.serialize() + '&branch_id=' + this.getId() + '&tree_id=' + this.tree.id; + params += '&new_value=' + newValue + '&old_value=' + oldValue; + var otherParams = this.tree.getURLParams(this.struct.editlink); + for (var i = 0; i < otherParams.length; i++) { + params += '&' + otherParams[i].name + '=' + otherParams[i].value; + } + new Ajax.Updater ( + this.tree.ajaxObj, + this.struct.editlink, + { + 'method' : 'post', + 'parameters' : params, + 'evalScripts': true, + 'onComplete' : function(event){this._completeEditAjax(event);}.bind(this), + 'onFailure' : function(event){this._failureEditAjax(event);}.bind(this) + } + ); + } catch (err) { + this._setWaitImg(this, false, true); + throw ('_editAjax(base) : ' + err.message); + } + }, + + _failureEditAjax : function () { + this._setWaitImg(this, false); + if (typeof(this.struct.onerrorajax) == 'function') { + this.struct.onerrorajax('edit', 'failure request', this); + } + }, + + /** + * Méthode appelée lorsque le retour ajax est effectué + * + * @access private + * @param XMLhttpResquest response L'objet Ajax + * @return void + */ + _completeEditAjax : function (response) { + try { + this._setWaitImg(this, false, true); + var rep = this.struct.oneditajax(this, response.responseText, this.txt.innerHTML); + if (rep) { + this.setText((rep === true ? response.responseText : rep)); + } + this.hideEditableElement(); + } catch (err) { + this._setWaitImg(this, false, true); + if (typeof(this.struct.onerrorajax) == 'function') { + this.struct.onerrorajax('edit', response.responseText, this); + } else { + alert ('_completeOpenPopulate(' + response.responseText + ') : ' + err.message); + } + } + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTreeBaseBranch Events Management + *------------------------------------------------------------------------------ + */ + + evt_openMouseOver : function (ev) { + if (Event.element) { + var obj = Event.element(ev); + var img = this._getImgInfo(obj); + obj.src = this.tree.imgBase + img.type + '_over' + img.number + '.gif'; + } + }, + + evt_openMouseOut : function (ev) { + if (Event.element) { + var obj = Event.element(ev); + var img = this._getImgInfo(obj); + obj.src = this.tree.imgBase + img.type.replace(/_over/g, '') + img.number + '.gif'; + } + }, + + evt_showTooltip : function (ev) { + this.displayTooltip = true; + setTimeout(this.showTooltip.bind(this), this.tree.durationTooltipShow); + }, + + evt_hideTooltip : function (ev) { + this.displayTooltip = false; + setTimeout(this.hideTooltip.bind(this), this.tree.durationTooltipHide); + }, + + /** + * Méthode appelée lorsque la souris passe sur le noeud + * + * @access public + * @param Element ev L'élément déclencheur + * @return boolean True si le changement s'est fait, false sinon + */ + setMouseOver : function (ev) { + if (typeof(this.struct.onmouseover) == 'function') { + return this.struct.onmouseover(this, ev); + } + }, + + /** + * Méthode appelée lorsqu'on clic sur le noeud + * + * @access public + * @param Element ev L'élément déclencheur + * @return boolean True si le changement s'est fait, false sinon + */ + setMouseOut : function (ev) { + if (typeof(this.struct.onmouseout) == 'function') { + return this.struct.onmouseout(this, ev); + } + }, + + /** + * Méthode appelée lorsqu'on clique sur le noeud (mousedown) + * + * @access public + * @param Element ev L'élément déclencheur + * @return void + */ + setMouseDown : function (ev) { + // Pour une raison ou une autre, le mousedown du div principal n'est pas appelé... + this.tree.evt_setAsCurrent(ev); + if (this.tree.selectedBranchShowed) { + if (!this.isSelected()) { + this.select(ev); + this.okayForUnselect = false; + } else { + this.okayForUnselect = true; + } + } + if (this.tooltip) { + this.displayTooltip = false; + this.hideTooltip(); + } + if (typeof(this.struct.onmousedown) == 'function') { + this.struct.onmousedown(this, ev); + } + }, + + /** + * Méthode appelée lorsqu'on "déclique" + * + * @access public + * @param Element ev L'élément déclencheur + * @return void + */ + setMouseUp : function (ev) { + if (this.tree.lastEdited) { + this.tree.lastEdited.hideEditable(ev); + } + // Si la branche est déjà sélectionnée, on la déselectionne + if (this.isSelected() && this.okayForUnselect) { + //this.unselect(); + return true; + } + this.okayForUnselect = true; + if (typeof(this.struct.onmouseup) == 'function') { + this.struct.onmouseup(this, ev); + } + }, + + /** + * Méthode appelée lorsqu'on clique sur le noeud + * + * @access public + * @param Element ev L'élément déclencheur + * @return void + */ + setClick : function (ev) { + if (this.tree.lastEdited) return false; + if (typeof(this.struct.onclick) == 'function') { + return this.struct.onclick(this, ev); + } + }, + + /** + * Fonction appelée lorsqu'on clique sur une checkbox + * + * @access public + * @param HTMLimgElement ev L'élément déclencheur + * @return boolean True si le changement s'est fait, false sinon + */ + checkOnClick : function (ev) { + if (this.tree.checkboxes && this.checkbox) { + var checked = (this.isChecked() > 0) ? 0 : 1; + var ok = true; + if (typeof(this.struct.onbeforecheck) == 'function') { + ok = this.struct.onbeforecheck(this, checked, ev); + } + if (ok) { + this.check(checked); + if (this.tree.checkboxesThreeState) { + this._manageCheckThreeState(this, checked); + this._adjustParentCheck(); + } + if (typeof(this.struct.oncheck) == 'function') { + this.struct.oncheck(this, checked, ev); + } + } + } + }, + + /** + * Méthode appelée lors de l'ouverture ou fermeture d'un noeud + * + * @access public + * @param HTMLimgElement ev L'élément déclencheur + * @return boolean True si le changement s'est fait, false sinon + */ + setOpen : function (ev) { + if (!this.hasChildren()) return false; + var ok = true; + if (typeof(this.struct.onbeforeopen) == 'function') { + ok = this.struct.onbeforeopen(this, this.struct.open, ev); + } + if (!ok) return false; + // On ne peut pas fermer la branche si elle subit un événement d'ouverture + if (typeof(this.struct.onopenpopulate) == 'function' && !this.eventable) return false; + this.openIt((this.isOpened()) ? false : true); + if (typeof(this.struct.onopen) == 'function') { + return this.struct.onopen(this, this.struct.open, ev); + } else if (typeof(this.struct.onopenpopulate) == 'function' && this.isOpened() && this.children.length == 0) { + if (!this.eventable) return false; + return this._openPopulate(ev); + } + return true; + }, + + /** + * Ajoute une fonction utilisateur au start du drag + * + * @access public + * @author coucoudom + * @param HTMLObject drag l'objet draggé + * @param HTMLObject dragbis + */ + ondragstarteffect : function (drag, dragbis) { + var dragObj = this.tree.getBranchByIdObj(drag.id); + if (!dragObj) { + for (var i = 0; i < this.tree.otherTrees.length; i++) { + dragObj = this.tree.otherTrees[i].getBranchByIdObj(drag.id); + if (dragObj) break; + } + if (!dragObj) return false; + } + // appel de la function user + if (typeof(dragObj.struct.ondragstarteffect) == 'function') { + var ok = dragObj.struct.ondragstarteffect(dragObj); + } + }, + + /** + * Ajoute une fonction utilisateur au end du drag + * + * @access public + * @author coucoudom + * @param HTMLObject drag l'objet draggé + * @param HTMLObject dragbis + */ + ondragendeffect : function (drag, dragbis) { + var dragObj = this.tree.getBranchByIdObj(drag.id); + if (!dragObj) { + for (var i = 0; i < this.tree.otherTrees.length; i++) { + dragObj = this.tree.otherTrees[i].getBranchByIdObj(drag.id); + if (dragObj) break; + } + if (!dragObj) return false; + } + // appel de la function user + if (typeof(dragObj.struct.ondragendeffect) == 'function') { + var ok = dragObj.struct.ondragendeffect(dragObj); + } + }, + + /** + * Méthode appelée lorsqu'on drop sur le noeud + * + * Ici, le this correspond à l'objet qui réceptionne le drag + * + * @access public + * @param HTMLElement drag L'élément draggué + * @return boolean True si le changement s'est fait, false sinon + */ + setDrop : function (drag, html, html2, ev) { + var dragObj = this.tree.getBranchByIdObj(drag.id); + // Si l'objet n'est pas dans l'arbre courant, on va chercher dans les autres liés + if (!dragObj) { + for (var i = 0; i < this.tree.otherTrees.length; i++) { + dragObj = this.tree.otherTrees[i].getBranchByIdObj(drag.id); + if (dragObj) break; + } + if (!dragObj) return false; + } + var alt = (dragObj.tree.dropALT) ? TafelTreeManager.altOn(ev) : false; + var ctrl = (dragObj.tree.dropCTRL) ? TafelTreeManager.ctrlOn(ev) || TafelTreeManager.metaOn(ev) : false; + var ok = true; + if ((this.tree.id == dragObj.tree.id && this.isChild(dragObj)) || !dragObj.eventable || !this.eventable) return false; + // Fonction utilisateur avant le drop + if (typeof(dragObj.struct.ondrop) == 'function') { + ok = dragObj.struct.ondrop(dragObj, this, false, null, ev); + } + if (ok) { + var asSibling = ((dragObj.tree.behaviourDrop == 1 || dragObj.tree.behaviourDrop == 3) && !alt || (dragObj.tree.behaviourDrop == 0 || dragObj.tree.behaviourDrop == 2) && alt) ? true : false; + var copyDrag = ((dragObj.tree.behaviourDrop == 2 || dragObj.tree.behaviourDrop == 3) && !ctrl || (dragObj.tree.behaviourDrop == 0 || dragObj.tree.behaviourDrop == 1) && ctrl) ? true : false; + // On va chercher les noeuds sur le serveur s'il y en a + if (!asSibling && typeof(this.struct.onopenpopulate) == 'function' && !this.isOpened() && this.children.length == 0) { + this._openPopulate(ev); + } + if (typeof(dragObj.struct.ondropajax) == 'function') { + dragObj._setDropAjax(this, asSibling, copyDrag, ev); + } else { + // Drop normal + var newBranch = null; + if (!asSibling) { + if (!copyDrag) { + dragObj.move(this); + } else { + newBranch = this.insertIntoLast(dragObj.clone()); + } + } else { + if (!copyDrag) { + dragObj.moveBefore(this); + } else { + newBranch = this.insertBefore(dragObj.clone()); + } + } + // Fonction utilisateur après le drop + if (typeof(dragObj.struct.ondrop) == 'function') { + ok = dragObj.struct.ondrop(dragObj, this, true, newBranch, ev); + } + } + } + }, + + /** + * Méthode appelée lorsqu'on double-clic sur le noeud + * + * @access public + * @param Element ev L'élément déclencheur + * @return boolean True si le changement s'est fait, false sinon + */ + setDblClick : function (ev) { + if (this.tree.lastEdited) return false; + if (typeof(this.struct.ondblclick) == 'function') { + this.struct.ondblclick(this, ev); + } + if (this.struct.editable && this.editableInput) { + if (!this.tree.lastEdited || this.tree.lastEdited.getId() != this.getId()) { + this.editableInput.style.width = (this.txt.offsetWidth + 20) + 'px'; + } + Element.hide(this.txt); + this.editableInput.value = this.txt.innerHTML; + this.editableInput.style.display = 'block'; + this.editableInput.focus(); + this.tree.lastEdited = this; + } + }, + + /** + * Enlève l'édition de la branche + * + * @access public + * @param Event ev L'événement déclencheur + * @return boolean True si l'élément a été caché, false sinon + */ + hideEditable : function (ev) { + if (this.editableInput && this.struct.editable) { + var obj = this.editableInput; + var value = obj.value; + if (this.struct.oneditajax) { + if (!this.eventable) return false; + this._editAjax(obj.value, this.txt.innerHTML, ev); + } else { + if (typeof(this.struct.onedit) == 'function') { + value = this.struct.onedit(this, obj.value, this.txt.innerHTML, ev); + } + this.setText(value); + this.hideEditableElement(); + } + return true; + } + return false; + }, + + hideEditableElement : function () { + Element.hide(this.editableInput); + this.editableInput.value = this.getText(); + this.txt.style.display = 'block'; + this.tree.lastEdited = null; + } +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + *------------------------------------------------------------------------------ + * TafelTreeRoot Class + *------------------------------------------------------------------------------ + */ + +var TafelTreeRoot = Class.create(); + +TafelTreeRoot.prototype = Object.extend(new TafelTreeBaseBranch, { + /** + * Constructeur d'un élément racine + * + * @access public + * @param TafelTree tree L'objet TafelTree courant + * @param object struct Les infos concernant la racine est ses enfants + * @param integer level Le niveau du noeud (0 pour la racine) + * @param boolean before True s'il y a des noeuds avant + * @param boolean after True s'il y a des noeuds après + */ + initialize : function (tree, struct, level, before, after, pos) { + this.isRoot = true; + this.tree = tree; + this.pos = pos; + this.level = level; + this.struct = struct; + this.tree.idTree++; + this.idObj = this.tree.idTreeBranch + this.tree.idTree; + this.hasSiblingsBefore = before; + this.hasSiblingsAfter = after; + this.eventable = true; + this.loaded = true; + this.children = []; + this.copiedTimes = 0; + + this._setProperties(); + this._setFunctions(); + + this.obj = this._addRoot(); + this.content = this._addContent(); + this.obj.appendChild(this.table); + this._setChildren(this); + this._setActions(); + }, + + /** + * Méthode qui insère une branche avant celle courante + * + * @access public + * @param object item Un objet au format TafelTreeBranch + * @return TafelTreeRoot La nouvelle racine insérée + */ + insertBefore : function (item) { + if (this.parent) return false; + var pos = this.pos; + var posBefore = pos + 1; + var isNotFirst = (pos == 0) ? false : true; + this._movePartStructRoot(pos); + this.tree.roots[pos] = new TafelTreeRoot(this.tree, item, this.level, isNotFirst, true, pos); + this.tree.div.insertBefore(this.tree.roots[pos].obj, this.obj); + this._manageAfterRootInsert(pos); + return this.tree.roots[pos]; + }, + + /** + * Méthode qui insère une branche après celle courante + * + * @access public + * @param object item Un objet au format TafelTreeBranch + * @return TafelTreeRoot La nouvelle racine insérée + */ + insertAfter : function (item) { + if (this.parent) return false; + var pos = this.pos + 1; + var posBefore = pos + 1; + var isNotLast = (pos == this.tree.roots.length) ? false : true; + this._movePartStructRoot(pos); + this.tree.roots[pos] = new TafelTreeRoot(this.tree, item, this.level, true, isNotLast, pos); + try { + this.tree.div.insertBefore(this.tree.roots[pos].obj, this.tree.roots[posBefore].obj); + } catch (err) { + this.tree.div.appendChild(this.tree.roots[pos].obj); + } + this._manageAfterRootInsert(pos); + return this.tree.roots[pos]; + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTreeRoot private methods + *------------------------------------------------------------------------------ + */ + + _manageAfterRootInsert : function (pos) { + for (var i = 0; i < this.tree.roots.length; i++) { + if (i < this.tree.roots.length - 1) { + this.tree.roots[i].hasSiblingsAfter = true; + } + if (i > 0) { + this.tree.roots[i].hasSiblingsBefore = true; + } + } + for (var i = 0; i < this.children.length; i++) { + this.children[i]._manageLineForRoot(this.hasSiblingsAfter); + } + }, + + _movePartStructRoot : function (pos) { + var nb = this.tree.roots.length - 1; + var newPos = 0; + for (var i = nb; i >= pos; i--) { + newPos = i + 1; + this.tree.roots[newPos] = this.tree.roots[i]; + this.tree.roots[newPos].pos = newPos; + } + }, + + /** + * Méthode pour ajouter l'élément principal + * + * @access private + * @return HTMLDivElement L'élément DIV créé + */ + _addRoot : function () { + var div = document.createElement('div'); + div.className = this.tree.classTreeRoot; + return div; + }, + + /** + * Méthode pour ajouter le contenu de l'élément (images + textes) + * + * Créé une structure comme suit : + * <table><tbody><tr> + * <td><img /></td> + * <td><![-- CDATA --]></td> + * </tr></tbody></table> + * + * @access private + * @return HTMLTbodyElement L'élément TBODY créé + */ + _addContent : function () { + var table = document.createElement('table'); + var tbody = document.createElement('tbody'); + var tr = document.createElement('tr'); + var tdImg = document.createElement('td'); + var tdTxt = document.createElement('td'); + var img = document.createElement('img'); + var span = document.createElement('div'); + var txt = document.createTextNode(txt); + img.src = this.tree.imgBase + this.struct.img; + span.innerHTML = this.struct.txt; + // Ajout du title (de NoisetteProd) + if (this.struct.title) { + span.setAttribute('title', this.struct.title); + } + // Fin ajout du title + span.setAttribute('id', this.idObj); + Element.addClassName(span, this.tree.classContent); + Element.addClassName(tdTxt, this.tree.classCanevas); + tdTxt.appendChild(span); + tdImg.appendChild(img); + // Insertion du tooltip, s'il existe + if (this.struct.tooltip) { + this.tooltip = this._createTooltip(); + tdTxt.appendChild(this.tooltip); + } + // Insertion de l'image avant l'icône + this.tdImg = tdImg; + this.beforeIcon = this._getImgBeforeIcon(); + tr.appendChild(this.beforeIcon); + tr.appendChild(tdImg); + tr.appendChild(tdTxt); + tbody.appendChild(tr); + table.appendChild(tbody); + if (this.tree.multiline) { + tdTxt.style.whiteSpace = 'normal'; + if (this.hasChildren()) this._manageMultiline(this.tdImg, 2, true); + } + if (this.struct.style) { + Element.addClassName(tdTxt, this.struct.style); + } + this.txt = span; + this.img = img; + this.table = table; + this._setEvents(tdTxt, tdImg); + return tbody; + } +}); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + *------------------------------------------------------------------------------ + * TafelTreeBranch Class + *------------------------------------------------------------------------------ + */ + +/** +Properties description + +this.tree : l'arbre de la branche +this.root : la racine de la branche +this.parent : le parent de la branche (peut être this.root) +this.level : le niveau de la branche. Le 1er niveau sous la racine est le 1 +this.pos : la position de la branche au sein des enfants du parent +this.idObj : l'id attribué automatiquement. Ne pas se baser dessus pour les developpements externes +this.children : les enfants de la branche +this.objDrag : L'objet Draggable + +this.struct : la structure de la branche avec toutes les infos utilisateur + +this.eventable : +Détermine si la branche peut être drag n' droppée ou non. +Utilisé uniquement lors du dragndrop ajax et open ajax. + +this.obj : HTMLDivElement qui symbolise la branche +this.content : HTMLTBodyElement qui symbolise le contenu de la branche +this.beforeIcon : HTMLTdElement qui symbolise la TD contenant le picto avant l'icône +this.img : HTMLImgElement qui représente l'icône avant le texte +this.txt : HTMLTextNodeElement qui représente le texte de la branche +this.table : HTMLTableElement qui est le parent du Tbody (this.content) +*/ + +var TafelTreeBranch = Class.create(); + +TafelTreeBranch.prototype = Object.extend(new TafelTreeBaseBranch, { + /** + * Constructeur d'une branche de l'arbre + * + * @access public + * @param TafelRoot root L'objet racine parent + * @param TafelBranch parent L'objet directement parent + * @param object struct Les infos concernant la branche est ses enfants + * @param integer level Le niveau du noeud + * @param boolean before True s'il y a des noeuds avant + * @param boolean after True s'il y a des noeuds après + * @param integer pos La position dans le tableau children[] du parent + */ + initialize : function (root, parent, struct, level, before, after, pos) { + this.tree = root.tree; + this.root = root; + this.level = level; + this.pos = pos; + this.parent = parent; + this.tree.idTree++; + this.idObj = this.tree.idTreeBranch + this.tree.idTree; + this.hasSiblingsBefore = before; + this.hasSiblingsAfter = after; + this.struct = struct; + this.eventable = true; + this.loaded = true; + this.inProcess = false; + this.children = []; + this.copiedTimes = 0; + + if (typeof(this.struct.draggable) == 'undefined') this.struct.draggable = 1; + this._setProperties(); + + // Fonctions utilisateurs + if (typeof(this.struct.ondrop) == 'undefined') { + if (typeof(this.tree.onDrop) == 'function') { + this.struct.ondrop = this.tree.onDrop; + this.ondropDefault = true; + } + } else {this.struct.ondrop = eval(this.struct.ondrop);} + if (typeof(this.struct.ondropajax) == 'undefined') { + if (this.tree.onDropAjax && typeof(this.tree.onDropAjax.func) == 'function') { + this.struct.ondropajax = this.tree.onDropAjax.func; + this.struct.droplink = this.tree.onDropAjax.link; + this.ondropajaxDefault = true; + } + } else {this.struct.ondropajax = eval(this.struct.ondropajax);} + this._setFunctions(); + + // Initialisation de la branche + this.obj = this._addBranch(); + this.content = this._addContent(); + this.obj.appendChild(this.table); + this._setChildren(root); + // set actions like select node + this._setActions(); + }, + + insertBefore : function (item) { + if (!this.parent) return false; + var pos = this.pos; + var posBefore = pos + 1; + var isNotFirst = (pos == 0) ? false : true; + this.parent._movePartStruct(pos); + this.parent.struct.items[pos] = item; + this.parent.children[pos] = new TafelTreeBranch(this.root, this.parent, item, this.level, isNotFirst, true, pos); + this.parent.obj.insertBefore(this.parent.children[pos].obj, this.obj); + this.parent._manageAfterInsert(pos); + return this.parent.children[pos]; + }, + + insertAfter : function (item) { + if (!this.parent) return false; + var pos = this.pos + 1; + var posBefore = pos + 1; + var isNotLast = (pos == this.parent.children.length) ? false : true; + this.parent._movePartStruct(pos); + this.parent.struct.items[pos] = item; + this.parent.children[pos] = new TafelTreeBranch(this.root, this.parent, item, this.level, true, isNotLast, pos); + try { + this.parent.obj.insertBefore(this.parent.children[pos].obj, this.parent.children[posBefore].obj); + } catch (err) { + this.parent.obj.appendChild(this.parent.children[pos].obj); + } + this.parent._manageAfterInsert(pos); + return this.parent.children[pos]; + }, + + /** + * Méthode pour déplacer une branche dans l'arbre comme fille + * + * @access public + * @param string hereb L'id de la nouvelle branche parente + * @return TafelTreeBranch La branche bougée + */ + move : function (hereb) { + return this.moveIntoLast(hereb); + }, + moveIntoLast : function (hereb) { + // On récupère l'objet "here" + var here = this.tree.getBranchById(hereb); + if (!here) return false + + var pos = here._getPos(); + var id = this.getId(); + var txt = this.getText(); + if (pos == here.children.length) { + obj = here.insertIntoLast(this.struct); + } else { + obj = here.children[pos].insertBefore(this.struct); + } + this.tree.removeBranch(this); + return obj; + }, + + moveIntoFirst : function (hereb) { + // On récupère l'objet "here" + var here = this.tree.getBranchById(hereb); + if (!here) return false + + var id = this.getId(); + var txt = this.getText(); + var obj = here.insertIntoFirst(this.struct); + this.tree.removeBranch(this); + return obj; + }, + + /** + * Méthode pour déplacer une branche dans l'arbre comme soeur + * + * @access public + * @param string hereb L'id de la nouvelle branche soeur + * @return void + */ + moveBefore : function (hereb) { + // On récupère l'objet "here" + var here = this.tree.getBranchById(hereb); + if (!here) return false; + + var id = this.getId(); + var txt = this.getText(); + var obj = here.insertBefore(this.struct); + this.tree.removeBranch(this); + return obj; + }, + + moveAfter : function (hereb) { + // On récupère l'objet "here" + var here = this.tree.getBranchById(hereb); + if (!here) return false; + + var id = this.getId(); + var txt = this.getText(); + var obj = here.insertAfter(this.struct); + this.tree.removeBranch(this); + return obj; + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTreeBranch private methods + *------------------------------------------------------------------------------ + */ + + /** + * Méthode pour ajouter l'élément principal + * + * @access private + * @return HTMLDivElement L'élément DIV créé + */ + _addBranch : function () { + var div = document.createElement('div'); + div.className = this.tree.classTreeBranch; + return div; + }, + + /** + * Méthode pour ajouter le contenu de l'élément (images + textes) + * + * Créé une structure comme suit : + * <table><tbody><tr> + * <td><img /></td> + * <td><img /></td> + * <td>etc. (relatif au niveau de l'élément courant)</td> + * <td><![-- CDATA --]></td> + * </tr></tbody></table> + * + * @access private + * @return HTMLTbodyElement L'élément TBODY créé + */ + _addContent : function () { + var table = document.createElement('table'); + var tbody = document.createElement('tbody'); + var tr = document.createElement('tr'); + var img = document.createElement('img'); + // Toutes les images jusqu'à celle avant l'icône + var imgs = this._addImgs(); + var nbImgs = imgs.length; + for (var i = nbImgs - 1; i >= 0; i--) { + tr.appendChild(imgs[i]); + } + // On récupère l'image avant l'icône + this.beforeIcon = this._getImgBeforeIcon(); + tr.appendChild(this.beforeIcon); + + // On créé l'icone et le texte + var tdImg = document.createElement('td'); + var tdTxt = document.createElement('td'); + var img = document.createElement('img'); + var span = document.createElement('div'); + span.innerHTML = this.struct.txt; + // Ajout du title (de NoisetteProd) + if (this.struct.title) { + span.setAttribute('title', this.struct.title); + } + // Fin ajout du title + span.setAttribute('id', this.idObj); + Element.addClassName(span, this.tree.classContent); + Element.addClassName(tdTxt, this.tree.classCanevas); + img.src = this.tree.imgBase + this.struct.img; + this.tdImg = tdImg; + if (this.tree.multiline) { + tdTxt.style.whiteSpace = 'normal'; + if (this.hasChildren()) this._manageMultiline(this.tdImg, 2, true); + } + if (this.struct.style) { + Element.addClassName(tdTxt, this.struct.style); + } + // On append l'ensemble à la table HTML + tdTxt.appendChild(span); + // Insertion du tooltip, s'il existe + if (this.struct.tooltip) { + this.tooltip = this._createTooltip(); + tdTxt.appendChild(this.tooltip); + } + tdImg.appendChild(img); + tr.appendChild(tdImg); + tr.appendChild(tdTxt); + tbody.appendChild(tr); + table.appendChild(tbody); + this.tdImg = tdImg; + this.txt = span; + this.img = img; + this.table = table; + this._setEvents(tdTxt, tdImg); + return tbody; + }, + + /** + * Fonction qui permet de gérer toutes les lignes verticales qui précèdent l'icone + * + * @access private + * @return array Les images à mettre avant l'icône + */ + _addImgs : function () { + var obj = this.parent; + var cpt = 0; + var imgs = []; + var img = null; + // On détermine s'il y a des lignes verticales avant l'icone et le texte + var td = null; + while (obj.parent) { + td = document.createElement('td'); + img = document.createElement('img'); + if (!obj.hasSiblingsAfter) { + img.src = this.tree.imgBase + this.tree.imgEmpty; + } else { + img.src = this.tree.imgBase + this.tree.imgLine1; + if (this.tree.multiline) { + this._manageMultiline(td, 1, true); + } + } + td.appendChild(img); + imgs[cpt] = td; + cpt++; + obj = obj.parent; + } + // On teste si le root à des soeurs. Si oui, on ajoute encore une ligne + td = document.createElement('td'); + img = document.createElement('img'); + if (!this.root.hasSiblingsAfter) { + img.src = this.tree.imgBase + this.tree.imgEmpty; + } else { + img.src = this.tree.imgBase + this.tree.imgLine1; + if (this.tree.multiline) { + this._manageMultiline(td, 1, true); + } + } + td.appendChild(img); + imgs[cpt] = td; + return imgs; + } +}); + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + *------------------------------------------------------------------------------ + * TafelTrees Management + *------------------------------------------------------------------------------ + */ + +var TafelTreeManager = { + /** + *------------------------------------------------------------------------------ + * TafelTreeManager properties + *------------------------------------------------------------------------------ + */ + + /** + * @var boolean stopEvent Stoppe la propagation de l'événement + */ + stopEvent : true, + + /** + * @var boolean keyboardEvents True pour activer la gestion clavier + */ + keyboardEvents : true, + + /** + * @var boolean keyboardStructEvents True pour activer la gestion clavier relative à la structure + */ + keyboardStructuralEvents : true, + + /** + * @var array trees Les arbres actuellement loadés + */ + trees : [], + + /** + * @var TafelTree currentTree L'arbre actuellement actif + */ + currentTree : null, + + /** + * @var array userKeys Les touches utilisateur + */ + userKeys : [], + + + + /** + *------------------------------------------------------------------------------ + * TafelTreeManager public methods + *------------------------------------------------------------------------------ + */ + + /** + * Permet de setter des fonctions utilisateur pour les touches voulues + * + * L'objet keys est formé comme ceci : + * - keys[0].key = code de la touche + * - keys[0].func = fonction utilisateur + * + * @access public + * @param array keys Les touchces et leur fonction + * @return void + */ + setKeys : function (keys) { + this.userKeys = keys; + }, + + /** + * Ajoute un arbre dans le manager + * + * @access public + * @param TafelTree tree L'arbre à ajouter + * @return void + */ + add : function (tree) { + this.trees.push(tree); + }, + + disableKeyboardEvents : function () { + this.keyboardEvents = false; + }, + + disableKeyboardStructuralEvents : function () { + this.keyboardStructuralEvents = false; + }, + + /** + * Retourne l'arbre actuellement actif + * + * @access public + * @return TafelTree L'arbre actuellement actif + */ + getCurrentTree : function () { + return this.currentTree; + }, + + /** + * Set l'arbre actuellement actif + * + * @access public + * @param TafelTree L'arbre actuellement actif + * @return void + */ + setCurrentTree : function (tree) { + this.currentTree = tree; + }, + + /** + * Retourne true si la touche POMME est appuyée (sur Mac Safari) + * + * @access public + * @return boolean True si POMME est appuyé + */ + metaOn : function (ev) { + var ok = false; + if (ev && (ev.metaKey)) { + ok = true; + } + return ok; + }, + + /** + * Retourne true si la touche CTRL est appuyée + * + * @access public + * @return boolean True si CTRL est appuyé + */ + ctrlOn : function (ev) { + var ok = false; + if (ev && (ev.ctrlKey || ev.modifier == 2)) { + ok = true; + } + return ok; + }, + + /** + * Retourne true si la touche ALT est appuyée + * + * @access public + * @return boolean True si ALT est appuyé + */ + altOn : function (ev) { + var ok = false; + if (ev && (ev.altKey || ev.modifier == 1)) { + ok = true; + } + return ok; + }, + + /** + * Retourne true si la touche SHIFT est appuyée + * + * @access public + * @return boolean True si ALT est appuyé + */ + shiftOn : function (ev) { + var ok = false; + if (ev && (ev.shiftKey || ev.modifier == 3)) { + ok = true; + } + return ok; + }, + + /** + * Retourne le code clavier + * + * @access public + * @param Event ev L'événement déclencheur + * @return void + */ + getCode : function (ev) { + return (ev.which) ? ev.which : ev.keyCode; + }, + + /** + * Assigne tous les événements nécessaires + * + * @access public + * @return void + */ + setControlEvents : function () { + Event.observe(document, 'keypress', this.evt_keyPress.bindAsEventListener(this), false); + var body = document.getElementsByTagName('body'); + if (!body || !body[0]) { + throw new Error(TAFELTREE_NO_BODY_TAG); + } else { + Event.observe(body[0], 'mouseup', this.evt_unselect.bindAsEventListener(this), false); + } + }, + + + /** + *------------------------------------------------------------------------------ + * TafelTreeManager events management + *------------------------------------------------------------------------------ + */ + + /** + * Déselectionne l'arbre courant + * + * @access public + * @param Event ev L'événement déclencheur + * @return void + */ + evt_unselect : function (ev) { + var obj = Event.element(ev); + var current = this.getCurrentTree(); + if (current) { + if (!Element.hasClassName(obj, current.classSelected) && !Element.hasClassName(obj, current.classOpenable)) { + current.unselect(); + this.setCurrentTree(null); + } + } + }, + + /** + * Appel lors de la touche ENTER + * + * @access public + * @param TafelTree tree L'arbre incriminé + * @param integer code Le code de la touche + * @param Object keys Les infos des "metakeys" ctrl, shift, alt et meta + * @param Event ev L'événement déclencheur + * @return void + */ + enter : function (tree, code, keys, ev) { + if (tree.lastEdited) { + tree.lastEdited.editableInput.blur(); + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche ESCAPE + * + * @access public + */ + escape : function (tree, code, keys, ev) { + var selected = tree.getSelectedBranches(); + var lastPos = selected.length - 1; + var nounselect = false; + if (lastPos == 0 && tree.lastEdited) { + if (tree.lastEdited.hideEditable(ev)) { + nounselect = true; + } + } + if (!nounselect) { + tree.unselect(); + } + tree.unsetCut(); + tree.unsetCopy(); + if (this.stopEvent) Event.stop(ev); + }, + + /** + * Appel lors de la touche HOME + * + * @access public + */ + moveStart : function (tree, code, keys, ev) { + if (!tree.lastEdited) { + tree.unselect(); + if (tree.roots.length > 0) { + var branch = tree.roots[0]; + branch.select(); + } + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche END + * + * @access public + */ + moveEnd : function (tree, code, keys, ev) { + if (!tree.lastEdited) { + tree.unselect(); + if (tree.roots.length > 0) { + var last = tree.roots.length - 1; + var branch = tree.roots[last]; + while (branch.hasChildren()) { + branch = branch.getLastBranch(); + } + branch.select(); + } + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche Fleche haut + * + * @access public + */ + moveUp : function (tree, code, keys, ev) { + var selected = tree.getSelectedBranches(); + var lastPos = selected.length - 1; + if (!tree.lastEdited) { + if (lastPos >= 0) { + var branch = selected[lastPos].getPreviousOpenedBranch(); + if (branch) branch.select(ev); + } else { + // On sélectionne automatiquement le 1er élément de l'arbre + if (typeof(tree.roots[0]) != 'undefined') tree.roots[0].select(); + } + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche Fleche bas + * + * @access public + */ + moveDown : function (tree, code, keys, ev) { + var selected = tree.getSelectedBranches(); + var lastPos = selected.length - 1; + if (!tree.lastEdited) { + if (lastPos >= 0) { + var branch = selected[lastPos].getNextOpenedBranch(); + if (branch) branch.select(ev); + } else { + // On sélectionne automatiquement le 1er élément de l'arbre + if (typeof(tree.roots[0]) != 'undefined') tree.roots[0].select(); + } + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche Fleche droite + * + * @access public + */ + moveRight : function (tree, code, keys, ev) { + var selected = tree.getSelectedBranches(); + var lastPos = selected.length - 1; + if (!tree.lastEdited) { + if (lastPos >= 0) { + var branch = selected[lastPos]; + if (branch.hasChildren() && !branch.isOpened()) { + branch.setOpen(ev); + } else { + if (branch.hasChildren()) { + var sel = branch.getFirstBranch(); + var sel = sel.select(ev); + } + } + } else { + // On sélectionne automatiquement le 1er élément de l'arbre + if (typeof(tree.roots[0]) != 'undefined') tree.roots[0].select(); + } + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche Fleche gauche + * + * @access public + */ + moveLeft : function (tree, code, keys, ev) { + var selected = tree.getSelectedBranches(); + var lastPos = selected.length - 1; + if (!tree.lastEdited) { + if (lastPos >= 0) { + var branch = selected[lastPos]; + if (lastPos == 0 && branch.hasChildren() && branch.isOpened()) { + branch.openIt(false); + } else { + if (!branch.isRoot) branch.parent.select(ev); + } + } else { + // On sélectionne automatiquement le 1er élément de l'arbre + if (typeof(tree.roots[0]) != 'undefined') tree.roots[0].select(); + } + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche F2 + * + * @access public + */ + edit : function (tree, code, keys, ev) { + var selected = tree.getSelectedBranches(); + var lastPos = selected.length - 1; + if (lastPos == 0) { + selected[lastPos].setDblClick(ev); + } + if (this.stopEvent) Event.stop(ev); + }, + + /** + * Appel lors de la touche DELETE + * + * @access public + */ + remove : function (tree, code, keys, ev) { + if (!tree.lastEdited) { + var selected = tree.getSelectedBranches(); + for (var i = 0; i < selected.length; i++) { + tree.removeBranch(selected[i]); + } + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche x ou X + * + * @access public + */ + cut : function (tree, code, keys, ev) { + if (keys.ctrlKey || keys.metaKey) { + tree.cut(); + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche c ou C + * + * @access public + */ + copy : function (tree, code, keys, ev) { + if (keys.ctrlKey || keys.metaKey) { + tree.copy(); + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche v ou V + * + * @access public + */ + paste : function (tree, code, keys, ev) { + if (keys.ctrlKey || keys.metaKey) { + tree.paste(); + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Appel lors de la touche z ou Z + * + * @access public + */ + undo : function (tree, code, keys, ev) { + if (keys.ctrlKey || keys.metaKey) { + tree.undo(); + if (this.stopEvent) Event.stop(ev); + } + }, + + /** + * Gestion du clavier + * + * @access private + * @param Event ev L'événement déclencheur + * @return void + */ + evt_keyPress : function (ev) { + var current = this.getCurrentTree(); + if (current && this.keyboardEvents) { + // Check Control Ctrl + var keys = { + 'ctrlKey' : this.ctrlOn(ev), + 'metaKey' : this.metaOn(ev), + 'altKey' : this.altOn(ev), + 'shiftKey' : this.shiftOn(ev) + }; + // Check de la touche appuyée + var code = this.getCode(ev); + // Check si l'utilisateur a fourni une fonction particulière + for (var i = 0; i < this.userKeys.length; i++) { + if (code == this.userKeys[i].key && typeof(this.userKeys[i].func) == 'function') { + if (!this.userKeys[i].func(current, code, keys, ev)) { + return false; + } + break; + } + } + switch (code) { + // Retour au début (Home) et fin (End) + case Event.KEY_HOME : this.moveStart(current, code, keys, ev); break; + case Event.KEY_END : this.moveEnd(current, code, keys, ev); break; + // Mouvements haut, bas, gauche et droite + case Event.KEY_UP : this.moveUp(current, code, keys, ev); break; + case Event.KEY_DOWN : this.moveDown(current, code, keys, ev); break; + case Event.KEY_RIGHT : this.moveRight(current, code, keys, ev); break; + case Event.KEY_LEFT : this.moveLeft(current, code, keys, ev); break; + } + if (this.keyboardStructuralEvents) { + switch (code) { + // Fin de l'édition d'une branche + case Event.KEY_RETURN : this.enter(current, code, keys, ev); break; + // Déselection + case Event.KEY_ESC : this.escape(current, code, keys, ev); break; + // Effacer (Del) + case Event.KEY_DELETE : this.remove(current, code, keys, ev); break; + // Editer (F2) + case 113: this.edit(current, code, keys, ev); break; + // Couper (x-X) + case 120: case 88: this.cut(current, code, keys, ev); break; + // Copier (c-C) + case 99 : case 67: this.copy(current, code, keys, ev); break; + // Coller (v-V) + case 118: case 86: this.paste(current, code, keys, ev); break; + // Annuler (z-Z) + case 122: case 90: this.undo(current, code, keys, ev); break; + } + } + } + } +}; + + +/** + *------------------------------------------------------------------------------ + * TafelTree pre-instanciation + *------------------------------------------------------------------------------ + */ + +function TafelTreeInitBase (ev) { + TafelTreeManager.setControlEvents(); + if (typeof(TafelTreeInit) == 'function') { + TafelTreeInit(); + } +}; + +Event.observe(window, 'load', TafelTreeInitBase, false); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/css/tree.css b/maarch_entreprise/trunk/tools/tafelTree/css/tree.css new file mode 100644 index 0000000000000000000000000000000000000000..df9b93cad6ebbf2afa37b4081b2053910c63ac4c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/css/tree.css @@ -0,0 +1,85 @@ +.tafelTree { +text-align: left; +float: left; +direction: ltr; +overflow: auto; +} + +.tafelTree, .tafelTree table { +font-size: small; +} + +.tafelTree, .tafelTree span, .tafelTree img, .tafelTree div { +margin: 0; +padding: 0; +} + +.tafelTree table { +border-collapse: collapse; +margin: 0; +padding: 0; +} + +.tafelTree table tr, .tafelTree table td { +direction: ltr; +margin: 0; +padding: 0; +} + +.tafelTree table td { +white-space: nowrap; +vertical-align: top; +} + +.tafelTree .tafelTreedrag { +cursor: pointer; +} + +.tafelTree .tafelTreecontent { +padding: 0 0.1em; +} + +.tafelTree .tafelTreecanevas { +vertical-align: middle; +} + +.tafelTree .tafelTreeselected { +background-color: #9999FF; +color: #FFFFFF; +} + +.tafelTree .tafelTreeeditable { +display: none; +padding: 0 0.2em; +border: 1px solid #CCCCFF; +background-color: #EEEEFF; +} + +.tafelTree .tafelTreedragOver { +background-color: #9999CC; +color: #EEEEFF; +} + +.tafelTree .tafelTreetooltip { +display: none; +position: absolute; +border: 1px solid #9999FF; +background-color: #EEEEFF; +padding: 0.3em; +z-index: 9000; +} + + + +/** + * Multiline + */ +.tafelTree table td.tafelTreemultiline { +background-repeat: repeat-y; +background-position: top left; +} + +.tafelTree table td.tafelTreemultiline2 { +background-repeat: repeat-y; +background-position: top left; +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/doc/docOffline_en.html b/maarch_entreprise/trunk/tools/tafelTree/doc/docOffline_en.html new file mode 100644 index 0000000000000000000000000000000000000000..a045d59ed314c9e155daeb1122e4c3afdf7e4687 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/doc/docOffline_en.html @@ -0,0 +1,2577 @@ +<html> +<head> + <title>TafelTree v1.7, 2006-11-14 >> Documentation</title> + <style> + body, table, select, option, input, textarea { + font-family: Verdana, Arial, sans-serif; + } + + body { + margin-top: 50px; + text-align: center; + background-color: #FFFFFF; + padding-bottom: 30px; + } + + div.body { + text-align: left; + width: 850px; + font-size: 0.7em; + margin: 0 auto; + } + + h1 { + text-align: right; + font-size: 2em; + color: #333399; + margin: 0; + padding: 0.1em; + } + + h2 { + text-align: right; + font-size: 1.5em; + color: #9999FF; + margin: 0; + padding: 0.2em; + padding-bottom: 1em; + border-bottom: 1px solid #999999; + } + + h1 span { + font-size: 0.5em; + font-style: italic; + } + + img.titre { + float: left; + } + + .spacer { + clear: both; + } + + a:visited { + color: #9999FF; + } + + a:hover { + color: #009900; + } + + /** + * Le menu + */ + #menu { + list-style: none; + margin: 0; + padding: 0; + font-weight: bold; + font-size: 1.2em; + } + + #menu li { + float: left; + width: 16.64%; + background-color: #EEEEFF; + } + + #menu a { + display: block; + text-align: center; + text-decoration: none; + border-bottom: 1px solid #999999; + } + + #menu a:visited { + color: #0000FF; + } + + #menu .ici a { + color: #009900; + } + + #menu a:hover { + background-color: #CCCCFF; + color: #EEEEFF; + } + + #contenu { + clear: both; + } + + #contenu .gauche { + font-size: 1.1em; + text-align: justify; + margin-top: 1em; + } + + /** + * Le contenu de gauche + */ + #contenu code { + display: block; + padding: 0.2em; + background-color: #EEEEEE; + border: 1px solid #999999; + margin: 1em 0; + font-size: 1em; + } + + #contenu .gauche > code { + font-size: 1.3em; + } + + #contenu .gauche h4 { + border-bottom: 1px solid #CCCCCC; + font-size: 1em; + color: #999999; + margin-top: 2em; + margin-bottom: 0; + } + + #contenu h3 { + text-align: center; + margin: 0; + font-size: 1.2em; + padding-bottom: 55px; + } + + /** + * Le bas du site + */ + div.bottom { + clear: both; + border-top: 1px solid #CCCCCC; + color: #555555; + margin-top: 1em; + padding-right: 25px; + background: url('../imgs/fleche.jpg') right center no-repeat; + } + + div.bottom p { + text-align: right; + margin: 0; + padding: 0; + } + + .classe { + color: #009900; + } + + .var { + color: #000099; + } + + .err { + color: #990000; + } + + .defaut { + font-weight: bold; + color: #990000; + } + + em { + color: inherit; + } + + .develop { + margin-left: 5em; + display: none; + } + + .doc h4 { + cursor: pointer; + } + + #contenu .gauche .doc h4:hover { + color: #009900; + } + + + div.code { + border: 1px solid #999999; + margin-bottom: 1em; + } + + div.code table { + border-collapse: collapse; + font-family: monospace; + } + + div.code td { + vertical-align: top; + } + + div.code td.num { + background-color: #EEEEEE; + border-right: 1px solid #DDDDDD; + } + + div.code td th { + font-size: 11px; + text-align: right; + font-weight: normal; + background-color: #EEEEEE; + color: #777777; + width: 2em; + } + + div.code td td { + font-size: 13px; + padding: 0 0 0 0.5em; + } + + div.code span.reserved { + color: #0000FF; + } + + div.code span.string { + color: #CC0000; + } + + div.code span.object { + color: #660000; + } + + div.code span.php { + font-weight: bold; + color: #CC33CC; + } + + div.code span.comment, span.comment span.reserved, span.comment span.object, span.comment span.string { + color: #009900; + } + + .doc h1 { + text-align: left; + margin-top: 1em; + } + .doc h2 { + text-align: left; + margin-top: 0.5em; + } + + #contenu .gauche h4.new { + color: #CC5555; + background-image: url('../imgs/new.png'); + background-position: top right; + background-repeat: no-repeat; + } + + .doc table.prop { + margin-left: 5%; + font-size: 0.9em; + border-collapse: collapse; + width: 95%; + } + + .doc table.prop th { + text-align: left; + } + .doc table.prop th.long { + width: 30%; + } + + .doc table.prop tr:hover { + background-color: #EEEEEE; + } + </style> + <script type="text/javascript"> + function shownext(obj) { + var div = obj; + while (div && div.nodeName.toLowerCase() != 'div') { + div = div.nextSibling; + } + if (div.style.display == 'block') { + div.style.display = 'none'; + } else { + div.style.display = 'block'; + } + } + </script> +</head> +<body> + +<div class="body"> + + <div id="contenu"> + <div class="gauche" > + + <h3 class="m4">Documentation</h3> + + <h4>Offline documentation</h4> + <ul> + <li><a href="docOffline_en.html" target="_blank">See offline documentation (HTML)</a></li> + <li><a href="docOffline_en.zip">Offline documentation (ZIP, 270 kb)</a></li> + </ul> + <h4>HTML format</h4> + <p>TafelTree is an opensource Javascript tree which has a lot of behaviours useful for managing datas. It's based on JSON and DOM. The HTML structure, totally transparent for the user of course, is like that :</p> + + <div id="myTree"></div> + <div class="spacer"> </div> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><div id=<span class="string">"tree"</span> class="tafelTree"></p></td></tr><tr><td><p style="padding-left:4ex;"><div class="tafelTree_root"></p></td></tr><tr><td><p style="padding-left:8ex;"><table><tbody><tr></p></td></tr><tr><td><p style="padding-left:12ex;"><td><img class="openable<span class="string">" src="</span>../imgs/minus5.gif"/></td></p></td></tr><tr><td><p style="padding-left:12ex;"><td><img src=<span class="string">"../imgs/globe.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:12ex;"><td class="canevas<span class="string">"><div class="</span>content">Root</div></td></p></td></tr><tr><td><p style="padding-left:8ex;"></tr></tbody></table></p></td></tr><tr><td><p style="padding-left:8ex;"><div class="tafelTree_branch"></p></td></tr><tr><td><p style="padding-left:12ex;"><table><tbody><tr></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img src=<span class="string">"../imgs/empty.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img class="openable<span class="string">" src="</span>../imgs/line3.gif"/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img src=<span class="string">"../imgs/page.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td class="canevas<span class="string">"><div class="</span>content"></p></td></tr><tr><td><p style="padding-left:20ex;">Child 1</div></td></p></td></tr><tr><td><p style="padding-left:12ex;"></tr></tbody></table></p></td></tr><tr><td><p style="padding-left:8ex;"></div></p></td></tr><tr><td><p style="padding-left:8ex;"><div class="tafelTree_branch"></p></td></tr><tr><td><p style="padding-left:12ex;"><table><tbody><tr></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img src=<span class="string">"../imgs/empty.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img class="openable<span class="string">" src="</span>../imgs/minus2.gif"/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img src=<span class="string">"../imgs/folderopen.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td class="canevas<span class="string">"><div class="</span>content"></p></td></tr><tr><td><p style="padding-left:20ex;">Child 2</div></td></p></td></tr><tr><td><p style="padding-left:12ex;"></tr></tbody></table></p></td></tr><tr><td><p style="padding-left:12ex;"><div class="tafelTree_branch"></p></td></tr><tr><td><p style="padding-left:16ex;"><table><tbody><tr></p></td></tr><tr><td><p style="padding-left:20ex;"><td><img src=<span class="string">"../imgs/empty.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:20ex;"><td><img src=<span class="string">"../imgs/empty.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:20ex;"><td><img class="openable"</p></td></tr><tr><td><p style="padding-left:24ex;">src=<span class="string">"../imgs/line2.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:20ex;"><td><img src=<span class="string">"../imgs/page.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:20ex;"><td class="canevas<span class="string">"><div class="</span>content"></p></td></tr><tr><td><p style="padding-left:24ex;">Child with child</div></td></p></td></tr><tr><td><p style="padding-left:16ex;"></tr></tbody></table></p></td></tr><tr><td><p style="padding-left:12ex;"></div></p></td></tr><tr><td><p style="padding-left:8ex;"></div></p></td></tr><tr><td><p style="padding-left:4ex;"></div></p></td></tr><tr><td><p style="padding-left:0ex;"></div></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <div class="doc"> + <h1>TafelTreeBranch Properties structure</h1> + <h2>TafelTreeBranch basic properties</h2> + + <a name="tag"></a> + <h4 onclick="shownext(this)">id <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Required</p> + + <p>The branch's user ID. Must be unique in the whole page, event if it's not in the same tree. + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="txt"></a> + <h4 onclick="shownext(this)">txt <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Required</p> + <p>The text which is showed just next the icon</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="acceptdrop"></a> + <h4 onclick="shownext(this)">acceptdrop <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : true</p> + <p><strong>True</strong> means you can drop a branch into it, <strong>false</strong> make this action impossible.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"acceptdrop"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tacceptdrop=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="canhavechildren"></a> + <h4 onclick="shownext(this)">canhavechildren <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : false</p> + <p><strong>*rue</strong> means the branch can have children from the server. You need it with the function <strong><a href="#onopenpopulate">onopenpopulate()</a></strong>. That allow the branch to have the " + " which shows that the branch has children.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"canhavechildren"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tcanhavechildren=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="check"></a> + <h4 onclick="shownext(this)">check <em>(integer)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : 0</p> + <p>Put <strong>1</strong> and the branch will be checked, if checkboxes are activated</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"check"</span> : 1</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tcheck=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="draggable"></a> + <h4 onclick="shownext(this)">draggable <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : true</p> + <p><strong>True</strong> allows you to drag the branch, <strong>false</strong> make this action impossible. Have no effects if the functions setOnDrop() or setOnDropAjax() aren't defined. (or ondrop or ondropajax)</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"draggable"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tdraggable=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="editable"></a> + <h4 onclick="shownext(this)">editable <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : 1</p> + <p>Permit the branch to be edited or not. If the funciton onEdit() exists, you can put 0 to force the branch to be "readonly"</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"editable"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Teditable=<span class="string">"0"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="img"></a> + <h4 onclick="shownext(this)">img <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : no icon</p> + <p>The icon if the branch hasn't children</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopen"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgclose"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timg=<span class="string">"anImg.gif"</span> Timgopen=<span class="string">"anImg.gif"</span> Timgclose=<span class="string">"anImg.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="imgclose"></a> + <h4 onclick="shownext(this)">imgclose <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : the same as <a href="#img">img</a></p> + <p>The icon if the branch has children and is closed.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopen"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgclose"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timg=<span class="string">"anImg.gif"</span> Timgopen=<span class="string">"anImg.gif"</span> Timgclose=<span class="string">"anImg.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="imgopen"></a> + <h4 onclick="shownext(this)">imgopen <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : the same as <a href="#img">img</a></p> + <p>The icon if the branch has children and is opened.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopen"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgclose"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timg=<span class="string">"anImg.gif"</span> Timgopen=<span class="string">"anImg.gif"</span> Timgclose=<span class="string">"anImg.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="img"></a> + <h4 class="new" onclick="shownext(this)">imgselected <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : the same as <a href="#img">img</a></p> + <p>The icon if the branch hasn't children and is selected</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgselected"</span> : <span class="string">"anImgSelect.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timg=<span class="string">"anImg.gif"</span> Timgselected=<span class="string">"anImgSelect.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="imgclose"></a> + <h4 class="new" onclick="shownext(this)">imgcloseselected <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : the same as <a href="#img">imgclose</a></p> + <p>The icon if the branch has children and is closed and selected.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgcloseselected"</span> : <span class="string">"anImgSelect.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgclose"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timgcloseselected=<span class="string">"anImgSelect.gif"</span> Timgclose=<span class="string">"anImg.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="imgopen"></a> + <h4 class="new" onclick="shownext(this)">imgopenselected <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : the same as <a href="#img">imgopen</a></p> + <p>The icon if the branch has children and is opened and selected.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopenselected"</span> : <span class="string">"anImgSelect.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopen"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timgopen=<span class="string">"anImg.gif"</span> Timgopenselected=<span class="string">"anImgSelect.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="items"></a> + <h4 onclick="shownext(this)">items <em>(array)</em></h4> + <div class="develop"> + <p class="classe">Optional</p> + <p>An array of TafelTreeBranch descriptions. Represents the children of the branch.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"items"</span> : [</p></td></tr><tr><td><p style="padding-left:4ex;">{</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"child1"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"Child 1"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"items"</span> : [</p></td></tr><tr><td><p style="padding-left:8ex;">{</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"id"</span> : <span class="string">"child1_1"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"txt"</span> : <span class="string">"Child of child 1"</span></p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:8ex;">]</p></td></tr><tr><td><p style="padding-left:4ex;">}, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"child2"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"Child 2"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">]</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span>>My super text</p></td></tr><tr><td><p style="padding-left:4ex;"><ul></p></td></tr><tr><td><p style="padding-left:8ex;"><li id=<span class="string">"child1"</span>>Child 1</p></td></tr><tr><td><p style="padding-left:12ex;"><ul></p></td></tr><tr><td><p style="padding-left:16ex;"><li id=<span class="string">"child1_1"</span>>Child of child 1</li></p></td></tr><tr><td><p style="padding-left:12ex;"></ul></p></td></tr><tr><td><p style="padding-left:8ex;"></li></p></td></tr><tr><td><p style="padding-left:8ex;"><li id=<span class="string">"child2"</span>>Child 2</li></p></td></tr><tr><td><p style="padding-left:4ex;"></ul></p></td></tr><tr><td><p style="padding-left:0ex;"></li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="last"></a> + <h4 onclick="shownext(this)">last <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value : false</p> + <p><strong>True</strong> allows you to have the branch always in the last position (in its parent). Useful after drag&drop, if you drag an other branch into the parent and whish to have this one always last.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"Trash"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"trash.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"last"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tlast=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="open"></a> + <h4 onclick="shownext(this)">open <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optional. Defaul value, the value of (<a href="#setOpenAll">setOpenAll()</a>). If cookies are activated, it's the cookie's state which is the default.</p> + <p><strong>True</strong> to have the branch open, <strong>false</strong> to have it closed.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"open"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Topen=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="style"></a> + <h4 onclick="shownext(this)">style <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional</p> + <p>The name of a CSS class. This class will be set for the text</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"style"</span> : <span class="string">"aCSSclassName"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tstyle=<span class="string">"aCCSclassName"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="title"></a> + <h4 onclick="shownext(this)">title <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional</p> + <p>The content of the HTML attribute "title". It can contains only plain normal text.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"title"</span> : <span class="string">"My title"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Ttitle=<span class="string">"My title"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="style"></a> + <h4 onclick="shownext(this)">tooltip <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optional</p> + <p>A tooltip which shows after an "onmouseover". The content can be HTML or text (or both)</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"tooltip"</span> : <span class="string">"Mon joli tooltip"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Ttooltip=<span class="string">"Mon joli tooltip"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>It's possible to put HTML. Beware with ( ' ) and ( " )</li> + <li>The tooltip is automatically inserted into a hidden DIV</li> + <li>The CSS style is <strong>div.tooltip</strong></li> + </ul> + + </div> + + + <h2>TafelTreeBranch function properties</h2> + + <a name="onbeforecheck"></a> + <h4 onclick="shownext(this)">onbeforecheck <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>the branch which called this action</td></tr> + <tr><th>checked <em>(boolean)</em></th> + <td>the check state of the branch</td></tr> + </table> + + <p class="var">Optional</p> + <p>Called when you check or uncheck a branch, BEFORE changes are made.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myBeforeCheck (branch, checked) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onbeforecheck"</span> : myBeforeCheck</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onbeforeopen"></a> + <h4 onclick="shownext(this)">onbeforeopen <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>the branch which called this action</td></tr> + <tr><th>opened <em>(boolean)</em></th> + <td>the open state of the branch</td></tr> + </table> + <p class="var">Optional</p> + <p>Called just before the branch is opened or closed. <strong>It must return a boolean</strong>. Override <strong><a href="#setOnBeforeOpen">setOnBeforeOpen()</a></strong> of TafelTree</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myBeforeOpen (branch, opened) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Tests</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, the branch will open</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Here, the branch won't open. The <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// myOpen() won't be called</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myOpen (branch, opened) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getTag());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onbeforeopen"</span> : myBeforeOpen,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onopen"</span> : myOpen</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="oncheck"></a> + <h4 onclick="shownext(this)">oncheck <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>the branch which called this action</td></tr> + <tr><th>checked <em>(boolean)</em></th> + <td>the check state of the branch</td></tr> + </table> + <p class="var">Optional</p> + <p>Called after the check (or uncheck) is done</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myCheck (branch, checked) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"oncheck"</span> : myCheck</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onclick"></a> + <h4 onclick="shownext(this)">onclick <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>the branch which called this action</td></tr> + </table> + <p class="var">Optional</p> + <p>Called when you click on the branch. Override <strong><a href="#setOnClick">setOnClick()</a></strong> of TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myClick (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch click"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onclick"</span> : myClick</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="ondblclick"></a> + <h4 onclick="shownext(this)">ondblclick <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>the branch which called this action</td></tr> + </table> + <p class="var">Optional</p> + <p>Called when you double-click on the branch. Override <strong><a href="#setOnDblClick">setOnDblClick()</a></strong> of TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myDblClick (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch double-click"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"ondblclick"</span> : myDblClick</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="ondrop"></a> + <h4 class="new" onclick="shownext(this)">ondrop <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch_move <em>(TafelTreeBranch)</em></th> + + <td>the dragged branch</td></tr> + <tr><th>branch_here <em>(TafelTreeBranch)</em></th> + <td>branch where the drop is done</td></tr> + <tr><th>drop_finished <em>(boolean)</em></th> + <td>False if drop isn't done, True if drop is done</td></tr> + + <tr><th>new_branch <em>(boolean)</em></th> + <td>The inserted branch, if it's a copyDrag</td></tr> + </table> + <p class="var">Optional</p> + <p>Called after the drop of the branch. <strong>It must return a boolean</strong>. You can make a "drop as sibling" if you keep the <strong>ALT</strong> key pressed. You can also do a "copydrag" if you maintain the <strong>CONTROL</strong> key pressed. Override <strong><a href="#setOnDrop">setOnDrop()</a></strong> of TafelTree</p> + + <p>This method is called twice. One time before drop happens (drop_finished = false) and one time after the drop is done (drop_finished = true), if there were no errors before.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myDrop (branch_move, branch_here, drop_finished,</p></td></tr><tr><td><p style="padding-left:4ex;">new_branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Beware, the <span class="reserved">function</span> is called twice. One time before drop</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// happends, one time after. Here, we check before drop</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// happends</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (!drop_finished) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Tests</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// OK, the branch will be dropped here</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// Here, the branch won't be dropped and will return</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// at her place</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// We can get the <span class="reserved">new</span> inserted branch, <span class="reserved">if</span> it's a copyDrag</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (new_branch) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(new_branch.getId())</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"ondrop"</span> : myDrop</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Keep ALT pressed for an "as sibling" drop</li> + <li>Keep CONTROL pressed to make a "copydrag"</li> + </ul> + </div> + + <a name="onedit"></a> + + <h4 onclick="shownext(this)">onedit <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>the edited branch</td></tr> + + <tr><th>newValue <em>(string)</em></th> + <td>the new value</td></tr> + <tr><th>oldValue <em>(string)</em></th> + <td>the old value</td></tr> + </table> + <p class="var">Optional</p> + + <p>Called after the edition of the branch (precisely, after the blur() of the input)</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myEdit (branch, newValue, oldValue) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (newValue.toLowerCase() == <span class="string">"trop facile"</span>) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="string">"Vraiment trop facile"</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> newValue;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"To be edited..."</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onedit"</span> : myEdit</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Returns the string that will be the new value of the branch</li> + </ul> + </div> + + <a name="onmouseout"></a> + <h4 onclick="shownext(this)">onmouseout <em>(function)</em></h4> + + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>the branch which called this action</td></tr> + </table> + <p class="var">Optional</p> + + <p>Called after a "mouse out" of the branch. Override <strong><a href="#setOnMouseOut">setOnMouseOut()</a></strong> of TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseOut (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"out : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseOver (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"over : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch mouse over and out"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseover"</span> : myMouseOver,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseout"</span> : myMouseOut</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onmouseover"></a> + <h4 onclick="shownext(this)">onmouseover <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>the branch which called this action</td></tr> + </table> + <p class="var">Optional</p> + <p>Called after a "mouse over" of the branch. Override <strong><a href="#setOnMouseOver">setOnMouseOver()</a></strong> of TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseOut (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"out : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseOver (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"over : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch mouse over and out"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseover"</span> : myMouseOver,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseout"</span> : myMouseOut</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onmousedown"></a> + <h4 class="new" onclick="shownext(this)">onmousedown <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>the branch which called this action</td></tr> + </table> + <p class="var">Optional</p> + <p>Called after a "mouse down" of the branch. Override <strong><a href="#setOnMouseDown">setOnMouseDown()</a></strong> of TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseDown (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"down : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch mouse down"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmousedown"</span> : myMouseDown</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onmouseup"></a> + <h4 class="new" onclick="shownext(this)">onmouseup <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>the branch which called this action</td></tr> + </table> + <p class="var">Optional</p> + <p>Called after a "mouse up" of the branch. Override <strong><a href="#setOnMouseUp">setOnMouseUp()</a></strong> of TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseUp (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"up : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch mouse up"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseup"</span> : myMouseUp</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onopen"></a> + <h4 onclick="shownext(this)">onopen <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>the branch which called this action</td></tr> + <tr><th>opened <em>(boolean)</em></th> + <td>the state of the branch</td></tr> + </table> + <p class="var">Optional</p> + <p>Called after the branch is opened or closed. Override <strong><a href="#setOnOpen">setOnOpen()</a></strong> of TafelTree</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myBeforeOpen (branch, opened) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Tests</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, the branch will open</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Here, the branch won't open. The <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// myOpen() won't be called</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myOpen (branch, opened) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getTag());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onbeforeopen"</span> : myBeforeOpen,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onopen"</span> : myOpen</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + + <h2>Specialities</h2> + + <h4 class="new" onclick="shownext(this)">onerrorajax(function)</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + + <tr><th>type <em>(string)</em></th> + <td>error type (open, drop or edit)</td></tr> + <tr><th>response <em>(string)</em></th> + <td>Ajax response text</td></tr> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>current branch</td></tr> + <tr><th>droppedOn <em>(TafelTreeBranch)</em></th> + <td>branch dropped on (if it's a "drop" error)</td></tr> + </table> + <p>Called after an error Ajax in functions drop, open or edit</p> + <h4>Samples</h4> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myErrorAjax (type, response, branch, droppedOn) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Check the type of error. Can be drop, edit or open</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">switch</span> (type) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"drop"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(<span class="string">"An error occured during the drop"</span>);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"open"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"edit"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"ondropajax"</span> : myDrop,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"droplink"</span> : <span class="string">"page.php"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onerrorajax"</span> : myErrorAjax</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="openlink"></a> + <h4 onclick="shownext(this)">openlink <em>(string)</em></h4> + <div class="develop"> + <p class="err">Optional, but required if <strong>onopenpopulate</strong> is defined. Used with the branch property <strong><a href="#canhavechildren">canhavechildren</a></strong></p> + + <p>Path of a script page on the server. Override <strong><a href="#setOnOpenPopulate">setOnOpenPopulate()</a></strong> of TafelTree</p> + </div> + + <a name="onopenpopulate"></a> + <h4 onclick="shownext(this)">onopenpopulate <em>(function)</em></h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>the branch opened</td></tr> + <tr><th>response <em>(string)</em></th> + <td>the Ajax response text</td></tr> + + </table> + <p class="err">Optional</p> + <p>Called after a branch is opened. When it's open, it launch an Ajax request at the page <strong>openlink</strong> and send the Ajax response to the user function. <strong>It must return a JSON string representing an array of one or more TafelTreeBranch</strong>. Override <strong><a href="#setOnOpenPopulate">setOnOpenPopulate()</a></strong> of TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myOpenPopulate (branch, response) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// To see the content of response, you can <span class="string">"<span class="reserved">alert</span>"</span> it or</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// put it in a div content like that :</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.tree.debug(response);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Evaluate a JSON response (note that the JSON is an array)</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// The response MUST BE a description of one or more</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// TafelTreeBranch</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// [{</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"id"</span> : <span class="string">"id_from_server_1"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"txt"</span> : <span class="string">"This is one is from the server"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"img"</span> : <span class="string">"globe.gif"</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// }]</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Some tests</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, the branch will be open with <span class="reserved">new</span> children</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// from the server;</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> response;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Here, the branch won't be open and no children will</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// be added</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onopenpopulate"</span> : myOpenPopulate,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"openlink"</span> : <span class="string">"somewhere/serverScriptPage.php"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"canhavechildren"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Response MUST BE an JSON array ( <strong>[ ]</strong> ) representing one or more TafelTreeBranch</li> + <li>JSON MUST BE a description of one or more TafelTreeBranch</li> + <li>Vars sent to the script page <a href="#openlink">openlink</a> are sent in POST</li> + + <li>These vars are : + <ul> + <li>" branch " = JSON description of the branch opened</li> + <li>" branch_id " = id of the branch opened</li> + <li>" tree_id " = id of the branch's parent tree</li> + </ul> + </li> + <li>All other vars passed throught <a href="#openlink">openlink</a> are in POST. For example, if openlink = "page.php?spec=1", you'll get <em>spec</em> in POST.</li> + + </ul> + </div> + + <a name="editlink"></a> + <h4 onclick="shownext(this)">editlink <em>(string)</em></h4> + <div class="develop"> + <p class="err">Optional, but required if <strong>oneditajax</strong> is defined. Can be used with the branch property <strong><a href="#editable">editable</a></strong></p> + + <p>Path of a script page on the server. Override <strong><a href="#setOnEditAjax">setOnEditAjax()</a></strong> of TafelTree</p> + </div> + + <a name="oneditajax"></a> + <h4 onclick="shownext(this)">oneditajax <em>(function)</em></h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>the edited branch</td></tr> + <tr><th>response <em>(string)</em></th> + <td>the Ajax response text</td></tr> + + <tr><th>oldValue <em>(string)</em></th> + <td>the old value</td></tr> + </table> + <p class="err">Optional</p> + <p>Called after the branch is edited. It launch an Ajax request at the page <strong>editlink</strong> and send the Ajax response to the user function. <strong>The method must return a string representing the new value of the branch</strong>. Override <strong><a href="#setOnEditAjax">setOnEditAjax()</a></strong> of TafelTree</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myEditAjax (branch, response, oldValue) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// To see the content of response, you can <span class="string">"<span class="reserved">alert</span>"</span> it or</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// put it in a div content like that :</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.tree.debug(response);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Evaluate a JSON response (note that the JSON is inside</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// brackets). The response should contain, somehow, the</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="reserved">new</span> value of the branch</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// ({</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"message"</span> : <span class="string">"Everything was fine on the server"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"newValue"</span> : <span class="string">"<span class="reserved">new</span> value of the branch"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"anyOtherParams"</span> : <span class="reserved">true</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// })</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// You can also just <span class="reserved">return</span> the <span class="reserved">new</span> value, <span class="reserved">if</span> you want</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// (and so you don't need brackets anymore). For example:</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span> (response); <span class="comment">// show the <span class="reserved">new</span> text</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Some tests</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, the branch will be edited and will have as</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// value what is returned by this <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> theNewValue;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Here, the branch won<span class="string">'t be edited and it'</span>ll keep</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// the oldValue</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"oneditajax"</span> : myEditAjax,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"editlink"</span> : <span class="string">"somewhere/serverScriptPage.php"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>The Ajax response should contain the new value of the branch</li> + <li>Vars sent to the script page <a href="#editlink">editlink</a> are sent in POST</li> + <li>These vars are : + <ul> + + <li>" branch " = JSON description of the branch</li> + <li>" branch_id " = id of the branch</li> + <li>" tree_id " = id of the branch's parent tree</li> + <li>" new_value " = the new value</li> + <li>" old_value " = the old value</li> + </ul> + + </li> + <li>All other vars passed throught <a href="#editlink">editlink</a> are in POST. For example, if editlink = "page.php?spec=1", you'll get <em>spec</em> in POST.</li> + </ul> + </div> + + <a name="droplink"></a> + + <h4 onclick="shownext(this)">droplink <em>(string)</em></h4> + <div class="develop"> + <p class="err">Optional, but required if <strong>ondropajax</strong> is defined.</p> + <p>Path of a script page on the server. Override <strong><a href="#setOnDropAjax">setOnDropAjax()</a></strong> of TafelTree</p> + + </div> + + <a name="ondropajax"></a> + <h4 class="new" onclick="shownext(this)">ondropajax <em>(function)</em></h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch_move <em>(TafelTreeBranch)</em></th> + + <td>the dragged branch</td></tr> + <tr><th>branch_here <em>(TafelTreeBranch)</em></th> + <td>the branch dropped on</td></tr> + <tr><th>response <em>(string)</em></th> + <td>the Ajax response text</td></tr> + + <tr><th>drop_finished <em>(boolean)</em></th> + <td>False if drop isn't done, True if drop is done</td></tr> + <tr><th>new_branch <em>(boolean)</em></th> + <td>The inserted branch, if it's a copyDrag</td></tr> + </table> + <p class="err">Optional</p> + + <p>Called after a drag&drop. When the branch is dropped, it launch an Ajax request at the page <strong>droplink</strong> and send the Ajax response to the user function. <strong>The medthod must return a boolean</strong>. You can make a "drop as sibling" if you keep the <strong>ALT</strong> key pressed. You can also do a "copydrag" if you maintain the <strong>CONTROL</strong> key pressed. Override <strong><a href="#setOnDropAjax">setOnDropAjax()</a></strong> of TafelTree</p> + + <p>This method is called twice. One time before drop happens (drop_finished = false) and one time after the drop is done (drop_finished = true), if there were no errors before.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr><tr><th>40</th></tr><tr><th>41</th></tr><tr><th>42</th></tr><tr><th>43</th></tr><tr><th>44</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myDropAjax(branch_move, branch_here, response,</p></td></tr><tr><td><p style="padding-left:4ex;">drop_finished, new_branch){</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Check that the move is not done now</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (!drop_finished) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// To see the content of response, you can <span class="string">"<span class="reserved">alert</span>"</span> it or</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// put it in a div content like that :</span></p></td></tr><tr><td><p style="padding-left:8ex;">branch_move.tree.debug(response); <span class="comment">// you can use branch_here too</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Evaluate a JSON response (note that the JSON is</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// inside brackets). For example, <span class="reserved">if</span> response equal :</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// ({</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// <span class="string">"param1"</span> : <span class="reserved">true</span>,</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// <span class="string">"param2"</span> : <span class="string">"salut biscuit"</span></span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// })</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> obj = eval(response);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (obj.param1) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(obj.param2);</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Some tests</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// OK, the branch will be dropped here</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// Here, the branch won't be dropped and will</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// <span class="reserved">return</span> at her place</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// We can get the <span class="reserved">new</span> inserted branch, <span class="reserved">if</span> it's a copyDrag</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// style</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (new_branch) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(new_branch.getId())</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"ondropajax"</span> : myDropAjax,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"droplink"</span> : <span class="string">"somewhere/serverScriptPage.php"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Keep ALT pressed for an "as sibling" drop</li> + <li>Keep CONTROL pressed to make a "copydrag"</li> + <li>Vars sent to the script page <a href="#droplink">droplink</a> are sent in POST</li> + + <li>These vars are : + <ul> + <li>" drag " = JSON description of dragged branch</li> + <li>" drop " = JSON description of dropped-on branch</li> + <li>" drag_id " = dragged branch id</li> + <li>" drop_id " = drop branch id</li> + <li>" treedrag_id " = dragged branch's tree id</li> + + <li>" treedrop_id " = drop branch's tree id</li> + <li>" sibling " = 0 if it's a drop "as child", 1 if it's an "as-sibling"</li> + </ul> + </li> + <li>All other vars passed throught <a href="#droplink">droplink</a> are in POST. For example, if droplink = "page.php?spec=1", you'll get <em>spec</em> in POST.</li> + + </ul> + </div> + + <a name="other"></a> + <h4 onclick="shownext(this)">...my own parameter <em>(integer, float, string, object, function, boolean, array)</em></h4> + <div class="develop"> + <p>It's possible to add any other prameters. When you manipulate a branch, you can access these properties throught the branch's property <strong>struct</strong>.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myClick (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (branch.struct.theWhetherIsBeautiful) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> str = branch.struct.wow;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.struct.aStrangeObject.param1 + <span class="string">" | "</span> + str);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branch.struct.frenchNames.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.struct.frenchNames[i]);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"wow"</span> : <span class="string">"some text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"theWhetherIsBeautiful"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"aStrangeObject"</span> : {<span class="string">"param1"</span> : <span class="string">"object in object"</span>},</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"frenchNames"</span> : [<span class="string">"Albert"</span>, <span class="string">"Gilbertin"</span>, <span class="string">"Zéphirin"</span>, <span class="string">"Anatole"</span>, <span class="string">"Gontan"</span>],</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onclick"</span> : myClick</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>These parameters ARE AVAILABLE in serialisation</li> + <li>They ARE VISIBLE in a toString()</li> + <li>They AREN'T INTERPRETED if you have an UL-LI structure</li> + </ul> + </div> + + + <h1>TafelTreeBranch methods</h1> + <h2>TafelTreeBranch public methods</h2> + + <h4 onclick="shownext(this)">hasChildren()</h4> + <div class="develop"> + <p>Returns true if branch has children, false if not</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.hasChildren());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">isOpened()</h4> + <div class="develop"> + <p>Returns true if the branch is opened</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.isOpened());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">isVisible()</h4> + <div class="develop"> + <p>Returns true if the branch is visible, false if not</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.isVisible());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getId()</h4> + <div class="develop"> + <p>Returns the ID of the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">changeId()</h4> + <div class="develop"> + <p>Change the branch's ID. Returns true if all is ok, false if the ID already exists in the tree.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (branch.changeId(<span class="string">"newId"</span>)) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"Change ok"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"This id ("</span> + newId + <span class="string">") already exists"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getText()</h4> + <div class="develop"> + <p>Returns branch's content</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getText());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getParent()</h4> + <div class="develop"> + <p>Returns parent branch, if it exists</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> parent = branch.getParent();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (parent) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(parent.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getParents()</h4> + <div class="develop"> + <p>Returns all parent branches. The first array's element is the closer parent. The last element is th root branch.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> parents = branch.getParents();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < parents.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (i < parents.length - 1) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(<span class="string">"Parent : "</span> + parents[i].getId());</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(<span class="string">"Root : "</span> + parents[i].getId());</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getAncestor()</h4> + <div class="develop"> + <p>Returns the root of the branch. IF you search the root's ancestor, it will returns "null"</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> root = branch.getAncestor();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (root) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(root.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getFirstBranch()</h4> + <div class="develop"> + <p>Returns the first branch's child, null if there isn't any</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> child = branch.getFirstBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (child) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(child.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getLastBranch()</h4> + <div class="develop"> + <p>Returns the last branch's child, null if there isn't any</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> child = branch.getLastBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (child) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(child.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPreviousSibling()</h4> + <div class="develop"> + <p>Returns the previous branch's sibling, null if there isn't any</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> sibling = branch.getPreviousSibling();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (sibling) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(sibling.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getNextSibling()</h4> + <div class="develop"> + <p>Returns the next branch's sibling, null if there isn't any</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> sibling = branch.getNextSibling();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (sibling) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(sibling.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPreviousBranch()</h4> + <div class="develop"> + <p>Returns the previous branch's sibling (without taking care of depth), null if there isn't any</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> previous = branch.getPreviousBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (previous) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(previous.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getNextBranch()</h4> + <div class="develop"> + <p>Returns the next branch's sibling (without taking care of depth), null if there isn't any</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> next = branch.getNextBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (next) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(next.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPreviousOpenedBranch()</h4> + <div class="develop"> + <p>Returns the previous branch's opened sibling (without taking care of depth), null if there isn't any</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> opened = branch.getPreviousOpenedBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (opened) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(opened.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getNextOpenedBranch()</h4> + <div class="develop"> + <p>Returns the next branch's opened sibling (without taking care of depth), null if there isn't any</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> opened = branch.getNextOpenedBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (opened) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(opened.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setText()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>txt <em>(string)</em></th> + + <td>the new text of the branch</td></tr> + </table> + <p>Set branch's texte</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.setText(<span class="string">"Hello"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getChildren()</h4> + <div class="develop"> + <p>Returns branch's children in an array</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> children = branch.getChildren();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < children.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(children[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getLevel()</h4> + <div class="develop"> + <p>Returns branch's depth. Root is at depth 0</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getLevel());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getIcon()</h4> + <div class="develop"> + <p>Returns the icon when the branch hasn't children</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getIcon());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getOpenIcon()</h4> + <div class="develop"> + <p>Returns the icon when the branch has children and is opened</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getOpenIcon());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getCloseIcon()</h4> + <div class="develop"> + <p>Returns the icon when the branch has children and is closed</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getCloseIcon());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getIconSelected()</h4> + <div class="develop"> + <p>Returns the icon when the branch hasn't children and is selected</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getIconSelected());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getOpenIconSelected()</h4> + <div class="develop"> + <p>Returns the icon when the branch has children and is opened and selected</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getOpenIconSelected());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getCloseIconSelected()</h4> + <div class="develop"> + <p>Returns the icon when the branch has children and is closed and selected</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getCloseIconSelected());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getCurrentIcon()</h4> + <div class="develop"> + <p>Returns the icon of the current state of the branch (open, close, children or not)</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getCurrentIcon());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setIcons()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>icon <em>(string)</em></th> + + <td>icon when the branch hasn't children</td></tr> + <tr class="classe"><th>iconOpen <em>(string)</em></th> + <td>icon when the branch has children and is opened</td></tr> + <tr class="classe"><th>iconClose <em>(string)</em></th> + <td>icon when the branch has children and is closed</td></tr> + + </table> + <p>Set branch's icon. If <strong>iconOpen</strong> or <strong>iconClose</strong> aren't defined, they take the value of <strong>icon</strong></p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Branch will have page.g<span class="reserved">if</span> <span class="reserved">for</span> all states</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.setIcons(<span class="string">"page.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Here, each state will have a different icon</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.setIcons(<span class="string">"page.gif"</span>, <span class="string">"folderopen.gif"</span>, <span class="string">"folder.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setIconsSelected()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>iconSelected <em>(string)</em></th> + + <td>icon when the branch hasn't children and is selected</td></tr> + <tr class="classe"><th>iconOpenSelected <em>(string)</em></th> + <td>icon when the branch has children and is opened and selected</td></tr> + <tr class="classe"><th>iconCloseSelected <em>(string)</em></th> + <td>icon when the branch has children and is closed and selected</td></tr> + + </table> + <p>Set branch's icon. If <strong>iconOpenSelected</strong> or <strong>iconCloseSelected</strong> aren't defined, they take respectively the value of <strong>iconopen</strong> and <strong>iconclose</strong> (see function <em>setIcons()</em>)</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Branch will have page.g<span class="reserved">if</span> <span class="reserved">if</span> it<span class="string">'s selected and hasn'</span>t</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// any children</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.setIconsSelected(<span class="string">"page.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Here, each state will have a different icon</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.setIconsSelected(<span class="string">"page.gif"</span>, <span class="string">"folderopen.gif"</span>, <span class="string">"folder.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">isChild()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch, string)</em></th> + + <td>branch to test, or just its ID</td></tr> + </table> + <p>Returns true if the branch in argument is an ancestor, false if not.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.isChild(<span class="string">"otherBranch"</span>));</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">openIt()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>open <em>(boolean)</em></th> + + <td>True open the branch, false close it</td></tr> + </table> + <p>Permits to open or close the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.openIt(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertIntoFirst()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>item <em>(object)</em></th> + + <td>a JSON object describing a TafelTreeBranch</td></tr> + </table> + <p>Insert the branch as a child, in the first position</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"branch1"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"child first"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertIntoFirst(item);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertIntoLast()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>item <em>(object)</em></th> + + <td>a JSON object describing a TafelTreeBranch</td></tr> + </table> + <p>Insert the branch as a child, in the last position</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"branch2"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"child last"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertIntoLast(item);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertBefore()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>item <em>(object)</em></th> + + <td>a JSON object describing a TafelTreeBranch</td></tr> + </table> + <p>Insert the branch as a sibling, just before</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"branch3"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"sibling first"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertBefore(item);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertAfter()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>item <em>(object)</em></th> + + <td>a JSON object describing a TafelTreeBranch</td></tr> + </table> + <p>Insert the branch as a sibling, just after</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"branch4"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"sibling last"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertAfter(item);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">clone()</h4> + <div class="develop"> + <p>Clone the structure of the initial branch. Doesn't create a new branch. It just returns a JSON object.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> clonedStructure = branch.clone();</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;">clonedStructure.id = <span class="string">"newid"</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">clonedStructure.txt = <span class="string">"My <span class="reserved">new</span> branch cloned"</span>;</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertAfter(clonedStructure);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Doesn't create a branch. Returns only the JSON structure</li> + </ul> + </div> + + <h4 onclick="shownext(this)">move()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>here <em>(TafelTreeBranch, string)</em></th> + <td>the new parent branch, or just its ID</td></tr> + </table> + <p>Method which move the branch as a child of "here", in the last position</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.move(<span class="string">"idNewParent"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">moveBefore()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>here <em>(TafelTreeBranch, string)</em></th> + + <td>the new parent branch, or just its ID</td></tr> + </table> + <p>Method which move the branch as a sibling after "here"</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.moveBefore(<span class="string">"idNewSibling"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">closeSiblings()</h4> + <div class="develop"> + <p>Close all sibling branches</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.closeSiblings();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">addClass()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>class <em>(string)</em></th> + + <td>CSS class to add</td></tr> + </table> + <p>Add a CSS class for the text</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.addClass(<span class="string">"myCSSclass"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">removeClass()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>class <em>(string)</em></th> + + <td>CSS class to retrieve</td></tr> + </table> + <p>Retrieve a CSS class of the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.removeClass(<span class="string">"myCSSclass"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">removeChildren()</h4> + <div class="develop"> + <p>Remove all children of the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.removeChildren();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">hasAllChildrenChecked()</h4> + <div class="develop"> + <p>Returns 1 if all children are checked, 0 if any, and -1 if some but not all</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.hasAllChildrenChecked());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">isChecked()</h4> + <div class="develop"> + <p>Returns 1 if the branch is checked, 0 if not, and -1 if partially checked</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.isChecked());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">check()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>check <em>(integer)</em></th> + + <td>Le status é donner é la branche</td></tr> + </table> + <p>Passer 1 pour la checker, 0 pour la unchecker</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.check(1);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">select()</h4> + <div class="develop"> + <p>Select the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.select();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">unselect()</h4> + <div class="develop"> + <p>Unselect the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getSelectedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (branches.length > 0) {</p></td></tr><tr><td><p style="padding-left:8ex;">branches[0].unselect();</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getWithinOffset()</h4> + <div class="develop"> + <p>Returns branch's coordinates inside the tree</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> pos = branch.getWithinOffset();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"Left : "</span> + pos[0] + <span class="string">", Top : "</span> + pos[1]);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getAbsoluteOffset()</h4> + <div class="develop"> + <p>Returns branch's coordinates inside the navigator</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> pos = branch.getAbsoluteOffset();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"Left : "</span> + pos[0] + <span class="string">", Top : "</span> + pos[1]);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + + <h2>TafelTreeBranch tree-like public methods</h2> + + <h4 onclick="shownext(this)">serialize()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + + <tr><th>debug <em>(boolean)</em></th> + <td>true allows you to have a nice display of the serialized string. ONLY FOR DEBUG! Default value is false</td></tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// True to see a nice string (usefull <span class="reserved">for</span> control)</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.serialize(<span class="reserved">true</span>));</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Send the serialization to the server</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">new</span> Ajax.Request(<span class="string">"mapage.php"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"parameters"</span>: <span class="string">"tree="</span> + branch.serialize()</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">countBranches()</h4> + <div class="develop"> + <p>Count the number of branches inside tthis branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.countBranches());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getOpenedBranches()</h4> + <div class="develop"> + <p>Retruns an array of all children-branches that are opened</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getOpenedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getCheckedBranches()</h4> + <div class="develop"> + <p>Retruns an array of all children-branches that are checked</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getUnCheckedBranches()</h4> + <div class="develop"> + <p>Retruns an array of all children-branches that aren't checked</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getUnCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPartCheckedBranches()</h4> + <div class="develop"> + <p>Retruns an array of all children-branches that are partially checked</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getPartCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getParentBranches()</h4> + <div class="develop"> + <p>Retruns an array of all children-branches that are themself parent of other branches</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getParentBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getLeafBranches()</h4> + <div class="develop"> + <p>Retruns an array of all children-branches that are leaf branches (without children)</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getLeafBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getBranches()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>filter <em>(function)</em></th> + + <td>the user function</td></tr> + </table> + <p>Retruns an array of all branches below this one. It's possible to put a filter.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// We can filter branches with an user <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myFilter (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (branch.getText() == <span class="string">"This one"</span>) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getBranches(myFilter);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">expend()</h4> + <div class="develop"> + <p>Expends all children-branches</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.expend();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">collapse()</h4> + <div class="develop"> + <p>Collapses all children-branches</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a tree was created</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.collapse();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + + <h1>TafelTree methods</h1> + <h2>TafelTree static methods</h2> + <h4 onclick="shownext(this)">loadFromUL()</h4> + <div class="develop"> + <h4>Arguments</h4> + + <table class="prop"> + <tr> + <th>id <em>(string)</em></th> + <td>UL id</td> + </tr> + <tr class="classe"> + <th>options (optional) <em>(object)</em></th> + + <td>All functions and parameters that can be set before generate(), including generate()</td> + </tr> + <tr class="classe"> + <th>debug (optional) <em>(boolean)</em></th> + <td>True display the JSON structure without creating the tree. Default value is false</td> + </tr> + </table> + + <p>UL generation doesn't allow to set your own parameters.</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><ul id=<span class="string">"idTree"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><li id=<span class="string">"b1"</span> Timg=<span class="string">"base.gif"</span>>My text</li></p></td></tr><tr><td><p style="padding-left:4ex;"><li id=<span class="string">"b2"</span> Timg=<span class="string">"base.gif"</span>>Other text</p></td></tr><tr><td><p style="padding-left:8ex;"><ul></p></td></tr><tr><td><p style="padding-left:12ex;"><li id=<span class="string">"b3"</span> Timg=<span class="string">"page.gif"</span> >Child</li></p></td></tr><tr><td><p style="padding-left:12ex;"><li id=<span class="string">"b4"</span> Timg=<span class="string">"page.gif"</span> Timgclose=<span class="string">"folder.gif"</span></p></td></tr><tr><td><p style="padding-left:16ex;">Timgopen=<span class="string">"folderopen.gif"</span>>Other child</p></td></tr><tr><td><p style="padding-left:16ex;"><ul></p></td></tr><tr><td><p style="padding-left:20ex;"><li id=<span class="string">"b5"</span> Timg=<span class="string">"page.gif"</span>>Child</li></p></td></tr><tr><td><p style="padding-left:20ex;"><li id=<span class="string">"b6"</span> Timg=<span class="string">"page.gif"</span> Teditable=<span class="string">"1"</span>></p></td></tr><tr><td><p style="padding-left:24ex;">Other child</li></p></td></tr><tr><td><p style="padding-left:16ex;"></ul></p></td></tr><tr><td><p style="padding-left:12ex;"></li></p></td></tr><tr><td><p style="padding-left:8ex;"></ul></p></td></tr><tr><td><p style="padding-left:4ex;"></li></p></td></tr><tr><td><p style="padding-left:4ex;"><li id=<span class="string">"b7"</span> Timg=<span class="string">"base.gif"</span>>Fin</li></p></td></tr><tr><td><p style="padding-left:0ex;"></ul></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myFuncClick(branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = TafelTree.loadFromUL(<span class="string">"idTree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"250px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onclick"</span> : myFuncClick,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAtLoad"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Functions to execute before generate() are set with the parameter OPTIONS</li> + <li>All branch's attirbutes are preceded with a " T " except ID</li> + <li>Attribute is <em>NEVER</em> between " " and its content is <em>ESCAPED (simple quote)</em> and is <em>ALWAYS</em> inside " "</li> + + <li>Attribute's content <em>MUST NOT</em> contains double quotes</li> + <li>It's not possible to set your own parameter</li> + </ul> + </div> + + <h2>TafelTree getters & setters methods</h2> + + <a name="new"></a> + <h4 onclick="shownext(this)">new TafelTree()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>id <em>(string)</em></th> + + <td>DIV ID</td> + </tr> + <tr> + <th>struct <em>(array)</em></th> + <td>JSON structure</td> + </tr> + <tr class="classe"> + + <th>options (optional) <em>(object)</em></th> + <td>All functions and parameters that can be set before generate(), including generate()</td> + </tr> + </table> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr><tr><th>40</th></tr><tr><th>41</th></tr><tr><th>42</th></tr><tr><th>43</th></tr><tr><th>44</th></tr><tr><th>45</th></tr><tr><th>46</th></tr><tr><th>47</th></tr><tr><th>48</th></tr><tr><th>49</th></tr><tr><th>50</th></tr><tr><th>51</th></tr><tr><th>52</th></tr><tr><th>53</th></tr><tr><th>54</th></tr><tr><th>55</th></tr><tr><th>56</th></tr><tr><th>57</th></tr><tr><th>58</th></tr><tr><th>59</th></tr><tr><th>60</th></tr><tr><th>61</th></tr><tr><th>62</th></tr><tr><th>63</th></tr><tr><th>64</th></tr><tr><th>65</th></tr><tr><th>66</th></tr><tr><th>67</th></tr><tr><th>68</th></tr><tr><th>69</th></tr><tr><th>70</th></tr><tr><th>71</th></tr><tr><th>72</th></tr><tr><th>73</th></tr><tr><th>74</th></tr><tr><th>75</th></tr><tr><th>76</th></tr><tr><th>77</th></tr><tr><th>78</th></tr><tr><th>79</th></tr><tr><th>80</th></tr><tr><th>81</th></tr><tr><th>82</th></tr><tr><th>83</th></tr><tr><th>84</th></tr><tr><th>85</th></tr><tr><th>86</th></tr><tr><th>87</th></tr><tr><th>88</th></tr><tr><th>89</th></tr><tr><th>90</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><div id=<span class="string">"idTree"</span>></div></p></td></tr><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> myStruct = [</p></td></tr><tr><td><p style="padding-left:4ex;">{</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"root"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"Root node"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span> : <span class="string">"base.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"style"</span> : <span class="string">"cssBoldStyle"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"items"</span> : [</p></td></tr><tr><td><p style="padding-left:8ex;">{</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"id"</span> : <span class="string">"node1"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"txt"</span> : <span class="string">"Node 1"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"img"</span> : <span class="string">"folderopen.gif"</span></p></td></tr><tr><td><p style="padding-left:8ex;">},</p></td></tr><tr><td><p style="padding-left:8ex;">{</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"id"</span> : <span class="string">"music"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"txt"</span> : <span class="string">"My music"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"img"</span> : <span class="string">"musicfolder.gif"</span></p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:8ex;">]</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">];</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"150px"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Example using options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> treeToBind = <span class="reserved">new</span> TafelTree(<span class="string">"idTreeToBind"</span>, structBind, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"150px"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> treeToBind2 = <span class="reserved">new</span> TafelTree(<span class="string">"idTreeToBind2"</span>, structBind2, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"150px"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"250px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImg"</span> : <span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgOpen"</span> : <span class="string">"folderopen.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgClose"</span> : <span class="string">"folder.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgSelected"</span> : <span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgOpenSelected"</span> : <span class="string">"folderopen.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgCloseSelected"</span> : <span class="string">"folder.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onLoad"</span> : myFuncLoad,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDebug"</span> : myFuncDebug,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onCheck"</span> : myFuncCheck,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onBeforeCheck"</span> : myFuncBeforeCheck,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onclick"</span> : myFuncClick,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDblClick"</span> : myFuncDblClick,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onBeforeOpen"</span> : myFuncBeforeOpen,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onOpen"</span> : myFunconOpen,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseOver"</span> : myFuncMouseOver,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseOut"</span> : myFuncMouseOut,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseDown"</span> : myFuncMouseDown,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseUp"</span> : myFuncMouseUp,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDrop"</span> : myFuncDrop,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onEdit"</span> : myFuncEdit,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onEditAjax"</span> : [myFuncEditAjax, <span class="string">"server/edit.php"</span>],</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDropAjax"</span> : [myFuncDropAjax, <span class="string">"server/drop.php"</span>]</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onOpenPopulate"</span> : [myFuncOpenPopulate, <span class="string">"server/open.php"</span>],</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"multiline"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"checkboxes"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"checkboxesThreeState"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"cookies"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openOneAtOnce"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAtLoad"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAfterAdd"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"showSelectedBranch"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"lineStyle"</span> : <span class="string">"line"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"rtlMode"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"dropALT"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"dropCTRL"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"propagateRestriction"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"reopenFromServer"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"behaviourDrop"</span> : <span class="string">"child"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"bind"</span> : [treeToBind],</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"bindAsUnidirectional"</span> : [treeToBind2]</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">enableMultiline()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + + <td>true for activating multi-line behaviour (default value, false)</td> + </tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableMultiline(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"multiline"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">reopenFromServerAfterLoad()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + + <td>false to empécher branches to be reopened from cookie, if their children are from the server. Default value is true</td> + </tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.reopenFromServerAfterLoad(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"reopenFromServer"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">enableCheckboxes()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + + <td>True activate the "checkbox 2 states" behaviour (default value, false)</td> + </tr> + </table> + <p>"Checkbox 2 states" means that you can check or uncheck a branch, but you'll never have partially checked branches.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableCheckboxes(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"checkboxes"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Checkboxes 2 states can be either " checked " or " unchecked "</li> + <li>For managing 3 states, see enableCheckboxesThreeState() function</li> + </ul> + </div> + + <h4 onclick="shownext(this)">enableCheckboxesThreeState()</h4> + + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + <td>True activate the "checkbox 3 states" behaviour (default value, false)</td> + </tr> + + </table> + <p>"Checkbox 2 states" means that it's an "clever check". When you check or uncheck a branch, il will automatically check or uncheck all children. If some children aren't checked and some other are, the parent will be partially checked.<p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableCheckboxesThreeState(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"checkboxesThreeState"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>There's no need to call enableCheckboxes() function.</li> + </ul> + </div> + + <h4 onclick="shownext(this)">enableCookies()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + <td>True activates cookies management (default value, true)</td> + </tr> + <tr class="classe"> + + <th>separator (optional) <em>(string)</em></th> + <td>Separator used in cookies (default value, " | ")</td> + </tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableCookies(<span class="reserved">true</span>, <span class="string">"#___#"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options. It's not possible to set the separator from here</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"cookies"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Cookies remember which branches are opened after a reload</li> + <li>Modify the separator can be useful if a " | " is part of branches ID</li> + </ul> + </div> + + <h4 onclick="shownext(this)">openOneAtOnce()</h4> + + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + <td>True enable the fact that you can only open one branch at one (default value, false)</td> + </tr> + + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.openOneAtOnce(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openOneAtOnce"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">openAtLoad()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>open <em>(boolean)</em></th> + + <td>True open all tree at load (default value, false)</td> + </tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.openAtLoad(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAtLoad"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>When cookies are activated, it's the cookie state which is interpreted</li> + </ul> + </div> + + <h4 onclick="shownext(this)">openAfterAdd()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>open <em>(boolean)</em></th> + <td>True open the branch after an insert or a drop, false keep it closed</td> + </tr> + </table> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.openAfterAdd(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAfterAdd"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">showSelectedBranch()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>show <em>(boolean)</em></th> + + <td>True highlight the selected branch (default value, true)</td> + </tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.showSelectedBranch(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"showSelectedBranch"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setLineStyle()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>style <em>(string)</em></th> + + <td>Set the line style of the tree (default value, " line ")</td> + </tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setLineStyle(<span class="string">"none"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"lineStyle"</span> : <span class="string">"none"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Les valeurs possibles sont " line ", " full " ou " none ".</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setIcons()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>icon <em>(string)</em></th> + <td>The icon if the branch hasn't children</td></tr> + <tr class="classe"><th>iconOpen <em>(string)</em></th> + <td>The icon if the branch has children and is opened</td></tr> + + <tr class="classe"><th>iconClose <em>(string)</em></th> + <td>The icon if the branch has children and is closed</td></tr> + </table> + <p>Set default icons for all banches. If <strong>iconOpen</strong> or <strong>iconClose</strong> aren't defined, they take the value of <strong>icon</strong></p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setIcons(<span class="string">"page.gif"</span>, <span class="string">"folderopen.gif"</span>, <span class="string">"folder.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImg"</span> : <span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgOpen"</span> : <span class="string">"folderopen.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgClose"</span> : <span class="string">"folder.gif"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setIconsSelected()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>iconSelected <em>(string)</em></th> + + <td>icon when the branch hasn't children and is selected</td></tr> + <tr class="classe"><th>iconOpenSelected <em>(string)</em></th> + <td>icon when the branch has children and is opened and selected</td></tr> + <tr class="classe"><th>iconCloseSelected <em>(string)</em></th> + <td>icon when the branch has children and is closed and selected</td></tr> + + </table> + <p>Set branch's icon. If <strong>iconOpenSelected</strong> or <strong>iconCloseSelected</strong> aren't defined, they take respectively the value of <strong>iconopen</strong> and <strong>iconclose</strong> (see function <em>setIcons()</em>)</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setIconsSelected(<span class="string">"page.gif"</span>, <span class="string">"folderopen.gif"</span>, <span class="string">"folder.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgSelected"</span> : <span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgOpenSelected"</span> : <span class="string">"folderopen.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgCloseSelected"</span> : <span class="string">"folder.gif"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="#behaviourDrop"></a> + <h4 class="new" onclick="shownext(this)">setBehaviourDrop()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>dropStyle <em>(string)</em></th> + + <td>'sibling', 'siblingcopy', child' or 'childcopy', default value is 'child'</td></tr> + </table> + <p>Set default drop behaviour. Set <strong>sibling</strong> and dropping a branch will make a new sibling or, by keeping ALT pressed, a new child. And vice-versa if it's set to <strong>child</strong>.</p> + <p>If you set <strong>siblingcopy</strong>, the drop will result in a new sibling which is a copy of the branch dropped. If you maintain ALT + CTRL pressed, it will move the branch as child, without copy. Well, the best thing to do is to test the four keywords, and see what happends...</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setBehaviourDrop(<span class="string">"sibling"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"behaviourDrop"</span> : <span class="string">"sibling"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">disableDropCTRL()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>ctrlDrop <em>(boolean)</em></th> + + <td>False disable the functionality CTRL drop, default value true</td></tr> + </table> + <p>If you give "false", it will disable the CTRL key. So it you'll not be able to make a copyDrag. A copyDrag makes a copy of the branch moved. An insertDrag just move the branch without creating any other.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.disableDropCTRL(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"dropCTRL"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">disableDropALT()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>altDrop <em>(string)</em></th> + + <td>False disable the functionality ALT drop, default value true</td></tr> + </table> + <p>False disable the functionality of having 2 different drop styles. Either "as sibling" or "as child". If you give "false" to this function, you + will have only the possibility of drop defined by the function <a href="#">setBehaviourDrop()</a></p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.disableDropALT(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"dropALT"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">propagateRestriction()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>propagate <em>(boolean)</em></th> + + <td>True propagate the interdiction to move after a ajax drag&drop (default value, true)</td> + </tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setOnDropAjax(myFunc, <span class="string">"mypage.php"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.propagateRestriction(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDropAjax"</span> : [myFunc, <span class="string">"mypage.php"</span>],</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"propagateRestriction"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Propagation means that children of the branch moved are blocked and can't be moved. (used to skip data problems).</li> + </ul> + </div> + + <h4 class="new" onclick="shownext(this)">enableRTL()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>rtl <em>(boolean)</em></th> + <td>True display the tree from right to left (default value, false)</td> + </tr> + </table> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableRTL(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"rtlMode"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + + <h2>TafelTree public methods</h2> + <h4 onclick="shownext(this)">generate()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + + <tr> + <th>partLoad <em>(boolean)</em></th> + <td>True generate the tree step-by-step (experimental), default value is false</td> + </tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.generate();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">serialize()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>debug <em>(boolean)</em></th> + + <td>true allows you to have a nice display of the serialized string. ONLY FOR DEBUG! Default value is false</td></tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.generate();</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// True to see a nice string (usefull <span class="reserved">for</span> control)</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(tree.serialize(<span class="reserved">true</span>));</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Send the serialization to the server</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">new</span> Ajax.Request(<span class="string">"mapage.php"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"parameters"</span> : <span class="string">"tree="</span> + tree.serialize()</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getSelectedBranches()</h4> + <div class="develop"> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> selected = tree.getSelectedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (selected.length > 0) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < selected.length; i++) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(selected[i].getId());</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getBranchById()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>id <em>(string)</em></th> + + <td>branch ID</td></tr> + </table> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">bind()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>tree <em>(TafelTree)</em></th> + + <td>the tree to bind</td></tr> + <tr class="classe"><th>tree <em>(TafelTree)</em></th> + <td>an other tree</td></tr> + <tr class="classe"><th>... <em>(TafelTree)</em></th> + <td>all the trees we want</td></tr> + + </table> + <p>This binding is bi-directional. That means that you can drop from tree1 to tree2 and from tree2 to tree1.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// In this case, it will be possible to drag&drop between</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// tree_1 and tree_2 and inversement</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree_2 = <span class="reserved">new</span> TafelTree(<span class="string">"idTree_2"</span>, myOtherStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.bind(tree_2);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>This binding is bi-directional</li> + </ul> + </div> + + <h4 onclick="shownext(this)">bindAsUnidirecitonal()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>tree <em>(TafelTree)</em></th> + <td>the tree to bind</td></tr> + <tr class="classe"><th>tree <em>(TafelTree)</em></th> + <td>an other tree</td></tr> + + <tr class="classe"><th>... <em>(TafelTree)</em></th> + <td>all the trees we want</td></tr> + </table> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// In this case, it will only be possible to drag&drop</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// from tree to tree_2</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree_2 = <span class="reserved">new</span> TafelTree(<span class="string">"idTree_2"</span>, myOtherStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.bindAsUnidirecitonal(tree_2);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>This binding is uni-directional</li> + </ul> + </div> + + <h4 onclick="shownext(this)">isBindedWith()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>tree <em>(TafelTree)</em></th> + <td>the tree to test if it's binded with</td></tr> + </table> + <h4>Samples</h4> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree_2 = <span class="reserved">new</span> TafelTree(<span class="string">"idTree_2"</span>, myOtherStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.bindAsUnidirectional(tree_2);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(tree.isBindedWith(tree_2)); <span class="comment">// returns <span class="reserved">true</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(tree_2.isBindedWith(tree)); <span class="comment">// returns <span class="reserved">false</span></span></p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">unselect()</h4> + <div class="develop"> + <p>Unselect branches, if one or more were selected</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.unselect();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">countBranches()</h4> + <div class="develop"> + <p>Count the number of branches</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(tree.countBranches());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getOpenedBranches()</h4> + <div class="develop"> + <p>Retruns an array of all branches that are opened</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getOpenedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getCheckedBranches()</h4> + <div class="develop"> + <p>Retruns an array of all branches that are checked</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getUnCheckedBranches()</h4> + <div class="develop"> + <p>Retruns an array of all branches that aren't checked</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getUnCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPartCheckedBranches()</h4> + <div class="develop"> + <p>Retruns an array of all branches that are partially checked</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getPartCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getParentBranches()</h4> + <div class="develop"> + <p>Retruns an array of all branches that are themself parent of other branches</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getParentBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getLeafBranches()</h4> + <div class="develop"> + <p>Retruns an array of all branches that are leaf branches (without children)</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getLeafBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getBranches()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>filter <em>(function)</em></th> + + <td>the user function</td></tr> + </table> + <p>Retruns an array of all branches. It's possible to put a filter.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// We can filter branches with an user <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myFilter (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (branch.getText() == <span class="string">"Celle-ci"</span>) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getBranches(myFilter);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">expend()</h4> + <div class="develop"> + <p>Expends all branches</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.expend();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">collapse()</h4> + <div class="develop"> + <p>Collapses all branches</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.collapse();</p></td></tr><tr><td><p style="padding-left:4ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertBranch()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>position <em>(TafelTreeBranch, string)</em></th> + + <td>the source branch (or just the ID)</td></tr> + <tr><th>item <em>(object)</em></th> + <td>new branch (format JSON <a href="#tag"><em>TafelTreeBranch properties</em></a>)</td></tr> + <tr class="classe"><th>sibling <em>(boolean)</em></th> + <td>true means we want to insert it as sibling, default value false (=child)</td></tr> + + <tr class="classe"><th>first <em>(boolean)</em></th> + <td>true means we want to insert it as first child or sibling before, default value false</td></tr> + </table> + <p>Allows you to insert a branch as sibling or as child, before, after, in the first or last place.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span>:<span class="string">"new1"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span>:<span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span>:<span class="string">"child before"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item2 = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span>:<span class="string">"new2"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span>:<span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span>:<span class="string">"child after"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item3 = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span>:<span class="string">"new3"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span>:<span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span>:<span class="string">"sibling before"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item4 = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span>:<span class="string">"new4"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span>:<span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span>:<span class="string">"sibling after"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Child branch - in first</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch1 = tree.insertBranch(<span class="string">"id_branch"</span>, item, <span class="reserved">false</span>, <span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Child branch - in last</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch2 = tree.insertBranch(<span class="string">"id_branch"</span>, item2, <span class="reserved">false</span>, <span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Sibling branch - before</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch3 = tree.insertBranch(<span class="string">"id_branch"</span>, item3, <span class="reserved">true</span>, <span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Sibling branch - after</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch4 = tree.insertBranch(<span class="string">"id_branch"</span>, item4, <span class="reserved">true</span>, <span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">removeBranch()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch, string)</em></th> + + <td>the branch to remove (or just the ID)</td></tr> + </table> + <p>Remove the branch and all its children</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.removeBranch(<span class="string">"id_branch_to_delete"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">debug()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>str <em>(string)</em></th> + + <td>The string to display</td></tr> + </table> + <p>Display a string into the Debug Zone</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Let's say a structure was defined</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.debug(<span class="string">"text to debug : "</span> + tree.id);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h2>TafelTree event methods</h2> + <h4 onclick="shownext(this)">setOnDebug()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called after the function tree.debug()</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myDebug (tree, HTMLDebugObj, str) {</p></td></tr><tr><td><p style="padding-left:8ex;">HTMLDebugObj.innerHTML = <span class="string">"My func : "</span> + str;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDebug"</span> : myDebug</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;">tree.debug(<span class="string">"text to debug"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>By default, tree.debug() display only the text into the HTMLDebugObj</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setOnLoad()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>The user function to call</td></tr> + </table> + <p>Called when the tree finished to load</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myLoad () {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"load finished"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onLoad"</span> : myLoad</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnOpen()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called after a branch is opened (<em>status = true</em>) or closed (<em>status = false</em>)</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myOpen (branch, status) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> str = (status) ? <span class="string">"opened"</span> : <span class="string">"closed"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" has been "</span> + str);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onOpen"</span> : myOpen</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnBeforeOpen()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called before a branch is open (<em>status = true</em>) or closed (<em>status = false</em>). If it returns <strong>false</strong>, the branch will keep its actual state.</p> + <h4>Samples</h4> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myBeforeOpen (branch, status) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> strNow = (status) ? <span class="string">"opened"</span> : <span class="string">"closed"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> strNext = (status) ? <span class="string">"closed"</span> : <span class="string">"opened"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" is "</span> + strNow +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">" and will be "</span> + strNext +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">" <span class="reserved">if</span> this <span class="reserved">function</span> returns <span class="reserved">true</span>"</span>);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onBeforeOpen"</span> : myBeforeOpen</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnMouseOver()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called when the mouse pass trought the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myMouseOver (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"over : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseOver"</span> : myMouseOver</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnMouseOut()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called when the mouse quit the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myMouseOut (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"out : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseOut"</span> : myMouseOut</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setOnMouseDown()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called when the mouse "down" on the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myMouseDown (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"down : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseDown"</span> : myMouseDown</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setOnMouseUp()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called when the mouse "up" on the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myMouseUp (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"up : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseUp"</span> : myMouseUp</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnClick()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called after a click on the branch</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myClick (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onclick"</span> : myClick</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>A clicked-branch will be automatically selected</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setOnDblClick()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>The user function to call</td></tr> + </table> + <p>Called after a double-click on a branch</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myDblClick (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDblClick"</span> : myDblClick</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>If edition is defined, the double-clic will start the branch's edition</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setOnEdit()</h4> + <div class="develop"> + + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>The user function to call</td></tr> + </table> + <p>Activate branches edition. Called after the edition of the branch (precisely, after the blur() of the input). The new content will be the one returned by the user function.</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myEdit (branch, newValue, oldValue) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> str = branch.getId() + <span class="string">" : "</span> + newValue;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> str;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onEdit"</span> : myEdit</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>If you have a doube-click fuction <em>(tree.setOnDblClick())</em>, the edition is no more available. It's one or the other, but not edition and double-click together</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setOnBeforeCheck()</h4> + + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>The user function to call</td></tr> + </table> + <p>Called when you check or uncheck a branch, BEFORE changes are made. If you don't want its state to change, just return <strong>false</strong></p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myBeforeCheck (branch, status) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> strNow = (status) ? <span class="string">"checked"</span> : <span class="string">"unchecked"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> strNext = (status) ? <span class="string">"unchecked"</span> : <span class="string">"checked"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" is "</span> + strNow +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">" and will be "</span> + strNext +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">" <span class="reserved">if</span> this <span class="reserved">function</span> returns <span class="reserved">true</span>"</span>);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onBeforeCheck"</span> : myBeforeCheck</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnCheck()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called after the check (or uncheck) is done</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myCheck (branch, status) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> str = (status) ? <span class="string">"checked"</span> : <span class="string">"unchecked"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" is now "</span> + str);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onCheck"</span> : myCheck</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setOnDrop()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + </table> + <p>Called after the drop of the branch. <strong>It must return a boolean</strong>. You can make a "drop as sibling" if you keep the <strong>ALT</strong> key pressed. You can also do a "copydrag" if you maintain the <strong>CONTROL</strong> key pressed.</p> + <p>This method is called twice. One time before drop happens (drop_finished = false) and one time after the drop is done (drop_finished = true), if there were no errors before.</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myDrop (branchMoved, newParent, dropFinished) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (!dropFinished) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(branchMoved.getId()+ <span class="string">" will be child of "</span></p></td></tr><tr><td><p style="padding-left:16ex;">+ newParent.getId());</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(branchMoved.getId()+ <span class="string">" is now child of "</span></p></td></tr><tr><td><p style="padding-left:16ex;">+ newParent.getId());</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDrop"</span> : myDrop</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Keep ALT pressed for an "as sibling" drop</li> + <li>Keep CONTROL pressed to make a "copydrag"</li> + </ul> + </div> + + <h4 class="new" onclick="shownext(this)">setOnDropAjax()</h4> + + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>The user function to call</td></tr> + <tr><th>link <em>(string)</em></th> + + <td>Link to the server page</td></tr> + </table> + <p>Called after a drag&drop. When the branch is dropped, it launch an Ajax request at the page <strong>droplink</strong> and send the Ajax response to the user function. <strong>The medthod must return a boolean</strong>. You can make a "drop as sibling" if you keep the <strong>ALT</strong> key pressed. You can also do a "copydrag" if you maintain the <strong>CONTROL</strong> key pressed.</p> + + <p>This method is called twice. One time before drop happens (drop_finished = false) and one time after the drop is done (drop_finished = true), if there were no errors before.</p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr><tr><th>40</th></tr><tr><th>41</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myDrop(branchMoved,newParent,response,dropFinished){</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Beware, the <span class="reserved">function</span> is called twice. Here, we</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// check before drop happends</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (!dropFinished) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// The response is the responseText of XMLHttpRequest</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// object</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(response);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// The text can be a JSON string, so you should</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// evaluate it like that :</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">var</span> obj = eval(<span class="string">""</span> + response + <span class="string">""</span>);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// You have to put brackets <span class="reserved">if</span> you didn't put</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// them in the server side</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(obj.myProperty);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(branchMoved.getId()+ <span class="string">" will be child of "</span> +</p></td></tr><tr><td><p style="padding-left:16ex;">newParent.getId() +</p></td></tr><tr><td><p style="padding-left:16ex;"><span class="string">" <span class="reserved">if</span> this <span class="reserved">function</span> returns <span class="reserved">true</span>"</span>);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDropAjax"</span> : [myDrop, <span class="string">"pageScript.php"</span>]</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// PHP file sample</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="php"><?php</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Do some stuff</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// ...</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// And display a JSON string. Note that <span class="reserved">if</span> you <span class="reserved">return</span> an object</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// you need to display it inside brackets</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="php">?></span></p></td></tr><tr><td><p style="padding-left:0ex;">({</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"myProperty"</span> : <span class="string">"myValue"</span>,</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"other"</span> : [<span class="string">"this"</span>, <span class="string">"is"</span>, <span class="string">"an"</span>, <span class="string">"array"</span>]</p></td></tr><tr><td><p style="padding-left:0ex;">})</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Keep ALT pressed for an "as sibling" drop</li> + <li>Keep CONTROL pressed to make a "copydrag"</li> + <li>Vars sent to the script page <a href="#droplink">droplink</a> are sent in POST</li> + + <li>These vars are : + <ul> + <li>" drag " = JSON description of dragged branch</li> + <li>" drop " = JSON description of dropped-on branch</li> + <li>" drag_id " = dragged branch id</li> + <li>" drop_id " = drop branch id</li> + <li>" treedrag_id " = dragged branch's tree id</li> + + <li>" treedrop_id " = drop branch's tree id</li> + <li>" sibling " = 0 if it's a drop "as child", 1 if it's an "as-sibling"</li> + </ul> + </li> + <li>All other vars passed throught <a href="#droplink">droplink</a> are in POST. For example, if droplink = "page.php?spec=1", you'll get <em>spec</em> in POST.</li> + + </ul> + </div> + + <h4 onclick="shownext(this)">setOnOpenPopulate()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + <tr><th>link <em>(string)</em></th> + <td>Link to the server page</td></tr> + </table> + <p>Called after a branch is opened. When it's open, it launch an Ajax request at the page <strong>openlink</strong> and send the Ajax response to the user function. <strong>It must return a JSON string representing an array of one or more TafelTreeBranch</strong></p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr><tr><th>40</th></tr><tr><th>41</th></tr><tr><th>42</th></tr><tr><th>43</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myOpen (branch, response) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// The response is the responseText of XMLHttpRequest</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// object</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(response);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// It MUST BE a JSON string which MUST BE the structure</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// of a TafelTreeBranch</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> childBranch = eval(response);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(childBranch.id + <span class="string">"\n"</span> + childBranch.txt);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" will be opened <span class="reserved">if</span> "</span> +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"this <span class="reserved">function</span> returns <span class="reserved">true</span>"</span>);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> response;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onOpenPopulate"</span> : [myOpen, <span class="string">"pageScript.php"</span>]</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// PHP file sample</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="php"><?php</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Do some stuff</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// ...</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Et on affiche une string JSON. A noter qu'on retourne</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// systématiquement un TABLEAU</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="php">?></span></p></td></tr><tr><td><p style="padding-left:0ex;">[</p></td></tr><tr><td><p style="padding-left:0ex;">{</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"id"</span> : <span class="string">"child1"</span>,</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"txt"</span> : <span class="string">"Texte 1"</span>,</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"items"</span> : [</p></td></tr><tr><td><p style="padding-left:4ex;">{</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"child2"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"Texte 2"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">]</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">]</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Response MUST BE an JSON array ( <strong>[ ]</strong> ) representing one or more TafelTreeBranch</li> + <li>JSON MUST BE a description of one or more TafelTreeBranch</li> + <li>Vars sent to the script page <a href="#openlink">openlink</a> are sent in POST</li> + + <li>These vars are : + <ul> + <li>" branch " = JSON description of the branch opened</li> + <li>" branch_id " = id of the branch opened</li> + <li>" tree_id " = id of the branch's parent tree</li> + </ul> + </li> + <li>All other vars passed throught <a href="#openlink">openlink</a> are in POST. For example, if openlink = "page.php?spec=1", you'll get <em>spec</em> in POST.</li> + + </ul> + </div> + + <h4 onclick="shownext(this)">setOnEditAjax()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>The user function to call</td></tr> + <tr><th>link <em>(string)</em></th> + <td>Link to the server page</td></tr> + </table> + <p>Called after the branch is edited. It launch an Ajax request at the page <strong>editlink</strong> and send the Ajax response to the user function. <strong>The method must return a string representing the new value of the branch</strong>.</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myEditAjax (branch, response, oldValue) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// To see the content of response, you can <span class="string">"<span class="reserved">alert</span>"</span> it or</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// put it in a div content like that :</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.tree.debug(response);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Evaluate a JSON response (note that the JSON is</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// inside brackets). The response should contain, somehow,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// the <span class="reserved">new</span> value of the branch</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// ({</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"message"</span> : <span class="string">"Everything was fine on the server"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"newValue"</span> : <span class="string">"<span class="reserved">new</span> value"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"anyOtherParams"</span> : <span class="reserved">true</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// })</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// You can also just <span class="reserved">return</span> the <span class="reserved">new</span> value, <span class="reserved">if</span> you want.</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// For example :</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span> (response); <span class="comment">// show the <span class="reserved">new</span> text</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Some tests</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, the branch will be edited and will have as</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// value what is returned by this <span class="reserved">function</span>;</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> theNewValue;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Here, the branch won<span class="string">"t be edited and it"</span>ll keep</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// the oldValue</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>The Ajax response should contain the new value of the branch</li> + <li>Vars sent to the script page <a href="#editlink">editlink</a> are sent in POST</li> + <li>These vars are : + <ul> + + <li>" branch " = JSON description of the branch</li> + <li>" branch_id " = id of the branch</li> + <li>" tree_id " = id of the branch's parent tree</li> + <li>" new_value " = the new value</li> + <li>" old_value " = the old value</li> + </ul> + + </li> + <li>All other vars passed throught <a href="#editlink">editlink</a> are in POST. For example, if editlink = "page.php?spec=1", you'll get <em>spec</em> in POST.</li> + </ul> + </div> + + <h4 class="new" onclick="shownext(this)">setOnErrorAjax()</h4> + + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>The user function to call</td></tr> + </table> + <p>Called after an error Ajax in functions drop, open or edit</p> + + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myErrorAjax (type, response, branch, droppedOn) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Check error type. Can be drop, edit ou open</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">switch</span> (type) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"drop"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"open"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"edit"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(<span class="string">"Une erreur est survenue pendant l'édition"</span>);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h1>TafelTreeManager methods</h1> + <h2>TafelTreeManager Keyboard events description</h2> + <h4 class="new" onclick="shownext(this)">Events</h4> + <div class="develop"> + <p>The follwing keyboard keys are managed :</p> + + <ul> + <li>ARROW_LEFT</li> + <li>ARROW_RIGHT</li> + <li>ARROW_UP</li> + <li>ARROW_DOWN</li> + <li>HOME</li> + + <li>END</li> + <li>F2 (editing)</li> + <li>ENTER (stop editing)</li> + <li>ESCAPE (unselect)</li> + <li>DELETE</li> + <li>CTRL + X (APPLE-KEY on mac Safari)</li> + + <li>CTRL + C (APPLE-KEY on mac Safari)</li> + <li>CTRL + V (APPLE-KEY on mac Safari)</li> + </ul> + <p>It's possible to desactivate certain keys or adding your own. See setKey() function</p> + </div> + <h2>TafelTreeManager public methods</h2> + <h4 class="new" onclick="shownext(this)">setKeys()</h4> + + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr> + <th>keys <em>(array)</em></th> + <td>array containing the key code and the function for the key</td> + </tr> + + </table> + <p>Can manage on or more behaviour for one or more keyboard keys. The function is called just after the key is pressed. The user function has for arguments the tree where the key was pressed, the modifiers-key pressed (ctrl, alt, shit or meta), the key code and the Event object.</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="reserved">function</span> definition</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myOnDelete (tree, code, modifiers, ev) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Do some stuff and <span class="reserved">return</span> <span class="reserved">true</span> <span class="reserved">if</span> you want</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// the process to continue. For DEL key, <span class="reserved">for</span> example,</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// there's already a build-in <span class="reserved">function</span>. If you</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// <span class="reserved">return</span> <span class="reserved">true</span>, the delete <span class="reserved">function</span> will be called.</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// If you <span class="reserved">return</span> <span class="reserved">false</span>, it will not be called...</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (okForDelete) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// key definition</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> keys = [</p></td></tr><tr><td><p style="padding-left:4ex;">{</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"key"</span> : 46,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"func"</span> : myOnDelete</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">];</p></td></tr><tr><td><p style="padding-left:4ex;">TafelTreeManager.setKeys(keys);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>modifiers.ctrlKey = true if Ctrl is pressed</li> + <li>modifiers.altKey = true if Alt is pressed</li> + <li>modifiers.shiftKey = true if Shift is pressed</li> + <li>modifiers.metaKey = true if "Pomme" (on mac Safari) is pressed</li> + + </ul> + </div> + + <h4 class="new" onclick="shownext(this)">disableKeyboardEvents()</h4> + <div class="develop"> + <p>Disable all keyboard events</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;">TafelTreeManager.disableKeyboardEvents();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">disableKeyboardStructuralEvents()</h4> + <div class="develop"> + <p>Disable all build-in structural functions., like DEL, COPY, PASTE, etc. So it's still possible to navigate with arrows. User functions are active too.</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;">TafelTreeManager.disableKeyboardStructuralEvents();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getCurrentTree()</h4> + <div class="develop"> + <p>Returns the current tree. Null if no tree is selected.</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(TafelTreeManager.getCurrentTree());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setCurrentTree()</h4> + <div class="develop"> + <p>Set the current tree where all keyboard actions will be done.</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;">TafelTreeManager.setCurrentTree(myTree);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + </div> + + </div> + </div> + <div class="bottom"> + <p>Treeview JS TafelTree</p> + <p>2006-12-30, <a href="#" onclick="gereStyle()">Tafel</a>. Optimised for Mozilla Firefox</p> + </div> + +</div> + +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/doc/docOffline_fr.html b/maarch_entreprise/trunk/tools/tafelTree/doc/docOffline_fr.html new file mode 100644 index 0000000000000000000000000000000000000000..c2e9737a0e1ce013996b22fbe499fc79c4ee53e1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/doc/docOffline_fr.html @@ -0,0 +1,2607 @@ +<html> +<head> + <style> + body, table, select, option, input, textarea { + font-family: Verdana, Arial, sans-serif; + } + + body { + margin-top: 50px; + text-align: center; + background-color: #FFFFFF; + padding-bottom: 30px; + } + + div.body { + text-align: left; + width: 850px; + font-size: 0.7em; + margin: 0 auto; + } + + h1 { + text-align: right; + font-size: 2em; + color: #333399; + margin: 0; + padding: 0.1em; + } + + h2 { + text-align: right; + font-size: 1.5em; + color: #9999FF; + margin: 0; + padding: 0.2em; + padding-bottom: 1em; + border-bottom: 1px solid #999999; + } + + h1 span { + font-size: 0.5em; + font-style: italic; + } + + img.titre { + float: left; + } + + .spacer { + clear: both; + } + + a:visited { + color: #9999FF; + } + + a:hover { + color: #009900; + } + + /** + * Le menu + */ + #menu { + list-style: none; + margin: 0; + padding: 0; + font-weight: bold; + font-size: 1.2em; + } + + #menu li { + float: left; + width: 16.64%; + background-color: #EEEEFF; + } + + #menu a { + display: block; + text-align: center; + text-decoration: none; + border-bottom: 1px solid #999999; + } + + #menu a:visited { + color: #0000FF; + } + + #menu .ici a { + color: #009900; + } + + #menu a:hover { + background-color: #CCCCFF; + color: #EEEEFF; + } + + #contenu { + clear: both; + } + + #contenu .gauche { + font-size: 1.1em; + text-align: justify; + margin-top: 1em; + } + + /** + * Le contenu de gauche + */ + #contenu code { + display: block; + padding: 0.2em; + background-color: #EEEEEE; + border: 1px solid #999999; + margin: 1em 0; + font-size: 1em; + } + + #contenu .gauche > code { + font-size: 1.3em; + } + + #contenu .gauche h4 { + border-bottom: 1px solid #CCCCCC; + font-size: 1em; + color: #999999; + margin-top: 2em; + margin-bottom: 0; + } + + #contenu h3 { + text-align: center; + margin: 0; + font-size: 1.2em; + padding-bottom: 55px; + } + + /** + * Le bas du site + */ + div.bottom { + clear: both; + border-top: 1px solid #CCCCCC; + color: #555555; + margin-top: 1em; + padding-right: 25px; + background: url('../imgs/fleche.jpg') right center no-repeat; + } + + div.bottom p { + text-align: right; + margin: 0; + padding: 0; + } + + .classe { + color: #009900; + } + + .var { + color: #000099; + } + + .err { + color: #990000; + } + + .defaut { + font-weight: bold; + color: #990000; + } + + em { + color: inherit; + } + + .develop { + margin-left: 5em; + display: none; + } + + .doc h4 { + cursor: pointer; + } + + #contenu .gauche .doc h4:hover { + color: #009900; + } + + + div.code { + border: 1px solid #999999; + margin-bottom: 1em; + } + + div.code table { + border-collapse: collapse; + font-family: monospace; + } + + div.code td { + vertical-align: top; + } + + div.code td.num { + background-color: #EEEEEE; + border-right: 1px solid #DDDDDD; + } + + div.code td th { + font-size: 11px; + text-align: right; + font-weight: normal; + background-color: #EEEEEE; + color: #777777; + width: 2em; + } + + div.code td td { + font-size: 13px; + padding: 0 0 0 0.5em; + } + + div.code span.reserved { + color: #0000FF; + } + + div.code span.string { + color: #CC0000; + } + + div.code span.object { + color: #660000; + } + + div.code span.php { + font-weight: bold; + color: #CC33CC; + } + + div.code span.comment, span.comment span.reserved, span.comment span.object, span.comment span.string { + color: #009900; + } + + .doc h1 { + text-align: left; + margin-top: 1em; + } + .doc h2 { + text-align: left; + margin-top: 0.5em; + } + + #contenu .gauche h4.new { + color: #CC5555; + background-image: url('../imgs/new.png'); + background-position: top right; + background-repeat: no-repeat; + } + + .doc table.prop { + margin-left: 5%; + font-size: 0.9em; + border-collapse: collapse; + width: 95%; + } + + .doc table.prop th { + text-align: left; + } + .doc table.prop th.long { + width: 30%; + } + + .doc table.prop tr:hover { + background-color: #EEEEEE; + } + </style> + <script type="text/javascript"> + function shownext(obj) { + var div = obj; + while (div && div.nodeName.toLowerCase() != 'div') { + div = div.nextSibling; + } + if (div.style.display == 'block') { + div.style.display = 'none'; + } else { + div.style.display = 'block'; + } + } + </script> +</head> +<body> + +<div class="body"> + <div id="contenu"> + <div class="gauche" > + + <h3 class="m4">Documentation</h3> + + <h4>Documentation offline</h4> + <ul> + <li><a href="docOffline.html" target="_blank">Voir la documentation offline (HTML)</a></li> + <li><a href="docOffline.zip">Documentation offline (ZIP, décompressé : 270 kb)</a></li> + </ul> + <h4>Format HTML</h4> + <p>TafelTree est un arbre Javascript open source qui permet de faire énormément de choses, ou presque. + Il est basé sur JSON et DOM, notamment. La structure HTML, complètement transparente (l'utilisateur touille + tout via du javascript, bien entendu) est comme ceci :</p> + + <div id="myTree"></div> + <div class="spacer"> </div> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><div id=<span class="string">"tree"</span> class="tafelTree"></p></td></tr><tr><td><p style="padding-left:4ex;"><div class="tafelTree_root"></p></td></tr><tr><td><p style="padding-left:8ex;"><table><tbody><tr></p></td></tr><tr><td><p style="padding-left:12ex;"><td><img class="openable<span class="string">" src="</span>../imgs/minus5.gif"/></td></p></td></tr><tr><td><p style="padding-left:12ex;"><td><img src=<span class="string">"../imgs/globe.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:12ex;"><td class="canevas<span class="string">"><div class="</span>content">Racine</div></td></p></td></tr><tr><td><p style="padding-left:8ex;"></tr></tbody></table></p></td></tr><tr><td><p style="padding-left:8ex;"><div class="tafelTree_branch"></p></td></tr><tr><td><p style="padding-left:12ex;"><table><tbody><tr></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img src=<span class="string">"../imgs/empty.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img class="openable<span class="string">" src="</span>../imgs/line3.gif"/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img src=<span class="string">"../imgs/page.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td class="canevas<span class="string">"><div class="</span>content"></p></td></tr><tr><td><p style="padding-left:20ex;">Enfant 1</div></td></p></td></tr><tr><td><p style="padding-left:12ex;"></tr></tbody></table></p></td></tr><tr><td><p style="padding-left:8ex;"></div></p></td></tr><tr><td><p style="padding-left:8ex;"><div class="tafelTree_branch"></p></td></tr><tr><td><p style="padding-left:12ex;"><table><tbody><tr></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img src=<span class="string">"../imgs/empty.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img class="openable<span class="string">" src="</span>../imgs/minus2.gif"/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td><img src=<span class="string">"../imgs/folderopen.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:16ex;"><td class="canevas<span class="string">"><div class="</span>content"></p></td></tr><tr><td><p style="padding-left:20ex;">Enfant 2</div></td></p></td></tr><tr><td><p style="padding-left:12ex;"></tr></tbody></table></p></td></tr><tr><td><p style="padding-left:12ex;"><div class="tafelTree_branch"></p></td></tr><tr><td><p style="padding-left:16ex;"><table><tbody><tr></p></td></tr><tr><td><p style="padding-left:20ex;"><td><img src=<span class="string">"../imgs/empty.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:20ex;"><td><img src=<span class="string">"../imgs/empty.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:20ex;"><td><img class="openable"</p></td></tr><tr><td><p style="padding-left:24ex;">src=<span class="string">"../imgs/line2.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:20ex;"><td><img src=<span class="string">"../imgs/page.gif"</span>/></td></p></td></tr><tr><td><p style="padding-left:20ex;"><td class="canevas<span class="string">"><div class="</span>content"></p></td></tr><tr><td><p style="padding-left:24ex;">Enfant avec enfant</div></td></p></td></tr><tr><td><p style="padding-left:16ex;"></tr></tbody></table></p></td></tr><tr><td><p style="padding-left:12ex;"></div></p></td></tr><tr><td><p style="padding-left:8ex;"></div></p></td></tr><tr><td><p style="padding-left:4ex;"></div></p></td></tr><tr><td><p style="padding-left:0ex;"></div></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <div class="doc"> + <h1>Propriétés TafelTreeBranch de structure</h1> + <h2>Propriétés TafelTreeBranch basiques</h2> + + <a name="tag"></a> + <h4 onclick="shownext(this)">id <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Obligatoire</p> + + <p>L'id utilisateur de la branche. Doit être unique. Attention, donc, lors de drag'n drop entre deux arbres, de bien vérifier que le tag de l'élément dropé n'existe pas encore.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="txt"></a> + <h4 onclick="shownext(this)">txt <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Obligatoire</p> + <p>Le texte affiché à coté de l'icône</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="acceptdrop"></a> + <h4 onclick="shownext(this)">acceptdrop <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : true</p> + <p><strong>True</strong> pour pouvoir droper des éléments sur la branche, <strong>false</strong> pour rendre cette action impossible.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"acceptdrop"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tacceptdrop=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="canhavechildren"></a> + <h4 onclick="shownext(this)">canhavechildren <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : false</p> + <p>Mettre <strong>true</strong> pour dire que la branche peut avoir des enfants. Est nécessaire lorsqu'on utilise la fonction <strong><a href="#onopenpopulate">onopenpopulate()</a></strong>. Cela permet de faire apparaître le " + " pour ouvrir la branche alors qu'elle n'a pas encore d'enfants.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"canhavechildren"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tcanhavechildren=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="check"></a> + <h4 onclick="shownext(this)">check <em>(integer)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : 0</p> + <p>Mettre <strong>1</strong> pour que la branche soit chechée d'office, s'il y a les checkboxes activées</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"check"</span> : 1</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tcheck=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="draggable"></a> + <h4 onclick="shownext(this)">draggable <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : true</p> + <p><strong>True</strong> pour pouvoir dragger la branche, <strong>false</strong> pour rendre cette action impossible. N'a aucun effet s'il n'y a pas de fonction setOnDrop() ou setOnDropAjax() définie. (ou encore ondrop ou ondropajax)</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"draggable"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tdraggable=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="editable"></a> + <h4 onclick="shownext(this)">editable <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : 1</p> + <p>Indique si la branche peut être éditée ou non. Si la fonciton onEdit() existe, mettre ce paramètre à false permet d'empêcher l'édition malgré tout</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"editable"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Teditable=<span class="string">"0"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="img"></a> + <h4 onclick="shownext(this)">img <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : pas d'image</p> + <p>L'icône affiché lorsque la branche n'a pas d'enfants.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopen"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgclose"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timg=<span class="string">"anImg.gif"</span> Timgopen=<span class="string">"anImg.gif"</span> Timgclose=<span class="string">"anImg.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="imgclose"></a> + <h4 onclick="shownext(this)">imgclose <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : le même que <a href="#img">img</a></p> + <p>L'icône affiché lorsque la branche a des enfants et est fermée.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopen"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgclose"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timg=<span class="string">"anImg.gif"</span> Timgopen=<span class="string">"anImg.gif"</span> Timgclose=<span class="string">"anImg.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="imgopen"></a> + <h4 onclick="shownext(this)">imgopen <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : le même que <a href="#img">img</a></p> + <p>L'icône affiché lorsque la branche a des enfants et est ouverte.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopen"</span> : <span class="string">"anImg.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgclose"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timg=<span class="string">"anImg.gif"</span> Timgopen=<span class="string">"anImg.gif"</span> Timgclose=<span class="string">"anImg.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="img"></a> + <h4 class="new" onclick="shownext(this)">imgselected <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : le même que <a href="#img">img</a></p> + <p>L'icône affiché lorsque la branche n'a pas d'enfants et est sélectionnée.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgselected"</span> : <span class="string">"anImgSelect.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timg=<span class="string">"anImg.gif"</span> Timgselected=<span class="string">"anImgSelect.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="imgclose"></a> + <h4 class="new" onclick="shownext(this)">imgcloseselected <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : le même que <a href="#img">imgclose</a></p> + <p>L'icône affiché lorsque la branche a des enfants et est fermée et sélectionnée.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgcloseselected"</span> : <span class="string">"anImgSelect.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgclose"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timgcloseselected=<span class="string">"anImgSelect.gif"</span> Timgclose=<span class="string">"anImg.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="imgopen"></a> + <h4 class="new" onclick="shownext(this)">imgopenselected <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : le même que <a href="#img">imgopen</a></p> + <p>L'icône affiché lorsque la branche a des enfants et est ouverte et sélectionnée.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopenselected"</span> : <span class="string">"anImgSelect.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"imgopen"</span> : <span class="string">"anImg.gif"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Timgopen=<span class="string">"anImg.gif"</span> Timgopenselected=<span class="string">"anImgSelect.gif"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="items"></a> + <h4 onclick="shownext(this)">items <em>(array)</em></h4> + <div class="develop"> + <p class="classe">Optionnel</p> + <p>Un tableau composé de branches. Représente les enfants de la branche</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"items"</span> : [</p></td></tr><tr><td><p style="padding-left:4ex;">{</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"child1"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"Child 1"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"items"</span> : [</p></td></tr><tr><td><p style="padding-left:8ex;">{</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"id"</span> : <span class="string">"child1_1"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"txt"</span> : <span class="string">"Child of child 1"</span></p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:8ex;">]</p></td></tr><tr><td><p style="padding-left:4ex;">}, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"child2"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"Child 2"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">]</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span>>My super text</p></td></tr><tr><td><p style="padding-left:4ex;"><ul></p></td></tr><tr><td><p style="padding-left:8ex;"><li id=<span class="string">"child1"</span>>Child 1</p></td></tr><tr><td><p style="padding-left:12ex;"><ul></p></td></tr><tr><td><p style="padding-left:16ex;"><li id=<span class="string">"child1_1"</span>>Child of child 1</li></p></td></tr><tr><td><p style="padding-left:12ex;"></ul></p></td></tr><tr><td><p style="padding-left:8ex;"></li></p></td></tr><tr><td><p style="padding-left:8ex;"><li id=<span class="string">"child2"</span>>Child 2</li></p></td></tr><tr><td><p style="padding-left:4ex;"></ul></p></td></tr><tr><td><p style="padding-left:0ex;"></li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="last"></a> + <h4 onclick="shownext(this)">last <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut : false</p> + <p><strong>True</strong> pour toujours avoir la branche en dernière position dans l'arbre. Utilisé après le drop d'une branche, pour éviter que cette dernière ne se retrouve tout en bas.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"Trash"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"img"</span> : <span class="string">"trash.gif"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"last"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tlast=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="open"></a> + <h4 onclick="shownext(this)">open <em>(boolean)</em></h4> + <div class="develop"> + <p class="classe">Optionnel. Par défaut, elle prend la valeur de l'arbre (<a href="#setOpenAll">setOpenAll()</a>). Si la gestion des cookies est activée, celle-ci passe par-dessus tout.</p> + <p><strong>True</strong> pour avoir la branche ouverte, <strong>false</strong> pour l'avoir fermée.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"open"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Topen=<span class="string">"1"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="style"></a> + <h4 onclick="shownext(this)">style <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel</p> + <p>Le nom d'une classe CSS qui s'appliquera uniquement au texte</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"style"</span> : <span class="string">"aCSSclassName"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Tstyle=<span class="string">"aCCSclassName"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="title"></a> + <h4 onclick="shownext(this)">title <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel</p> + <p>Le contenu de l'attribut HTML "title" du texte de la branche (équivalent au tooltip). Le title ne peut contenir que du texte.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"title"</span> : <span class="string">"My title"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Ttitle=<span class="string">"My title"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="style"></a> + <h4 onclick="shownext(this)">tooltip <em>(string)</em></h4> + <div class="develop"> + <p class="classe">Optionnel</p> + <p>Un tooltip qui s'affiche au survol de la branche avec la souris (équivalent au title). Le contenu peut être de l'HTML</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"myId"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"My super text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"tooltip"</span> : <span class="string">"Mon joli tooltip"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// UL - LI</span></p></td></tr><tr><td><p style="padding-left:0ex;"><li id=<span class="string">"myId"</span> Ttooltip=<span class="string">"Mon joli tooltip"</span>>My super text</li></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>On peut y mettre de l'HTML. Attention toutefois avec les quotes ( ' ) et guillemets ( " )</li> + <li>Le tooltip est automatiquement inséré dans un DIV</li> + <li>Le style CSS s'appelle <strong>div.tooltip</strong></li> + </ul> + + </div> + + + <h2>Propriétés TafelTreeBranch de fonctions</h2> + + <a name="onbeforecheck"></a> + <h4 onclick="shownext(this)">onbeforecheck <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>la branche qui va changer son status de check</td></tr> + <tr><th>checked <em>(boolean)</em></th> + <td>Le status de la branche si le changement est validé</td></tr> + </table> + + <p class="var">Optionnel</p> + <p>Méthode appelée lorsqu'on clique sur une checkbox, avant que le changement de status soit fait</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myBeforeCheck (branch, checked) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onbeforecheck"</span> : myBeforeCheck</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onbeforeopen"></a> + <h4 onclick="shownext(this)">onbeforeopen <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>la branche qui va s'ouvrir</td></tr> + <tr><th>opened <em>(boolean)</em></th> + <td>A true, la branche est ouverte et va donc se fermer. A false, c'est l'inverse</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée juste avant d'ouvrir la branche. <strong>Elle doit retourner un boolean</strong>. Prend le pas sur la méthode <strong><a href="#setOnBeforeOpen">setOnBeforeOpen()</a></strong> de TafelTree</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myBeforeOpen (branch, opened) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Tests divers</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, la branche va s'ouvrir</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Ici, la branche ne s'ouvrira pas. La fonciton myOpen ne sera</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// pas appelée</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myOpen (branch, opened) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getTag());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onbeforeopen"</span> : myBeforeOpen,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onopen"</span> : myOpen</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="oncheck"></a> + <h4 onclick="shownext(this)">oncheck <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>la branche qui a changé son status de check</td></tr> + <tr><th>checked <em>(boolean)</em></th> + <td>Le nouveau status de la branche</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée lorsqu'on clique sur une checkbox</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myCheck (branch, checked) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"oncheck"</span> : myCheck</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onclick"></a> + <h4 onclick="shownext(this)">onclick <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>la branche sur laquelle on clique</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée lorsqu'on clique sur le texte de la branche. Prend le pas sur la méthode <strong><a href="#setOnClick">setOnClick()</a></strong> de TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myClick (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch click"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onclick"</span> : myClick</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="ondblclick"></a> + <h4 onclick="shownext(this)">ondblclick <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>la branche sur laquelle on double-clique</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée lorsqu'on double-clique sur le texte de la branche. Prend le pas sur la méthode <strong><a href="#setOnDblClick">setOnDblClick()</a></strong> de TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myDblClick (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch double-click"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"ondblclick"</span> : myDblClick</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="ondrop"></a> + <h4 class="new" onclick="shownext(this)">ondrop <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch_move <em>(TafelTreeBranch)</em></th> + + <td>la branche dragguée</td></tr> + <tr><th>branch_here <em>(TafelTreeBranch)</em></th> + <td>La branche sur qui il y a eu le drop</td></tr> + <tr><th>drop_finished <em>(boolean)</em></th> + <td>False si le drop n'est pas encore effectué, True si le drop est effectué</td></tr> + + <tr><th>new_branch <em>(boolean)</em></th> + <td>La branche insérée, s'il s'agit d'un copyDrag</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée après avoir drag'n dropé la branche. <strong>Elle doit retourner un boolean</strong>. On peut faire un "drop as sibling (frère)" en gardant la touche <strong>ALT</strong> appuyée. Il est également possible de faire un "copydrag" en + maintenant la touche <strong>CONTROL</strong> appuyée. Prend le pas sur la méthode <strong><a href="#setOnDrop">setOnDrop()</a></strong> de TafelTree</p> + + <p>La méthode est appelée deux fois. Une fois avant que le drop soit fait (drop_finished = false) et une fois après que le drop soit fait (drop_finished = true), pour autant qu'il n'y ait pas eu d'erreurs avant.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myDrop (branch_move, branch_here, drop_finished,</p></td></tr><tr><td><p style="padding-left:4ex;">new_branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Attention, cette fonction est appelée 2x. D'abord avant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// que le drop soit fait, puis ensuite après coup. Là, on</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// teste si le drop n'a pas encore été effectué</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (!drop_finished) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Tests divers</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// OK, la branche pourra être droppée ici</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// Ici, la branche ne sera pas droppée et reviendra</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// à sa place initiale</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// On peut récupérer la nouvelle branche insérée</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// s<span class="string">'il s'</span>agit d'un copyDrag</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (new_branch) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(new_branch.getId())</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"ondrop"</span> : myDrop</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Maintenir ALT pour dropper "as sibling"</li> + <li>Maintenir CONTROL pour faire un "copydrag"</li> + </ul> + </div> + + <a name="onedit"></a> + + <h4 onclick="shownext(this)">onedit <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>la branche qui a été éditée</td></tr> + + <tr><th>newValue <em>(string)</em></th> + <td>La nouvelle valeur qui sera enregistrée</td></tr> + <tr><th>oldValue <em>(string)</em></th> + <td>L'ancienne valeur de la branche</td></tr> + </table> + <p class="var">Optionnel</p> + + <p>Méthode appelée lorsqu'on édite une branche (précisément, après le blur() de l'input qui apparaît suite à un double-clic sur la branche)</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myEdit (branch, newValue, oldValue) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (newValue.toLowerCase() == <span class="string">"trop facile"</span>) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="string">"Vraiment trop facile"</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> newValue;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"To be edited..."</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onedit"</span> : myEdit</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Retourne la string qui sera effectivement enregistrée</li> + </ul> + </div> + + <a name="onmouseout"></a> + <h4 onclick="shownext(this)">onmouseout <em>(function)</em></h4> + + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>la branche que la souris quitte</td></tr> + </table> + <p class="var">Optionnel</p> + + <p>Méthode appelée lorsqu'on retire la souris du texte de la branche. Prend le pas sur la méthode <strong><a href="#setOnMouseOut">setOnMouseOut()</a></strong> de TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseOut (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"out : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseOver (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"over : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch mouse over and out"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseover"</span> : myMouseOver,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseout"</span> : myMouseOut</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onmouseover"></a> + <h4 onclick="shownext(this)">onmouseover <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>la branche sur qui la souris passe</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée lorsqu'on passe la souris sur le texte de la branche. Prend le pas sur la méthode <strong><a href="#setOnMouseOver">setOnMouseOver()</a></strong> de TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseOut (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"out : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseOver (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"over : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch mouse over and out"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseover"</span> : myMouseOver,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseout"</span> : myMouseOut</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onmousedown"></a> + <h4 class="new" onclick="shownext(this)">onmousedown <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>la branche sur qui la souris passe</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée lorsqu'on fait un mouse down sur la branche. Prend le pas sur la méthode <strong><a href="#setOnMouseDown">setOnMouseDown()</a></strong> de TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseDown (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"down : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch mouse down"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmousedown"</span> : myMouseDown</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onmouseup"></a> + <h4 class="new" onclick="shownext(this)">onmouseup <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>la branche sur qui la souris passe</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée lorsqu'on fait un mouse up sur la branche. Prend le pas sur la méthode <strong><a href="#setOnMouseUp">setOnMouseUp()</a></strong> de TafelTree</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myMouseUp (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"up : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch mouse up"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onmouseup"</span> : myMouseUp</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="onopen"></a> + <h4 onclick="shownext(this)">onopen <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>la branche qui s'ouvre ou ferme</td></tr> + <tr><th>opened <em>(boolean)</em></th> + <td>A true, la branche est ouverte, à false non</td></tr> + </table> + <p class="var">Optionnel</p> + <p>Méthode appelée après l'ouverture de la branche. Prend le pas sur la méthode <strong><a href="#setOnOpen">setOnOpen()</a></strong> de TafelTree</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myBeforeOpen (branch, opened) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Tests divers</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, la branche va s'ouvrir</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Ici, la branche ne s'ouvrira pas. La fonciton myOpen ne sera</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// pas appelée</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myOpen (branch, opened) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getTag());</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onbeforeopen"</span> : myBeforeOpen,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onopen"</span> : myOpen</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + + <h2>Spécificités</h2> + + <h4 class="new" onclick="shownext(this)">onerrorajax(function)</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + + <tr><th>type <em>(string)</em></th> + <td>Le type d'erreur (open, drop ou edit)</td></tr> + <tr><th>response <em>(string)</em></th> + <td>La réponse texte Ajax</td></tr> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + + <td>La branche courante</td></tr> + <tr><th>droppedOn <em>(TafelTreeBranch)</em></th> + <td>La branche sur laquelle il y a eu un drop (s'il s'agit d'un drop, évidemment)</td></tr> + </table> + <p>Méthode appelée suite à une erreur dans une requête Ajax de drop, open ou edit</p> + <h4>Exemples</h4> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myErrorAjax (type, response, branch, droppedOn) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Vérifie le type d'erreur. Peut être drop, edit ou open</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">switch</span> (type) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"drop"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(<span class="string">"Une erreur est survenue pendant le drop"</span>);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"open"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"edit"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"ondropajax"</span> : myDrop,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"droplink"</span> : <span class="string">"page.php"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onerrorajax"</span> : myErrorAjax</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="openlink"></a> + <h4 onclick="shownext(this)">openlink <em>(string)</em></h4> + <div class="develop"> + <p class="err">Optionnel, mais obligatoire si <strong>onopenpopulate</strong> est une fonction. Uitlisé avec la propriété de branche <strong><a href="#canhavechildren">canhavechildren</a></strong></p> + + <p>Page de script coté serveur appelée après l'ouverture de la branche, s'il s'agit de la fonction <strong>onopenpopulate</strong>. Prend le pas sur la méthode <strong><a href="#setOnOpenPopulate">setOnOpenPopulate()</a></strong> de TafelTree</p> + </div> + + <a name="onopenpopulate"></a> + <h4 onclick="shownext(this)">onopenpopulate <em>(function)</em></h4> + + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>la branche ouverte</td></tr> + <tr><th>response <em>(string)</em></th> + + <td>La string retournée par la requête</td></tr> + </table> + <p class="err">Optionnel</p> + <p>Méthode appelée après l'ouverture de la branche. Lorsque celle-ci est ouverte, elle lance une requête Ajax à la page <strong>openlink</strong> et renvoie le retour Ajax à la méthode utilisateur. <strong>La méthode doit retourner une string JSON représentant des TafelTreeBranch</strong>. Prend le pas sur la méthode <strong><a href="#setOnOpenPopulate">setOnOpenPopulate()</a></strong> de TafelTree</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myOpenPopulate (branch, response) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Pour voir le contenu de la réponse, on peut faire une</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"<span class="reserved">alert</span>"</span> ou le mettre dans le DIV de debug de l'arbre</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.tree.debug(response);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On peut aussi évaluer la réponse en tant qu'objet JSON</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// (à noter qu<span class="string">'il s'</span>agit d'un tableau). La réponse DOIT</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// ETRE une description d'une ou plusieurs TafelTreeBranch</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// [{</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"id"</span> : <span class="string">"id_from_server_1"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"txt"</span> : <span class="string">"This is one is from the server"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"img"</span> : <span class="string">"globe.gif"</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// }]</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Tests divers</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, la branche sera ouverte avec les nouvelles</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// branches qui viennent du serveur</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> response;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Ici, la branche ne sera pas ouverte et aucune</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// branche ne sera ajoutée</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onopenpopulate"</span> : myOpenPopulate,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"openlink"</span> : <span class="string">"somewhere/serverScriptPage.php"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"canhavechildren"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Le réponse DOIT ETRE un tableau JSON ( <strong>[ ]</strong> ) contenant des TafelTreeBranch</li> + <li>Le JSON DOIT ETRE une description de une ou plusieurs TafelTreeBranch</li> + <li>Les variables envoyées à la page <a href="#openlink">openlink</a> passent par la méthode POST</li> + + <li>Ces variables sont : + <ul> + <li>" branch " = description JSON de la branche</li> + <li>" branch_id " = id de la branche qui s'ouvre</li> + <li>" tree_id " = id de l'arbre d'où est tiré la branche qui s'ouvre</li> + </ul> + </li> + <li>Toutes autres variables passée par <a href="#openlink">openlink</a> sont également transmises en POST. Par exemple, si openlink = "page.php?spec=1", on récuperera <em>spec</em> en POST malgré tout.</li> + + </ul> + </div> + + <a name="editlink"></a> + <h4 onclick="shownext(this)">editlink <em>(string)</em></h4> + <div class="develop"> + <p class="err">Optionnel, mais obligatoire si <strong>oneditajax</strong> est une fonction. Peut être utilisé avec la propriété de branche <strong><a href="#editable">editable</a></strong></p> + + <p>Page de script coté serveur appelée après l'édition de la branche, s'il s'agit de la fonction <strong>oneditajax</strong>. Prend le pas sur la méthode <strong><a href="#setOnEditAjax">setOnEditAjax()</a></strong> de TafelTree</p> + </div> + + <a name="oneditajax"></a> + <h4 onclick="shownext(this)">oneditajax <em>(function)</em></h4> + + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch)</em></th> + <td>la branche ouverte</td></tr> + <tr><th>response <em>(string)</em></th> + + <td>La string retournée par la requête</td></tr> + <tr><th>oldValue <em>(string)</em></th> + <td>L'ancienne valeur de la branche</td></tr> + </table> + <p class="err">Optionnel</p> + <p>Méthode appelée après l'édition de la branche. Lorsque celle-ci a terminé d'être éditée, elle lance une requête Ajax à la page <strong>editlink</strong> et renvoie le retour Ajax à la méthode utilisateur. <strong>La méthode doit retourner une string représentant la nouvelle valeur de la branche</strong>. Prend le pas sur la méthode <strong><a href="#setOnEditAjax">setOnEditAjax()</a></strong> de TafelTree</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myEditAjax (branch, response, oldValue) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Pour voir le contenu de la réponse, on peut faire une</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"<span class="reserved">alert</span>"</span> ou le mettre dans le DIV de debug de l'arbre</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.tree.debug(response);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On peut aussi évaluer la réponse en tant qu'objet JSON</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// (à noter qu'elle est entre parenthèses). La réponse</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// doit contenir, d<span class="string">'une manière ou d'</span>une autre, la</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// nouvelle valeur de la branche</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// ({</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"message"</span> : <span class="string">"Tout est ok sur le serveur"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"newValue"</span> : <span class="string">"Nouvelle valeur de la branche"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"anyOtherParams"</span> : <span class="reserved">true</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// })</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On peut aussi retourner seulement la nouvelle valeur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// (dans ce cas, plus besoin de parenthèses)</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="reserved">alert</span> (response); // show the <span class="reserved">new</span> text</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Tests divers</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, la branche sera éditée et aura la</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// nouvelle valeur retournée par cette fonction</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> theNewValue;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Ici, la branche ne sera pas éditée et conservera</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// son ancienne valeur (oldValue)</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"oneditajax"</span> : myEditAjax,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"editlink"</span> : <span class="string">"somewhere/serverScriptPage.php"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>La réponse devrait contenir la nouvelle valeur à insérer dans la branche</li> + <li>Les variables envoyées à la page <a href="#editlink">editlink</a> passent par la méthode POST</li> + <li>Ces variables sont : + <ul> + + <li>" branch " = description JSON de la branche</li> + <li>" branch_id " = id de la branche qui s'ouvreé</li> + <li>" tree_id " = id de l'arbre d'où est tiré la branche qui s'ouvre</li> + <li>" new_value " = la nouvelle valeur de la branche</li> + <li>" old_value " = l'ancienne valeur de la branche</li> + </ul> + + </li> + <li>Toutes autres variables passée par <a href="#editlink">editlink</a> sont également transmises en POST. Par exemple, si editlink = "page.php?spec=1", on récuperera <em>spec</em> en POST malgré tout.</li> + </ul> + </div> + + <a name="droplink"></a> + + <h4 onclick="shownext(this)">droplink <em>(string)</em></h4> + <div class="develop"> + <p class="err">Optionnel, mais obligatoire si <strong>ondropajax</strong> est une fonction</p> + <p>Page de script coté serveur appelée après le drop de la branche, s'il s'agit de la fonction <strong>ondropajax</strong>. Prend le pas sur la méthode <strong><a href="#setOnDropAjax">setOnDropAjax()</a></strong> de TafelTree</p> + + </div> + + <a name="ondropajax"></a> + <h4 class="new" onclick="shownext(this)">ondropajax <em>(function)</em></h4> + <div class="develop"> + <h4>Propriétés</h4> + <table class="prop"> + <tr><th>branch_move <em>(TafelTreeBranch)</em></th> + + <td>la branche dragguée</td></tr> + <tr><th>branch_here <em>(TafelTreeBranch)</em></th> + <td>La branche sur qui il y a eu le drop</td></tr> + <tr><th>response <em>(string)</em></th> + <td>La string retournée par la requête</td></tr> + + <tr><th>drop_finished <em>(boolean)</em></th> + <td>False si le drop n'est pas encore effectué, True si le drop est effectué</td></tr> + <tr><th>new_branch <em>(boolean)</em></th> + <td>La branche insérée, s'il s'agit d'un copyDrag</td></tr> + </table> + <p class="err">Optionnel</p> + + <p>Méthode appelée après le drag'n drop de la branche. Lorsque celle-ci est dropée, elle lance une requête Ajax à la page <strong>droplink</strong> et renvoie le retour Ajax à la méthode utilisateur. <strong>La méthode doit retourner un boolean</strong>. On peut faire un "drop as sibling (frère)" en gardant la touche <strong>ALT</strong> appuyée. Il est également possible de faire un "copydrag" en maintenant la touche <strong>CONTROL</strong> appuyée. Prend le pas sur la méthode <strong><a href="#setOnDropAjax">setOnDropAjax()</a></strong> de TafelTree</p> + + <p>La méthode est appelée deux fois. Une fois avant que le drop soit fait (drop_finished = false) et une fois après que le drop soit fait (drop_finished = true), pour autant qu'il n'y ait pas eu d'erreurs avant.</p> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr><tr><th>40</th></tr><tr><th>41</th></tr><tr><th>42</th></tr><tr><th>43</th></tr><tr><th>44</th></tr><tr><th>45</th></tr><tr><th>46</th></tr><tr><th>47</th></tr><tr><th>48</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myDropAjax (branch_move, branch_here, response,</p></td></tr><tr><td><p style="padding-left:4ex;">drop_finished, new_branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On vérifie que le drop n'est pas encore effectué</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (!drop_finished) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Pour voir le contenu de la réponse, on peut soit</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// faire une <span class="string">"<span class="reserved">alert</span>"</span>, soit la mettre dans le DIV de</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// debug</span></p></td></tr><tr><td><p style="padding-left:8ex;">branch_move.tree.debug(response);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Evalue une réponse JSON (à noter que le JSON est</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// entre parenthèses). Imaginons que la réponse égale</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// ceci :</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// ({</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// <span class="string">"param1"</span> : <span class="reserved">true</span>,</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// <span class="string">"param2"</span> : <span class="string">"salut biscuit"</span></span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// })</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// On pourra dès lors faire ceci :</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> obj = eval(response);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (obj.param1) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(obj.param2);</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Tests divers</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// OK, la branche sera droppée ici</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// Ici, la branche ne sera pas droppée et</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// retournera à sa place initiale</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// On peut récupérer la nouvelle branche insérée</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// s<span class="string">'il s'</span>agit d'un copyDrag</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (new_branch) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(new_branch.getId())</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"ondropajax"</span> : myDropAjax,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"droplink"</span> : <span class="string">"somewhere/serverScriptPage.php"</span></p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Maintenir ALT pour dropper "as sibling"</li> + <li>Maintenir CONTROL pour faire un "copydrag"</li> + <li>Les variables envoyées à la page <a href="#droplink">droplink</a> passent par la méthode POST</li> + + <li>Ces variables sont : + <ul> + <li>" drag " = description JSON de la branche qui a bougé</li> + <li>" drop " = description JSON de la branche sur laquelle on a déposé le drag</li> + <li>" drag_id " = id de la branche qui a bougé</li> + <li>" drop_id " = id de la branche sur laquelle on a déposé le drag_id</li> + <li>" treedrag_id " = id de l'arbre d'où est tiré la branche qui a bougé</li> + + <li>" treedrop_id " = id de l'arbre qui accueille la branche qui a bougé</li> + <li>" sibling " = 0 si on le drop comme fils, 1 s'il est comme frère</li> + </ul> + </li> + <li>Toutes autres variables passée par <a href="#droplink">droplink</a> sont également transmises en POST. Par exemple, si droplink = "page.php?spec=1", on récuperera <em>spec</em> en POST malgré tout.</li> + + </ul> + </div> + + <a name="other"></a> + <h4 onclick="shownext(this)">...mon propre paramètre <em>(integer, float, string, object, function, boolean, array)</em></h4> + <div class="develop"> + <p>Il est possible d'ajouter autant de paramètres souhaités, suivant les besoins. Lors de l'appel d'une fonction, ils sont récupérables en passant par la propriété <strong>struct</strong>.</p> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myClick (branch) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (branch.struct.theWhetherIsBeautiful) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> str = branch.struct.wow;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.struct.aStrangeObject.param1 + <span class="string">"|"</span>+ str);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i=0; i < branch.struct.frenchNames.length; i++){</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.struct.frenchNames[i]);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="reserved">var</span> branch = {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"tag1"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"A branch"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"wow"</span> : <span class="string">"some text"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"theWhetherIsBeautiful"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"aStrangeObject"</span> : {<span class="string">"param1"</span> : <span class="string">"object in object"</span>},</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"frenchNames"</span> : [</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"Albert"</span>, <span class="string">"Gilbertin"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"Zéphirin"</span>, <span class="string">"Anatole"</span>, <span class="string">"Gontan"</span></p></td></tr><tr><td><p style="padding-left:4ex;">],</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"onclick"</span> : myClick</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Les paramètres persos SONT DISPONIBLES dans la sérialisation</li> + <li>Ils APPARAISSENT lors d'un toString()</li> + <li>Ils NE SONT PAS INTERPRETES lors d'une création UL - LI</li> + </ul> + </div> + + + <h1>Méthodes de TafelTreeBranch</h1> + <h2>Méthodes publiques TafelTreeBranch</h2> + + <h4 onclick="shownext(this)">hasChildren()</h4> + <div class="develop"> + <p>Retourne true si la branche a des enfants, false sinon</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.hasChildren());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">isOpened()</h4> + <div class="develop"> + <p>Retourne true si la branche est ouverte, false sinon</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.isOpened());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">isVisible()</h4> + <div class="develop"> + <p>Retourne true si la branche est visible, false sinon</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.isVisible());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getId()</h4> + <div class="develop"> + <p>Retourne l'identifiant (id) de la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">changeId()</h4> + <div class="develop"> + <p>Change l'identifiant (id) de la branche. Retourne true si tout est ok, false si l'id de la branche existe déjà dans l'arbre</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (branch.changeId(<span class="string">"newId"</span>)) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"Changement ok"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"Cet id ("</span> + newId + <span class="string">") existe déjà"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getText()</h4> + <div class="develop"> + <p>Retourne le contenu de la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getText());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getParent()</h4> + <div class="develop"> + <p>Retourne la branche parente, si elle existe</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> parent = branch.getParent();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (parent) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(parent.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getParents()</h4> + <div class="develop"> + <p>Retourne toutes les branches parentes. Le premier élément du tableau est le parent direct. Le dernier élément du tableau représente la racine</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> parents = branch.getParents();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < parents.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (i < parents.length - 1) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(<span class="string">"Parent : "</span> + parents[i].getId());</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(<span class="string">"Racine : "</span> + parents[i].getId());</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getAncestor()</h4> + <div class="develop"> + <p>Retourne la racine de la branche. Si on cherche l'ancêtre d'une racine, ça retournera "null"</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> root = branch.getAncestor();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (root) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(root.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getFirstBranch()</h4> + <div class="develop"> + <p>Retourne le premier enfant de la branche, null s'il n'y en a pas</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> child = branch.getFirstBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (child) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(child.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getLastBranch()</h4> + <div class="develop"> + <p>Retourne le dernier enfant de la branche, null s'il n'y en a pas</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> child = branch.getLastBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (child) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(child.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPreviousSibling()</h4> + <div class="develop"> + <p>Retourne la branche soeur précédente, null s'il n'y en a pas</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> sibling = branch.getPreviousSibling();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (sibling) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(sibling.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getNextSibling()</h4> + <div class="develop"> + <p>Retourne la branche soeur suivante, null s'il n'y en a pas</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> sibling = branch.getNextSibling();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (sibling) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(sibling.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPreviousBranch()</h4> + <div class="develop"> + <p>Retourne la branche précédente (pas forcément de même niveau), null s'il n'y en a pas</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> previous = branch.getPreviousBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (previous) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(previous.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getNextBranch()</h4> + <div class="develop"> + <p>Retourne la branche suivante (pas forcément de même niveau), null s'il n'y en a pas</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> next = branch.getNextBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (next) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(next.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPreviousOpenedBranch()</h4> + <div class="develop"> + <p>Retourne la branche ouverte précédente (pas forcément de même niveau), null s'il n'y en a pas</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> opened = branch.getPreviousOpenedBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (opened) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(opened.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getNextOpenedBranch()</h4> + <div class="develop"> + <p>Retourne la branche ouverte suivante (pas forcément de même niveau), null s'il n'y en a pas</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> opened = branch.getNextOpenedBranch();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (opened) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(opened.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setText()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>txt <em>(string)</em></th> + + <td>Le nouveau texte de la branche</td></tr> + </table> + <p>Set le contenu de la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.setText(<span class="string">"Salut biscuit"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getChildren()</h4> + <div class="develop"> + <p>Retourne les enfants de la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> children = branch.getChildren();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < children.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(children[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getLevel()</h4> + <div class="develop"> + <p>Retourne le niveau de la branche. La racine est au niveau 0</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getLevel());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getIcon()</h4> + <div class="develop"> + <p>Retourne l'icône de la branche lorsque celle-ci n'a pas d'enfants</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getIcon());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getOpenIcon()</h4> + <div class="develop"> + <p>Retourne l'icône de la branche lorsque celle-ci a des enfants et est ouverte</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getOpenIcon());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getCloseIcon()</h4> + <div class="develop"> + <p>Retourne l'icône de la branche lorsque celle-ci a des enfants et est fermée</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getCloseIcon());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getIconSelected()</h4> + <div class="develop"> + <p>Retourne l'icône de la branche lorsque celle-ci n'a pas d'enfants et est sélectionnée</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getIconSelected());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getOpenIconSelected()</h4> + <div class="develop"> + <p>Retourne l'icône de la branche lorsque celle-ci a des enfants et est ouverte et sélectionnée</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getOpenIconSelected());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getCloseIconSelected()</h4> + <div class="develop"> + <p>Retourne l'icône de la branche lorsque celle-ci a des enfants et est fermée et sélectionnée</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getCloseIconSelected());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getCurrentIcon()</h4> + <div class="develop"> + <p>Retourne l'icône actuel de la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getCurrentIcon());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setIcons()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>icon <em>(string)</em></th> + + <td>L'icône si la branche n'a pas d'enfants</td></tr> + <tr class="classe"><th>iconOpen <em>(string)</em></th> + <td>L'icône si la branche a des enfants et est ouverte</td></tr> + <tr class="classe"><th>iconClose <em>(string)</em></th> + <td>L'icône si la branche a des enfants et est fermée</td></tr> + + </table> + <p>Set les icônes de la branche. Si <strong>iconOpen</strong> ou <strong>iconClose</strong> ne sont pas renseignés, ils prennent la valeur de <strong>icon</strong></p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// La branche aura page.g<span class="reserved">if</span> pour tous les états</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.setIcons(<span class="string">"page.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Ici, on distingue les différents états par différents</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// icônes</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.setIcons(<span class="string">"page.gif"</span>, <span class="string">"folderopen.gif"</span>, <span class="string">"folder.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setIconsSelected()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>iconSelected <em>(string)</em></th> + + <td>L'icône si la branche n'a pas d'enfants et est sélectionée</td></tr> + <tr class="classe"><th>iconOpenSelected <em>(string)</em></th> + <td>L'icône si la branche a des enfants et est ouverte et sélectionée</td></tr> + <tr class="classe"><th>iconCloseSelected <em>(string)</em></th> + <td>L'icône si la branche a des enfants et est fermée et sélectionée</td></tr> + + </table> + <p>Set les icônes de la branche. Si <strong>iconOpenSelected</strong> ou <strong>iconCloseSelected</strong> ne sont pas renseignés, ils prennent respectivement les valeurs de <strong>iconOpen</strong> et <strong>iconClose</strong> (voir la fonction <em>setIcons()</em>)</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// La branche aura page.g<span class="reserved">if</span> comme état sélectionné si elle</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// n<span class="string">'a pas d'</span>enfants</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.setIconsSelected(<span class="string">"page.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Ici, on distingue les différents états par différents</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// icônes</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.setIconSelected(<span class="string">"page.gif"</span>, <span class="string">"folderopen.gif"</span>, <span class="string">"folder.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">isChild()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch, string)</em></th> + + <td>La branche peut-être parente, ou juste son ID</td></tr> + </table> + <p>Méthode qui détermine si la branche est un enfant de celle passée en paramètre. Retourne true si la branche est effectivement une descendante.</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.isChild(<span class="string">"otherBranch"</span>));</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">openIt()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>open <em>(boolean)</em></th> + + <td>True pour ouvrir la branche, false pour la fermer</td></tr> + </table> + <p>Méthode qui permet d'ouvrir ou fermer la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.openIt(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertIntoFirst()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>item <em>(object)</em></th> + + <td>Un objet au format JSON correspondant à une TafelTreeBranch</td></tr> + </table> + <p>Méthode qui permet d'insérer une branche comme fille, en première de liste</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"branch1"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"child first"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertIntoFirst(item);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertIntoLast()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>item <em>(object)</em></th> + + <td>Un objet au format JSON correspondant à une TafelTreeBranch</td></tr> + </table> + <p>Méthode qui permet d'insérer une branche comme fille, en dernière de liste</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"branch2"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"child last"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertIntoLast(item);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertBefore()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>item <em>(object)</em></th> + + <td>Un objet au format JSON correspondant à une TafelTreeBranch</td></tr> + </table> + <p>Méthode qui permet d'insérer une branche comme soeur, juste avant elle</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"branch3"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"sibling first"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertBefore(item);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertAfter()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>item <em>(object)</em></th> + + <td>Un objet au format JSON correspondant à une TafelTreeBranch</td></tr> + </table> + <p>Méthode qui permet d'insérer une branche comme soeur, juste après elle</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"branch4"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"sibling last"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertAfter(item);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">clone()</h4> + <div class="develop"> + <p>Permet de cloner la strucutre de la branche. Ne créé pas une nouvelle branche. Elle ne fait que de retourner + la structure initiale.</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> clonedStructure = branch.clone();</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;">clonedStructure.id = <span class="string">"newid"</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">clonedStructure.txt = <span class="string">"Ma nouvelle branche clonée"</span>;</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> newBranch = branch.insertAfter(clonedStructure);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(newBranch.getId());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Ne créé pas la nouvelle branche dans l'arbre. Ne retourne que la structure</li> + <li>La structure est toujours au format JSON</li> + </ul> + </div> + + <h4 onclick="shownext(this)">move()</h4> + + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>here <em>(TafelTreeBranch, string)</em></th> + <td>La nouvelle branche parente, ou juste son ID</td></tr> + </table> + <p>Méthode qui permet de changer une branche de place, en la plaçant comme fille</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.move(<span class="string">"idNewParent"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">moveBefore()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>here <em>(TafelTreeBranch, string)</em></th> + + <td>La branche soeur, ou juste son ID</td></tr> + </table> + <p>Méthode qui permet de changer une branche de place, en la plaçant comme soeur</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.moveBefore(<span class="string">"idNewSibling"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">closeSiblings()</h4> + <div class="develop"> + <p>Ferme toutes les branches soeurs</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.closeSiblings();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">addClass()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>class <em>(string)</em></th> + + <td>La classe CSS à ajouter</td></tr> + </table> + <p>Méthode qui ajoute une classe CSS à la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.addClass(<span class="string">"myCSSclass"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">removeClass()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>class <em>(string)</em></th> + + <td>La classe CSS à retirer</td></tr> + </table> + <p>Méthode qui retire une classe CSS à la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.removeClass(<span class="string">"myCSSclass"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">removeChildren()</h4> + <div class="develop"> + <p>Méthode qui supprime tous les enfants de la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.removeChildren();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">hasAllChildrenChecked()</h4> + <div class="develop"> + <p>Retourne 1 si tous les enfants de la branche sont checkés, 0 si aucuns ne le sont et -1 si certains le sont</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.hasAllChildrenChecked());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">isChecked()</h4> + <div class="develop"> + <p>Retourne 1 si la branche est checkée, 0 si elle ne l'est pas et -1 si elle est partiellement checkée</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.isChecked());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">check()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>check <em>(integer)</em></th> + + <td>Le status à donner à la branche</td></tr> + </table> + <p>Passer 1 pour la checker, 0 pour la unchecker</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.check(1);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">select()</h4> + <div class="develop"> + <p>Sélectionne la branche et place le focus dessus</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.select();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">unselect()</h4> + <div class="develop"> + <p>Désélectionne la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getSelectedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (branches.length > 0) {</p></td></tr><tr><td><p style="padding-left:8ex;">branches[0].unselect();</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getWithinOffset()</h4> + <div class="develop"> + <p>Récupère les coordonnées de la branche au sein de l'arbre</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> pos = branch.getWithinOffset();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"Left : "</span> + pos[0] + <span class="string">", Top : "</span> + pos[1]);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getAbsoluteOffset()</h4> + <div class="develop"> + <p>Récupère les coordonnées de la branche dans l'écran</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> pos = branch.getAbsoluteOffset();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(<span class="string">"Left : "</span> + pos[0] + <span class="string">", Top : "</span> + pos[1]);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + + <h2>Méthodes de TafelTreeBranch découlant de TafelTree</h2> + + <h4 onclick="shownext(this)">serialize()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + + <tr><th>debug <em>(boolean)</em></th> + <td>Mettre true pour avoir un joli affichage du contenu de la branche. UNIQUEMENT POUR LE DEBUG. False par défaut</td></tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On met <span class="reserved">true</span> pour visualiser et contrôler la string</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.serialize(<span class="reserved">true</span>));</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On met rien pour traiter la string</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">new</span> Ajax.Request(<span class="string">"mapage.php"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"parameters"</span>: <span class="string">"tree="</span> + branch.serialize()</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">countBranches()</h4> + <div class="develop"> + <p>Compte le nombre de branches contenues dans la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.countBranches());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getOpenedBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches ouvertes sous la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getOpenedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getCheckedBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches checkées sous la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getUnCheckedBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches non checkées sous la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getUnCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPartCheckedBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches partiellement checkées sous la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getPartCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getParentBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches qui ont des enfants</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getParentBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getLeafBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches qui n'ont pas d'enfants</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getLeafBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getBranches()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>filter <em>(function)</em></th> + + <td>La fonction utilisateur</td></tr> + </table> + <p>Retourne un tableau contenant toutes les branches sous celle-ci. On peut y mettre un filtre.</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On peut filtrer les branches avec une fonction</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myFilter (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (branch.getText() == <span class="string">"Celle-ci"</span>) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = branch.getBranches(myFilter);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">expend()</h4> + <div class="develop"> + <p>Ouvre toutes les branches sous la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.expend();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">collapse()</h4> + <div class="develop"> + <p>Ferme toutes les branches sous la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">branch.collapse();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + + <h1>Méthodes TafelTree</h1> + <h2>Méthodes TafelTree statiques</h2> + <h4 onclick="shownext(this)">loadFromUL()</h4> + <div class="develop"> + <h4>Paramètres</h4> + + <table class="prop"> + <tr> + <th>id <em>(string)</em></th> + <td>L'id de l'UL qui contient les informations</td> + </tr> + <tr class="classe"> + <th>imgBase (optionnel) <em>(string)</em></th> + + <td>Le chemin vers le dossier des images de l'arbre, " imgs/ " par défaut</td> + </tr> + <tr class="classe"> + <th>width (optionnel) <em>(string ou integer)</em></th> + <td>La largeur max de l'arbre, " 100% " par défaut</td> + </tr> + <tr class="classe"> + + <th>height (optionnel) <em>(string ou integer)</em></th> + <td>La hauteur max de l'arbre, " auto " par défaut</td> + </tr> + <tr class="classe"> + <th>options (optionnel) <em>(object)</em></th> + <td>Tout ce qui doit s'exécuter avant le generate(), génération comprise</td> + + </tr> + <tr class="classe"> + <th>debug (optionnel) <em>(boolean)</em></th> + <td>A True, Affiche la structure JSON mais ne créé pas l'arbre, false par défaut</td> + </tr> + </table> + <p>La génération par UL ne permet pas de gérer ses propres attributs. Pour ce qui est des fonctions de l'arbre, on doit les gérer via le paramètre <strong>options</strong>. + Pour plus de détails sur ce paramètre, voir <a href="#new">new TafelTree()</a></p> + + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><ul id=<span class="string">"idTree"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><li id=<span class="string">"b1"</span> Timg=<span class="string">"base.gif"</span>>Mon texte</li></p></td></tr><tr><td><p style="padding-left:4ex;"><li id=<span class="string">"b2"</span> Timg=<span class="string">"base.gif"</span>>Texte autre</p></td></tr><tr><td><p style="padding-left:8ex;"><ul></p></td></tr><tr><td><p style="padding-left:12ex;"><li id=<span class="string">"b3"</span> Timg=<span class="string">"page.gif"</span> >Enfant</li></p></td></tr><tr><td><p style="padding-left:12ex;"><li id=<span class="string">"b4"</span> Timg=<span class="string">"page.gif"</span> Timgclose=<span class="string">"folder.gif"</span></p></td></tr><tr><td><p style="padding-left:16ex;">Timgopen=<span class="string">"folderopen.gif"</span>>Autre Enfant</p></td></tr><tr><td><p style="padding-left:16ex;"><ul></p></td></tr><tr><td><p style="padding-left:20ex;"><li id=<span class="string">"b5"</span> Timg=<span class="string">"page.gif"</span>>Enfant</li></p></td></tr><tr><td><p style="padding-left:20ex;"><li id=<span class="string">"b6"</span> Timg=<span class="string">"page.gif"</span> Teditable=<span class="string">"1"</span>></p></td></tr><tr><td><p style="padding-left:24ex;">Autre Enfant</li></p></td></tr><tr><td><p style="padding-left:16ex;"></ul></p></td></tr><tr><td><p style="padding-left:12ex;"></li></p></td></tr><tr><td><p style="padding-left:8ex;"></ul></p></td></tr><tr><td><p style="padding-left:4ex;"></li></p></td></tr><tr><td><p style="padding-left:4ex;"><li id=<span class="string">"b7"</span> Timg=<span class="string">"base.gif"</span>>Fin</li></p></td></tr><tr><td><p style="padding-left:0ex;"></ul></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myFuncClick(branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = TafelTree.loadFromUL(<span class="string">"idTree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"250px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onclick"</span> : myFuncClick,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAtLoad"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Les fonctions à faire avant la génération (génération comprise) sont chargées via le paramètre OPTIONS</li> + <li>Tous les attributs des branches sont précédés d'un " T " sauf l'id</li> + <li>Les attributs de branches sont les mêmes que pour le JSON</li> + <li>L'attribut n'est <em>JAMAIS</em> entre guillemets et son contenu est <em>ÉCHAPPÉ (simple quotes)</em> et <em>TOUJOURS</em> entre guillemets</li> + + <li>Le contenu d'un attribut <em>NE DOIT PAS</em> contenir de double quotes (guillemets)</li> + <li>Il n'est pas possible d'assigner des attributs persos, malheureusement</li> + </ul> + </div> + + <h2>Getter et setter TafelTree</h2> + + <a name="new"></a> + <h4 onclick="shownext(this)">new TafelTree()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>id <em>(string)</em></th> + + <td>L'id du DIV qui contiendra l'ensemble de l'arbre</td> + </tr> + <tr> + <th>struct <em>(array)</em></th> + <td>La structure de l'arbre formatté JSON</td> + </tr> + <tr class="classe"> + + <th>imgBase (optionnel) <em>(string)</em></th> + <td>Le chemin vers le dossier des images de l'arbre, " imgs/ " par défaut</td> + </tr> + <tr class="classe"> + <th>width (optionnel) <em>(string ou integer)</em></th> + <td>La largeur max de l'arbre, " 100% " par défaut</td> + + </tr> + <tr class="classe"> + <th>height (optionnel) <em>(string ou integer)</em></th> + <td>La hauteur max de l'arbre, " auto " par défaut</td> + </tr> + <tr class="classe"> + <th>options (optionnel) <em>(object)</em></th> + + <td>Tout ce qui doit s'exécuter avant le generate(), génération comprise</td> + </tr> + </table> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr><tr><th>40</th></tr><tr><th>41</th></tr><tr><th>42</th></tr><tr><th>43</th></tr><tr><th>44</th></tr><tr><th>45</th></tr><tr><th>46</th></tr><tr><th>47</th></tr><tr><th>48</th></tr><tr><th>49</th></tr><tr><th>50</th></tr><tr><th>51</th></tr><tr><th>52</th></tr><tr><th>53</th></tr><tr><th>54</th></tr><tr><th>55</th></tr><tr><th>56</th></tr><tr><th>57</th></tr><tr><th>58</th></tr><tr><th>59</th></tr><tr><th>60</th></tr><tr><th>61</th></tr><tr><th>62</th></tr><tr><th>63</th></tr><tr><th>64</th></tr><tr><th>65</th></tr><tr><th>66</th></tr><tr><th>67</th></tr><tr><th>68</th></tr><tr><th>69</th></tr><tr><th>70</th></tr><tr><th>71</th></tr><tr><th>72</th></tr><tr><th>73</th></tr><tr><th>74</th></tr><tr><th>75</th></tr><tr><th>76</th></tr><tr><th>77</th></tr><tr><th>78</th></tr><tr><th>79</th></tr><tr><th>80</th></tr><tr><th>81</th></tr><tr><th>82</th></tr><tr><th>83</th></tr><tr><th>84</th></tr><tr><th>85</th></tr><tr><th>86</th></tr><tr><th>87</th></tr><tr><th>88</th></tr><tr><th>89</th></tr><tr><th>90</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><div id=<span class="string">"idTree"</span>></div></p></td></tr><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> myStruct = [</p></td></tr><tr><td><p style="padding-left:4ex;">{</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span> : <span class="string">"root"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span> : <span class="string">"Root node"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span> : <span class="string">"base.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"style"</span> : <span class="string">"cssBoldStyle"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"items"</span> : [</p></td></tr><tr><td><p style="padding-left:8ex;">{</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"id"</span> : <span class="string">"node1"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"txt"</span> : <span class="string">"Node 1"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"img"</span> : <span class="string">"folderopen.gif"</span></p></td></tr><tr><td><p style="padding-left:8ex;">},</p></td></tr><tr><td><p style="padding-left:8ex;">{</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"id"</span> : <span class="string">"music"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"txt"</span> : <span class="string">"My music"</span>,</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"img"</span> : <span class="string">"musicfolder.gif"</span></p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:8ex;">]</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">];</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"150px"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Example using options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> treeToBind = <span class="reserved">new</span> TafelTree(<span class="string">"idTreeToBind"</span>, structBind, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"150px"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> treeToBind2 = <span class="reserved">new</span> TafelTree(<span class="string">"idTreeToBind2"</span>, structBind2, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"150px"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"imgBase"</span> : <span class="string">"imgs/"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"width"</span> : <span class="string">"300px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"height"</span> : <span class="string">"250px"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImg"</span> : <span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgOpen"</span> : <span class="string">"folderopen.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgClose"</span> : <span class="string">"folder.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgSelected"</span> : <span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgOpenSelected"</span> : <span class="string">"folderopen.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgCloseSelected"</span> : <span class="string">"folder.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onLoad"</span> : myFuncLoad,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDebug"</span> : myFuncDebug,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onCheck"</span> : myFuncCheck,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onBeforeCheck"</span> : myFuncBeforeCheck,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onclick"</span> : myFuncClick,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDblClick"</span> : myFuncDblClick,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onBeforeOpen"</span> : myFuncBeforeOpen,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onOpen"</span> : myFunconOpen,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseOver"</span> : myFuncMouseOver,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseOut"</span> : myFuncMouseOut,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseDown"</span> : myFuncMouseDown,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseUp"</span> : myFuncMouseUp,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDrop"</span> : myFuncDrop,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onEdit"</span> : myFuncEdit,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onEditAjax"</span> : [myFuncEditAjax, <span class="string">"server/edit.php"</span>],</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDropAjax"</span> : [myFuncDropAjax, <span class="string">"server/drop.php"</span>]</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onOpenPopulate"</span> : [myFuncOpenPopulate, <span class="string">"server/open.php"</span>],</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"multiline"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"checkboxes"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"checkboxesThreeState"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"cookies"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openOneAtOnce"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAtLoad"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAfterAdd"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"showSelectedBranch"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"lineStyle"</span> : <span class="string">"line"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"rtlMode"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"dropALT"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"dropCTRL"</span> : <span class="reserved">false</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"propagateRestriction"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"reopenFromServer"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"behaviourDrop"</span> : <span class="string">"child"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"bind"</span> : [treeToBind],</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"bindAsUnidirectional"</span> : [treeToBind2]</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">enableMultiline()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + + <td>True pour activer la gestion multi-ligne (par défaut, false)</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableMultiline(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"multiline"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">reopenFromServerAfterLoad()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + + <td>False pour ne pas ouvrir les noeuds qui ont leurs enfants sur le serveur après un reload, true par défaut</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.reopenFromServerAfterLoad(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"reopenFromServer"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">enableCheckboxes()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + + <td>True pour activer la gestion des checkboxes à 2 états (par défaut, false)</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableCheckboxes(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"checkboxes"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Les checkboxes à deux états peuvent être soit " checked ", soit " unchecked "</li> + <li>Pour gérer 3 états, voir la fonction enableCheckboxesThreeState()</li> + </ul> + </div> + + <h4 onclick="shownext(this)">enableCheckboxesThreeState()</h4> + + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + <td>True pour activer la gestion des checkboxes à 3 états (par défaut, false)</td> + </tr> + + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableCheckboxesThreeState(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"checkboxesThreeState"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Il n'y a pas besoin d'appeler la méthode enableCheckboxes().</li> + </ul> + </div> + + <h4 onclick="shownext(this)">enableCookies()</h4> + <div class="develop"> + + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + <td>True pour activer les cookies (par défaut, true)</td> + </tr> + <tr class="classe"> + + <th>separator (optionnel) <em>(string)</em></th> + <td>Le séparateur utilisé dans les cookies (par défaut, " | ")</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableCookies(<span class="reserved">true</span>, <span class="string">"#___#"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options. On ne peut pas choisir le séparateur, depuis lé</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"cookies"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Les cookies permettent de se souvenir de quelles branches sont ouvertes</li> + <li>Changer le séparateur peut servir si une barre verticale fait partie de l'id des branches</li> + </ul> + </div> + + <h4 onclick="shownext(this)">openOneAtOnce()</h4> + + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>enable <em>(boolean)</em></th> + <td>True pour ne pouvoir ouvrir qu'une seule branche à la fois (par défaut, false)</td> + </tr> + + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.openOneAtOnce(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openOneAtOnce"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">openAtLoad()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>open <em>(boolean)</em></th> + + <td>True pour avoir l'arbre ouvert après le premier load (par défaut, false)</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.openAtLoad(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAtLoad"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Lorsque les cookies sont activés, ceux-ci prennent le pas sur cette fonction</li> + </ul> + </div> + + <h4 onclick="shownext(this)">openAfterAdd()</h4> + <div class="develop"> + + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>open <em>(boolean)</em></th> + <td>True pour avoir la branche qui s'ouvre après un insert ou un drop, false pour la garder fermée</td> + </tr> + </table> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.openAfterAdd(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"openAfterAdd"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">showSelectedBranch()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>show <em>(boolean)</em></th> + + <td>True pour avoir la branche sélectionnée en surbrillance (par défaut, true)</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.showSelectedBranch(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"showSelectedBranch"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setLineStyle()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>style <em>(string)</em></th> + + <td>Le style choisi pour l'affichage de l'arbre (par défaut, " line ")</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setLineStyle(<span class="string">"none"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"lineStyle"</span> : <span class="string">"none"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Les valeurs possibles sont " line ", " full " ou " none ".</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setIcons()</h4> + <div class="develop"> + + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>icon <em>(string)</em></th> + <td>L'icône si la branche n'a pas d'enfants</td></tr> + <tr class="classe"><th>iconOpen <em>(string)</em></th> + <td>L'icône si la branche a des enfants et est ouverte</td></tr> + + <tr class="classe"><th>iconClose <em>(string)</em></th> + <td>L'icône si la branche a des enfants et est fermée</td></tr> + </table> + <p>Set les icônes par défaut des branches. Si <strong>iconOpen</strong> ou <strong>iconClose</strong> ne sont pas renseignés, ils prennent la valeur de <strong>icon</strong></p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setIcons(<span class="string">"page.gif"</span>, <span class="string">"folderopen.gif"</span>, <span class="string">"folder.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImg"</span> : <span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgOpen"</span> : <span class="string">"folderopen.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgClose"</span> : <span class="string">"folder.gif"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setIconsSelected()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>iconSelected <em>(string)</em></th> + + <td>L'icône si la branche n'a pas d'enfants et est sélectionée</td></tr> + <tr class="classe"><th>iconOpenSelected <em>(string)</em></th> + <td>L'icône si la branche a des enfants et est ouverte et sélectionée</td></tr> + <tr class="classe"><th>iconCloseSelected <em>(string)</em></th> + <td>L'icône si la branche a des enfants et est fermée et sélectionée</td></tr> + + </table> + <p>Set les icônes de la branche. Si <strong>iconOpenSelected</strong> ou <strong>iconCloseSelected</strong> ne sont pas renseignés, ils prennent respectivement les valeurs de <strong>iconOpen</strong> et <strong>iconClose</strong> (voir la fonction <em>setIcons()</em>)</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setIconsSelected(<span class="string">"page.gif"</span>, <span class="string">"folderopen.gif"</span>, <span class="string">"folder.gif"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgSelected"</span> : <span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgOpenSelected"</span> : <span class="string">"folderopen.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"defaultImgCloseSelected"</span> : <span class="string">"folder.gif"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <a name="#behaviourDrop"></a> + <h4 class="new" onclick="shownext(this)">setBehaviourDrop()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>dropStyle <em>(string)</em></th> + + <td>'sibling', 'siblingcopy', 'child' ou 'childcopy', suivant le type de drop voulu, 'child' par défaut</td></tr> + </table> + <p>Set le comportement de drop par défaut. En mettant <strong>sibling</strong>, on droppera les branches comme soeur ou, en maintenant ALT appuyé, comme fille. Et inversément si on met <strong>child</strong>.</p> + <p>Si on opte pour <strong>siblingcopy</strong>, on droppera les branches comme soeur et sera un copie ou, en maintenant ALT + CTRL appuyé, comme fille et pas copie. En fait, ça inverse les comportements des touches ALT et CTRL. Le mieux pour comprendre, c'est d'essayer...</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setBehaviourDrop(<span class="string">"sibling"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"behaviourDrop"</span> : <span class="string">"sibling"</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">disableDropCTRL()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>ctrlDrop <em>(boolean)</em></th> + + <td>False désactive la fonctionnalité CTRL avec drop, la valeur par défaut est true</td></tr> + </table> + <p>En passant "false", la touche CTRL sera désactivée. Il ne sera plus possible de faire des copy-drag. Un copy-drag copie la branche drag&dropée à l'emplacement de drop. Un insertDrag déplace simplement la branche sans pour autant en créer une nouvelle.</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.disableDropCTRL(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"dropCTRL"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">disableDropALT()</h4> + <div class="develop"> + <h4>Arguments</h4> + <table class="prop"> + <tr><th>altDrop <em>(string)</em></th> + + <td>False désactive la fonctionnalité ALT avec drop, la valeur par défaut est true</td></tr> + </table> + <p>False enlève la possibilité d'avoir 2 différents types de drop. Soit "comme soeur" soit "comme fille". En passant "false", il ne + sera possible de faire que les types de drop définis par la fonction <a href="#">setBehaviourDrop()</a></p> + <h4>Samples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.disableDropALT(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"dropALT"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">propagateRestriction()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>propagate <em>(boolean)</em></th> + + <td>True pour propager l'interdiction de bouger après un drag&drop ajax (par défaut, true)</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.setOnDropAjax(myFunc, <span class="string">"mypage.php"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.propagateRestriction(<span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDropAjax"</span> : [myFunc, <span class="string">"mypage.php"</span>],</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"propagateRestriction"</span> : <span class="reserved">false</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>La propagation implique que les enfants de la branche droppée sont également bloqués (pour éviter des problèmes de croisements de données)</li> + </ul> + </div> + + <h4 class="new" onclick="shownext(this)">enableRTL()</h4> + <div class="develop"> + + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>rtl <em>(boolean)</em></th> + <td>True pour avoir l'arbre qui se lit de droite à gauche (par défaut, false)</td> + </tr> + </table> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.enableRTL(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Options</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"rtlMode"</span> : <span class="reserved">true</span></p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + + <h2>Méthodes TafelTree publiques</h2> + <h4 onclick="shownext(this)">generate()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + + <tr> + <th>partLoad <em>(boolean)</em></th> + <td>True pour générer l'arbre petit-à-petit (expérimental), false par défaut</td> + </tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.generate();</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On peut générer l"arbre petit-à-petit (pour les gros arbre)</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Attention, c"est vaguement expérimental;</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.generate(<span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">serialize()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>debug <em>(boolean)</em></th> + + <td>Mettre true pour avoir un joli affichage du contenu de l'arbre. UNIQUEMENT POUR LE DEBUG. False par défaut</td></tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe que la structure est définie en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree(<span class="string">"idTree"</span>, myStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.generate();</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On met <span class="reserved">true</span> pour visualiser et contrôler la string</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(tree.serialize(<span class="reserved">true</span>));</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On met rien pour traiter la string</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">new</span> Ajax.Request(<span class="string">"mapage.php"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"parameters"</span> : <span class="string">"tree="</span> + tree.serialize()</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getSelectedBranches()</h4> + <div class="develop"> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> selected = tree.getSelectedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (selected.length > 0) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < selected.length; i++) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(selected[i].getId());</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getBranchById()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>id <em>(string)</em></th> + + <td>L'id de la branche</td></tr> + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch = tree.getBranchById(<span class="string">"idBranch"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(branch.getId();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">bind()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>tree <em>(TafelTree)</em></th> + + <td>L'arbre avec lequel on veut faire le lien</td></tr> + <tr class="classe"><th>tree <em>(TafelTree)</em></th> + <td>Un autre arbre</td></tr> + <tr class="classe"><th>... <em>(TafelTree)</em></th> + <td>Autant d'autres arbres que l'on veut</td></tr> + + </table> + <p>Le lien bi-directionnel permet de faire, en une fois, les liens drag&drop entre les arbres, dans les deux sens (arbre1 vers arbre2 et vice-versa)</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// A noter dans ce cas qu"on pourra faire des drag&drop de</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// tree vers tree_2, et inversément</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree_2 = <span class="reserved">new</span> TafelTree(<span class="string">"idTree_2"</span>, myOtherStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.bind(tree_2);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Le lien sert à pouvoir faire des drag&drop entre les arbres</li> + <li>Ce lien est bi-directionnel</li> + </ul> + </div> + + <h4 onclick="shownext(this)">bindAsUnidirecitonal()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>tree <em>(TafelTree)</em></th> + <td>L'arbre avec lequel on veut faire le lien</td></tr> + + <tr class="classe"><th>tree <em>(TafelTree)</em></th> + <td>Un autre arbre</td></tr> + <tr class="classe"><th>... <em>(TafelTree)</em></th> + <td>Autant d'autres arbres que l'on veut</td></tr> + </table> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// A noter dans ce cas qu"on ne pourra faire des drag&drop</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// que de tree vers tree_2 et pas inversément</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree_2 = <span class="reserved">new</span> TafelTree(<span class="string">"idTree_2"</span>, myOtherStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.bindAsUnidirecitonal(tree_2);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Le lien sert à pouvoir faire des drag&drop entre les arbres</li> + <li>Ce lien est uni-directionnel</li> + </ul> + </div> + + <h4 onclick="shownext(this)">isBindedWith()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>tree <em>(TafelTree)</em></th> + <td>L'arbre avec lequel on veut savoir s'il y a un lien</td></tr> + + </table> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree_2 = <span class="reserved">new</span> TafelTree(<span class="string">"idTree_2"</span>, myOtherStruct);</p></td></tr><tr><td><p style="padding-left:4ex;">tree.bindAsUnidirectional(tree_2);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(tree.isBindedWith(tree_2)); <span class="comment">// retourne <span class="reserved">true</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(tree_2.isBindedWith(tree)); <span class="comment">// retourne <span class="reserved">false</span></span></p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">unselect()</h4> + <div class="develop"> + <p>Déselectionne la branche, s'il y en avait une sélectionnée</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.unselect();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">countBranches()</h4> + <div class="develop"> + <p>Compte le nombre de branches contenues dans l'arbre</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(tree.countBranches());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getOpenedBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches ouvertes</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getOpenedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getCheckedBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches checkées</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getUnCheckedBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches non checkées</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getUnCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getPartCheckedBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches partiellement checkées</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getPartCheckedBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getParentBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches qui ont des enfants</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getParentBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">getLeafBranches()</h4> + <div class="develop"> + <p>Retourne un tableau contenant les branches qui n'ont pas d'enfants</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getLeafBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getBranches()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>filter <em>(function)</em></th> + + <td>La fonction utilisateur</td></tr> + </table> + <p>Retourne un tableau contenant toutes les branches de l'arbre. On peut y mettre un filtre.</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu'un arbre a été créé auparavant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getBranches();</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On peut filtrer les branches avec une fonction</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myFilter (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (branch.getText() == <span class="string">"Celle-ci"</span>) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branches = tree.getBranches(myFilter);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">for</span> (<span class="reserved">var</span> i = 0; i < branches.length; i++) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branches[i].getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">expend()</h4> + <div class="develop"> + <p>Ouvre toutes les branches</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.expend();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">collapse()</h4> + <div class="develop"> + <p>Ferme toutes les branches</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.collapse();</p></td></tr><tr><td><p style="padding-left:4ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">insertBranch()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>position <em>(TafelTreeBranch, string)</em></th> + + <td>La branche source (ou juste l'id)</td></tr> + <tr><th>item <em>(object)</em></th> + <td>La nouvelle branche (au format <a href="#tag"><em>TafelTreeBranch properties</em></a>)</td></tr> + <tr class="classe"><th>sibling <em>(boolean)</em></th> + <td>True pour indiquer qu'on veut l'insérer en tant que soeur, par défaut false</td></tr> + + <tr class="classe"><th>first <em>(boolean)</em></th> + <td>True pour indiquer qu'on veut l'insérer avant ou en premier, false par défaut</td></tr> + </table> + <p>Premet de rajouter une branche comme fille ou comme soeur, avant ou après la branche désirée</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span>:<span class="string">"new1"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span>:<span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span>:<span class="string">"child before"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item2 = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span>:<span class="string">"new2"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span>:<span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span>:<span class="string">"child after"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item3 = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span>:<span class="string">"new3"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span>:<span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span>:<span class="string">"sibling before"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> item4 = {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"id"</span>:<span class="string">"new4"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"img"</span>:<span class="string">"page.gif"</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"txt"</span>:<span class="string">"sibling after"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Branche fille (enfant) - en premier</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch1 = tree.insertBranch(<span class="string">"id_branch"</span>, item, <span class="reserved">false</span>, <span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Branche fille (enfant) - en dernier</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch2 = tree.insertBranch(<span class="string">"id_branch"</span>, item2, <span class="reserved">false</span>, <span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Branche soeur - avant</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch3 = tree.insertBranch(<span class="string">"id_branch"</span>, item3, <span class="reserved">true</span>, <span class="reserved">true</span>);</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Branche soeur - après</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> branch4 = tree.insertBranch(<span class="string">"id_branch"</span>, item4, <span class="reserved">true</span>, <span class="reserved">false</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">removeBranch()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>branch <em>(TafelTreeBranch, string)</em></th> + + <td>La branche source (ou juste l'id)</td></tr> + </table> + <p>Supprime la branche est toutes ses filles</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.removeBranch(<span class="string">"id_branch_to_delete"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">debug()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>str <em>(string)</em></th> + + <td>Le texte à afficher</td></tr> + </table> + <p>Affiche un texte dans la zone de débug</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On part du principe qu"un arbre a été généré en amont</span></p></td></tr><tr><td><p style="padding-left:4ex;">tree.debug(<span class="string">"text to debug : "</span> + tree.id);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h2>Méthodes TafelTree d'événements</h2> + <h4 onclick="shownext(this)">setOnDebug()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsqu'on fait appel à tree.debug()</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myDebug (tree, HTMLDebugObj, str) {</p></td></tr><tr><td><p style="padding-left:8ex;">HTMLDebugObj.innerHTML = <span class="string">"Ma fonction : "</span> + str;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDebug"</span> : myDebug</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;">tree.debug(<span class="string">"text to debug"</span>);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Par défaut, la méthode tree.debug() affiche simplement le texte dans le HTMLDebugObj</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setOnLoad()</h4> + <div class="develop"> + + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsque l'arbre a fini de loader (en le générant avec true : <strong>tree.generate(true)</strong>)</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myLoad () {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"load terminé"</span>);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onLoad"</span> : myLoad</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnOpen()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée après qu'une branche ait été ouverte (<em>status = true</em>) ou fermée (<em>status = false</em>)</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myOpen (branch, status) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> str = (status) ? <span class="string">"ouverte"</span> : <span class="string">"fermée"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" a été "</span> + str);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onOpen"</span> : myOpen</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnBeforeOpen()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée avant qu'une branche soit ouverte (<em>status = true</em>) ou fermée (<em>status = false</em>). Si elle retourne <strong>false</strong>, la branche conservera son status actuel.</p> + <h4>Exemples</h4> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myBeforeOpen (branch, status) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> strNow = (status) ? <span class="string">"ouverte"</span> : <span class="string">"fermée"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> strNext = (status) ? <span class="string">"fermée"</span> : <span class="string">"ouverte"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" est actuellement "</span> + strNow +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">" et sera donc "</span> + strNext +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">" si cette fonction retourne <span class="reserved">true</span>"</span>);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onBeforeOpen"</span> : myBeforeOpen</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnMouseOver()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsque la souris passe sur la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myMouseOver (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"over : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseOver"</span> : myMouseOver</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnMouseOut()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsque la souris n'est plus sur la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myMouseOut (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"out : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseOut"</span> : myMouseOut</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setOnMouseDown()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsqu'on fait un "mouse down" sur la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myMouseDown (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"down : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseDown"</span> : myMouseDown</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setOnMouseUp()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsqu'on fait un "mouse up" sur la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// User <span class="reserved">function</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myMouseUp (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(<span class="string">"up : "</span> + branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onMouseUp"</span> : myMouseUp</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnClick()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsqu'on clique sur la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myClick (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onclick"</span> : myClick</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Quoiqu'il arrive, la branche sur laquelle on clique sera sélectionnée</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setOnDblClick()</h4> + <div class="develop"> + + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsqu'on double-clique sur la branche</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myDblClick (branch) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId());</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDblClick"</span> : myDblClick</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnEdit()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Active l'édition des branches. Méthode qui est appelée lorsqu'on fini d'éditer une branche (concrétement, lors du blur du champ texte). Le contenu de la branche sera celui que la fonction utilisateur retournera.</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myEdit (branch, newValue, oldValue) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> str = branch.getId() + <span class="string">" : "</span> + newValue;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> str;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onEdit"</span> : myEdit</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Lorsqu'on a une fonction assignée en double-clic <em>(tree.setOnDblClick())</em>, l'utilisation du onEdit disparaît. C'est soit l'un, soit l'autre</li> + </ul> + </div> + + <h4 onclick="shownext(this)">setOnBeforeCheck()</h4> + + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsqu'on check ou uncheck la branche, juste avant qu'elle change de status. Pour ne pas changer son status, il faut retourner <strong>false</strong></p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myBeforeCheck (branch, status) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> strNow = (status) ? <span class="string">"checkée"</span> : <span class="string">"uncheckée"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> strNext = (status) ? <span class="string">"uncheckée"</span> : <span class="string">"checkée"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" est actuellement "</span> + strNow +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">" et sera "</span> + strNext +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">" si cette fonction retourne <span class="reserved">true</span>"</span>);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onBeforeCheck"</span> : myBeforeCheck</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 onclick="shownext(this)">setOnCheck()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode qui est appelée lorsqu'on check ou uncheck la branche</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myCheck (branch, status) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> str = (status) ? <span class="string">"checkée"</span> : <span class="string">"uncheckée"</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" est maintenant "</span> + str);</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onCheck"</span> : myCheck</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setOnDrop()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + </table> + <p>Active le drag&dorp. Méthode qui est appelée lorsqu'on drop la branche. On peut faire un "drop as sibling (frère)" en gardant la touche <strong>ALT</strong> appuyée. Il est également possible de faire un "copydrag" en maintenant la touche <strong>CONTROL</strong> appuyée.</p> + <p>La méthode est appelée deux fois. Une fois avant que le drop soit fait (drop_finished = false) et une fois après que le drop soit fait (drop_finished = true), pour autant qu'il n'y ait pas eu d'erreurs avant.</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myDrop (branchMoved, newParent, dropFinished) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (!dropFinished) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(branchMoved.getId() + <span class="string">" sera fille de "</span></p></td></tr><tr><td><p style="padding-left:16ex;">+ newParent.getId());</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(branchMoved.getId() + <span class="string">" est maintenant fille de "</span></p></td></tr><tr><td><p style="padding-left:16ex;">+ newParent.getId());</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDrop"</span> : myDrop</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Maintenir ALT pour dropper "as sibling"</li> + <li>Maintenir CONTROL pour faire un "copydrag"</li> + </ul> + </div> + + <h4 class="new" onclick="shownext(this)">setOnDropAjax()</h4> + + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>La méthode à appeler</td></tr> + <tr><th>link <em>(string)</em></th> + + <td>Le lien vers la page de traitement coté serveur</td></tr> + </table> + <p>Active le drag&dorp. Méthode qui est appelée lorsqu'on drop la branche et qui envoie du même coup une requête Ajax. On peut faire un "drop as sibling (frère)" en gardant la touche <strong>ALT</strong> appuyée. Il est également possible de faire un "copydrag" en maintenant la touche <strong>CONTROL</strong> appuyée. Pour d'autres exemples, voir <a href="#ondropajax">Drop Ajax </a></p> + + <p>La méthode est appelée deux fois. Une fois avant que le drop soit fait (drop_finished = false) et une fois après que le drop soit fait (drop_finished = true), pour autant qu'il n'y ait pas eu d'erreurs avant.</p> + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myDrop(branchMoved,newParent,response,dropFinished){</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// On check avant que le drop soit fait</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (!dropFinished) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// La réponse correspond au responseText de</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// l'objet XMLHttpRequest</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(response);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// Il peut tout-à-fait s'agir d"une string JSON,</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="comment">// auquel cas on peut l'évaluer comme ceci :</span></p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">var</span> obj = eval(<span class="string">"("</span> + response + <span class="string">")"</span>);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(obj.myProperty);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(branchMoved.getId() + <span class="string">" sera fille de "</span> +</p></td></tr><tr><td><p style="padding-left:16ex;">newParent.getId() +</p></td></tr><tr><td><p style="padding-left:16ex;"><span class="string">" si cette fonction retourne <span class="reserved">true</span>"</span>);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onDropAjax"</span> : [myDrop, <span class="string">"pageScript.php"</span>]</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Exemple de fichier PHP coté serveur</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="php"><?php</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// On fait divers traitements</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// ...</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Et on affiche une string JSON</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="php">?></span></p></td></tr><tr><td><p style="padding-left:0ex;">({</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"myProperty"</span> : <span class="string">"myValue"</span>,</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"other"</span> : [<span class="string">"this"</span>, <span class="string">"is"</span>, <span class="string">"an"</span>, <span class="string">"array"</span>]</p></td></tr><tr><td><p style="padding-left:0ex;">})</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>Maintenir ALT pour dropper "as sibling"</li> + <li>Maintenir CONTROL pour faire un "copydrag"</li> + <li>Les variables envoyées à la page <a href="#droplink">droplink</a> passent par la méthode POST</li> + + <li>Ces variables sont : + <ul> + <li>" drag " = description JSON de la branche qui a bougé</li> + <li>" drop " = description JSON de la branche sur laquelle on a déposé le drag</li> + <li>" drag_id " = id de la branche qui a bougé</li> + <li>" drop_id " = id de la branche sur laquelle on a déposé le drag_id</li> + <li>" treedrag_id " = id de l'arbre d'où est tiré la branche qui a bougé</li> + + <li>" treedrop_id " = id de l'arbre qui accueille la branche qui a bougé</li> + <li>" sibling " = 0 si on le drop est comme fils, 1 s'il est comme frère</li> + </ul> + </li> + <li>Toutes autres variables passée par <a href="#droplink">droplink</a> sont également transmises en POST. Par exemple, si droplink = "page.php?spec=1", on récuperera <em>spec</em> en POST malgré tout.</li> + + </ul> + </div> + + <h4 onclick="shownext(this)">setOnOpenPopulate()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + <tr><th>link <em>(string)</em></th> + <td>Le lien vers la page de traitement coté serveur</td></tr> + </table> + <p>Active la remplissage des enfants au moment de l'ouverture de la branche. Méthode qui est appelée lorsqu'on ouvre la branche et qui envoie du même coup une requête Ajax. Pour d'autres exemples, voir <a href="#onopenpopulate">onopenpopulate</a></p> + <h4>Exemples</h4> + + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr><tr><th>32</th></tr><tr><th>33</th></tr><tr><th>34</th></tr><tr><th>35</th></tr><tr><th>36</th></tr><tr><th>37</th></tr><tr><th>38</th></tr><tr><th>39</th></tr><tr><th>40</th></tr><tr><th>41</th></tr><tr><th>42</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Fonction utilisateur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myOpen (branch, response) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// La réponse correspond au responseText de</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// l'objet XMLHttpRequest</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(response);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Il DOIT string JSON, qui DOIT être structurée</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// à la façon d'une TafelTreeBranch</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">var</span> childBranch = eval(response);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(childBranch.id + <span class="string">"\n"</span> + childBranch.txt);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">alert</span>(branch.getId() + <span class="string">" sera ouverte si cette "</span> +</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="string">"fonction retourne <span class="reserved">true</span>"</span>);</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> response;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> tree = <span class="reserved">new</span> TafelTree (<span class="string">"idtree"</span>, {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"generate"</span> : <span class="reserved">true</span>,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"onOpenPopulate"</span> : [myOpen, <span class="string">"pageScript.php"</span>]</p></td></tr><tr><td><p style="padding-left:4ex;">});</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:0ex;"><!-- Exemple de fichier PHP coté serveur --></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="php"><?php</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// On fait divers traitements</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// ...</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// Et on affiche une string JSON. A noter qu'on retourne</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="comment">// systématiquement un TABLEAU</span></p></td></tr><tr><td><p style="padding-left:0ex;"><span class="php">?></span></p></td></tr><tr><td><p style="padding-left:0ex;">[</p></td></tr><tr><td><p style="padding-left:0ex;">{</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"id"</span> : <span class="string">"child1"</span>,</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"txt"</span> : <span class="string">"Texte 1"</span>,</p></td></tr><tr><td><p style="padding-left:0ex;"><span class="string">"items"</span> : [</p></td></tr><tr><td><p style="padding-left:4ex;">{</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"id"</span> : <span class="string">"child2"</span>,</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="string">"txt"</span> : <span class="string">"Texte 2"</span></p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">]</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">]</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>La fonction utilisateur DOIT retourner une string JSON représentant des TafelTreeBranch. Ou false pour annuler l'ouverture.</li> + <li>Le JSON DOIT ETRE entre parenthèses <strong>( )</strong></li> + <li>Les variables envoyées à la page <a href="#openlink">openlink</a> passent par la méthode POST</li> + + <li>Ces variables sont : + <ul> + <li>" branch " = description JSON de la branche</li> + <li>" branch_id " = id de la branche qui s'ouvre</li> + <li>" tree_id " = id de l'arbre qui accueille la branche qui s'ouvre</li> + </ul> + </li> + <li>Toutes autres variables passée par <a href="#openlink">openlink</a> sont également transmises en POST. Par exemple, si openlink = "page.php?spec=1", on récuperera <em>spec</em> en POST malgré tout.</li> + + </ul> + </div> + + <h4 onclick="shownext(this)">setOnEditAjax()</h4> + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + + <td>La méthode à appeler</td></tr> + <tr><th>link <em>(string)</em></th> + <td>Le lien vers la page de traitement coté serveur</td></tr> + </table> + <p>Méthode appelée après l'édition de la branche. Lorsque celle-ci a terminé d'être éditée, elle lance une requête Ajax à la page <strong>editlink</strong> et renvoie le retour Ajax à la méthode utilisateur. <strong>La méthode doit retourner une string représentant la nouvelle valeur de la branche</strong>. Prend le pas sur la méthode <strong><a href="#setOnEditAjax">setOnEditAjax()</a></strong> de TafelTree</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr><tr><th>27</th></tr><tr><th>28</th></tr><tr><th>29</th></tr><tr><th>30</th></tr><tr><th>31</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myEditAjax (branch, response, oldValue) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Pour voir le contenu de la réponse, on peut en faire une</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"<span class="reserved">alert</span>"</span> ou le mettre dans le DIV de debug comme ceci :</span></p></td></tr><tr><td><p style="padding-left:4ex;">branch.tree.debug(response);</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On peut aussi évaluer la réponse en tant qu'objet JSON</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// (à noter qu'elle est entre parenthèses). La réponse</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// doit contenir, d<span class="string">'une manière ou d'</span>une autre, la</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// nouvelle valeur de la branche</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// ({</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"message"</span> : <span class="string">"Tout est ok sur le serveur"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"newValue"</span> : <span class="string">"Nouvelle valeur de la branche"</span>,</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="string">"anyOtherParams"</span> : <span class="reserved">true</span></span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// })</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// On peut aussi retourner seulement la nouvelle valeur</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// (dans ce cas, plus besoin de parenthèses)</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// <span class="reserved">alert</span> (response); // show the <span class="reserved">new</span> text</span></p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Tests divers</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">if</span> (resultsFromTest) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// OK, la branche sera éditée et aura la</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// nouvelle valeur retournée par cette fonction</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> theNewValue;</p></td></tr><tr><td><p style="padding-left:4ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Ici, la branche ne sera pas éditée et conservera</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// son ancienne valeur (oldValue)</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>La réponse devrait contenir la nouvelle valeur à insérer dans la branche</li> + <li>Les variables envoyées à la page <a href="#editlink">editlink</a> passent par la méthode POST</li> + <li>Ces variables sont : + <ul> + + <li>" branch " = description JSON de la branche</li> + <li>" branch_id " = id de la branche qui s'ouvreé</li> + <li>" tree_id " = id de l'arbre d'où est tiré la branche qui s'ouvre</li> + <li>" new_value " = la nouvelle valeur de la branche</li> + <li>" old_value " = l'ancienne valeur de la branche</li> + </ul> + + </li> + <li>Toutes autres variables passée par <a href="#editlink">editlink</a> sont également transmises en POST. Par exemple, si openlink = "page.php?spec=1", on récuperera <em>spec</em> en POST malgré tout.</li> + </ul> + </div> + + <h4 class="new" onclick="shownext(this)">setOnErrorAjax()</h4> + + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr><th>func <em>(function)</em></th> + <td>La méthode à appeler</td></tr> + </table> + <p>Méthode appelée suite à une erreur dans une requête Ajax de drop, open ou edit</p> + + <h4>Exemples</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><span class="reserved">function</span> myErrorAjax (type, response, branch, droppedOn) {</p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Vérifie le type d'erreur. Peue être drop, edit ou open</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">switch</span> (type) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"drop"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"open"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">case</span> <span class="string">"edit"</span> :</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">alert</span>(<span class="string">"Une erreur est survenue pendant l'édition"</span>);</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">break</span>;</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;">}</p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h1>Méthodes TafelTreeManager</h1> + <h2>Description des événements clavier</h2> + <h4 class="new" onclick="shownext(this)">Events</h4> + <div class="develop"> + <p>Les touches suivantes sont gérées :</p> + + <ul> + <li>ARROW_LEFT</li> + <li>ARROW_RIGHT</li> + <li>ARROW_UP</li> + <li>ARROW_DOWN</li> + <li>HOME</li> + + <li>END</li> + <li>F2 (édition)</li> + <li>ENTER (stop de l'édition)</li> + <li>ESCAPE (déselection)</li> + <li>DELETE</li> + <li>CTRL + X (touche POMME sur mac Safari)</li> + + <li>CTRL + C (touche POMME sur mac Safari)</li> + <li>CTRL + V (touche POMME sur mac Safari)</li> + </ul> + <p>Il est possible de désactiver certaines touches ou d'ajouter ses propres touches. Voir la fonction setKey()</p> + </div> + <h2>Méthodes TafelTreeManager publiques</h2> + <h4 class="new" onclick="shownext(this)">setKeys()</h4> + + <div class="develop"> + <h4>Paramètres</h4> + <table class="prop"> + <tr> + <th>keys <em>(array)</em></th> + <td>Le tableau contenant les informations des code touche et la fonction approrpiée</td> + </tr> + + </table> + <p>Permet de gérer un ou plusieurs comportements pour une touche donnée. Concrétement, la fonction associée à la touche est + appelée dès que la touche est appuyée. Cette fonction contient les données d'environnement (l'arbre sur lequel se passe + l'action, les touches appuyées (ctrl, alt, shift ou meta) etc).</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr><tr><th>5</th></tr><tr><th>6</th></tr><tr><th>7</th></tr><tr><th>8</th></tr><tr><th>9</th></tr><tr><th>10</th></tr><tr><th>11</th></tr><tr><th>12</th></tr><tr><th>13</th></tr><tr><th>14</th></tr><tr><th>15</th></tr><tr><th>16</th></tr><tr><th>17</th></tr><tr><th>18</th></tr><tr><th>19</th></tr><tr><th>20</th></tr><tr><th>21</th></tr><tr><th>22</th></tr><tr><th>23</th></tr><tr><th>24</th></tr><tr><th>25</th></tr><tr><th>26</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Définition de la fonction pour la touche n°46 (DEL)</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">function</span> myOnDelete (tree, code, modifiers, ev) {</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// Là, il s<span class="string">'agit de faire se qu'</span>on veut et retourner</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// <span class="string">"<span class="reserved">true</span>"</span> si on veut que le process continue. Par</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// exemple, pour la touche DEL, il y a déjà une</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// fonction intégrée. Si on retourne <span class="string">"<span class="reserved">true</span>"</span>, cette</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// fonction sera appelée. Si on retourne <span class="string">"<span class="reserved">false</span>"</span>, elle</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="comment">// ne sera pas appelée...</span></p></td></tr><tr><td><p style="padding-left:8ex;"><span class="reserved">if</span> (okForDelete) {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">true</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">} <span class="reserved">else</span> {</p></td></tr><tr><td><p style="padding-left:12ex;"><span class="reserved">return</span> <span class="reserved">false</span>;</p></td></tr><tr><td><p style="padding-left:8ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:0ex;"> </p></td></tr><tr><td><p style="padding-left:4ex;"><span class="comment">// Définition des touches</span></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">var</span> keys = [</p></td></tr><tr><td><p style="padding-left:4ex;">{</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"key"</span> : 46,</p></td></tr><tr><td><p style="padding-left:8ex;"><span class="string">"func"</span> : myOnDelete</p></td></tr><tr><td><p style="padding-left:4ex;">}</p></td></tr><tr><td><p style="padding-left:4ex;">];</p></td></tr><tr><td><p style="padding-left:4ex;">TafelTreeManager.setKeys(keys);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + <h4>Notes</h4> + <ul> + <li>modifiers.ctrlKey = true si Ctrl est appuyé</li> + <li>modifiers.altKey = true si Alt est appuyé</li> + <li>modifiers.shiftKey = true si Shift est appuyé</li> + <li>modifiers.metaKey = true si "Pomme" (sous mac Safari) est appuyé</li> + + </ul> + </div> + + <h4 class="new" onclick="shownext(this)">disableKeyboardEvents()</h4> + <div class="develop"> + <p>Désactive la gestion clavier</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;">TafelTreeManager.disableKeyboardEvents();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">disableKeyboardStructuralEvents()</h4> + <div class="develop"> + <p>Désactive la gestion clavier pour ce qui est changement de structure. Il est donc possible de se déplacer avec les + flèches mais pas de copier-coller ou supprimer, par exemple.</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;">TafelTreeManager.disableKeyboardStructuralEvents();</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">getCurrentTree()</h4> + <div class="develop"> + <p>Retourne l'arbre courant sur lequel se passe les actions. Null si aucun arbre n'est courant.</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;"><span class="reserved">alert</span>(TafelTreeManager.getCurrentTree());</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + <h4 class="new" onclick="shownext(this)">setCurrentTree()</h4> + <div class="develop"> + <p>Set l'arbre courant sur lequel va se passer les actions</p> + <h4>Exemple</h4> + <div class="code"><table><tr><td class="num"><table><tr><th>1</th></tr><tr><th>2</th></tr><tr><th>3</th></tr><tr><th>4</th></tr></table></td><td><table><tr><td><p style="padding-left:0ex;"><script type=<span class="string">"text/javascript"</span>></p></td></tr><tr><td><p style="padding-left:4ex;">TafelTreeManager.setCurrentTree(myTree);</p></td></tr><tr><td><p style="padding-left:0ex;"></script></p></td></tr><tr><td> </td></tr></table></td></tr></table></div> + + </div> + + </div> + + </div> + </div> + <div class="bottom"> + <p>Treeview JS TafelTree</p> + <p>2006-12-30, <a href="#" onclick="gereStyle()">Tafel</a>. Optimisé pour Mozilla Firefox</p> + + </div> +</div> + +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/doc/new.png b/maarch_entreprise/trunk/tools/tafelTree/doc/new.png new file mode 100644 index 0000000000000000000000000000000000000000..ff033a94f300390ff87127758f25f72b8c0bb93b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/doc/new.png differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/edit.html b/maarch_entreprise/trunk/tools/tafelTree/edit.html new file mode 100644 index 0000000000000000000000000000000000000000..0c86984c4ad85786fc1c8622361fbf6914ef3cd2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/edit.html @@ -0,0 +1,146 @@ +<html> +<head> + <title>OpenOfficeGeneration Documentation</title> + <link rel="stylesheet" type="text/css" href="css/tree.css" /> + <style> + body { + background-color: #FFFFFF; + } + .mover { + background-color: #FF9999; + color: #FFEEEE; + } + + .special { + color: #CC0000; + } + + .tafelTree h3, .tafelTree p, .tafelTree ol { + margin: 0; + padding: 0; + } + + .tafelTree p { + padding-bottom: 1em; + } + + .tafelTree h3 { + color: #009900; + } + </style> + <script type="text/javascript" src="js/prototype.js"></script> + <script type="text/javascript" src="js/scriptaculous.js"></script> + <script type="text/javascript" src="Tree.js"></script> +</head> +<body> + + <script type="text/javascript"> + function funcEdit (branch, response) { + // Ici tu peux traiter le retour et retourner true si + // tu veux assigner la valeur retournée par le serveur + // Tu peux aussi retourner autre chose et c'est cette + // valeur qui sera prise en compte + return "Arbre 1 : " + response; + } + function funcEdit2 (branch, response) { + // Ici tu peux traiter le retour et retourner true si + // tu veux assigner la valeur retournée par le serveur + // Tu peux aussi retourner autre chose et c'est cette + // valeur qui sera prise en compte + return "Arbre 2 : " + response; + } + var tree = null; + var tree2 = null; + function TafelTreeInit () { + var struct = [ + { + 'id':'root1', + 'txt':'Element racine', + 'items':[ + { + 'id':'child1', + 'txt':'Un enfant', + 'onclick' : function(b){b.tree.debug('hop');} + }, + { + 'id':'child2', + 'txt':'Un enfant 2', + 'editable' : false + }, + { + 'id':'child3', + 'txt':'Un enfant 3' + }, + { + 'id':'child4', + 'txt':'Un enfant 4' + } + ] + } + ]; + var struct2 = [ + { + 'id':'root12', + 'txt':'Element racine', + 'items':[ + { + 'id':'child12', + 'txt':'Un enfant' + }, + { + 'id':'child22', + 'txt':'Un enfant 2', + 'editable' : false + }, + { + 'id':'child32', + 'txt':'Un enfant 3' + }, + { + 'id':'child42', + 'txt':'Un enfant 4' + } + ] + } + ]; + tree = new TafelTree('test', struct, { + 'generate' : true, + 'imgBase' : 'imgs/', + 'defaultImg' : 'page.gif', + 'defaultImgOpen' : 'folderopen.gif', + 'defaultImgClose' : 'folder.gif', + 'onEditAjax' : [funcEdit, 'sampleEdit1.php'], + 'onDrop' : function(){return true;}, + 'copyDrag' : true, + 'behaviourDrop' : 'sibling' + }); + tree2 = new TafelTree('test2', struct2, { + 'generate' : true, + 'imgBase' : 'imgs/', + 'defaultImg' : 'page.gif', + 'defaultImgOpen' : 'folderopen.gif', + 'defaultImgClose' : 'folder.gif', + 'onEditAjax' : [funcEdit2, 'sampleEdit1.php'], + 'onDrop' : function(){return true;}, + 'bind' : [tree] + }); + } + + function effet () { + var branch = tree.getBranchById('child1'); + var s = '1 . '; + if (!branch) { + branch = tree2.getBranchById('child1'); + s = '2 . '; + } + alert(s + branch.getText()); + } + </script> + <div id="test"></div> + <div id="test2"></div> + <p><a href="#" onclick="effet()">Effet</a></p> + + + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/base.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/base.gif new file mode 100644 index 0000000000000000000000000000000000000000..337a77f1636d90e12696f57e05f8bded176e5187 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/base.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/check1.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/check1.gif new file mode 100644 index 0000000000000000000000000000000000000000..b1680b05b78dc46afb88fd02b1e3f299e7e8b443 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/check1.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/check2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/check2.gif new file mode 100644 index 0000000000000000000000000000000000000000..549ce94e87d8954272e2cb3f5e6293754a46cc1e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/check2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/check3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/check3.gif new file mode 100644 index 0000000000000000000000000000000000000000..d8ac736933d3072af8aa54dbc3a16520121c833b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/check3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over1.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over1.gif new file mode 100644 index 0000000000000000000000000000000000000000..dbd90d8ab0cda2bed291adc8590f71761491f125 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over1.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..f1925b20b7a2b0aed8fecbfeee19c7deec8a04b5 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..451c82130e76ded58dcb6bdb197031d9e32b2fd2 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/check_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/empty.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/empty.gif new file mode 100644 index 0000000000000000000000000000000000000000..d7ae4067134ffb090de8adafdeaf575fe11a411d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/empty.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/folder.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/folder.gif new file mode 100644 index 0000000000000000000000000000000000000000..3acd63d694bc2ae8a78708f308587ef8c55b6cca Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/folder.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/folderopen.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/folderopen.gif new file mode 100644 index 0000000000000000000000000000000000000000..f296307d1593f6eebcfbe9d2531aef9a305d4c59 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/folderopen.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/globe.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/globe.gif new file mode 100644 index 0000000000000000000000000000000000000000..89d901237465ec86700a1bea57ffed6c9448d8ec Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/globe.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/imgfolder.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/imgfolder.gif new file mode 100644 index 0000000000000000000000000000000000000000..e6d880347f518bbd1239f2af3e3059ccb1e674e3 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/imgfolder.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/line0.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/line0.gif new file mode 100644 index 0000000000000000000000000000000000000000..ceda243e9ccf74a6cdf6316e2f4a785613ab2abb Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/line0.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/line1.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/line1.gif new file mode 100644 index 0000000000000000000000000000000000000000..60f2ccb26efc24e92c7bba5f35f2ca243d4838dd Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/line1.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/line2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/line2.gif new file mode 100644 index 0000000000000000000000000000000000000000..f2d7bdd5065ad01d005de788ffceb90e7ba39aab Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/line2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/line3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/line3.gif new file mode 100644 index 0000000000000000000000000000000000000000..d718be218facdbdf057fc5e92b5b86580b131071 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/line3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/line4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/line4.gif new file mode 100644 index 0000000000000000000000000000000000000000..1b1a3496a807364295a32bf21ff0f2fea3c0827e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/line4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/line5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/line5.gif new file mode 100644 index 0000000000000000000000000000000000000000..2421b138d39dd4434044d5882aae112b86e9b52e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/line5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linebg.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linebg.gif new file mode 100644 index 0000000000000000000000000000000000000000..fbbff5dc80424dc3f6f4055bb539a661abb69ce8 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linebg.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linebg2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linebg2.gif new file mode 100644 index 0000000000000000000000000000000000000000..a0cf9eace2c811cfddf7f9d0207d01cf7d0a52cd Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linebg2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linebgfull.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linebgfull.gif new file mode 100644 index 0000000000000000000000000000000000000000..e8ecb8fd30145a81f34c8a463c3b8fefce346fc4 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linebgfull.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linebgfull2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linebgfull2.gif new file mode 100644 index 0000000000000000000000000000000000000000..82da3504f32797b9265d5082b96436fa3f63532c Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linebgfull2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull0.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull0.gif new file mode 100644 index 0000000000000000000000000000000000000000..af25d1229466398573cf01e9201b291b577ec2ac Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull0.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull1.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull1.gif new file mode 100644 index 0000000000000000000000000000000000000000..d49a17314343b0aed2daf86d7fc8d68ca28c981a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull1.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull2.gif new file mode 100644 index 0000000000000000000000000000000000000000..05f251f099ee4cdc9f7e75413fb3b5b0a67d4ef2 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull3.gif new file mode 100644 index 0000000000000000000000000000000000000000..74591b961dac855191ac23534735856a56197859 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull4.gif new file mode 100644 index 0000000000000000000000000000000000000000..266b770a55255c52ac340f65403bbbe5f11957d5 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull5.gif new file mode 100644 index 0000000000000000000000000000000000000000..a941fa9ae792990647216511ff626baddd8c90ee Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/linefull5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/load.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/load.gif new file mode 100644 index 0000000000000000000000000000000000000000..1eac9d69e7c9515d3f14c5630c3b66a2aac8b44e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/load.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/lock.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/lock.gif new file mode 100644 index 0000000000000000000000000000000000000000..ce683fcceb9a04b4d8b0c2d0fba5c1418a07fb45 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/lock.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus0.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus0.gif new file mode 100644 index 0000000000000000000000000000000000000000..3bf101b000a2368d0e167c7c059a1d89d4ce3eab Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus0.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus2.gif new file mode 100644 index 0000000000000000000000000000000000000000..0372294cb98eb287dd2f3be297f179f355ec7e35 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus3.gif new file mode 100644 index 0000000000000000000000000000000000000000..d928af6394a83a9ae7f52b159e81a8bc98dd5b8c Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus4.gif new file mode 100644 index 0000000000000000000000000000000000000000..30bc7deecb497409fd1b02e5e0274962f0cf8e28 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus5.gif new file mode 100644 index 0000000000000000000000000000000000000000..e2e30fcb24250b3743eae8c00ec94c54c8bf9cc4 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over0.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over0.gif new file mode 100644 index 0000000000000000000000000000000000000000..b4311df656ef9bbd249836a28385d56540110ada Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over0.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..f3af634187f5c83824c2be13dea1a70a3b9abab5 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..bbbedd1505be600bd7ef206ceeec20740907ec99 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over4.gif new file mode 100644 index 0000000000000000000000000000000000000000..6569da9fced947194501b5c32a0484644b2434af Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over5.gif new file mode 100644 index 0000000000000000000000000000000000000000..94a2504b87dd3710c6059eed8331407156697a70 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minus_over5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull2.gif new file mode 100644 index 0000000000000000000000000000000000000000..95deed63eef7a37e84c2c2a121b82dc277c4811d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull3.gif new file mode 100644 index 0000000000000000000000000000000000000000..5e78643943f7d00ec0f4b4796be94e96f0672d48 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull4.gif new file mode 100644 index 0000000000000000000000000000000000000000..94e24b3ae1da9aee43639724fe97d90f2b1dcf05 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull5.gif new file mode 100644 index 0000000000000000000000000000000000000000..a7f73d0d608fe5fcc2568c1d899f2fb170cd96a7 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..e74ced4a37e5aedd9749f73f701df118e3ed9a9e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..4422da2a0b11536eab675d44430f842eba077c36 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over4.gif new file mode 100644 index 0000000000000000000000000000000000000000..8495bf04748af1ac9c2edc66cb8cd9a8e7eef286 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over5.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e3ec1bd6ac6ca1400a7fd9b81ab5ec63feac356 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/minusfull_over5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/musicfolder.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/musicfolder.gif new file mode 100644 index 0000000000000000000000000000000000000000..f620789feb3c4b1222909d255f51aeaa81faefb6 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/musicfolder.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/page.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/page.gif new file mode 100644 index 0000000000000000000000000000000000000000..3304be6db05d25a0804841b3aa230a088b7e2c28 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/page.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus0.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus0.gif new file mode 100644 index 0000000000000000000000000000000000000000..35ad7874dbb4312f7533f41f2d18cce021386b09 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus0.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus2.gif new file mode 100644 index 0000000000000000000000000000000000000000..ea2816efcea7a32f53f467c4a5fde344d9b4f585 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus3.gif new file mode 100644 index 0000000000000000000000000000000000000000..cd6967e52b92d46da70950f18335896de54c9fcd Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus4.gif new file mode 100644 index 0000000000000000000000000000000000000000..185bd9b7047143849a01d2e6e92a24e96abdf335 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus5.gif new file mode 100644 index 0000000000000000000000000000000000000000..72fe4e577f3a24dc19f47a60f070d55cc0dc1b2a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over0.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over0.gif new file mode 100644 index 0000000000000000000000000000000000000000..cef8ba843ca8a3a26c457d3d158f3bac604672e1 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over0.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..976438bfd501c06f011a331ef53f69b580d45fb3 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..4c5e7fa8b8936be834f137b9a0b2f1597953eff1 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over4.gif new file mode 100644 index 0000000000000000000000000000000000000000..3be8ffc1682d5d6c1065a4145ff056051785cdc3 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over5.gif new file mode 100644 index 0000000000000000000000000000000000000000..0aeb3a51adec35e887680cd8aed4d6de0dc9fe88 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plus_over5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull2.gif new file mode 100644 index 0000000000000000000000000000000000000000..d7c5898d9dbe68708ec74126e54f20bee6f470a5 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull3.gif new file mode 100644 index 0000000000000000000000000000000000000000..35d95f880b7e39778df61570e5e0b380013d1ac8 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull4.gif new file mode 100644 index 0000000000000000000000000000000000000000..ee094656f3be498765431663e673adcfca135dab Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull5.gif new file mode 100644 index 0000000000000000000000000000000000000000..48f4bfece085972aeca42f9e1ab30a8d94d31f39 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..366ee904d68cc872bbb7b1f4c5ba1d7f09dab5ac Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..60bdddaadc389d8a556c96b44330a4f1074bfae1 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over4.gif new file mode 100644 index 0000000000000000000000000000000000000000..90553e9d1f4b6ac675b81606ec843415182ba76d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over5.gif new file mode 100644 index 0000000000000000000000000000000000000000..4cb0f9994f6f0c473c99b089b796751da9b8211e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/plusfull_over5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/pt.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/pt.gif new file mode 100644 index 0000000000000000000000000000000000000000..f4a2493a1f8939a9731429423fed62dca96d6f38 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/pt.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/pt2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/pt2.gif new file mode 100644 index 0000000000000000000000000000000000000000..33c52fdc1415c509efa864d5e853062e1471ba5b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/pt2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line0.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line0.gif new file mode 100644 index 0000000000000000000000000000000000000000..45be7f3638f585f1e78c5d2239c6845cb397ed63 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line0.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line1.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line1.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c05212f4ae8ff3bd40e83645e7698b0d0bd23d7 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line1.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line2.gif new file mode 100644 index 0000000000000000000000000000000000000000..bd4a09f4e4869af5f360aa59cc1f2f421299353b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line3.gif new file mode 100644 index 0000000000000000000000000000000000000000..1fa0cc305adebf665ff6eec8abfc125391ddefc7 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line4.gif new file mode 100644 index 0000000000000000000000000000000000000000..646a2e48c7269fbde652d67f6b9721f866ec5cc2 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line5.gif new file mode 100644 index 0000000000000000000000000000000000000000..99309d7f9c4bd0f708d51c344347062231906c23 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_line5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebg.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebg.gif new file mode 100644 index 0000000000000000000000000000000000000000..b383b230bc1e5d9210e6beceea05508610a55051 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebg.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebg2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebg2.gif new file mode 100644 index 0000000000000000000000000000000000000000..459915c81c607e490520d60330b6c5020d329a0b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebg2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebgfull.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebgfull.gif new file mode 100644 index 0000000000000000000000000000000000000000..ccd9db20679ef97cd5b76a21432b309805fd702c Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebgfull.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebgfull2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebgfull2.gif new file mode 100644 index 0000000000000000000000000000000000000000..4d013cd8f73624cdece0b783f9635b9a696febe3 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linebgfull2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull0.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull0.gif new file mode 100644 index 0000000000000000000000000000000000000000..6f066da4366ea237cce1d09c1d285fbb711cb60e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull0.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull1.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull1.gif new file mode 100644 index 0000000000000000000000000000000000000000..3874a81de9d92d4271084d59c6d8704bc70b6b0b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull1.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull2.gif new file mode 100644 index 0000000000000000000000000000000000000000..f4260146c6a2ff9d0fce705ef97773783c944eb9 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull3.gif new file mode 100644 index 0000000000000000000000000000000000000000..bdf804cc982023879e09fa38ef1c9281056b3139 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull4.gif new file mode 100644 index 0000000000000000000000000000000000000000..2959a0bc79659781225f5b9160e3c9ade5adb36e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull5.gif new file mode 100644 index 0000000000000000000000000000000000000000..bcd04baecdf00abc4be7689750bbcc18a84fd13c Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_linefull5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus2.gif new file mode 100644 index 0000000000000000000000000000000000000000..08e4c7c9fe0ad022b074983e7a008967c2f684d7 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus3.gif new file mode 100644 index 0000000000000000000000000000000000000000..33090cb980c5a59e296e3ecdf06134f8453b8b6e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus4.gif new file mode 100644 index 0000000000000000000000000000000000000000..9a1343668f4355c9085a54a35f266a294ee5d6ff Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus5.gif new file mode 100644 index 0000000000000000000000000000000000000000..bd55d03d3f3ae73e64827e46db815bc7627b5bc0 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..898f2ef055351251445bffc67a96d148dcfb6c98 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..793c0297443923119dfd0af440a2a266f9381ef8 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over4.gif new file mode 100644 index 0000000000000000000000000000000000000000..daa99866bb814ba141815d090fcf75947df03d0c Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over5.gif new file mode 100644 index 0000000000000000000000000000000000000000..a3cd1225a4651b90bffdfd230a0859947c45ac03 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minus_over5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull2.gif new file mode 100644 index 0000000000000000000000000000000000000000..fd2d3ac0ddfe0904038e743a7ec00f2daff385a1 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull3.gif new file mode 100644 index 0000000000000000000000000000000000000000..a27ea1aec3c4d70af15df1a795b6063ebd7b633d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull4.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c1846300d86562a01970da6e31c49d6ba39ef79 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull5.gif new file mode 100644 index 0000000000000000000000000000000000000000..893a3033a816a81b69775ea6540015cb2dbec4f5 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..ebfbb793d33b428b24fddec5e71ac4ec5485e074 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..60dd6cd81b9d0424870a5a14176f1b6f48cb6c66 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over4.gif new file mode 100644 index 0000000000000000000000000000000000000000..e2cc4f953959b041c00255570e12e86246bb2bba Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over5.gif new file mode 100644 index 0000000000000000000000000000000000000000..523d8402437580368d46331f0f54231ee96e502b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_minusfull_over5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus2.gif new file mode 100644 index 0000000000000000000000000000000000000000..02db24175a74ab389e9a9fb8c2cc923a43ba8d22 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus3.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e4902821a4e711e679837b032cc7fc32f77baca Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus4.gif new file mode 100644 index 0000000000000000000000000000000000000000..30438a900aa23f40b2817c0e148bda9a3c268e60 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus5.gif new file mode 100644 index 0000000000000000000000000000000000000000..2911859da7b804d3fff4108ed09338171e759c38 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..9f83ba5158380da4e0d6d36b8ba94bc563cbeee0 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..c4ce660420585c722bc6262abfa4fdd34e64b036 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over4.gif new file mode 100644 index 0000000000000000000000000000000000000000..8900221b33873b74d9979e70a42861bf09103bc3 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over5.gif new file mode 100644 index 0000000000000000000000000000000000000000..04faba92b5f4aaf143f1aa18a721bcfadeb68de4 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plus_over5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull2.gif new file mode 100644 index 0000000000000000000000000000000000000000..bcd6bf600262af44c8b66985ba3a6cf68fc7c63f Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull3.gif new file mode 100644 index 0000000000000000000000000000000000000000..f0e56afe1ff0701f32e4eaaf03da9c746cb3e3d3 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull4.gif new file mode 100644 index 0000000000000000000000000000000000000000..62fc4e0551f6e2d50ccd206c1904745996962218 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull5.gif new file mode 100644 index 0000000000000000000000000000000000000000..669163ab6cf4c3d0dffd787af3884a6e87c46cff Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over2.gif new file mode 100644 index 0000000000000000000000000000000000000000..d23cb5324f9a912788472c4d5177539918303f2f Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over3.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over3.gif new file mode 100644 index 0000000000000000000000000000000000000000..a315054f58255ec8f1bb6c34792a85697b29285e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over3.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over4.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over4.gif new file mode 100644 index 0000000000000000000000000000000000000000..668da6f980b96f6c37873b77f272fcb03d8728b4 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over4.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over5.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over5.gif new file mode 100644 index 0000000000000000000000000000000000000000..34f33319eed298f18ebbdc4672e55545bcf21e36 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_plusfull_over5.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_pt2.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_pt2.gif new file mode 100644 index 0000000000000000000000000000000000000000..8b4b349f2864a55280583af44e0406ecd0a8435d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/rtl_pt2.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/trash.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/trash.gif new file mode 100644 index 0000000000000000000000000000000000000000..cfa0f000e1ed3b61c8737fcfbef4b78035a6abe7 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/trash.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/trashfull.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/trashfull.gif new file mode 100644 index 0000000000000000000000000000000000000000..e1cc61b5503d55c24438eafe1f782a37ac2516cf Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/trashfull.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/unlock.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/unlock.gif new file mode 100644 index 0000000000000000000000000000000000000000..4fd2ec4621a2c1569d818b9d5c35f284322840a8 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/unlock.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/user.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/user.gif new file mode 100644 index 0000000000000000000000000000000000000000..aa598cd5edbc80fe074901121ca549bdd812f84e Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/user.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/wait.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/wait.gif new file mode 100644 index 0000000000000000000000000000000000000000..085ccaecaf5fa5c34bc14cd2c2ed5cbbd8e25dcb Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/wait.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/imgs/watch.gif b/maarch_entreprise/trunk/tools/tafelTree/imgs/watch.gif new file mode 100644 index 0000000000000000000000000000000000000000..2f9a7f842c69c654c5c85baf2ea3285ddd6cc61c Binary files /dev/null and b/maarch_entreprise/trunk/tools/tafelTree/imgs/watch.gif differ diff --git a/maarch_entreprise/trunk/tools/tafelTree/index.html b/maarch_entreprise/trunk/tools/tafelTree/index.html new file mode 100644 index 0000000000000000000000000000000000000000..afd9e56224977dfe75593e065943859a015bf9ad --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/index.html @@ -0,0 +1,319 @@ +<html> +<head> + <title>OpenOfficeGeneration Documentation</title> + <link rel="stylesheet" type="text/css" href="css/tree.css" /> + <style> + body { + background-color: #FFEEFF; + } + .mover { + background-color: #FF9999; + color: #FFEEEE; + } + + .special { + color: #CC0000; + } + + .tafelTree h3, .tafelTree p, .tafelTree ol { + margin: 0; + padding: 0; + } + + .tafelTree p { + padding-bottom: 1em; + } + + .tafelTree h3 { + color: #009900; + } + </style> + <script type="text/javascript" src="js/prototype.js"></script> + <script type="text/javascript" src="js/scriptaculous.js"></script> + <script type="text/javascript" src="Tree-optimized.js"></script> + <script type="text/javascript"> + function opp(branch, response){ + return response; + } + var struct = [ + { + 'id' : 'root0', + 'txt' : 'root 0' + }, + { + 'id':'root1', + 'txt':'TafelTree JS', + 'img':'base.gif', + 'items':[ + { + 'id':'child1', + 'txt':'L\'objet en question', + 'items':[ + { + 'id':'child2', + 'txt':'<span>Ses méthodes</span>' + }, + { + 'id':'3', + 'txt':'Ses propriétés', + 'checkbox':false + }, + { + 'id':'child4', + 'txt':'Ses functions utilisateur (genre onclick)', + 'onclick':function(branch){alert("le texte de ce noeud est le suivant : \n" + branch.struct.txt);}, + 'items' : [ + { + 'id' : 'blu', + 'txt' : 'hop', + 'check':1 + } + ] + }, + { + 'id':'child10', + 'txt':"<div><h3>On peut même mettre de l\'HTML</h3><p>Y\'a rien besoin de spécial, juste avoir :</p><ol><li>des notions du HTML</li><li>de l'imagination</li><li>Echapper les simples quotes (\\' au lieu de \')</li></ol></div>" + }, + { + 'id':'child4t', + 'txt':'Ici, on a une classe CSS particulière', + 'style' : 'special' + }, + { + 'id':'child8', + 'txt':'Celui-ci est draggable', + 'ondrop':function(move, here){return true;} + } + ] + }, + { + 'id':'child5', + 'txt':'Les événements', + 'items':[ + { + 'id':'child6', + 'txt':'Un petit mouseover et mouseout', + 'img':'globe.gif', + 'onmouseover':function(branch){branch.addClass('mover');}, + 'onmouseout':function(branch){branch.removeClass('mover');} + }, + { + 'id':'child7', + 'txt':'Avec un double clic', + 'ondblclick':function(branch){alert('double-clic sur ' + branch.getId());} + }, + { + 'id':'ouvertureinfinie', + 'txt':'Ici, il y a une infinité d\'enfants', + 'onopenpopulate':function(branch, response){return true;}, + 'openlink':'open.php', + 'canhavechildren':true, + 'onopenpopulate':null, + 'openlink':'server/open.php' + }, + { + 'id':'child9', + 'txt':'Contenu éditable', + 'acceptdrop':false, + 'editable':true, + 'onedit':function(branch, newv, oldv){return newv;} + } + ] + }, + { + 'id':'pb', + 'txt':'Poubelle', + 'img':'trash.gif', + 'imgopen':'trashfull.gif', + 'imgclose':'trashfull.gif', + 'draggable':false, + 'last': true + } + ] + } + ]; + var struct2 = [ + { + 'id' : 'root043', + 'txt' : 'root 0' + }]; + var tree1 = null; + var tree2 = null; + function TafelTreeInit () { + tree2 = new TafelTree('test2', struct2, { + 'generate':true + }); + tree1 = new TafelTree('test1', struct, { + 'generate':true, + 'imgBase' : 'imgs/', + 'openAtLoad':true, + 'cookies':true, + 'onDrop':drop, + 'multiline':true, + 'defaultImg':'page.gif', + 'defaultImgSelected':'globe.gif', + 'defaultImgOpen':'folderopen.gif', + 'defaultImgClose':'folder.gif', + 'defaultImgCloseSelected':'unlock.gif', + 'defaultImgOpenSelected':'imgfolder.gif', + 'rtlMode':false, + 'dropALT':false, + 'checkboxes':true, + 'onClick' : testParent, + 'behaviourDrop':'child', + 'dropALT' : false, + 'dropCTRL' : false, + 'bind':[tree2] + }); + var b = tree1.getBranchById('root043'); + alert(b); + } + + function glu (branch) { + return (branch.children.length > 0) ? true : false; + } + + function testParent (branch) { + var p = tree1.getBranches(glu); + var str = ''; + for (var i = 0; i < p.length; i++) { + str += p[i].getText() + ' : ' + p[i].children.length + "\n"; + } + alert(str); + } + function drop () { + return true; + } + function tojson(){ + //tree1.debug(tree1.serialize(true)); + var branch = tree1.getBranchById('child5'); + //tree1.debug(branch.serialize(true)); + tree1.restoreDefault(); + } + </script> +</head> +<body> +<div id="test2"></div> +<a href="#" onClick="tojson()">Serialise</a> +<div class="body"> + <img class="titre" src="imgs/doc.jpg" alt="doc" title="doc" /> + <h1>Génération de Treeview <span>(Javascript)</span></h1> + <h2>Treeview basé sur la libraire <a href="http://script.aculo.us" target="_blank">Script Aculous</a></h2> + <!--<ul id="menu"> + <li><a href="index.html">Accueil</a></li> + <li><a href="install.html">Installation</a></li> + <li><a href="exemples.html">Exemples</a></li> + <li><a href="doc.html">Doc</a></li> + <li><a href="forum.html">Forum</a></li> + <li><a href="liens.html">Liens</a></li> + <li class="ici"><a href="arbre.php">Treeview</a></li> + </ul>--> + <div id="contenu"> + <div class="gauche"> + <h3>Treeview - Accueil</h3> + <div id="test1"></div> + <h4>Comment commencer ?</h4> + <p>C'est très simple, procédons donc pas-à-pas. D'abord, on inclu tous les fichiers nécessaires Javascript et CSS + entre les balises <head></head></p> + <code> +<link rel="stylesheet" type="text/css" href="css/tree.css" /> +<br /><script type="text/javascript" src="js/prototype.js"></script> +<br /><script type="text/javascript" src="js/scriptaculous.js"></script> +<br /><script type="text/javascript" src="Tree.js"></script> + </code> + <p>La CSS est celle contenue dans le dossier CSS du zip. Quand au scripts JS, il faut savoir qu'il est basé sur la + librairie de Script Aculous. Il faut donc intégrer la librairie prototype.js ainsi que scriptaculous.js. Toutes + les deux sont contenues dans le dossier JS. Mais si tu as déjà script aculous quelque part, tu n'es pas obligé + de le remettre.</p> + <p>La dernière librairie, c'est Tree.js. C'est le corps du programme.</p> + <h4>Créer un arbre</h4> + <p>Voici donc comment créer un arbre très simple</p> + <code> +<script type="text/javascript"> +<br />var struct = [ +<br />{ +<br />'id':'root1', +<br />'txt':'Element racine', +<br />'img':'page.gif', // Image s'il n'a pas d'enfants +<br />'imgopen':'folderopen.gif', // Image s'il a des enfants et qu'il est ouvert +<br />'imgclose':'folder.gif', // Image s'il a des enfants et qu'il est fermé +<br />'items':[ +<br /> { +<br /> 'id':'child1', +<br /> 'txt':'Un enfant', +<br /> 'img':'page.gif' +<br /> } +<br />] +<br />} +<br />]; +<br />var tree = new TafelTree('test2', struct, 'tree/imgs/', '100%', 'auto'); +<br />tree.generate(); +<br /></script> + </code> + <script type="text/javascript"> + function load1 () { + var struct = [ + { + 'id':'root1', + 'txt':'Element racine', + 'img':'page.gif', // Image s'il n'a pas d'enfants + 'imgopen':'folderopen.gif', // Image s'il a des enfants et qu'il est ouvert + 'imgclose':'folder.gif', // Image s'il a des enfants et qu'il est fermé + 'items':[ + { + 'id':'child1', + 'txt':'Un enfant', + 'img':'page.gif' + } + ] + } + ]; + var tree2 = new TafelTree('test2', struct, 'imgs/', '100%', 'auto'); + tree2.generate(); + } + Event.observe(window, 'load', load1, false); + </script> + <div id="test2"></div> + <p><a href="download/tafeltree.zip">Download de l'arbre</a></p> + </div><!-- + <div class="droite"> + <div> + <h4>Dernières mise-à-jour</h4> + <p>La dernière mise à jour date du 21 oaût 2006.</p> + <p><a href="download/tafeltree.zip">Téléchargez ici!</a></p> + <cite>Par Tafel</cite> + </div> + <div> + <h4>Accueil</h4> + <p>Les bases. Comment créer un arbre, la logique du truc, tout ça tout ça</p> + <p><a href="arbre.php">Voir la page</a></p> + <cite>Par Tafel</cite> + </div> + <div> + <h4>TafelTree</h4> + <p>L'arbre en détail.</p> + <p><a href="arbre4.html">Voir la page</a></p> + <cite>Par Tafel</cite> + </div> + <div> + <h4>TafelTreeBranch</h4> + <p>Les actions sur la branche. Sa structure et ses méthodes</p> + <p><a href="arbre4.html">Voir la page</a></p> + <cite>Par Tafel</cite> + </div> + <div> + <h4>Documentation</h4> + <p>Une doc rapide et plus ou moins exhaustive</p> + <p><a href="arbre4.html">Voir la page</a></p> + <cite>Par Tafel</cite> + </div> + </div>--> + </div> + <div class="bottom"> + <p>OpenOffice Generation PHP + Treeview JS</p> + <p>Le 26 août 2006, <a href="#" onClick="gereStyle()">Tafel</a>. Optimisé pour Mozilla Firefox</p> + </div> +</div> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tafelTree/js/builder.js b/maarch_entreprise/trunk/tools/tafelTree/js/builder.js new file mode 100644 index 0000000000000000000000000000000000000000..199afc12f6d9cd467ab0103a9b87dc5aa5d5bd17 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/js/builder.js @@ -0,0 +1,131 @@ +// script.aculo.us builder.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 + +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +var Builder = { + NODEMAP: { + AREA: 'map', + CAPTION: 'table', + COL: 'table', + COLGROUP: 'table', + LEGEND: 'fieldset', + OPTGROUP: 'select', + OPTION: 'select', + PARAM: 'object', + TBODY: 'table', + TD: 'table', + TFOOT: 'table', + TH: 'table', + THEAD: 'table', + TR: 'table' + }, + // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, + // due to a Firefox bug + node: function(elementName) { + elementName = elementName.toUpperCase(); + + // try innerHTML approach + var parentTag = this.NODEMAP[elementName] || 'div'; + var parentElement = document.createElement(parentTag); + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; + } catch(e) {} + var element = parentElement.firstChild || null; + + // see if browser added wrapping tags + if(element && (element.tagName.toUpperCase() != elementName)) + element = element.getElementsByTagName(elementName)[0]; + + // fallback to createElement approach + if(!element) element = document.createElement(elementName); + + // abort if nothing could be created + if(!element) return; + + // attributes (or text) + if(arguments[1]) + if(this._isStringOrNumber(arguments[1]) || + (arguments[1] instanceof Array)) { + this._children(element, arguments[1]); + } else { + var attrs = this._attributes(arguments[1]); + if(attrs.length) { + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" +elementName + " " + + attrs + "></" + elementName + ">"; + } catch(e) {} + element = parentElement.firstChild || null; + // workaround firefox 1.0.X bug + if(!element) { + element = document.createElement(elementName); + for(attr in arguments[1]) + element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; + } + if(element.tagName.toUpperCase() != elementName) + element = parentElement.getElementsByTagName(elementName)[0]; + } + } + + // text, or array of children + if(arguments[2]) + this._children(element, arguments[2]); + + return element; + }, + _text: function(text) { + return document.createTextNode(text); + }, + + ATTR_MAP: { + 'className': 'class', + 'htmlFor': 'for' + }, + + _attributes: function(attributes) { + var attrs = []; + for(attribute in attributes) + attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + + '="' + attributes[attribute].toString().escapeHTML() + '"'); + return attrs.join(" "); + }, + _children: function(element, children) { + if(typeof children=='object') { // array can hold nodes and text + children.flatten().each( function(e) { + if(typeof e=='object') + element.appendChild(e) + else + if(Builder._isStringOrNumber(e)) + element.appendChild(Builder._text(e)); + }); + } else + if(Builder._isStringOrNumber(children)) + element.appendChild(Builder._text(children)); + }, + _isStringOrNumber: function(param) { + return(typeof param=='string' || typeof param=='number'); + }, + build: function(html) { + var element = this.node('div'); + $(element).update(html.strip()); + return element.down(); + }, + dump: function(scope) { + if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope + + var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ + "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ + "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ + "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); + + tags.each( function(tag){ + scope[tag] = function() { + return Builder.node.apply(Builder, [tag].concat($A(arguments))); + } + }); + } +} diff --git a/maarch_entreprise/trunk/tools/tafelTree/js/controls.js b/maarch_entreprise/trunk/tools/tafelTree/js/controls.js new file mode 100644 index 0000000000000000000000000000000000000000..d5a16e8c41877ba46d9d18a066a0ba8dc0b35f2d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/js/controls.js @@ -0,0 +1,835 @@ +// script.aculo.us controls.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 + +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005, 2006 Ivan Krstic (http://blogs.law.harvard.edu/ivan) +// (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) +// Contributors: +// Richard Livsey +// Rahul Bhargava +// Rob Wills +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// Autocompleter.Base handles all the autocompletion functionality +// that's independent of the data source for autocompletion. This +// includes drawing the autocompletion menu, observing keyboard +// and mouse events, and similar. +// +// Specific autocompleters need to provide, at the very least, +// a getUpdatedChoices function that will be invoked every time +// the text inside the monitored textbox changes. This method +// should get the text for which to provide autocompletion by +// invoking this.getToken(), NOT by directly accessing +// this.element.value. This is to allow incremental tokenized +// autocompletion. Specific auto-completion logic (AJAX, etc) +// belongs in getUpdatedChoices. +// +// Tokenized incremental autocompletion is enabled automatically +// when an autocompleter is instantiated with the 'tokens' option +// in the options parameter, e.g.: +// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); +// will incrementally autocomplete with a comma as the token. +// Additionally, ',' in the above example can be replaced with +// a token array, e.g. { tokens: [',', '\n'] } which +// enables autocompletion on multiple tokens. This is most +// useful when one of the tokens is \n (a newline), as it +// allows smart autocompletion after linebreaks. + +if(typeof Effect == 'undefined') + throw("controls.js requires including script.aculo.us' effects.js library"); + +var Autocompleter = {} +Autocompleter.Base = function() {}; +Autocompleter.Base.prototype = { + baseInitialize: function(element, update, options) { + this.element = $(element); + this.update = $(update); + this.hasFocus = false; + this.changed = false; + this.active = false; + this.index = 0; + this.entryCount = 0; + + if(this.setOptions) + this.setOptions(options); + else + this.options = options || {}; + + this.options.paramName = this.options.paramName || this.element.name; + this.options.tokens = this.options.tokens || []; + this.options.frequency = this.options.frequency || 0.4; + this.options.minChars = this.options.minChars || 1; + this.options.onShow = this.options.onShow || + function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, { + setHeight: false, + offsetTop: element.offsetHeight + }); + } + Effect.Appear(update,{duration:0.15}); + }; + this.options.onHide = this.options.onHide || + function(element, update){ new Effect.Fade(update,{duration:0.15}) }; + + if(typeof(this.options.tokens) == 'string') + this.options.tokens = new Array(this.options.tokens); + + this.observer = null; + + this.element.setAttribute('autocomplete','off'); + + Element.hide(this.update); + + Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); + Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); + }, + + show: function() { + if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); + if(!this.iefix && + (navigator.appVersion.indexOf('MSIE')>0) && + (navigator.userAgent.indexOf('Opera')<0) && + (Element.getStyle(this.update, 'position')=='absolute')) { + new Insertion.After(this.update, + '<iframe id="' + this.update.id + '_iefix" '+ + 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' + + 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>'); + this.iefix = $(this.update.id+'_iefix'); + } + if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); + }, + + fixIEOverlapping: function() { + Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); + this.iefix.style.zIndex = 1; + this.update.style.zIndex = 2; + Element.show(this.iefix); + }, + + hide: function() { + this.stopIndicator(); + if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); + if(this.iefix) Element.hide(this.iefix); + }, + + startIndicator: function() { + if(this.options.indicator) Element.show(this.options.indicator); + }, + + stopIndicator: function() { + if(this.options.indicator) Element.hide(this.options.indicator); + }, + + onKeyPress: function(event) { + if(this.active) + switch(event.keyCode) { + case Event.KEY_TAB: + case Event.KEY_RETURN: + this.selectEntry(); + Event.stop(event); + case Event.KEY_ESC: + this.hide(); + this.active = false; + Event.stop(event); + return; + case Event.KEY_LEFT: + case Event.KEY_RIGHT: + return; + case Event.KEY_UP: + this.markPrevious(); + this.render(); + if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); + return; + case Event.KEY_DOWN: + this.markNext(); + this.render(); + if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); + return; + } + else + if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || + (navigator.appVersion.indexOf('AppleWebKit') > 0 && event.keyCode == 0)) return; + + this.changed = true; + this.hasFocus = true; + + if(this.observer) clearTimeout(this.observer); + this.observer = + setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); + }, + + activate: function() { + this.changed = false; + this.hasFocus = true; + this.getUpdatedChoices(); + }, + + onHover: function(event) { + var element = Event.findElement(event, 'LI'); + if(this.index != element.autocompleteIndex) + { + this.index = element.autocompleteIndex; + this.render(); + } + Event.stop(event); + }, + + onClick: function(event) { + var element = Event.findElement(event, 'LI'); + this.index = element.autocompleteIndex; + this.selectEntry(); + this.hide(); + }, + + onBlur: function(event) { + // needed to make click events working + setTimeout(this.hide.bind(this), 250); + this.hasFocus = false; + this.active = false; + }, + + render: function() { + if(this.entryCount > 0) { + for (var i = 0; i < this.entryCount; i++) + this.index==i ? + Element.addClassName(this.getEntry(i),"selected") : + Element.removeClassName(this.getEntry(i),"selected"); + + if(this.hasFocus) { + this.show(); + this.active = true; + } + } else { + this.active = false; + this.hide(); + } + }, + + markPrevious: function() { + if(this.index > 0) this.index-- + else this.index = this.entryCount-1; + this.getEntry(this.index).scrollIntoView(true); + }, + + markNext: function() { + if(this.index < this.entryCount-1) this.index++ + else this.index = 0; + this.getEntry(this.index).scrollIntoView(false); + }, + + getEntry: function(index) { + return this.update.firstChild.childNodes[index]; + }, + + getCurrentEntry: function() { + return this.getEntry(this.index); + }, + + selectEntry: function() { + this.active = false; + this.updateElement(this.getCurrentEntry()); + }, + + updateElement: function(selectedElement) { + if (this.options.updateElement) { + this.options.updateElement(selectedElement); + return; + } + var value = ''; + if (this.options.select) { + var nodes = document.getElementsByClassName(this.options.select, selectedElement) || []; + if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); + } else + value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); + + var lastTokenPos = this.findLastToken(); + if (lastTokenPos != -1) { + var newValue = this.element.value.substr(0, lastTokenPos + 1); + var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/); + if (whitespace) + newValue += whitespace[0]; + this.element.value = newValue + value; + } else { + this.element.value = value; + } + this.element.focus(); + + if (this.options.afterUpdateElement) + this.options.afterUpdateElement(this.element, selectedElement); + }, + + updateChoices: function(choices) { + if(!this.changed && this.hasFocus) { + this.update.innerHTML = choices; + Element.cleanWhitespace(this.update); + Element.cleanWhitespace(this.update.down()); + + if(this.update.firstChild && this.update.down().childNodes) { + this.entryCount = + this.update.down().childNodes.length; + for (var i = 0; i < this.entryCount; i++) { + var entry = this.getEntry(i); + entry.autocompleteIndex = i; + this.addObservers(entry); + } + } else { + this.entryCount = 0; + } + + this.stopIndicator(); + this.index = 0; + + if(this.entryCount==1 && this.options.autoSelect) { + this.selectEntry(); + this.hide(); + } else { + this.render(); + } + } + }, + + addObservers: function(element) { + Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); + Event.observe(element, "click", this.onClick.bindAsEventListener(this)); + }, + + onObserverEvent: function() { + this.changed = false; + if(this.getToken().length>=this.options.minChars) { + this.startIndicator(); + this.getUpdatedChoices(); + } else { + this.active = false; + this.hide(); + } + }, + + getToken: function() { + var tokenPos = this.findLastToken(); + if (tokenPos != -1) + var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,''); + else + var ret = this.element.value; + + return /\n/.test(ret) ? '' : ret; + }, + + findLastToken: function() { + var lastTokenPos = -1; + + for (var i=0; i<this.options.tokens.length; i++) { + var thisTokenPos = this.element.value.lastIndexOf(this.options.tokens[i]); + if (thisTokenPos > lastTokenPos) + lastTokenPos = thisTokenPos; + } + return lastTokenPos; + } +} + +Ajax.Autocompleter = Class.create(); +Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), { + initialize: function(element, update, url, options) { + this.baseInitialize(element, update, options); + this.options.asynchronous = true; + this.options.onComplete = this.onComplete.bind(this); + this.options.defaultParams = this.options.parameters || null; + this.url = url; + }, + + getUpdatedChoices: function() { + entry = encodeURIComponent(this.options.paramName) + '=' + + encodeURIComponent(this.getToken()); + + this.options.parameters = this.options.callback ? + this.options.callback(this.element, entry) : entry; + + if(this.options.defaultParams) + this.options.parameters += '&' + this.options.defaultParams; + + new Ajax.Request(this.url, this.options); + }, + + onComplete: function(request) { + this.updateChoices(request.responseText); + } + +}); + +// The local array autocompleter. Used when you'd prefer to +// inject an array of autocompletion options into the page, rather +// than sending out Ajax queries, which can be quite slow sometimes. +// +// The constructor takes four parameters. The first two are, as usual, +// the id of the monitored textbox, and id of the autocompletion menu. +// The third is the array you want to autocomplete from, and the fourth +// is the options block. +// +// Extra local autocompletion options: +// - choices - How many autocompletion choices to offer +// +// - partialSearch - If false, the autocompleter will match entered +// text only at the beginning of strings in the +// autocomplete array. Defaults to true, which will +// match text at the beginning of any *word* in the +// strings in the autocomplete array. If you want to +// search anywhere in the string, additionally set +// the option fullSearch to true (default: off). +// +// - fullSsearch - Search anywhere in autocomplete array strings. +// +// - partialChars - How many characters to enter before triggering +// a partial match (unlike minChars, which defines +// how many characters are required to do any match +// at all). Defaults to 2. +// +// - ignoreCase - Whether to ignore case when autocompleting. +// Defaults to true. +// +// It's possible to pass in a custom function as the 'selector' +// option, if you prefer to write your own autocompletion logic. +// In that case, the other options above will not apply unless +// you support them. + +Autocompleter.Local = Class.create(); +Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), { + initialize: function(element, update, array, options) { + this.baseInitialize(element, update, options); + this.options.array = array; + }, + + getUpdatedChoices: function() { + this.updateChoices(this.options.selector(this)); + }, + + setOptions: function(options) { + this.options = Object.extend({ + choices: 10, + partialSearch: true, + partialChars: 2, + ignoreCase: true, + fullSearch: false, + selector: function(instance) { + var ret = []; // Beginning matches + var partial = []; // Inside matches + var entry = instance.getToken(); + var count = 0; + + for (var i = 0; i < instance.options.array.length && + ret.length < instance.options.choices ; i++) { + + var elem = instance.options.array[i]; + var foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase()) : + elem.indexOf(entry); + + while (foundPos != -1) { + if (foundPos == 0 && elem.length != entry.length) { + ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + + elem.substr(entry.length) + "</li>"); + break; + } else if (entry.length >= instance.options.partialChars && + instance.options.partialSearch && foundPos != -1) { + if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { + partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" + + elem.substr(foundPos, entry.length) + "</strong>" + elem.substr( + foundPos + entry.length) + "</li>"); + break; + } + } + + foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : + elem.indexOf(entry, foundPos + 1); + + } + } + if (partial.length) + ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)) + return "<ul>" + ret.join('') + "</ul>"; + } + }, options || {}); + } +}); + +// AJAX in-place editor +// +// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor + +// Use this if you notice weird scrolling problems on some browsers, +// the DOM might be a bit confused when this gets called so do this +// waits 1 ms (with setTimeout) until it does the activation +Field.scrollFreeActivate = function(field) { + setTimeout(function() { + Field.activate(field); + }, 1); +} + +Ajax.InPlaceEditor = Class.create(); +Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99"; +Ajax.InPlaceEditor.prototype = { + initialize: function(element, url, options) { + this.url = url; + this.element = $(element); + + this.options = Object.extend({ + paramName: "value", + okButton: true, + okText: "ok", + cancelLink: true, + cancelText: "cancel", + savingText: "Saving...", + clickToEditText: "Click to edit", + okText: "ok", + rows: 1, + onComplete: function(transport, element) { + new Effect.Highlight(element, {startcolor: this.options.highlightcolor}); + }, + onFailure: function(transport) { + alert("Error communicating with the server: " + transport.responseText.stripTags()); + }, + callback: function(form) { + return Form.serialize(form); + }, + handleLineBreaks: true, + loadingText: 'Loading...', + savingClassName: 'inplaceeditor-saving', + loadingClassName: 'inplaceeditor-loading', + formClassName: 'inplaceeditor-form', + highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor, + highlightendcolor: "#FFFFFF", + externalControl: null, + submitOnBlur: false, + ajaxOptions: {}, + evalScripts: false + }, options || {}); + + if(!this.options.formId && this.element.id) { + this.options.formId = this.element.id + "-inplaceeditor"; + if ($(this.options.formId)) { + // there's already a form with that name, don't specify an id + this.options.formId = null; + } + } + + if (this.options.externalControl) { + this.options.externalControl = $(this.options.externalControl); + } + + this.originalBackground = Element.getStyle(this.element, 'background-color'); + if (!this.originalBackground) { + this.originalBackground = "transparent"; + } + + this.element.title = this.options.clickToEditText; + + this.onclickListener = this.enterEditMode.bindAsEventListener(this); + this.mouseoverListener = this.enterHover.bindAsEventListener(this); + this.mouseoutListener = this.leaveHover.bindAsEventListener(this); + Event.observe(this.element, 'click', this.onclickListener); + Event.observe(this.element, 'mouseover', this.mouseoverListener); + Event.observe(this.element, 'mouseout', this.mouseoutListener); + if (this.options.externalControl) { + Event.observe(this.options.externalControl, 'click', this.onclickListener); + Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener); + Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener); + } + }, + enterEditMode: function(evt) { + if (this.saving) return; + if (this.editing) return; + this.editing = true; + this.onEnterEditMode(); + if (this.options.externalControl) { + Element.hide(this.options.externalControl); + } + Element.hide(this.element); + this.createForm(); + this.element.parentNode.insertBefore(this.form, this.element); + if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField); + // stop the event to avoid a page refresh in Safari + if (evt) { + Event.stop(evt); + } + return false; + }, + createForm: function() { + this.form = document.createElement("form"); + this.form.id = this.options.formId; + Element.addClassName(this.form, this.options.formClassName) + this.form.onsubmit = this.onSubmit.bind(this); + + this.createEditField(); + + if (this.options.textarea) { + var br = document.createElement("br"); + this.form.appendChild(br); + } + + if (this.options.okButton) { + okButton = document.createElement("input"); + okButton.type = "submit"; + okButton.value = this.options.okText; + okButton.className = 'editor_ok_button'; + this.form.appendChild(okButton); + } + + if (this.options.cancelLink) { + cancelLink = document.createElement("a"); + cancelLink.href = "#"; + cancelLink.appendChild(document.createTextNode(this.options.cancelText)); + cancelLink.onclick = this.onclickCancel.bind(this); + cancelLink.className = 'editor_cancel'; + this.form.appendChild(cancelLink); + } + }, + hasHTMLLineBreaks: function(string) { + if (!this.options.handleLineBreaks) return false; + return string.match(/<br/i) || string.match(/<p>/i); + }, + convertHTMLLineBreaks: function(string) { + return string.replace(/<br>/gi, "\n").replace(/<br\/>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<p>/gi, ""); + }, + createEditField: function() { + var text; + if(this.options.loadTextURL) { + text = this.options.loadingText; + } else { + text = this.getText(); + } + + var obj = this; + + if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) { + this.options.textarea = false; + var textField = document.createElement("input"); + textField.obj = this; + textField.type = "text"; + textField.name = this.options.paramName; + textField.value = text; + textField.style.backgroundColor = this.options.highlightcolor; + textField.className = 'editor_field'; + var size = this.options.size || this.options.cols || 0; + if (size != 0) textField.size = size; + if (this.options.submitOnBlur) + textField.onblur = this.onSubmit.bind(this); + this.editField = textField; + } else { + this.options.textarea = true; + var textArea = document.createElement("textarea"); + textArea.obj = this; + textArea.name = this.options.paramName; + textArea.value = this.convertHTMLLineBreaks(text); + textArea.rows = this.options.rows; + textArea.cols = this.options.cols || 40; + textArea.className = 'editor_field'; + if (this.options.submitOnBlur) + textArea.onblur = this.onSubmit.bind(this); + this.editField = textArea; + } + + if(this.options.loadTextURL) { + this.loadExternalText(); + } + this.form.appendChild(this.editField); + }, + getText: function() { + return this.element.innerHTML; + }, + loadExternalText: function() { + Element.addClassName(this.form, this.options.loadingClassName); + this.editField.disabled = true; + new Ajax.Request( + this.options.loadTextURL, + Object.extend({ + asynchronous: true, + onComplete: this.onLoadedExternalText.bind(this) + }, this.options.ajaxOptions) + ); + }, + onLoadedExternalText: function(transport) { + Element.removeClassName(this.form, this.options.loadingClassName); + this.editField.disabled = false; + this.editField.value = transport.responseText.stripTags(); + Field.scrollFreeActivate(this.editField); + }, + onclickCancel: function() { + this.onComplete(); + this.leaveEditMode(); + return false; + }, + onFailure: function(transport) { + this.options.onFailure(transport); + if (this.oldInnerHTML) { + this.element.innerHTML = this.oldInnerHTML; + this.oldInnerHTML = null; + } + return false; + }, + onSubmit: function() { + // onLoading resets these so we need to save them away for the Ajax call + var form = this.form; + var value = this.editField.value; + + // do this first, sometimes the ajax call returns before we get a chance to switch on Saving... + // which means this will actually switch on Saving... *after* we've left edit mode causing Saving... + // to be displayed indefinitely + this.onLoading(); + + if (this.options.evalScripts) { + new Ajax.Request( + this.url, Object.extend({ + parameters: this.options.callback(form, value), + onComplete: this.onComplete.bind(this), + onFailure: this.onFailure.bind(this), + asynchronous:true, + evalScripts:true + }, this.options.ajaxOptions)); + } else { + new Ajax.Updater( + { success: this.element, + // don't update on failure (this could be an option) + failure: null }, + this.url, Object.extend({ + parameters: this.options.callback(form, value), + onComplete: this.onComplete.bind(this), + onFailure: this.onFailure.bind(this) + }, this.options.ajaxOptions)); + } + // stop the event to avoid a page refresh in Safari + if (arguments.length > 1) { + Event.stop(arguments[0]); + } + return false; + }, + onLoading: function() { + this.saving = true; + this.removeForm(); + this.leaveHover(); + this.showSaving(); + }, + showSaving: function() { + this.oldInnerHTML = this.element.innerHTML; + this.element.innerHTML = this.options.savingText; + Element.addClassName(this.element, this.options.savingClassName); + this.element.style.backgroundColor = this.originalBackground; + Element.show(this.element); + }, + removeForm: function() { + if(this.form) { + if (this.form.parentNode) Element.remove(this.form); + this.form = null; + } + }, + enterHover: function() { + if (this.saving) return; + this.element.style.backgroundColor = this.options.highlightcolor; + if (this.effect) { + this.effect.cancel(); + } + Element.addClassName(this.element, this.options.hoverClassName) + }, + leaveHover: function() { + if (this.options.backgroundColor) { + this.element.style.backgroundColor = this.oldBackground; + } + Element.removeClassName(this.element, this.options.hoverClassName) + if (this.saving) return; + this.effect = new Effect.Highlight(this.element, { + startcolor: this.options.highlightcolor, + endcolor: this.options.highlightendcolor, + restorecolor: this.originalBackground + }); + }, + leaveEditMode: function() { + Element.removeClassName(this.element, this.options.savingClassName); + this.removeForm(); + this.leaveHover(); + this.element.style.backgroundColor = this.originalBackground; + Element.show(this.element); + if (this.options.externalControl) { + Element.show(this.options.externalControl); + } + this.editing = false; + this.saving = false; + this.oldInnerHTML = null; + this.onLeaveEditMode(); + }, + onComplete: function(transport) { + this.leaveEditMode(); + this.options.onComplete.bind(this)(transport, this.element); + }, + onEnterEditMode: function() {}, + onLeaveEditMode: function() {}, + dispose: function() { + if (this.oldInnerHTML) { + this.element.innerHTML = this.oldInnerHTML; + } + this.leaveEditMode(); + Event.stopObserving(this.element, 'click', this.onclickListener); + Event.stopObserving(this.element, 'mouseover', this.mouseoverListener); + Event.stopObserving(this.element, 'mouseout', this.mouseoutListener); + if (this.options.externalControl) { + Event.stopObserving(this.options.externalControl, 'click', this.onclickListener); + Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener); + Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener); + } + } +}; + +Ajax.InPlaceCollectionEditor = Class.create(); +Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype); +Object.extend(Ajax.InPlaceCollectionEditor.prototype, { + createEditField: function() { + if (!this.cached_selectTag) { + var selectTag = document.createElement("select"); + var collection = this.options.collection || []; + var optionTag; + collection.each(function(e,i) { + optionTag = document.createElement("option"); + optionTag.value = (e instanceof Array) ? e[0] : e; + if((typeof this.options.value == 'undefined') && + ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true; + if(this.options.value==optionTag.value) optionTag.selected = true; + optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e)); + selectTag.appendChild(optionTag); + }.bind(this)); + this.cached_selectTag = selectTag; + } + + this.editField = this.cached_selectTag; + if(this.options.loadTextURL) this.loadExternalText(); + this.form.appendChild(this.editField); + this.options.callback = function(form, value) { + return "value=" + encodeURIComponent(value); + } + } +}); + +// Delayed observer, like Form.Element.Observer, +// but waits for delay after last key input +// Ideal for live-search fields + +Form.Element.DelayedObserver = Class.create(); +Form.Element.DelayedObserver.prototype = { + initialize: function(element, delay, callback) { + this.delay = delay || 0.5; + this.element = $(element); + this.callback = callback; + this.timer = null; + this.lastValue = $F(this.element); + Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); + }, + delayedListener: function(event) { + if(this.lastValue == $F(this.element)) return; + if(this.timer) clearTimeout(this.timer); + this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); + this.lastValue = $F(this.element); + }, + onTimerEvent: function() { + this.timer = null; + this.callback(this.element, $F(this.element)); + } +}; diff --git a/maarch_entreprise/trunk/tools/tafelTree/js/dragdrop.js b/maarch_entreprise/trunk/tools/tafelTree/js/dragdrop.js new file mode 100644 index 0000000000000000000000000000000000000000..32c91bc342b43bf441e421700b9a821442cf948b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/js/dragdrop.js @@ -0,0 +1,944 @@ +// script.aculo.us dragdrop.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 + +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005, 2006 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +if(typeof Effect == 'undefined') + throw("dragdrop.js requires including script.aculo.us' effects.js library"); + +var Droppables = { + drops: [], + + remove: function(element) { + this.drops = this.drops.reject(function(d) { return d.element==$(element) }); + }, + + add: function(element) { + element = $(element); + var options = Object.extend({ + greedy: true, + hoverclass: null, + tree: false + }, arguments[1] || {}); + + // cache containers + if(options.containment) { + options._containers = []; + var containment = options.containment; + if((typeof containment == 'object') && + (containment.constructor == Array)) { + containment.each( function(c) { options._containers.push($(c)) }); + } else { + options._containers.push($(containment)); + } + } + + if(options.accept) options.accept = [options.accept].flatten(); + + Element.makePositioned(element); // fix IE + options.element = element; + + this.drops.push(options); + }, + + findDeepestChild: function(drops) { + deepest = drops[0]; + + for (i = 1; i < drops.length; ++i) + if (Element.isParent(drops[i].element, deepest.element)) + deepest = drops[i]; + + return deepest; + }, + + isContained: function(element, drop) { + var containmentNode; + if(drop.tree) { + containmentNode = element.treeNode; + } else { + containmentNode = element.parentNode; + } + return drop._containers.detect(function(c) { return containmentNode == c }); + }, + + isAffected: function(point, element, drop) { + return ( + (drop.element!=element) && + ((!drop._containers) || + this.isContained(element, drop)) && + ((!drop.accept) || + (Element.classNames(element).detect( + function(v) { return drop.accept.include(v) } ) )) && + Position.within(drop.element, point[0], point[1]) ); + }, + + deactivate: function(drop) { + if(drop.hoverclass) + Element.removeClassName(drop.element, drop.hoverclass); + this.last_active = null; + }, + + activate: function(drop) { + if(drop.hoverclass) + Element.addClassName(drop.element, drop.hoverclass); + this.last_active = drop; + }, + + show: function(point, element) { + if(!this.drops.length) return; + var affected = []; + + if(this.last_active) this.deactivate(this.last_active); + this.drops.each( function(drop) { + if(Droppables.isAffected(point, element, drop)) + affected.push(drop); + }); + + if(affected.length>0) { + drop = Droppables.findDeepestChild(affected); + Position.within(drop.element, point[0], point[1]); + if(drop.onHover) + drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); + + Droppables.activate(drop); + } + }, + + fire: function(event, element) { + if(!this.last_active) return; + Position.prepare(); + + if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) + if (this.last_active.onDrop) + this.last_active.onDrop(element, this.last_active.element, event); + }, + + reset: function() { + if(this.last_active) + this.deactivate(this.last_active); + } +} + +var Draggables = { + drags: [], + observers: [], + + register: function(draggable) { + if(this.drags.length == 0) { + this.eventMouseUp = this.endDrag.bindAsEventListener(this); + this.eventMouseMove = this.updateDrag.bindAsEventListener(this); + this.eventKeypress = this.keyPress.bindAsEventListener(this); + + Event.observe(document, "mouseup", this.eventMouseUp); + Event.observe(document, "mousemove", this.eventMouseMove); + Event.observe(document, "keypress", this.eventKeypress); + } + this.drags.push(draggable); + }, + + unregister: function(draggable) { + this.drags = this.drags.reject(function(d) { return d==draggable }); + if(this.drags.length == 0) { + Event.stopObserving(document, "mouseup", this.eventMouseUp); + Event.stopObserving(document, "mousemove", this.eventMouseMove); + Event.stopObserving(document, "keypress", this.eventKeypress); + } + }, + + activate: function(draggable) { + if(draggable.options.delay) { + this._timeout = setTimeout(function() { + Draggables._timeout = null; + window.focus(); + Draggables.activeDraggable = draggable; + }.bind(this), draggable.options.delay); + } else { + window.focus(); // allows keypress events if window isn't currently focused, fails for Safari + this.activeDraggable = draggable; + } + }, + + deactivate: function() { + this.activeDraggable = null; + }, + + updateDrag: function(event) { + if(!this.activeDraggable) return; + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + // Mozilla-based browsers fire successive mousemove events with + // the same coordinates, prevent needless redrawing (moz bug?) + if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; + this._lastPointer = pointer; + + this.activeDraggable.updateDrag(event, pointer); + }, + + endDrag: function(event) { + if(this._timeout) { + clearTimeout(this._timeout); + this._timeout = null; + } + if(!this.activeDraggable) return; + this._lastPointer = null; + this.activeDraggable.endDrag(event); + this.activeDraggable = null; + }, + + keyPress: function(event) { + if(this.activeDraggable) + this.activeDraggable.keyPress(event); + }, + + addObserver: function(observer) { + this.observers.push(observer); + this._cacheObserverCallbacks(); + }, + + removeObserver: function(element) { // element instead of observer fixes mem leaks + this.observers = this.observers.reject( function(o) { return o.element==element }); + this._cacheObserverCallbacks(); + }, + + notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' + if(this[eventName+'Count'] > 0) + this.observers.each( function(o) { + if(o[eventName]) o[eventName](eventName, draggable, event); + }); + if(draggable.options[eventName]) draggable.options[eventName](draggable, event); + }, + + _cacheObserverCallbacks: function() { + ['onStart','onEnd','onDrag'].each( function(eventName) { + Draggables[eventName+'Count'] = Draggables.observers.select( + function(o) { return o[eventName]; } + ).length; + }); + } +} + +/*--------------------------------------------------------------------------*/ + +var Draggable = Class.create(); +Draggable._dragging = {}; + +Draggable.prototype = { + initialize: function(element) { + var defaults = { + handle: false, + reverteffect: function(element, top_offset, left_offset) { + var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; + new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, + queue: {scope:'_draggable', position:'end'} + }); + }, + endeffect: function(element) { + var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0; + new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, + queue: {scope:'_draggable', position:'end'}, + afterFinish: function(){ + Draggable._dragging[element] = false + } + }); + }, + zindex: 1000, + revert: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } + delay: 0 + }; + + if(!arguments[1] || typeof arguments[1].endeffect == 'undefined') + Object.extend(defaults, { + starteffect: function(element) { + element._opacity = Element.getOpacity(element); + Draggable._dragging[element] = true; + new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); + } + }); + + var options = Object.extend(defaults, arguments[1] || {}); + + this.element = $(element); + + if(options.handle && (typeof options.handle == 'string')) + this.handle = this.element.down('.'+options.handle, 0); + + if(!this.handle) this.handle = $(options.handle); + if(!this.handle) this.handle = this.element; + + if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { + options.scroll = $(options.scroll); + this._isScrollChild = Element.childOf(this.element, options.scroll); + } + + Element.makePositioned(this.element); // fix IE + + this.delta = this.currentDelta(); + this.options = options; + this.dragging = false; + + this.eventMouseDown = this.initDrag.bindAsEventListener(this); + Event.observe(this.handle, "mousedown", this.eventMouseDown); + + Draggables.register(this); + }, + + destroy: function() { + Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); + Draggables.unregister(this); + }, + + currentDelta: function() { + return([ + parseInt(Element.getStyle(this.element,'left') || '0'), + parseInt(Element.getStyle(this.element,'top') || '0')]); + }, + + initDrag: function(event) { + if(typeof Draggable._dragging[this.element] != 'undefined' && + Draggable._dragging[this.element]) return; + if(Event.isLeftClick(event)) { + // abort on form elements, fixes a Firefox issue + var src = Event.element(event); + if((tag_name = src.tagName.toUpperCase()) && ( + tag_name=='INPUT' || + tag_name=='SELECT' || + tag_name=='OPTION' || + tag_name=='BUTTON' || + tag_name=='TEXTAREA')) return; + + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var pos = Position.cumulativeOffset(this.element); + this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); + + Draggables.activate(this); + Event.stop(event); + } + }, + + startDrag: function(event) { + this.dragging = true; + + if(this.options.zindex) { + this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); + this.element.style.zIndex = this.options.zindex; + } + + if(this.options.ghosting) { + this._clone = this.element.cloneNode(true); + Position.absolutize(this.element); + this.element.parentNode.insertBefore(this._clone, this.element); + } + + if(this.options.scroll) { + if (this.options.scroll == window) { + var where = this._getWindowScroll(this.options.scroll); + this.originalScrollLeft = where.left; + this.originalScrollTop = where.top; + } else { + this.originalScrollLeft = this.options.scroll.scrollLeft; + this.originalScrollTop = this.options.scroll.scrollTop; + } + } + + Draggables.notify('onStart', this, event); + + if(this.options.starteffect) this.options.starteffect(this.element); + }, + + updateDrag: function(event, pointer) { + if(!this.dragging) this.startDrag(event); + Position.prepare(); + Droppables.show(pointer, this.element); + Draggables.notify('onDrag', this, event); + + this.draw(pointer); + if(this.options.change) this.options.change(this); + + if(this.options.scroll) { + this.stopScrolling(); + + var p; + if (this.options.scroll == window) { + with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } + } else { + p = Position.page(this.options.scroll); + p[0] += this.options.scroll.scrollLeft + Position.deltaX; + p[1] += this.options.scroll.scrollTop + Position.deltaY; + p.push(p[0]+this.options.scroll.offsetWidth); + p.push(p[1]+this.options.scroll.offsetHeight); + } + var speed = [0,0]; + if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); + if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); + if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); + if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); + this.startScrolling(speed); + } + + // fix AppleWebKit rendering + if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); + + Event.stop(event); + }, + + finishDrag: function(event, success) { + this.dragging = false; + + if(this.options.ghosting) { + Position.relativize(this.element); + Element.remove(this._clone); + this._clone = null; + } + + if(success) Droppables.fire(event, this.element); + Draggables.notify('onEnd', this, event); + + var revert = this.options.revert; + if(revert && typeof revert == 'function') revert = revert(this.element); + + var d = this.currentDelta(); + if(revert && this.options.reverteffect) { + this.options.reverteffect(this.element, + d[1]-this.delta[1], d[0]-this.delta[0]); + } else { + this.delta = d; + } + + if(this.options.zindex) + this.element.style.zIndex = this.originalZ; + + if(this.options.endeffect) + this.options.endeffect(this.element); + + Draggables.deactivate(this); + Droppables.reset(); + }, + + keyPress: function(event) { + if(event.keyCode!=Event.KEY_ESC) return; + this.finishDrag(event, false); + Event.stop(event); + }, + + endDrag: function(event) { + if(!this.dragging) return; + this.stopScrolling(); + this.finishDrag(event, true); + Event.stop(event); + }, + + draw: function(point) { + var pos = Position.cumulativeOffset(this.element); + if(this.options.ghosting) { + var r = Position.realOffset(this.element); + pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; + } + + var d = this.currentDelta(); + pos[0] -= d[0]; pos[1] -= d[1]; + + if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { + pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; + pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; + } + + var p = [0,1].map(function(i){ + return (point[i]-pos[i]-this.offset[i]) + }.bind(this)); + + if(this.options.snap) { + if(typeof this.options.snap == 'function') { + p = this.options.snap(p[0],p[1],this); + } else { + if(this.options.snap instanceof Array) { + p = p.map( function(v, i) { + return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this)) + } else { + p = p.map( function(v) { + return Math.round(v/this.options.snap)*this.options.snap }.bind(this)) + } + }} + + var style = this.element.style; + if((!this.options.constraint) || (this.options.constraint=='horizontal')) + style.left = p[0] + "px"; + if((!this.options.constraint) || (this.options.constraint=='vertical')) + style.top = p[1] + "px"; + + if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering + }, + + stopScrolling: function() { + if(this.scrollInterval) { + clearInterval(this.scrollInterval); + this.scrollInterval = null; + Draggables._lastScrollPointer = null; + } + }, + + startScrolling: function(speed) { + if(!(speed[0] || speed[1])) return; + this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; + this.lastScrolled = new Date(); + this.scrollInterval = setInterval(this.scroll.bind(this), 10); + }, + + scroll: function() { + var current = new Date(); + var delta = current - this.lastScrolled; + this.lastScrolled = current; + if(this.options.scroll == window) { + with (this._getWindowScroll(this.options.scroll)) { + if (this.scrollSpeed[0] || this.scrollSpeed[1]) { + var d = delta / 1000; + this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); + } + } + } else { + this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; + this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; + } + + Position.prepare(); + Droppables.show(Draggables._lastPointer, this.element); + Draggables.notify('onDrag', this); + if (this._isScrollChild) { + Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); + Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; + Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; + if (Draggables._lastScrollPointer[0] < 0) + Draggables._lastScrollPointer[0] = 0; + if (Draggables._lastScrollPointer[1] < 0) + Draggables._lastScrollPointer[1] = 0; + this.draw(Draggables._lastScrollPointer); + } + + if(this.options.change) this.options.change(this); + }, + + _getWindowScroll: function(w) { + var T, L, W, H; + with (w.document) { + if (w.document.documentElement && documentElement.scrollTop) { + T = documentElement.scrollTop; + L = documentElement.scrollLeft; + } else if (w.document.body) { + T = body.scrollTop; + L = body.scrollLeft; + } + if (w.innerWidth) { + W = w.innerWidth; + H = w.innerHeight; + } else if (w.document.documentElement && documentElement.clientWidth) { + W = documentElement.clientWidth; + H = documentElement.clientHeight; + } else { + W = body.offsetWidth; + H = body.offsetHeight + } + } + return { top: T, left: L, width: W, height: H }; + } +} + +/*--------------------------------------------------------------------------*/ + +var SortableObserver = Class.create(); +SortableObserver.prototype = { + initialize: function(element, observer) { + this.element = $(element); + this.observer = observer; + this.lastValue = Sortable.serialize(this.element); + }, + + onStart: function() { + this.lastValue = Sortable.serialize(this.element); + }, + + onEnd: function() { + Sortable.unmark(); + if(this.lastValue != Sortable.serialize(this.element)) + this.observer(this.element) + } +} + +var Sortable = { + SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, + + sortables: {}, + + _findRootElement: function(element) { + while (element.tagName.toUpperCase() != "BODY") { + if(element.id && Sortable.sortables[element.id]) return element; + element = element.parentNode; + } + }, + + options: function(element) { + element = Sortable._findRootElement($(element)); + if(!element) return; + return Sortable.sortables[element.id]; + }, + + destroy: function(element){ + var s = Sortable.options(element); + + if(s) { + Draggables.removeObserver(s.element); + s.droppables.each(function(d){ Droppables.remove(d) }); + s.draggables.invoke('destroy'); + + delete Sortable.sortables[s.element.id]; + } + }, + + create: function(element) { + element = $(element); + var options = Object.extend({ + element: element, + tag: 'li', // assumes li children, override with tag: 'tagname' + dropOnEmpty: false, + tree: false, + treeTag: 'ul', + overlap: 'vertical', // one of 'vertical', 'horizontal' + constraint: 'vertical', // one of 'vertical', 'horizontal', false + containment: element, // also takes array of elements (or id's); or false + handle: false, // or a CSS class + only: false, + delay: 0, + hoverclass: null, + ghosting: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + format: this.SERIALIZE_RULE, + onChange: Prototype.emptyFunction, + onUpdate: Prototype.emptyFunction + }, arguments[1] || {}); + + // clear any old sortable with same element + this.destroy(element); + + // build options for the draggables + var options_for_draggable = { + revert: true, + scroll: options.scroll, + scrollSpeed: options.scrollSpeed, + scrollSensitivity: options.scrollSensitivity, + delay: options.delay, + ghosting: options.ghosting, + constraint: options.constraint, + handle: options.handle }; + + if(options.starteffect) + options_for_draggable.starteffect = options.starteffect; + + if(options.reverteffect) + options_for_draggable.reverteffect = options.reverteffect; + else + if(options.ghosting) options_for_draggable.reverteffect = function(element) { + element.style.top = 0; + element.style.left = 0; + }; + + if(options.endeffect) + options_for_draggable.endeffect = options.endeffect; + + if(options.zindex) + options_for_draggable.zindex = options.zindex; + + // build options for the droppables + var options_for_droppable = { + overlap: options.overlap, + containment: options.containment, + tree: options.tree, + hoverclass: options.hoverclass, + onHover: Sortable.onHover + } + + var options_for_tree = { + onHover: Sortable.onEmptyHover, + overlap: options.overlap, + containment: options.containment, + hoverclass: options.hoverclass + } + + // fix for gecko engine + Element.cleanWhitespace(element); + + options.draggables = []; + options.droppables = []; + + // drop on empty handling + if(options.dropOnEmpty || options.tree) { + Droppables.add(element, options_for_tree); + options.droppables.push(element); + } + + (this.findElements(element, options) || []).each( function(e) { + // handles are per-draggable + var handle = options.handle ? + $(e).down('.'+options.handle,0) : e; + options.draggables.push( + new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); + Droppables.add(e, options_for_droppable); + if(options.tree) e.treeNode = element; + options.droppables.push(e); + }); + + if(options.tree) { + (Sortable.findTreeElements(element, options) || []).each( function(e) { + Droppables.add(e, options_for_tree); + e.treeNode = element; + options.droppables.push(e); + }); + } + + // keep reference + this.sortables[element.id] = options; + + // for onupdate + Draggables.addObserver(new SortableObserver(element, options.onUpdate)); + + }, + + // return all suitable-for-sortable elements in a guaranteed order + findElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.tag); + }, + + findTreeElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.treeTag); + }, + + onHover: function(element, dropon, overlap) { + if(Element.isParent(dropon, element)) return; + + if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { + return; + } else if(overlap>0.5) { + Sortable.mark(dropon, 'before'); + if(dropon.previousSibling != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, dropon); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } else { + Sortable.mark(dropon, 'after'); + var nextElement = dropon.nextSibling || null; + if(nextElement != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, nextElement); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } + }, + + onEmptyHover: function(element, dropon, overlap) { + var oldParentNode = element.parentNode; + var droponOptions = Sortable.options(dropon); + + if(!Element.isParent(dropon, element)) { + var index; + + var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); + var child = null; + + if(children) { + var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); + + for (index = 0; index < children.length; index += 1) { + if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { + offset -= Element.offsetSize (children[index], droponOptions.overlap); + } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { + child = index + 1 < children.length ? children[index + 1] : null; + break; + } else { + child = children[index]; + break; + } + } + } + + dropon.insertBefore(element, child); + + Sortable.options(oldParentNode).onChange(element); + droponOptions.onChange(element); + } + }, + + unmark: function() { + if(Sortable._marker) Sortable._marker.hide(); + }, + + mark: function(dropon, position) { + // mark on ghosting only + var sortable = Sortable.options(dropon.parentNode); + if(sortable && !sortable.ghosting) return; + + if(!Sortable._marker) { + Sortable._marker = + ($('dropmarker') || Element.extend(document.createElement('DIV'))). + hide().addClassName('dropmarker').setStyle({position:'absolute'}); + document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); + } + var offsets = Position.cumulativeOffset(dropon); + Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); + + if(position=='after') + if(sortable.overlap == 'horizontal') + Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); + else + Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); + + Sortable._marker.show(); + }, + + _tree: function(element, options, parent) { + var children = Sortable.findElements(element, options) || []; + + for (var i = 0; i < children.length; ++i) { + var match = children[i].id.match(options.format); + + if (!match) continue; + + var child = { + id: encodeURIComponent(match ? match[1] : null), + element: element, + parent: parent, + children: [], + position: parent.children.length, + container: $(children[i]).down(options.treeTag) + } + + /* Get the element containing the children and recurse over it */ + if (child.container) + this._tree(child.container, options, child) + + parent.children.push (child); + } + + return parent; + }, + + tree: function(element) { + element = $(element); + var sortableOptions = this.options(element); + var options = Object.extend({ + tag: sortableOptions.tag, + treeTag: sortableOptions.treeTag, + only: sortableOptions.only, + name: element.id, + format: sortableOptions.format + }, arguments[1] || {}); + + var root = { + id: null, + parent: null, + children: [], + container: element, + position: 0 + } + + return Sortable._tree(element, options, root); + }, + + /* Construct a [i] index for a particular node */ + _constructIndex: function(node) { + var index = ''; + do { + if (node.id) index = '[' + node.position + ']' + index; + } while ((node = node.parent) != null); + return index; + }, + + sequence: function(element) { + element = $(element); + var options = Object.extend(this.options(element), arguments[1] || {}); + + return $(this.findElements(element, options) || []).map( function(item) { + return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; + }); + }, + + setSequence: function(element, new_sequence) { + element = $(element); + var options = Object.extend(this.options(element), arguments[2] || {}); + + var nodeMap = {}; + this.findElements(element, options).each( function(n) { + if (n.id.match(options.format)) + nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; + n.parentNode.removeChild(n); + }); + + new_sequence.each(function(ident) { + var n = nodeMap[ident]; + if (n) { + n[1].appendChild(n[0]); + delete nodeMap[ident]; + } + }); + }, + + serialize: function(element) { + element = $(element); + var options = Object.extend(Sortable.options(element), arguments[1] || {}); + var name = encodeURIComponent( + (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); + + if (options.tree) { + return Sortable.tree(element, arguments[1]).children.map( function (item) { + return [name + Sortable._constructIndex(item) + "[id]=" + + encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); + }).flatten().join('&'); + } else { + return Sortable.sequence(element, arguments[1]).map( function(item) { + return name + "[]=" + encodeURIComponent(item); + }).join('&'); + } + } +} + +// Returns true if child is contained within element +Element.isParent = function(child, element) { + if (!child.parentNode || child == element) return false; + if (child.parentNode == element) return true; + return Element.isParent(child.parentNode, element); +} + +Element.findChildren = function(element, only, recursive, tagName) { + if(!element.hasChildNodes()) return null; + tagName = tagName.toUpperCase(); + if(only) only = [only].flatten(); + var elements = []; + $A(element.childNodes).each( function(e) { + if(e.tagName && e.tagName.toUpperCase()==tagName && + (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) + elements.push(e); + if(recursive) { + var grandchildren = Element.findChildren(e, only, recursive, tagName); + if(grandchildren) elements.push(grandchildren); + } + }); + + return (elements.length>0 ? elements.flatten() : []); +} + +Element.offsetSize = function (element, type) { + return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; +} diff --git a/maarch_entreprise/trunk/tools/tafelTree/js/effects.js b/maarch_entreprise/trunk/tools/tafelTree/js/effects.js new file mode 100644 index 0000000000000000000000000000000000000000..06f59b47698e61d0f4c63bd8a5147147d0217b04 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/js/effects.js @@ -0,0 +1,1090 @@ +// script.aculo.us effects.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 + +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// Contributors: +// Justin Palmer (http://encytemedia.com/) +// Mark Pilgrim (http://diveintomark.org/) +// Martin Bialasinki +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// converts rgb() and #xxx to #xxxxxx format, +// returns self (or first argument) if not convertable +String.prototype.parseColor = function() { + var color = '#'; + if(this.slice(0,4) == 'rgb(') { + var cols = this.slice(4,this.length-1).split(','); + var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); + } else { + if(this.slice(0,1) == '#') { + if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); + if(this.length==7) color = this.toLowerCase(); + } + } + return(color.length==7 ? color : (arguments[0] || this)); +} + +/*--------------------------------------------------------------------------*/ + +Element.collectTextNodes = function(element) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); + }).flatten().join(''); +} + +Element.collectTextNodesIgnoreClass = function(element, className) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? + Element.collectTextNodesIgnoreClass(node, className) : '')); + }).flatten().join(''); +} + +Element.setContentZoom = function(element, percent) { + element = $(element); + element.setStyle({fontSize: (percent/100) + 'em'}); + if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); + return element; +} + +Element.getOpacity = function(element){ + return $(element).getStyle('opacity'); +} + +Element.setOpacity = function(element, value){ + return $(element).setStyle({opacity:value}); +} + +Element.getInlineOpacity = function(element){ + return $(element).style.opacity || ''; +} + +Element.forceRerendering = function(element) { + try { + element = $(element); + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch(e) { } +}; + +/*--------------------------------------------------------------------------*/ + +Array.prototype.call = function() { + var args = arguments; + this.each(function(f){ f.apply(this, args) }); +} + +/*--------------------------------------------------------------------------*/ + +var Effect = { + _elementDoesNotExistError: { + name: 'ElementDoesNotExistError', + message: 'The specified DOM element does not exist, but is required for this effect to operate' + }, + tagifyText: function(element) { + if(typeof Builder == 'undefined') + throw("Effect.tagifyText requires including script.aculo.us' builder.js library"); + + var tagifyStyle = 'position:relative'; + if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1'; + + element = $(element); + $A(element.childNodes).each( function(child) { + if(child.nodeType==3) { + child.nodeValue.toArray().each( function(character) { + element.insertBefore( + Builder.node('span',{style: tagifyStyle}, + character == ' ' ? String.fromCharCode(160) : character), + child); + }); + Element.remove(child); + } + }); + }, + multiple: function(element, effect) { + var elements; + if(((typeof element == 'object') || + (typeof element == 'function')) && + (element.length)) + elements = element; + else + elements = $(element).childNodes; + + var options = Object.extend({ + speed: 0.1, + delay: 0.0 + }, arguments[2] || {}); + var masterDelay = options.delay; + + $A(elements).each( function(element, index) { + new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); + }); + }, + PAIRS: { + 'slide': ['SlideDown','SlideUp'], + 'blind': ['BlindDown','BlindUp'], + 'appear': ['Appear','Fade'] + }, + toggle: function(element, effect) { + element = $(element); + effect = (effect || 'appear').toLowerCase(); + var options = Object.extend({ + queue: { position:'end', scope:(element.id || 'global'), limit: 1 } + }, arguments[2] || {}); + Effect[element.visible() ? + Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); + } +}; + +var Effect2 = Effect; // deprecated + +/* ------------- transitions ------------- */ + +Effect.Transitions = { + linear: Prototype.K, + sinoidal: function(pos) { + return (-Math.cos(pos*Math.PI)/2) + 0.5; + }, + reverse: function(pos) { + return 1-pos; + }, + flicker: function(pos) { + return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; + }, + wobble: function(pos) { + return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; + }, + pulse: function(pos, pulses) { + pulses = pulses || 5; + return ( + Math.round((pos % (1/pulses)) * pulses) == 0 ? + ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) : + 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) + ); + }, + none: function(pos) { + return 0; + }, + full: function(pos) { + return 1; + } +}; + +/* ------------- core effects ------------- */ + +Effect.ScopedQueue = Class.create(); +Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { + initialize: function() { + this.effects = []; + this.interval = null; + }, + _each: function(iterator) { + this.effects._each(iterator); + }, + add: function(effect) { + var timestamp = new Date().getTime(); + + var position = (typeof effect.options.queue == 'string') ? + effect.options.queue : effect.options.queue.position; + + switch(position) { + case 'front': + // move unstarted effects after this effect + this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { + e.startOn += effect.finishOn; + e.finishOn += effect.finishOn; + }); + break; + case 'with-last': + timestamp = this.effects.pluck('startOn').max() || timestamp; + break; + case 'end': + // start effect after last queued effect has finished + timestamp = this.effects.pluck('finishOn').max() || timestamp; + break; + } + + effect.startOn += timestamp; + effect.finishOn += timestamp; + + if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) + this.effects.push(effect); + + if(!this.interval) + this.interval = setInterval(this.loop.bind(this), 15); + }, + remove: function(effect) { + this.effects = this.effects.reject(function(e) { return e==effect }); + if(this.effects.length == 0) { + clearInterval(this.interval); + this.interval = null; + } + }, + loop: function() { + var timePos = new Date().getTime(); + for(var i=0, len=this.effects.length;i<len;i++) + if(this.effects[i]) this.effects[i].loop(timePos); + } +}); + +Effect.Queues = { + instances: $H(), + get: function(queueName) { + if(typeof queueName != 'string') return queueName; + + if(!this.instances[queueName]) + this.instances[queueName] = new Effect.ScopedQueue(); + + return this.instances[queueName]; + } +} +Effect.Queue = Effect.Queues.get('global'); + +Effect.DefaultOptions = { + transition: Effect.Transitions.sinoidal, + duration: 1.0, // seconds + fps: 60.0, // max. 60fps due to Effect.Queue implementation + sync: false, // true for combining + from: 0.0, + to: 1.0, + delay: 0.0, + queue: 'parallel' +} + +Effect.Base = function() {}; +Effect.Base.prototype = { + position: null, + start: function(options) { + this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {}); + this.currentFrame = 0; + this.state = 'idle'; + this.startOn = this.options.delay*1000; + this.finishOn = this.startOn + (this.options.duration*1000); + this.event('beforeStart'); + if(!this.options.sync) + Effect.Queues.get(typeof this.options.queue == 'string' ? + 'global' : this.options.queue.scope).add(this); + }, + loop: function(timePos) { + if(timePos >= this.startOn) { + if(timePos >= this.finishOn) { + this.render(1.0); + this.cancel(); + this.event('beforeFinish'); + if(this.finish) this.finish(); + this.event('afterFinish'); + return; + } + var pos = (timePos - this.startOn) / (this.finishOn - this.startOn); + var frame = Math.round(pos * this.options.fps * this.options.duration); + if(frame > this.currentFrame) { + this.render(pos); + this.currentFrame = frame; + } + } + }, + render: function(pos) { + if(this.state == 'idle') { + this.state = 'running'; + this.event('beforeSetup'); + if(this.setup) this.setup(); + this.event('afterSetup'); + } + if(this.state == 'running') { + if(this.options.transition) pos = this.options.transition(pos); + pos *= (this.options.to-this.options.from); + pos += this.options.from; + this.position = pos; + this.event('beforeUpdate'); + if(this.update) this.update(pos); + this.event('afterUpdate'); + } + }, + cancel: function() { + if(!this.options.sync) + Effect.Queues.get(typeof this.options.queue == 'string' ? + 'global' : this.options.queue.scope).remove(this); + this.state = 'finished'; + }, + event: function(eventName) { + if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); + if(this.options[eventName]) this.options[eventName](this); + }, + inspect: function() { + var data = $H(); + for(property in this) + if(typeof this[property] != 'function') data[property] = this[property]; + return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>'; + } +} + +Effect.Parallel = Class.create(); +Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), { + initialize: function(effects) { + this.effects = effects || []; + this.start(arguments[1]); + }, + update: function(position) { + this.effects.invoke('render', position); + }, + finish: function(position) { + this.effects.each( function(effect) { + effect.render(1.0); + effect.cancel(); + effect.event('beforeFinish'); + if(effect.finish) effect.finish(position); + effect.event('afterFinish'); + }); + } +}); + +Effect.Event = Class.create(); +Object.extend(Object.extend(Effect.Event.prototype, Effect.Base.prototype), { + initialize: function() { + var options = Object.extend({ + duration: 0 + }, arguments[0] || {}); + this.start(options); + }, + update: Prototype.emptyFunction +}); + +Effect.Opacity = Class.create(); +Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + if(!this.element) throw(Effect._elementDoesNotExistError); + // make this work on IE on elements without 'layout' + if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + var options = Object.extend({ + from: this.element.getOpacity() || 0.0, + to: 1.0 + }, arguments[1] || {}); + this.start(options); + }, + update: function(position) { + this.element.setOpacity(position); + } +}); + +Effect.Move = Class.create(); +Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + if(!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + x: 0, + y: 0, + mode: 'relative' + }, arguments[1] || {}); + this.start(options); + }, + setup: function() { + // Bug in Opera: Opera returns the "real" position of a static element or + // relative element that does not have top/left explicitly set. + // ==> Always set top and left for position relative elements in your stylesheets + // (to 0 if you do not need them) + this.element.makePositioned(); + this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); + this.originalTop = parseFloat(this.element.getStyle('top') || '0'); + if(this.options.mode == 'absolute') { + // absolute movement, so we need to calc deltaX and deltaY + this.options.x = this.options.x - this.originalLeft; + this.options.y = this.options.y - this.originalTop; + } + }, + update: function(position) { + this.element.setStyle({ + left: Math.round(this.options.x * position + this.originalLeft) + 'px', + top: Math.round(this.options.y * position + this.originalTop) + 'px' + }); + } +}); + +// for backwards compatibility +Effect.MoveBy = function(element, toTop, toLeft) { + return new Effect.Move(element, + Object.extend({ x: toLeft, y: toTop }, arguments[3] || {})); +}; + +Effect.Scale = Class.create(); +Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), { + initialize: function(element, percent) { + this.element = $(element); + if(!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + scaleX: true, + scaleY: true, + scaleContent: true, + scaleFromCenter: false, + scaleMode: 'box', // 'box' or 'contents' or {} with provided values + scaleFrom: 100.0, + scaleTo: percent + }, arguments[2] || {}); + this.start(options); + }, + setup: function() { + this.restoreAfterFinish = this.options.restoreAfterFinish || false; + this.elementPositioning = this.element.getStyle('position'); + + this.originalStyle = {}; + ['top','left','width','height','fontSize'].each( function(k) { + this.originalStyle[k] = this.element.style[k]; + }.bind(this)); + + this.originalTop = this.element.offsetTop; + this.originalLeft = this.element.offsetLeft; + + var fontSize = this.element.getStyle('font-size') || '100%'; + ['em','px','%','pt'].each( function(fontSizeType) { + if(fontSize.indexOf(fontSizeType)>0) { + this.fontSize = parseFloat(fontSize); + this.fontSizeType = fontSizeType; + } + }.bind(this)); + + this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; + + this.dims = null; + if(this.options.scaleMode=='box') + this.dims = [this.element.offsetHeight, this.element.offsetWidth]; + if(/^content/.test(this.options.scaleMode)) + this.dims = [this.element.scrollHeight, this.element.scrollWidth]; + if(!this.dims) + this.dims = [this.options.scaleMode.originalHeight, + this.options.scaleMode.originalWidth]; + }, + update: function(position) { + var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); + if(this.options.scaleContent && this.fontSize) + this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); + this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); + }, + finish: function(position) { + if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle); + }, + setDimensions: function(height, width) { + var d = {}; + if(this.options.scaleX) d.width = Math.round(width) + 'px'; + if(this.options.scaleY) d.height = Math.round(height) + 'px'; + if(this.options.scaleFromCenter) { + var topd = (height - this.dims[0])/2; + var leftd = (width - this.dims[1])/2; + if(this.elementPositioning == 'absolute') { + if(this.options.scaleY) d.top = this.originalTop-topd + 'px'; + if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; + } else { + if(this.options.scaleY) d.top = -topd + 'px'; + if(this.options.scaleX) d.left = -leftd + 'px'; + } + } + this.element.setStyle(d); + } +}); + +Effect.Highlight = Class.create(); +Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + if(!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {}); + this.start(options); + }, + setup: function() { + // Prevent executing on elements not in the layout flow + if(this.element.getStyle('display')=='none') { this.cancel(); return; } + // Disable background image during the effect + this.oldStyle = {}; + if (!this.options.keepBackgroundImage) { + this.oldStyle.backgroundImage = this.element.getStyle('background-image'); + this.element.setStyle({backgroundImage: 'none'}); + } + if(!this.options.endcolor) + this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); + if(!this.options.restorecolor) + this.options.restorecolor = this.element.getStyle('background-color'); + // init color calculations + this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); + this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); + }, + update: function(position) { + this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ + return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) }); + }, + finish: function() { + this.element.setStyle(Object.extend(this.oldStyle, { + backgroundColor: this.options.restorecolor + })); + } +}); + +Effect.ScrollTo = Class.create(); +Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + this.start(arguments[1] || {}); + }, + setup: function() { + Position.prepare(); + var offsets = Position.cumulativeOffset(this.element); + if(this.options.offset) offsets[1] += this.options.offset; + var max = window.innerHeight ? + window.height - window.innerHeight : + document.body.scrollHeight - + (document.documentElement.clientHeight ? + document.documentElement.clientHeight : document.body.clientHeight); + this.scrollStart = Position.deltaY; + this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart; + }, + update: function(position) { + Position.prepare(); + window.scrollTo(Position.deltaX, + this.scrollStart + (position*this.delta)); + } +}); + +/* ------------- combination effects ------------- */ + +Effect.Fade = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + var options = Object.extend({ + from: element.getOpacity() || 1.0, + to: 0.0, + afterFinishInternal: function(effect) { + if(effect.options.to!=0) return; + effect.element.hide().setStyle({opacity: oldOpacity}); + }}, arguments[1] || {}); + return new Effect.Opacity(element,options); +} + +Effect.Appear = function(element) { + element = $(element); + var options = Object.extend({ + from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), + to: 1.0, + // force Safari to render floated elements properly + afterFinishInternal: function(effect) { + effect.element.forceRerendering(); + }, + beforeSetup: function(effect) { + effect.element.setOpacity(effect.options.from).show(); + }}, arguments[1] || {}); + return new Effect.Opacity(element,options); +} + +Effect.Puff = function(element) { + element = $(element); + var oldStyle = { + opacity: element.getInlineOpacity(), + position: element.getStyle('position'), + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height + }; + return new Effect.Parallel( + [ new Effect.Scale(element, 200, + { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], + Object.extend({ duration: 1.0, + beforeSetupInternal: function(effect) { + Position.absolutize(effect.effects[0].element) + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().setStyle(oldStyle); } + }, arguments[1] || {}) + ); +} + +Effect.BlindUp = function(element) { + element = $(element); + element.makeClipping(); + return new Effect.Scale(element, 0, + Object.extend({ scaleContent: false, + scaleX: false, + restoreAfterFinish: true, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }, arguments[1] || {}) + ); +} + +Effect.BlindDown = function(element) { + element = $(element); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: 0, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping(); + } + }, arguments[1] || {})); +} + +Effect.SwitchOff = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + return new Effect.Appear(element, Object.extend({ + duration: 0.4, + from: 0, + transition: Effect.Transitions.flicker, + afterFinishInternal: function(effect) { + new Effect.Scale(effect.element, 1, { + duration: 0.3, scaleFromCenter: true, + scaleX: false, scaleContent: false, restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); + } + }) + } + }, arguments[1] || {})); +} + +Effect.DropOut = function(element) { + element = $(element); + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left'), + opacity: element.getInlineOpacity() }; + return new Effect.Parallel( + [ new Effect.Move(element, {x: 0, y: 100, sync: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 }) ], + Object.extend( + { duration: 0.5, + beforeSetup: function(effect) { + effect.effects[0].element.makePositioned(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); + } + }, arguments[1] || {})); +} + +Effect.Shake = function(element) { + element = $(element); + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left') }; + return new Effect.Move(element, + { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { + effect.element.undoPositioned().setStyle(oldStyle); + }}) }}) }}) }}) }}) }}); +} + +Effect.SlideDown = function(element) { + element = $(element).cleanWhitespace(); + // SlideDown need to have the content of the element wrapped in a container element with fixed height! + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: window.opera ? 0 : 1, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if(window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } + }, arguments[1] || {}) + ); +} + +Effect.SlideUp = function(element) { + element = $(element).cleanWhitespace(); + var oldInnerBottom = element.down().getStyle('bottom'); + return new Effect.Scale(element, window.opera ? 0 : 1, + Object.extend({ scaleContent: false, + scaleX: false, + scaleMode: 'box', + scaleFrom: 100, + restoreAfterFinish: true, + beforeStartInternal: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if(window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned().setStyle({bottom: oldInnerBottom}); + effect.element.down().undoPositioned(); + } + }, arguments[1] || {}) + ); +} + +// Bug in opera makes the TD containing this element expand for a instance after finish +Effect.Squish = function(element) { + return new Effect.Scale(element, window.opera ? 1 : 0, { + restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }); +} + +Effect.Grow = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.full + }, arguments[1] || {}); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var initialMoveX, initialMoveY; + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + initialMoveX = initialMoveY = moveX = moveY = 0; + break; + case 'top-right': + initialMoveX = dims.width; + initialMoveY = moveY = 0; + moveX = -dims.width; + break; + case 'bottom-left': + initialMoveX = moveX = 0; + initialMoveY = dims.height; + moveY = -dims.height; + break; + case 'bottom-right': + initialMoveX = dims.width; + initialMoveY = dims.height; + moveX = -dims.width; + moveY = -dims.height; + break; + case 'center': + initialMoveX = dims.width / 2; + initialMoveY = dims.height / 2; + moveX = -dims.width / 2; + moveY = -dims.height / 2; + break; + } + + return new Effect.Move(element, { + x: initialMoveX, + y: initialMoveY, + duration: 0.01, + beforeSetup: function(effect) { + effect.element.hide().makeClipping().makePositioned(); + }, + afterFinishInternal: function(effect) { + new Effect.Parallel( + [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), + new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), + new Effect.Scale(effect.element, 100, { + scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, + sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) + ], Object.extend({ + beforeSetup: function(effect) { + effect.effects[0].element.setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); + } + }, options) + ) + } + }); +} + +Effect.Shrink = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.none + }, arguments[1] || {}); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + moveX = moveY = 0; + break; + case 'top-right': + moveX = dims.width; + moveY = 0; + break; + case 'bottom-left': + moveX = 0; + moveY = dims.height; + break; + case 'bottom-right': + moveX = dims.width; + moveY = dims.height; + break; + case 'center': + moveX = dims.width / 2; + moveY = dims.height / 2; + break; + } + + return new Effect.Parallel( + [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), + new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), + new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) + ], Object.extend({ + beforeStartInternal: function(effect) { + effect.effects[0].element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } + }, options) + ); +} + +Effect.Pulsate = function(element) { + element = $(element); + var options = arguments[1] || {}; + var oldOpacity = element.getInlineOpacity(); + var transition = options.transition || Effect.Transitions.sinoidal; + var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) }; + reverser.bind(transition); + return new Effect.Opacity(element, + Object.extend(Object.extend({ duration: 2.0, from: 0, + afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } + }, options), {transition: reverser})); +} + +Effect.Fold = function(element) { + element = $(element); + var oldStyle = { + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height }; + element.makeClipping(); + return new Effect.Scale(element, 5, Object.extend({ + scaleContent: false, + scaleX: false, + afterFinishInternal: function(effect) { + new Effect.Scale(element, 1, { + scaleContent: false, + scaleY: false, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().setStyle(oldStyle); + } }); + }}, arguments[1] || {})); +}; + +Effect.Morph = Class.create(); +Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + if(!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + style: {} + }, arguments[1] || {}); + if (typeof options.style == 'string') { + if(options.style.indexOf(':') == -1) { + var cssText = '', selector = '.' + options.style; + $A(document.styleSheets).reverse().each(function(styleSheet) { + if (styleSheet.cssRules) cssRules = styleSheet.cssRules; + else if (styleSheet.rules) cssRules = styleSheet.rules; + $A(cssRules).reverse().each(function(rule) { + if (selector == rule.selectorText) { + cssText = rule.style.cssText; + throw $break; + } + }); + if (cssText) throw $break; + }); + this.style = cssText.parseStyle(); + options.afterFinishInternal = function(effect){ + effect.element.addClassName(effect.options.style); + effect.transforms.each(function(transform) { + if(transform.style != 'opacity') + effect.element.style[transform.style.camelize()] = ''; + }); + } + } else this.style = options.style.parseStyle(); + } else this.style = $H(options.style) + this.start(options); + }, + setup: function(){ + function parseColor(color){ + if(!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; + color = color.parseColor(); + return $R(0,2).map(function(i){ + return parseInt( color.slice(i*2+1,i*2+3), 16 ) + }); + } + this.transforms = this.style.map(function(pair){ + var property = pair[0].underscore().dasherize(), value = pair[1], unit = null; + + if(value.parseColor('#zzzzzz') != '#zzzzzz') { + value = value.parseColor(); + unit = 'color'; + } else if(property == 'opacity') { + value = parseFloat(value); + if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + } else if(Element.CSS_LENGTH.test(value)) + var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/), + value = parseFloat(components[1]), unit = (components.length == 3) ? components[2] : null; + + var originalValue = this.element.getStyle(property); + return $H({ + style: property, + originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), + targetValue: unit=='color' ? parseColor(value) : value, + unit: unit + }); + }.bind(this)).reject(function(transform){ + return ( + (transform.originalValue == transform.targetValue) || + ( + transform.unit != 'color' && + (isNaN(transform.originalValue) || isNaN(transform.targetValue)) + ) + ) + }); + }, + update: function(position) { + var style = $H(), value = null; + this.transforms.each(function(transform){ + value = transform.unit=='color' ? + $R(0,2).inject('#',function(m,v,i){ + return m+(Math.round(transform.originalValue[i]+ + (transform.targetValue[i] - transform.originalValue[i])*position)).toColorPart() }) : + transform.originalValue + Math.round( + ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit; + style[transform.style] = value; + }); + this.element.setStyle(style); + } +}); + +Effect.Transform = Class.create(); +Object.extend(Effect.Transform.prototype, { + initialize: function(tracks){ + this.tracks = []; + this.options = arguments[1] || {}; + this.addTracks(tracks); + }, + addTracks: function(tracks){ + tracks.each(function(track){ + var data = $H(track).values().first(); + this.tracks.push($H({ + ids: $H(track).keys().first(), + effect: Effect.Morph, + options: { style: data } + })); + }.bind(this)); + return this; + }, + play: function(){ + return new Effect.Parallel( + this.tracks.map(function(track){ + var elements = [$(track.ids) || $$(track.ids)].flatten(); + return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) }); + }).flatten(), + this.options + ); + } +}); + +Element.CSS_PROPERTIES = $w( + 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + + 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + + 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + + 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + + 'fontSize fontWeight height left letterSpacing lineHeight ' + + 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ + 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + + 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + + 'right textIndent top width wordSpacing zIndex'); + +Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; + +String.prototype.parseStyle = function(){ + var element = Element.extend(document.createElement('div')); + element.innerHTML = '<div style="' + this + '"></div>'; + var style = element.down().style, styleRules = $H(); + + Element.CSS_PROPERTIES.each(function(property){ + if(style[property]) styleRules[property] = style[property]; + }); + if(/MSIE/.test(navigator.userAgent) && !window.opera && this.indexOf('opacity') > -1) { + styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]; + } + return styleRules; +}; + +Element.morph = function(element, style) { + new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || {})); + return element; +}; + +['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom', + 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each( + function(f) { Element.Methods[f] = Element[f]; } +); + +Element.Methods.visualEffect = function(element, effect, options) { + s = effect.gsub(/_/, '-').camelize(); + effect_class = s.charAt(0).toUpperCase() + s.substring(1); + new Effect[effect_class](element, options); + return $(element); +}; + +Element.addMethods(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/js/prototype.js b/maarch_entreprise/trunk/tools/tafelTree/js/prototype.js new file mode 100644 index 0000000000000000000000000000000000000000..0476b8fdccc0717b3be623ff464748d1c5e751e6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/js/prototype.js @@ -0,0 +1,2515 @@ +/* Prototype JavaScript framework, version 1.5.0 + * (c) 2005-2007 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://prototype.conio.net/ + * +/*--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.5.0', + BrowserFeatures: { + XPath: !!document.evaluate + }, + + ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', + emptyFunction: function() {}, + K: function(x) { return x } +} + +var Class = { + create: function() { + return function() { + this.initialize.apply(this, arguments); + } + } +} + +var Abstract = new Object(); + +Object.extend = function(destination, source) { + for (var property in source) { + destination[property] = source[property]; + } + return destination; +} + +Object.extend(Object, { + inspect: function(object) { + try { + if (object === undefined) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : object.toString(); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({}, object); + } +}); + +Function.prototype.bind = function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } +} + +Function.prototype.bindAsEventListener = function(object) { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments))); + } +} + +Object.extend(Number.prototype, { + toColorPart: function() { + var digits = this.toString(16); + if (this < 16) return '0' + digits; + return digits; + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator) { + $R(0, this, true).each(iterator); + return this; + } +}); + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) {} + } + + return returnValue; + } +} + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create(); +PeriodicalExecuter.prototype = { + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.callback(this); + } finally { + this.currentlyExecuting = false; + } + } + } +} +String.interpret = function(value){ + return value == null ? '' : String(value); +} + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = count === undefined ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return this; + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = truncation === undefined ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : this; + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var div = document.createElement('div'); + var text = document.createTextNode(this); + div.appendChild(text); + return div.innerHTML; + }, + + unescapeHTML: function() { + var div = document.createElement('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return {}; + + return match[1].split(separator || '&').inject({}, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var name = decodeURIComponent(pair[0]); + var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; + + if (hash[name] !== undefined) { + if (hash[name].constructor != Array) + hash[name] = [hash[name]]; + if (value) hash[name].push(value); + } + else hash[name] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function(){ + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.replace(/\\/g, '\\\\'); + if (useDoubleQuotes) + return '"' + escapedString.replace(/"/g, '\\"') + '"'; + else + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (typeof replacement == 'function') return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +} + +String.prototype.parseQuery = String.prototype.toQueryParams; + +var Template = Class.create(); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; +Template.prototype = { + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + return this.template.gsub(this.pattern, function(match) { + var before = match[1]; + if (before == '\\') return match[2]; + return before + String.interpret(object[match[3]]); + }); + } +} + +var $break = new Object(); +var $continue = new Object(); + +var Enumerable = { + each: function(iterator) { + var index = 0; + try { + this._each(function(value) { + try { + iterator(value, index++); + } catch (e) { + if (e != $continue) throw e; + } + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + }, + + eachSlice: function(number, iterator) { + var index = -number, slices = [], array = this.toArray(); + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.map(iterator); + }, + + all: function(iterator) { + var result = true; + this.each(function(value, index) { + result = result && !!(iterator || Prototype.K)(value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator) { + var result = false; + this.each(function(value, index) { + if (result = !!(iterator || Prototype.K)(value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator) { + var results = []; + this.each(function(value, index) { + results.push((iterator || Prototype.K)(value, index)); + }); + return results; + }, + + detect: function(iterator) { + var result; + this.each(function(value, index) { + if (iterator(value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator) { + var results = []; + this.each(function(value, index) { + if (iterator(value, index)) + results.push(value); + }); + return results; + }, + + grep: function(pattern, iterator) { + var results = []; + this.each(function(value, index) { + var stringValue = value.toString(); + if (stringValue.match(pattern)) + results.push((iterator || Prototype.K)(value, index)); + }) + return results; + }, + + include: function(object) { + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inGroupsOf: function(number, fillWith) { + fillWith = fillWith === undefined ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + }, + + inject: function(memo, iterator) { + this.each(function(value, index) { + memo = iterator(memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator) { + var result; + this.each(function(value, index) { + value = (iterator || Prototype.K)(value, index); + if (result == undefined || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator) { + var result; + this.each(function(value, index) { + value = (iterator || Prototype.K)(value, index); + if (result == undefined || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator) { + var trues = [], falses = []; + this.each(function(value, index) { + ((iterator || Prototype.K)(value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value, index) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator) { + var results = []; + this.each(function(value, index) { + if (!iterator(value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator) { + return this.map(function(value, index) { + return {value: value, criteria: iterator(value, index)}; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.map(); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (typeof args.last() == 'function') + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + size: function() { + return this.toArray().length; + }, + + inspect: function() { + return '#<Enumerable:' + this.toArray().inspect() + '>'; + } +} + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray +}); +var $A = Array.from = function(iterable) { + if (!iterable) return []; + if (iterable.toArray) { + return iterable.toArray(); + } else { + var results = []; + for (var i = 0, length = iterable.length; i < length; i++) + results.push(iterable[i]); + return results; + } +} + +Object.extend(Array.prototype, Enumerable); + +if (!Array.prototype._reverse) + Array.prototype._reverse = Array.prototype.reverse; + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0, length = this.length; i < length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(value && value.constructor == Array ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + indexOf: function(object) { + for (var i = 0, length = this.length; i < length; i++) + if (this[i] == object) return i; + return -1; + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + reduce: function() { + return this.length > 1 ? this : this[0]; + }, + + uniq: function() { + return this.inject([], function(array, value) { + return array.include(value) ? array : array.concat([value]); + }); + }, + + clone: function() { + return [].concat(this); + }, + + size: function() { + return this.length; + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + } +}); + +Array.prototype.toArray = Array.prototype.clone; + +function $w(string){ + string = string.strip(); + return string ? string.split(/\s+/) : []; +} + +if(window.opera){ + Array.prototype.concat = function(){ + var array = []; + for(var i = 0, length = this.length; i < length; i++) array.push(this[i]); + for(var i = 0, length = arguments.length; i < length; i++) { + if(arguments[i].constructor == Array) { + for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) + array.push(arguments[i][j]); + } else { + array.push(arguments[i]); + } + } + return array; + } +} +var Hash = function(obj) { + Object.extend(this, obj || {}); +}; + +Object.extend(Hash, { + toQueryString: function(obj) { + var parts = []; + + this.prototype._each.call(obj, function(pair) { + if (!pair.key) return; + + if (pair.value && pair.value.constructor == Array) { + var values = pair.value.compact(); + if (values.length < 2) pair.value = values.reduce(); + else { + key = encodeURIComponent(pair.key); + values.each(function(value) { + value = value != undefined ? encodeURIComponent(value) : ''; + parts.push(key + '=' + encodeURIComponent(value)); + }); + return; + } + } + if (pair.value == undefined) pair[1] = ''; + parts.push(pair.map(encodeURIComponent).join('=')); + }); + + return parts.join('&'); + } +}); + +Object.extend(Hash.prototype, Enumerable); +Object.extend(Hash.prototype, { + _each: function(iterator) { + for (var key in this) { + var value = this[key]; + if (value && value == Hash.prototype[key]) continue; + + var pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + }, + + keys: function() { + return this.pluck('key'); + }, + + values: function() { + return this.pluck('value'); + }, + + merge: function(hash) { + return $H(hash).inject(this, function(mergedHash, pair) { + mergedHash[pair.key] = pair.value; + return mergedHash; + }); + }, + + remove: function() { + var result; + for(var i = 0, length = arguments.length; i < length; i++) { + var value = this[arguments[i]]; + if (value !== undefined){ + if (result === undefined) result = value; + else { + if (result.constructor != Array) result = [result]; + result.push(value) + } + } + delete this[arguments[i]]; + } + return result; + }, + + toQueryString: function() { + return Hash.toQueryString(this); + }, + + inspect: function() { + return '#<Hash:{' + this.map(function(pair) { + return pair.map(Object.inspect).join(': '); + }).join(', ') + '}>'; + } +}); + +function $H(object) { + if (object && object.constructor == Hash) return object; + return new Hash(object); +}; +ObjectRange = Class.create(); +Object.extend(ObjectRange.prototype, Enumerable); +Object.extend(ObjectRange.prototype, { + initialize: function(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + }, + + _each: function(iterator) { + var value = this.start; + while (this.include(value)) { + iterator(value); + value = value.succ(); + } + }, + + include: function(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } +}); + +var $R = function(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +} + +var Ajax = { + getTransport: function() { + return Try.these( + function() {return new XMLHttpRequest()}, + function() {return new ActiveXObject('Msxml2.XMLHTTP')}, + function() {return new ActiveXObject('Microsoft.XMLHTTP')} + ) || false; + }, + + activeRequestCount: 0 +} + +Ajax.Responders = { + responders: [], + + _each: function(iterator) { + this.responders._each(iterator); + }, + + register: function(responder) { + if (!this.include(responder)) + this.responders.push(responder); + }, + + unregister: function(responder) { + this.responders = this.responders.without(responder); + }, + + dispatch: function(callback, request, transport, json) { + this.each(function(responder) { + if (typeof responder[callback] == 'function') { + try { + responder[callback].apply(responder, [request, transport, json]); + } catch (e) {} + } + }); + } +}; + +Object.extend(Ajax.Responders, Enumerable); + +Ajax.Responders.register({ + onCreate: function() { + Ajax.activeRequestCount++; + }, + onComplete: function() { + Ajax.activeRequestCount--; + } +}); + +Ajax.Base = function() {}; +Ajax.Base.prototype = { + setOptions: function(options) { + this.options = { + method: 'post', + asynchronous: true, + contentType: 'application/x-www-form-urlencoded', + encoding: 'UTF-8', + parameters: '' + } + Object.extend(this.options, options || {}); + + this.options.method = this.options.method.toLowerCase(); + if (typeof this.options.parameters == 'string') + this.options.parameters = this.options.parameters.toQueryParams(); + } +} + +Ajax.Request = Class.create(); +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + +Ajax.Request.prototype = Object.extend(new Ajax.Base(), { + _complete: false, + + initialize: function(url, options) { + this.transport = Ajax.getTransport(); + this.setOptions(options); + this.request(url); + }, + + request: function(url) { + this.url = url; + this.method = this.options.method; + var params = this.options.parameters; + + if (!['get', 'post'].include(this.method)) { + // simulate other verbs over post + params['_method'] = this.method; + this.method = 'post'; + } + + params = Hash.toQueryString(params); + if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_=' + + // when GET, append parameters to URL + if (this.method == 'get' && params) + this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params; + + try { + Ajax.Responders.dispatch('onCreate', this, this.transport); + + this.transport.open(this.method.toUpperCase(), this.url, + this.options.asynchronous); + + if (this.options.asynchronous) + setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10); + + this.transport.onreadystatechange = this.onStateChange.bind(this); + this.setRequestHeaders(); + + var body = this.method == 'post' ? (this.options.postBody || params) : null; + + this.transport.send(body); + + /* Force Firefox to handle ready state 4 for synchronous requests */ + if (!this.options.asynchronous && this.transport.overrideMimeType) + this.onStateChange(); + + } + catch (e) { + this.dispatchException(e); + } + }, + + onStateChange: function() { + var readyState = this.transport.readyState; + if (readyState > 1 && !((readyState == 4) && this._complete)) + this.respondToReadyState(this.transport.readyState); + }, + + setRequestHeaders: function() { + var headers = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-Prototype-Version': Prototype.Version, + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + }; + + if (this.method == 'post') { + headers['Content-type'] = this.options.contentType + + (this.options.encoding ? '; charset=' + this.options.encoding : ''); + + /* Force "Connection: close" for older Mozilla browsers to work + * around a bug where XMLHttpRequest sends an incorrect + * Content-length header. See Mozilla Bugzilla #246651. + */ + if (this.transport.overrideMimeType && + (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) + headers['Connection'] = 'close'; + } + + // user-defined headers + if (typeof this.options.requestHeaders == 'object') { + var extras = this.options.requestHeaders; + + if (typeof extras.push == 'function') + for (var i = 0, length = extras.length; i < length; i += 2) + headers[extras[i]] = extras[i+1]; + else + $H(extras).each(function(pair) { headers[pair.key] = pair.value }); + } + + for (var name in headers) + this.transport.setRequestHeader(name, headers[name]); + }, + + success: function() { + return !this.transport.status + || (this.transport.status >= 200 && this.transport.status < 300); + }, + + respondToReadyState: function(readyState) { + var state = Ajax.Request.Events[readyState]; + var transport = this.transport, json = this.evalJSON(); + + if (state == 'Complete') { + try { + this._complete = true; + (this.options['on' + this.transport.status] + || this.options['on' + (this.success() ? 'Success' : 'Failure')] + || Prototype.emptyFunction)(transport, json); + } catch (e) { + this.dispatchException(e); + } + + if ((this.getHeader('Content-type') || 'text/javascript').strip(). + match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)) + this.evalResponse(); + } + + try { + (this.options['on' + state] || Prototype.emptyFunction)(transport, json); + Ajax.Responders.dispatch('on' + state, this, transport, json); + } catch (e) { + this.dispatchException(e); + } + + if (state == 'Complete') { + // avoid memory leak in MSIE: clean up + this.transport.onreadystatechange = Prototype.emptyFunction; + } + }, + + getHeader: function(name) { + try { + return this.transport.getResponseHeader(name); + } catch (e) { return null } + }, + + evalJSON: function() { + try { + var json = this.getHeader('X-JSON'); + return json ? eval('(' + json + ')') : null; + } catch (e) { return null } + }, + + evalResponse: function() { + try { + return eval(this.transport.responseText); + } catch (e) { + this.dispatchException(e); + } + }, + + dispatchException: function(exception) { + (this.options.onException || Prototype.emptyFunction)(this, exception); + Ajax.Responders.dispatch('onException', this, exception); + } +}); + +Ajax.Updater = Class.create(); + +Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { + initialize: function(container, url, options) { + this.container = { + success: (container.success || container), + failure: (container.failure || (container.success ? null : container)) + } + + this.transport = Ajax.getTransport(); + this.setOptions(options); + + var onComplete = this.options.onComplete || Prototype.emptyFunction; + this.options.onComplete = (function(transport, param) { + this.updateContent(); + onComplete(transport, param); + }).bind(this); + + this.request(url); + }, + + updateContent: function() { + var receiver = this.container[this.success() ? 'success' : 'failure']; + var response = this.transport.responseText; + + if (!this.options.evalScripts) response = response.stripScripts(); + + if (receiver = $(receiver)) { + if (this.options.insertion) + new this.options.insertion(receiver, response); + else + receiver.update(response); + } + + if (this.success()) { + if (this.onComplete) + setTimeout(this.onComplete.bind(this), 10); + } + } +}); + +Ajax.PeriodicalUpdater = Class.create(); +Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { + initialize: function(container, url, options) { + this.setOptions(options); + this.onComplete = this.options.onComplete; + + this.frequency = (this.options.frequency || 2); + this.decay = (this.options.decay || 1); + + this.updater = {}; + this.container = container; + this.url = url; + + this.start(); + }, + + start: function() { + this.options.onComplete = this.updateComplete.bind(this); + this.onTimerEvent(); + }, + + stop: function() { + this.updater.options.onComplete = undefined; + clearTimeout(this.timer); + (this.onComplete || Prototype.emptyFunction).apply(this, arguments); + }, + + updateComplete: function(request) { + if (this.options.decay) { + this.decay = (request.responseText == this.lastText ? + this.decay * this.options.decay : 1); + + this.lastText = request.responseText; + } + this.timer = setTimeout(this.onTimerEvent.bind(this), + this.decay * this.frequency * 1000); + }, + + onTimerEvent: function() { + this.updater = new Ajax.Updater(this.container, this.url, this.options); + } +}); +function $(element) { + if (arguments.length > 1) { + for (var i = 0, elements = [], length = arguments.length; i < length; i++) + elements.push($(arguments[i])); + return elements; + } + if (typeof element == 'string') + element = document.getElementById(element); + return Element.extend(element); +} + +if (Prototype.BrowserFeatures.XPath) { + document._getElementsByXPath = function(expression, parentElement) { + var results = []; + var query = document.evaluate(expression, $(parentElement) || document, + null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0, length = query.snapshotLength; i < length; i++) + results.push(query.snapshotItem(i)); + return results; + }; +} + +document.getElementsByClassName = function(className, parentElement) { + if (Prototype.BrowserFeatures.XPath) { + var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]"; + return document._getElementsByXPath(q, parentElement); + } else { + var children = ($(parentElement) || document.body).getElementsByTagName('*'); + var elements = [], child; + for (var i = 0, length = children.length; i < length; i++) { + child = children[i]; + if (Element.hasClassName(child, className)) + elements.push(Element.extend(child)); + } + return elements; + } +}; + +/*--------------------------------------------------------------------------*/ + +if (!window.Element) + var Element = new Object(); + +Element.extend = function(element) { + if (!element || _nativeExtensions || element.nodeType == 3) return element; + + if (!element._extended && element.tagName && element != window) { + var methods = Object.clone(Element.Methods), cache = Element.extend.cache; + + if (element.tagName == 'FORM') + Object.extend(methods, Form.Methods); + if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName)) + Object.extend(methods, Form.Element.Methods); + + Object.extend(methods, Element.Methods.Simulated); + + for (var property in methods) { + var value = methods[property]; + if (typeof value == 'function' && !(property in element)) + element[property] = cache.findOrStore(value); + } + } + + element._extended = true; + return element; +}; + +Element.extend.cache = { + findOrStore: function(value) { + return this[value] = this[value] || function() { + return value.apply(null, [this].concat($A(arguments))); + } + } +}; + +Element.Methods = { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function(element) { + element = $(element); + Element[Element.visible(element) ? 'hide' : 'show'](element); + return element; + }, + + hide: function(element) { + $(element).style.display = 'none'; + return element; + }, + + show: function(element) { + $(element).style.display = ''; + return element; + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + return element; + }, + + update: function(element, html) { + html = typeof html == 'undefined' ? '' : html.toString(); + $(element).innerHTML = html.stripScripts(); + setTimeout(function() {html.evalScripts()}, 10); + return element; + }, + + replace: function(element, html) { + element = $(element); + html = typeof html == 'undefined' ? '' : html.toString(); + if (element.outerHTML) { + element.outerHTML = html.stripScripts(); + } else { + var range = element.ownerDocument.createRange(); + range.selectNodeContents(element); + element.parentNode.replaceChild( + range.createContextualFragment(html.stripScripts()), element); + } + setTimeout(function() {html.evalScripts()}, 10); + return element; + }, + + inspect: function(element) { + element = $(element); + var result = '<' + element.tagName.toLowerCase(); + $H({'id': 'id', 'className': 'class'}).each(function(pair) { + var property = pair.first(), attribute = pair.last(); + var value = (element[property] || '').toString(); + if (value) result += ' ' + attribute + '=' + value.inspect(true); + }); + return result + '>'; + }, + + recursivelyCollect: function(element, property) { + element = $(element); + var elements = []; + while (element = element[property]) + if (element.nodeType == 1) + elements.push(Element.extend(element)); + return elements; + }, + + ancestors: function(element) { + return $(element).recursivelyCollect('parentNode'); + }, + + descendants: function(element) { + return $A($(element).getElementsByTagName('*')); + }, + + immediateDescendants: function(element) { + if (!(element = $(element).firstChild)) return []; + while (element && element.nodeType != 1) element = element.nextSibling; + if (element) return [element].concat($(element).nextSiblings()); + return []; + }, + + previousSiblings: function(element) { + return $(element).recursivelyCollect('previousSibling'); + }, + + nextSiblings: function(element) { + return $(element).recursivelyCollect('nextSibling'); + }, + + siblings: function(element) { + element = $(element); + return element.previousSiblings().reverse().concat(element.nextSiblings()); + }, + + match: function(element, selector) { + if (typeof selector == 'string') + selector = new Selector(selector); + return selector.match($(element)); + }, + + up: function(element, expression, index) { + return Selector.findElement($(element).ancestors(), expression, index); + }, + + down: function(element, expression, index) { + return Selector.findElement($(element).descendants(), expression, index); + }, + + previous: function(element, expression, index) { + return Selector.findElement($(element).previousSiblings(), expression, index); + }, + + next: function(element, expression, index) { + return Selector.findElement($(element).nextSiblings(), expression, index); + }, + + getElementsBySelector: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element, args); + }, + + getElementsByClassName: function(element, className) { + return document.getElementsByClassName(className, element); + }, + + readAttribute: function(element, name) { + element = $(element); + if (document.all && !window.opera) { + var t = Element._attributeTranslations; + if (t.values[name]) return t.values[name](element, name); + if (t.names[name]) name = t.names[name]; + var attribute = element.attributes[name]; + if(attribute) return attribute.nodeValue; + } + return element.getAttribute(name); + }, + + getHeight: function(element) { + return $(element).getDimensions().height; + }, + + getWidth: function(element) { + return $(element).getDimensions().width; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + var elementClassName = element.className; + if (elementClassName.length == 0) return false; + if (elementClassName == className || + elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) + return true; + return false; + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + Element.classNames(element).add(className); + return element; + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + Element.classNames(element).remove(className); + return element; + }, + + toggleClassName: function(element, className) { + if (!(element = $(element))) return; + Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className); + return element; + }, + + observe: function() { + Event.observe.apply(Event, arguments); + return $A(arguments).first(); + }, + + stopObserving: function() { + Event.stopObserving.apply(Event, arguments); + return $A(arguments).first(); + }, + + // removes whitespace-only text node children + cleanWhitespace: function(element) { + element = $(element); + var node = element.firstChild; + while (node) { + var nextNode = node.nextSibling; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + element.removeChild(node); + node = nextNode; + } + return element; + }, + + empty: function(element) { + return $(element).innerHTML.match(/^\s*$/); + }, + + descendantOf: function(element, ancestor) { + element = $(element), ancestor = $(ancestor); + while (element = element.parentNode) + if (element == ancestor) return true; + return false; + }, + + scrollTo: function(element) { + element = $(element); + var pos = Position.cumulativeOffset(element); + window.scrollTo(pos[0], pos[1]); + return element; + }, + + getStyle: function(element, style) { + element = $(element); + if (['float','cssFloat'].include(style)) + style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat'); + style = style.camelize(); + var value = element.style[style]; + if (!value) { + if (document.defaultView && document.defaultView.getComputedStyle) { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css[style] : null; + } else if (element.currentStyle) { + value = element.currentStyle[style]; + } + } + + if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none')) + value = element['offset'+style.capitalize()] + 'px'; + + if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) + if (Element.getStyle(element, 'position') == 'static') value = 'auto'; + if(style == 'opacity') { + if(value) return parseFloat(value); + if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) + if(value[1]) return parseFloat(value[1]) / 100; + return 1.0; + } + return value == 'auto' ? null : value; + }, + + setStyle: function(element, style) { + element = $(element); + for (var name in style) { + var value = style[name]; + if(name == 'opacity') { + if (value == 1) { + value = (/Gecko/.test(navigator.userAgent) && + !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0; + if(/MSIE/.test(navigator.userAgent) && !window.opera) + element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); + } else if(value === '') { + if(/MSIE/.test(navigator.userAgent) && !window.opera) + element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); + } else { + if(value < 0.00001) value = 0; + if(/MSIE/.test(navigator.userAgent) && !window.opera) + element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + + 'alpha(opacity='+value*100+')'; + } + } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat'; + element.style[name.camelize()] = value; + } + return element; + }, + + getDimensions: function(element) { + element = $(element); + var display = $(element).getStyle('display'); + if (display != 'none' && display != null) // Safari bug + return {width: element.offsetWidth, height: element.offsetHeight}; + + // All *Width and *Height properties give 0 on elements with display none, + // so enable the element temporarily + var els = element.style; + var originalVisibility = els.visibility; + var originalPosition = els.position; + var originalDisplay = els.display; + els.visibility = 'hidden'; + els.position = 'absolute'; + els.display = 'block'; + var originalWidth = element.clientWidth; + var originalHeight = element.clientHeight; + els.display = originalDisplay; + els.position = originalPosition; + els.visibility = originalVisibility; + return {width: originalWidth, height: originalHeight}; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + // Opera returns the offset relative to the positioning context, when an + // element is position relative but top and left have not been defined + if (window.opera) { + element.style.top = 0; + element.style.left = 0; + } + } + return element; + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + return element; + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return element; + element._overflow = element.style.overflow || 'auto'; + if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') + element.style.overflow = 'hidden'; + return element; + }, + + undoClipping: function(element) { + element = $(element); + if (!element._overflow) return element; + element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; + element._overflow = null; + return element; + } +}; + +Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf}); + +Element._attributeTranslations = {}; + +Element._attributeTranslations.names = { + colspan: "colSpan", + rowspan: "rowSpan", + valign: "vAlign", + datetime: "dateTime", + accesskey: "accessKey", + tabindex: "tabIndex", + enctype: "encType", + maxlength: "maxLength", + readonly: "readOnly", + longdesc: "longDesc" +}; + +Element._attributeTranslations.values = { + _getAttr: function(element, attribute) { + return element.getAttribute(attribute, 2); + }, + + _flag: function(element, attribute) { + return $(element).hasAttribute(attribute) ? attribute : null; + }, + + style: function(element) { + return element.style.cssText.toLowerCase(); + }, + + title: function(element) { + var node = element.getAttributeNode('title'); + return node.specified ? node.nodeValue : null; + } +}; + +Object.extend(Element._attributeTranslations.values, { + href: Element._attributeTranslations.values._getAttr, + src: Element._attributeTranslations.values._getAttr, + disabled: Element._attributeTranslations.values._flag, + checked: Element._attributeTranslations.values._flag, + readonly: Element._attributeTranslations.values._flag, + multiple: Element._attributeTranslations.values._flag +}); + +Element.Methods.Simulated = { + hasAttribute: function(element, attribute) { + var t = Element._attributeTranslations; + attribute = t.names[attribute] || attribute; + return $(element).getAttributeNode(attribute).specified; + } +}; + +// IE is missing .innerHTML support for TABLE-related elements +if (document.all && !window.opera){ + Element.Methods.update = function(element, html) { + element = $(element); + html = typeof html == 'undefined' ? '' : html.toString(); + var tagName = element.tagName.toUpperCase(); + if (['THEAD','TBODY','TR','TD'].include(tagName)) { + var div = document.createElement('div'); + switch (tagName) { + case 'THEAD': + case 'TBODY': + div.innerHTML = '<table><tbody>' + html.stripScripts() + '</tbody></table>'; + depth = 2; + break; + case 'TR': + div.innerHTML = '<table><tbody><tr>' + html.stripScripts() + '</tr></tbody></table>'; + depth = 3; + break; + case 'TD': + div.innerHTML = '<table><tbody><tr><td>' + html.stripScripts() + '</td></tr></tbody></table>'; + depth = 4; + } + $A(element.childNodes).each(function(node){ + element.removeChild(node) + }); + depth.times(function(){ div = div.firstChild }); + + $A(div.childNodes).each( + function(node){ element.appendChild(node) }); + } else { + element.innerHTML = html.stripScripts(); + } + setTimeout(function() {html.evalScripts()}, 10); + return element; + } +}; + +Object.extend(Element, Element.Methods); + +var _nativeExtensions = false; + +if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) + ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) { + var className = 'HTML' + tag + 'Element'; + if(window[className]) return; + var klass = window[className] = {}; + klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__; + }); + +Element.addMethods = function(methods) { + Object.extend(Element.Methods, methods || {}); + + function copy(methods, destination, onlyIfAbsent) { + onlyIfAbsent = onlyIfAbsent || false; + var cache = Element.extend.cache; + for (var property in methods) { + var value = methods[property]; + if (!onlyIfAbsent || !(property in destination)) + destination[property] = cache.findOrStore(value); + } + } + + if (typeof HTMLElement != 'undefined') { + copy(Element.Methods, HTMLElement.prototype); + copy(Element.Methods.Simulated, HTMLElement.prototype, true); + copy(Form.Methods, HTMLFormElement.prototype); + [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) { + copy(Form.Element.Methods, klass.prototype); + }); + _nativeExtensions = true; + } +} + +var Toggle = new Object(); +Toggle.display = Element.toggle; + +/*--------------------------------------------------------------------------*/ + +Abstract.Insertion = function(adjacency) { + this.adjacency = adjacency; +} + +Abstract.Insertion.prototype = { + initialize: function(element, content) { + this.element = $(element); + this.content = content.stripScripts(); + + if (this.adjacency && this.element.insertAdjacentHTML) { + try { + this.element.insertAdjacentHTML(this.adjacency, this.content); + } catch (e) { + var tagName = this.element.tagName.toUpperCase(); + if (['TBODY', 'TR'].include(tagName)) { + this.insertContent(this.contentFromAnonymousTable()); + } else { + throw e; + } + } + } else { + this.range = this.element.ownerDocument.createRange(); + if (this.initializeRange) this.initializeRange(); + this.insertContent([this.range.createContextualFragment(this.content)]); + } + + setTimeout(function() {content.evalScripts()}, 10); + }, + + contentFromAnonymousTable: function() { + var div = document.createElement('div'); + div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>'; + return $A(div.childNodes[0].childNodes[0].childNodes); + } +} + +var Insertion = new Object(); + +Insertion.Before = Class.create(); +Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { + initializeRange: function() { + this.range.setStartBefore(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.parentNode.insertBefore(fragment, this.element); + }).bind(this)); + } +}); + +Insertion.Top = Class.create(); +Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { + initializeRange: function() { + this.range.selectNodeContents(this.element); + this.range.collapse(true); + }, + + insertContent: function(fragments) { + fragments.reverse(false).each((function(fragment) { + this.element.insertBefore(fragment, this.element.firstChild); + }).bind(this)); + } +}); + +Insertion.Bottom = Class.create(); +Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { + initializeRange: function() { + this.range.selectNodeContents(this.element); + this.range.collapse(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.appendChild(fragment); + }).bind(this)); + } +}); + +Insertion.After = Class.create(); +Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { + initializeRange: function() { + this.range.setStartAfter(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.parentNode.insertBefore(fragment, + this.element.nextSibling); + }).bind(this)); + } +}); + +/*--------------------------------------------------------------------------*/ + +Element.ClassNames = Class.create(); +Element.ClassNames.prototype = { + initialize: function(element) { + this.element = $(element); + }, + + _each: function(iterator) { + this.element.className.split(/\s+/).select(function(name) { + return name.length > 0; + })._each(iterator); + }, + + set: function(className) { + this.element.className = className; + }, + + add: function(classNameToAdd) { + if (this.include(classNameToAdd)) return; + this.set($A(this).concat(classNameToAdd).join(' ')); + }, + + remove: function(classNameToRemove) { + if (!this.include(classNameToRemove)) return; + this.set($A(this).without(classNameToRemove).join(' ')); + }, + + toString: function() { + return $A(this).join(' '); + } +}; + +Object.extend(Element.ClassNames.prototype, Enumerable); +var Selector = Class.create(); +Selector.prototype = { + initialize: function(expression) { + this.params = {classNames: []}; + this.expression = expression.toString().strip(); + this.parseExpression(); + this.compileMatcher(); + }, + + parseExpression: function() { + function abort(message) { throw 'Parse error in selector: ' + message; } + + if (this.expression == '') abort('empty expression'); + + var params = this.params, expr = this.expression, match, modifier, clause, rest; + while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { + params.attributes = params.attributes || []; + params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); + expr = match[1]; + } + + if (expr == '*') return this.params.wildcard = true; + + while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { + modifier = match[1], clause = match[2], rest = match[3]; + switch (modifier) { + case '#': params.id = clause; break; + case '.': params.classNames.push(clause); break; + case '': + case undefined: params.tagName = clause.toUpperCase(); break; + default: abort(expr.inspect()); + } + expr = rest; + } + + if (expr.length > 0) abort(expr.inspect()); + }, + + buildMatchExpression: function() { + var params = this.params, conditions = [], clause; + + if (params.wildcard) + conditions.push('true'); + if (clause = params.id) + conditions.push('element.readAttribute("id") == ' + clause.inspect()); + if (clause = params.tagName) + conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); + if ((clause = params.classNames).length > 0) + for (var i = 0, length = clause.length; i < length; i++) + conditions.push('element.hasClassName(' + clause[i].inspect() + ')'); + if (clause = params.attributes) { + clause.each(function(attribute) { + var value = 'element.readAttribute(' + attribute.name.inspect() + ')'; + var splitValueBy = function(delimiter) { + return value + ' && ' + value + '.split(' + delimiter.inspect() + ')'; + } + + switch (attribute.operator) { + case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break; + case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break; + case '|=': conditions.push( + splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect() + ); break; + case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break; + case '': + case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break; + default: throw 'Unknown operator ' + attribute.operator + ' in selector'; + } + }); + } + + return conditions.join(' && '); + }, + + compileMatcher: function() { + this.match = new Function('element', 'if (!element.tagName) return false; \ + element = $(element); \ + return ' + this.buildMatchExpression()); + }, + + findElements: function(scope) { + var element; + + if (element = $(this.params.id)) + if (this.match(element)) + if (!scope || Element.childOf(element, scope)) + return [element]; + + scope = (scope || document).getElementsByTagName(this.params.tagName || '*'); + + var results = []; + for (var i = 0, length = scope.length; i < length; i++) + if (this.match(element = scope[i])) + results.push(Element.extend(element)); + + return results; + }, + + toString: function() { + return this.expression; + } +} + +Object.extend(Selector, { + matchElements: function(elements, expression) { + var selector = new Selector(expression); + return elements.select(selector.match.bind(selector)).map(Element.extend); + }, + + findElement: function(elements, expression, index) { + if (typeof expression == 'number') index = expression, expression = false; + return Selector.matchElements(elements, expression || '*')[index || 0]; + }, + + findChildElements: function(element, expressions) { + return expressions.map(function(expression) { + return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) { + var selector = new Selector(expr); + return results.inject([], function(elements, result) { + return elements.concat(selector.findElements(result || element)); + }); + }); + }).flatten(); + } +}); + +function $$() { + return Selector.findChildElements(document, $A(arguments)); +} +var Form = { + reset: function(form) { + $(form).reset(); + return form; + }, + + serializeElements: function(elements, getHash) { + var data = elements.inject({}, function(result, element) { + if (!element.disabled && element.name) { + var key = element.name, value = $(element).getValue(); + if (value != undefined) { + if (result[key]) { + if (result[key].constructor != Array) result[key] = [result[key]]; + result[key].push(value); + } + else result[key] = value; + } + } + return result; + }); + + return getHash ? data : Hash.toQueryString(data); + } +}; + +Form.Methods = { + serialize: function(form, getHash) { + return Form.serializeElements(Form.getElements(form), getHash); + }, + + getElements: function(form) { + return $A($(form).getElementsByTagName('*')).inject([], + function(elements, child) { + if (Form.Element.Serializers[child.tagName.toLowerCase()]) + elements.push(Element.extend(child)); + return elements; + } + ); + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) return $A(inputs).map(Element.extend); + + for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || (name && input.name != name)) + continue; + matchingInputs.push(Element.extend(input)); + } + + return matchingInputs; + }, + + disable: function(form) { + form = $(form); + form.getElements().each(function(element) { + element.blur(); + element.disabled = 'true'; + }); + return form; + }, + + enable: function(form) { + form = $(form); + form.getElements().each(function(element) { + element.disabled = ''; + }); + return form; + }, + + findFirstElement: function(form) { + return $(form).getElements().find(function(element) { + return element.type != 'hidden' && !element.disabled && + ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + }); + }, + + focusFirstElement: function(form) { + form = $(form); + form.findFirstElement().activate(); + return form; + } +} + +Object.extend(Form, Form.Methods); + +/*--------------------------------------------------------------------------*/ + +Form.Element = { + focus: function(element) { + $(element).focus(); + return element; + }, + + select: function(element) { + $(element).select(); + return element; + } +} + +Form.Element.Methods = { + serialize: function(element) { + element = $(element); + if (!element.disabled && element.name) { + var value = element.getValue(); + if (value != undefined) { + var pair = {}; + pair[element.name] = value; + return Hash.toQueryString(pair); + } + } + return ''; + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + return Form.Element.Serializers[method](element); + }, + + clear: function(element) { + $(element).value = ''; + return element; + }, + + present: function(element) { + return $(element).value != ''; + }, + + activate: function(element) { + element = $(element); + element.focus(); + if (element.select && ( element.tagName.toLowerCase() != 'input' || + !['button', 'reset', 'submit'].include(element.type) ) ) + element.select(); + return element; + }, + + disable: function(element) { + element = $(element); + element.disabled = true; + return element; + }, + + enable: function(element) { + element = $(element); + element.blur(); + element.disabled = false; + return element; + } +} + +Object.extend(Form.Element, Form.Element.Methods); +var Field = Form.Element; +var $F = Form.Element.getValue; + +/*--------------------------------------------------------------------------*/ + +Form.Element.Serializers = { + input: function(element) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + return Form.Element.Serializers.inputSelector(element); + default: + return Form.Element.Serializers.textarea(element); + } + }, + + inputSelector: function(element) { + return element.checked ? element.value : null; + }, + + textarea: function(element) { + return element.value; + }, + + select: function(element) { + return this[element.type == 'select-one' ? + 'selectOne' : 'selectMany'](element); + }, + + selectOne: function(element) { + var index = element.selectedIndex; + return index >= 0 ? this.optionValue(element.options[index]) : null; + }, + + selectMany: function(element) { + var values, length = element.length; + if (!length) return null; + + for (var i = 0, values = []; i < length; i++) { + var opt = element.options[i]; + if (opt.selected) values.push(this.optionValue(opt)); + } + return values; + }, + + optionValue: function(opt) { + // extend element because hasAttribute may not be native + return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; + } +} + +/*--------------------------------------------------------------------------*/ + +Abstract.TimedObserver = function() {} +Abstract.TimedObserver.prototype = { + initialize: function(element, frequency, callback) { + this.frequency = frequency; + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + this.registerCallback(); + }, + + registerCallback: function() { + setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + onTimerEvent: function() { + var value = this.getValue(); + var changed = ('string' == typeof this.lastValue && 'string' == typeof value + ? this.lastValue != value : String(this.lastValue) != String(value)); + if (changed) { + this.callback(this.element, value); + this.lastValue = value; + } + } +} + +Form.Element.Observer = Class.create(); +Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(); +Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = function() {} +Abstract.EventObserver.prototype = { + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + Form.getElements(this.element).each(this.registerCallback.bind(this)); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + default: + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +} + +Form.Element.EventObserver = Class.create(); +Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(); +Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { + getValue: function() { + return Form.serialize(this.element); + } +}); +if (!window.Event) { + var Event = new Object(); +} + +Object.extend(Event, { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + KEY_HOME: 36, + KEY_END: 35, + KEY_PAGEUP: 33, + KEY_PAGEDOWN: 34, + + element: function(event) { + return event.target || event.srcElement; + }, + + isLeftClick: function(event) { + return (((event.which) && (event.which == 1)) || + ((event.button) && (event.button == 1))); + }, + + pointerX: function(event) { + return event.pageX || (event.clientX + + (document.documentElement.scrollLeft || document.body.scrollLeft)); + }, + + pointerY: function(event) { + return event.pageY || (event.clientY + + (document.documentElement.scrollTop || document.body.scrollTop)); + }, + + stop: function(event) { + if (event.preventDefault) { + event.preventDefault(); + event.stopPropagation(); + } else { + event.returnValue = false; + event.cancelBubble = true; + } + }, + + // find the first node with the given tagName, starting from the + // node the event was triggered on; traverses the DOM upwards + findElement: function(event, tagName) { + var element = Event.element(event); + while (element.parentNode && (!element.tagName || + (element.tagName.toUpperCase() != tagName.toUpperCase()))) + element = element.parentNode; + return element; + }, + + observers: false, + + _observeAndCache: function(element, name, observer, useCapture) { + if (!this.observers) this.observers = []; + if (element.addEventListener) { + this.observers.push([element, name, observer, useCapture]); + element.addEventListener(name, observer, useCapture); + } else if (element.attachEvent) { + this.observers.push([element, name, observer, useCapture]); + element.attachEvent('on' + name, observer); + } + }, + + unloadCache: function() { + if (!Event.observers) return; + for (var i = 0, length = Event.observers.length; i < length; i++) { + Event.stopObserving.apply(this, Event.observers[i]); + Event.observers[i][0] = null; + } + Event.observers = false; + }, + + observe: function(element, name, observer, useCapture) { + element = $(element); + useCapture = useCapture || false; + + if (name == 'keypress' && + (navigator.appVersion.match(/Konqueror|Safari|KHTML/) + || element.attachEvent)) + name = 'keydown'; + + Event._observeAndCache(element, name, observer, useCapture); + }, + + stopObserving: function(element, name, observer, useCapture) { + element = $(element); + useCapture = useCapture || false; + + if (name == 'keypress' && + (navigator.appVersion.match(/Konqueror|Safari|KHTML/) + || element.detachEvent)) + name = 'keydown'; + + if (element.removeEventListener) { + element.removeEventListener(name, observer, useCapture); + } else if (element.detachEvent) { + try { + element.detachEvent('on' + name, observer); + } catch (e) {} + } + } +}); + +/* prevent memory leaks in IE */ +if (navigator.appVersion.match(/\bMSIE\b/)) + Event.observe(window, 'unload', Event.unloadCache, false); +var Position = { + // set to true if needed, warning: firefox performance problems + // NOT neeeded for page scrolling, only if draggable contained in + // scrollable elements + includeScrollOffsets: false, + + // must be called before calling withinIncludingScrolloffset, every time the + // page is scrolled + prepare: function() { + this.deltaX = window.pageXOffset + || document.documentElement.scrollLeft + || document.body.scrollLeft + || 0; + this.deltaY = window.pageYOffset + || document.documentElement.scrollTop + || document.body.scrollTop + || 0; + }, + + realOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return [valueL, valueT]; + }, + + cumulativeOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return [valueL, valueT]; + }, + + positionedOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + if(element.tagName=='BODY') break; + var p = Element.getStyle(element, 'position'); + if (p == 'relative' || p == 'absolute') break; + } + } while (element); + return [valueL, valueT]; + }, + + offsetParent: function(element) { + if (element.offsetParent) return element.offsetParent; + if (element == document.body) return element; + + while ((element = element.parentNode) && element != document.body) + if (Element.getStyle(element, 'position') != 'static') + return element; + + return document.body; + }, + + // caches x/y coordinate pair to use with overlap + within: function(element, x, y) { + if (this.includeScrollOffsets) + return this.withinIncludingScrolloffsets(element, x, y); + this.xcomp = x; + this.ycomp = y; + this.offset = this.cumulativeOffset(element); + + return (y >= this.offset[1] && + y < this.offset[1] + element.offsetHeight && + x >= this.offset[0] && + x < this.offset[0] + element.offsetWidth); + }, + + withinIncludingScrolloffsets: function(element, x, y) { + var offsetcache = this.realOffset(element); + + this.xcomp = x + offsetcache[0] - this.deltaX; + this.ycomp = y + offsetcache[1] - this.deltaY; + this.offset = this.cumulativeOffset(element); + + return (this.ycomp >= this.offset[1] && + this.ycomp < this.offset[1] + element.offsetHeight && + this.xcomp >= this.offset[0] && + this.xcomp < this.offset[0] + element.offsetWidth); + }, + + // within must be called directly before + overlap: function(mode, element) { + if (!mode) return 0; + if (mode == 'vertical') + return ((this.offset[1] + element.offsetHeight) - this.ycomp) / + element.offsetHeight; + if (mode == 'horizontal') + return ((this.offset[0] + element.offsetWidth) - this.xcomp) / + element.offsetWidth; + }, + + page: function(forElement) { + var valueT = 0, valueL = 0; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + + // Safari fix + if (element.offsetParent==document.body) + if (Element.getStyle(element,'position')=='absolute') break; + + } while (element = element.offsetParent); + + element = forElement; + do { + if (!window.opera || element.tagName=='BODY') { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } + } while (element = element.parentNode); + + return [valueL, valueT]; + }, + + clone: function(source, target) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || {}) + + // find page position of source + source = $(source); + var p = Position.page(source); + + // find coordinate system to use + target = $(target); + var delta = [0, 0]; + var parent = null; + // delta [0,0] will do fine with position: fixed elements, + // position:absolute needs offsetParent deltas + if (Element.getStyle(target,'position') == 'absolute') { + parent = Position.offsetParent(target); + delta = Position.page(parent); + } + + // correct by body offsets (fixes Safari) + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + // set position + if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if(options.setWidth) target.style.width = source.offsetWidth + 'px'; + if(options.setHeight) target.style.height = source.offsetHeight + 'px'; + }, + + absolutize: function(element) { + element = $(element); + if (element.style.position == 'absolute') return; + Position.prepare(); + + var offsets = Position.positionedOffset(element); + var top = offsets[1]; + var left = offsets[0]; + var width = element.clientWidth; + var height = element.clientHeight; + + element._originalLeft = left - parseFloat(element.style.left || 0); + element._originalTop = top - parseFloat(element.style.top || 0); + element._originalWidth = element.style.width; + element._originalHeight = element.style.height; + + element.style.position = 'absolute'; + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.width = width + 'px'; + element.style.height = height + 'px'; + }, + + relativize: function(element) { + element = $(element); + if (element.style.position == 'relative') return; + Position.prepare(); + + element.style.position = 'relative'; + var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); + var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); + + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.height = element._originalHeight; + element.style.width = element._originalWidth; + } +} + +// Safari returns margins on body which is incorrect if the child is absolutely +// positioned. For performance reasons, redefine Position.cumulativeOffset for +// KHTML/WebKit only. +if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { + Position.cumulativeOffset = function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return [valueL, valueT]; + } +} + +Element.addMethods(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/js/scriptaculous.js b/maarch_entreprise/trunk/tools/tafelTree/js/scriptaculous.js new file mode 100644 index 0000000000000000000000000000000000000000..585313c3a87a25e4e500c28dcac1e66f25f67b4f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/js/scriptaculous.js @@ -0,0 +1,51 @@ +// script.aculo.us scriptaculous.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 + +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +var Scriptaculous = { + Version: '1.7.0', + require: function(libraryName) { + // inserting via DOM fails in Safari 2.0, so brute force approach + document.write('<script type="text/javascript" src="'+libraryName+'"></script>'); + }, + load: function() { + if((typeof Prototype=='undefined') || + (typeof Element == 'undefined') || + (typeof Element.Methods=='undefined') || + parseFloat(Prototype.Version.split(".")[0] + "." + + Prototype.Version.split(".")[1]) < 1.5) + throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0"); + + $A(document.getElementsByTagName("script")).findAll( function(s) { + return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) + }).each( function(s) { + var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); + var includes = s.src.match(/\?.*load=([a-z,]*)/); + (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each( + function(include) { Scriptaculous.require(path+include+'.js') }); + }); + } +} + +Scriptaculous.load(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/js/slider.js b/maarch_entreprise/trunk/tools/tafelTree/js/slider.js new file mode 100644 index 0000000000000000000000000000000000000000..f24f28233032f49bd8d83b886b63855b81501f53 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/js/slider.js @@ -0,0 +1,278 @@ +// script.aculo.us slider.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 + +// Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +if(!Control) var Control = {}; +Control.Slider = Class.create(); + +// options: +// axis: 'vertical', or 'horizontal' (default) +// +// callbacks: +// onChange(value) +// onSlide(value) +Control.Slider.prototype = { + initialize: function(handle, track, options) { + var slider = this; + + if(handle instanceof Array) { + this.handles = handle.collect( function(e) { return $(e) }); + } else { + this.handles = [$(handle)]; + } + + this.track = $(track); + this.options = options || {}; + + this.axis = this.options.axis || 'horizontal'; + this.increment = this.options.increment || 1; + this.step = parseInt(this.options.step || '1'); + this.range = this.options.range || $R(0,1); + + this.value = 0; // assure backwards compat + this.values = this.handles.map( function() { return 0 }); + this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; + this.options.startSpan = $(this.options.startSpan || null); + this.options.endSpan = $(this.options.endSpan || null); + + this.restricted = this.options.restricted || false; + + this.maximum = this.options.maximum || this.range.end; + this.minimum = this.options.minimum || this.range.start; + + // Will be used to align the handle onto the track, if necessary + this.alignX = parseInt(this.options.alignX || '0'); + this.alignY = parseInt(this.options.alignY || '0'); + + this.trackLength = this.maximumOffset() - this.minimumOffset(); + + this.handleLength = this.isVertical() ? + (this.handles[0].offsetHeight != 0 ? + this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : + (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : + this.handles[0].style.width.replace(/px$/,"")); + + this.active = false; + this.dragging = false; + this.disabled = false; + + if(this.options.disabled) this.setDisabled(); + + // Allowed values array + this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; + if(this.allowedValues) { + this.minimum = this.allowedValues.min(); + this.maximum = this.allowedValues.max(); + } + + this.eventMouseDown = this.startDrag.bindAsEventListener(this); + this.eventMouseUp = this.endDrag.bindAsEventListener(this); + this.eventMouseMove = this.update.bindAsEventListener(this); + + // Initialize handles in reverse (make sure first handle is active) + this.handles.each( function(h,i) { + i = slider.handles.length-1-i; + slider.setValue(parseFloat( + (slider.options.sliderValue instanceof Array ? + slider.options.sliderValue[i] : slider.options.sliderValue) || + slider.range.start), i); + Element.makePositioned(h); // fix IE + Event.observe(h, "mousedown", slider.eventMouseDown); + }); + + Event.observe(this.track, "mousedown", this.eventMouseDown); + Event.observe(document, "mouseup", this.eventMouseUp); + Event.observe(document, "mousemove", this.eventMouseMove); + + this.initialized = true; + }, + dispose: function() { + var slider = this; + Event.stopObserving(this.track, "mousedown", this.eventMouseDown); + Event.stopObserving(document, "mouseup", this.eventMouseUp); + Event.stopObserving(document, "mousemove", this.eventMouseMove); + this.handles.each( function(h) { + Event.stopObserving(h, "mousedown", slider.eventMouseDown); + }); + }, + setDisabled: function(){ + this.disabled = true; + }, + setEnabled: function(){ + this.disabled = false; + }, + getNearestValue: function(value){ + if(this.allowedValues){ + if(value >= this.allowedValues.max()) return(this.allowedValues.max()); + if(value <= this.allowedValues.min()) return(this.allowedValues.min()); + + var offset = Math.abs(this.allowedValues[0] - value); + var newValue = this.allowedValues[0]; + this.allowedValues.each( function(v) { + var currentOffset = Math.abs(v - value); + if(currentOffset <= offset){ + newValue = v; + offset = currentOffset; + } + }); + return newValue; + } + if(value > this.range.end) return this.range.end; + if(value < this.range.start) return this.range.start; + return value; + }, + setValue: function(sliderValue, handleIdx){ + if(!this.active) { + this.activeHandleIdx = handleIdx || 0; + this.activeHandle = this.handles[this.activeHandleIdx]; + this.updateStyles(); + } + handleIdx = handleIdx || this.activeHandleIdx || 0; + if(this.initialized && this.restricted) { + if((handleIdx>0) && (sliderValue<this.values[handleIdx-1])) + sliderValue = this.values[handleIdx-1]; + if((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1])) + sliderValue = this.values[handleIdx+1]; + } + sliderValue = this.getNearestValue(sliderValue); + this.values[handleIdx] = sliderValue; + this.value = this.values[0]; // assure backwards compat + + this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = + this.translateToPx(sliderValue); + + this.drawSpans(); + if(!this.dragging || !this.event) this.updateFinished(); + }, + setValueBy: function(delta, handleIdx) { + this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, + handleIdx || this.activeHandleIdx || 0); + }, + translateToPx: function(value) { + return Math.round( + ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * + (value - this.range.start)) + "px"; + }, + translateToValue: function(offset) { + return ((offset/(this.trackLength-this.handleLength) * + (this.range.end-this.range.start)) + this.range.start); + }, + getRange: function(range) { + var v = this.values.sortBy(Prototype.K); + range = range || 0; + return $R(v[range],v[range+1]); + }, + minimumOffset: function(){ + return(this.isVertical() ? this.alignY : this.alignX); + }, + maximumOffset: function(){ + return(this.isVertical() ? + (this.track.offsetHeight != 0 ? this.track.offsetHeight : + this.track.style.height.replace(/px$/,"")) - this.alignY : + (this.track.offsetWidth != 0 ? this.track.offsetWidth : + this.track.style.width.replace(/px$/,"")) - this.alignY); + }, + isVertical: function(){ + return (this.axis == 'vertical'); + }, + drawSpans: function() { + var slider = this; + if(this.spans) + $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); + if(this.options.startSpan) + this.setSpan(this.options.startSpan, + $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); + if(this.options.endSpan) + this.setSpan(this.options.endSpan, + $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); + }, + setSpan: function(span, range) { + if(this.isVertical()) { + span.style.top = this.translateToPx(range.start); + span.style.height = this.translateToPx(range.end - range.start + this.range.start); + } else { + span.style.left = this.translateToPx(range.start); + span.style.width = this.translateToPx(range.end - range.start + this.range.start); + } + }, + updateStyles: function() { + this.handles.each( function(h){ Element.removeClassName(h, 'selected') }); + Element.addClassName(this.activeHandle, 'selected'); + }, + startDrag: function(event) { + if(Event.isLeftClick(event)) { + if(!this.disabled){ + this.active = true; + + var handle = Event.element(event); + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var track = handle; + if(track==this.track) { + var offsets = Position.cumulativeOffset(this.track); + this.event = event; + this.setValue(this.translateToValue( + (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) + )); + var offsets = Position.cumulativeOffset(this.activeHandle); + this.offsetX = (pointer[0] - offsets[0]); + this.offsetY = (pointer[1] - offsets[1]); + } else { + // find the handle (prevents issues with Safari) + while((this.handles.indexOf(handle) == -1) && handle.parentNode) + handle = handle.parentNode; + + if(this.handles.indexOf(handle)!=-1) { + this.activeHandle = handle; + this.activeHandleIdx = this.handles.indexOf(this.activeHandle); + this.updateStyles(); + + var offsets = Position.cumulativeOffset(this.activeHandle); + this.offsetX = (pointer[0] - offsets[0]); + this.offsetY = (pointer[1] - offsets[1]); + } + } + } + Event.stop(event); + } + }, + update: function(event) { + if(this.active) { + if(!this.dragging) this.dragging = true; + this.draw(event); + // fix AppleWebKit rendering + if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); + Event.stop(event); + } + }, + draw: function(event) { + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var offsets = Position.cumulativeOffset(this.track); + pointer[0] -= this.offsetX + offsets[0]; + pointer[1] -= this.offsetY + offsets[1]; + this.event = event; + this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); + if(this.initialized && this.options.onSlide) + this.options.onSlide(this.values.length>1 ? this.values : this.value, this); + }, + endDrag: function(event) { + if(this.active && this.dragging) { + this.finishDrag(event, true); + Event.stop(event); + } + this.active = false; + this.dragging = false; + }, + finishDrag: function(event, success) { + this.active = false; + this.dragging = false; + this.updateFinished(); + }, + updateFinished: function() { + if(this.initialized && this.options.onChange) + this.options.onChange(this.values.length>1 ? this.values : this.value, this); + this.event = null; + } +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/js/unittest.js b/maarch_entreprise/trunk/tools/tafelTree/js/unittest.js new file mode 100644 index 0000000000000000000000000000000000000000..a4478855ec2045c0a403da1b6994555986962fff --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/js/unittest.js @@ -0,0 +1,564 @@ +// script.aculo.us unittest.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 + +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) +// (c) 2005, 2006 Michael Schuerig (http://www.schuerig.de/michael/) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// experimental, Firefox-only +Event.simulateMouse = function(element, eventName) { + var options = Object.extend({ + pointerX: 0, + pointerY: 0, + buttons: 0, + ctrlKey: false, + altKey: false, + shiftKey: false, + metaKey: false + }, arguments[2] || {}); + var oEvent = document.createEvent("MouseEvents"); + oEvent.initMouseEvent(eventName, true, true, document.defaultView, + options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element)); + + if(this.mark) Element.remove(this.mark); + this.mark = document.createElement('div'); + this.mark.appendChild(document.createTextNode(" ")); + document.body.appendChild(this.mark); + this.mark.style.position = 'absolute'; + this.mark.style.top = options.pointerY + "px"; + this.mark.style.left = options.pointerX + "px"; + this.mark.style.width = "5px"; + this.mark.style.height = "5px;"; + this.mark.style.borderTop = "1px solid red;" + this.mark.style.borderLeft = "1px solid red;" + + if(this.step) + alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options)); + + $(element).dispatchEvent(oEvent); +}; + +// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2. +// You need to downgrade to 1.0.4 for now to get this working +// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much +Event.simulateKey = function(element, eventName) { + var options = Object.extend({ + ctrlKey: false, + altKey: false, + shiftKey: false, + metaKey: false, + keyCode: 0, + charCode: 0 + }, arguments[2] || {}); + + var oEvent = document.createEvent("KeyEvents"); + oEvent.initKeyEvent(eventName, true, true, window, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, + options.keyCode, options.charCode ); + $(element).dispatchEvent(oEvent); +}; + +Event.simulateKeys = function(element, command) { + for(var i=0; i<command.length; i++) { + Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)}); + } +}; + +var Test = {} +Test.Unit = {}; + +// security exception workaround +Test.Unit.inspect = Object.inspect; + +Test.Unit.Logger = Class.create(); +Test.Unit.Logger.prototype = { + initialize: function(log) { + this.log = $(log); + if (this.log) { + this._createLogTable(); + } + }, + start: function(testName) { + if (!this.log) return; + this.testName = testName; + this.lastLogLine = document.createElement('tr'); + this.statusCell = document.createElement('td'); + this.nameCell = document.createElement('td'); + this.nameCell.className = "nameCell"; + this.nameCell.appendChild(document.createTextNode(testName)); + this.messageCell = document.createElement('td'); + this.lastLogLine.appendChild(this.statusCell); + this.lastLogLine.appendChild(this.nameCell); + this.lastLogLine.appendChild(this.messageCell); + this.loglines.appendChild(this.lastLogLine); + }, + finish: function(status, summary) { + if (!this.log) return; + this.lastLogLine.className = status; + this.statusCell.innerHTML = status; + this.messageCell.innerHTML = this._toHTML(summary); + this.addLinksToResults(); + }, + message: function(message) { + if (!this.log) return; + this.messageCell.innerHTML = this._toHTML(message); + }, + summary: function(summary) { + if (!this.log) return; + this.logsummary.innerHTML = this._toHTML(summary); + }, + _createLogTable: function() { + this.log.innerHTML = + '<div id="logsummary"></div>' + + '<table id="logtable">' + + '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' + + '<tbody id="loglines"></tbody>' + + '</table>'; + this.logsummary = $('logsummary') + this.loglines = $('loglines'); + }, + _toHTML: function(txt) { + return txt.escapeHTML().replace(/\n/g,"<br/>"); + }, + addLinksToResults: function(){ + $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log + td.title = "Run only this test" + Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;}); + }); + $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log + td.title = "Run all tests" + Event.observe(td, 'click', function(){ window.location.search = "";}); + }); + } +} + +Test.Unit.Runner = Class.create(); +Test.Unit.Runner.prototype = { + initialize: function(testcases) { + this.options = Object.extend({ + testLog: 'testlog' + }, arguments[1] || {}); + this.options.resultsURL = this.parseResultsURLQueryParameter(); + this.options.tests = this.parseTestsQueryParameter(); + if (this.options.testLog) { + this.options.testLog = $(this.options.testLog) || null; + } + if(this.options.tests) { + this.tests = []; + for(var i = 0; i < this.options.tests.length; i++) { + if(/^test/.test(this.options.tests[i])) { + this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"])); + } + } + } else { + if (this.options.test) { + this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])]; + } else { + this.tests = []; + for(var testcase in testcases) { + if(/^test/.test(testcase)) { + this.tests.push( + new Test.Unit.Testcase( + this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, + testcases[testcase], testcases["setup"], testcases["teardown"] + )); + } + } + } + } + this.currentTest = 0; + this.logger = new Test.Unit.Logger(this.options.testLog); + setTimeout(this.runTests.bind(this), 1000); + }, + parseResultsURLQueryParameter: function() { + return window.location.search.parseQuery()["resultsURL"]; + }, + parseTestsQueryParameter: function(){ + if (window.location.search.parseQuery()["tests"]){ + return window.location.search.parseQuery()["tests"].split(','); + }; + }, + // Returns: + // "ERROR" if there was an error, + // "FAILURE" if there was a failure, or + // "SUCCESS" if there was neither + getResult: function() { + var hasFailure = false; + for(var i=0;i<this.tests.length;i++) { + if (this.tests[i].errors > 0) { + return "ERROR"; + } + if (this.tests[i].failures > 0) { + hasFailure = true; + } + } + if (hasFailure) { + return "FAILURE"; + } else { + return "SUCCESS"; + } + }, + postResults: function() { + if (this.options.resultsURL) { + new Ajax.Request(this.options.resultsURL, + { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false }); + } + }, + runTests: function() { + var test = this.tests[this.currentTest]; + if (!test) { + // finished! + this.postResults(); + this.logger.summary(this.summary()); + return; + } + if(!test.isWaiting) { + this.logger.start(test.name); + } + test.run(); + if(test.isWaiting) { + this.logger.message("Waiting for " + test.timeToWait + "ms"); + setTimeout(this.runTests.bind(this), test.timeToWait || 1000); + } else { + this.logger.finish(test.status(), test.summary()); + this.currentTest++; + // tail recursive, hopefully the browser will skip the stackframe + this.runTests(); + } + }, + summary: function() { + var assertions = 0; + var failures = 0; + var errors = 0; + var messages = []; + for(var i=0;i<this.tests.length;i++) { + assertions += this.tests[i].assertions; + failures += this.tests[i].failures; + errors += this.tests[i].errors; + } + return ( + (this.options.context ? this.options.context + ': ': '') + + this.tests.length + " tests, " + + assertions + " assertions, " + + failures + " failures, " + + errors + " errors"); + } +} + +Test.Unit.Assertions = Class.create(); +Test.Unit.Assertions.prototype = { + initialize: function() { + this.assertions = 0; + this.failures = 0; + this.errors = 0; + this.messages = []; + }, + summary: function() { + return ( + this.assertions + " assertions, " + + this.failures + " failures, " + + this.errors + " errors" + "\n" + + this.messages.join("\n")); + }, + pass: function() { + this.assertions++; + }, + fail: function(message) { + this.failures++; + this.messages.push("Failure: " + message); + }, + info: function(message) { + this.messages.push("Info: " + message); + }, + error: function(error) { + this.errors++; + this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")"); + }, + status: function() { + if (this.failures > 0) return 'failed'; + if (this.errors > 0) return 'error'; + return 'passed'; + }, + assert: function(expression) { + var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"'; + try { expression ? this.pass() : + this.fail(message); } + catch(e) { this.error(e); } + }, + assertEqual: function(expected, actual) { + var message = arguments[2] || "assertEqual"; + try { (expected == actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertInspect: function(expected, actual) { + var message = arguments[2] || "assertInspect"; + try { (expected == actual.inspect()) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertEnumEqual: function(expected, actual) { + var message = arguments[2] || "assertEnumEqual"; + try { $A(expected).length == $A(actual).length && + expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ? + this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + + ', actual ' + Test.Unit.inspect(actual)); } + catch(e) { this.error(e); } + }, + assertNotEqual: function(expected, actual) { + var message = arguments[2] || "assertNotEqual"; + try { (expected != actual) ? this.pass() : + this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertIdentical: function(expected, actual) { + var message = arguments[2] || "assertIdentical"; + try { (expected === actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertNotIdentical: function(expected, actual) { + var message = arguments[2] || "assertNotIdentical"; + try { !(expected === actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertNull: function(obj) { + var message = arguments[1] || 'assertNull' + try { (obj==null) ? this.pass() : + this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); } + catch(e) { this.error(e); } + }, + assertMatch: function(expected, actual) { + var message = arguments[2] || 'assertMatch'; + var regex = new RegExp(expected); + try { (regex.exec(actual)) ? this.pass() : + this.fail(message + ' : regex: "' + Test.Unit.inspect(expected) + ' did not match: ' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertHidden: function(element) { + var message = arguments[1] || 'assertHidden'; + this.assertEqual("none", element.style.display, message); + }, + assertNotNull: function(object) { + var message = arguments[1] || 'assertNotNull'; + this.assert(object != null, message); + }, + assertType: function(expected, actual) { + var message = arguments[2] || 'assertType'; + try { + (actual.constructor == expected) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + (actual.constructor) + '"'); } + catch(e) { this.error(e); } + }, + assertNotOfType: function(expected, actual) { + var message = arguments[2] || 'assertNotOfType'; + try { + (actual.constructor != expected) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + (actual.constructor) + '"'); } + catch(e) { this.error(e); } + }, + assertInstanceOf: function(expected, actual) { + var message = arguments[2] || 'assertInstanceOf'; + try { + (actual instanceof expected) ? this.pass() : + this.fail(message + ": object was not an instance of the expected type"); } + catch(e) { this.error(e); } + }, + assertNotInstanceOf: function(expected, actual) { + var message = arguments[2] || 'assertNotInstanceOf'; + try { + !(actual instanceof expected) ? this.pass() : + this.fail(message + ": object was an instance of the not expected type"); } + catch(e) { this.error(e); } + }, + assertRespondsTo: function(method, obj) { + var message = arguments[2] || 'assertRespondsTo'; + try { + (obj[method] && typeof obj[method] == 'function') ? this.pass() : + this.fail(message + ": object doesn't respond to [" + method + "]"); } + catch(e) { this.error(e); } + }, + assertReturnsTrue: function(method, obj) { + var message = arguments[2] || 'assertReturnsTrue'; + try { + var m = obj[method]; + if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; + m() ? this.pass() : + this.fail(message + ": method returned false"); } + catch(e) { this.error(e); } + }, + assertReturnsFalse: function(method, obj) { + var message = arguments[2] || 'assertReturnsFalse'; + try { + var m = obj[method]; + if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; + !m() ? this.pass() : + this.fail(message + ": method returned true"); } + catch(e) { this.error(e); } + }, + assertRaise: function(exceptionName, method) { + var message = arguments[2] || 'assertRaise'; + try { + method(); + this.fail(message + ": exception expected but none was raised"); } + catch(e) { + ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); + } + }, + assertElementsMatch: function() { + var expressions = $A(arguments), elements = $A(expressions.shift()); + if (elements.length != expressions.length) { + this.fail('assertElementsMatch: size mismatch: ' + elements.length + ' elements, ' + expressions.length + ' expressions'); + return false; + } + elements.zip(expressions).all(function(pair, index) { + var element = $(pair.first()), expression = pair.last(); + if (element.match(expression)) return true; + this.fail('assertElementsMatch: (in index ' + index + ') expected ' + expression.inspect() + ' but got ' + element.inspect()); + }.bind(this)) && this.pass(); + }, + assertElementMatches: function(element, expression) { + this.assertElementsMatch([element], expression); + }, + benchmark: function(operation, iterations) { + var startAt = new Date(); + (iterations || 1).times(operation); + var timeTaken = ((new Date())-startAt); + this.info((arguments[2] || 'Operation') + ' finished ' + + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); + return timeTaken; + }, + _isVisible: function(element) { + element = $(element); + if(!element.parentNode) return true; + this.assertNotNull(element); + if(element.style && Element.getStyle(element, 'display') == 'none') + return false; + + return this._isVisible(element.parentNode); + }, + assertNotVisible: function(element) { + this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1])); + }, + assertVisible: function(element) { + this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1])); + }, + benchmark: function(operation, iterations) { + var startAt = new Date(); + (iterations || 1).times(operation); + var timeTaken = ((new Date())-startAt); + this.info((arguments[2] || 'Operation') + ' finished ' + + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); + return timeTaken; + } +} + +Test.Unit.Testcase = Class.create(); +Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), { + initialize: function(name, test, setup, teardown) { + Test.Unit.Assertions.prototype.initialize.bind(this)(); + this.name = name; + + if(typeof test == 'string') { + test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,'); + test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)'); + this.test = function() { + eval('with(this){'+test+'}'); + } + } else { + this.test = test || function() {}; + } + + this.setup = setup || function() {}; + this.teardown = teardown || function() {}; + this.isWaiting = false; + this.timeToWait = 1000; + }, + wait: function(time, nextPart) { + this.isWaiting = true; + this.test = nextPart; + this.timeToWait = time; + }, + run: function() { + try { + try { + if (!this.isWaiting) this.setup.bind(this)(); + this.isWaiting = false; + this.test.bind(this)(); + } finally { + if(!this.isWaiting) { + this.teardown.bind(this)(); + } + } + } + catch(e) { this.error(e); } + } +}); + +// *EXPERIMENTAL* BDD-style testing to please non-technical folk +// This draws many ideas from RSpec http://rspec.rubyforge.org/ + +Test.setupBDDExtensionMethods = function(){ + var METHODMAP = { + shouldEqual: 'assertEqual', + shouldNotEqual: 'assertNotEqual', + shouldEqualEnum: 'assertEnumEqual', + shouldBeA: 'assertType', + shouldNotBeA: 'assertNotOfType', + shouldBeAn: 'assertType', + shouldNotBeAn: 'assertNotOfType', + shouldBeNull: 'assertNull', + shouldNotBeNull: 'assertNotNull', + + shouldBe: 'assertReturnsTrue', + shouldNotBe: 'assertReturnsFalse', + shouldRespondTo: 'assertRespondsTo' + }; + Test.BDDMethods = {}; + for(m in METHODMAP) { + Test.BDDMethods[m] = eval( + 'function(){'+ + 'var args = $A(arguments);'+ + 'var scope = args.shift();'+ + 'scope.'+METHODMAP[m]+'.apply(scope,(args || []).concat([this])); }'); + } + [Array.prototype, String.prototype, Number.prototype].each( + function(p){ Object.extend(p, Test.BDDMethods) } + ); +} + +Test.context = function(name, spec, log){ + Test.setupBDDExtensionMethods(); + + var compiledSpec = {}; + var titles = {}; + for(specName in spec) { + switch(specName){ + case "setup": + case "teardown": + compiledSpec[specName] = spec[specName]; + break; + default: + var testName = 'test'+specName.gsub(/\s+/,'-').camelize(); + var body = spec[specName].toString().split('\n').slice(1); + if(/^\{/.test(body[0])) body = body.slice(1); + body.pop(); + body = body.map(function(statement){ + return statement.strip() + }); + compiledSpec[testName] = body.join('\n'); + titles[testName] = specName; + } + } + new Test.Unit.Runner(compiledSpec, { titles: titles, testLog: log || 'testlog', context: name }); +}; \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/open.html b/maarch_entreprise/trunk/tools/tafelTree/open.html new file mode 100644 index 0000000000000000000000000000000000000000..d986c6d07a798837700b2dc73c128d7e048f18be --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/open.html @@ -0,0 +1,94 @@ +<html> +<head> + <title>OpenOfficeGeneration Documentation</title> + <link rel="stylesheet" type="text/css" href="css/tree.css" /> + <style> + body { + background-color: #FFFFFF; + } + .mover { + background-color: #FF9999; + color: #FFEEEE; + } + + .special { + color: #CC0000; + } + + .tafelTree h3, .tafelTree p, .tafelTree ol { + margin: 0; + padding: 0; + } + + .tafelTree p { + padding-bottom: 1em; + } + + .tafelTree h3 { + color: #009900; + } + </style> + <script type="text/javascript" src="js/prototype.js"></script> + <script type="text/javascript" src="js/scriptaculous.js"></script> + <script type="text/javascript" src="Tree.js"></script> +</head> +<body> + + + <script type="text/javascript"> + function funcOpen (branch, response) { + // Ici tu peux traiter le retour et retourner true si + // tu veux insérer les enfants, false si tu veux pas + return true; + } + var tree = null; + function TafelTreeInit () { + var struct = [ + { + 'id':'root1', + 'txt':'Element racine', + 'items':[ + { + 'id':'child1', + 'txt':'Un enfant', + 'canhavechildren' : true + }, + { + 'id':'child2', + 'txt':'Un enfant 2' + }, + { + 'id':'child3', + 'txt':'Un enfant 3', + 'canhavechildren' : true + }, + { + 'id':'child4', + 'txt':'Un enfant 4', + 'canhavechildren' : true + } + ] + } + ]; + tree = new TafelTree('test', struct, { + 'generate' : true, + 'imgBase' : 'imgs/', + 'defaultImg' : 'page.gif', + 'defaultImgOpen' : 'folderopen.gif', + 'defaultImgClose' : 'folder.gif', + 'onOpenPopulate' : [funcOpen, 'sampleOpen1.php'] + }); + } + + function effet () { + var branch = tree.getBranchById('child1'); + branch.refreshChildren(); + } + </script> + <div id="test"></div> + <p><a href="#" onclick="effet()">Effet</a></p> + + + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tafelTree/sampleEdit1.php b/maarch_entreprise/trunk/tools/tafelTree/sampleEdit1.php new file mode 100644 index 0000000000000000000000000000000000000000..aef65c8274452b14dae9461935b0bf690214477e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/sampleEdit1.php @@ -0,0 +1,7 @@ +<?php + +if (isset($_POST['branch_id'])) { + echo $_POST['new_value']; +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/sampleOpen1.php b/maarch_entreprise/trunk/tools/tafelTree/sampleOpen1.php new file mode 100644 index 0000000000000000000000000000000000000000..af3dc867db4bfc37c164fde4dce0dc1dd695f29c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/sampleOpen1.php @@ -0,0 +1,38 @@ +<?php + +if (isset($_POST['branch_id'])) { + switch ($_POST['branch_id']) { + case 'child1' : + // Création du tableau de branches enfant pour child1 + echo "["; + echo "{id:'server1', txt:'Du serveur 1'},"; + echo "{id:'server2', txt:'Du serveur 2'}"; + echo ",{id:'server2d', txt:'Du serveur 2d'}"; + echo "]"; + break; + case 'child3' : + // Création du tableau de branches enfant pour child3 + echo "["; + echo "{id:'server3', txt:'Du serveur 3'}"; + echo "]"; + break; + case 'child4' : + // Création du tableau de branches enfant pour child4 + echo "["; + echo "{id:'server4', txt:'Du serveur 4'},"; + echo "{id:'server5', txt:'Du serveur 5', canhavechildren:true},"; + echo "{id:'server6', txt:'Du serveur 6'}"; + echo "]"; + break; + case 'server5' : + // Création du tableau de branches enfant pour server5 + echo "["; + echo "{id:'server7', txt:'Du serveur 7'}"; + echo "]"; + break; + default : + // Ne fait rien + } +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php4/JSON.php b/maarch_entreprise/trunk/tools/tafelTree/server/php4/JSON.php new file mode 100644 index 0000000000000000000000000000000000000000..80d799da19d0d4a0830781a8ac9a61e970be96b5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php4/JSON.php @@ -0,0 +1,804 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Converts to and from JSON format. + * + * JSON (JavaScript Object Notation) is a lightweight data-interchange + * format. It is easy for humans to read and write. It is easy for machines + * to parse and generate. It is based on a subset of the JavaScript + * Programming Language, Standard ECMA-262 3rd Edition - December 1999. + * This feature can also be found in Python. JSON is a text format that is + * completely language independent but uses conventions that are familiar + * to programmers of the C-family of languages, including C, C++, C#, Java, + * JavaScript, Perl, TCL, and many others. These properties make JSON an + * ideal data-interchange language. + * + * This package provides a simple encoder and decoder for JSON notation. It + * is intended for use with client-side Javascript applications that make + * use of HTTPRequest to perform server communication functions - data can + * be encoded into JSON notation for use in a client-side javascript, or + * decoded from incoming Javascript requests. JSON format is native to + * Javascript, and can be directly eval()'ed with no further parsing + * overhead + * + * All strings should be in ASCII or UTF-8 format! + * + * LICENSE: Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: Redistributions of source code must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * @category + * @package Services_JSON + * @author Michal Migurski <mike-json@teczno.com> + * @author Matt Knapp <mdknapp[at]gmail[dot]com> + * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com> + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.1 2006/11/13 16:47:48 rekam Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_SLICE', 1); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_STR', 2); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_ARR', 3); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_OBJ', 4); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_CMT', 5); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_LOOSE_TYPE', 16); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_SUPPRESS_ERRORS', 32); + +/** + * Converts to and from JSON format. + * + * Brief example of use: + * + * <code> + * // create a new instance of Services_JSON + * $json = new Services_JSON(); + * + * // convert a complexe value to JSON notation, and send it to the browser + * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); + * $output = $json->encode($value); + * + * print($output); + * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] + * + * // accept incoming POST data, assumed to be in JSON notation + * $input = file_get_contents('php://input', 1000000); + * $value = $json->decode($input); + * </code> + */ +class Services_JSON +{ + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + return '"'.$ascii.'"'; + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); + + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } + + return false; + } +} + +if (class_exists('PEAR_Error')) { + + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } + +} else { + + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + + } + } + +} + +?> diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php4/LICENSE b/maarch_entreprise/trunk/tools/tafelTree/server/php4/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e59acee720bde1b3b0a3504bec415c5c34ff1ab0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php4/LICENSE @@ -0,0 +1,24 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +http://pear.php.net/pepr/pepr-proposal-show.php?id=198 +http://mike.teczno.com/JSON/doc/ \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php4/TafelTree.class.php b/maarch_entreprise/trunk/tools/tafelTree/server/php4/TafelTree.class.php new file mode 100644 index 0000000000000000000000000000000000000000..9af7a7af21fe8f84e353092a4dd320d7fcb5ed2e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php4/TafelTree.class.php @@ -0,0 +1,223 @@ +<?php + +include_once ('JSON.php'); +include_once ('TafelTreeBranch.class.php'); + +/** + * + * + * @author FTafel + */ +class TafelTree { + + + /** + *------------------------------------------------------------------------------ + * Propriétés + *------------------------------------------------------------------------------ + */ + + /** + * @access protected + * @var string $id L'id de l'arbre + */ + var $id; + + /** + * @access protected + * @var string $id L'id de l'arbre + */ + var $width; + + /** + * @access protected + * @var string $id L'id de l'arbre + */ + var $height; + + /** + * @access protected + * @var string $id L'id de l'arbre + */ + var $pathImgs; + + /** + * @access protected + * @var array $options Les options de load de l'arbre + */ + var $options; + + + /** + *------------------------------------------------------------------------------ + * Constructeur + *------------------------------------------------------------------------------ + */ + + /** + * Constructeur + * + * @access public + * @param string id L'id de l'élément HTML conteneur + * @param string imgBase Le path vers les images + * @param integer width La largeur de l'arbre + * @param integer height La hauteur de l'arbre + * @param array options Les options de l'arbre + */ + function TafelTree ($id, $imgs = 'imgs/', $width = '100%', $height = 'auto', $options = array()){ + $this->id = $id; + $this->pathImgs = $imgs; + $this->width = $width; + $this->height = $height; + $this->options = array(); + foreach ($options as $property => $value) { + $this->options[$property] = $value; + } + } + + /** + * Load les infos depuis une string JSON + * + * @access public + * @param string $json La string JSON + * @return TafelTree Le TafelTree créé + */ + function &loadJSON ($json, $id, $imgs = 'imgs/', $width = '100%', $height = 'auto', $options = array()) { + $tree =& new TafelTree($id, $imgs, $width, $height, $options); + $service = new Services_JSON(); + $tree->items =& TafelTree::loadServiceJSON($service->decode($json)); + return $tree; + } + + /** + * Load les infos depuis un objet Service_JSON + * + * @access public + * @param Service_JSON $service L'objet Service_JSON + * @return array Les TafelTreeBranch créées + */ + function &loadServiceJSON ($service) { + $branches = array(); + foreach ($service as $branch) { + $branches[] =& TafelTreeBranch::loadServiceJSON($branch); + } + return $branches; + } + + + + /** + *------------------------------------------------------------------------------ + * Fonctions getters et setters + *------------------------------------------------------------------------------ + */ + + function getId() { + return $this->id; + } + function getPathImgs() { + return $this->pathImgs; + } + function getWidth() { + return $this->width; + } + function getHeight() { + return $this->height; + } + + + /** + *------------------------------------------------------------------------------ + * Fonctions publiques + *------------------------------------------------------------------------------ + */ + + /** + * Ajoute une branche comme enfant + * + * @access public + * @param TafelTreeBranch $branch La branche à ajouter + * @return void + */ + function &add ($branch) { + if (!isset($this->items)) { + $this->items = array(); + } + $this->items[] =& $branch; + } + + /** + * Ajoute une sous-branche à l'arbre + * + * @access public + * @param string $id L'id de la sous-branche + * @param string $txt Le texte de la sous-branche + * @param array $options Les informations complémentaires + * @return TafelTreeBranch La sous-branche + */ + function &addBranch ($id, $txt, $options = array()) { + $branch =& new TafelTreeBranch (); + $branch->setId($id); + $branch->setText($txt); + foreach ($options as $property => $value) { + if ($property != 'items') { + $branch->setParam($property, $value); + } + } + if (isset($options['items'])) { + foreach ($options['items'] as $opt) { + $branch->addBranch(null, null, $opt); + } + } + if (!isset($this->items)) { + $this->items = array(); + } + $this->items[] =& $branch; + return $branch; + } + + /** + * Affiche la méthode d'initialisation de l'arbre + * + * @access public + * @param integer $debug Mettre 1 ou 2 pour avoir un affichage plus lisible + * @return string La string de la méthode JS d'initialisation + */ + function display ($debug = 0) { + if ($debug == 1) { + $d = '<br />'; + } elseif ($debug == 2) { + $d = "\n"; + } else { + $d = ''; + } + if (count($this->options) > 0) { + $s = new Services_JSON(); + $options = ','.$s->encode($this->options); + } + $str = "var tree_".$this->id." = null;".$d; + $str .= "function TafelTreeInit() {".$d; + $str .= "tree_".$this->id." = new TafelTree (".$d; + $str .= "'".$this->getId()."', ".$d; + $str .= $this->getJSON().", ".$d; + $str .= "'".$this->getPathImgs()."', ".$d; + $str .= "'".$this->getWidth()."', ".$d; + $str .= "'".$this->getHeight()."'".$options; + $str .= ");".$d; + $str .= "};".$d; + return $str; + } + + /** + * Affiche la structure JSON de l'arbre + * + * @access public + * @return string La structure JSON de l'arbre + */ + function getJSON () { + $service = new Services_JSON(); + return $service->encode($this->items); + } +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php4/TafelTreeBranch.class.php b/maarch_entreprise/trunk/tools/tafelTree/server/php4/TafelTreeBranch.class.php new file mode 100644 index 0000000000000000000000000000000000000000..f6af458dd4e5357d225996fdab5484e7bf0484e9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php4/TafelTreeBranch.class.php @@ -0,0 +1,181 @@ +<?php + +/** + * + * + * @author FTafel + */ +class TafelTreeBranch { + + + /** + *------------------------------------------------------------------------------ + * Propriétés + *------------------------------------------------------------------------------ + */ + + /** + * @access protected + * @var string $id L'id de la branche + */ + var $id; + + /** + * @access protected + * @var string $txt Le texte de la branche + */ + var $txt; + + + /** + *------------------------------------------------------------------------------ + * Constructeur + *------------------------------------------------------------------------------ + */ + + /** + * Constructeur + * + * @access public + */ + function TafelTreeBranch (){ + } + + /** + * Load les infos depuis une string JSON + * + * @access public + * @param string $json La string JSON + * @return array Les TafelTreeBranch créées + */ + function &loadJSON ($json) { + $service = new Services_JSON(); + $obj = $service->decode($json); + $branches = array(); + foreach ($obj as $s) { + $branches[] =& TafelTreeBranch::loadServiceJSON($s); + } + return $branches; + } + + /** + * Load les infos depuis un objet Service_JSON + * + * @access public + * @param Service_JSON $service L'objet Service_JSON + * @return array Les TafelTreeBranch créées + */ + function &loadServiceJSON ($service) { + $branch =& new TafelTreeBranch(); + // On check toutes les propriétés de branche + foreach ($service as $property => $value) { + if ($property != 'items') { + $branch->setParam($property, $value); + } + } + // On check les enfants + if (isset($service) && isset($service->items)) { + $branch->items = array(); + foreach ($service->items as $b) { + $branch->items[] =& TafelTreeBranch::loadServiceJSON($b); + } + } + return $branch; + } + + + + /** + *------------------------------------------------------------------------------ + * Fonctions getters et setters + *------------------------------------------------------------------------------ + */ + + function getId () {return $this->id;} + function setId ($id) {$this->id = $id;} + + function getText () {return $this->txt;} + function setText ($txt) {$this->txt = $txt;} + + function getParam ($param) { + if (isset($this->$param)) { + return $this->$param; + } + } + + function setParam ($param, $value) { + if ($param == 'id') { + $this->setId($value); + } elseif ($param == 'txt') { + $this->setText($value); + } else { + $this->$param = $value; + } + } + + + /** + *------------------------------------------------------------------------------ + * Fonctions publiques + *------------------------------------------------------------------------------ + */ + + /** + * Ajoute une branche comme enfant + * + * @access public + * @param TafelTreeBranch $branch La branche à ajouter + * @return void + */ + function &add ($branch) { + if (!isset($this->items)) { + $this->items = array(); + } + $this->items[] =& $branch; + } + + /** + * Ajoute une sous-branche à la branche courante + * + * @access public + * @param string $id L'id de la sous-branche + * @param string $txt Le texte de la sous-branche + * @param array $options Les informations complémentaires + * @return TafelTreeBranch La sous-branche + */ + function &addBranch ($id, $txt, $options = array()) { + $branch =& new TafelTreeBranch (); + $branch->setId($id); + $branch->setText($txt); + foreach ($options as $property => $value) { + if ($property != 'items') { + $branch->setParam($property, $value); + } + } + if (isset($options['items'])) { + foreach ($options['items'] as $opt) { + $branch->addBranch(null, null, $opt); + } + } + if (!isset($this->items)) { + $this->items = array(); + } + $this->items[] =& $branch; + return $branch; + } + + /** + * Retourne la string JSON qui correspond à la structure de la branche et sous-branches + * + * @access public + * @return string La string JSON de la branche + */ + function getJSON () { + $service = new Services_JSON(); + return $service->encode($this); + } + + +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php4_sample.php b/maarch_entreprise/trunk/tools/tafelTree/server/php4_sample.php new file mode 100644 index 0000000000000000000000000000000000000000..d2aed0d84c03fa407a62553c0eb16bec17b8be01 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php4_sample.php @@ -0,0 +1,93 @@ +<?php + +include_once ('php4/TafelTree.class.php'); + + +/// + // CASE 1 : load structure from a JSON string + // + /// + +// Check the JSON string +$json = "[{id:'r1',txt:'root',items:[{id:'b1',txt:'branch 1',myPos:{x:1,y:9}},{id:'b2',txt:'branch 2'}]}]"; + +// Load the JSON into an object (or array of objects) +$branches =& TafelTreeBranch::loadJSON($json); + +// Manipulate the object (or array of objects) +$first = $branches[0]; +echo '<h3>CASE 1 : load structure from a JSON string</h3>'; +echo 'First JSON branch : '.$first->getText().' ('.$first->getId().')'; +echo '<ul>'; +foreach ($first->items as $next) { + echo '<li>Next JSON branch : '.$next->getText().' ('.$next->getId().')</li>'; +} +echo '</ul>'; + + + + + + +/// + // CASE 2 : create a loader TafelTree from an object + // + /// + +// Create the tree (same options as javascript). In this sample, the file +// drop.php doesn't exist. It's just to show how to manage ajax declarations +$tree =& new TafelTree('divTree', '../imgs/', null, null, array( + 'generate' => true, + 'onMouseOver'=>'myMouseover', + 'onMouseOut'=>'myMouseout', + 'defaultImg'=>'page.gif', + 'lineStyle'=>'full', + 'onDropAjax'=>array('funcDrop', 'drop.php') +)); + +// Add a root branch +$b1 =& $tree->addBranch('r1', 'root'); + +// Add two branches into the root +$b1->addBranch('b1', 'branch 1', array('onclick'=>'testclick','thing' => 1)); +$b1->addBranch('b2', 'branch 2'); + +?> +<html> +<head> + <title>PHP4 sample</title> + <link rel="stylesheet" href="../css/tree.css" type="text/css" /> + <script src="../js/prototype.js" type="text/javascript"></script> + <script src="../js/scriptaculous.js" type="text/javascript"></script> + <script src="../Tree.js" type="text/javascript"></script> + <script type="text/javascript"> + function myMouseover (branch) { + branch.txt.style.color = 'red'; + } + function myMouseout (branch) { + branch.txt.style.color = 'black'; + } + function funcDrop (move, here, response, finished) { + return false; + } + function testclick(branch) { + + } +<?php +// Display the function which is called at load +// You can print only the JSON structure with +// the function $tree->getJSON(); +echo $tree->display(); +?> + </script> +</head> +<body> + +<h3>CASE 2 : create a loader TafelTree from an object</h3> +<div id="divTree"></div> + +<h3>CASE 3 : get only the JSON from an object</h3> +<?php echo $tree->getJSON(); ?> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php5/JSON.php b/maarch_entreprise/trunk/tools/tafelTree/server/php5/JSON.php new file mode 100644 index 0000000000000000000000000000000000000000..c9923b9d28564e1326528b57d3954f12bb818d63 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php5/JSON.php @@ -0,0 +1,804 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Converts to and from JSON format. + * + * JSON (JavaScript Object Notation) is a lightweight data-interchange + * format. It is easy for humans to read and write. It is easy for machines + * to parse and generate. It is based on a subset of the JavaScript + * Programming Language, Standard ECMA-262 3rd Edition - December 1999. + * This feature can also be found in Python. JSON is a text format that is + * completely language independent but uses conventions that are familiar + * to programmers of the C-family of languages, including C, C++, C#, Java, + * JavaScript, Perl, TCL, and many others. These properties make JSON an + * ideal data-interchange language. + * + * This package provides a simple encoder and decoder for JSON notation. It + * is intended for use with client-side Javascript applications that make + * use of HTTPRequest to perform server communication functions - data can + * be encoded into JSON notation for use in a client-side javascript, or + * decoded from incoming Javascript requests. JSON format is native to + * Javascript, and can be directly eval()'ed with no further parsing + * overhead + * + * All strings should be in ASCII or UTF-8 format! + * + * LICENSE: Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: Redistributions of source code must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * @category + * @package Services_JSON + * @author Michal Migurski <mike-json@teczno.com> + * @author Matt Knapp <mdknapp[at]gmail[dot]com> + * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com> + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.1 2006/11/13 16:47:49 rekam Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_SLICE', 1); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_STR', 2); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_ARR', 3); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_OBJ', 4); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_CMT', 5); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_LOOSE_TYPE', 16); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_SUPPRESS_ERRORS', 32); + +/** + * Converts to and from JSON format. + * + * Brief example of use: + * + * <code> + * // create a new instance of Services_JSON + * $json = new Services_JSON(); + * + * // convert a complexe value to JSON notation, and send it to the browser + * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); + * $output = $json->encode($value); + * + * print($output); + * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] + * + * // accept incoming POST data, assumed to be in JSON notation + * $input = file_get_contents('php://input', 1000000); + * $value = $json->decode($input); + * </code> + */ +class Services_JSON +{ + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + return '"'.$ascii.'"'; + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); + + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } + + return false; + } +} + +if (class_exists('PEAR_Error')) { + + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } + +} else { + + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + + } + } + +} + +?> diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php5/LICENSE b/maarch_entreprise/trunk/tools/tafelTree/server/php5/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e59acee720bde1b3b0a3504bec415c5c34ff1ab0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php5/LICENSE @@ -0,0 +1,24 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +http://pear.php.net/pepr/pepr-proposal-show.php?id=198 +http://mike.teczno.com/JSON/doc/ \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php5/TafelTree.class.php b/maarch_entreprise/trunk/tools/tafelTree/server/php5/TafelTree.class.php new file mode 100644 index 0000000000000000000000000000000000000000..a010a886261f2a136ba24888a866e4d263eadb6d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php5/TafelTree.class.php @@ -0,0 +1,223 @@ +<?php + +include_once ('JSON.php'); +include_once ('TafelTreeBranch.class.php'); + +/** + * + * + * @author FTafel + */ +class TafelTree { + + + /** + *------------------------------------------------------------------------------ + * Propriétés + *------------------------------------------------------------------------------ + */ + + /** + * @access protected + * @var string $id L'id de l'arbre + */ + protected $id; + + /** + * @access protected + * @var string $id L'id de l'arbre + */ + protected $width; + + /** + * @access protected + * @var string $id L'id de l'arbre + */ + protected $height; + + /** + * @access protected + * @var string $id L'id de l'arbre + */ + protected $pathImgs; + + /** + * @access protected + * @var array $options Les options de load de l'arbre + */ + protected $options; + + + /** + *------------------------------------------------------------------------------ + * Constructeur + *------------------------------------------------------------------------------ + */ + + /** + * Constructeur + * + * @access public + * @param string id L'id de l'élément HTML conteneur + * @param string imgBase Le path vers les images + * @param integer width La largeur de l'arbre + * @param integer height La hauteur de l'arbre + * @param array options Les options de l'arbre + */ + public function __construct($id, $imgs = 'imgs/', $width = '100%', $height = 'auto', $options = array()){ + $this->id = $id; + $this->pathImgs = $imgs; + $this->width = $width; + $this->height = $height; + $this->options = array(); + foreach ($options as $property => $value) { + $this->options[$property] = $value; + } + } + + /** + * Load les infos depuis une string JSON + * + * @access public + * @param string $json La string JSON + * @return TafelTree Le TafelTree créé + */ + public function loadJSON ($json, $id, $imgs = 'imgs/', $width = '100%', $height = 'auto', $options = array()) { + $tree = new TafelTree($id, $imgs, $width, $height, $options); + $service = new Services_JSON(); + $tree->items = TafelTree::loadServiceJSON($service->decode($json)); + return $tree; + } + + /** + * Load les infos depuis un objet Service_JSON + * + * @access public + * @param Service_JSON $service L'objet Service_JSON + * @return array Les TafelTreeBranch créées + */ + public function loadServiceJSON ($service) { + $branches = array(); + foreach ($service as $branch) { + $branches[] = TafelTreeBranch::loadServiceJSON($branch); + } + return $branches; + } + + + + /** + *------------------------------------------------------------------------------ + * Fonctions getters et setters + *------------------------------------------------------------------------------ + */ + + public function getId() { + return $this->id; + } + public function getPathImgs() { + return $this->pathImgs; + } + public function getWidth() { + return $this->width; + } + public function getHeight() { + return $this->height; + } + + + /** + *------------------------------------------------------------------------------ + * Fonctions publiques + *------------------------------------------------------------------------------ + */ + + /** + * Ajoute une branche comme enfant + * + * @access public + * @param TafelTreeBranch $branch La branche à ajouter + * @return void + */ + public function add (TafelTreeBranch $branch) { + if (!isset($this->items)) { + $this->items = array(); + } + $this->items[] = $branch; + } + + /** + * Ajoute une sous-branche à l'arbre + * + * @access public + * @param string $id L'id de la sous-branche + * @param string $txt Le texte de la sous-branche + * @param array $options Les informations complémentaires + * @return TafelTreeBranch La sous-branche + */ + public function addBranch ($id, $txt, $options = array()) { + $branch = new TafelTreeBranch (); + $branch->setId($id); + $branch->setText($txt); + foreach ($options as $property => $value) { + if ($property != 'items') { + $branch->setParam($property, $value); + } + } + if (isset($options['items'])) { + foreach ($options['items'] as $opt) { + $branch->addBranch(null, null, $opt); + } + } + if (!isset($this->items)) { + $this->items = array(); + } + $this->items[] = $branch; + return $branch; + } + + /** + * Affiche la méthode d'initialisation de l'arbre + * + * @access public + * @param integer $debug Mettre 1 ou 2 pour avoir un affichage plus lisible + * @return string La string de la méthode JS d'initialisation + */ + public function display ($debug = 0) { + if ($debug == 1) { + $d = '<br />'; + } elseif ($debug == 2) { + $d = "\n"; + } else { + $d = ''; + } + if (count($this->options) > 0) { + $s = new Services_JSON(); + $options = ','.$s->encode($this->options); + } + $str = "var tree_".$this->id." = null;".$d; + $str .= "function TafelTreeInit() {".$d; + $str .= "tree_".$this->id." = new TafelTree (".$d; + $str .= "'".$this->getId()."', ".$d; + $str .= $this->getJSON().", ".$d; + $str .= "'".$this->getPathImgs()."', ".$d; + $str .= "'".$this->getWidth()."', ".$d; + $str .= "'".$this->getHeight()."'".$options; + $str .= ");".$d; + $str .= "};".$d; + return $str; + } + + /** + * Affiche la structure JSON de l'arbre + * + * @access public + * @return string La structure JSON de l'arbre + */ + public function getJSON () { + $service = new Services_JSON(); + return $service->encode($this->items); + } +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php5/TafelTreeBranch.class.php b/maarch_entreprise/trunk/tools/tafelTree/server/php5/TafelTreeBranch.class.php new file mode 100644 index 0000000000000000000000000000000000000000..1e5bfa3eec51afeb17fe093006e283c19c4b81a0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php5/TafelTreeBranch.class.php @@ -0,0 +1,195 @@ +<?php + +/** + * + * + * @author FTafel + */ +class TafelTreeBranch { + + + /** + *------------------------------------------------------------------------------ + * Propriétés + *------------------------------------------------------------------------------ + */ + + /** + * @access public + * @var string $id L'id de la branche + */ + public $id; + + /** + * @access public + * @var string $txt Le texte de la branche + */ + public $txt; + + + /** + *------------------------------------------------------------------------------ + * Constructeur + *------------------------------------------------------------------------------ + */ + + /** + * Constructeur + * + * @access public + */ + public function __construct(){ + } + + /** + * Load les infos depuis une string JSON + * + * @access public + * @param string $json La string JSON + * @return array Les TafelTreeBranch créées + */ + public function loadJSON ($json) { + $service = new Services_JSON(); + $obj = $service->decode($json); + $branches = array(); + foreach ($obj as $s) { + $branches[] = TafelTreeBranch::loadServiceJSON($s); + } + return $branches; + } + + /** + * Load les infos depuis un objet Service_JSON + * + * @access public + * @param Service_JSON $service L'objet Service_JSON + * @return array Les TafelTreeBranch créées + */ + public function loadServiceJSON ($service) { + $branch = new TafelTreeBranch(); + // On check toutes les propriétés de branche + foreach ($service as $property => $value) { + if ($property != 'items') { + $branch->setParam($property, $value); + } + } + // On check les enfants + if (isset($service) && isset($service->items)) { + $branch->items = array(); + foreach ($service->items as $b) { + $branch->items[] = TafelTreeBranch::loadServiceJSON($b); + } + } + return $branch; + } + + + + /** + *------------------------------------------------------------------------------ + * Fonctions getters et setters + *------------------------------------------------------------------------------ + */ + + public function getId () {return $this->id;} + public function setId ($id) {$this->id = $id;} + + public function getText () {return $this->txt;} + public function setText ($txt) {$this->txt = $txt;} + + /** + * Retourne la valeur d'une propriété, si elle existe + * + * @access public + * @param string $param La propriété à chercher + * @return string La valeur de la propriété + */ + public function getParam ($param) { + if (isset($this->$param)) { + return $this->$param; + } + } + + /** + * Set un paramètre pour la branche + * + * @access public + * @param string $param Le nom de la propriété + * @param string $value La valeur de la propriété + */ + public function setParam ($param, $value) { + if ($param == 'id') { + $this->setId($value); + } elseif ($param == 'txt') { + $this->setText($value); + } else { + $this->$param = $value; + } + } + + + /** + *------------------------------------------------------------------------------ + * Fonctions publiques + *------------------------------------------------------------------------------ + */ + + /** + * Ajoute une branche comme enfant + * + * @access public + * @param TafelTreeBranch $branch La branche à ajouter + * @return void + */ + public function add (TafelTreeBranch $branch) { + if (!isset($this->items)) { + $this->items = array(); + } + $this->items[] = $branch; + } + + /** + * Ajoute une sous-branche à la branche courante + * + * @access public + * @param string $id L'id de la sous-branche + * @param string $txt Le texte de la sous-branche + * @param array $options Les informations complémentaires + * @return TafelTreeBranch La sous-branche + */ + public function addBranch ($id, $txt, $options = array()) { + $branch = new TafelTreeBranch (); + $branch->setId($id); + $branch->setText($txt); + foreach ($options as $property => $value) { + if ($property != 'items') { + $branch->setParam($property, $value); + } + } + if (isset($options['items'])) { + foreach ($options['items'] as $opt) { + $branch->addBranch(null, null, $opt); + } + } + if (!isset($this->items)) { + $this->items = array(); + } + $this->items[] = $branch; + return $branch; + } + + /** + * Retourne la string JSON qui correspond à la structure de la branche et sous-branches + * + * @access public + * @return string La string JSON de la branche + */ + public function getJSON () { + $service = new Services_JSON(); + return $service->encode($this); + } + + +} + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/server/php5_sample.php b/maarch_entreprise/trunk/tools/tafelTree/server/php5_sample.php new file mode 100644 index 0000000000000000000000000000000000000000..e589cf499846a95bbbc7a5a58e01791c82c87114 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/server/php5_sample.php @@ -0,0 +1,93 @@ +<?php + +include_once ('php4/TafelTree.class.php'); + + +/// + // CASE 1 : load structure from a JSON string + // + /// + +// Check the JSON string +$json = "[{id:'r1',txt:'root',items:[{id:'b1',txt:'branch 1',myPos:{x:1,y:9}},{id:'b2',txt:'branch 2'}]}]"; + +// Load the JSON into an object (or array of objects) +$branches = TafelTreeBranch::loadJSON($json); + +// Manipulate the object (or array of objects) +$first = $branches[0]; +echo '<h3>CASE 1 : load structure from a JSON string</h3>'; +echo 'First JSON branch : '.$first->getText().' ('.$first->getId().')'; +echo '<ul>'; +foreach ($first->items as $next) { + echo '<li>Next JSON branch : '.$next->getText().' ('.$next->getId().')</li>'; +} +echo '</ul>'; + + + + + + +/// + // CASE 2 : create a loader TafelTree from an object + // + /// + +// Create the tree (same options as javascript). In this sample, the file +// drop.php doesn't exist. It's just to show how to manage ajax declarations +$tree = new TafelTree('divTree', '../imgs/', null, null, array( + 'generate' => true, + 'onMouseOver'=>'myMouseover', + 'onMouseOut'=>'myMouseout', + 'defaultImg'=>'page.gif', + 'lineStyle'=>'full', + 'onDropAjax'=>array('funcDrop', 'drop.php') +)); + +// Add a root branch +$b1 = $tree->addBranch('r1', 'root'); + +// Add two branches into the root +$b1->addBranch('b1', 'branch 1', array('onclick'=>'testclick','thing' => 1)); +$b1->addBranch('b2', 'branch 2'); + +?> +<html> +<head> + <title>PHP4 sample</title> + <link rel="stylesheet" href="../css/tree.css" type="text/css" /> + <script src="../js/prototype.js" type="text/javascript"></script> + <script src="../js/scriptaculous.js" type="text/javascript"></script> + <script src="../Tree.js" type="text/javascript"></script> + <script type="text/javascript"> + function myMouseover (branch) { + branch.txt.style.color = 'red'; + } + function myMouseout (branch) { + branch.txt.style.color = 'black'; + } + function funcDrop (move, here, response, finished) { + return false; + } + function testclick(branch) { + + } +<?php +// Display the function which is called at load +// You can print only the JSON structure with +// the function $tree->getJSON(); +echo $tree->display(); +?> + </script> +</head> +<body> + +<h3>CASE 2 : create a loader TafelTree from an object</h3> +<div id="divTree"></div> + +<h3>CASE 3 : get only the JSON from an object</h3> +<?php echo $tree->getJSON(); ?> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tafelTree/tests.php b/maarch_entreprise/trunk/tools/tafelTree/tests.php new file mode 100644 index 0000000000000000000000000000000000000000..7b9dc84f7edc1fc4376b8ce6953c053429bc3dfb --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/tests.php @@ -0,0 +1,72 @@ +<html> +<head> + <title>OpenOfficeGeneration Documentation</title> + <link rel="stylesheet" type="text/css" href="css/tree.css" /> + <script type="text/javascript" src="js/prototype.js"></script> + <script type="text/javascript" src="js/scriptaculous.js"></script> + <script type="text/javascript" src="Tree.js"></script> +</head> +<body> + + <script type="text/javascript"> + function dstart (branch) { + var tree = branch.getTree(); + tree.debug('start'); + } + + function dend (branch) { + var tree = branch.getTree(); + tree.debug('end'); + } + function ondrop (b1, b2) { + return true; + } + var tree = null; + function TafelTreeInit () { + var struct = [ + { + 'id':'root1', + 'checkbox':false, + 'txt':'Element racine', + 'items':[ + { + 'id':'child1', + 'txt':'Un enfant' + }, + { + 'id':'child2', + 'txt':'Un enfant 2', + 'select' : true + }, + { + 'id':'child3', + 'txt':'Un enfant 3' + }, + { + 'id':'child4', + 'txt':'Un enfant 4' + } + ] + } + ]; + tree = new TafelTree('test', struct, { + 'generate' : true, + 'imgBase' : 'imgs/', + 'onDragStartEffect' : dstart, + 'onDragEndEffect' : dend, + 'onDrop' : ondrop, + 'checkboxes':true + }); + } + + function blu (branch) { + alert(branch.txt.className); + } + </script> + <div id="test"></div> + <p><a href="#" onclick="blu()">Effet</a></p> + + + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries new file mode 100644 index 0000000000000000000000000000000000000000..36aabe2d03f60846b349c85d0c1ac88eb2d4c841 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries @@ -0,0 +1,3 @@ +/index.html/1.1/Fri Oct 20 09:21:16 2006// +/test.css/1.1/Fri Oct 20 09:21:16 2006// +D diff --git a/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries.Extra b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries.Extra new file mode 100644 index 0000000000000000000000000000000000000000..fe86b140f0888a0430729463becf58ca62a94b49 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries.Extra @@ -0,0 +1,2 @@ +/index.html////*/// +/test.css////*/// diff --git a/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries.Extra.Old b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries.Extra.Old new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries.Old b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Entries.Old new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Repository b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Repository new file mode 100644 index 0000000000000000000000000000000000000000..1c7fc12123719cebc172ca43c1bd0f2761a5afbc --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Repository @@ -0,0 +1 @@ +tafelTree/unit diff --git a/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Root b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Root new file mode 100644 index 0000000000000000000000000000000000000000..41b1b6a61c44ae12580a2a411a038f2bf45455f7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/unit/CVS/Root @@ -0,0 +1 @@ +:ext:rekam@tafeltree.cvs.sourceforge.net:/cvsroot/tafeltree diff --git a/maarch_entreprise/trunk/tools/tafelTree/unit/index.html b/maarch_entreprise/trunk/tools/tafelTree/unit/index.html new file mode 100644 index 0000000000000000000000000000000000000000..cb726295546762045e0ca15e4e8492be6a3e899f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/unit/index.html @@ -0,0 +1,172 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Page title</title> + <script src="../js/prototype.js" type="text/javascript"></script> + <script src="../js/scriptaculous.js" type="text/javascript"></script> + <script src="../js/util.js" type="text/javascript"></script> + <script src="../js/unittest.js" type="text/javascript"></script> + <!-- other JavaScript includes --> + <script src="../Tree.js" type="text/javascript"></script> + <link rel="stylesheet" href="test.css" type="text/css" /> + <link rel="stylesheet" href="../css/tree.css" type="text/css" /> +</head> +<body> + +<!-- Log output --> +<div id="testlog"> </div> + +<h3>Tree 1</h3> +<div id="tree1"></div> +<h3>Tree 2</h3> +<div id="tree2"></div> +<h3>Tree 3</h3> +<div id="tree3"></div> + + +<!-- Tests follow --> +<script type="text/javascript" language="javascript"> +// <![CDATA[ + var tree1 = null; + var tree2 = null; + var tree3 = null; + function dd (drag, drop) { return true; }; + function open (branch, response) { return true; }; + + new Test.Unit.Runner({ + + setup: function() { with(this) { + var struct1 = [ + { + 'id':'root1', + 'txt':'Root 1', + 'img':'base.gif', + 'items': [ + {'id':'child','txt':'Child 1','img':'page.gif','imgopen':'folderopen.gif','imgclose':'folder.gif'} + ] + } + ]; + if (!tree1) { + tree1 = new TafelTree('tree1', struct1, '../imgs/'); + tree1.enableCheckboxesThreeState(true); + tree1.setOnDrop(dd); + tree1.setOnOpenPopulate(open, 'open.php'); + tree1.enableCookies(false); + tree1.generate(); + } + var struct2 = [ + { + 'id':'root1_t2', + 'txt':'Root 2', + 'img':'base.gif', + 'items': [ + {'id':'child_t2','txt':'Child 2','img':'page.gif','imgopen':'folderopen.gif','imgclose':'folder.gif'}, + {'id':'child2_t2','txt':'Child','img':'page.gif','imgopen':'folderopen.gif','imgclose':'folder.gif' + } + ] + } + ]; + if (!tree2) { + tree2 = new TafelTree('tree2', struct2, '../imgs/'); + tree2.setOnDrop(dd); + tree2.enableCookies(false); + tree2.generate(); + } + var struct3 = [ + { + 'id':'root1_t3', + 'txt':'Root 3', + 'img':'base.gif', + 'items': [ + {'id':'child_t3','txt':'Child 3','img':'page.gif','imgopen':'folderopen.gif','imgclose':'folder.gif'} + ] + } + ]; + if (!tree3) { + tree3 = new TafelTree('tree3', struct3, '../imgs/'); + tree3.setOnDrop(dd); + tree3.enableCookies(false); + tree3.generate(); + } + }}, + + teardown: function() { with(this) { + }}, + + testGetBranchById: function() { with(this) { + var r = tree1.getBranchById('root1'); + assertEqual('root1', r.getId()); + }}, + + testInsertBranch: function() { with(this) { + var item1 = {'id':'child_last','txt':'child_last','img':'page.gif'}; + var item2 = {'id':'child_first','txt':'child_first','img':'page.gif'}; + var item3 = {'id':'child_before','txt':'child_before','img':'page.gif'}; + var item4 = {'id':'child_after','txt':'child_after','img':'page.gif'}; + tree1.insertBranch('child', item1, false, false); + tree1.insertBranch('child', item2, false, true); + tree1.insertBranch('child', item3, true, true); + tree1.insertBranch('child', item4, true, false); + var b1 = tree1.getBranchById('child_last'); + var b2 = tree1.getBranchById('child_first'); + var b3 = tree1.getBranchById('child_before'); + var b4 = tree1.getBranchById('child_after'); + assertEqual(item1.id, b1.getId()); + assertEqual(item2.id, b2.getId()); + assertEqual(item3.id, b3.getId()); + assertEqual(item4.id, b4.getId()); + }}, + + testBindUniDirectional: function() { with(this) { + tree1.bindAsUnidirectional(tree2); + assertEqual(true, tree1.isBindedWith(tree2)); + assertEqual('', tree2.isBindedWith(tree1)); + }}, + + testBindBiDirectional: function() { with(this) { + tree3.bind(tree2); + assertEqual(true, tree3.isBindedWith(tree2)); + assertEqual(true, tree2.isBindedWith(tree3)); + assertEqual(true, tree1.isBindedWith(tree2)); + }}, + + testCountBranches: function() { with(this) { + assertEqual(6, tree1.countBranches()); + }}, + + testGetOpenedBranches: function() { with(this) { + var b = tree1.getOpenedBranches(); + assertEqual(2, b.length); + assertEqual('root1', b[0].getId()); + assertEqual('child', b[1].getId()); + }}, + + testGetCheckedBranches: function() { with(this) { + var b = tree1.getCheckedBranches(); + assertEqual(0, b.length); + }}, + + testBranchOperations: function() { with(this) { + var b = tree1.getBranchById('child'); + b.check(1); + b.openIt(false); + assertEqual(1, b.struct.check); + assertEqual(true, b.isChecked()); + assertEqual('', b.struct.open); + assertEqual('', b.isOpened()); + }}, + + testBranchMoves: function() { with(this) { + var b1 = tree3.getBranchById('child_t3'); + b1.move('child'); + assertEqual('', tree1.getBranchById('child_t3')); + var b2 = tree2.getBranchById('child_t2'); + b2.move('child_t3'); + assertNotEqual('', tree3.getBranchById('child_t2')); + }} + }, "testlog"); +// ]]> +</script> + +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tafelTree/unit/test.css b/maarch_entreprise/trunk/tools/tafelTree/unit/test.css new file mode 100644 index 0000000000000000000000000000000000000000..8ba4fede528f94ef0a7c5a3be7dd70025f47b54c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tafelTree/unit/test.css @@ -0,0 +1,40 @@ +body, div, p, h1, h2, h3, ul, ol, span, a, table, td, form, img, li { + font-family: sans-serif; +} + +body { + font-size:0.8em; +} + +#log { + padding-bottom: 1em; + border-bottom: 2px solid #000; + margin-bottom: 2em; +} + +#logsummary { + margin-bottom: 1em; + padding: 1ex; + border: 1px solid #000; + font-weight: bold; +} + +#logtable { + width:100%; + border-collapse: collapse; + border: 1px dotted #666; +} + +#logtable td, #logtable th { + text-align: left; + padding: 3px 8px; + border: 1px dotted #666; +} + +#logtable .passed { + background-color: #cfc; +} + +#logtable .failed, #logtable .error { + background-color: #fcc; +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/langs/en.js b/maarch_entreprise/trunk/tools/tiny_mce/langs/en.js new file mode 100644 index 0000000000000000000000000000000000000000..8519b4de75e69ceb98867f5dc951f00509927815 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/langs/en.js @@ -0,0 +1,154 @@ +tinyMCE.addI18n({en:{ +common:{ +edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?", +apply:"Apply", +insert:"Insert", +update:"Update", +cancel:"Cancel", +close:"Close", +browse:"Browse", +class_name:"Class", +not_set:"-- Not set --", +clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?", +clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.", +popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.", +invalid_data:"Error: Invalid values entered, these are marked in red.", +more_colors:"More colors" +}, +contextmenu:{ +align:"Alignment", +left:"Left", +center:"Center", +right:"Right", +full:"Full" +}, +insertdatetime:{ +date_fmt:"%Y-%m-%d", +time_fmt:"%H:%M:%S", +insertdate_desc:"Insert date", +inserttime_desc:"Insert time", +months_long:"January,February,March,April,May,June,July,August,September,October,November,December", +months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", +day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday", +day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun" +}, +print:{ +print_desc:"Print" +}, +preview:{ +preview_desc:"Preview" +}, +directionality:{ +ltr_desc:"Direction left to right", +rtl_desc:"Direction right to left" +}, +layer:{ +insertlayer_desc:"Insert new layer", +forward_desc:"Move forward", +backward_desc:"Move backward", +absolute_desc:"Toggle absolute positioning", +content:"New layer..." +}, +save:{ +save_desc:"Save", +cancel_desc:"Cancel all changes" +}, +nonbreaking:{ +nonbreaking_desc:"Insert non-breaking space character" +}, +iespell:{ +iespell_desc:"Run spell checking", +download:"ieSpell not detected. Do you want to install it now?" +}, +advhr:{ +advhr_desc:"Horizontal rule" +}, +emotions:{ +emotions_desc:"Emotions" +}, +searchreplace:{ +search_desc:"Find", +replace_desc:"Find/Replace" +}, +advimage:{ +image_desc:"Insert/edit image" +}, +advlink:{ +link_desc:"Insert/edit link" +}, +xhtmlxtras:{ +cite_desc:"Citation", +abbr_desc:"Abbreviation", +acronym_desc:"Acronym", +del_desc:"Deletion", +ins_desc:"Insertion", +attribs_desc:"Insert/Edit Attributes" +}, +style:{ +desc:"Edit CSS Style" +}, +paste:{ +paste_text_desc:"Paste as Plain Text", +paste_word_desc:"Paste from Word", +selectall_desc:"Select All" +}, +paste_dlg:{ +text_title:"Use CTRL+V on your keyboard to paste the text into the window.", +text_linebreaks:"Keep linebreaks", +word_title:"Use CTRL+V on your keyboard to paste the text into the window." +}, +table:{ +desc:"Inserts a new table", +row_before_desc:"Insert row before", +row_after_desc:"Insert row after", +delete_row_desc:"Delete row", +col_before_desc:"Insert column before", +col_after_desc:"Insert column after", +delete_col_desc:"Remove column", +split_cells_desc:"Split merged table cells", +merge_cells_desc:"Merge table cells", +row_desc:"Table row properties", +cell_desc:"Table cell properties", +props_desc:"Table properties", +paste_row_before_desc:"Paste table row before", +paste_row_after_desc:"Paste table row after", +cut_row_desc:"Cut table row", +copy_row_desc:"Copy table row", +del:"Delete table", +row:"Row", +col:"Column", +cell:"Cell" +}, +autosave:{ +unload_msg:"The changes you made will be lost if you navigate away from this page." +}, +fullscreen:{ +desc:"Toggle fullscreen mode" +}, +media:{ +desc:"Insert / edit embedded media", +edit:"Edit embedded media" +}, +fullpage:{ +desc:"Document properties" +}, +template:{ +desc:"Insert predefined template content" +}, +visualchars:{ +desc:"Visual control characters on/off." +}, +spellchecker:{ +desc:"Toggle spellchecker", +menu:"Spellchecker settings", +ignore_word:"Ignore word", +ignore_words:"Ignore all", +langs:"Languages", +wait:"Please wait...", +sug:"Suggestions", +no_sug:"No suggestions", +no_mpell:"No misspellings found." +}, +pagebreak:{ +desc:"Insert page break." +}}}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/license.txt b/maarch_entreprise/trunk/tools/tiny_mce/license.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d6d4c8f51c5c3910583e84d96fdf9e219afdd2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/license.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/css/advhr.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/css/advhr.css new file mode 100644 index 0000000000000000000000000000000000000000..0e22834985e9655e028dc8e6ac2b1f326be1949c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/css/advhr.css @@ -0,0 +1,5 @@ +input.radio {border:1px none #000; background:transparent; vertical-align:middle;} +.panel_wrapper div.current {height:80px;} +#width {width:50px; vertical-align:middle;} +#width2 {width:50px; vertical-align:middle;} +#size {width:100px;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..4d3b062deeaa7c22fa174a90f8000caa7edb8c1c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.AdvancedHRPlugin",{init:function(a,b){a.addCommand("mceAdvancedHr",function(){a.windowManager.open({file:b+"/rule.htm",width:250+parseInt(a.getLang("advhr.delta_width",0)),height:160+parseInt(a.getLang("advhr.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("advhr",{title:"advhr.advhr_desc",cmd:"mceAdvancedHr"});a.onNodeChange.add(function(d,c,e){c.setActive("advhr",e.nodeName=="HR")});a.onClick.add(function(c,d){d=d.target;if(d.nodeName==="HR"){c.selection.select(d)}})},getInfo:function(){return{longname:"Advanced HR",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advhr",tinymce.plugins.AdvancedHRPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..8a847532bf7502674d8b60cfc5a3ff31436dc3a5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/editor_plugin_src.js @@ -0,0 +1,54 @@ +/** + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AdvancedHRPlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceAdvancedHr', function() { + ed.windowManager.open({ + file : url + '/rule.htm', + width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)), + height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('advhr', { + title : 'advhr.advhr_desc', + cmd : 'mceAdvancedHr' + }); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('advhr', n.nodeName == 'HR'); + }); + + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName === 'HR') + ed.selection.select(e); + }); + }, + + getInfo : function() { + return { + longname : 'Advanced HR', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/js/rule.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/js/rule.js new file mode 100644 index 0000000000000000000000000000000000000000..b6cbd66c759fd9d158a84a6d31f5ef6579f79783 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/js/rule.js @@ -0,0 +1,43 @@ +var AdvHRDialog = { + init : function(ed) { + var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w; + + w = dom.getAttrib(n, 'width'); + f.width.value = w ? parseInt(w) : (dom.getStyle('width') || ''); + f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || ''; + f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width'); + selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px'); + }, + + update : function() { + var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = ''; + + h = '<hr'; + + if (f.size.value) { + h += ' size="' + f.size.value + '"'; + st += ' height:' + f.size.value + 'px;'; + } + + if (f.width.value) { + h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"'; + st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';'; + } + + if (f.noshade.checked) { + h += ' noshade="noshade"'; + st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;'; + } + + if (ed.settings.inline_styles) + h += ' style="' + tinymce.trim(st) + '"'; + + h += ' />'; + + ed.execCommand("mceInsertContent", false, h); + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.requireLangPack(); +tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..873bfd8d38c2bb20615cd632df47617a002a709c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/langs/en_dlg.js @@ -0,0 +1,5 @@ +tinyMCE.addI18n('en.advhr_dlg',{ +width:"Width", +size:"Height", +noshade:"No shadow" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/rule.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/rule.htm new file mode 100644 index 0000000000000000000000000000000000000000..75ca3392f78506e5a92dde1f780cd2fbd7d0dc19 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advhr/rule.htm @@ -0,0 +1,62 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advhr.advhr_desc}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/rule.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <link href="css/advhr.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<form onsubmit="AdvHRDialog.update();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td><label for="width">{#advhr_dlg.width}</label></td> + <td class="nowrap"> + <input id="width" name="width" type="text" value="" class="mceFocus" /> + <select name="width2" id="width2"> + <option value="">px</option> + <option value="%">%</option> + </select> + </td> + </tr> + <tr> + <td><label for="size">{#advhr_dlg.size}</label></td> + <td><select id="size" name="size"> + <option value="">Normal</option> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + <option value="5">5</option> + </select></td> + </tr> + <tr> + <td><label for="noshade">{#advhr_dlg.noshade}</label></td> + <td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td> + </tr> + </table> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/css/advimage.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/css/advimage.css new file mode 100644 index 0000000000000000000000000000000000000000..0a6251a6965637d3002613cb09384922e2f2b51b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/css/advimage.css @@ -0,0 +1,13 @@ +#src_list, #over_list, #out_list {width:280px;} +.mceActionPanel {margin-top:7px;} +.alignPreview {border:1px solid #000; width:140px; height:140px; overflow:hidden; padding:5px;} +.checkbox {border:0;} +.panel_wrapper div.current {height:305px;} +#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;} +#align, #classlist {width:150px;} +#width, #height {vertical-align:middle; width:50px; text-align:center;} +#vspace, #hspace, #border {vertical-align:middle; width:30px; text-align:center;} +#class_list {width:180px;} +input {width: 280px;} +#constrain, #onmousemovecheck {width:auto;} +#id, #dir, #lang, #usemap, #longdesc {width:200px;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..4c7a9c3a881e7759ff48cd1ce311055f12d61713 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..f526842e6f4cbf5a8d9003ad3b287417cf47bf94 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/editor_plugin_src.js @@ -0,0 +1,47 @@ +/** + * $Id: editor_plugin_src.js 677 2008-03-07 13:52:41Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AdvancedImagePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceAdvImage', function() { + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + file : url + '/image.htm', + width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)), + height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('image', { + title : 'advimage.image_desc', + cmd : 'mceAdvImage' + }); + }, + + getInfo : function() { + return { + longname : 'Advanced image', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/image.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/image.htm new file mode 100644 index 0000000000000000000000000000000000000000..5d261504674aab55a22c2d3a4c735592f638903f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/image.htm @@ -0,0 +1,237 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advimage_dlg.dialog_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/validate.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/image.js"></script> + <link href="css/advimage.css" rel="stylesheet" type="text/css" /> +</head> +<body id="advimage" style="display: none"> + <form onsubmit="ImageDialog.insert();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advimage_dlg.tab_general}</a></span></li> + <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#advimage_dlg.tab_appearance}</a></span></li> + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advimage_dlg.tab_advanced}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#advimage_dlg.general}</legend> + + <table class="properties"> + <tr> + <td class="column1"><label id="srclabel" for="src">{#advimage_dlg.src}</label></td> + <td colspan="2"><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input name="src" type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" /></td> + <td id="srcbrowsercontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td><label for="src_list">{#advimage_dlg.image_list}</label></td> + <td><select id="src_list" name="src_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;document.getElementById('title').value=this.options[this.selectedIndex].text;ImageDialog.showPreviewImage(this.options[this.selectedIndex].value);"><option value=""></option></select></td> + </tr> + <tr> + <td class="column1"><label id="altlabel" for="alt">{#advimage_dlg.alt}</label></td> + <td colspan="2"><input id="alt" name="alt" type="text" value="" /></td> + </tr> + <tr> + <td class="column1"><label id="titlelabel" for="title">{#advimage_dlg.title}</label></td> + <td colspan="2"><input id="title" name="title" type="text" value="" /></td> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>{#advimage_dlg.preview}</legend> + <div id="prev"></div> + </fieldset> + </div> + + <div id="appearance_panel" class="panel"> + <fieldset> + <legend>{#advimage_dlg.tab_appearance}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label id="alignlabel" for="align">{#advimage_dlg.align}</label></td> + <td><select id="align" name="align" onchange="ImageDialog.updateStyle('align');ImageDialog.changeAppearance();"> + <option value="">{#not_set}</option> + <option value="baseline">{#advimage_dlg.align_baseline}</option> + <option value="top">{#advimage_dlg.align_top}</option> + <option value="middle">{#advimage_dlg.align_middle}</option> + <option value="bottom">{#advimage_dlg.align_bottom}</option> + <option value="text-top">{#advimage_dlg.align_texttop}</option> + <option value="text-bottom">{#advimage_dlg.align_textbottom}</option> + <option value="left">{#advimage_dlg.align_left}</option> + <option value="right">{#advimage_dlg.align_right}</option> + </select> + </td> + <td rowspan="6" valign="top"> + <div class="alignPreview"> + <img id="alignSampleImg" src="img/sample.gif" alt="{#advimage_dlg.example_img}" /> + Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam + nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum + edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam + erat volutpat. + </div> + </td> + </tr> + + <tr> + <td class="column1"><label id="widthlabel" for="width">{#advimage_dlg.dimensions}</label></td> + <td class="nowrap"> + <input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" /> x + <input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" /> px + </td> + </tr> + + <tr> + <td> </td> + <td><table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td> + <td><label id="constrainlabel" for="constrain">{#advimage_dlg.constrain_proportions}</label></td> + </tr> + </table></td> + </tr> + + <tr> + <td class="column1"><label id="vspacelabel" for="vspace">{#advimage_dlg.vspace}</label></td> + <td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" /> + </td> + </tr> + + <tr> + <td class="column1"><label id="hspacelabel" for="hspace">{#advimage_dlg.hspace}</label></td> + <td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" /></td> + </tr> + + <tr> + <td class="column1"><label id="borderlabel" for="border">{#advimage_dlg.border}</label></td> + <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" /></td> + </tr> + + <tr> + <td><label for="class_list">{#class_name}</label></td> + <td colspan="2"><select id="class_list" name="class_list" class="mceEditableSelect"><option value=""></option></select></td> + </tr> + + <tr> + <td class="column1"><label id="stylelabel" for="style">{#advimage_dlg.style}</label></td> + <td colspan="2"><input id="style" name="style" type="text" value="" onchange="ImageDialog.changeAppearance();" /></td> + </tr> + + <!-- <tr> + <td class="column1"><label id="classeslabel" for="classes">{#advimage_dlg.classes}</label></td> + <td colspan="2"><input id="classes" name="classes" type="text" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td> + </tr> --> + </table> + </fieldset> + </div> + + <div id="advanced_panel" class="panel"> + <fieldset> + <legend>{#advimage_dlg.swap_image}</legend> + + <input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="ImageDialog.setSwapImage(this.checked);" /> + <label id="onmousemovechecklabel" for="onmousemovecheck">{#advimage_dlg.alt_image}</label> + + <table border="0" cellpadding="4" cellspacing="0" width="100%"> + <tr> + <td class="column1"><label id="onmouseoversrclabel" for="onmouseoversrc">{#advimage_dlg.mouseover}</label></td> + <td><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td> + <td id="onmouseoversrccontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td><label for="over_list">{#advimage_dlg.image_list}</label></td> + <td><select id="over_list" name="over_list" onchange="document.getElementById('onmouseoversrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td> + </tr> + <tr> + <td class="column1"><label id="onmouseoutsrclabel" for="onmouseoutsrc">{#advimage_dlg.mouseout}</label></td> + <td class="column2"><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td> + <td id="onmouseoutsrccontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td><label for="out_list">{#advimage_dlg.image_list}</label></td> + <td><select id="out_list" name="out_list" onchange="document.getElementById('onmouseoutsrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>{#advimage_dlg.misc}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label id="idlabel" for="id">{#advimage_dlg.id}</label></td> + <td><input id="id" name="id" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label id="dirlabel" for="dir">{#advimage_dlg.langdir}</label></td> + <td> + <select id="dir" name="dir" onchange="ImageDialog.changeAppearance();"> + <option value="">{#not_set}</option> + <option value="ltr">{#advimage_dlg.ltr}</option> + <option value="rtl">{#advimage_dlg.rtl}</option> + </select> + </td> + </tr> + + <tr> + <td class="column1"><label id="langlabel" for="lang">{#advimage_dlg.langcode}</label></td> + <td> + <input id="lang" name="lang" type="text" value="" /> + </td> + </tr> + + <tr> + <td class="column1"><label id="usemaplabel" for="usemap">{#advimage_dlg.map}</label></td> + <td> + <input id="usemap" name="usemap" type="text" value="" /> + </td> + </tr> + + <tr> + <td class="column1"><label id="longdesclabel" for="longdesc">{#advimage_dlg.long_desc}</label></td> + <td><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="longdesc" name="longdesc" type="text" value="" /></td> + <td id="longdesccontainer"> </td> + </tr> + </table></td> + </tr> + </table> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/img/sample.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/img/sample.gif new file mode 100644 index 0000000000000000000000000000000000000000..53bf6890b507741c10910c9e2217ad8247b98e8d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/img/sample.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/js/image.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/js/image.js new file mode 100644 index 0000000000000000000000000000000000000000..347722661b970a0328d4d1167208347b1e06b501 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/js/image.js @@ -0,0 +1,443 @@ +var ImageDialog = { + preInit : function() { + var url; + + tinyMCEPopup.requireLangPack(); + + if (url = tinyMCEPopup.getParam("external_image_list_url")) + document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>'); + }, + + init : function(ed) { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(); + + tinyMCEPopup.resizeToInnerSize(); + this.fillClassList('class_list'); + this.fillFileList('src_list', 'tinyMCEImageList'); + this.fillFileList('over_list', 'tinyMCEImageList'); + this.fillFileList('out_list', 'tinyMCEImageList'); + TinyMCE_EditableSelects.init(); + + if (n.nodeName == 'IMG') { + nl.src.value = dom.getAttrib(n, 'src'); + nl.width.value = dom.getAttrib(n, 'width'); + nl.height.value = dom.getAttrib(n, 'height'); + nl.alt.value = dom.getAttrib(n, 'alt'); + nl.title.value = dom.getAttrib(n, 'title'); + nl.vspace.value = this.getAttrib(n, 'vspace'); + nl.hspace.value = this.getAttrib(n, 'hspace'); + nl.border.value = this.getAttrib(n, 'border'); + selectByValue(f, 'align', this.getAttrib(n, 'align')); + selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true); + nl.style.value = dom.getAttrib(n, 'style'); + nl.id.value = dom.getAttrib(n, 'id'); + nl.dir.value = dom.getAttrib(n, 'dir'); + nl.lang.value = dom.getAttrib(n, 'lang'); + nl.usemap.value = dom.getAttrib(n, 'usemap'); + nl.longdesc.value = dom.getAttrib(n, 'longdesc'); + nl.insert.value = ed.getLang('update'); + + if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover'))) + nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); + + if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout'))) + nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); + + if (ed.settings.inline_styles) { + // Move attribs to styles + if (dom.getAttrib(n, 'align')) + this.updateStyle('align'); + + if (dom.getAttrib(n, 'hspace')) + this.updateStyle('hspace'); + + if (dom.getAttrib(n, 'border')) + this.updateStyle('border'); + + if (dom.getAttrib(n, 'vspace')) + this.updateStyle('vspace'); + } + } + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '260px'; + + // Setup browse button + document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image'); + if (isVisible('overbrowser')) + document.getElementById('onmouseoversrc').style.width = '260px'; + + // Setup browse button + document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image'); + if (isVisible('outbrowser')) + document.getElementById('onmouseoutsrc').style.width = '260px'; + + // If option enabled default contrain proportions to checked + if (ed.getParam("advimage_constrain_proportions", true)) + f.constrain.checked = true; + + // Check swap image if valid data + if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value) + this.setSwapImage(true); + else + this.setSwapImage(false); + + this.changeAppearance(); + this.showPreviewImage(nl.src.value, 1); + }, + + insert : function(file, title) { + var ed = tinyMCEPopup.editor, t = this, f = document.forms[0]; + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (tinyMCEPopup.getParam("accessibility_warnings", 1)) { + if (!f.alt.value) { + tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { + if (s) + t.insertAndClose(); + }); + + return; + } + } + + t.insertAndClose(); + }, + + insertAndClose : function() { + var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + // Fixes crash in Safari + if (tinymce.isWebKit) + ed.getWin().focus(); + + if (!ed.settings.inline_styles) { + args = { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }; + } else { + // Remove deprecated values + args = { + vspace : '', + hspace : '', + border : '', + align : '' + }; + } + + tinymce.extend(args, { + src : nl.src.value, + width : nl.width.value, + height : nl.height.value, + alt : nl.alt.value, + title : nl.title.value, + 'class' : getSelectValue(f, 'class_list'), + style : nl.style.value, + id : nl.id.value, + dir : nl.dir.value, + lang : nl.lang.value, + usemap : nl.usemap.value, + longdesc : nl.longdesc.value + }); + + args.onmouseover = args.onmouseout = ''; + + if (f.onmousemovecheck.checked) { + if (nl.onmouseoversrc.value) + args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';"; + + if (nl.onmouseoutsrc.value) + args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';"; + } + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + setSwapImage : function(st) { + var f = document.forms[0]; + + f.onmousemovecheck.checked = st; + setBrowserDisabled('overbrowser', !st); + setBrowserDisabled('outbrowser', !st); + + if (f.over_list) + f.over_list.disabled = !st; + + if (f.out_list) + f.out_list.disabled = !st; + + f.onmouseoversrc.disabled = !st; + f.onmouseoutsrc.disabled = !st; + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options.length = 0; + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + lst.options.length = 0; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.elements.width.value = f.elements.height.value = ''; + }, + + updateImageData : function(img, st) { + var f = document.forms[0]; + + if (!st) { + f.elements.width.value = img.width; + f.elements.height.value = img.height; + } + + this.preloadImg = img; + }, + + changeAppearance : function() { + var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg'); + + if (img) { + if (ed.getParam('inline_styles')) { + ed.dom.setAttrib(img, 'style', f.style.value); + } else { + img.align = f.align.value; + img.border = f.border.value; + img.hspace = f.hspace.value; + img.vspace = f.vspace.value; + } + } + }, + + changeHeight : function() { + var f = document.forms[0], tp, t = this; + + if (!f.constrain.checked || !t.preloadImg) { + return; + } + + if (f.width.value == "" || f.height.value == "") + return; + + tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height; + f.height.value = tp.toFixed(0); + }, + + changeWidth : function() { + var f = document.forms[0], tp, t = this; + + if (!f.constrain.checked || !t.preloadImg) { + return; + } + + if (f.width.value == "" || f.height.value == "") + return; + + tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width; + f.width.value = tp.toFixed(0); + }, + + updateStyle : function(ty) { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value}); + + if (tinyMCEPopup.editor.settings.inline_styles) { + // Handle align + if (ty == 'align') { + dom.setStyle(img, 'float', ''); + dom.setStyle(img, 'vertical-align', ''); + + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') + dom.setStyle(img, 'float', v); + else + img.style.verticalAlign = v; + } + } + + // Handle border + if (ty == 'border') { + dom.setStyle(img, 'border', ''); + + v = f.border.value; + if (v || v == '0') { + if (v == '0') + img.style.border = '0'; + else + img.style.border = v + 'px solid black'; + } + } + + // Handle hspace + if (ty == 'hspace') { + dom.setStyle(img, 'marginLeft', ''); + dom.setStyle(img, 'marginRight', ''); + + v = f.hspace.value; + if (v) { + img.style.marginLeft = v + 'px'; + img.style.marginRight = v + 'px'; + } + } + + // Handle vspace + if (ty == 'vspace') { + dom.setStyle(img, 'marginTop', ''); + dom.setStyle(img, 'marginBottom', ''); + + v = f.vspace.value; + if (v) { + img.style.marginTop = v + 'px'; + img.style.marginBottom = v + 'px'; + } + } + + // Merge + dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText)); + } + }, + + changeMouseMove : function() { + }, + + showPreviewImage : function(u, st) { + if (!u) { + tinyMCEPopup.dom.setHTML('prev', ''); + return; + } + + if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true)) + this.resetImageData(); + + u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u); + + if (!st) + tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />'); + else + tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />'); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..f493d196fae5ba43d1a738e781d7f0f7f24c9acf --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advimage/langs/en_dlg.js @@ -0,0 +1,43 @@ +tinyMCE.addI18n('en.advimage_dlg',{ +tab_general:"General", +tab_appearance:"Appearance", +tab_advanced:"Advanced", +general:"General", +title:"Title", +preview:"Preview", +constrain_proportions:"Constrain proportions", +langdir:"Language direction", +langcode:"Language code", +long_desc:"Long description link", +style:"Style", +classes:"Classes", +ltr:"Left to right", +rtl:"Right to left", +id:"Id", +map:"Image map", +swap_image:"Swap image", +alt_image:"Alternative image", +mouseover:"for mouse over", +mouseout:"for mouse out", +misc:"Miscellaneous", +example_img:"Appearance preview image", +missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.", +dialog_title:"Insert/edit image", +src:"Image URL", +alt:"Image description", +list:"Image list", +border:"Border", +dimensions:"Dimensions", +vspace:"Vertical space", +hspace:"Horizontal space", +align:"Alignment", +align_baseline:"Baseline", +align_top:"Top", +align_middle:"Middle", +align_bottom:"Bottom", +align_texttop:"Text top", +align_textbottom:"Text bottom", +align_left:"Left", +align_right:"Right", +image_list:"Image list" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/css/advlink.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/css/advlink.css new file mode 100644 index 0000000000000000000000000000000000000000..14364316a19d94fda52a04f0bc067928a3a62c3b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/css/advlink.css @@ -0,0 +1,8 @@ +.mceLinkList, .mceAnchorList, #targetlist {width:280px;} +.mceActionPanel {margin-top:7px;} +.panel_wrapper div.current {height:320px;} +#classlist, #title, #href {width:280px;} +#popupurl, #popupname {width:200px;} +#popupwidth, #popupheight, #popupleft, #popuptop {width:30px;vertical-align:middle;text-align:center;} +#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {width:200px;} +#events_panel input {width:200px;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..983fe5a9ca494675c9da41c16ecd58b595e4259b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.AdvancedLinkPlugin",{init:function(a,b){this.editor=a;a.addCommand("mceAdvLink",function(){var c=a.selection;if(c.isCollapsed()&&!a.dom.getParent(c.getNode(),"A")){return}a.windowManager.open({file:b+"/link.htm",width:480+parseInt(a.getLang("advlink.delta_width",0)),height:400+parseInt(a.getLang("advlink.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("link",{title:"advlink.link_desc",cmd:"mceAdvLink"});a.addShortcut("ctrl+k","advlink.advlink_desc","mceAdvLink");a.onNodeChange.add(function(d,c,f,e){c.setDisabled("link",e&&f.nodeName!="A");c.setActive("link",f.nodeName=="A"&&!f.name)})},getInfo:function(){return{longname:"Advanced link",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlink",tinymce.plugins.AdvancedLinkPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..fc5325a9677066a1cabb3ad64fdf481f9c2f056d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/editor_plugin_src.js @@ -0,0 +1,58 @@ +/** + * $Id: editor_plugin_src.js 539 2008-01-14 19:08:58Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AdvancedLinkPlugin', { + init : function(ed, url) { + this.editor = ed; + + // Register commands + ed.addCommand('mceAdvLink', function() { + var se = ed.selection; + + // No selection and not in link + if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A')) + return; + + ed.windowManager.open({ + file : url + '/link.htm', + width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)), + height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('link', { + title : 'advlink.link_desc', + cmd : 'mceAdvLink' + }); + + ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink'); + + ed.onNodeChange.add(function(ed, cm, n, co) { + cm.setDisabled('link', co && n.nodeName != 'A'); + cm.setActive('link', n.nodeName == 'A' && !n.name); + }); + }, + + getInfo : function() { + return { + longname : 'Advanced link', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/js/advlink.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/js/advlink.js new file mode 100644 index 0000000000000000000000000000000000000000..bb7922a6e1e12c832509fbc6348777df77a767d1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/js/advlink.js @@ -0,0 +1,528 @@ +/* Functions for the advlink plugin popup */ + +tinyMCEPopup.requireLangPack(); + +var templates = { + "window.open" : "window.open('${url}','${target}','${options}')" +}; + +function preinit() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>'); +} + +function changeClass() { + var f = document.forms[0]; + + f.classes.value = getSelectValue(f, 'classlist'); +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + var formObj = document.forms[0]; + var inst = tinyMCEPopup.editor; + var elm = inst.selection.getNode(); + var action = "insert"; + var html; + + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink'); + document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink'); + document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href'); + document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href'); + document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target'); + + // Link list + html = getLinkListHTML('linklisthref','href'); + if (html == "") + document.getElementById("linklisthrefrow").style.display = 'none'; + else + document.getElementById("linklisthrefcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '260px'; + + if (isVisible('popupurlbrowser')) + document.getElementById('popupurl').style.width = '180px'; + + elm = inst.dom.getParent(elm, "A"); + if (elm != null && elm.nodeName == "A") + action = "update"; + + formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true); + + setPopupControlsDisabled(true); + + if (action == "update") { + var href = inst.dom.getAttrib(elm, 'href'); + var onclick = inst.dom.getAttrib(elm, 'onclick'); + + // Setup form data + setFormValue('href', href); + setFormValue('title', inst.dom.getAttrib(elm, 'title')); + setFormValue('id', inst.dom.getAttrib(elm, 'id')); + setFormValue('style', inst.dom.getAttrib(elm, "style")); + setFormValue('rel', inst.dom.getAttrib(elm, 'rel')); + setFormValue('rev', inst.dom.getAttrib(elm, 'rev')); + setFormValue('charset', inst.dom.getAttrib(elm, 'charset')); + setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang')); + setFormValue('dir', inst.dom.getAttrib(elm, 'dir')); + setFormValue('lang', inst.dom.getAttrib(elm, 'lang')); + setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : "")); + setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : "")); + setFormValue('type', inst.dom.getAttrib(elm, 'type')); + setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus')); + setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur')); + setFormValue('onclick', onclick); + setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick')); + setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown')); + setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup')); + setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover')); + setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove')); + setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout')); + setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress')); + setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown')); + setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup')); + setFormValue('target', inst.dom.getAttrib(elm, 'target')); + setFormValue('classes', inst.dom.getAttrib(elm, 'class')); + + // Parse onclick data + if (onclick != null && onclick.indexOf('window.open') != -1) + parseWindowOpen(onclick); + else + parseFunction(onclick); + + // Select by the values + selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir')); + selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel')); + selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev')); + selectByValue(formObj, 'linklisthref', href); + + if (href.charAt(0) == '#') + selectByValue(formObj, 'anchorlist', href); + + addClassesToList('classlist', 'advlink_styles'); + + selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true); + selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true); + } else + addClassesToList('classlist', 'advlink_styles'); +} + +function checkPrefix(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external'))) + n.value = 'http://' + n.value; +} + +function setFormValue(name, value) { + document.forms[0].elements[name].value = value; +} + +function parseWindowOpen(onclick) { + var formObj = document.forms[0]; + + // Preprocess center code + if (onclick.indexOf('return false;') != -1) { + formObj.popupreturn.checked = true; + onclick = onclick.replace('return false;', ''); + } else + formObj.popupreturn.checked = false; + + var onClickData = parseLink(onclick); + + if (onClickData != null) { + formObj.ispopup.checked = true; + setPopupControlsDisabled(false); + + var onClickWindowOptions = parseOptions(onClickData['options']); + var url = onClickData['url']; + + formObj.popupname.value = onClickData['target']; + formObj.popupurl.value = url; + formObj.popupwidth.value = getOption(onClickWindowOptions, 'width'); + formObj.popupheight.value = getOption(onClickWindowOptions, 'height'); + + formObj.popupleft.value = getOption(onClickWindowOptions, 'left'); + formObj.popuptop.value = getOption(onClickWindowOptions, 'top'); + + if (formObj.popupleft.value.indexOf('screen') != -1) + formObj.popupleft.value = "c"; + + if (formObj.popuptop.value.indexOf('screen') != -1) + formObj.popuptop.value = "c"; + + formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes"; + formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes"; + formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes"; + formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes"; + formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes"; + formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes"; + formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes"; + + buildOnClick(); + } +} + +function parseFunction(onclick) { + var formObj = document.forms[0]; + var onClickData = parseLink(onclick); + + // TODO: Add stuff here +} + +function getOption(opts, name) { + return typeof(opts[name]) == "undefined" ? "" : opts[name]; +} + +function setPopupControlsDisabled(state) { + var formObj = document.forms[0]; + + formObj.popupname.disabled = state; + formObj.popupurl.disabled = state; + formObj.popupwidth.disabled = state; + formObj.popupheight.disabled = state; + formObj.popupleft.disabled = state; + formObj.popuptop.disabled = state; + formObj.popuplocation.disabled = state; + formObj.popupscrollbars.disabled = state; + formObj.popupmenubar.disabled = state; + formObj.popupresizable.disabled = state; + formObj.popuptoolbar.disabled = state; + formObj.popupstatus.disabled = state; + formObj.popupreturn.disabled = state; + formObj.popupdependent.disabled = state; + + setBrowserDisabled('popupurlbrowser', state); +} + +function parseLink(link) { + link = link.replace(new RegExp(''', 'g'), "'"); + + var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1"); + + // Is function name a template function + var template = templates[fnName]; + if (template) { + // Build regexp + var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi")); + var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\("; + var replaceStr = ""; + for (var i=0; i<variableNames.length; i++) { + // Is string value + if (variableNames[i].indexOf("'${") != -1) + regExp += "'(.*)'"; + else // Number value + regExp += "([0-9]*)"; + + replaceStr += "$" + (i+1); + + // Cleanup variable name + variableNames[i] = variableNames[i].replace(new RegExp("[^A-Za-z0-9]", "gi"), ""); + + if (i != variableNames.length-1) { + regExp += "\\s*,\\s*"; + replaceStr += "<delim>"; + } else + regExp += ".*"; + } + + regExp += "\\);?"; + + // Build variable array + var variables = []; + variables["_function"] = fnName; + var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('<delim>'); + for (var i=0; i<variableNames.length; i++) + variables[variableNames[i]] = variableValues[i]; + + return variables; + } + + return null; +} + +function parseOptions(opts) { + if (opts == null || opts == "") + return []; + + // Cleanup the options + opts = opts.toLowerCase(); + opts = opts.replace(/;/g, ","); + opts = opts.replace(/[^0-9a-z=,]/g, ""); + + var optionChunks = opts.split(','); + var options = []; + + for (var i=0; i<optionChunks.length; i++) { + var parts = optionChunks[i].split('='); + + if (parts.length == 2) + options[parts[0]] = parts[1]; + } + + return options; +} + +function buildOnClick() { + var formObj = document.forms[0]; + + if (!formObj.ispopup.checked) { + formObj.onclick.value = ""; + return; + } + + var onclick = "window.open('"; + var url = formObj.popupurl.value; + + onclick += url + "','"; + onclick += formObj.popupname.value + "','"; + + if (formObj.popuplocation.checked) + onclick += "location=yes,"; + + if (formObj.popupscrollbars.checked) + onclick += "scrollbars=yes,"; + + if (formObj.popupmenubar.checked) + onclick += "menubar=yes,"; + + if (formObj.popupresizable.checked) + onclick += "resizable=yes,"; + + if (formObj.popuptoolbar.checked) + onclick += "toolbar=yes,"; + + if (formObj.popupstatus.checked) + onclick += "status=yes,"; + + if (formObj.popupdependent.checked) + onclick += "dependent=yes,"; + + if (formObj.popupwidth.value != "") + onclick += "width=" + formObj.popupwidth.value + ","; + + if (formObj.popupheight.value != "") + onclick += "height=" + formObj.popupheight.value + ","; + + if (formObj.popupleft.value != "") { + if (formObj.popupleft.value != "c") + onclick += "left=" + formObj.popupleft.value + ","; + else + onclick += "left='+(screen.availWidth/2-" + (formObj.popupwidth.value/2) + ")+',"; + } + + if (formObj.popuptop.value != "") { + if (formObj.popuptop.value != "c") + onclick += "top=" + formObj.popuptop.value + ","; + else + onclick += "top='+(screen.availHeight/2-" + (formObj.popupheight.value/2) + ")+',"; + } + + if (onclick.charAt(onclick.length-1) == ',') + onclick = onclick.substring(0, onclick.length-1); + + onclick += "');"; + + if (formObj.popupreturn.checked) + onclick += "return false;"; + + // tinyMCE.debug(onclick); + + formObj.onclick.value = onclick; + + if (formObj.href.value == "") + formObj.href.value = url; +} + +function setAttrib(elm, attrib, value) { + var formObj = document.forms[0]; + var valueElm = formObj.elements[attrib.toLowerCase()]; + var dom = tinyMCEPopup.editor.dom; + + if (typeof(value) == "undefined" || value == null) { + value = ""; + + if (valueElm) + value = valueElm.value; + } + + // Clean up the style + if (attrib == 'style') + value = dom.serializeStyle(dom.parseStyle(value)); + + dom.setAttrib(elm, attrib, value); +} + +function getAnchorListHTML(id, target) { + var inst = tinyMCEPopup.editor; + var nodes = inst.dom.select('a.mceItemAnchor,img.mceItemAnchor'), name, i; + var html = ""; + + html += '<select id="' + id + '" name="' + id + '" class="mceAnchorList" o2nfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target + '.value='; + html += 'this.options[this.selectedIndex].value;">'; + html += '<option value="">---</option>'; + + for (i=0; i<nodes.length; i++) { + if ((name = inst.dom.getAttrib(nodes[i], "name")) != "") + html += '<option value="#' + name + '">' + name + '</option>'; + } + + html += '</select>'; + + return html; +} + +function insertAction() { + var inst = tinyMCEPopup.editor; + var elm, elementArray, i; + + elm = inst.selection.getNode(); + checkPrefix(document.forms[0].href); + + elm = inst.dom.getParent(elm, "A"); + + // Remove element if there is no href + if (!document.forms[0].href.value) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + i = inst.selection.getBookmark(); + inst.dom.remove(elm, 1); + inst.selection.moveToBookmark(i); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (elm == null) { + inst.getDoc().execCommand("unlink", false, null); + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';}); + for (i=0; i<elementArray.length; i++) + setAllAttribs(elm = elementArray[i]); + } else + setAllAttribs(elm); + + // Don't move caret if selection was image + if (elm.childNodes.length != 1 || elm.firstChild.nodeName != 'IMG') { + inst.focus(); + inst.selection.select(elm); + inst.selection.collapse(0); + tinyMCEPopup.storeSelection(); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); +} + +function setAllAttribs(elm) { + var formObj = document.forms[0]; + var href = formObj.href.value; + var target = getSelectValue(formObj, 'targetlist'); + + setAttrib(elm, 'href', href); + setAttrib(elm, 'title'); + setAttrib(elm, 'target', target == '_self' ? '' : target); + setAttrib(elm, 'id'); + setAttrib(elm, 'style'); + setAttrib(elm, 'class', getSelectValue(formObj, 'classlist')); + setAttrib(elm, 'rel'); + setAttrib(elm, 'rev'); + setAttrib(elm, 'charset'); + setAttrib(elm, 'hreflang'); + setAttrib(elm, 'dir'); + setAttrib(elm, 'lang'); + setAttrib(elm, 'tabindex'); + setAttrib(elm, 'accesskey'); + setAttrib(elm, 'type'); + setAttrib(elm, 'onfocus'); + setAttrib(elm, 'onblur'); + setAttrib(elm, 'onclick'); + setAttrib(elm, 'ondblclick'); + setAttrib(elm, 'onmousedown'); + setAttrib(elm, 'onmouseup'); + setAttrib(elm, 'onmouseover'); + setAttrib(elm, 'onmousemove'); + setAttrib(elm, 'onmouseout'); + setAttrib(elm, 'onkeypress'); + setAttrib(elm, 'onkeydown'); + setAttrib(elm, 'onkeyup'); + + // Refresh in old MSIE + if (tinyMCE.isMSIE5) + elm.outerHTML = elm.outerHTML; +} + +function getSelectValue(form_obj, field_name) { + var elm = form_obj.elements[field_name]; + + if (!elm || elm.options == null || elm.selectedIndex == -1) + return ""; + + return elm.options[elm.selectedIndex].value; +} + +function getLinkListHTML(elm_id, target_form_element, onchange_func) { + if (typeof(tinyMCELinkList) == "undefined" || tinyMCELinkList.length == 0) + return ""; + + var html = ""; + + html += '<select id="' + elm_id + '" name="' + elm_id + '"'; + html += ' class="mceLinkList" onfoc2us="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value='; + html += 'this.options[this.selectedIndex].value;'; + + if (typeof(onchange_func) != "undefined") + html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);'; + + html += '"><option value="">---</option>'; + + for (var i=0; i<tinyMCELinkList.length; i++) + html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>'; + + html += '</select>'; + + return html; + + // tinyMCE.debug('-- image list start --', html, '-- image list end --'); +} + +function getTargetListHTML(elm_id, target_form_element) { + var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';'); + var html = ''; + + html += '<select id="' + elm_id + '" name="' + elm_id + '" onf2ocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value='; + html += 'this.options[this.selectedIndex].value;">'; + html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>'; + html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>'; + html += '<option value="_parent">' + tinyMCEPopup.getLang('advlink_dlg.target_parent') + ' (_parent)</option>'; + html += '<option value="_top">' + tinyMCEPopup.getLang('advlink_dlg.target_top') + ' (_top)</option>'; + + for (var i=0; i<targets.length; i++) { + var key, value; + + if (targets[i] == "") + continue; + + key = targets[i].split('=')[0]; + value = targets[i].split('=')[1]; + + html += '<option value="' + key + '">' + value + ' (' + key + ')</option>'; + } + + html += '</select>'; + + return html; +} + +// While loading +preinit(); +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..c71ffbd0f1646355d9a0d28b739de11b96b29bdf --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/langs/en_dlg.js @@ -0,0 +1,52 @@ +tinyMCE.addI18n('en.advlink_dlg',{ +title:"Insert/edit link", +url:"Link URL", +target:"Target", +titlefield:"Title", +is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +list:"Link list", +general_tab:"General", +popup_tab:"Popup", +events_tab:"Events", +advanced_tab:"Advanced", +general_props:"General properties", +popup_props:"Popup properties", +event_props:"Events", +advanced_props:"Advanced properties", +popup_opts:"Options", +anchor_names:"Anchors", +target_same:"Open in this window / frame", +target_parent:"Open in parent window / frame", +target_top:"Open in top frame (replaces all frames)", +target_blank:"Open in new window", +popup:"Javascript popup", +popup_url:"Popup URL", +popup_name:"Window name", +popup_return:"Insert 'return false'", +popup_scrollbars:"Show scrollbars", +popup_statusbar:"Show status bar", +popup_toolbar:"Show toolbars", +popup_menubar:"Show menu bar", +popup_location:"Show location bar", +popup_resizable:"Make window resizable", +popup_dependent:"Dependent (Mozilla/Firefox only)", +popup_size:"Size", +popup_position:"Position (X/Y)", +id:"Id", +style:"Style", +classes:"Classes", +target_name:"Target name", +langdir:"Language direction", +target_langcode:"Target language", +langcode:"Language code", +encoding:"Target character encoding", +mime:"Target MIME type", +rel:"Relationship page to target", +rev:"Relationship target to page", +tabindex:"Tabindex", +accesskey:"Accesskey", +ltr:"Left to right", +rtl:"Right to left", +link_list:"Link list" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/link.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/link.htm new file mode 100644 index 0000000000000000000000000000000000000000..cc8b0b87c163065ea8de1affb26f82d370c1ad20 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/advlink/link.htm @@ -0,0 +1,338 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advlink_dlg.title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/validate.js"></script> + <script type="text/javascript" src="js/advlink.js"></script> + <link href="css/advlink.css" rel="stylesheet" type="text/css" /> +</head> +<body id="advlink" style="display: none"> + <form onsubmit="insertAction();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advlink_dlg.general_tab}</a></span></li> + <li id="popup_tab"><span><a href="javascript:mcTabs.displayTab('popup_tab','popup_panel');" onmousedown="return false;">{#advlink_dlg.popup_tab}</a></span></li> + <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#advlink_dlg.events_tab}</a></span></li> + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advlink_dlg.advanced_tab}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#advlink_dlg.general_props}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="nowrap"><label id="hreflabel" for="href">{#advlink_dlg.url}</label></td> + <td><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="href" name="href" type="text" class="mceFocus" value="" onchange="selectByValue(this.form,'linklisthref',this.value);" /></td> + <td id="hrefbrowsercontainer"> </td> + </tr> + </table></td> + </tr> + <tr id="linklisthrefrow"> + <td class="column1"><label for="linklisthref">{#advlink_dlg.list}</label></td> + <td colspan="2" id="linklisthrefcontainer"><select id="linklisthref"><option value=""></option></select></td> + </tr> + <tr> + <td class="column1"><label for="anchorlist">{#advlink_dlg.anchor_names}</label></td> + <td colspan="2" id="anchorlistcontainer"><select id="anchorlist"><option value=""></option></select></td> + </tr> + <tr> + <td><label id="targetlistlabel" for="targetlist">{#advlink_dlg.target}</label></td> + <td id="targetlistcontainer"><select id="targetlist"><option value=""></option></select></td> + </tr> + <tr> + <td class="nowrap"><label id="titlelabel" for="title">{#advlink_dlg.titlefield}</label></td> + <td><input id="title" name="title" type="text" value="" /></td> + </tr> + <tr> + <td><label id="classlabel" for="classlist">{#class_name}</label></td> + <td> + <select id="classlist" name="classlist" onchange="changeClass();"> + <option value="" selected="selected">{#not_set}</option> + </select> + </td> + </tr> + </table> + </fieldset> + </div> + + <div id="popup_panel" class="panel"> + <fieldset> + <legend>{#advlink_dlg.popup_props}</legend> + + <input type="checkbox" id="ispopup" name="ispopup" class="radio" onclick="setPopupControlsDisabled(!this.checked);buildOnClick();" /> + <label id="ispopuplabel" for="ispopup">{#advlink_dlg.popup}</label> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="nowrap"><label for="popupurl">{#advlink_dlg.popup_url}</label> </td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" name="popupurl" id="popupurl" value="" onchange="buildOnClick();" /></td> + <td id="popupurlbrowsercontainer"> </td> + </tr> + </table> + </td> + </tr> + <tr> + <td class="nowrap"><label for="popupname">{#advlink_dlg.popup_name}</label> </td> + <td><input type="text" name="popupname" id="popupname" value="" onchange="buildOnClick();" /></td> + </tr> + <tr> + <td class="nowrap"><label>{#advlink_dlg.popup_size}</label> </td> + <td class="nowrap"> + <input type="text" id="popupwidth" name="popupwidth" value="" onchange="buildOnClick();" /> x + <input type="text" id="popupheight" name="popupheight" value="" onchange="buildOnClick();" /> px + </td> + </tr> + <tr> + <td class="nowrap" id="labelleft"><label>{#advlink_dlg.popup_position}</label> </td> + <td class="nowrap"> + <input type="text" id="popupleft" name="popupleft" value="" onchange="buildOnClick();" /> / + <input type="text" id="popuptop" name="popuptop" value="" onchange="buildOnClick();" /> (c /c = center) + </td> + </tr> + </table> + + <fieldset> + <legend>{#advlink_dlg.popup_opts}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td><input type="checkbox" id="popuplocation" name="popuplocation" class="checkbox" onchange="buildOnClick();" /></td> + <td class="nowrap"><label id="popuplocationlabel" for="popuplocation">{#advlink_dlg.popup_location}</label></td> + <td><input type="checkbox" id="popupscrollbars" name="popupscrollbars" class="checkbox" onchange="buildOnClick();" /></td> + <td class="nowrap"><label id="popupscrollbarslabel" for="popupscrollbars">{#advlink_dlg.popup_scrollbars}</label></td> + </tr> + <tr> + <td><input type="checkbox" id="popupmenubar" name="popupmenubar" class="checkbox" onchange="buildOnClick();" /></td> + <td class="nowrap"><label id="popupmenubarlabel" for="popupmenubar">{#advlink_dlg.popup_menubar}</label></td> + <td><input type="checkbox" id="popupresizable" name="popupresizable" class="checkbox" onchange="buildOnClick();" /></td> + <td class="nowrap"><label id="popupresizablelabel" for="popupresizable">{#advlink_dlg.popup_resizable}</label></td> + </tr> + <tr> + <td><input type="checkbox" id="popuptoolbar" name="popuptoolbar" class="checkbox" onchange="buildOnClick();" /></td> + <td class="nowrap"><label id="popuptoolbarlabel" for="popuptoolbar">{#advlink_dlg.popup_toolbar}</label></td> + <td><input type="checkbox" id="popupdependent" name="popupdependent" class="checkbox" onchange="buildOnClick();" /></td> + <td class="nowrap"><label id="popupdependentlabel" for="popupdependent">{#advlink_dlg.popup_dependent}</label></td> + </tr> + <tr> + <td><input type="checkbox" id="popupstatus" name="popupstatus" class="checkbox" onchange="buildOnClick();" /></td> + <td class="nowrap"><label id="popupstatuslabel" for="popupstatus">{#advlink_dlg.popup_statusbar}</label></td> + <td><input type="checkbox" id="popupreturn" name="popupreturn" class="checkbox" onchange="buildOnClick();" checked="checked" /></td> + <td class="nowrap"><label id="popupreturnlabel" for="popupreturn">{#advlink_dlg.popup_return}</label></td> + </tr> + </table> + </fieldset> + </fieldset> + </div> + + <div id="advanced_panel" class="panel"> + <fieldset> + <legend>{#advlink_dlg.advanced_props}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="column1"><label id="idlabel" for="id">{#advlink_dlg.id}</label></td> + <td><input id="id" name="id" type="text" value="" /></td> + </tr> + + <tr> + <td><label id="stylelabel" for="style">{#advlink_dlg.style}</label></td> + <td><input type="text" id="style" name="style" value="" /></td> + </tr> + + <tr> + <td><label id="classeslabel" for="classes">{#advlink_dlg.classes}</label></td> + <td><input type="text" id="classes" name="classes" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td> + </tr> + + <tr> + <td><label id="targetlabel" for="target">{#advlink_dlg.target_name}</label></td> + <td><input type="text" id="target" name="target" value="" onchange="selectByValue(this.form,'targetlist',this.value,true);" /></td> + </tr> + + <tr> + <td class="column1"><label id="dirlabel" for="dir">{#advlink_dlg.langdir}</label></td> + <td> + <select id="dir" name="dir"> + <option value="">{#not_set}</option> + <option value="ltr">{#advlink_dlg.ltr}</option> + <option value="rtl">{#advlink_dlg.rtl}</option> + </select> + </td> + </tr> + + <tr> + <td><label id="hreflanglabel" for="hreflang">{#advlink_dlg.target_langcode}</label></td> + <td><input type="text" id="hreflang" name="hreflang" value="" /></td> + </tr> + + <tr> + <td class="column1"><label id="langlabel" for="lang">{#advlink_dlg.langcode}</label></td> + <td> + <input id="lang" name="lang" type="text" value="" /> + </td> + </tr> + + <tr> + <td><label id="charsetlabel" for="charset">{#advlink_dlg.encoding}</label></td> + <td><input type="text" id="charset" name="charset" value="" /></td> + </tr> + + <tr> + <td><label id="typelabel" for="type">{#advlink_dlg.mime}</label></td> + <td><input type="text" id="type" name="type" value="" /></td> + </tr> + + <tr> + <td><label id="rellabel" for="rel">{#advlink_dlg.rel}</label></td> + <td><select id="rel" name="rel"> + <option value="">{#not_set}</option> + <option value="lightbox">Lightbox</option> + <option value="alternate">Alternate</option> + <option value="designates">Designates</option> + <option value="stylesheet">Stylesheet</option> + <option value="start">Start</option> + <option value="next">Next</option> + <option value="prev">Prev</option> + <option value="contents">Contents</option> + <option value="index">Index</option> + <option value="glossary">Glossary</option> + <option value="copyright">Copyright</option> + <option value="chapter">Chapter</option> + <option value="subsection">Subsection</option> + <option value="appendix">Appendix</option> + <option value="help">Help</option> + <option value="bookmark">Bookmark</option> + <option value="nofollow">No Follow</option> + <option value="tag">Tag</option> + </select> + </td> + </tr> + + <tr> + <td><label id="revlabel" for="rev">{#advlink_dlg.rev}</label></td> + <td><select id="rev" name="rev"> + <option value="">{#not_set}</option> + <option value="alternate">Alternate</option> + <option value="designates">Designates</option> + <option value="stylesheet">Stylesheet</option> + <option value="start">Start</option> + <option value="next">Next</option> + <option value="prev">Prev</option> + <option value="contents">Contents</option> + <option value="index">Index</option> + <option value="glossary">Glossary</option> + <option value="copyright">Copyright</option> + <option value="chapter">Chapter</option> + <option value="subsection">Subsection</option> + <option value="appendix">Appendix</option> + <option value="help">Help</option> + <option value="bookmark">Bookmark</option> + </select> + </td> + </tr> + + <tr> + <td><label id="tabindexlabel" for="tabindex">{#advlink_dlg.tabindex}</label></td> + <td><input type="text" id="tabindex" name="tabindex" value="" /></td> + </tr> + + <tr> + <td><label id="accesskeylabel" for="accesskey">{#advlink_dlg.accesskey}</label></td> + <td><input type="text" id="accesskey" name="accesskey" value="" /></td> + </tr> + </table> + </fieldset> + </div> + + <div id="events_panel" class="panel"> + <fieldset> + <legend>{#advlink_dlg.event_props}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="column1"><label for="onfocus">onfocus</label></td> + <td><input id="onfocus" name="onfocus" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onblur">onblur</label></td> + <td><input id="onblur" name="onblur" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onclick">onclick</label></td> + <td><input id="onclick" name="onclick" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="ondblclick">ondblclick</label></td> + <td><input id="ondblclick" name="ondblclick" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onmousedown">onmousedown</label></td> + <td><input id="onmousedown" name="onmousedown" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onmouseup">onmouseup</label></td> + <td><input id="onmouseup" name="onmouseup" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onmouseover">onmouseover</label></td> + <td><input id="onmouseover" name="onmouseover" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onmousemove">onmousemove</label></td> + <td><input id="onmousemove" name="onmousemove" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onmouseout">onmouseout</label></td> + <td><input id="onmouseout" name="onmouseout" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onkeypress">onkeypress</label></td> + <td><input id="onkeypress" name="onkeypress" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onkeydown">onkeydown</label></td> + <td><input id="onkeydown" name="onkeydown" type="text" value="" /></td> + </tr> + + <tr> + <td class="column1"><label for="onkeyup">onkeyup</label></td> + <td><input id="onkeyup" name="onkeyup" type="text" value="" /></td> + </tr> + </table> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/autosave/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/autosave/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..091a063a9cbbbff973dda8001808a9a76c743e4b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/autosave/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.AutoSavePlugin",{init:function(a,b){var c=this;c.editor=a;window.onbeforeunload=tinymce.plugins.AutoSavePlugin._beforeUnloadHandler},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:tinymce.majorVersion+"."+tinymce.minorVersion}},"static":{_beforeUnloadHandler:function(){var a;tinymce.each(tinyMCE.editors,function(b){if(b.getParam("fullscreen_is_enabled")){return}if(b.isDirty()){a=b.getLang("autosave.unload_msg");return false}});return a}}});tinymce.PluginManager.add("autosave",tinymce.plugins.AutoSavePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/autosave/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/autosave/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..3c4325abe59b7385df8c86a2a23db02f93367cd5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/autosave/editor_plugin_src.js @@ -0,0 +1,51 @@ +/** + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AutoSavePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler; + }, + + getInfo : function() { + return { + longname : 'Auto save', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + 'static' : { + _beforeUnloadHandler : function() { + var msg; + + tinymce.each(tinyMCE.editors, function(ed) { + if (ed.getParam("fullscreen_is_enabled")) + return; + + if (ed.isDirty()) { + msg = ed.getLang("autosave.unload_msg"); + return false; + } + }); + + return msg; + } + } + }); + + // Register plugin + tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/bbcode/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/bbcode/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..930fdff0afcff943ffef53b2b81f8b7d4c74bc83 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/bbcode/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a,b){var d=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.onBeforeSetContent.add(function(e,f){f.content=d["_"+c+"_bbcode2html"](f.content)});a.onPostProcess.add(function(e,f){if(f.set){f.content=d["_"+c+"_bbcode2html"](f.content)}if(f.get){f.content=d["_"+c+"_html2bbcode"](f.content)}})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_punbb_html2bbcode:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");b(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");b(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");b(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");b(/<font>(.*?)<\/font>/gi,"$1");b(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");b(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");b(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");b(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");b(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");b(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");b(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");b(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");b(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");b(/<\/(strong|b)>/gi,"[/b]");b(/<(strong|b)>/gi,"[b]");b(/<\/(em|i)>/gi,"[/i]");b(/<(em|i)>/gi,"[i]");b(/<\/u>/gi,"[/u]");b(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");b(/<u>/gi,"[u]");b(/<blockquote[^>]*>/gi,"[quote]");b(/<\/blockquote>/gi,"[/quote]");b(/<br \/>/gi,"\n");b(/<br\/>/gi,"\n");b(/<br>/gi,"\n");b(/<p>/gi,"");b(/<\/p>/gi,"\n");b(/ /gi," ");b(/"/gi,'"');b(/</gi,"<");b(/>/gi,">");b(/&/gi,"&");return a},_punbb_bbcode2html:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/\n/gi,"<br />");b(/\[b\]/gi,"<strong>");b(/\[\/b\]/gi,"</strong>");b(/\[i\]/gi,"<em>");b(/\[\/i\]/gi,"</em>");b(/\[u\]/gi,"<u>");b(/\[\/u\]/gi,"</u>");b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');b(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>');b(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>');b(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> ');b(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> ');return a}});tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/bbcode/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/bbcode/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..1d7493e26d710b2a19602b1fb1108a547cb85911 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/bbcode/editor_plugin_src.js @@ -0,0 +1,117 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.BBCodePlugin', { + init : function(ed, url) { + var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase(); + + ed.onBeforeSetContent.add(function(ed, o) { + o.content = t['_' + dialect + '_bbcode2html'](o.content); + }); + + ed.onPostProcess.add(function(ed, o) { + if (o.set) + o.content = t['_' + dialect + '_bbcode2html'](o.content); + + if (o.get) + o.content = t['_' + dialect + '_html2bbcode'](o.content); + }); + }, + + getInfo : function() { + return { + longname : 'BBCode Plugin', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + // HTML -> BBCode in PunBB dialect + _punbb_html2bbcode : function(s) { + s = tinymce.trim(s); + + function rep(re, str) { + s = s.replace(re, str); + }; + + // example: <strong> to [b] + rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"); + rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"); + rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"); + rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"); + rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"); + rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"); + rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"); + rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"); + rep(/<font>(.*?)<\/font>/gi,"$1"); + rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"); + rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"); + rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"); + rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"); + rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"); + rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"); + rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"); + rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"); + rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"); + rep(/<\/(strong|b)>/gi,"[/b]"); + rep(/<(strong|b)>/gi,"[b]"); + rep(/<\/(em|i)>/gi,"[/i]"); + rep(/<(em|i)>/gi,"[i]"); + rep(/<\/u>/gi,"[/u]"); + rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"); + rep(/<u>/gi,"[u]"); + rep(/<blockquote[^>]*>/gi,"[quote]"); + rep(/<\/blockquote>/gi,"[/quote]"); + rep(/<br \/>/gi,"\n"); + rep(/<br\/>/gi,"\n"); + rep(/<br>/gi,"\n"); + rep(/<p>/gi,""); + rep(/<\/p>/gi,"\n"); + rep(/ /gi," "); + rep(/"/gi,"\""); + rep(/</gi,"<"); + rep(/>/gi,">"); + rep(/&/gi,"&"); + + return s; + }, + + // BBCode -> HTML from PunBB dialect + _punbb_bbcode2html : function(s) { + s = tinymce.trim(s); + + function rep(re, str) { + s = s.replace(re, str); + }; + + // example: [b] to <strong> + rep(/\n/gi,"<br />"); + rep(/\[b\]/gi,"<strong>"); + rep(/\[\/b\]/gi,"</strong>"); + rep(/\[i\]/gi,"<em>"); + rep(/\[\/i\]/gi,"</em>"); + rep(/\[u\]/gi,"<u>"); + rep(/\[\/u\]/gi,"</u>"); + rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>"); + rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>"); + rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />"); + rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>"); + rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span> "); + rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span> "); + + return s; + } + }); + + // Register plugin + tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/compat2x/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/compat2x/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..d921728fcb60e5526a100025afac7f1ca3db044e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/compat2x/editor_plugin.js @@ -0,0 +1 @@ +(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.is;tinymce.create("tinymce.plugins.Compat2x",{getInfo:function(){return{longname:"Compat2x",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x",version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}}});(function(){tinymce.extend(tinyMCE,{addToLang:function(f,e){d(e,function(h,g){tinyMCE.i18n[(tinyMCE.settings.language||"en")+"."+(f?f+"_":"")+g]=h})},getInstanceById:function(e){return this.get(e)}})})();(function(){var e=tinymce.EditorManager;tinyMCE.instances={};tinyMCE.plugins={};tinymce.PluginManager.onAdd.add(function(f,h,g){tinyMCE.plugins[h]=g});tinyMCE.majorVersion=tinymce.majorVersion;tinyMCE.minorVersion=tinymce.minorVersion;tinyMCE.releaseDate=tinymce.releaseDate;tinyMCE.baseURL=tinymce.baseURL;tinyMCE.isIE=tinyMCE.isMSIE=tinymce.isIE||tinymce.isOpera;tinyMCE.isMSIE5=tinymce.isIE;tinyMCE.isMSIE5_0=tinymce.isIE;tinyMCE.isMSIE7=tinymce.isIE;tinyMCE.isGecko=tinymce.isGecko;tinyMCE.isSafari=tinymce.isWebKit;tinyMCE.isOpera=tinymce.isOpera;tinyMCE.isMac=false;tinyMCE.isNS7=false;tinyMCE.isNS71=false;tinyMCE.compat=true;TinyMCE_Engine=tinyMCE;tinymce.extend(tinyMCE,{getParam:function(g,f){return this.activeEditor.getParam(g,f)},addEvent:function(i,g,h,j){tinymce.dom.Event.add(i,g,h,j||this)},getControlHTML:function(f){return e.activeEditor.controlManager.createControl(f)},loadCSS:function(f){tinymce.DOM.loadCSS(f)},importCSS:function(g,f){if(g==document){this.loadCSS(f)}else{new tinymce.dom.DOMUtils(g).loadCSS(f)}},log:function(){console.debug.apply(console,arguments)},getLang:function(h,g){var f=e.activeEditor.getLang(h.replace(/^lang_/g,""),g);if(/^[0-9\-.]+$/g.test(f)){return parseInt(f)}return f},isInstance:function(f){return f!=null&&typeof(f)=="object"&&f.execCommand},triggerNodeChange:function(){e.activeEditor.nodeChanged()},regexpReplace:function(j,f,h,i){var g;if(j==null){return j}if(typeof(i)=="undefined"){i="g"}g=new RegExp(f,i);return j.replace(g,h)},trim:function(f){return tinymce.trim(f)},xmlEncode:function(f){return tinymce.DOM.encode(f)},explode:function(f,h){var g=[];tinymce.each(f.split(h),function(i){if(i!=""){g.push(i)}});return g},switchClass:function(h,g){var f;if(/^mceButton/.test(g)){f=e.activeEditor.controlManager.get(h);if(!f){return}switch(g){case"mceButtonNormal":f.setDisabled(false);f.setActive(false);return;case"mceButtonDisabled":f.setDisabled(true);return;case"mceButtonSelected":f.setActive(true);f.setDisabled(false);return}}},addCSSClass:function(g,h,f){return tinymce.DOM.addClass(g,h,f)},hasCSSClass:function(f,g){return tinymce.DOM.hasClass(f,g)},removeCSSClass:function(f,g){return tinymce.DOM.removeClass(f,g)},getCSSClasses:function(){var f=e.activeEditor.dom.getClasses(),g=[];d(f,function(h){g.push(h["class"])});return g},setWindowArg:function(g,f){e.activeEditor.windowManager.params[g]=f},getWindowArg:function(i,g){var h=e.activeEditor.windowManager,f;f=h.getParam(i);if(f===""){return""}return f||h.getFeature(i)||g},getParentNode:function(h,g){return this._getDOM().getParent(h,g)},selectElements:function(o,k,m){var l,j=[],h,g;for(g=0,k=k.split(",");g<k.length;g++){for(l=0,h=o.getElementsByTagName(k[g]);l<h.length;l++){(!m||m(h[l]))&&j.push(h[l])}}return j},getNodeTree:function(i,f,g,h){return this.selectNodes(i,function(j){return(!g||j.nodeType==g)&&(!h||j.nodeName==h)},f?f:[])},getAttrib:function(g,h,f){return this._getDOM().getAttrib(g,h,f)},setAttrib:function(g,h,f){return this._getDOM().setAttrib(g,h,f)},getElementsByAttributeValue:function(m,k,g,h){var j,f=m.getElementsByTagName(k),l=[];for(j=0;j<f.length;j++){if(tinyMCE.getAttrib(f[j],g).indexOf(h)!=-1){l[l.length]=f[j]}}return l},selectNodes:function(k,j,g){var h;if(!g){g=[]}if(j(k)){g[g.length]=k}if(k.hasChildNodes()){for(h=0;h<k.childNodes.length;h++){tinyMCE.selectNodes(k.childNodes[h],j,g)}}return g},getContent:function(){return e.activeEditor.getContent()},getParentElement:function(i,g,h){if(g){g=new RegExp("^("+g.toUpperCase().replace(/,/g,"|")+")$","g")}return this._getDOM().getParent(i,function(f){return f.nodeType==1&&(!g||g.test(f.nodeName))&&(!h||h(f))},this.activeEditor.getBody())},importPluginLanguagePack:function(f){tinymce.PluginManager.requireLangPack(f)},getButtonHTML:function(l,j,h,k,i,g){var f=e.activeEditor;h=h.replace(/\{\$pluginurl\}/g,tinyMCE.pluginURL);h=h.replace(/\{\$themeurl\}/g,tinyMCE.themeURL);j=j.replace(/^lang_/g,"");return f.controlManager.createButton(l,{title:j,command:k,ui:i,value:g,scope:this,"class":"compat",image:h})},addSelectAccessibility:function(h,g,f){if(!g._isAccessible){g.onkeydown=tinyMCE.accessibleEventHandler;g.onblur=tinyMCE.accessibleEventHandler;g._isAccessible=true;g._win=f}return false},accessibleEventHandler:function(g){var h,f=this._win;g=tinymce.isIE?f.event:g;h=tinymce.isIE?g.srcElement:g.target;if(g.type=="blur"){if(h.oldonchange){h.onchange=h.oldonchange;h.oldonchange=null}return true}if(h.nodeName=="SELECT"&&!h.oldonchange){h.oldonchange=h.onchange;h.onchange=null}if(g.keyCode==13||g.keyCode==32){h.onchange=h.oldonchange;h.onchange();h.oldonchange=null;tinyMCE.cancelEvent(g);return false}return true},cancelEvent:function(f){return tinymce.dom.Event.cancel(f)},handleVisualAid:function(f){e.activeEditor.addVisual(f)},getAbsPosition:function(g,f){return tinymce.DOM.getPos(g,f)},cleanupEventStr:function(f){f=""+f;f=f.replace("function anonymous()\n{\n","");f=f.replace("\n}","");f=f.replace(/^return true;/gi,"");return f},getVisualAidClass:function(f){return f},parseStyle:function(f){return this._getDOM().parseStyle(f)},serializeStyle:function(f){return this._getDOM().serializeStyle(f)},openWindow:function(h,g){var f=e.activeEditor,i={},j;for(j in h){i[j]=h[j]}h=i;g=g||{};h.url=new tinymce.util.URI(tinymce.ThemeManager.themeURLs[f.settings.theme]).toAbsolute(h.file);h.inline=h.inline||g.inline;f.windowManager.open(h,g)},closeWindow:function(f){e.activeEditor.windowManager.close(f)},getOuterHTML:function(f){return tinymce.DOM.getOuterHTML(f)},setOuterHTML:function(g,f,i){return tinymce.DOM.setOuterHTML(g,f,i)},hasPlugin:function(f){return tinymce.PluginManager.get(f)!=null},_setEventsEnabled:function(){},addPlugin:function(g,i){var h=this;function j(f){tinyMCE.selectedInstance=f;f.onInit.add(function(){h.settings=f.settings;h.settings.base_href=tinyMCE.documentBasePath;tinyMCE.settings=h.settings;tinyMCE.documentBasePath=f.documentBasePath;if(i.initInstance){i.initInstance(f)}f.contentDocument=f.getDoc();f.contentWindow=f.getWin();f.undoRedo=f.undoManager;f.startContent=f.getContent({format:"raw"});tinyMCE.instances[f.id]=f;tinyMCE.loadedFiles=[]});f.onActivate.add(function(){tinyMCE.settings=f.settings;tinyMCE.selectedInstance=f});if(i.handleNodeChange){f.onNodeChange.add(function(l,k,m){i.handleNodeChange(l.id,m,0,0,false,!l.selection.isCollapsed())})}if(i.onChange){f.onChange.add(function(k,l){return i.onChange(k)})}if(i.cleanup){f.onGetContent.add(function(){})}this.getInfo=function(){return i.getInfo()};this.createControl=function(k){tinyMCE.pluginURL=tinymce.baseURL+"/plugins/"+g;tinyMCE.themeURL=tinymce.baseURL+"/themes/"+tinyMCE.activeEditor.settings.theme;if(i.getControlHTML){return i.getControlHTML(k)}return null};this.execCommand=function(l,k,m){if(i.execCommand){return i.execCommand(f.id,f.getBody(),l,k,m)}return false}}tinymce.PluginManager.add(g,j)},_getDOM:function(){return tinyMCE.activeEditor?tinyMCE.activeEditor.dom:tinymce.DOM},convertRelativeToAbsoluteURL:function(f,g){return new tinymce.util.URI(f).toAbsolute(g)},convertAbsoluteURLToRelativeURL:function(f,g){return new tinymce.util.URI(f).toRelative(g)}});tinymce.extend(tinymce.Editor.prototype,{getFocusElement:function(){return this.selection.getNode()},getData:function(f){if(!this.data){this.data=[]}if(!this.data[f]){this.data[f]=[]}return this.data[f]},hasPlugin:function(f){return this.plugins[f]!=null},getContainerWin:function(){return window},getHTML:function(f){return this.getContent({format:f?"raw":"html"})},setHTML:function(f){this.setContent(f)},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},isHidden:function(){var f;if(!tinymce.isGecko){return false}f=this.getSel();return(!f||!f.rangeCount||f.rangeCount==0)},translate:function(f){var h=this.settings.language,g;if(!f){return f}g=tinymce.EditorManager.i18n[h+"."+f]||f.replace(/{\#([^}]+)\}/g,function(j,i){return tinymce.EditorManager.i18n[h+"."+i]||"{#"+i+"}"});g=g.replace(/{\$lang_([^}]+)\}/g,function(j,i){return tinymce.EditorManager.i18n[h+"."+i]||"{$lang_"+i+"}"});return g},repaint:function(){this.execCommand("mceRepaint")}});tinymce.extend(tinymce.dom.Selection.prototype,{getSelectedText:function(){return this.getContent({format:"text"})},getSelectedHTML:function(){return this.getContent({format:"html"})},getFocusElement:function(){return this.getNode()},selectNode:function(i,j,g,f){var h=this;h.select(i,g||0);if(!b(j)){j=true}if(j){if(!b(f)){f=true}h.collapse(f)}}})}).call(this);tinymce.PluginManager.add("compat2x",tinymce.plugins.Compat2x)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/compat2x/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/compat2x/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..60d4f2d03f95584548369ce5d1ab8b636a71bc92 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/compat2x/editor_plugin_src.js @@ -0,0 +1,616 @@ +/** + * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is; + + tinymce.create('tinymce.plugins.Compat2x', { + getInfo : function() { + return { + longname : 'Compat2x', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x', + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion + }; + } + }); + + (function() { + // Extend tinyMCE/EditorManager + tinymce.extend(tinyMCE, { + addToLang : function(p, l) { + each(l, function(v, k) { + tinyMCE.i18n[(tinyMCE.settings.language || 'en') + '.' + (p ? p + '_' : '') + k] = v; + }); + }, + + getInstanceById : function(n) { + return this.get(n); + } + }); + })(); + + (function() { + var EditorManager = tinymce.EditorManager; + + tinyMCE.instances = {}; + tinyMCE.plugins = {}; + tinymce.PluginManager.onAdd.add(function(pm, n, p) { + tinyMCE.plugins[n] = p; + }); + + tinyMCE.majorVersion = tinymce.majorVersion; + tinyMCE.minorVersion = tinymce.minorVersion; + tinyMCE.releaseDate = tinymce.releaseDate; + tinyMCE.baseURL = tinymce.baseURL; + tinyMCE.isIE = tinyMCE.isMSIE = tinymce.isIE || tinymce.isOpera; + tinyMCE.isMSIE5 = tinymce.isIE; + tinyMCE.isMSIE5_0 = tinymce.isIE; + tinyMCE.isMSIE7 = tinymce.isIE; + tinyMCE.isGecko = tinymce.isGecko; + tinyMCE.isSafari = tinymce.isWebKit; + tinyMCE.isOpera = tinymce.isOpera; + tinyMCE.isMac = false; + tinyMCE.isNS7 = false; + tinyMCE.isNS71 = false; + tinyMCE.compat = true; + + // Extend tinyMCE class + TinyMCE_Engine = tinyMCE; + tinymce.extend(tinyMCE, { + getParam : function(n, dv) { + return this.activeEditor.getParam(n, dv); + }, + + addEvent : function(e, na, f, sc) { + tinymce.dom.Event.add(e, na, f, sc || this); + }, + + getControlHTML : function(n) { + return EditorManager.activeEditor.controlManager.createControl(n); + }, + + loadCSS : function(u) { + tinymce.DOM.loadCSS(u); + }, + + importCSS : function(doc, u) { + if (doc == document) + this.loadCSS(u); + else + new tinymce.dom.DOMUtils(doc).loadCSS(u); + }, + + log : function() { + console.debug.apply(console, arguments); + }, + + getLang : function(n, dv) { + var v = EditorManager.activeEditor.getLang(n.replace(/^lang_/g, ''), dv); + + // Is number + if (/^[0-9\-.]+$/g.test(v)) + return parseInt(v); + + return v; + }, + + isInstance : function(o) { + return o != null && typeof(o) == "object" && o.execCommand; + }, + + triggerNodeChange : function() { + EditorManager.activeEditor.nodeChanged(); + }, + + regexpReplace : function(in_str, reg_exp, replace_str, opts) { + var re; + + if (in_str == null) + return in_str; + + if (typeof(opts) == "undefined") + opts = 'g'; + + re = new RegExp(reg_exp, opts); + + return in_str.replace(re, replace_str); + }, + + trim : function(s) { + return tinymce.trim(s); + }, + + xmlEncode : function(s) { + return tinymce.DOM.encode(s); + }, + + explode : function(s, d) { + var o = []; + + tinymce.each(s.split(d), function(v) { + if (v != '') + o.push(v); + }); + + return o; + }, + + switchClass : function(id, cls) { + var b; + + if (/^mceButton/.test(cls)) { + b = EditorManager.activeEditor.controlManager.get(id); + + if (!b) + return; + + switch (cls) { + case "mceButtonNormal": + b.setDisabled(false); + b.setActive(false); + return; + + case "mceButtonDisabled": + b.setDisabled(true); + return; + + case "mceButtonSelected": + b.setActive(true); + b.setDisabled(false); + return; + } + } + }, + + addCSSClass : function(e, n, b) { + return tinymce.DOM.addClass(e, n, b); + }, + + hasCSSClass : function(e, n) { + return tinymce.DOM.hasClass(e, n); + }, + + removeCSSClass : function(e, n) { + return tinymce.DOM.removeClass(e, n); + }, + + getCSSClasses : function() { + var cl = EditorManager.activeEditor.dom.getClasses(), o = []; + + each(cl, function(c) { + o.push(c['class']); + }); + + return o; + }, + + setWindowArg : function(n, v) { + EditorManager.activeEditor.windowManager.params[n] = v; + }, + + getWindowArg : function(n, dv) { + var wm = EditorManager.activeEditor.windowManager, v; + + v = wm.getParam(n); + if (v === '') + return ''; + + return v || wm.getFeature(n) || dv; + }, + + getParentNode : function(n, f) { + return this._getDOM().getParent(n, f); + }, + + selectElements : function(n, na, f) { + var i, a = [], nl, x; + + for (x=0, na = na.split(','); x<na.length; x++) + for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++) + (!f || f(nl[i])) && a.push(nl[i]); + + return a; + }, + + getNodeTree : function(n, na, t, nn) { + return this.selectNodes(n, function(n) { + return (!t || n.nodeType == t) && (!nn || n.nodeName == nn); + }, na ? na : []); + }, + + getAttrib : function(e, n, dv) { + return this._getDOM().getAttrib(e, n, dv); + }, + + setAttrib : function(e, n, v) { + return this._getDOM().setAttrib(e, n, v); + }, + + getElementsByAttributeValue : function(n, e, a, v) { + var i, nl = n.getElementsByTagName(e), o = []; + + for (i=0; i<nl.length; i++) { + if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1) + o[o.length] = nl[i]; + } + + return o; + }, + + selectNodes : function(n, f, a) { + var i; + + if (!a) + a = []; + + if (f(n)) + a[a.length] = n; + + if (n.hasChildNodes()) { + for (i=0; i<n.childNodes.length; i++) + tinyMCE.selectNodes(n.childNodes[i], f, a); + } + + return a; + }, + + getContent : function() { + return EditorManager.activeEditor.getContent(); + }, + + getParentElement : function(n, na, f) { + if (na) + na = new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$', 'g'); + + return this._getDOM().getParent(n, function(n) { + return n.nodeType == 1 && (!na || na.test(n.nodeName)) && (!f || f(n)); + }, this.activeEditor.getBody()); + }, + + importPluginLanguagePack : function(n) { + tinymce.PluginManager.requireLangPack(n); + }, + + getButtonHTML : function(cn, lang, img, c, u, v) { + var ed = EditorManager.activeEditor; + + img = img.replace(/\{\$pluginurl\}/g, tinyMCE.pluginURL); + img = img.replace(/\{\$themeurl\}/g, tinyMCE.themeURL); + lang = lang.replace(/^lang_/g, ''); + + return ed.controlManager.createButton(cn, { + title : lang, + command : c, + ui : u, + value : v, + scope : this, + 'class' : 'compat', + image : img + }); + }, + + addSelectAccessibility : function(e, s, w) { + // Add event handlers + if (!s._isAccessible) { + s.onkeydown = tinyMCE.accessibleEventHandler; + s.onblur = tinyMCE.accessibleEventHandler; + s._isAccessible = true; + s._win = w; + } + + return false; + }, + + accessibleEventHandler : function(e) { + var elm, win = this._win; + + e = tinymce.isIE ? win.event : e; + elm = tinymce.isIE ? e.srcElement : e.target; + + // Unpiggyback onchange on blur + if (e.type == "blur") { + if (elm.oldonchange) { + elm.onchange = elm.oldonchange; + elm.oldonchange = null; + } + + return true; + } + + // Piggyback onchange + if (elm.nodeName == "SELECT" && !elm.oldonchange) { + elm.oldonchange = elm.onchange; + elm.onchange = null; + } + + // Execute onchange and remove piggyback + if (e.keyCode == 13 || e.keyCode == 32) { + elm.onchange = elm.oldonchange; + elm.onchange(); + elm.oldonchange = null; + + tinyMCE.cancelEvent(e); + return false; + } + + return true; + }, + + cancelEvent : function(e) { + return tinymce.dom.Event.cancel(e); + }, + + handleVisualAid : function(e) { + EditorManager.activeEditor.addVisual(e); + }, + + getAbsPosition : function(n, r) { + return tinymce.DOM.getPos(n, r); + }, + + cleanupEventStr : function(s) { + s = "" + s; + s = s.replace('function anonymous()\n{\n', ''); + s = s.replace('\n}', ''); + s = s.replace(/^return true;/gi, ''); // Remove event blocker + + return s; + }, + + getVisualAidClass : function(s) { + // TODO: Implement + return s; + }, + + parseStyle : function(s) { + return this._getDOM().parseStyle(s); + }, + + serializeStyle : function(s) { + return this._getDOM().serializeStyle(s); + }, + + openWindow : function(tpl, args) { + var ed = EditorManager.activeEditor, o = {}, n; + + // Convert name/value array to object + for (n in tpl) + o[n] = tpl[n]; + + tpl = o; + + args = args || {}; + tpl.url = new tinymce.util.URI(tinymce.ThemeManager.themeURLs[ed.settings.theme]).toAbsolute(tpl.file); + tpl.inline = tpl.inline || args.inline; + + ed.windowManager.open(tpl, args); + }, + + closeWindow : function(win) { + EditorManager.activeEditor.windowManager.close(win); + }, + + getOuterHTML : function(e) { + return tinymce.DOM.getOuterHTML(e); + }, + + setOuterHTML : function(e, h, d) { + return tinymce.DOM.setOuterHTML(e, h, d); + }, + + hasPlugin : function(n) { + return tinymce.PluginManager.get(n) != null; + }, + + _setEventsEnabled : function() { + // Ignore it!! + }, + + addPlugin : function(pn, f) { + var t = this; + + function PluginWrapper(ed) { + tinyMCE.selectedInstance = ed; + + ed.onInit.add(function() { + t.settings = ed.settings; + t.settings['base_href'] = tinyMCE.documentBasePath; + tinyMCE.settings = t.settings; + tinyMCE.documentBasePath = ed.documentBasePath; + //ed.formElement = DOM.get(ed.id); + + if (f.initInstance) + f.initInstance(ed); + + ed.contentDocument = ed.getDoc(); + ed.contentWindow = ed.getWin(); + ed.undoRedo = ed.undoManager; + ed.startContent = ed.getContent({format : 'raw'}); + + tinyMCE.instances[ed.id] = ed; + tinyMCE.loadedFiles = []; + }); + + ed.onActivate.add(function() { + tinyMCE.settings = ed.settings; + tinyMCE.selectedInstance = ed; + }); + + /* if (f.removeInstance) { + ed.onDestroy.add(function() { + return f.removeInstance(ed.id); + }); + }*/ + + if (f.handleNodeChange) { + ed.onNodeChange.add(function(ed, cm, n) { + f.handleNodeChange(ed.id, n, 0, 0, false, !ed.selection.isCollapsed()); + }); + } + + if (f.onChange) { + ed.onChange.add(function(ed, n) { + return f.onChange(ed); + }); + } + + if (f.cleanup) { + ed.onGetContent.add(function() { + //f.cleanup(type, content, inst); + }); + } + + this.getInfo = function() { + return f.getInfo(); + }; + + this.createControl = function(n) { + tinyMCE.pluginURL = tinymce.baseURL + '/plugins/' + pn; + tinyMCE.themeURL = tinymce.baseURL + '/themes/' + tinyMCE.activeEditor.settings.theme; + + if (f.getControlHTML) + return f.getControlHTML(n); + + return null; + }; + + this.execCommand = function(cmd, ui, val) { + if (f.execCommand) + return f.execCommand(ed.id, ed.getBody(), cmd, ui, val); + + return false; + }; + }; + + tinymce.PluginManager.add(pn, PluginWrapper); + }, + + _getDOM : function() { + return tinyMCE.activeEditor ? tinyMCE.activeEditor.dom : tinymce.DOM; + }, + + convertRelativeToAbsoluteURL : function(b, u) { + return new tinymce.util.URI(b).toAbsolute(u); + }, + + convertAbsoluteURLToRelativeURL : function(b, u) { + return new tinymce.util.URI(b).toRelative(u); + } + }); + + // Extend Editor class + tinymce.extend(tinymce.Editor.prototype, { + getFocusElement : function() { + return this.selection.getNode(); + }, + + getData : function(n) { + if (!this.data) + this.data = []; + + if (!this.data[n]) + this.data[n] = []; + + return this.data[n]; + }, + + hasPlugin : function(n) { + return this.plugins[n] != null; + }, + + getContainerWin : function() { + return window; + }, + + getHTML : function(raw) { + return this.getContent({ format : raw ? 'raw' : 'html'}); + }, + + setHTML : function(h) { + this.setContent(h); + }, + + getSel : function() { + return this.selection.getSel(); + }, + + getRng : function() { + return this.selection.getRng(); + }, + + isHidden : function() { + var s; + + if (!tinymce.isGecko) + return false; + + s = this.getSel(); + + // Weird, wheres that cursor selection? + return (!s || !s.rangeCount || s.rangeCount == 0); + }, + + translate : function(s) { + var c = this.settings.language, o; + + if (!s) + return s; + + o = tinymce.EditorManager.i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) { + return tinymce.EditorManager.i18n[c + '.' + b] || '{#' + b + '}'; + }); + + o = o.replace(/{\$lang_([^}]+)\}/g, function(a, b) { + return tinymce.EditorManager.i18n[c + '.' + b] || '{$lang_' + b + '}'; + }); + + return o; + }, + + repaint : function() { + this.execCommand('mceRepaint'); + } + }); + + // Extend selection + tinymce.extend(tinymce.dom.Selection.prototype, { + getSelectedText : function() { + return this.getContent({format : 'text'}); + }, + + getSelectedHTML : function() { + return this.getContent({format : 'html'}); + }, + + getFocusElement : function() { + return this.getNode(); + }, + + selectNode : function(node, collapse, select_text_node, to_start) { + var t = this; + + t.select(node, select_text_node || 0); + + if (!is(collapse)) + collapse = true; + + if (collapse) { + if (!is(to_start)) + to_start = true; + + t.collapse(to_start); + } + } + }); + }).call(this); + + // Register plugin + tinymce.PluginManager.add('compat2x', tinymce.plugins.Compat2x); +})(); + diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/contextmenu/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/contextmenu/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..24ee2eb4a0b60d20c7685e1bba3e5584747ab312 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/contextmenu/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(d){var f=this;f.editor=d;f.onContextMenu=new tinymce.util.Dispatcher(this);d.onContextMenu.add(function(g,h){if(!h.ctrlKey){f._getMenu(g).showMenu(h.clientX,h.clientY);a.add(g.getDoc(),"click",e);a.cancel(h)}});function e(){if(f._menu){f._menu.removeAll();f._menu.destroy();a.remove(d.getDoc(),"click",e)}}d.onMouseDown.add(e);d.onKeyDown.add(e)},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(h){var l=this,f=l._menu,i=h.selection,e=i.isCollapsed(),d=i.getNode()||h.getBody(),g,k,j;if(f){f.removeAll();f.destroy()}k=b.getPos(h.getContentAreaContainer());j=b.getPos(h.getContainer());f=h.controlManager.createDropMenu("contextmenu",{offset_x:k.x+h.getParam("contextmenu_offset_x",0),offset_y:k.y+h.getParam("contextmenu_offset_y",0),constrain:1});l._menu=f;f.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(e);f.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(e);f.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((d.nodeName=="A"&&!h.dom.getAttrib(d,"name"))||!e){f.addSeparator();f.add({title:"advanced.link_desc",icon:"link",cmd:h.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}f.addSeparator();f.add({title:"advanced.image_desc",icon:"image",cmd:h.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator();g=f.addMenu({title:"contextmenu.align"});g.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});g.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});g.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});g.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});l.onContextMenu.dispatch(l,f,d,e);return f}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/contextmenu/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/contextmenu/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..a2c1866ba56d00fea8796f57c95dfc03a7340407 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/contextmenu/editor_plugin_src.js @@ -0,0 +1,95 @@ +/** + * $Id: editor_plugin_src.js 848 2008-05-15 11:54:40Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM; + + tinymce.create('tinymce.plugins.ContextMenu', { + init : function(ed) { + var t = this; + + t.editor = ed; + t.onContextMenu = new tinymce.util.Dispatcher(this); + + ed.onContextMenu.add(function(ed, e) { + if (!e.ctrlKey) { + t._getMenu(ed).showMenu(e.clientX, e.clientY); + Event.add(ed.getDoc(), 'click', hide); + Event.cancel(e); + } + }); + + function hide() { + if (t._menu) { + t._menu.removeAll(); + t._menu.destroy(); + Event.remove(ed.getDoc(), 'click', hide); + } + }; + + ed.onMouseDown.add(hide); + ed.onKeyDown.add(hide); + }, + + getInfo : function() { + return { + longname : 'Contextmenu', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + _getMenu : function(ed) { + var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2; + + if (m) { + m.removeAll(); + m.destroy(); + } + + p1 = DOM.getPos(ed.getContentAreaContainer()); + p2 = DOM.getPos(ed.getContainer()); + + m = ed.controlManager.createDropMenu('contextmenu', { + offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0), + offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0), + constrain : 1 + }); + + t._menu = m; + + m.add({title : 'advanced.cut_desc', icon : 'cut', cmd : 'Cut'}).setDisabled(col); + m.add({title : 'advanced.copy_desc', icon : 'copy', cmd : 'Copy'}).setDisabled(col); + m.add({title : 'advanced.paste_desc', icon : 'paste', cmd : 'Paste'}); + + if ((el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) || !col) { + m.addSeparator(); + m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true}); + m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'}); + } + + m.addSeparator(); + m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true}); + + m.addSeparator(); + am = m.addMenu({title : 'contextmenu.align'}); + am.add({title : 'contextmenu.left', icon : 'justifyleft', cmd : 'JustifyLeft'}); + am.add({title : 'contextmenu.center', icon : 'justifycenter', cmd : 'JustifyCenter'}); + am.add({title : 'contextmenu.right', icon : 'justifyright', cmd : 'JustifyRight'}); + am.add({title : 'contextmenu.full', icon : 'justifyfull', cmd : 'JustifyFull'}); + + t.onContextMenu.dispatch(t, m, el, col); + + return m; + } + }); + + // Register plugin + tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/directionality/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/directionality/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..bce8e73995d05c6bdd18f476a595be3e633b9782 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/directionality/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceDirectionLTR",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="ltr"){a.dom.setAttrib(d,"dir","ltr")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addCommand("mceDirectionRTL",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="rtl"){a.dom.setAttrib(d,"dir","rtl")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});a.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});a.onNodeChange.add(c._nodeChange,c)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/directionality/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/directionality/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..81818e37ca211de530a6be0a45b5aac5e0422285 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/directionality/editor_plugin_src.js @@ -0,0 +1,79 @@ +/** + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.Directionality', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + ed.addCommand('mceDirectionLTR', function() { + var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); + + if (e) { + if (ed.dom.getAttrib(e, "dir") != "ltr") + ed.dom.setAttrib(e, "dir", "ltr"); + else + ed.dom.setAttrib(e, "dir", ""); + } + + ed.nodeChanged(); + }); + + ed.addCommand('mceDirectionRTL', function() { + var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); + + if (e) { + if (ed.dom.getAttrib(e, "dir") != "rtl") + ed.dom.setAttrib(e, "dir", "rtl"); + else + ed.dom.setAttrib(e, "dir", ""); + } + + ed.nodeChanged(); + }); + + ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); + ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'}); + + ed.onNodeChange.add(t._nodeChange, t); + }, + + getInfo : function() { + return { + longname : 'Directionality', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _nodeChange : function(ed, cm, n) { + var dom = ed.dom, dir; + + n = dom.getParent(n, dom.isBlock); + if (!n) { + cm.setDisabled('ltr', 1); + cm.setDisabled('rtl', 1); + return; + } + + dir = dom.getAttrib(n, 'dir'); + cm.setActive('ltr', dir == "ltr"); + cm.setDisabled('ltr', 0); + cm.setActive('rtl', dir == "rtl"); + cm.setDisabled('rtl', 0); + } + }); + + // Register plugin + tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..4783bc371677400b356f6a29622c9aafdd4497cd --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.EmotionsPlugin",{init:function(a,b){a.addCommand("mceEmotion",function(){a.windowManager.open({file:b+"/emotions.htm",width:250+parseInt(a.getLang("emotions.delta_width",0)),height:160+parseInt(a.getLang("emotions.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("emotions",{title:"emotions.emotions_desc",cmd:"mceEmotion"})},getInfo:function(){return{longname:"Emotions",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("emotions",tinymce.plugins.EmotionsPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..df0d370aeab690245bf03bb35623dd7b180720d0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/editor_plugin_src.js @@ -0,0 +1,40 @@ +/** + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.EmotionsPlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceEmotion', function() { + ed.windowManager.open({ + file : url + '/emotions.htm', + width : 250 + parseInt(ed.getLang('emotions.delta_width', 0)), + height : 160 + parseInt(ed.getLang('emotions.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('emotions', {title : 'emotions.emotions_desc', cmd : 'mceEmotion'}); + }, + + getInfo : function() { + return { + longname : 'Emotions', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/emotions.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/emotions.htm new file mode 100644 index 0000000000000000000000000000000000000000..55a1d72fa7f87cf051eaf6e45e4a00af8578a609 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/emotions.htm @@ -0,0 +1,40 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#emotions_dlg.title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/emotions.js"></script> +</head> +<body style="display: none"> + <div align="center"> + <div class="title">{#emotions_dlg.title}:<br /><br /></div> + + <table border="0" cellspacing="0" cellpadding="4"> + <tr> + <td><a href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}" title="{#emotions_dlg.cool}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}" title="{#emotions_dlg.cry}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}" title="{#emotions_dlg.embarassed}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}" title="{#emotions_dlg.foot_in_mouth}" /></a></td> + </tr> + <tr> + <td><a href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}" title="{#emotions_dlg.frown}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}" title="{#emotions_dlg.innocent}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}" title="{#emotions_dlg.kiss}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}" title="{#emotions_dlg.laughing}" /></a></td> + </tr> + <tr> + <td><a href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}" title="{#emotions_dlg.money_mouth}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}" title="{#emotions_dlg.sealed}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}" title="{#emotions_dlg.smile}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}" title="{#emotions_dlg.surprised}" /></a></td> + </tr> + <tr> + <td><a href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}" title="{#emotions_dlg.tongue_out}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}" title="{#emotions_dlg.undecided}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}" title="{#emotions_dlg.wink}" /></a></td> + <td><a href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}" title="{#emotions_dlg.yell}" /></a></td> + </tr> + </table> + </div> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-cool.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-cool.gif new file mode 100644 index 0000000000000000000000000000000000000000..ba90cc36fb0415d0273d1cd206bff63fd9c91fde Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-cool.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-cry.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-cry.gif new file mode 100644 index 0000000000000000000000000000000000000000..74d897a4f6d22e814e2b054e98b8a75fb464b4be Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-cry.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-embarassed.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-embarassed.gif new file mode 100644 index 0000000000000000000000000000000000000000..963a96b8a7593b1d8bcbab073abe5ee4e539dbf6 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-embarassed.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif new file mode 100644 index 0000000000000000000000000000000000000000..16f68cc1e91a9b8ec6cfa0ba4e0c86f94b177f1a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-frown.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-frown.gif new file mode 100644 index 0000000000000000000000000000000000000000..716f55e161bfebb1c3d34f0b0f40c177fc82c30b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-frown.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-innocent.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-innocent.gif new file mode 100644 index 0000000000000000000000000000000000000000..334d49e0e60f2997c9ba24071764f95d9e08a5cc Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-innocent.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-kiss.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-kiss.gif new file mode 100644 index 0000000000000000000000000000000000000000..4efd549ed31c44b1faac17ed34bb67abeb42baf8 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-kiss.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-laughing.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-laughing.gif new file mode 100644 index 0000000000000000000000000000000000000000..1606c119e75678c4031f384e0d50849906e8f533 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-laughing.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif new file mode 100644 index 0000000000000000000000000000000000000000..ca2451e102722e12e131ae53ea76989acbf191e2 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-sealed.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-sealed.gif new file mode 100644 index 0000000000000000000000000000000000000000..b33d3cca1e7b8e62dc689880074d5c61f619520d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-sealed.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-smile.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-smile.gif new file mode 100644 index 0000000000000000000000000000000000000000..e6a9e60d5ddd1243fbbf2197b4dc6cd9c1b58b93 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-smile.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-surprised.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-surprised.gif new file mode 100644 index 0000000000000000000000000000000000000000..cb99cdd9136fa30462a9f57aa6a0adeb7e4124e7 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-surprised.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif new file mode 100644 index 0000000000000000000000000000000000000000..2075dc16058f1f17912167675ce5cfb9986fc71d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-undecided.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-undecided.gif new file mode 100644 index 0000000000000000000000000000000000000000..bef7e257303f8243c89787e7a7f9955dd1f112e2 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-undecided.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-wink.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-wink.gif new file mode 100644 index 0000000000000000000000000000000000000000..9faf1aff8f4b28e02f4f414975fe1859c43b6b54 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-wink.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-yell.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-yell.gif new file mode 100644 index 0000000000000000000000000000000000000000..648e6e879123fe49beebbc1f3635141864a79a9c Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/img/smiley-yell.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/js/emotions.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/js/emotions.js new file mode 100644 index 0000000000000000000000000000000000000000..c549367096fc801fa12cb6f61261a12f4fd9ed17 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/js/emotions.js @@ -0,0 +1,22 @@ +tinyMCEPopup.requireLangPack(); + +var EmotionsDialog = { + init : function(ed) { + tinyMCEPopup.resizeToInnerSize(); + }, + + insert : function(file, title) { + var ed = tinyMCEPopup.editor, dom = ed.dom; + + tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', { + src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file, + alt : ed.getLang(title), + title : ed.getLang(title), + border : 0 + })); + + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..3b57ad9e3ca69893c19fd560174653b33725671e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/emotions/langs/en_dlg.js @@ -0,0 +1,20 @@ +tinyMCE.addI18n('en.emotions_dlg',{ +title:"Insert emotion", +desc:"Emotions", +cool:"Cool", +cry:"Cry", +embarassed:"Embarassed", +foot_in_mouth:"Foot in mouth", +frown:"Frown", +innocent:"Innocent", +kiss:"Kiss", +laughing:"Laughing", +money_mouth:"Money mouth", +sealed:"Sealed", +smile:"Smile", +surprised:"Surprised", +tongue_out:"Tongue out", +undecided:"Undecided", +wink:"Wink", +yell:"Yell" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/dialog.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/dialog.htm new file mode 100644 index 0000000000000000000000000000000000000000..b4c62840ea682ccd1dff023a6576a6a62999881d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/dialog.htm @@ -0,0 +1,27 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#example_dlg.title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/dialog.js"></script> +</head> +<body> + +<form onsubmit="ExampleDialog.insert();return false;" action="#"> + <p>Here is a example dialog.</p> + <p>Selected text: <input id="someval" name="someval" type="text" class="text" /></p> + <p>Custom arg: <input id="somearg" name="somearg" type="text" class="text" /></p> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="button" id="insert" name="insert" value="{#insert}" onclick="ExampleDialog.insert();" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..ec1f81ea401789fdf00662a930eadb7d677e4112 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.PluginManager.requireLangPack("example");tinymce.create("tinymce.plugins.ExamplePlugin",{init:function(a,b){a.addCommand("mceExample",function(){a.windowManager.open({file:b+"/dialog.htm",width:320+parseInt(a.getLang("example.delta_width",0)),height:120+parseInt(a.getLang("example.delta_height",0)),inline:1},{plugin_url:b,some_custom_arg:"custom arg"})});a.addButton("example",{title:"example.desc",cmd:"mceExample",image:b+"/img/example.gif"});a.onNodeChange.add(function(d,c,e){c.setActive("example",e.nodeName=="IMG")})},createControl:function(b,a){return null},getInfo:function(){return{longname:"Example plugin",author:"Some author",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example",version:"1.0"}}});tinymce.PluginManager.add("example",tinymce.plugins.ExamplePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..50505504dd674af8e62c78404a0c2932d7e9f5e0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/editor_plugin_src.js @@ -0,0 +1,81 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + // Load plugin specific language pack + tinymce.PluginManager.requireLangPack('example'); + + tinymce.create('tinymce.plugins.ExamplePlugin', { + /** + * Initializes the plugin, this will be executed after the plugin has been created. + * This call is done before the editor instance has finished it's initialization so use the onInit event + * of the editor instance to intercept that event. + * + * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. + * @param {string} url Absolute URL to where the plugin is located. + */ + init : function(ed, url) { + // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); + ed.addCommand('mceExample', function() { + ed.windowManager.open({ + file : url + '/dialog.htm', + width : 320 + parseInt(ed.getLang('example.delta_width', 0)), + height : 120 + parseInt(ed.getLang('example.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, // Plugin absolute URL + some_custom_arg : 'custom arg' // Custom argument + }); + }); + + // Register example button + ed.addButton('example', { + title : 'example.desc', + cmd : 'mceExample', + image : url + '/img/example.gif' + }); + + // Add a node change handler, selects the button in the UI when a image is selected + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('example', n.nodeName == 'IMG'); + }); + }, + + /** + * Creates control instances based in the incomming name. This method is normally not + * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons + * but you sometimes need to create more complex controls like listboxes, split buttons etc then this + * method can be used to create those. + * + * @param {String} n Name of the control to create. + * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control. + * @return {tinymce.ui.Control} New control instance or null if no control was created. + */ + createControl : function(n, cm) { + return null; + }, + + /** + * Returns information about the plugin as a name/value array. + * The current keys are longname, author, authorurl, infourl and version. + * + * @return {Object} Name/value array containing information about the plugin. + */ + getInfo : function() { + return { + longname : 'Example plugin', + author : 'Some author', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example', + version : "1.0" + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/img/example.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/img/example.gif new file mode 100644 index 0000000000000000000000000000000000000000..1ab5da4461113d2af579898528246fdbe52ecd00 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/img/example.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/js/dialog.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/js/dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..fa8341132fa02560f2488b6a37ba9fbc57c90832 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/js/dialog.js @@ -0,0 +1,19 @@ +tinyMCEPopup.requireLangPack(); + +var ExampleDialog = { + init : function() { + var f = document.forms[0]; + + // Get the selected contents as text and place it in the input + f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'}); + f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg'); + }, + + insert : function() { + // Insert the contents from the input into the document + tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value); + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/langs/en.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/langs/en.js new file mode 100644 index 0000000000000000000000000000000000000000..e0784f80f4b8ad5f24c99d40c5fbfc853974fda9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/langs/en.js @@ -0,0 +1,3 @@ +tinyMCE.addI18n('en.example',{ + desc : 'This is just a template button' +}); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..ebcf948dac378f663294bd0d6cb36b7f4279e8ad --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/example/langs/en_dlg.js @@ -0,0 +1,3 @@ +tinyMCE.addI18n('en.example_dlg',{ + title : 'This is just a example title' +}); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/css/fullpage.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/css/fullpage.css new file mode 100644 index 0000000000000000000000000000000000000000..7a3334f08d0bdc7da68f0368ce183661dde6f468 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/css/fullpage.css @@ -0,0 +1,182 @@ +/* Hide the advanced tab */ +#advanced_tab { + display: none; +} + +#metatitle, #metakeywords, #metadescription, #metaauthor, #metacopyright { + width: 280px; +} + +#doctype, #docencoding { + width: 200px; +} + +#langcode { + width: 30px; +} + +#bgimage { + width: 220px; +} + +#fontface { + width: 240px; +} + +#leftmargin, #rightmargin, #topmargin, #bottommargin { + width: 50px; +} + +.panel_wrapper div.current { + height: 400px; +} + +#stylesheet, #style { + width: 240px; +} + +/* Head list classes */ + +.headlistwrapper { + width: 100%; +} + +.addbutton, .removebutton, .moveupbutton, .movedownbutton { + border-top: 1px solid; + border-left: 1px solid; + border-bottom: 1px solid; + border-right: 1px solid; + border-color: #F0F0EE; + cursor: default; + display: block; + width: 20px; + height: 20px; +} + +#doctypes { + width: 200px; +} + +.addbutton:hover, .removebutton:hover, .moveupbutton:hover, .movedownbutton:hover { + border: 1px solid #0A246A; + background-color: #B6BDD2; +} + +.addbutton { + background-image: url('../images/add.gif'); + float: left; + margin-right: 3px; +} + +.removebutton { + background-image: url('../images/remove.gif'); + float: left; +} + +.moveupbutton { + background-image: url('../images/move_up.gif'); + float: left; + margin-right: 3px; +} + +.movedownbutton { + background-image: url('../images/move_down.gif'); + float: left; +} + +.selected { + border: 1px solid #0A246A; + background-color: #B6BDD2; +} + +.toolbar { + width: 100%; +} + +#headlist { + width: 100%; + margin-top: 3px; + font-size: 11px; +} + +#info, #title_element, #meta_element, #script_element, #style_element, #base_element, #link_element, #comment_element, #unknown_element { + display: none; +} + +#addmenu { + position: absolute; + border: 1px solid gray; + display: none; + z-index: 100; + background-color: white; +} + +#addmenu a { + display: block; + width: 100%; + line-height: 20px; + text-decoration: none; + background-color: white; +} + +#addmenu a:hover { + background-color: #B6BDD2; + color: black; +} + +#addmenu span { + padding-left: 10px; + padding-right: 10px; +} + +#updateElementPanel { + display: none; +} + +#script_element .panel_wrapper div.current { + height: 108px; +} + +#style_element .panel_wrapper div.current { + height: 108px; +} + +#link_element .panel_wrapper div.current { + height: 140px; +} + +#element_script_value { + width: 100%; + height: 100px; +} + +#element_comment_value { + width: 100%; + height: 120px; +} + +#element_style_value { + width: 100%; + height: 100px; +} + +#element_title, #element_script_src, #element_meta_name, #element_meta_content, #element_base_href, #element_link_href, #element_link_title { + width: 250px; +} + +.updateElementButton { + margin-top: 3px; +} + +/* MSIE specific styles */ + +* html .addbutton, * html .removebutton, * html .moveupbutton, * html .movedownbutton { + width: 22px; + height: 22px; +} + +textarea { + height: 55px; +} + +.panel_wrapper div.current {height:420px;} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..8e11bfc47445e8ee9859fc99c237abdc7569b924 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceFullPageProperties",function(){a.windowManager.open({file:b+"/fullpage.htm",width:430+parseInt(a.getLang("fullpage.delta_width",0)),height:495+parseInt(a.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:b,head_html:c.head})});a.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});a.onBeforeSetContent.add(c._setContent,c);a.onSetContent.add(c._setBodyAttribs,c);a.onGetContent.add(c._getContent,c)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_setBodyAttribs:function(d,a){var l,c,e,g,b,h,j,f=this.head.match(/body(.*?)>/i);if(f&&f[1]){l=f[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(l){for(c=0,e=l.length;c<e;c++){g=l[c].split("=");b=g[0].replace(/\s/,"");h=g[1];if(h){h=h.replace(/^\s+/,"").replace(/\s+$/,"");j=h.match(/^["'](.*)["']$/);if(j){h=j[1]}}else{h=b}d.dom.setAttrib(d.getBody(),"style",h)}}}},_createSerializer:function(){return new tinymce.dom.Serializer({dom:this.editor.dom,apply_source_formatting:true})},_setContent:function(d,b){var h=this,a,j,f=b.content,g,i="";if(b.source_view&&d.getParam("fullpage_hide_in_source_view")){return}f=f.replace(/<(\/?)BODY/gi,"<$1body");a=f.indexOf("<body");if(a!=-1){a=f.indexOf(">",a);h.head=f.substring(0,a+1);j=f.indexOf("</body",a);if(j==-1){j=f.indexOf("</body",j)}b.content=f.substring(a+1,j);h.foot=f.substring(j);function e(c){return c.replace(/<\/?[A-Z]+/g,function(k){return k.toLowerCase()})}h.head=e(h.head);h.foot=e(h.foot)}else{h.head="";if(d.getParam("fullpage_default_xml_pi")){h.head+='<?xml version="1.0" encoding="'+d.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}h.head+=d.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');h.head+="\n<html>\n<head>\n<title>"+d.getParam("fullpage_default_title","Untitled document")+"</title>\n";if(g=d.getParam("fullpage_default_encoding")){h.head+='<meta http-equiv="Content-Type" content="'+g+'" />\n'}if(g=d.getParam("fullpage_default_font_family")){i+="font-family: "+g+";"}if(g=d.getParam("fullpage_default_font_size")){i+="font-size: "+g+";"}if(g=d.getParam("fullpage_default_text_color")){i+="color: "+g+";"}h.head+="</head>\n<body"+(i?' style="'+i+'"':"")+">\n";h.foot="\n</body>\n</html>"}},_getContent:function(a,c){var b=this;if(!c.source_view||!a.getParam("fullpage_hide_in_source_view")){c.content=tinymce.trim(b.head)+"\n"+tinymce.trim(c.content)+"\n"+tinymce.trim(b.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..c7d5aca367451463121aacc8301197b85bae77fe --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/editor_plugin_src.js @@ -0,0 +1,146 @@ +/** + * $Id: editor_plugin_src.js 1029 2009-02-24 22:32:21Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.FullPagePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceFullPageProperties', function() { + ed.windowManager.open({ + file : url + '/fullpage.htm', + width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)), + height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + head_html : t.head + }); + }); + + // Register buttons + ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'}); + + ed.onBeforeSetContent.add(t._setContent, t); + ed.onSetContent.add(t._setBodyAttribs, t); + ed.onGetContent.add(t._getContent, t); + }, + + getInfo : function() { + return { + longname : 'Fullpage', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + _setBodyAttribs : function(ed, o) { + var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i); + + if (attr && attr[1]) { + bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g); + + if (bdattr) { + for(i = 0, len = bdattr.length; i < len; i++) { + kv = bdattr[i].split('='); + k = kv[0].replace(/\s/,''); + v = kv[1]; + + if (v) { + v = v.replace(/^\s+/,'').replace(/\s+$/,''); + t = v.match(/^["'](.*)["']$/); + + if (t) + v = t[1]; + } else + v = k; + + ed.dom.setAttrib(ed.getBody(), 'style', v); + } + } + } + }, + + _createSerializer : function() { + return new tinymce.dom.Serializer({ + dom : this.editor.dom, + apply_source_formatting : true + }); + }, + + _setContent : function(ed, o) { + var t = this, sp, ep, c = o.content, v, st = ''; + + if (o.source_view && ed.getParam('fullpage_hide_in_source_view')) + return; + + // Parse out head, body and footer + c = c.replace(/<(\/?)BODY/gi, '<$1body'); + sp = c.indexOf('<body'); + + if (sp != -1) { + sp = c.indexOf('>', sp); + t.head = c.substring(0, sp + 1); + + ep = c.indexOf('</body', sp); + if (ep == -1) + ep = c.indexOf('</body', ep); + + o.content = c.substring(sp + 1, ep); + t.foot = c.substring(ep); + + function low(s) { + return s.replace(/<\/?[A-Z]+/g, function(a) { + return a.toLowerCase(); + }) + }; + + t.head = low(t.head); + t.foot = low(t.foot); + } else { + t.head = ''; + if (ed.getParam('fullpage_default_xml_pi')) + t.head += '<?xml version="1.0" encoding="' + ed.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n'; + + t.head += ed.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'); + t.head += '\n<html>\n<head>\n<title>' + ed.getParam('fullpage_default_title', 'Untitled document') + '</title>\n'; + + if (v = ed.getParam('fullpage_default_encoding')) + t.head += '<meta http-equiv="Content-Type" content="' + v + '" />\n'; + + if (v = ed.getParam('fullpage_default_font_family')) + st += 'font-family: ' + v + ';'; + + if (v = ed.getParam('fullpage_default_font_size')) + st += 'font-size: ' + v + ';'; + + if (v = ed.getParam('fullpage_default_text_color')) + st += 'color: ' + v + ';'; + + t.head += '</head>\n<body' + (st ? ' style="' + st + '"' : '') + '>\n'; + t.foot = '\n</body>\n</html>'; + } + }, + + _getContent : function(ed, o) { + var t = this; + + if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view')) + o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot); + } + }); + + // Register plugin + tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/fullpage.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/fullpage.htm new file mode 100644 index 0000000000000000000000000000000000000000..3ea40810ab7d95e9d0532aa3324a172bc298de51 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/fullpage.htm @@ -0,0 +1,576 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#fullpage_dlg.title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="js/fullpage.js"></script> + <link href="css/fullpage.css" rel="stylesheet" type="text/css" /> +</head> +<body id="advlink" style="display: none"> + <form onsubmit="updateAction();return false;" name="fullpage" action="#"> + <div class="tabs"> + <ul> + <li id="meta_tab" class="current"><span><a href="javascript:mcTabs.displayTab('meta_tab','meta_panel');" onmousedown="return false;">{#fullpage_dlg.meta_tab}</a></span></li> + <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#fullpage_dlg.appearance_tab}</a></span></li> + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_tab}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="meta_panel" class="panel current"> + <fieldset> + <legend>{#fullpage_dlg.meta_props}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="nowrap"><label for="metatitle">{#fullpage_dlg.meta_title}</label> </td> + <td><input type="text" id="metatitle" name="metatitle" value="" class="mceFocus" /></td> + </tr> + <tr> + <td class="nowrap"><label for="metakeywords">{#fullpage_dlg.meta_keywords}</label> </td> + <td><textarea id="metakeywords" name="metakeywords" rows="4"></textarea></td> + </tr> + <tr> + <td class="nowrap"><label for="metadescription">{#fullpage_dlg.meta_description}</label> </td> + <td><textarea id="metadescription" name="metadescription" rows="4"></textarea></td> + </tr> + <tr> + <td class="nowrap"><label for="metaauthor">{#fullpage_dlg.author}</label> </td> + <td><input type="text" id="metaauthor" name="metaauthor" value="" /></td> + </tr> + <tr> + <td class="nowrap"><label for="metacopyright">{#fullpage_dlg.copyright}</label> </td> + <td><input type="text" id="metacopyright" name="metacopyright" value="" /></td> + </tr> + <tr> + <td class="nowrap"><label for="metarobots">{#fullpage_dlg.meta_robots}</label> </td> + <td> + <select id="metarobots" name="metarobots"> + <option value="">{#not_set}</option> + <option value="index,follow">{#fullpage_dlg.meta_index_follow}</option> + <option value="index,nofollow">{#fullpage_dlg.meta_index_nofollow}</option> + <option value="noindex,follow">{#fullpage_dlg.meta_noindex_follow}</option> + <option value="noindex,nofollow">{#fullpage_dlg.meta_noindex_nofollow}</option> + </select> + </td> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>{#fullpage_dlg.langprops}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="docencoding">{#fullpage_dlg.encoding}</label></td> + <td> + <select id="docencoding" name="docencoding"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + <tr> + <td class="nowrap"><label for="doctypes">{#fullpage_dlg.doctypes}</label> </td> + <td> + <select id="doctypes" name="doctypes"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + <tr> + <td class="nowrap"><label for="langcode">{#fullpage_dlg.langcode}</label> </td> + <td><input type="text" id="langcode" name="langcode" value="" /></td> + </tr> + <tr> + <td class="column1"><label for="langdir">{#fullpage_dlg.langdir}</label></td> + <td> + <select id="langdir" name="langdir"> + <option value="">{#not_set}</option> + <option value="ltr">{#fullpage_dlg.ltr}</option> + <option value="rtl">{#fullpage_dlg.rtl}</option> + </select> + </td> + </tr> + <tr> + <td class="nowrap"><label for="xml_pi">{#fullpage_dlg.xml_pi}</label> </td> + <td><input type="checkbox" id="xml_pi" name="xml_pi" class="checkbox" /></td> + </tr> + </table> + </fieldset> + </div> + + <div id="appearance_panel" class="panel"> + <fieldset> + <legend>{#fullpage_dlg.appearance_textprops}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="fontface">{#fullpage_dlg.fontface}</label></td> + <td> + <select id="fontface" name="fontface" onchange="changedStyleField(this);"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + + <tr> + <td class="column1"><label for="fontsize">{#fullpage_dlg.fontsize}</label></td> + <td> + <select id="fontsize" name="fontsize" onchange="changedStyleField(this);"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + + <tr> + <td class="column1"><label for="textcolor">{#fullpage_dlg.textcolor}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');changedStyleField(this);" /></td> + <td id="textcolor_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>{#fullpage_dlg.appearance_bgprops}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="bgimage">{#fullpage_dlg.bgimage}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="bgimage" name="bgimage" type="text" value="" onchange="changedStyleField(this);" /></td> + <td id="bgimage_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + <tr> + <td class="column1"><label for="bgcolor">{#fullpage_dlg.bgcolor}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedStyleField(this);" /></td> + <td id="bgcolor_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>{#fullpage_dlg.appearance_marginprops}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="leftmargin">{#fullpage_dlg.left_margin}</label></td> + <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="changedStyleField(this);" /></td> + <td class="column1"><label for="rightmargin">{#fullpage_dlg.right_margin}</label></td> + <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="changedStyleField(this);" /></td> + </tr> + <tr> + <td class="column1"><label for="topmargin">{#fullpage_dlg.top_margin}</label></td> + <td><input id="topmargin" name="topmargin" type="text" value="" onchange="changedStyleField(this);" /></td> + <td class="column1"><label for="bottommargin">{#fullpage_dlg.bottom_margin}</label></td> + <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="changedStyleField(this);" /></td> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>{#fullpage_dlg.appearance_linkprops}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="link_color">{#fullpage_dlg.link_color}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');changedStyleField(this);" /></td> + <td id="link_color_pickcontainer"> </td> + </tr> + </table> + </td> + + <td class="column1"><label for="visited_color">{#fullpage_dlg.visited_color}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');changedStyleField(this);" /></td> + <td id="visited_color_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td class="column1"><label for="active_color">{#fullpage_dlg.active_color}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');changedStyleField(this);" /></td> + <td id="active_color_pickcontainer"> </td> + </tr> + </table> + </td> + + <td> </td> + <td> </td> + +<!-- <td class="column1"><label for="hover_color">{#fullpage_dlg.hover_color}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="hover_color" name="hover_color" type="text" value="" size="9" onchange="changedStyleField(this);" /></td> + <td id="hover_color_pickcontainer"> </td> + </tr> + </table> + </td> --> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>{#fullpage_dlg.appearance_style}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="stylesheet">{#fullpage_dlg.stylesheet}</label></td> + <td><table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="stylesheet" name="stylesheet" type="text" value="" /></td> + <td id="stylesheet_browsercontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td class="column1"><label for="style">{#fullpage_dlg.style}</label></td> + <td><input id="style" name="style" type="text" value="" onchange="changedStyleField(this);" /></td> + </tr> + </table> + </fieldset> + </div> + + <div id="advanced_panel" class="panel"> + <div id="addmenu"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr><td><a href="javascript:addHeadElm('title');" onmousedown="return false;"><span>{#fullpage_dlg.add_title}</span></a></td></tr> + <tr><td><a href="javascript:addHeadElm('meta');" onmousedown="return false;"><span>{#fullpage_dlg.add_meta}</span></a></td></tr> + <tr><td><a href="javascript:addHeadElm('script');" onmousedown="return false;"><span>{#fullpage_dlg.add_script}</span></a></td></tr> + <tr><td><a href="javascript:addHeadElm('style');" onmousedown="return false;"><span>{#fullpage_dlg.add_style}</span></a></td></tr> + <tr><td><a href="javascript:addHeadElm('link');" onmousedown="return false;"><span>{#fullpage_dlg.add_link}</span></a></td></tr> + <tr><td><a href="javascript:addHeadElm('base');" onmousedown="return false;"><span>{#fullpage_dlg.add_base}</span></a></td></tr> + <tr><td><a href="javascript:addHeadElm('comment');" onmousedown="return false;"><span>{#fullpage_dlg.add_comment}</span></a></td></tr> + </table> + </div> + + <fieldset> + <legend>{#fullpage_dlg.head_elements}</legend> + + <div class="headlistwrapper"> + <div class="toolbar"> + <div style="float: left"> + <a id="addbutton" href="javascript:showAddMenu();" onmousedown="return false;" class="addbutton" title="{#fullpage_dlg.add}"></a> + <a href="#" onmousedown="return false;" class="removebutton" title="{#fullpage_dlg.remove}"></a> + </div> + <div style="float: right"> + <a href="#" onmousedown="return false;" class="moveupbutton" title="{#fullpage_dlg.moveup}"></a> + <a href="#" onmousedown="return false;" class="movedownbutton" title="{#fullpage_dlg.movedown}"></a> + </div> + <br style="clear: both" /> + </div> + <select id="headlist" size="26" onchange="updateHeadElm(this.options[this.selectedIndex].value);"> + <option value="title_0"><title>Some title bla bla bla</title></option> + <option value="meta_1"><meta name="keywords">Some bla bla bla</meta></option> + <option value="meta_2"><meta name="description">Some bla bla bla bla bla bla bla bla bla</meta></option> + <option value="script_3"><script language="javascript">...</script></option> + <option value="style_4"><style>...</style></option> + <option value="base_5"><base href="." /></option> + <option value="comment_6"><!-- ... --></option> + <option value="link_7"><link href="." /></option> + </select> + </div> + </fieldset> + + <fieldset id="meta_element"> + <legend>{#fullpage_dlg.meta_element}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="element_meta_type">{#fullpage_dlg.type}</label></td> + <td><select id="element_meta_type"> + <option value="name">name</option> + <option value="http-equiv">http-equiv</option> + </select></td> + </tr> + <tr> + <td class="column1"><label for="element_meta_name">{#fullpage_dlg.name}</label></td> + <td><input id="element_meta_name" name="element_meta_name" type="text" value="" /></td> + </tr> + <tr> + <td class="column1"><label for="element_meta_content">{#fullpage_dlg.content}</label></td> + <td><input id="element_meta_content" name="element_meta_content" type="text" value="" /></td> + </tr> + </table> + + <input type="button" id="meta_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" /> + </fieldset> + + <fieldset id="title_element"> + <legend>{#fullpage_dlg.title_element}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="element_title">{#fullpage_dlg.meta_title}</label></td> + <td><input id="element_title" name="element_title" type="text" value="" /></td> + </tr> + </table> + + <input type="button" id="title_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" /> + </fieldset> + + <fieldset id="script_element"> + <legend>{#fullpage_dlg.script_element}</legend> + + <div class="tabs"> + <ul> + <li id="script_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('script_props_tab','script_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li> + <li id="script_value_tab"><span><a href="javascript:mcTabs.displayTab('script_value_tab','script_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li> + </ul> + </div> + + <br style="clear: both" /> + + <div class="panel_wrapper"> + <div id="script_props_panel" class="panel current"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="element_script_type">{#fullpage_dlg.type}</label></td> + <td><select id="element_script_type"> + <option value="text/javascript">text/javascript</option> + <option value="text/jscript">text/jscript</option> + <option value="text/vbscript">text/vbscript</option> + <option value="text/vbs">text/vbs</option> + <option value="text/ecmascript">text/ecmascript</option> + <option value="text/xml">text/xml</option> + </select></td> + </tr> + <tr> + <td class="column1"><label for="element_script_src">{#fullpage_dlg.src}</label></td> + <td><table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="element_script_src" name="element_script_src" type="text" value="" /></td> + <td id="script_src_pickcontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td class="column1"><label for="element_script_charset">{#fullpage_dlg.charset}</label></td> + <td><select id="element_script_charset"><option value="">{#not_set}</option></select></td> + </tr> + <tr> + <td class="column1"><label for="element_script_defer">{#fullpage_dlg.defer}</label></td> + <td><input type="checkbox" id="element_script_defer" name="element_script_defer" class="checkbox" /></td> + </tr> + </table> + </div> + + <div id="script_value_panel" class="panel"> + <textarea id="element_script_value"></textarea> + </div> + </div> + + <input type="button" id="script_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" /> + </fieldset> + + <fieldset id="style_element"> + <legend>{#fullpage_dlg.style_element}</legend> + + <div class="tabs"> + <ul> + <li id="style_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('style_props_tab','style_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li> + <li id="style_value_tab"><span><a href="javascript:mcTabs.displayTab('style_value_tab','style_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li> + </ul> + </div> + + <br style="clear: both" /> + + <div class="panel_wrapper"> + <div id="style_props_panel" class="panel current"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="element_style_type">{#fullpage_dlg.type}</label></td> + <td><select id="element_style_type"> + <option value="text/css">text/css</option> + </select></td> + </tr> + <tr> + <td class="column1"><label for="element_style_media">{#fullpage_dlg.media}</label></td> + <td><select id="element_style_media"></select></td> + </tr> + </table> + </div> + + <div id="style_value_panel" class="panel"> + <textarea id="element_style_value"></textarea> + </div> + </div> + + <input type="button" id="style_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" /> + </fieldset> + + <fieldset id="base_element"> + <legend>{#fullpage_dlg.base_element}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="element_base_href">{#fullpage_dlg.href}</label></td> + <td><input id="element_base_href" name="element_base_href" type="text" value="" /></td> + </tr> + <tr> + <td class="column1"><label for="element_base_target">{#fullpage_dlg.target}</label></td> + <td><input id="element_base_target" name="element_base_target" type="text" value="" /></td> + </tr> + </table> + + <input type="button" id="base_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" /> + </fieldset> + + <fieldset id="link_element"> + <legend>{#fullpage_dlg.link_element}</legend> + + <div class="tabs"> + <ul> + <li id="link_general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('link_general_tab','link_general_panel');" onmousedown="return false;">{#fullpage_dlg.general_props}</a></span></li> + <li id="link_advanced_tab"><span><a href="javascript:mcTabs.displayTab('link_advanced_tab','link_advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_props}</a></span></li> + </ul> + </div> + + <br style="clear: both" /> + + <div class="panel_wrapper"> + <div id="link_general_panel" class="panel current"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="element_link_href">{#fullpage_dlg.href}</label></td> + <td><table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="element_link_href" name="element_link_href" type="text" value="" /></td> + <td id="link_href_pickcontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td class="column1"><label for="element_link_title">{#fullpage_dlg.meta_title}</label></td> + <td><input id="element_link_title" name="element_link_title" type="text" value="" /></td> + </tr> + <tr> + <td class="column1"><label for="element_link_type">{#fullpage_dlg.type}</label></td> + <td><select id="element_link_type" name="element_link_type"> + <option value="text/css">text/css</option> + <option value="text/javascript">text/javascript</option> + </select></td> + </tr> + <tr> + <td class="column1"><label for="element_link_media">{#fullpage_dlg.media}</label></td> + <td><select id="element_link_media" name="element_link_media"></select></td> + </tr> + <tr> + <td><label for="element_style_rel">{#fullpage_dlg.rel}</label></td> + <td><select id="element_style_rel" name="element_style_rel"> + <option value="">{#not_set}</option> + <option value="stylesheet">Stylesheet</option> + <option value="alternate">Alternate</option> + <option value="designates">Designates</option> + <option value="start">Start</option> + <option value="next">Next</option> + <option value="prev">Prev</option> + <option value="contents">Contents</option> + <option value="index">Index</option> + <option value="glossary">Glossary</option> + <option value="copyright">Copyright</option> + <option value="chapter">Chapter</option> + <option value="subsection">Subsection</option> + <option value="appendix">Appendix</option> + <option value="help">Help</option> + <option value="bookmark">Bookmark</option> + </select> + </td> + </tr> + </table> + </div> + + <div id="link_advanced_panel" class="panel"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="column1"><label for="element_link_charset">{#fullpage_dlg.charset}</label></td> + <td><select id="element_link_charset"><option value="">{#not_set}</option></select></td> + </tr> + <tr> + <td class="column1"><label for="element_link_hreflang">{#fullpage_dlg.hreflang}</label></td> + <td><input id="element_link_hreflang" name="element_link_hreflang" type="text" value="" /></td> + </tr> + <tr> + <td class="column1"><label for="element_link_target">{#fullpage_dlg.target}</label></td> + <td><input id="element_link_target" name="element_link_target" type="text" value="" /></td> + </tr> + <tr> + <td><label for="element_style_rev">{#fullpage_dlg.rev}</label></td> + <td><select id="element_style_rev" name="element_style_rev"> + <option value="">{#not_set}</option> + <option value="alternate">Alternate</option> + <option value="designates">Designates</option> + <option value="stylesheet">Stylesheet</option> + <option value="start">Start</option> + <option value="next">Next</option> + <option value="prev">Prev</option> + <option value="contents">Contents</option> + <option value="index">Index</option> + <option value="glossary">Glossary</option> + <option value="copyright">Copyright</option> + <option value="chapter">Chapter</option> + <option value="subsection">Subsection</option> + <option value="appendix">Appendix</option> + <option value="help">Help</option> + <option value="bookmark">Bookmark</option> + </select> + </td> + </tr> + </table> + </div> + </div> + + <input type="button" id="link_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" /> + </fieldset> + + <fieldset id="comment_element"> + <legend>{#fullpage_dlg.comment_element}</legend> + + <textarea id="element_comment_value"></textarea> + + <input type="button" id="comment_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" /> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="update" value="{#update}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/js/fullpage.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/js/fullpage.js new file mode 100644 index 0000000000000000000000000000000000000000..89059ef6670a4cbb12cc718ae4c62befebf1ae75 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/js/fullpage.js @@ -0,0 +1,461 @@ +tinyMCEPopup.requireLangPack(); + +var doc; + +var defaultDocTypes = + 'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' + + 'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' + + 'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' + + 'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' + + 'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' + + 'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' + + 'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'; + +var defaultEncodings = + 'Western european (iso-8859-1)=iso-8859-1,' + + 'Central European (iso-8859-2)=iso-8859-2,' + + 'Unicode (UTF-8)=utf-8,' + + 'Chinese traditional (Big5)=big5,' + + 'Cyrillic (iso-8859-5)=iso-8859-5,' + + 'Japanese (iso-2022-jp)=iso-2022-jp,' + + 'Greek (iso-8859-7)=iso-8859-7,' + + 'Korean (iso-2022-kr)=iso-2022-kr,' + + 'ASCII (us-ascii)=us-ascii'; + +var defaultMediaTypes = + 'all=all,' + + 'screen=screen,' + + 'print=print,' + + 'tty=tty,' + + 'tv=tv,' + + 'projection=projection,' + + 'handheld=handheld,' + + 'braille=braille,' + + 'aural=aural'; + +var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings'; +var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px'; + +function init() { + var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style; + + // Setup doctype select box + doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(','); + for (i=0; i<doctypes.length; i++) { + p = doctypes[i].split('='); + + if (p.length > 1) + addSelectValue(f, 'doctypes', p[0], p[1]); + } + + // Setup fonts select box + fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';'); + for (i=0; i<fonts.length; i++) { + p = fonts[i].split('='); + + if (p.length > 1) + addSelectValue(f, 'fontface', p[0], p[1]); + } + + // Setup fontsize select box + fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(','); + for (i=0; i<fonts.length; i++) + addSelectValue(f, 'fontsize', fonts[i], fonts[i]); + + // Setup mediatype select boxs + mediaTypes = ed.getParam("fullpage_media_types", defaultMediaTypes).split(','); + for (i=0; i<mediaTypes.length; i++) { + p = mediaTypes[i].split('='); + + if (p.length > 1) { + addSelectValue(f, 'element_style_media', p[0], p[1]); + addSelectValue(f, 'element_link_media', p[0], p[1]); + } + } + + // Setup encodings select box + encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(','); + for (i=0; i<encodings.length; i++) { + p = encodings[i].split('='); + + if (p.length > 1) { + addSelectValue(f, 'docencoding', p[0], p[1]); + addSelectValue(f, 'element_script_charset', p[0], p[1]); + addSelectValue(f, 'element_link_charset', p[0], p[1]); + } + } + + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color'); + //document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color'); + document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color'); + document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color'); + document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor'); + document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage'); + document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage'); + document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage'); + document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage'); + + // Resize some elements + if (isVisible('stylesheetbrowser')) + document.getElementById('stylesheet').style.width = '220px'; + + if (isVisible('link_href_browser')) + document.getElementById('element_link_href').style.width = '230px'; + + if (isVisible('bgimage_browser')) + document.getElementById('bgimage').style.width = '210px'; + + // Add iframe + dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}}); + doc = dom.get('documentIframe').contentWindow.document; + h = tinyMCEPopup.getWindowArg('head_html'); + + // Preprocess the HTML disable scripts and urls + h = h.replace(/<script>/gi, '<script type="text/javascript">'); + h = h.replace(/type=([\"\'])?/gi, 'type=$1-mce-'); + h = h.replace(/(src=|href=)/g, 'mce_$1'); + + // Write in the content in the iframe + doc.write(h + '</body></html>'); + doc.close(); + + // Parse xml and doctype + xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, h, 1); + xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, h, 1); + docType = getReItem(/<\!DOCTYPE.*?>/gi, h, 0); + f.langcode.value = getReItem(/lang="(.*?)"/gi, h, 1); + + // Parse title + if (e = doc.getElementsByTagName('title')[0]) + el.metatitle.value = e.textContent || e.text; + + // Parse meta + tinymce.each(doc.getElementsByTagName('meta'), function(n) { + var na = (n.getAttribute('name', 2) || '').toLowerCase(), va = n.getAttribute('content', 2), eq = n.getAttribute('httpEquiv', 2) || ''; + + e = el['meta' + na]; + + if (na == 'robots') { + selectByValue(f, 'metarobots', tinymce.trim(va), true, true); + return; + } + + switch (eq.toLowerCase()) { + case "content-type": + tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1); + + // Override XML encoding + if (tmp != "") + xmlEnc = tmp; + + return; + } + + if (e) + e.value = va; + }); + + selectByValue(f, 'doctypes', docType, true, true); + selectByValue(f, 'docencoding', xmlEnc, true, true); + selectByValue(f, 'langdir', doc.body.getAttribute('dir', 2) || '', true, true); + + if (xmlVer != '') + el.xml_pi.checked = true; + + // Parse appearance + + // Parse primary stylesheet + tinymce.each(doc.getElementsByTagName("link"), function(l) { + var m = l.getAttribute('media', 2) || '', t = l.getAttribute('type', 2) || ''; + + if (t == "-mce-text/css" && (m == "" || m == "screen" || m == "all") && (l.getAttribute('rel', 2) || '') == "stylesheet") { + f.stylesheet.value = l.getAttribute('mce_href', 2) || ''; + return false; + } + }); + + // Get from style elements + tinymce.each(doc.getElementsByTagName("style"), function(st) { + var tmp = parseStyleElement(st); + + for (x=0; x<tmp.length; x++) { + if (tmp[x].rule.indexOf('a:visited') != -1 && tmp[x].data['color']) + f.visited_color.value = tmp[x].data['color']; + + if (tmp[x].rule.indexOf('a:link') != -1 && tmp[x].data['color']) + f.link_color.value = tmp[x].data['color']; + + if (tmp[x].rule.indexOf('a:active') != -1 && tmp[x].data['color']) + f.active_color.value = tmp[x].data['color']; + } + }); + + f.textcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "text"); + f.active_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "alink"); + f.link_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "link"); + f.visited_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "vlink"); + f.bgcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "bgcolor"); + f.bgimage.value = tinyMCEPopup.dom.getAttrib(doc.body, "background"); + + // Get from style info + style = tinyMCEPopup.dom.parseStyle(tinyMCEPopup.dom.getAttrib(doc.body, 'style')); + + if (style['font-family']) + selectByValue(f, 'fontface', style['font-family'], true, true); + else + selectByValue(f, 'fontface', ed.getParam("fullpage_default_fontface", ""), true, true); + + if (style['font-size']) + selectByValue(f, 'fontsize', style['font-size'], true, true); + else + selectByValue(f, 'fontsize', ed.getParam("fullpage_default_fontsize", ""), true, true); + + if (style['color']) + f.textcolor.value = convertRGBToHex(style['color']); + + if (style['background-image']) + f.bgimage.value = style['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + + if (style['background-color']) + f.bgcolor.value = style['background-color']; + + if (style['margin']) { + tmp = style['margin'].replace(/[^0-9 ]/g, ''); + tmp = tmp.split(/ +/); + f.topmargin.value = tmp.length > 0 ? tmp[0] : ''; + f.rightmargin.value = tmp.length > 1 ? tmp[1] : tmp[0]; + f.bottommargin.value = tmp.length > 2 ? tmp[2] : tmp[0]; + f.leftmargin.value = tmp.length > 3 ? tmp[3] : tmp[0]; + } + + if (style['margin-left']) + f.leftmargin.value = style['margin-left'].replace(/[^0-9]/g, ''); + + if (style['margin-right']) + f.rightmargin.value = style['margin-right'].replace(/[^0-9]/g, ''); + + if (style['margin-top']) + f.topmargin.value = style['margin-top'].replace(/[^0-9]/g, ''); + + if (style['margin-bottom']) + f.bottommargin.value = style['margin-bottom'].replace(/[^0-9]/g, ''); + + f.style.value = tinyMCEPopup.dom.serializeStyle(style); + + // Update colors + updateColor('textcolor_pick', 'textcolor'); + updateColor('bgcolor_pick', 'bgcolor'); + updateColor('visited_color_pick', 'visited_color'); + updateColor('active_color_pick', 'active_color'); + updateColor('link_color_pick', 'link_color'); +} + +function getReItem(r, s, i) { + var c = r.exec(s); + + if (c && c.length > i) + return c[i]; + + return ''; +} + +function updateAction() { + var f = document.forms[0], nl, i, h, v, s, head, html, l, tmp, addlink = true, ser; + + head = doc.getElementsByTagName('head')[0]; + + // Fix scripts without a type + nl = doc.getElementsByTagName('script'); + for (i=0; i<nl.length; i++) { + if (tinyMCEPopup.dom.getAttrib(nl[i], 'mce_type') == '') + nl[i].setAttribute('mce_type', 'text/javascript'); + } + + // Get primary stylesheet + nl = doc.getElementsByTagName("link"); + for (i=0; i<nl.length; i++) { + l = nl[i]; + + tmp = tinyMCEPopup.dom.getAttrib(l, 'media'); + + if (tinyMCEPopup.dom.getAttrib(l, 'mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCEPopup.dom.getAttrib(l, 'rel') == "stylesheet") { + addlink = false; + + if (f.stylesheet.value == '') + l.parentNode.removeChild(l); + else + l.setAttribute('mce_href', f.stylesheet.value); + + break; + } + } + + // Add new link + if (f.stylesheet.value != '') { + l = doc.createElement('link'); + + l.setAttribute('type', 'text/css'); + l.setAttribute('mce_href', f.stylesheet.value); + l.setAttribute('rel', 'stylesheet'); + + head.appendChild(l); + } + + setMeta(head, 'keywords', f.metakeywords.value); + setMeta(head, 'description', f.metadescription.value); + setMeta(head, 'author', f.metaauthor.value); + setMeta(head, 'copyright', f.metacopyright.value); + setMeta(head, 'robots', getSelectValue(f, 'metarobots')); + setMeta(head, 'Content-Type', getSelectValue(f, 'docencoding')); + + doc.body.dir = getSelectValue(f, 'langdir'); + doc.body.style.cssText = f.style.value; + + doc.body.setAttribute('vLink', f.visited_color.value); + doc.body.setAttribute('link', f.link_color.value); + doc.body.setAttribute('text', f.textcolor.value); + doc.body.setAttribute('aLink', f.active_color.value); + + doc.body.style.fontFamily = getSelectValue(f, 'fontface'); + doc.body.style.fontSize = getSelectValue(f, 'fontsize'); + doc.body.style.backgroundColor = f.bgcolor.value; + + if (f.leftmargin.value != '') + doc.body.style.marginLeft = f.leftmargin.value + 'px'; + + if (f.rightmargin.value != '') + doc.body.style.marginRight = f.rightmargin.value + 'px'; + + if (f.bottommargin.value != '') + doc.body.style.marginBottom = f.bottommargin.value + 'px'; + + if (f.topmargin.value != '') + doc.body.style.marginTop = f.topmargin.value + 'px'; + + html = doc.getElementsByTagName('html')[0]; + html.setAttribute('lang', f.langcode.value); + html.setAttribute('xml:lang', f.langcode.value); + + if (f.bgimage.value != '') + doc.body.style.backgroundImage = "url('" + f.bgimage.value + "')"; + else + doc.body.style.backgroundImage = ''; + + ser = tinyMCEPopup.editor.plugins.fullpage._createSerializer(); + ser.setRules('-title,meta[http-equiv|name|content],base[href|target],link[href|rel|type|title|media],style[type],script[type|language|src],html[lang|xml::lang|xmlns],body[style|dir|vlink|link|text|alink],head'); + + h = ser.serialize(doc.documentElement); + h = h.substring(0, h.lastIndexOf('</body>')); + + if (h.indexOf('<title>') == -1) + h = h.replace(/<head.*?>/, '$&\n' + '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>'); + else + h = h.replace(/<title>(.*?)<\/title>/, '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>'); + + if ((v = getSelectValue(f, 'doctypes')) != '') + h = v + '\n' + h; + + if (f.xml_pi.checked) { + s = '<?xml version="1.0"'; + + if ((v = getSelectValue(f, 'docencoding')) != '') + s += ' encoding="' + v + '"'; + + s += '?>\n'; + h = s + h; + } + + h = h.replace(/type=\"\-mce\-/gi, 'type="'); + + tinyMCEPopup.editor.plugins.fullpage.head = h; + tinyMCEPopup.editor.plugins.fullpage._setBodyAttribs(tinyMCEPopup.editor, {}); + tinyMCEPopup.close(); +} + +function changedStyleField(field) { +} + +function setMeta(he, k, v) { + var nl, i, m; + + nl = he.getElementsByTagName('meta'); + for (i=0; i<nl.length; i++) { + if (k == 'Content-Type' && tinyMCEPopup.dom.getAttrib(nl[i], 'http-equiv') == k) { + if (v == '') + nl[i].parentNode.removeChild(nl[i]); + else + nl[i].setAttribute('content', "text/html; charset=" + v); + + return; + } + + if (tinyMCEPopup.dom.getAttrib(nl[i], 'name') == k) { + if (v == '') + nl[i].parentNode.removeChild(nl[i]); + else + nl[i].setAttribute('content', v); + return; + } + } + + if (v == '') + return; + + m = doc.createElement('meta'); + + if (k == 'Content-Type') + m.httpEquiv = k; + else + m.setAttribute('name', k); + + m.setAttribute('content', v); + he.appendChild(m); +} + +function parseStyleElement(e) { + var v = e.innerHTML; + var p, i, r; + + v = v.replace(/<!--/gi, ''); + v = v.replace(/-->/gi, ''); + v = v.replace(/[\n\r]/gi, ''); + v = v.replace(/\s+/gi, ' '); + + r = []; + p = v.split(/{|}/); + + for (i=0; i<p.length; i+=2) { + if (p[i] != "") + r[r.length] = {rule : tinymce.trim(p[i]), data : tinyMCEPopup.dom.parseStyle(p[i+1])}; + } + + return r; +} + +function serializeStyleElement(d) { + var i, s, st; + + s = '<!--\n'; + + for (i=0; i<d.length; i++) { + s += d[i].rule + ' {\n'; + + st = tinyMCE.serializeStyle(d[i].data); + + if (st != '') + st += ';'; + + s += st.replace(/;/g, ';\n'); + s += '}\n'; + + if (i != d.length - 1) + s += '\n'; + } + + s += '\n-->'; + + return s; +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..f5801b8b310adf452d0a2d1b5ddffa7c07eeefa2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullpage/langs/en_dlg.js @@ -0,0 +1,85 @@ +tinyMCE.addI18n('en.fullpage_dlg',{ +title:"Document properties", +meta_tab:"General", +appearance_tab:"Appearance", +advanced_tab:"Advanced", +meta_props:"Meta information", +langprops:"Language and encoding", +meta_title:"Title", +meta_keywords:"Keywords", +meta_description:"Description", +meta_robots:"Robots", +doctypes:"Doctype", +langcode:"Language code", +langdir:"Language direction", +ltr:"Left to right", +rtl:"Right to left", +xml_pi:"XML declaration", +encoding:"Character encoding", +appearance_bgprops:"Background properties", +appearance_marginprops:"Body margins", +appearance_linkprops:"Link colors", +appearance_textprops:"Text properties", +bgcolor:"Background color", +bgimage:"Background image", +left_margin:"Left margin", +right_margin:"Right margin", +top_margin:"Top margin", +bottom_margin:"Bottom margin", +text_color:"Text color", +font_size:"Font size", +font_face:"Font face", +link_color:"Link color", +hover_color:"Hover color", +visited_color:"Visited color", +active_color:"Active color", +textcolor:"Color", +fontsize:"Font size", +fontface:"Font family", +meta_index_follow:"Index and follow the links", +meta_index_nofollow:"Index and don't follow the links", +meta_noindex_follow:"Do not index but follow the links", +meta_noindex_nofollow:"Do not index and don\'t follow the links", +appearance_style:"Stylesheet and style properties", +stylesheet:"Stylesheet", +style:"Style", +author:"Author", +copyright:"Copyright", +add:"Add new element", +remove:"Remove selected element", +moveup:"Move selected element up", +movedown:"Move selected element down", +head_elements:"Head elements", +info:"Information", +add_title:"Title element", +add_meta:"Meta element", +add_script:"Script element", +add_style:"Style element", +add_link:"Link element", +add_base:"Base element", +add_comment:"Comment node", +title_element:"Title element", +script_element:"Script element", +style_element:"Style element", +base_element:"Base element", +link_element:"Link element", +meta_element:"Meta element", +comment_element:"Comment", +src:"Src", +language:"Language", +href:"Href", +target:"Target", +type:"Type", +charset:"Charset", +defer:"Defer", +media:"Media", +properties:"Properties", +name:"Name", +value:"Value", +content:"Content", +rel:"Rel", +rev:"Rev", +hreflang:"Href lang", +general_props:"General", +advanced_props:"Advanced" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..dfb3f16cccec3d1d1523b3ad7ed5df4df429d3e8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(c,d){var e=this,f={},b;e.editor=c;c.addCommand("mceFullScreen",function(){var h,i=a.doc.documentElement;if(c.getParam("fullscreen_is_enabled")){if(c.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",e.resizeFunc);tinyMCE.get(c.getParam("fullscreen_editor_id")).setContent(c.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(c);a.remove("mce_fullscreen_container");i.style.overflow=c.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",c.getParam("fullscreen_overflow"));a.win.scrollTo(c.getParam("fullscreen_scrollx"),c.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(c.getParam("fullscreen_new_window")){h=a.win.open(d+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{h.resizeTo(screen.availWidth,screen.availHeight)}catch(g){}}else{tinyMCE.oldSettings=tinyMCE.settings;f.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";f.fullscreen_html_overflow=a.getStyle(i,"overflow",1);b=a.getViewPort();f.fullscreen_scrollx=b.x;f.fullscreen_scrolly=b.y;if(tinymce.isOpera&&f.fullscreen_overflow=="visible"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&f.fullscreen_overflow=="scroll"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&(f.fullscreen_html_overflow=="visible"||f.fullscreen_html_overflow=="scroll")){f.fullscreen_html_overflow="auto"}if(f.fullscreen_overflow=="0px"){f.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");i.style.overflow="hidden";b=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){b.h-=1}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+(tinymce.isIE6||(tinymce.isIE&&!a.boxModel)?"absolute":"fixed")+";top:0;left:0;width:"+b.w+"px;height:"+b.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(c.settings,function(j,k){f[k]=j});f.id="mce_fullscreen";f.width=n.clientWidth;f.height=n.clientHeight-15;f.fullscreen_is_enabled=true;f.fullscreen_editor_id=c.id;f.theme_advanced_resizing=false;f.save_onsavecallback=function(){c.setContent(tinyMCE.get(f.id).getContent({format:"raw"}),{format:"raw"});c.execCommand("mceSave")};tinymce.each(c.getParam("fullscreen_settings"),function(l,j){f[j]=l});if(f.theme_advanced_toolbar_location==="external"){f.theme_advanced_toolbar_location="top"}e.fullscreenEditor=new tinymce.Editor("mce_fullscreen",f);e.fullscreenEditor.onInit.add(function(){e.fullscreenEditor.setContent(c.getContent());e.fullscreenEditor.focus()});e.fullscreenEditor.render();tinyMCE.add(e.fullscreenEditor);e.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");e.fullscreenElement.update();e.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var j=tinymce.DOM.getViewPort();e.fullscreenEditor.theme.resizeTo(j.w,j.h)})}});c.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});c.onNodeChange.add(function(h,g){g.setActive("fullscreen",h.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..77a8c3b9ab443176737267a6ae71d217b09937ce --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/editor_plugin_src.js @@ -0,0 +1,145 @@ +/** + * $Id: editor_plugin_src.js 923 2008-09-09 16:45:29Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM; + + tinymce.create('tinymce.plugins.FullScreenPlugin', { + init : function(ed, url) { + var t = this, s = {}, vp; + + t.editor = ed; + + // Register commands + ed.addCommand('mceFullScreen', function() { + var win, de = DOM.doc.documentElement; + + if (ed.getParam('fullscreen_is_enabled')) { + if (ed.getParam('fullscreen_new_window')) + closeFullscreen(); // Call to close in new window + else { + DOM.win.setTimeout(function() { + tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc); + tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'}); + tinyMCE.remove(ed); + DOM.remove('mce_fullscreen_container'); + de.style.overflow = ed.getParam('fullscreen_html_overflow'); + DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow')); + DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly')); + tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings + }, 10); + } + + return; + } + + if (ed.getParam('fullscreen_new_window')) { + win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight); + try { + win.resizeTo(screen.availWidth, screen.availHeight); + } catch (e) { + // Ignore + } + } else { + tinyMCE.oldSettings = tinyMCE.settings; // Store old settings + s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto'; + s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1); + vp = DOM.getViewPort(); + s.fullscreen_scrollx = vp.x; + s.fullscreen_scrolly = vp.y; + + // Fixes an Opera bug where the scrollbars doesn't reappear + if (tinymce.isOpera && s.fullscreen_overflow == 'visible') + s.fullscreen_overflow = 'auto'; + + // Fixes an IE bug where horizontal scrollbars would appear + if (tinymce.isIE && s.fullscreen_overflow == 'scroll') + s.fullscreen_overflow = 'auto'; + + // Fixes an IE bug where the scrollbars doesn't reappear + if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll')) + s.fullscreen_html_overflow = 'auto'; + + if (s.fullscreen_overflow == '0px') + s.fullscreen_overflow = ''; + + DOM.setStyle(DOM.doc.body, 'overflow', 'hidden'); + de.style.overflow = 'hidden'; //Fix for IE6/7 + vp = DOM.getViewPort(); + DOM.win.scrollTo(0, 0); + + if (tinymce.isIE) + vp.h -= 1; + + n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:' + (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel) ? 'absolute' : 'fixed') + ';top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'}); + DOM.add(n, 'div', {id : 'mce_fullscreen'}); + + tinymce.each(ed.settings, function(v, n) { + s[n] = v; + }); + + s.id = 'mce_fullscreen'; + s.width = n.clientWidth; + s.height = n.clientHeight - 15; + s.fullscreen_is_enabled = true; + s.fullscreen_editor_id = ed.id; + s.theme_advanced_resizing = false; + s.save_onsavecallback = function() { + ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'}); + ed.execCommand('mceSave'); + }; + + tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) { + s[k] = v; + }); + + if (s.theme_advanced_toolbar_location === 'external') + s.theme_advanced_toolbar_location = 'top'; + + t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s); + t.fullscreenEditor.onInit.add(function() { + t.fullscreenEditor.setContent(ed.getContent()); + t.fullscreenEditor.focus(); + }); + + t.fullscreenEditor.render(); + tinyMCE.add(t.fullscreenEditor); + + t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container'); + t.fullscreenElement.update(); + //document.body.overflow = 'hidden'; + + t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() { + var vp = tinymce.DOM.getViewPort(); + + t.fullscreenEditor.theme.resizeTo(vp.w, vp.h); + }); + } + }); + + // Register buttons + ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'}); + + ed.onNodeChange.add(function(ed, cm) { + cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled')); + }); + }, + + getInfo : function() { + return { + longname : 'Fullscreen', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/fullscreen.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/fullscreen.htm new file mode 100644 index 0000000000000000000000000000000000000000..6ec4f26f1ccdd86e6cbb6a4042e9318c899822fb --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/fullscreen/fullscreen.htm @@ -0,0 +1,110 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title></title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <script type="text/javascript" src="../../tiny_mce.js"></script> + <script type="text/javascript"> + function patchCallback(settings, key) { + if (settings[key]) + settings[key] = "window.opener." + settings[key]; + } + + var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id; + + // Clone array + for (var n in paSe) + settings[n] = paSe[n]; + + // Override options for fullscreen + for (var n in paSe.fullscreen_settings) + settings[n] = paSe.fullscreen_settings[n]; + + // Patch callbacks, make them point to window.opener + patchCallback(settings, 'urlconverter_callback'); + patchCallback(settings, 'insertlink_callback'); + patchCallback(settings, 'insertimage_callback'); + patchCallback(settings, 'setupcontent_callback'); + patchCallback(settings, 'save_callback'); + patchCallback(settings, 'onchange_callback'); + patchCallback(settings, 'init_instance_callback'); + patchCallback(settings, 'file_browser_callback'); + patchCallback(settings, 'cleanup_callback'); + patchCallback(settings, 'execcommand_callback'); + patchCallback(settings, 'oninit'); + + // Set options + delete settings.id; + settings['mode'] = 'exact'; + settings['elements'] = 'fullscreenarea'; + settings['add_unload_trigger'] = false; + settings['ask'] = false; + settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI(); + settings['fullscreen_is_enabled'] = true; + settings['fullscreen_editor_id'] = oeID; + settings['theme_advanced_resizing'] = false; + settings['strict_loading_mode'] = true; + + settings.save_onsavecallback = function() { + window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'}); + window.opener.tinyMCE.get(oeID).execCommand('mceSave'); + window.close(); + }; + + function unloadHandler(e) { + moveContent(); + } + + function moveContent() { + window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent()); + } + + function closeFullscreen() { + moveContent(); + window.close(); + } + + function doParentSubmit() { + moveContent(); + + if (window.opener.tinyMCE.selectedInstance.formElement.form) + window.opener.tinyMCE.selectedInstance.formElement.form.submit(); + + window.close(); + + return false; + } + + function render() { + var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM; + + e.value = window.opener.tinyMCE.get(oeID).getContent(); + + vp = dom.getViewPort(); + settings.width = vp.w; + settings.height = vp.h - 15; + + tinymce.dom.Event.add(window, 'resize', function() { + var vp = dom.getViewPort(); + + tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h); + }); + + tinyMCE.init(settings); + } + + // Add onunload + tinymce.dom.Event.add(window, "beforeunload", unloadHandler); + </script> +</head> +<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no"> +<form onsubmit="doParentSubmit();"> +<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea> +</form> + +<script type="text/javascript"> + render(); +</script> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/iespell/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/iespell/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..e9cba106c60955a1303a70281d2457877d98af37 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/iespell/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.IESpell",{init:function(a,b){var c=this,d;if(!tinymce.isIE){return}c.editor=a;a.addCommand("mceIESpell",function(){try{d=new ActiveXObject("ieSpell.ieSpellExtension");d.CheckDocumentNode(a.getDoc().documentElement)}catch(f){if(f.number==-2146827859){a.windowManager.confirm(a.getLang("iespell.download"),function(e){if(e){window.open("http://www.iespell.com/download.php","ieSpellDownload","")}})}else{a.windowManager.alert("Error Loading ieSpell: Exception "+f.number)}}});a.addButton("iespell",{title:"iespell.iespell_desc",cmd:"mceIESpell"})},getInfo:function(){return{longname:"IESpell (IE Only)",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("iespell",tinymce.plugins.IESpell)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/iespell/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/iespell/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..a68f69a23807ba9473e8b3e5cddb49f4dd7d5a30 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/iespell/editor_plugin_src.js @@ -0,0 +1,51 @@ +/** + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.IESpell', { + init : function(ed, url) { + var t = this, sp; + + if (!tinymce.isIE) + return; + + t.editor = ed; + + // Register commands + ed.addCommand('mceIESpell', function() { + try { + sp = new ActiveXObject("ieSpell.ieSpellExtension"); + sp.CheckDocumentNode(ed.getDoc().documentElement); + } catch (e) { + if (e.number == -2146827859) { + ed.windowManager.confirm(ed.getLang("iespell.download"), function(s) { + if (s) + window.open('http://www.iespell.com/download.php', 'ieSpellDownload', ''); + }); + } else + ed.windowManager.alert("Error Loading ieSpell: Exception " + e.number); + } + }); + + // Register buttons + ed.addButton('iespell', {title : 'iespell.iespell_desc', cmd : 'mceIESpell'}); + }, + + getInfo : function() { + return { + longname : 'IESpell (IE Only)', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..4affad454e658368e29991d6c4157dda7d0b9115 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/editor_plugin.js @@ -0,0 +1 @@ +(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark("simple")}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":q.settings.inlinepopups_skin||"clearlooks2",style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..a002bc513aee2f2f79e0e47e38fb8a942ce272e7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/editor_plugin_src.js @@ -0,0 +1,632 @@ +/** + * $Id: editor_plugin_src.js 999 2009-02-10 17:42:58Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is; + + tinymce.create('tinymce.plugins.InlinePopups', { + init : function(ed, url) { + // Replace window manager + ed.onBeforeRenderUI.add(function() { + ed.windowManager = new tinymce.InlineWindowManager(ed); + DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css"); + }); + }, + + getInfo : function() { + return { + longname : 'InlinePopups', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', { + InlineWindowManager : function(ed) { + var t = this; + + t.parent(ed); + t.zIndex = 300000; + t.count = 0; + t.windows = {}; + }, + + open : function(f, p) { + var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u; + + f = f || {}; + p = p || {}; + + // Run native windows + if (!f.inline) + return t.parent(f, p); + + // Only store selection if the type is a normal window + if (!f.type) + t.bookmark = ed.selection.getBookmark('simple'); + + id = DOM.uniqueId(); + vp = DOM.getViewPort(); + f.width = parseInt(f.width || 320); + f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0); + f.min_width = parseInt(f.min_width || 150); + f.min_height = parseInt(f.min_height || 100); + f.max_width = parseInt(f.max_width || 2000); + f.max_height = parseInt(f.max_height || 2000); + f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0))); + f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0))); + f.movable = f.resizable = true; + p.mce_width = f.width; + p.mce_height = f.height; + p.mce_inline = true; + p.mce_window_id = id; + p.mce_auto_focus = f.auto_focus; + + // Transpose +// po = DOM.getPos(ed.getContainer()); +// f.left -= po.x; +// f.top -= po.y; + + t.features = f; + t.params = p; + t.onOpen.dispatch(t, f, p); + + if (f.type) { + opt += ' mceModal'; + + if (f.type) + opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1); + + f.resizable = false; + } + + if (f.statusbar) + opt += ' mceStatusbar'; + + if (f.resizable) + opt += ' mceResizable'; + + if (f.minimizable) + opt += ' mceMinimizable'; + + if (f.maximizable) + opt += ' mceMaximizable'; + + if (f.movable) + opt += ' mceMovable'; + + // Create DOM objects + t._addAll(DOM.doc.body, + ['div', {id : id, 'class' : ed.settings.inlinepopups_skin || 'clearlooks2', style : 'width:100px;height:100px'}, + ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt}, + ['div', {id : id + '_top', 'class' : 'mceTop'}, + ['div', {'class' : 'mceLeft'}], + ['div', {'class' : 'mceCenter'}], + ['div', {'class' : 'mceRight'}], + ['span', {id : id + '_title'}, f.title || ''] + ], + + ['div', {id : id + '_middle', 'class' : 'mceMiddle'}, + ['div', {id : id + '_left', 'class' : 'mceLeft'}], + ['span', {id : id + '_content'}], + ['div', {id : id + '_right', 'class' : 'mceRight'}] + ], + + ['div', {id : id + '_bottom', 'class' : 'mceBottom'}, + ['div', {'class' : 'mceLeft'}], + ['div', {'class' : 'mceCenter'}], + ['div', {'class' : 'mceRight'}], + ['span', {id : id + '_status'}, 'Content'] + ], + + ['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}], + ['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}], + ['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}], + ['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}], + ['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}], + ['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}], + ['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}], + ['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}], + ['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}], + ['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}], + ['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}], + ['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}], + ['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}] + ] + ] + ); + + DOM.setStyles(id, {top : -10000, left : -10000}); + + // Fix gecko rendering bug, where the editors iframe messed with window contents + if (tinymce.isGecko) + DOM.setStyle(id, 'overflow', 'auto'); + + // Measure borders + if (!f.type) { + dw += DOM.get(id + '_left').clientWidth; + dw += DOM.get(id + '_right').clientWidth; + dh += DOM.get(id + '_top').clientHeight; + dh += DOM.get(id + '_bottom').clientHeight; + } + + // Resize window + DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh}); + + u = f.url || f.file; + if (u) { + if (tinymce.relaxedDomain) + u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain; + + u = tinymce._addVer(u); + } + + if (!f.type) { + DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'}); + DOM.setStyles(id + '_ifr', {width : f.width, height : f.height}); + DOM.setAttrib(id + '_ifr', 'src', u); + } else { + DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok'); + + if (f.type == 'confirm') + DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel'); + + DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'}); + DOM.setHTML(id + '_content', f.content.replace('\n', '<br />')); + } + + // Register events + mdf = Event.add(id, 'mousedown', function(e) { + var n = e.target, w, vp; + + w = t.windows[id]; + t.focus(id); + + if (n.nodeName == 'A' || n.nodeName == 'a') { + if (n.className == 'mceMax') { + w.oldPos = w.element.getXY(); + w.oldSize = w.element.getSize(); + + vp = DOM.getViewPort(); + + // Reduce viewport size to avoid scrollbars + vp.w -= 2; + vp.h -= 2; + + w.element.moveTo(vp.x, vp.y); + w.element.resizeTo(vp.w, vp.h); + DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight}); + DOM.addClass(id + '_wrapper', 'mceMaximized'); + } else if (n.className == 'mceMed') { + // Reset to old size + w.element.moveTo(w.oldPos.x, w.oldPos.y); + w.element.resizeTo(w.oldSize.w, w.oldSize.h); + w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight); + + DOM.removeClass(id + '_wrapper', 'mceMaximized'); + } else if (n.className == 'mceMove') + return t._startDrag(id, e, n.className); + else if (DOM.hasClass(n, 'mceResize')) + return t._startDrag(id, e, n.className.substring(13)); + } + }); + + clf = Event.add(id, 'click', function(e) { + var n = e.target; + + t.focus(id); + + if (n.nodeName == 'A' || n.nodeName == 'a') { + switch (n.className) { + case 'mceClose': + t.close(null, id); + return Event.cancel(e); + + case 'mceButton mceOk': + case 'mceButton mceCancel': + f.button_func(n.className == 'mceButton mceOk'); + return Event.cancel(e); + } + } + }); + + // Add window + w = t.windows[id] = { + id : id, + mousedown_func : mdf, + click_func : clf, + element : new Element(id, {blocker : 1, container : ed.getContainer()}), + iframeElement : new Element(id + '_ifr'), + features : f, + deltaWidth : dw, + deltaHeight : dh + }; + + w.iframeElement.on('focus', function() { + t.focus(id); + }); + + // Setup blocker + if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') { + DOM.add(DOM.doc.body, 'div', { + id : 'mceModalBlocker', + 'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker', + style : {zIndex : t.zIndex - 1} + }); + + DOM.show('mceModalBlocker'); // Reduces flicker in IE + } else + DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1); + + if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel)) + DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2}); + + t.focus(id); + t._fixIELayout(id, 1); + + // Focus ok button + if (DOM.get(id + '_ok')) + DOM.get(id + '_ok').focus(); + + t.count++; + + return w; + }, + + focus : function(id) { + var t = this, w; + + if (w = t.windows[id]) { + w.zIndex = this.zIndex++; + w.element.setStyle('zIndex', w.zIndex); + w.element.update(); + + id = id + '_wrapper'; + DOM.removeClass(t.lastId, 'mceFocus'); + DOM.addClass(id, 'mceFocus'); + t.lastId = id; + } + }, + + _addAll : function(te, ne) { + var i, n, t = this, dom = tinymce.DOM; + + if (is(ne, 'string')) + te.appendChild(dom.doc.createTextNode(ne)); + else if (ne.length) { + te = te.appendChild(dom.create(ne[0], ne[1])); + + for (i=2; i<ne.length; i++) + t._addAll(te, ne[i]); + } + }, + + _startDrag : function(id, se, ac) { + var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh; + + // Get positons and sizes +// cp = DOM.getPos(t.editor.getContainer()); + cp = {x : 0, y : 0}; + vp = DOM.getViewPort(); + + // Reduce viewport size to avoid scrollbars while dragging + vp.w -= 2; + vp.h -= 2; + + sex = se.screenX; + sey = se.screenY; + dx = dy = dw = dh = 0; + + // Handle mouse up + mu = Event.add(d, 'mouseup', function(e) { + Event.remove(d, 'mouseup', mu); + Event.remove(d, 'mousemove', mm); + + if (eb) + eb.remove(); + + we.moveBy(dx, dy); + we.resizeBy(dw, dh); + sz = we.getSize(); + DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight}); + t._fixIELayout(id, 1); + + return Event.cancel(e); + }); + + if (ac != 'Move') + startMove(); + + function startMove() { + if (eb) + return; + + t._fixIELayout(id, 0); + + // Setup event blocker + DOM.add(d.body, 'div', { + id : 'mceEventBlocker', + 'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'), + style : {zIndex : t.zIndex + 1} + }); + + if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel)) + DOM.setStyles('mceEventBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2}); + + eb = new Element('mceEventBlocker'); + eb.update(); + + // Setup placeholder + p = we.getXY(); + sz = we.getSize(); + sx = cp.x + p.x - vp.x; + sy = cp.y + p.y - vp.y; + DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}}); + ph = new Element('mcePlaceHolder'); + }; + + // Handle mouse move/drag + mm = Event.add(d, 'mousemove', function(e) { + var x, y, v; + + startMove(); + + x = e.screenX - sex; + y = e.screenY - sey; + + switch (ac) { + case 'ResizeW': + dx = x; + dw = 0 - x; + break; + + case 'ResizeE': + dw = x; + break; + + case 'ResizeN': + case 'ResizeNW': + case 'ResizeNE': + if (ac == "ResizeNW") { + dx = x; + dw = 0 - x; + } else if (ac == "ResizeNE") + dw = x; + + dy = y; + dh = 0 - y; + break; + + case 'ResizeS': + case 'ResizeSW': + case 'ResizeSE': + if (ac == "ResizeSW") { + dx = x; + dw = 0 - x; + } else if (ac == "ResizeSE") + dw = x; + + dh = y; + break; + + case 'mceMove': + dx = x; + dy = y; + break; + } + + // Boundary check + if (dw < (v = w.features.min_width - sz.w)) { + if (dx !== 0) + dx += dw - v; + + dw = v; + } + + if (dh < (v = w.features.min_height - sz.h)) { + if (dy !== 0) + dy += dh - v; + + dh = v; + } + + dw = Math.min(dw, w.features.max_width - sz.w); + dh = Math.min(dh, w.features.max_height - sz.h); + dx = Math.max(dx, vp.x - (sx + vp.x)); + dy = Math.max(dy, vp.y - (sy + vp.y)); + dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x)); + dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y)); + + // Move if needed + if (dx + dy !== 0) { + if (sx + dx < 0) + dx = 0; + + if (sy + dy < 0) + dy = 0; + + ph.moveTo(sx + dx, sy + dy); + } + + // Resize if needed + if (dw + dh !== 0) + ph.resizeTo(sz.w + dw, sz.h + dh); + + return Event.cancel(e); + }); + + return Event.cancel(se); + }, + + resizeBy : function(dw, dh, id) { + var w = this.windows[id]; + + if (w) { + w.element.resizeBy(dw, dh); + w.iframeElement.resizeBy(dw, dh); + } + }, + + close : function(win, id) { + var t = this, w, d = DOM.doc, ix = 0, fw, id; + + id = t._findId(id || win); + + // Probably not inline + if (!t.windows[id]) { + t.parent(win); + return; + } + + t.count--; + + if (t.count == 0) + DOM.remove('mceModalBlocker'); + + if (w = t.windows[id]) { + t.onClose.dispatch(t); + Event.remove(d, 'mousedown', w.mousedownFunc); + Event.remove(d, 'click', w.clickFunc); + Event.clear(id); + Event.clear(id + '_ifr'); + + DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak + w.element.remove(); + delete t.windows[id]; + + // Find front most window and focus that + each (t.windows, function(w) { + if (w.zIndex > ix) { + fw = w; + ix = w.zIndex; + } + }); + + if (fw) + t.focus(fw.id); + } + }, + + setTitle : function(w, ti) { + var e; + + w = this._findId(w); + + if (e = DOM.get(w + '_title')) + e.innerHTML = DOM.encode(ti); + }, + + alert : function(txt, cb, s) { + var t = this, w; + + w = t.open({ + title : t, + type : 'alert', + button_func : function(s) { + if (cb) + cb.call(s || t, s); + + t.close(null, w.id); + }, + content : DOM.encode(t.editor.getLang(txt, txt)), + inline : 1, + width : 400, + height : 130 + }); + }, + + confirm : function(txt, cb, s) { + var t = this, w; + + w = t.open({ + title : t, + type : 'confirm', + button_func : function(s) { + if (cb) + cb.call(s || t, s); + + t.close(null, w.id); + }, + content : DOM.encode(t.editor.getLang(txt, txt)), + inline : 1, + width : 400, + height : 130 + }); + }, + + // Internal functions + + _findId : function(w) { + var t = this; + + if (typeof(w) == 'string') + return w; + + each(t.windows, function(wo) { + var ifr = DOM.get(wo.id + '_ifr'); + + if (ifr && w == ifr.contentWindow) { + w = wo.id; + return false; + } + }); + + return w; + }, + + _fixIELayout : function(id, s) { + var w, img; + + if (!tinymce.isIE6) + return; + + // Fixes the bug where hover flickers and does odd things in IE6 + each(['n','s','w','e','nw','ne','sw','se'], function(v) { + var e = DOM.get(id + '_resize_' + v); + + DOM.setStyles(e, { + width : s ? e.clientWidth : '', + height : s ? e.clientHeight : '', + cursor : DOM.getStyle(e, 'cursor', 1) + }); + + DOM.setStyle(id + "_bottom", 'bottom', '-1px'); + + e = 0; + }); + + // Fixes graphics glitch + if (w = this.windows[id]) { + // Fixes rendering bug after resize + w.element.hide(); + w.element.show(); + + // Forced a repaint of the window + //DOM.get(id).style.filter = ''; + + // IE has a bug where images used in CSS won't get loaded + // sometimes when the cache in the browser is disabled + // This fix tries to solve it by loading the images using the image object + each(DOM.select('div,a', id), function(e, i) { + if (e.currentStyle.backgroundImage != 'none') { + img = new Image(); + img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1'); + } + }); + + DOM.get(id).style.filter = ''; + } + } + }); + + // Register plugin + tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups); +})(); + diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif new file mode 100644 index 0000000000000000000000000000000000000000..94abd08763fffdaa0dd5c5afb470a97294f2b94d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif new file mode 100644 index 0000000000000000000000000000000000000000..e671094cb0eb210b756117f992cf5ca2caa698fd Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif new file mode 100644 index 0000000000000000000000000000000000000000..6baf64ad321ab3d35330f2aaae7504aa519644bd Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif new file mode 100644 index 0000000000000000000000000000000000000000..497307a85ad32e00b67c5f27d6f3b46ac566d89b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif new file mode 100644 index 0000000000000000000000000000000000000000..c894b2e83522ae29d32e0ed57007d1285c715a7f Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif new file mode 100644 index 0000000000000000000000000000000000000000..c2a2ad454db194e428a7b9da40f62d5376a17428 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif new file mode 100644 index 0000000000000000000000000000000000000000..43a735f22c81d6d7d99c1ba9f034f38bfdd1a92b Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css new file mode 100644 index 0000000000000000000000000000000000000000..5e6fd7d3cfff5bdbe30cc8c63e05d82e061ab3ab --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css @@ -0,0 +1,90 @@ +/* Clearlooks 2 */ + +/* Reset */ +.clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block} + +/* General */ +.clearlooks2 {position:absolute; direction:ltr} +.clearlooks2 .mceWrapper {position:static} +.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%} +.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)} +.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none} + +/* Top */ +.clearlooks2 .mceTop, .clearlooks2 .mceTop div {top:0; width:100%; height:23px} +.clearlooks2 .mceTop .mceLeft {width:6px; background:url(img/corners.gif)} +.clearlooks2 .mceTop .mceCenter {right:6px; width:100%; height:23px; background:url(img/horizontal.gif) 12px 0; clip:rect(auto auto auto 12px)} +.clearlooks2 .mceTop .mceRight {right:0; width:6px; height:23px; background:url(img/corners.gif) -12px 0} +.clearlooks2 .mceTop span {width:100%; text-align:center; vertical-align:middle; line-height:23px; font-weight:bold} +.clearlooks2 .mceFocus .mceTop .mceLeft {background:url(img/corners.gif) -6px 0} +.clearlooks2 .mceFocus .mceTop .mceCenter {background:url(img/horizontal.gif) 0 -23px} +.clearlooks2 .mceFocus .mceTop .mceRight {background:url(img/corners.gif) -18px 0} +.clearlooks2 .mceFocus .mceTop span {color:#FFF} + +/* Middle */ +.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0} +.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto)} +.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:url(img/vertical.gif) -5px 0} +.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF} +.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:url(img/vertical.gif)} + +/* Bottom */ +.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px} +.clearlooks2 .mceBottom {left:0; bottom:0; width:100%} +.clearlooks2 .mceBottom div {top:0} +.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:url(img/corners.gif) -34px -6px} +.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%; background:url(img/horizontal.gif) 0 -46px} +.clearlooks2 .mceBottom .mceRight {right:0; width:5px; background: url(img/corners.gif) -34px 0} +.clearlooks2 .mceBottom span {display:none} +.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px} +.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0} +.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px} +.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0} +.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px} + +/* Actions */ +.clearlooks2 a {width:29px; height:16px; top:3px;} +.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0} +.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0} +.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0} +.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0} +.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px} +.clearlooks2 .mceMovable .mceMove {display:block} +.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px} +.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px} +.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px} +.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px} +.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px} +.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px} +.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px} +.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px} +.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px} + +/* Resize */ +.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px} +.clearlooks2 .mceResizable .mceResize {display:block} +.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none} +.clearlooks2 .mceMinimizable .mceMin {display:block} +.clearlooks2 .mceMaximizable .mceMax {display:block} +.clearlooks2 .mceMaximized .mceMed {display:block} +.clearlooks2 .mceMaximized .mceMax {display:none} +.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize} +.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize} +.clearlooks2 a.mceResizeNE {top:0; right:0; cursor:ne-resize} +.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize;} +.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize} +.clearlooks2 a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize} +.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize} +.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize} + +/* Alert/Confirm */ +.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0} +.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px} +.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal} +.clearlooks2 a:hover {font-weight:bold;} +.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#D6D7D5} +.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px} +.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif)} +.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px} +.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto} +.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/template.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/template.htm new file mode 100644 index 0000000000000000000000000000000000000000..f9ec64219d26b850b0c7633d9ad2171a0cc79047 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/inlinepopups/template.htm @@ -0,0 +1,387 @@ +<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> --> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Template for dialogs</title> +<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css" /> +</head> +<body> + +<div class="mceEditor"> + <div class="clearlooks2" style="width:400px; height:100px; left:10px;"> + <div class="mceWrapper"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Blured</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span>Content</span> + <div class="mceRight"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar text.</span> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceMin" href="#"></a> + <a class="mceMax" href="#"></a> + <a class="mceMed" href="#"></a> + <a class="mceClose" href="#"></a> + <a class="mceResize mceResizeN" href="#"></a> + <a class="mceResize mceResizeS" href="#"></a> + <a class="mceResize mceResizeW" href="#"></a> + <a class="mceResize mceResizeE" href="#"></a> + <a class="mceResize mceResizeNW" href="#"></a> + <a class="mceResize mceResizeNE" href="#"></a> + <a class="mceResize mceResizeSW" href="#"></a> + <a class="mceResize mceResizeSE" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:100px; left:420px;"> + <div class="mceWrapper mceMovable mceFocus"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Focused</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span>Content</span> + <div class="mceRight"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar text.</span> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceMin" href="#"></a> + <a class="mceMax" href="#"></a> + <a class="mceMed" href="#"></a> + <a class="mceClose" href="#"></a> + <a class="mceResize mceResizeN" href="#"></a> + <a class="mceResize mceResizeS" href="#"></a> + <a class="mceResize mceResizeW" href="#"></a> + <a class="mceResize mceResizeE" href="#"></a> + <a class="mceResize mceResizeNW" href="#"></a> + <a class="mceResize mceResizeNE" href="#"></a> + <a class="mceResize mceResizeSW" href="#"></a> + <a class="mceResize mceResizeSE" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:120px;"> + <div class="mceWrapper mceMovable mceFocus mceStatusbar"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span>Content</span> + <div class="mceRight"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar text.</span> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceMin" href="#"></a> + <a class="mceMax" href="#"></a> + <a class="mceMed" href="#"></a> + <a class="mceClose" href="#"></a> + <a class="mceResize mceResizeN" href="#"></a> + <a class="mceResize mceResizeS" href="#"></a> + <a class="mceResize mceResizeW" href="#"></a> + <a class="mceResize mceResizeE" href="#"></a> + <a class="mceResize mceResizeNW" href="#"></a> + <a class="mceResize mceResizeNE" href="#"></a> + <a class="mceResize mceResizeSW" href="#"></a> + <a class="mceResize mceResizeSE" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:120px;"> + <div class="mceWrapper mceMovable mceFocus mceStatusbar mceResizable"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar, Resizable</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span>Content</span> + <div class="mceRight"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar text.</span> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceMin" href="#"></a> + <a class="mceMax" href="#"></a> + <a class="mceMed" href="#"></a> + <a class="mceClose" href="#"></a> + <a class="mceResize mceResizeN" href="#"></a> + <a class="mceResize mceResizeS" href="#"></a> + <a class="mceResize mceResizeW" href="#"></a> + <a class="mceResize mceResizeE" href="#"></a> + <a class="mceResize mceResizeNW" href="#"></a> + <a class="mceResize mceResizeNE" href="#"></a> + <a class="mceResize mceResizeSW" href="#"></a> + <a class="mceResize mceResizeSE" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:230px;"> + <div class="mceWrapper mceMovable mceFocus mceResizable mceMaximizable"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Resizable, Maximizable</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span>Content</span> + <div class="mceRight"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar text.</span> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceMin" href="#"></a> + <a class="mceMax" href="#"></a> + <a class="mceMed" href="#"></a> + <a class="mceClose" href="#"></a> + <a class="mceResize mceResizeN" href="#"></a> + <a class="mceResize mceResizeS" href="#"></a> + <a class="mceResize mceResizeW" href="#"></a> + <a class="mceResize mceResizeE" href="#"></a> + <a class="mceResize mceResizeNW" href="#"></a> + <a class="mceResize mceResizeNE" href="#"></a> + <a class="mceResize mceResizeSW" href="#"></a> + <a class="mceResize mceResizeSE" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:230px;"> + <div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximizable"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Blurred, Maximizable, Statusbar, Resizable</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span>Content</span> + <div class="mceRight"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar text.</span> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceMin" href="#"></a> + <a class="mceMax" href="#"></a> + <a class="mceMed" href="#"></a> + <a class="mceClose" href="#"></a> + <a class="mceResize mceResizeN" href="#"></a> + <a class="mceResize mceResizeS" href="#"></a> + <a class="mceResize mceResizeW" href="#"></a> + <a class="mceResize mceResizeE" href="#"></a> + <a class="mceResize mceResizeNW" href="#"></a> + <a class="mceResize mceResizeNE" href="#"></a> + <a class="mceResize mceResizeSW" href="#"></a> + <a class="mceResize mceResizeSE" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:340px;"> + <div class="mceWrapper mceMovable mceFocus mceResizable mceMaximized mceMinimizable mceMaximizable"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Maximized, Maximizable, Minimizable</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span>Content</span> + <div class="mceRight"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar text.</span> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceMin" href="#"></a> + <a class="mceMax" href="#"></a> + <a class="mceMed" href="#"></a> + <a class="mceClose" href="#"></a> + <a class="mceResize mceResizeN" href="#"></a> + <a class="mceResize mceResizeS" href="#"></a> + <a class="mceResize mceResizeW" href="#"></a> + <a class="mceResize mceResizeE" href="#"></a> + <a class="mceResize mceResizeNW" href="#"></a> + <a class="mceResize mceResizeNE" href="#"></a> + <a class="mceResize mceResizeSW" href="#"></a> + <a class="mceResize mceResizeSE" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:340px;"> + <div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximized mceMinimizable mceMaximizable"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Blured</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span>Content</span> + <div class="mceRight"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Statusbar text.</span> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceMin" href="#"></a> + <a class="mceMax" href="#"></a> + <a class="mceMed" href="#"></a> + <a class="mceClose" href="#"></a> + <a class="mceResize mceResizeN" href="#"></a> + <a class="mceResize mceResizeS" href="#"></a> + <a class="mceResize mceResizeW" href="#"></a> + <a class="mceResize mceResizeE" href="#"></a> + <a class="mceResize mceResizeNW" href="#"></a> + <a class="mceResize mceResizeNE" href="#"></a> + <a class="mceResize mceResizeSW" href="#"></a> + <a class="mceResize mceResizeSE" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:130px; left:10px; top:450px;"> + <div class="mceWrapper mceMovable mceFocus mceModal mceAlert"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Alert</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span> + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + </span> + <div class="mceRight"></div> + <div class="mceIcon"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceButton mceOk" href="#">Ok</a> + <a class="mceClose" href="#"></a> + </div> + </div> + + <div class="clearlooks2" style="width:400px; height:130px; left:420px; top:450px;"> + <div class="mceWrapper mceMovable mceFocus mceModal mceConfirm"> + <div class="mceTop"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + <span>Confirm</span> + </div> + + <div class="mceMiddle"> + <div class="mceLeft"></div> + <span> + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + </span> + <div class="mceRight"></div> + <div class="mceIcon"></div> + </div> + + <div class="mceBottom"> + <div class="mceLeft"></div> + <div class="mceCenter"></div> + <div class="mceRight"></div> + </div> + + <a class="mceMove" href="#"></a> + <a class="mceButton mceOk" href="#">Ok</a> + <a class="mceButton mceCancel" href="#">Cancel</a> + <a class="mceClose" href="#"></a> + </div> + </div> +</div> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/insertdatetime/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/insertdatetime/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..938ce6b17d904764b39fdba7bd16189577e68b18 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/insertdatetime/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.InsertDateTime",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceInsertDate",function(){var d=c._getDateTime(new Date(),a.getParam("plugin_insertdate_dateFormat",a.getLang("insertdatetime.date_fmt")));a.execCommand("mceInsertContent",false,d)});a.addCommand("mceInsertTime",function(){var d=c._getDateTime(new Date(),a.getParam("plugin_insertdate_timeFormat",a.getLang("insertdatetime.time_fmt")));a.execCommand("mceInsertContent",false,d)});a.addButton("insertdate",{title:"insertdatetime.insertdate_desc",cmd:"mceInsertDate"});a.addButton("inserttime",{title:"insertdatetime.inserttime_desc",cmd:"mceInsertTime"})},getInfo:function(){return{longname:"Insert date/time",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getDateTime:function(e,a){var c=this.editor;function b(g,d){g=""+g;if(g.length<d){for(var f=0;f<(d-g.length);f++){g="0"+g}}return g}a=a.replace("%D","%m/%d/%y");a=a.replace("%r","%I:%M:%S %p");a=a.replace("%Y",""+e.getFullYear());a=a.replace("%y",""+e.getYear());a=a.replace("%m",b(e.getMonth()+1,2));a=a.replace("%d",b(e.getDate(),2));a=a.replace("%H",""+b(e.getHours(),2));a=a.replace("%M",""+b(e.getMinutes(),2));a=a.replace("%S",""+b(e.getSeconds(),2));a=a.replace("%I",""+((e.getHours()+11)%12+1));a=a.replace("%p",""+(e.getHours()<12?"AM":"PM"));a=a.replace("%B",""+c.getLang("insertdatetime.months_long").split(",")[e.getMonth()]);a=a.replace("%b",""+c.getLang("insertdatetime.months_short").split(",")[e.getMonth()]);a=a.replace("%A",""+c.getLang("insertdatetime.day_long").split(",")[e.getDay()]);a=a.replace("%a",""+c.getLang("insertdatetime.day_short").split(",")[e.getDay()]);a=a.replace("%%","%");return a}});tinymce.PluginManager.add("insertdatetime",tinymce.plugins.InsertDateTime)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/insertdatetime/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/insertdatetime/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..9ab3135bd5b9e5fed464538ac5fc37b913734a33 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/insertdatetime/editor_plugin_src.js @@ -0,0 +1,80 @@ +/** + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.InsertDateTime', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + ed.addCommand('mceInsertDate', function() { + var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_dateFormat", ed.getLang('insertdatetime.date_fmt'))); + + ed.execCommand('mceInsertContent', false, str); + }); + + ed.addCommand('mceInsertTime', function() { + var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_timeFormat", ed.getLang('insertdatetime.time_fmt'))); + + ed.execCommand('mceInsertContent', false, str); + }); + + ed.addButton('insertdate', {title : 'insertdatetime.insertdate_desc', cmd : 'mceInsertDate'}); + ed.addButton('inserttime', {title : 'insertdatetime.inserttime_desc', cmd : 'mceInsertTime'}); + }, + + getInfo : function() { + return { + longname : 'Insert date/time', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _getDateTime : function(d, fmt) { + var ed = this.editor; + + function addZeros(value, len) { + value = "" + value; + + if (value.length < len) { + for (var i=0; i<(len-value.length); i++) + value = "0" + value; + } + + return value; + }; + + fmt = fmt.replace("%D", "%m/%d/%y"); + fmt = fmt.replace("%r", "%I:%M:%S %p"); + fmt = fmt.replace("%Y", "" + d.getFullYear()); + fmt = fmt.replace("%y", "" + d.getYear()); + fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2)); + fmt = fmt.replace("%d", addZeros(d.getDate(), 2)); + fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2)); + fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2)); + fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2)); + fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1)); + fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM")); + fmt = fmt.replace("%B", "" + ed.getLang("insertdatetime.months_long").split(',')[d.getMonth()]); + fmt = fmt.replace("%b", "" + ed.getLang("insertdatetime.months_short").split(',')[d.getMonth()]); + fmt = fmt.replace("%A", "" + ed.getLang("insertdatetime.day_long").split(',')[d.getDay()]); + fmt = fmt.replace("%a", "" + ed.getLang("insertdatetime.day_short").split(',')[d.getDay()]); + fmt = fmt.replace("%%", "%"); + + return fmt; + } + }); + + // Register plugin + tinymce.PluginManager.add('insertdatetime', tinymce.plugins.InsertDateTime); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/layer/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/layer/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..f88a6dd28d0a89fd9f565934fe9db62d576e3bf3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/layer/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.Layer",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceInsertLayer",c._insertLayer,c);a.addCommand("mceMoveForward",function(){c._move(1)});a.addCommand("mceMoveBackward",function(){c._move(-1)});a.addCommand("mceMakeAbsolute",function(){c._toggleAbsolute()});a.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});a.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});a.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});a.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});a.onInit.add(function(){if(tinymce.isIE){a.getDoc().execCommand("2D-Position",false,true)}});a.onNodeChange.add(c._nodeChange,c);a.onVisualAid.add(c._visualAid,c)},getInfo:function(){return{longname:"Layer",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var c,d;c=this._getParentLayer(e);d=b.dom.getParent(e,"DIV,P,IMG");if(!d){a.setDisabled("absolute",1);a.setDisabled("moveforward",1);a.setDisabled("movebackward",1)}else{a.setDisabled("absolute",0);a.setDisabled("moveforward",!c);a.setDisabled("movebackward",!c);a.setActive("absolute",c&&c.style.position.toLowerCase()=="absolute")}},_visualAid:function(a,c,b){var d=a.dom;tinymce.each(d.select("div,p",c),function(f){if(/^(absolute|relative|static)$/i.test(f.style.position)){if(b){d.addClass(f,"mceItemVisualAid")}else{d.removeClass(f,"mceItemVisualAid")}}})},_move:function(h){var b=this.editor,f,g=[],e=this._getParentLayer(b.selection.getNode()),c=-1,j=-1,a;a=[];tinymce.walk(b.getBody(),function(d){if(d.nodeType==1&&/^(absolute|relative|static)$/i.test(d.style.position)){a.push(d)}},"childNodes");for(f=0;f<a.length;f++){g[f]=a[f].style.zIndex?parseInt(a[f].style.zIndex):0;if(c<0&&a[f]==e){c=f}}if(h<0){for(f=0;f<g.length;f++){if(g[f]<g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{if(g[c]>0){a[c].style.zIndex=g[c]-1}}}else{for(f=0;f<g.length;f++){if(g[f]>g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{a[c].style.zIndex=g[c]+1}}b.execCommand("mceRepaint")},_getParentLayer:function(a){return this.editor.dom.getParent(a,function(b){return b.nodeType==1&&/^(absolute|relative|static)$/i.test(b.style.position)})},_insertLayer:function(){var a=this.editor,b=a.dom.getPos(a.dom.getParent(a.selection.getNode(),"*"));a.dom.add(a.getBody(),"div",{style:{position:"absolute",left:b.x,top:(b.y>20?b.y:20),width:100,height:100},"class":"mceItemVisualAid"},a.selection.getContent()||a.getLang("layer.content"))},_toggleAbsolute:function(){var a=this.editor,b=this._getParentLayer(a.selection.getNode());if(!b){b=a.dom.getParent(a.selection.getNode(),"DIV,P,IMG")}if(b){if(b.style.position.toLowerCase()=="absolute"){a.dom.setStyles(b,{position:"",left:"",top:"",width:"",height:""});a.dom.removeClass(b,"mceItemVisualAid")}else{if(b.style.left==""){b.style.left=20+"px"}if(b.style.top==""){b.style.top=20+"px"}if(b.style.width==""){b.style.width=b.width?(b.width+"px"):"100px"}if(b.style.height==""){b.style.height=b.height?(b.height+"px"):"100px"}b.style.position="absolute";a.addVisual(a.getBody())}a.execCommand("mceRepaint");a.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/layer/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/layer/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..a72f6c36e73eb9106503f9f43860428320210016 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/layer/editor_plugin_src.js @@ -0,0 +1,209 @@ +/** + * $Id: editor_plugin_src.js 652 2008-02-29 13:09:46Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.Layer', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceInsertLayer', t._insertLayer, t); + + ed.addCommand('mceMoveForward', function() { + t._move(1); + }); + + ed.addCommand('mceMoveBackward', function() { + t._move(-1); + }); + + ed.addCommand('mceMakeAbsolute', function() { + t._toggleAbsolute(); + }); + + // Register buttons + ed.addButton('moveforward', {title : 'layer.forward_desc', cmd : 'mceMoveForward'}); + ed.addButton('movebackward', {title : 'layer.backward_desc', cmd : 'mceMoveBackward'}); + ed.addButton('absolute', {title : 'layer.absolute_desc', cmd : 'mceMakeAbsolute'}); + ed.addButton('insertlayer', {title : 'layer.insertlayer_desc', cmd : 'mceInsertLayer'}); + + ed.onInit.add(function() { + if (tinymce.isIE) + ed.getDoc().execCommand('2D-Position', false, true); + }); + + ed.onNodeChange.add(t._nodeChange, t); + ed.onVisualAid.add(t._visualAid, t); + }, + + getInfo : function() { + return { + longname : 'Layer', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _nodeChange : function(ed, cm, n) { + var le, p; + + le = this._getParentLayer(n); + p = ed.dom.getParent(n, 'DIV,P,IMG'); + + if (!p) { + cm.setDisabled('absolute', 1); + cm.setDisabled('moveforward', 1); + cm.setDisabled('movebackward', 1); + } else { + cm.setDisabled('absolute', 0); + cm.setDisabled('moveforward', !le); + cm.setDisabled('movebackward', !le); + cm.setActive('absolute', le && le.style.position.toLowerCase() == "absolute"); + } + }, + + // Private methods + + _visualAid : function(ed, e, s) { + var dom = ed.dom; + + tinymce.each(dom.select('div,p', e), function(e) { + if (/^(absolute|relative|static)$/i.test(e.style.position)) { + if (s) + dom.addClass(e, 'mceItemVisualAid'); + else + dom.removeClass(e, 'mceItemVisualAid'); + } + }); + }, + + _move : function(d) { + var ed = this.editor, i, z = [], le = this._getParentLayer(ed.selection.getNode()), ci = -1, fi = -1, nl; + + nl = []; + tinymce.walk(ed.getBody(), function(n) { + if (n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position)) + nl.push(n); + }, 'childNodes'); + + // Find z-indexes + for (i=0; i<nl.length; i++) { + z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex) : 0; + + if (ci < 0 && nl[i] == le) + ci = i; + } + + if (d < 0) { + // Move back + + // Try find a lower one + for (i=0; i<z.length; i++) { + if (z[i] < z[ci]) { + fi = i; + break; + } + } + + if (fi > -1) { + nl[ci].style.zIndex = z[fi]; + nl[fi].style.zIndex = z[ci]; + } else { + if (z[ci] > 0) + nl[ci].style.zIndex = z[ci] - 1; + } + } else { + // Move forward + + // Try find a higher one + for (i=0; i<z.length; i++) { + if (z[i] > z[ci]) { + fi = i; + break; + } + } + + if (fi > -1) { + nl[ci].style.zIndex = z[fi]; + nl[fi].style.zIndex = z[ci]; + } else + nl[ci].style.zIndex = z[ci] + 1; + } + + ed.execCommand('mceRepaint'); + }, + + _getParentLayer : function(n) { + return this.editor.dom.getParent(n, function(n) { + return n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position); + }); + }, + + _insertLayer : function() { + var ed = this.editor, p = ed.dom.getPos(ed.dom.getParent(ed.selection.getNode(), '*')); + + ed.dom.add(ed.getBody(), 'div', { + style : { + position : 'absolute', + left : p.x, + top : (p.y > 20 ? p.y : 20), + width : 100, + height : 100 + }, + 'class' : 'mceItemVisualAid' + }, ed.selection.getContent() || ed.getLang('layer.content')); + }, + + _toggleAbsolute : function() { + var ed = this.editor, le = this._getParentLayer(ed.selection.getNode()); + + if (!le) + le = ed.dom.getParent(ed.selection.getNode(), 'DIV,P,IMG'); + + if (le) { + if (le.style.position.toLowerCase() == "absolute") { + ed.dom.setStyles(le, { + position : '', + left : '', + top : '', + width : '', + height : '' + }); + + ed.dom.removeClass(le, 'mceItemVisualAid'); + } else { + if (le.style.left == "") + le.style.left = 20 + 'px'; + + if (le.style.top == "") + le.style.top = 20 + 'px'; + + if (le.style.width == "") + le.style.width = le.width ? (le.width + 'px') : '100px'; + + if (le.style.height == "") + le.style.height = le.height ? (le.height + 'px') : '100px'; + + le.style.position = "absolute"; + ed.addVisual(ed.getBody()); + } + + ed.execCommand('mceRepaint'); + ed.nodeChanged(); + } + } + }); + + // Register plugin + tinymce.PluginManager.add('layer', tinymce.plugins.Layer); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/css/content.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/css/content.css new file mode 100644 index 0000000000000000000000000000000000000000..1bf6a758696c2a69384e7eb4595ea156d86c6ccc --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/css/content.css @@ -0,0 +1,6 @@ +.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;} +.mceItemShockWave {background-image: url(../img/shockwave.gif);} +.mceItemFlash {background-image:url(../img/flash.gif);} +.mceItemQuickTime {background-image:url(../img/quicktime.gif);} +.mceItemWindowsMedia {background-image:url(../img/windowsmedia.gif);} +.mceItemRealMedia {background-image:url(../img/realmedia.gif);} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/css/media.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/css/media.css new file mode 100644 index 0000000000000000000000000000000000000000..2d087944dece9120429389d57ca27d894de5ee1f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/css/media.css @@ -0,0 +1,16 @@ +#id, #name, #hspace, #vspace, #class_name, #align { width: 100px } +#hspace, #vspace { width: 50px } +#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px } +#flash_base, #flash_flashvars { width: 240px } +#width, #height { width: 40px } +#src, #media_type { width: 250px } +#class { width: 120px } +#prev { margin: 0; border: 1px solid black; width: 380px; height: 230px; overflow: auto } +.panel_wrapper div.current { height: 390px; overflow: auto } +#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none } +.mceAddSelectValue { background-color: #DDDDDD } +#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px } +#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px } +#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px } +#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px } +#qt_qtsrc { width: 200px } diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..951d1e43ad23534230e458a5b0c6a1fd44eaddb8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.MediaPlugin",{init:function(b,c){var e=this;e.editor=b;e.url=c;function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(g.className)}b.onPreInit.add(function(){b.serializer.addRules("param[name|value|_mce_value]")});b.addCommand("mceMedia",function(){b.windowManager.open({file:c+"/media.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("media",{title:"media.desc",cmd:"mceMedia"});b.onNodeChange.add(function(h,g,i){g.setActive("media",i.nodeName=="IMG"&&f(i))});b.onInit.add(function(){var g={mceItemFlash:"flash",mceItemShockWave:"shockwave",mceItemWindowsMedia:"windowsmedia",mceItemQuickTime:"quicktime",mceItemRealMedia:"realmedia"};b.selection.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.selection.onBeforeSetContent.add(e._objectsToSpans,e);if(b.settings.content_css!==false){b.dom.loadCSS(c+"/css/content.css")}if(b.theme.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..faa0cf73032ffb58f4f166316a26923e82e7f2ee --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/editor_plugin_src.js @@ -0,0 +1,405 @@ +/** + * $Id: editor_plugin_src.js 1037 2009-03-02 16:41:15Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.MediaPlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + function isMediaElm(n) { + return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className); + }; + + ed.onPreInit.add(function() { + // Force in _value parameter this extra parameter is required for older Opera versions + ed.serializer.addRules('param[name|value|_mce_value]'); + }); + + // Register commands + ed.addCommand('mceMedia', function() { + ed.windowManager.open({ + file : url + '/media.htm', + width : 430 + parseInt(ed.getLang('media.delta_width', 0)), + height : 470 + parseInt(ed.getLang('media.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'}); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n)); + }); + + ed.onInit.add(function() { + var lo = { + mceItemFlash : 'flash', + mceItemShockWave : 'shockwave', + mceItemWindowsMedia : 'windowsmedia', + mceItemQuickTime : 'quicktime', + mceItemRealMedia : 'realmedia' + }; + + ed.selection.onSetContent.add(function() { + t._spansToImgs(ed.getBody()); + }); + + ed.selection.onBeforeSetContent.add(t._objectsToSpans, t); + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(url + "/css/content.css"); + + if (ed.theme.onResolveName) { + ed.theme.onResolveName.add(function(th, o) { + if (o.name == 'img') { + each(lo, function(v, k) { + if (ed.dom.hasClass(o.node, k)) { + o.name = v; + o.title = ed.dom.getAttrib(o.node, 'title'); + return false; + } + }); + } + }); + } + + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) { + m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'}); + } + }); + } + }); + + ed.onBeforeSetContent.add(t._objectsToSpans, t); + + ed.onSetContent.add(function() { + t._spansToImgs(ed.getBody()); + }); + + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + if (o.set) { + t._spansToImgs(o.node); + + each(dom.select('IMG', o.node), function(n) { + var p; + + if (isMediaElm(n)) { + p = t._parse(n.title); + dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100)); + dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100)); + } + }); + } + + if (o.get) { + each(dom.select('IMG', o.node), function(n) { + var ci, cb, mt; + + if (ed.getParam('media_use_script')) { + if (isMediaElm(n)) + n.className = n.className.replace(/mceItem/g, 'mceTemp'); + + return; + } + + switch (n.className) { + case 'mceItemFlash': + ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'application/x-shockwave-flash'; + break; + + case 'mceItemShockWave': + ci = '166b1bca-3f9c-11cf-8075-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + mt = 'application/x-director'; + break; + + case 'mceItemWindowsMedia': + ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6'; + cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + mt = 'application/x-mplayer2'; + break; + + case 'mceItemQuickTime': + ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b'; + cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + mt = 'video/quicktime'; + break; + + case 'mceItemRealMedia': + ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (ci) { + dom.replace(t._buildObj({ + classid : ci, + codebase : cb, + type : mt + }, n), n); + } + }); + } + }); + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/_mce_value=/g, 'value='); + }); + + function getAttr(s, n) { + n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); + + return n ? ed.dom.decode(n[1]) : ''; + }; + + ed.onPostProcess.add(function(ed, o) { + if (ed.getParam('media_use_script')) { + o.content = o.content.replace(/<img[^>]+>/g, function(im) { + var cl = getAttr(im, 'class'); + + if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) { + at = t._parse(getAttr(im, 'title')); + at.width = getAttr(im, 'width'); + at.height = getAttr(im, 'height'); + im = '<script type="text/javascript">write' + cl.substring(7) + '({' + t._serialize(at) + '});</script>'; + } + + return im; + }); + } + }); + }, + + getInfo : function() { + return { + longname : 'Media', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + _objectsToSpans : function(ed, o) { + var t = this, h = o.content; + + h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { + var o = t._parse(c); + + return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + t.url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />' + }); + + h = h.replace(/<object([^>]*)>/gi, '<span class="mceItemObject" $1>'); + h = h.replace(/<embed([^>]*)\/?>/gi, '<span class="mceItemEmbed" $1></span>'); + h = h.replace(/<embed([^>]*)>/gi, '<span class="mceItemEmbed" $1>'); + h = h.replace(/<\/(object)([^>]*)>/gi, '</span>'); + h = h.replace(/<\/embed>/gi, ''); + h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<span ' + b.replace(/value=/gi, '_mce_value=') + ' class="mceItemParam"></span>'}); + h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam"></span>'); + + o.content = h; + }, + + _buildObj : function(o, n) { + var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title), stc; + + stc = ed.getParam('media_strict', true) && o.type == 'application/x-shockwave-flash'; + + p.width = o.width = dom.getAttrib(n, 'width') || 100; + p.height = o.height = dom.getAttrib(n, 'height') || 100; + + if (p.src) + p.src = ed.convertURL(p.src, 'src', n); + + if (stc) { + ob = dom.create('span', { + id : p.id, + mce_name : 'object', + type : 'application/x-shockwave-flash', + data : p.src, + style : dom.getAttrib(n, 'style'), + width : o.width, + height : o.height + }); + } else { + ob = dom.create('span', { + id : p.id, + mce_name : 'object', + classid : "clsid:" + o.classid, + style : dom.getAttrib(n, 'style'), + codebase : o.codebase, + width : o.width, + height : o.height + }); + } + + each (p, function(v, k) { + if (!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(k)) { + // Use url instead of src in IE for Windows media + if (o.type == 'application/x-mplayer2' && k == 'src' && !p.url) + k = 'url'; + + if (v) + dom.add(ob, 'span', {mce_name : 'param', name : k, '_mce_value' : v}); + } + }); + + if (!stc) + dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p)); + + return ob; + }, + + _spansToImgs : function(p) { + var t = this, dom = t.editor.dom, im, ci; + + each(dom.select('span', p), function(n) { + // Convert object into image + if (dom.getAttrib(n, 'class') == 'mceItemObject') { + ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, ''); + + switch (ci) { + case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': + case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': + case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + + return; + } + + // Convert embed into image + if (dom.getAttrib(n, 'class') == 'mceItemEmbed') { + switch (dom.getAttrib(n, 'type')) { + case 'application/x-shockwave-flash': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'application/x-director': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'application/x-mplayer2': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'video/quicktime': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'audio/x-pn-realaudio-plugin': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + } + }); + }, + + _createImg : function(cl, n) { + var im, dom = this.editor.dom, pa = {}, ti = '', args; + + args = ['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality']; + + // Create image + im = dom.create('img', { + src : this.url + '/img/trans.gif', + width : dom.getAttrib(n, 'width') || 100, + height : dom.getAttrib(n, 'height') || 100, + style : dom.getAttrib(n, 'style'), + 'class' : cl + }); + + // Setup base parameters + each(args, function(na) { + var v = dom.getAttrib(n, na); + + if (v) + pa[na] = v; + }); + + // Add optional parameters + each(dom.select('span', n), function(n) { + if (dom.hasClass(n, 'mceItemParam')) + pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_mce_value'); + }); + + // Use src not movie + if (pa.movie) { + pa.src = pa.movie; + delete pa.movie; + } + + // Merge with embed args + n = dom.select('.mceItemEmbed', n)[0]; + if (n) { + each(args, function(na) { + var v = dom.getAttrib(n, na); + + if (v && !pa[na]) + pa[na] = v; + }); + } + + delete pa.width; + delete pa.height; + + im.title = this._serialize(pa); + + return im; + }, + + _parse : function(s) { + return tinymce.util.JSON.parse('{' + s + '}'); + }, + + _serialize : function(o) { + return tinymce.util.JSON.serialize(o).replace(/[{}]/g, ''); + } + }); + + // Register plugin + tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/flash.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/flash.gif new file mode 100644 index 0000000000000000000000000000000000000000..cb192e6ceda8d19ad8e7d08dd1cfde0aa72ead2a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/flash.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/flv_player.swf b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/flv_player.swf new file mode 100644 index 0000000000000000000000000000000000000000..042c2ab969e98a6fdbe08848c4a73bd2c41de906 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/flv_player.swf differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/quicktime.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/quicktime.gif new file mode 100644 index 0000000000000000000000000000000000000000..3b0499145b16138249f653a1a3f2c80230fb292c Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/quicktime.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/realmedia.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/realmedia.gif new file mode 100644 index 0000000000000000000000000000000000000000..fdfe0b9ac05869ae845fdd828eaad97cc0c69dbc Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/realmedia.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/shockwave.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/shockwave.gif new file mode 100644 index 0000000000000000000000000000000000000000..5f235dfc7363bd4957b5fe352e16a7eee9a38574 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/shockwave.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/trans.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/trans.gif new file mode 100644 index 0000000000000000000000000000000000000000..388486517fa8da13ebd150e8f65d5096c3e10c3a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/trans.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/windowsmedia.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/windowsmedia.gif new file mode 100644 index 0000000000000000000000000000000000000000..ab50f2d887a0843b116ef598e5a005e5601d18d0 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/img/windowsmedia.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/js/embed.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/js/embed.js new file mode 100644 index 0000000000000000000000000000000000000000..f8dc810527b43e3403bfbe1e147399a06dfdf5b5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/js/embed.js @@ -0,0 +1,73 @@ +/** + * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. + */ + +function writeFlash(p) { + writeEmbed( + 'D27CDB6E-AE6D-11cf-96B8-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'application/x-shockwave-flash', + p + ); +} + +function writeShockWave(p) { + writeEmbed( + '166B1BCA-3F9C-11CF-8075-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', + 'application/x-director', + p + ); +} + +function writeQuickTime(p) { + writeEmbed( + '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', + 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', + 'video/quicktime', + p + ); +} + +function writeRealMedia(p) { + writeEmbed( + 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'audio/x-pn-realaudio-plugin', + p + ); +} + +function writeWindowsMedia(p) { + p.url = p.src; + writeEmbed( + '6BF52A52-394A-11D3-B153-00C04F79FAA6', + 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', + 'application/x-mplayer2', + p + ); +} + +function writeEmbed(cls, cb, mt, p) { + var h = '', n; + + h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; + h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : ''; + h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : ''; + h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : ''; + h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : ''; + h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : ''; + h += '>'; + + for (n in p) + h += '<param name="' + n + '" value="' + p[n] + '">'; + + h += '<embed type="' + mt + '"'; + + for (n in p) + h += n + '="' + p[n] + '" '; + + h += '></embed></object>'; + + document.write(h); +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/js/media.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/js/media.js new file mode 100644 index 0000000000000000000000000000000000000000..86cfa98563d829fed029f6bc164bc4bc6493b0ef --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/js/media.js @@ -0,0 +1,630 @@ +tinyMCEPopup.requireLangPack(); + +var oldWidth, oldHeight, ed, url; + +if (url = tinyMCEPopup.getParam("media_external_list_url")) + document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>'); + +function init() { + var pl = "", f, val; + var type = "flash", fe, i; + + ed = tinyMCEPopup.editor; + + tinyMCEPopup.resizeToInnerSize(); + f = document.forms[0] + + fe = ed.selection.getNode(); + if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + pl = fe.title; + + switch (ed.dom.getAttrib(fe, 'class')) { + case 'mceItemFlash': + type = 'flash'; + break; + + case 'mceItemFlashVideo': + type = 'flv'; + break; + + case 'mceItemShockWave': + type = 'shockwave'; + break; + + case 'mceItemWindowsMedia': + type = 'wmp'; + break; + + case 'mceItemQuickTime': + type = 'qt'; + break; + + case 'mceItemRealMedia': + type = 'rmp'; + break; + } + + document.forms[0].insert.value = ed.getLang('update', 'Insert', true); + } + + document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); + document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var html = getMediaListHTML('medialist','src','media','media'); + if (html == "") + document.getElementById("linklistrow").style.display = 'none'; + else + document.getElementById("linklistcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('filebrowser')) + document.getElementById('src').style.width = '230px'; + + // Setup form + if (pl != "") { + pl = tinyMCEPopup.editor.plugins.media._parse(pl); + + switch (type) { + case "flash": + setBool(pl, 'flash', 'play'); + setBool(pl, 'flash', 'loop'); + setBool(pl, 'flash', 'menu'); + setBool(pl, 'flash', 'swliveconnect'); + setStr(pl, 'flash', 'quality'); + setStr(pl, 'flash', 'scale'); + setStr(pl, 'flash', 'salign'); + setStr(pl, 'flash', 'wmode'); + setStr(pl, 'flash', 'base'); + setStr(pl, 'flash', 'flashvars'); + break; + + case "qt": + setBool(pl, 'qt', 'loop'); + setBool(pl, 'qt', 'autoplay'); + setBool(pl, 'qt', 'cache'); + setBool(pl, 'qt', 'controller'); + setBool(pl, 'qt', 'correction'); + setBool(pl, 'qt', 'enablejavascript'); + setBool(pl, 'qt', 'kioskmode'); + setBool(pl, 'qt', 'autohref'); + setBool(pl, 'qt', 'playeveryframe'); + setBool(pl, 'qt', 'tarsetcache'); + setStr(pl, 'qt', 'scale'); + setStr(pl, 'qt', 'starttime'); + setStr(pl, 'qt', 'endtime'); + setStr(pl, 'qt', 'tarset'); + setStr(pl, 'qt', 'qtsrcchokespeed'); + setStr(pl, 'qt', 'volume'); + setStr(pl, 'qt', 'qtsrc'); + break; + + case "shockwave": + setBool(pl, 'shockwave', 'sound'); + setBool(pl, 'shockwave', 'progress'); + setBool(pl, 'shockwave', 'autostart'); + setBool(pl, 'shockwave', 'swliveconnect'); + setStr(pl, 'shockwave', 'swvolume'); + setStr(pl, 'shockwave', 'swstretchstyle'); + setStr(pl, 'shockwave', 'swstretchhalign'); + setStr(pl, 'shockwave', 'swstretchvalign'); + break; + + case "wmp": + setBool(pl, 'wmp', 'autostart'); + setBool(pl, 'wmp', 'enabled'); + setBool(pl, 'wmp', 'enablecontextmenu'); + setBool(pl, 'wmp', 'fullscreen'); + setBool(pl, 'wmp', 'invokeurls'); + setBool(pl, 'wmp', 'mute'); + setBool(pl, 'wmp', 'stretchtofit'); + setBool(pl, 'wmp', 'windowlessvideo'); + setStr(pl, 'wmp', 'balance'); + setStr(pl, 'wmp', 'baseurl'); + setStr(pl, 'wmp', 'captioningid'); + setStr(pl, 'wmp', 'currentmarker'); + setStr(pl, 'wmp', 'currentposition'); + setStr(pl, 'wmp', 'defaultframe'); + setStr(pl, 'wmp', 'playcount'); + setStr(pl, 'wmp', 'rate'); + setStr(pl, 'wmp', 'uimode'); + setStr(pl, 'wmp', 'volume'); + break; + + case "rmp": + setBool(pl, 'rmp', 'autostart'); + setBool(pl, 'rmp', 'loop'); + setBool(pl, 'rmp', 'autogotourl'); + setBool(pl, 'rmp', 'center'); + setBool(pl, 'rmp', 'imagestatus'); + setBool(pl, 'rmp', 'maintainaspect'); + setBool(pl, 'rmp', 'nojava'); + setBool(pl, 'rmp', 'prefetch'); + setBool(pl, 'rmp', 'shuffle'); + setStr(pl, 'rmp', 'console'); + setStr(pl, 'rmp', 'controls'); + setStr(pl, 'rmp', 'numloop'); + setStr(pl, 'rmp', 'scriptcallbacks'); + break; + } + + setStr(pl, null, 'src'); + setStr(pl, null, 'id'); + setStr(pl, null, 'name'); + setStr(pl, null, 'vspace'); + setStr(pl, null, 'hspace'); + setStr(pl, null, 'bgcolor'); + setStr(pl, null, 'align'); + setStr(pl, null, 'width'); + setStr(pl, null, 'height'); + + if ((val = ed.dom.getAttrib(fe, "width")) != "") + pl.width = f.width.value = val; + + if ((val = ed.dom.getAttrib(fe, "height")) != "") + pl.height = f.height.value = val; + + oldWidth = pl.width ? parseInt(pl.width) : 0; + oldHeight = pl.height ? parseInt(pl.height) : 0; + } else + oldWidth = oldHeight = 0; + + selectByValue(f, 'media_type', type); + changedType(type); + updateColor('bgcolor_pick', 'bgcolor'); + + TinyMCE_EditableSelects.init(); + generatePreview(); +} + +function insertMedia() { + var fe, f = document.forms[0], h; + + tinyMCEPopup.restoreSelection(); + + if (!AutoValidator.validate(f)) { + tinyMCEPopup.alert(ed.getLang('invalid_data')); + return false; + } + + f.width.value = f.width.value == "" ? 100 : f.width.value; + f.height.value = f.height.value == "" ? 100 : f.height.value; + + fe = ed.selection.getNode(); + if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + fe.className = "mceItemFlash"; + break; + + case "flv": + fe.className = "mceItemFlashVideo"; + break; + + case "shockwave": + fe.className = "mceItemShockWave"; + break; + + case "qt": + fe.className = "mceItemQuickTime"; + break; + + case "wmp": + fe.className = "mceItemWindowsMedia"; + break; + + case "rmp": + fe.className = "mceItemRealMedia"; + break; + } + + if (fe.width != f.width.value || fe.height != f.height.value) + ed.execCommand('mceRepaint'); + + fe.title = serializeParameters(); + fe.width = f.width.value; + fe.height = f.height.value; + fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : ''); + fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : ''); + fe.align = f.align.options[f.align.selectedIndex].value; + } else { + h = '<img src="' + tinyMCEPopup.getWindowArg("plugin_url") + '/img/trans.gif"' ; + + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + h += ' class="mceItemFlash"'; + break; + + case "flv": + h += ' class="mceItemFlashVideo"'; + break; + + case "shockwave": + h += ' class="mceItemShockWave"'; + break; + + case "qt": + h += ' class="mceItemQuickTime"'; + break; + + case "wmp": + h += ' class="mceItemWindowsMedia"'; + break; + + case "rmp": + h += ' class="mceItemRealMedia"'; + break; + } + + h += ' title="' + serializeParameters() + '"'; + h += ' width="' + f.width.value + '"'; + h += ' height="' + f.height.value + '"'; + h += ' align="' + f.align.options[f.align.selectedIndex].value + '"'; + + h += ' />'; + + ed.execCommand('mceInsertContent', false, h); + } + + tinyMCEPopup.close(); +} + +function updatePreview() { + var f = document.forms[0], type; + + f.width.value = f.width.value || '320'; + f.height.value = f.height.value || '240'; + + type = getType(f.src.value); + selectByValue(f, 'media_type', type); + changedType(type); + generatePreview(); +} + +function getMediaListHTML() { + if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) { + var html = ""; + + html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;updatePreview();">'; + html += '<option value="">---</option>'; + + for (var i=0; i<tinyMCEMediaList.length; i++) + html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>'; + + html += '</select>'; + + return html; + } + + return ""; +} + +function getType(v) { + var fo, i, c, el, x, f = document.forms[0]; + + fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); + + // YouTube + if (v.match(/watch\?v=(.+)(.*)/)) { + f.width.value = '425'; + f.height.value = '350'; + f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1]; + return 'flash'; + } + + // Google video + if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { + f.width.value = '425'; + f.height.value = '326'; + f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; + return 'flash'; + } + + for (i=0; i<fo.length; i++) { + c = fo[i].split('='); + + el = c[1].split(','); + for (x=0; x<el.length; x++) + if (v.indexOf('.' + el[x]) != -1) + return c[0]; + } + + return null; +} + +function switchType(v) { + var t = getType(v), d = document, f = d.forms[0]; + + if (!t) + return; + + selectByValue(d.forms[0], 'media_type', t); + changedType(t); + + // Update qtsrc also + if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) { + alert(ed.getLang("media_qt_stream_warn")); + + if (f.qt_qtsrc.value == '') + f.qt_qtsrc.value = f.src.value; + } +} + +function changedType(t) { + var d = document; + + d.getElementById('flash_options').style.display = 'none'; + d.getElementById('flv_options').style.display = 'none'; + d.getElementById('qt_options').style.display = 'none'; + d.getElementById('shockwave_options').style.display = 'none'; + d.getElementById('wmp_options').style.display = 'none'; + d.getElementById('rmp_options').style.display = 'none'; + + if (t) + d.getElementById(t + '_options').style.display = 'block'; +} + +function serializeParameters() { + var d = document, f = d.forms[0], s = ''; + + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + s += getBool('flash', 'play', true); + s += getBool('flash', 'loop', true); + s += getBool('flash', 'menu', true); + s += getBool('flash', 'swliveconnect', false); + s += getStr('flash', 'quality'); + s += getStr('flash', 'scale'); + s += getStr('flash', 'salign'); + s += getStr('flash', 'wmode'); + s += getStr('flash', 'base'); + s += getStr('flash', 'flashvars'); + break; + + case "qt": + s += getBool('qt', 'loop', false); + s += getBool('qt', 'autoplay', true); + s += getBool('qt', 'cache', false); + s += getBool('qt', 'controller', true); + s += getBool('qt', 'correction', false, 'none', 'full'); + s += getBool('qt', 'enablejavascript', false); + s += getBool('qt', 'kioskmode', false); + s += getBool('qt', 'autohref', false); + s += getBool('qt', 'playeveryframe', false); + s += getBool('qt', 'targetcache', false); + s += getStr('qt', 'scale'); + s += getStr('qt', 'starttime'); + s += getStr('qt', 'endtime'); + s += getStr('qt', 'target'); + s += getStr('qt', 'qtsrcchokespeed'); + s += getStr('qt', 'volume'); + s += getStr('qt', 'qtsrc'); + break; + + case "shockwave": + s += getBool('shockwave', 'sound'); + s += getBool('shockwave', 'progress'); + s += getBool('shockwave', 'autostart'); + s += getBool('shockwave', 'swliveconnect'); + s += getStr('shockwave', 'swvolume'); + s += getStr('shockwave', 'swstretchstyle'); + s += getStr('shockwave', 'swstretchhalign'); + s += getStr('shockwave', 'swstretchvalign'); + break; + + case "wmp": + s += getBool('wmp', 'autostart', true); + s += getBool('wmp', 'enabled', false); + s += getBool('wmp', 'enablecontextmenu', true); + s += getBool('wmp', 'fullscreen', false); + s += getBool('wmp', 'invokeurls', true); + s += getBool('wmp', 'mute', false); + s += getBool('wmp', 'stretchtofit', false); + s += getBool('wmp', 'windowlessvideo', false); + s += getStr('wmp', 'balance'); + s += getStr('wmp', 'baseurl'); + s += getStr('wmp', 'captioningid'); + s += getStr('wmp', 'currentmarker'); + s += getStr('wmp', 'currentposition'); + s += getStr('wmp', 'defaultframe'); + s += getStr('wmp', 'playcount'); + s += getStr('wmp', 'rate'); + s += getStr('wmp', 'uimode'); + s += getStr('wmp', 'volume'); + break; + + case "rmp": + s += getBool('rmp', 'autostart', false); + s += getBool('rmp', 'loop', false); + s += getBool('rmp', 'autogotourl', true); + s += getBool('rmp', 'center', false); + s += getBool('rmp', 'imagestatus', true); + s += getBool('rmp', 'maintainaspect', false); + s += getBool('rmp', 'nojava', false); + s += getBool('rmp', 'prefetch', false); + s += getBool('rmp', 'shuffle', false); + s += getStr('rmp', 'console'); + s += getStr('rmp', 'controls'); + s += getStr('rmp', 'numloop'); + s += getStr('rmp', 'scriptcallbacks'); + break; + } + + s += getStr(null, 'id'); + s += getStr(null, 'name'); + s += getStr(null, 'src'); + s += getStr(null, 'align'); + s += getStr(null, 'bgcolor'); + s += getInt(null, 'vspace'); + s += getInt(null, 'hspace'); + s += getStr(null, 'width'); + s += getStr(null, 'height'); + + s = s.length > 0 ? s.substring(0, s.length - 1) : s; + + return s; +} + +function setBool(pl, p, n) { + if (typeof(pl[n]) == "undefined") + return; + + document.forms[0].elements[p + "_" + n].checked = pl[n] != 'false'; +} + +function setStr(pl, p, n) { + var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n]; + + if (typeof(pl[n]) == "undefined") + return; + + if (e.type == "text") + e.value = pl[n]; + else + selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]); +} + +function getBool(p, n, d, tv, fv) { + var v = document.forms[0].elements[p + "_" + n].checked; + + tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'"; + fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'"; + + return (v == d) ? '' : n + (v ? ':' + tv + ',' : ":\'" + fv + "\',"); +} + +function getStr(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + if (n == 'src') + v = tinyMCEPopup.editor.convertURL(v, 'src', null); + + return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); +} + +function getInt(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ","); +} + +function jsEncode(s) { + s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); + s = s.replace(new RegExp('"', 'g'), '\\"'); + s = s.replace(new RegExp("'", 'g'), "\\'"); + + return s; +} + +function generatePreview(c) { + var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; + + p.innerHTML = '<!-- x --->'; + + nw = parseInt(f.width.value); + nh = parseInt(f.height.value); + + if (f.width.value != "" && f.height.value != "") { + if (f.constrain.checked) { + if (c == 'width' && oldWidth != 0) { + wp = nw / oldWidth; + nh = Math.round(wp * nh); + f.height.value = nh; + } else if (c == 'height' && oldHeight != 0) { + hp = nh / oldHeight; + nw = Math.round(hp * nw); + f.width.value = nw; + } + } + } + + if (f.width.value != "") + oldWidth = nw; + + if (f.height.value != "") + oldHeight = nh; + + // After constrain + pl = serializeParameters(); + + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + type = 'application/x-shockwave-flash'; + break; + + case "shockwave": + cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + type = 'application/x-director'; + break; + + case "qt": + cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; + codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + type = 'video/quicktime'; + break; + + case "wmp": + cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'application/x-mplayer2'; + break; + + case "rmp": + cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (pl == '') { + p.innerHTML = ''; + return; + } + + pl = tinyMCEPopup.editor.plugins.media._parse(pl); + + if (!pl.src) { + p.innerHTML = ''; + return; + } + + pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src); + pl.width = !pl.width ? 100 : pl.width; + pl.height = !pl.height ? 100 : pl.height; + pl.id = !pl.id ? 'obj' : pl.id; + pl.name = !pl.name ? 'eobj' : pl.name; + pl.align = !pl.align ? '' : pl.align; + + // Avoid annoying warning about insecure items + if (!tinymce.isIE || document.location.protocol != 'https:') { + h += '<object classid="' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">'; + + for (n in pl) { + h += '<param name="' + n + '" value="' + pl[n] + '">'; + + // Add extra url parameter if it's an absolute URL + if (n == 'src' && pl[n].indexOf('://') != -1) + h += '<param name="url" value="' + pl[n] + '" />'; + } + } + + h += '<embed type="' + type + '" '; + + for (n in pl) + h += n + '="' + pl[n] + '" '; + + h += '></embed>'; + + // Avoid annoying warning about insecure items + if (!tinymce.isIE || document.location.protocol != 'https:') + h += '</object>'; + + p.innerHTML = "<!-- x --->" + h; +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..6d0a996f7d923076e2068f7f751d79b295e5bce4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/langs/en_dlg.js @@ -0,0 +1,103 @@ +tinyMCE.addI18n('en.media_dlg',{ +title:"Insert / edit embedded media", +general:"General", +advanced:"Advanced", +file:"File/URL", +list:"List", +size:"Dimensions", +preview:"Preview", +constrain_proportions:"Constrain proportions", +type:"Type", +id:"Id", +name:"Name", +class_name:"Class", +vspace:"V-Space", +hspace:"H-Space", +play:"Auto play", +loop:"Loop", +menu:"Show menu", +quality:"Quality", +scale:"Scale", +align:"Align", +salign:"SAlign", +wmode:"WMode", +bgcolor:"Background", +base:"Base", +flashvars:"Flashvars", +liveconnect:"SWLiveConnect", +autohref:"AutoHREF", +cache:"Cache", +hidden:"Hidden", +controller:"Controller", +kioskmode:"Kiosk mode", +playeveryframe:"Play every frame", +targetcache:"Target cache", +correction:"No correction", +enablejavascript:"Enable JavaScript", +starttime:"Start time", +endtime:"End time", +href:"Href", +qtsrcchokespeed:"Choke speed", +target:"Target", +volume:"Volume", +autostart:"Auto start", +enabled:"Enabled", +fullscreen:"Fullscreen", +invokeurls:"Invoke URLs", +mute:"Mute", +stretchtofit:"Stretch to fit", +windowlessvideo:"Windowless video", +balance:"Balance", +baseurl:"Base URL", +captioningid:"Captioning id", +currentmarker:"Current marker", +currentposition:"Current position", +defaultframe:"Default frame", +playcount:"Play count", +rate:"Rate", +uimode:"UI Mode", +flash_options:"Flash options", +qt_options:"Quicktime options", +wmp_options:"Windows media player options", +rmp_options:"Real media player options", +shockwave_options:"Shockwave options", +autogotourl:"Auto goto URL", +center:"Center", +imagestatus:"Image status", +maintainaspect:"Maintain aspect", +nojava:"No java", +prefetch:"Prefetch", +shuffle:"Shuffle", +console:"Console", +numloop:"Num loops", +controls:"Controls", +scriptcallbacks:"Script callbacks", +swstretchstyle:"Stretch style", +swstretchhalign:"Stretch H-Align", +swstretchvalign:"Stretch V-Align", +sound:"Sound", +progress:"Progress", +qtsrc:"QT Src", +qt_stream_warn:"Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..", +align_top:"Top", +align_right:"Right", +align_bottom:"Bottom", +align_left:"Left", +align_center:"Center", +align_top_left:"Top left", +align_top_right:"Top right", +align_bottom_left:"Bottom left", +align_bottom_right:"Bottom right", +flv_options:"Flash video options", +flv_scalemode:"Scale mode", +flv_buffer:"Buffer", +flv_startimage:"Start image", +flv_starttime:"Start time", +flv_defaultvolume:"Default volumne", +flv_hiddengui:"Hidden GUI", +flv_autostart:"Auto start", +flv_loop:"Loop", +flv_showscalemodes:"Show scale modes", +flv_smoothvideo:"Smooth video", +flv_jscallback:"JS Callback" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/media.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/media.htm new file mode 100644 index 0000000000000000000000000000000000000000..911c03dcc59e4757f0cbddda361e0fa6d5a5dac4 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/media/media.htm @@ -0,0 +1,822 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#media_dlg.title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/media.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/validate.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <link href="css/media.css" rel="stylesheet" type="text/css" /> +</head> +<body style="display: none"> + <form onsubmit="insertMedia();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{#media_dlg.general}</a></span></li> + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#media_dlg.advanced}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#media_dlg.general}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td><label for="media_type">{#media_dlg.type}</label></td> + <td> + <select id="media_type" name="media_type" onchange="changedType(this.value);generatePreview();"> + <option value="flash">Flash</option> + <!-- <option value="flv">Flash video (FLV)</option> --> + <option value="qt">Quicktime</option> + <option value="shockwave">Shockwave</option> + <option value="wmp">Windows Media</option> + <option value="rmp">Real Media</option> + </select> + </td> + </tr> + <tr> + <td><label for="src">{#media_dlg.file}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="switchType(this.value);generatePreview();" /></td> + <td id="filebrowsercontainer"> </td> + </tr> + </table> + </td> + </tr> + <tr id="linklistrow"> + <td><label for="linklist">{#media_dlg.list}</label></td> + <td id="linklistcontainer"><select id="linklist"><option value=""></option></select></td> + </tr> + <tr> + <td><label for="width">{#media_dlg.size}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size" onchange="generatePreview('height');" /></td> + <td> <input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td> + <td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>{#media_dlg.preview}</legend> + <div id="prev"></div> + </fieldset> + </div> + + <div id="advanced_panel" class="panel"> + <fieldset> + <legend>{#media_dlg.advanced}</legend> + + <table border="0" cellpadding="4" cellspacing="0" width="100%"> + <tr> + <td><label for="id">{#media_dlg.id}</label></td> + <td><input type="text" id="id" name="id" onchange="generatePreview();" /></td> + <td><label for="name">{#media_dlg.name}</label></td> + <td><input type="text" id="name" name="name" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="align">{#media_dlg.align}</label></td> + <td> + <select id="align" name="align" onchange="generatePreview();"> + <option value="">{#not_set}</option> + <option value="top">{#media_dlg.align_top}</option> + <option value="right">{#media_dlg.align_right}</option> + <option value="bottom">{#media_dlg.align_bottom}</option> + <option value="left">{#media_dlg.align_left}</option> + </select> + </td> + + <td><label for="bgcolor">{#media_dlg.bgcolor}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');generatePreview();" /></td> + <td id="bgcolor_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="vspace">{#media_dlg.vspace}</label></td> + <td><input type="text" id="vspace" name="vspace" class="number" onchange="generatePreview();" /></td> + <td><label for="hspace">{#media_dlg.hspace}</label></td> + <td><input type="text" id="hspace" name="hspace" class="number" onchange="generatePreview();" /></td> + </tr> + </table> + </fieldset> + + <fieldset id="flash_options"> + <legend>{#media_dlg.flash_options}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td><label for="flash_quality">{#media_dlg.quality}</label></td> + <td> + <select id="flash_quality" name="flash_quality" onchange="generatePreview();"> + <option value="">{#not_set}</option> + <option value="high">high</option> + <option value="low">low</option> + <option value="autolow">autolow</option> + <option value="autohigh">autohigh</option> + <option value="best">best</option> + </select> + </td> + + <td><label for="flash_scale">{#media_dlg.scale}</label></td> + <td> + <select id="flash_scale" name="flash_scale" onchange="generatePreview();"> + <option value="">{#not_set}</option> + <option value="showall">showall</option> + <option value="noborder">noborder</option> + <option value="exactfit">exactfit</option> + <option value="noscale">noscale</option> + </select> + </td> + </tr> + + <tr> + <td><label for="flash_wmode">{#media_dlg.wmode}</label></td> + <td> + <select id="flash_wmode" name="flash_wmode" onchange="generatePreview();"> + <option value="">{#not_set}</option> + <option value="window">window</option> + <option value="opaque">opaque</option> + <option value="transparent">transparent</option> + </select> + </td> + + <td><label for="flash_salign">{#media_dlg.salign}</label></td> + <td> + <select id="flash_salign" name="flash_salign" onchange="generatePreview();"> + <option value="">{#not_set}</option> + <option value="l">{#media_dlg.align_left}</option> + <option value="t">{#media_dlg.align_top}</option> + <option value="r">{#media_dlg.align_right}</option> + <option value="b">{#media_dlg.align_bottom}</option> + <option value="tl">{#media_dlg.align_top_left}</option> + <option value="tr">{#media_dlg.align_top_right}</option> + <option value="bl">{#media_dlg.align_bottom_left}</option> + <option value="br">{#media_dlg.align_bottom_right}</option> + </select> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="generatePreview();" /></td> + <td><label for="flash_play">{#media_dlg.play}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="generatePreview();" /></td> + <td><label for="flash_loop">{#media_dlg.loop}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></td> + <td><label for="flash_menu">{#media_dlg.menu}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="generatePreview();" /></td> + <td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td> + </tr> + </table> + </td> + </tr> + </table> + + <table> + <tr> + <td><label for="flash_base">{#media_dlg.base}</label></td> + <td><input type="text" id="flash_base" name="flash_base" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td> + <td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="generatePreview();" /></td> + </tr> + </table> + </fieldset> + + <fieldset id="flv_options"> + <legend>{#media_dlg.flv_options}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td><label for="flv_scalemode">{#media_dlg.flv_scalemode}</label></td> + <td> + <select id="flv_scalemode" name="flv_scalemode" onchange="generatePreview();"> + <option value="">{#not_set}</option> + <option value="none">none</option> + <option value="double">double</option> + <option value="full">full</option> + </select> + </td> + + <td><label for="flv_buffer">{#media_dlg.flv_buffer}</label></td> + <td><input type="text" id="flv_buffer" name="flv_buffer" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="flv_startimage">{#media_dlg.flv_startimage}</label></td> + <td><input type="text" id="flv_startimage" name="flv_startimage" onchange="generatePreview();" /></td> + + <td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td> + <td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="flv_defaultvolume">{#media_dlg.flv_defaultvolume}</label></td> + <td><input type="text" id="flv_defaultvolume" name="flv_defaultvolume" onchange="generatePreview();" /></td> + + + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flv_hiddengui" name="flv_hiddengui" checked="checked" onchange="generatePreview();" /></td> + <td><label for="flv_hiddengui">{#media_dlg.flv_hiddengui}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flv_autostart" name="flv_autostart" checked="checked" onchange="generatePreview();" /></td> + <td><label for="flv_autostart">{#media_dlg.flv_autostart}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flv_loop" name="flv_loop" checked="checked" onchange="generatePreview();" /></td> + <td><label for="flv_loop">{#media_dlg.flv_loop}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flv_showscalemodes" name="flv_showscalemodes" onchange="generatePreview();" /></td> + <td><label for="flv_showscalemodes">{#media_dlg.flv_showscalemodes}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flv_smoothvideo" name="flash_flv_flv_smoothvideosmoothvideo" checked="checked" onchange="generatePreview();" /></td> + <td><label for="flv_smoothvideo">{#media_dlg.flv_smoothvideo}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="flv_jscallback" name="flv_jscallback" onchange="generatePreview();" /></td> + <td><label for="flv_jscallback">{#media_dlg.flv_jscallback}</label></td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + + <fieldset id="qt_options"> + <legend>{#media_dlg.qt_options}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_loop" name="qt_loop" onchange="generatePreview();" /></td> + <td><label for="qt_loop">{#media_dlg.loop}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_autoplay" name="qt_autoplay" checked="checked" onchange="generatePreview();" /></td> + <td><label for="qt_autoplay">{#media_dlg.play}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_cache" name="qt_cache" onchange="generatePreview();" /></td> + <td><label for="qt_cache">{#media_dlg.cache}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_controller" name="qt_controller" checked="checked" onchange="generatePreview();" /></td> + <td><label for="qt_controller">{#media_dlg.controller}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_correction" name="qt_correction" onchange="generatePreview();" /></td> + <td><label for="qt_correction">{#media_dlg.correction}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_enablejavascript" name="qt_enablejavascript" onchange="generatePreview();" /></td> + <td><label for="qt_enablejavascript">{#media_dlg.enablejavascript}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_kioskmode" name="qt_kioskmode" onchange="generatePreview();" /></td> + <td><label for="qt_kioskmode">{#media_dlg.kioskmode}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_autohref" name="qt_autohref" onchange="generatePreview();" /></td> + <td><label for="qt_autohref">{#media_dlg.autohref}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_playeveryframe" name="qt_playeveryframe" onchange="generatePreview();" /></td> + <td><label for="qt_playeveryframe">{#media_dlg.playeveryframe}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="qt_targetcache" name="qt_targetcache" onchange="generatePreview();" /></td> + <td><label for="qt_targetcache">{#media_dlg.targetcache}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="qt_scale">{#media_dlg.scale}</label></td> + <td><select id="qt_scale" name="qt_scale" class="mceEditableSelect" onchange="generatePreview();"> + <option value="">{#not_set}</option> + <option value="tofit">tofit</option> + <option value="aspect">aspect</option> + </select> + </td> + + <td colspan="2"> </td> + </tr> + + <tr> + <td><label for="qt_starttime">{#media_dlg.starttime}</label></td> + <td><input type="text" id="qt_starttime" name="qt_starttime" onchange="generatePreview();" /></td> + + <td><label for="qt_endtime">{#media_dlg.endtime}</label></td> + <td><input type="text" id="qt_endtime" name="qt_endtime" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="qt_target">{#media_dlg.target}</label></td> + <td><input type="text" id="qt_target" name="qt_target" onchange="generatePreview();" /></td> + + <td><label for="qt_href">{#media_dlg.href}</label></td> + <td><input type="text" id="qt_href" name="qt_href" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="qt_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td> + <td><input type="text" id="qt_qtsrcchokespeed" name="qt_qtsrcchokespeed" onchange="generatePreview();" /></td> + + <td><label for="qt_volume">{#media_dlg.volume}</label></td> + <td><input type="text" id="qt_volume" name="qt_volume" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="qt_qtsrc">{#media_dlg.qtsrc}</label></td> + <td colspan="4"> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="qt_qtsrc" name="qt_qtsrc" onchange="generatePreview();" /></td> + <td id="qtsrcfilebrowsercontainer"> </td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + + <fieldset id="wmp_options"> + <legend>{#media_dlg.wmp_options}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="wmp_autostart" name="wmp_autostart" checked="checked" onchange="generatePreview();" /></td> + <td><label for="wmp_autostart">{#media_dlg.autostart}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="wmp_enabled" name="wmp_enabled" onchange="generatePreview();" /></td> + <td><label for="wmp_enabled">{#media_dlg.enabled}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="wmp_enablecontextmenu" name="wmp_enablecontextmenu" checked="checked" onchange="generatePreview();" /></td> + <td><label for="wmp_enablecontextmenu">{#media_dlg.menu}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="wmp_fullscreen" name="wmp_fullscreen" onchange="generatePreview();" /></td> + <td><label for="wmp_fullscreen">{#media_dlg.fullscreen}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="wmp_invokeurls" name="wmp_invokeurls" checked="checked" onchange="generatePreview();" /></td> + <td><label for="wmp_invokeurls">{#media_dlg.invokeurls}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="wmp_mute" name="wmp_mute" onchange="generatePreview();" /></td> + <td><label for="wmp_mute">{#media_dlg.mute}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="wmp_stretchtofit" name="wmp_stretchtofit" onchange="generatePreview();" /></td> + <td><label for="wmp_stretchtofit">{#media_dlg.stretchtofit}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="wmp_windowlessvideo" name="wmp_windowlessvideo" onchange="generatePreview();" /></td> + <td><label for="wmp_windowlessvideo">{#media_dlg.windowlessvideo}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="wmp_balance">{#media_dlg.balance}</label></td> + <td><input type="text" id="wmp_balance" name="wmp_balance" onchange="generatePreview();" /></td> + + <td><label for="wmp_baseurl">{#media_dlg.baseurl}</label></td> + <td><input type="text" id="wmp_baseurl" name="wmp_baseurl" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="wmp_captioningid">{#media_dlg.captioningid}</label></td> + <td><input type="text" id="wmp_captioningid" name="wmp_captioningid" onchange="generatePreview();" /></td> + + <td><label for="wmp_currentmarker">{#media_dlg.currentmarker}</label></td> + <td><input type="text" id="wmp_currentmarker" name="wmp_currentmarker" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="wmp_currentposition">{#media_dlg.currentposition}</label></td> + <td><input type="text" id="wmp_currentposition" name="wmp_currentposition" onchange="generatePreview();" /></td> + + <td><label for="wmp_defaultframe">{#media_dlg.defaultframe}</label></td> + <td><input type="text" id="wmp_defaultframe" name="wmp_defaultframe" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="wmp_playcount">{#media_dlg.playcount}</label></td> + <td><input type="text" id="wmp_playcount" name="wmp_playcount" onchange="generatePreview();" /></td> + + <td><label for="wmp_rate">{#media_dlg.rate}</label></td> + <td><input type="text" id="wmp_rate" name="wmp_rate" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="wmp_uimode">{#media_dlg.uimode}</label></td> + <td><input type="text" id="wmp_uimode" name="wmp_uimode" onchange="generatePreview();" /></td> + + <td><label for="wmp_volume">{#media_dlg.volume}</label></td> + <td><input type="text" id="wmp_volume" name="wmp_volume" onchange="generatePreview();" /></td> + </tr> + + </table> + </fieldset> + + <fieldset id="rmp_options"> + <legend>{#media_dlg.rmp_options}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_autostart" name="rmp_autostart" onchange="generatePreview();" /></td> + <td><label for="rmp_autostart">{#media_dlg.autostart}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_loop" name="rmp_loop" onchange="generatePreview();" /></td> + <td><label for="rmp_loop">{#media_dlg.loop}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_autogotourl" name="rmp_autogotourl" checked="checked" onchange="generatePreview();" /></td> + <td><label for="rmp_autogotourl">{#media_dlg.autogotourl}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_center" name="rmp_center" onchange="generatePreview();" /></td> + <td><label for="rmp_center">{#media_dlg.center}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_imagestatus" name="rmp_imagestatus" checked="checked" onchange="generatePreview();" /></td> + <td><label for="rmp_imagestatus">{#media_dlg.imagestatus}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_maintainaspect" name="rmp_maintainaspect" onchange="generatePreview();" /></td> + <td><label for="rmp_maintainaspect">{#media_dlg.maintainaspect}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_nojava" name="rmp_nojava" onchange="generatePreview();" /></td> + <td><label for="rmp_nojava">{#media_dlg.nojava}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_prefetch" name="rmp_prefetch" onchange="generatePreview();" /></td> + <td><label for="rmp_prefetch">{#media_dlg.prefetch}</label></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="rmp_shuffle" name="rmp_shuffle" onchange="generatePreview();" /></td> + <td><label for="rmp_shuffle">{#media_dlg.shuffle}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + + </td> + </tr> + + <tr> + <td><label for="rmp_console">{#media_dlg.console}</label></td> + <td><input type="text" id="rmp_console" name="rmp_console" onchange="generatePreview();" /></td> + + <td><label for="rmp_controls">{#media_dlg.controls}</label></td> + <td><input type="text" id="rmp_controls" name="rmp_controls" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="rmp_numloop">{#media_dlg.numloop}</label></td> + <td><input type="text" id="rmp_numloop" name="rmp_numloop" onchange="generatePreview();" /></td> + + <td><label for="rmp_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td> + <td><input type="text" id="rmp_scriptcallbacks" name="rmp_scriptcallbacks" onchange="generatePreview();" /></td> + </tr> + </table> + </fieldset> + + <fieldset id="shockwave_options"> + <legend>{#media_dlg.shockwave_options}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td> + <td> + <select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="generatePreview();"> + <option value="none">{#not_set}</option> + <option value="meet">Meet</option> + <option value="fill">Fill</option> + <option value="stage">Stage</option> + </select> + </td> + + <td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td> + <td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="generatePreview();" /></td> + </tr> + + <tr> + <td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td> + <td> + <select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="generatePreview();"> + <option value="none">{#not_set}</option> + <option value="left">{#media_dlg.align_left}</option> + <option value="center">{#media_dlg.align_center}</option> + <option value="right">{#media_dlg.align_right}</option> + </select> + </td> + + <td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td> + <td> + <select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="generatePreview();"> + <option value="none">{#not_set}</option> + <option value="meet">Meet</option> + <option value="fill">Fill</option> + <option value="stage">Stage</option> + </select> + </td> + </tr> + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="generatePreview();" checked="checked" /></td> + <td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="generatePreview();" checked="checked" /></td> + <td><label for="shockwave_sound">{#media_dlg.sound}</label></td> + </tr> + </table> + </td> + </tr> + + + <tr> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="generatePreview();" /></td> + <td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td> + </tr> + </table> + </td> + + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="generatePreview();" checked="checked" /></td> + <td><label for="shockwave_progress">{#media_dlg.progress}</label></td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/nonbreaking/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/nonbreaking/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..f2dbbff2bba374860fde9c94744857adb35c1b45 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/nonbreaking/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span class="mceItemHidden mceVisualNbsp">·</span>':" ")});a.addButton("nonbreaking",{title:"nonbreaking.nonbreaking_desc",cmd:"mceNonBreaking"});if(a.getParam("nonbreaking_force_tab")){a.onKeyDown.add(function(d,f){if(tinymce.isIE&&f.keyCode==9){d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");tinymce.dom.Event.cancel(f)}})}},getInfo:function(){return{longname:"Nonbreaking space",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("nonbreaking",tinymce.plugins.Nonbreaking)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/nonbreaking/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/nonbreaking/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..b72375660c317531a795b8c070c86a9c6516b4fa --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/nonbreaking/editor_plugin_src.js @@ -0,0 +1,50 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.Nonbreaking', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceNonBreaking', function() { + ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span class="mceItemHidden mceVisualNbsp">·</span>' : ' '); + }); + + // Register buttons + ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'}); + + if (ed.getParam('nonbreaking_force_tab')) { + ed.onKeyDown.add(function(ed, e) { + if (tinymce.isIE && e.keyCode == 9) { + ed.execCommand('mceNonBreaking'); + ed.execCommand('mceNonBreaking'); + ed.execCommand('mceNonBreaking'); + tinymce.dom.Event.cancel(e); + } + }); + } + }, + + getInfo : function() { + return { + longname : 'Nonbreaking space', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + + // Private methods + }); + + // Register plugin + tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/noneditable/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/noneditable/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..9945cd85802b0e5bf2a124150e7daded16af1e41 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/noneditable/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.dom.Event;tinymce.create("tinymce.plugins.NonEditablePlugin",{init:function(d,e){var f=this,c,b;f.editor=d;c=d.getParam("noneditable_editable_class","mceEditable");b=d.getParam("noneditable_noneditable_class","mceNonEditable");d.onNodeChange.addToTop(function(h,g,k){var j,i;j=h.dom.getParent(h.selection.getStart(),function(l){return h.dom.hasClass(l,b)});i=h.dom.getParent(h.selection.getEnd(),function(l){return h.dom.hasClass(l,b)});if(j||i){f._setDisabled(1);return false}else{f._setDisabled(0)}})},getInfo:function(){return{longname:"Non editable elements",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_block:function(c,d){var b=d.keyCode;if((b>32&&b<41)||(b>111&&b<124)){return}return a.cancel(d)},_setDisabled:function(d){var c=this,b=c.editor;tinymce.each(b.controlManager.controls,function(e){e.setDisabled(d)});if(d!==c.disabled){if(d){b.onKeyDown.addToTop(c._block);b.onKeyPress.addToTop(c._block);b.onKeyUp.addToTop(c._block);b.onPaste.addToTop(c._block)}else{b.onKeyDown.remove(c._block);b.onKeyPress.remove(c._block);b.onKeyUp.remove(c._block);b.onPaste.remove(c._block)}c.disabled=d}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/noneditable/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/noneditable/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..77db577cf611abfaaf68b85641998e9cc54e020f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/noneditable/editor_plugin_src.js @@ -0,0 +1,87 @@ +/** + * $Id: editor_plugin_src.js 743 2008-03-23 17:47:33Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var Event = tinymce.dom.Event; + + tinymce.create('tinymce.plugins.NonEditablePlugin', { + init : function(ed, url) { + var t = this, editClass, nonEditClass; + + t.editor = ed; + editClass = ed.getParam("noneditable_editable_class", "mceEditable"); + nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable"); + + ed.onNodeChange.addToTop(function(ed, cm, n) { + var sc, ec; + + // Block if start or end is inside a non editable element + sc = ed.dom.getParent(ed.selection.getStart(), function(n) { + return ed.dom.hasClass(n, nonEditClass); + }); + + ec = ed.dom.getParent(ed.selection.getEnd(), function(n) { + return ed.dom.hasClass(n, nonEditClass); + }); + + // Block or unblock + if (sc || ec) { + t._setDisabled(1); + return false; + } else + t._setDisabled(0); + }); + }, + + getInfo : function() { + return { + longname : 'Non editable elements', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + _block : function(ed, e) { + var k = e.keyCode; + + // Don't block arrow keys, pg up/down, and F1-F12 + if ((k > 32 && k < 41) || (k > 111 && k < 124)) + return; + + return Event.cancel(e); + }, + + _setDisabled : function(s) { + var t = this, ed = t.editor; + + tinymce.each(ed.controlManager.controls, function(c) { + c.setDisabled(s); + }); + + if (s !== t.disabled) { + if (s) { + ed.onKeyDown.addToTop(t._block); + ed.onKeyPress.addToTop(t._block); + ed.onKeyUp.addToTop(t._block); + ed.onPaste.addToTop(t._block); + } else { + ed.onKeyDown.remove(t._block); + ed.onKeyPress.remove(t._block); + ed.onKeyUp.remove(t._block); + ed.onPaste.remove(t._block); + } + + t.disabled = s; + } + } + }); + + // Register plugin + tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/css/content.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/css/content.css new file mode 100644 index 0000000000000000000000000000000000000000..c949d58cc4795a467174c7bb81119ee3e3d64cce --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/css/content.css @@ -0,0 +1 @@ +.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../img/pagebreak.gif) no-repeat center top;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..a212f696334f9bd4cdfb830b45240b9353cd01d8 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.PageBreakPlugin",{init:function(b,d){var f='<img src="'+d+'/img/trans.gif" class="mcePageBreak mceItemNoResize" />',a="mcePageBreak",c=b.getParam("pagebreak_separator","<!-- pagebreak -->"),e;e=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(g){return"\\"+g}),"g");b.addCommand("mcePageBreak",function(){b.execCommand("mceInsertContent",0,f)});b.addButton("pagebreak",{title:"pagebreak.desc",cmd:a});b.onInit.add(function(){if(b.settings.content_css!==false){b.dom.loadCSS(d+"/css/content.css")}if(b.theme.onResolveName){b.theme.onResolveName.add(function(g,h){if(h.node.nodeName=="IMG"&&b.dom.hasClass(h.node,a)){h.name="pagebreak"}})}});b.onClick.add(function(g,h){h=h.target;if(h.nodeName==="IMG"&&g.dom.hasClass(h,a)){g.selection.select(h)}});b.onNodeChange.add(function(h,g,i){g.setActive("pagebreak",i.nodeName==="IMG"&&h.dom.hasClass(i,a))});b.onBeforeSetContent.add(function(g,h){h.content=h.content.replace(e,f)});b.onPostProcess.add(function(g,h){if(h.get){h.content=h.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mcePageBreak')!==-1){i=c}return i})}})},getInfo:function(){return{longname:"PageBreak",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("pagebreak",tinymce.plugins.PageBreakPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..16f5748279078596f68fdbe79e379bccf30c3e80 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/editor_plugin_src.js @@ -0,0 +1,74 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.PageBreakPlugin', { + init : function(ed, url) { + var pb = '<img src="' + url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE; + + pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g'); + + // Register commands + ed.addCommand('mcePageBreak', function() { + ed.execCommand('mceInsertContent', 0, pb); + }); + + // Register buttons + ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls}); + + ed.onInit.add(function() { + if (ed.settings.content_css !== false) + ed.dom.loadCSS(url + "/css/content.css"); + + if (ed.theme.onResolveName) { + ed.theme.onResolveName.add(function(th, o) { + if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls)) + o.name = 'pagebreak'; + }); + } + }); + + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls)) + ed.selection.select(e); + }); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls)); + }); + + ed.onBeforeSetContent.add(function(ed, o) { + o.content = o.content.replace(pbRE, pb); + }); + + ed.onPostProcess.add(function(ed, o) { + if (o.get) + o.content = o.content.replace(/<img[^>]+>/g, function(im) { + if (im.indexOf('class="mcePageBreak') !== -1) + im = sep; + + return im; + }); + }); + }, + + getInfo : function() { + return { + longname : 'PageBreak', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/img/pagebreak.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/img/pagebreak.gif new file mode 100644 index 0000000000000000000000000000000000000000..acdf4085f3068c4c0a1d6855f4b80dae8bac3068 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/img/pagebreak.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/img/trans.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/img/trans.gif new file mode 100644 index 0000000000000000000000000000000000000000..388486517fa8da13ebd150e8f65d5096c3e10c3a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/pagebreak/img/trans.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..f439463780b206046948320b782491796671c848 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var k=c.dom,j={content:i};e.onPreProcess.dispatch(e,j);j.node=k.create("div",0,j.content);e.onPostProcess.dispatch(e,j);j.content=c.serializer.serialize(j.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(j.content)){e._insertBlockContent(c,k,j.content)}else{e._insert(j.content)}}c.addCommand("mceInsertClipboardContent",function(i,h){g(h)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"}," ");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);g(p.innerHTML);return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var r=o.get("_mcePaste"),q;r.id="_mceRemoved";o.remove(r);r=o.get("_mcePaste")||r;q=(o.select("> span.Apple-style-span div",r)[0]||o.select("> span.Apple-style-span",r)[0]||r).innerHTML;o.remove(r);if(k){j.setRng(k)}g(q)},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}e._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(c,e){var b=e.content,d;function d(f){a(f,function(g){if(g.constructor==RegExp){b=b.replace(g,"")}else{b=b.replace(g[0],g[1])}})}d([/^\s*( )+/g,/( |<br[^>]*>)+\s*$/g]);if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(b)){e.wordContent=true;d([/<!--[\s\S]+?-->/gi,/<\/?(img|font|meta|link|style|span|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|class|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|class|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/<script[^>]+>[\s\S]*?<\/script>/gi,[/ /g,"\u00a0"]])}e.content=b},_postProcess:function(c,e){var b=this,d=b.editor.dom;if(e.wordContent){a(d.select("a",e.node),function(f){if(!f.href||f.href.indexOf("#_Toc")!=-1){d.remove(f,1)}});if(b.editor.getParam("paste_convert_middot_lists",true)){b._convertLists(c,e)}a(d.select("*",e.node),function(f){d.setAttrib(f,"style","")})}if(tinymce.isWebKit){a(d.select("*",e.node),function(f){f.removeAttribute("mce_style")})}},_convertLists:function(e,c){var g=e.editor.dom,f,i,b=-1,d,j=[],h;a(g.select("p",c.node),function(q){var m,r="",o,n,k,l;for(m=q.firstChild;m&&m.nodeType==3;m=m.nextSibling){r+=m.nodeValue}if(/^[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0\u00a0*/.test(r)){o="ul"}if(/^[\s\S]*\w+\.[\s\S]*\u00a0{2,}/.test(r)){o="ol"}if(o){d=parseFloat(q.style.marginLeft||0);if(d>b){j.push(d)}if(!f||o!=h){f=g.create(o);g.insertAfter(f,q)}else{if(d>b){f=i.appendChild(g.create(o))}else{if(d<b){k=tinymce.inArray(j,d);l=g.getParents(f.parentNode,o);f=l[l.length-1-k]||f}}}if(o=="ul"){n=q.innerHTML.replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*( |\u00a0)+\s*/,"")}else{n=q.innerHTML.replace(/^[\s\S]*\w+\.( |\u00a0)+\s*/,"")}i=f.appendChild(g.create("li",0,n));g.remove(q);b=d;h=o}else{f=b=0}})},_insertBlockContent:function(h,e,i){var c,g,d=h.selection,m,j,b,k,f;function l(p){var o;if(tinymce.isIE){o=h.getDoc().body.createTextRange();o.moveToElementText(p);o.collapse(false);o.select()}else{d.select(p,1);d.collapse(false)}}this._insert('<span id="_marker"> </span>',1);g=e.get("_marker");c=e.getParent(g,"p,h1,h2,h3,h4,h5,h6,ul,ol");if(c){g=e.split(c,g);a(e.create("div",0,i).childNodes,function(o){m=g.parentNode.insertBefore(o.cloneNode(true),g)});l(m)}else{e.setOuterHTML(g,i);d.select(h.getBody(),1);d.collapse(0)}e.remove("_marker");j=d.getStart();b=e.getViewPort(h.getWin());k=h.dom.getPos(j).y;f=j.clientHeight;if(k<b.y||k+f>b.y+b.h){h.getDoc().body.scrollTop=k<b.y?k:k-b.h+25}},_insert:function(d,b){var c=this.editor;if(!c.selection.isCollapsed()){c.execCommand("Delete")}c.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,d,{skip_undo:b})},_legacySupport:function(){var c=this,b=c.editor;a(["mcePasteText","mcePasteWord"],function(d){b.addCommand(d,function(){b.windowManager.open({file:c.url+(d=="mcePasteText"?"/pastetext.htm":"/pasteword.htm"),width:450,height:400,inline:1})})});b.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});b.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"});b.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..a6651ec2faf6d5a6a63ff82e83bea6a239366d58 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/editor_plugin_src.js @@ -0,0 +1,402 @@ +/** + * $Id: editor_plugin_src.js 1112 2009-04-30 20:03:51Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.PastePlugin', { + init : function(ed, url) { + var t = this, cb; + + t.editor = ed; + t.url = url; + + // Setup plugin events + t.onPreProcess = new tinymce.util.Dispatcher(t); + t.onPostProcess = new tinymce.util.Dispatcher(t); + + // Register default handlers + t.onPreProcess.add(t._preProcess); + t.onPostProcess.add(t._postProcess); + + // Register optional preprocess handler + t.onPreProcess.add(function(pl, o) { + ed.execCallback('paste_preprocess', pl, o); + }); + + // Register optional postprocess + t.onPostProcess.add(function(pl, o) { + ed.execCallback('paste_postprocess', pl, o); + }); + + // This function executes the process handlers and inserts the contents + function process(h) { + var dom = ed.dom, o = {content : h}; + + // Execute pre process handlers + t.onPreProcess.dispatch(t, o); + + // Create DOM structure + o.node = dom.create('div', 0, o.content); + + // Execute post process handlers + t.onPostProcess.dispatch(t, o); + + // Serialize content + o.content = ed.serializer.serialize(o.node, {getInner : 1}); + + // Insert cleaned content. We need to handle insertion of contents containing block elements separatly + if (/<(p|h[1-6]|ul|ol)/.test(o.content)) + t._insertBlockContent(ed, dom, o.content); + else + t._insert(o.content); + }; + + // Add command for external usage + ed.addCommand('mceInsertClipboardContent', function(u, v) { + process(v); + }); + + // This function grabs the contents from the clipboard by adding a + // hidden div and placing the caret inside it and after the browser paste + // is done it grabs that contents and processes that + function grabContent(e) { + var n, or, rng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY; + + if (dom.get('_mcePaste')) + return; + + // Create container to paste into + n = dom.add(body, 'div', {id : '_mcePaste'}, ' '); + + // If contentEditable mode we need to find out the position of the closest element + if (body != ed.getDoc().body) + posY = dom.getPos(ed.selection.getStart(), body).y; + else + posY = body.scrollTop; + + // Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles + dom.setStyles(n, { + position : 'absolute', + left : -10000, + top : posY, + width : 1, + height : 1, + overflow : 'hidden' + }); + + if (tinymce.isIE) { + // Select the container + rng = dom.doc.body.createTextRange(); + rng.moveToElementText(n); + rng.execCommand('Paste'); + + // Remove container + dom.remove(n); + + // Process contents + process(n.innerHTML); + + return tinymce.dom.Event.cancel(e); + } else { + or = ed.selection.getRng(); + + // Move caret into hidden div + n = n.firstChild; + rng = ed.getDoc().createRange(); + rng.setStart(n, 0); + rng.setEnd(n, 1); + sel.setRng(rng); + + // Wait a while and grab the pasted contents + window.setTimeout(function() { + var n = dom.get('_mcePaste'), h; + + // Webkit clones the _mcePaste div for some odd reason so this will ensure that we get the real new div not the old empty one + n.id = '_mceRemoved'; + dom.remove(n); + n = dom.get('_mcePaste') || n; + + // Grab the HTML contents + // We need to look for a apple style wrapper on webkit it also adds a div wrapper if you copy/paste the body of the editor + // It's amazing how strange the contentEditable mode works in WebKit + h = (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML; + + // Remove hidden div and restore selection + dom.remove(n); + + // Restore the old selection + if (or) + sel.setRng(or); + + process(h); + }, 0); + } + }; + + // Check if we should use the new auto process method + if (ed.getParam('paste_auto_cleanup_on_paste', true)) { + // Is it's Opera or older FF use key handler + if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) { + ed.onKeyDown.add(function(ed, e) { + if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45)) + grabContent(e); + }); + } else { + // Grab contents on paste event on Gecko and WebKit + ed.onPaste.addToTop(function(ed, e) { + return grabContent(e); + }); + } + } + + // Add legacy support + t._legacySupport(); + }, + + getInfo : function() { + return { + longname : 'Paste text/word', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + _preProcess : function(pl, o) { + var h = o.content, process; + + //console.log('Before preprocess:' + o.content); + + function process(items) { + each(items, function(v) { + // Remove or replace + if (v.constructor == RegExp) + h = h.replace(v, ''); + else + h = h.replace(v[0], v[1]); + }); + }; + + // Process away some basic content + process([ + /^\s*( )+/g, // nbsp entities at the start of contents + /( |<br[^>]*>)+\s*$/g // nbsp entities at the end of contents + ]); + + // Detect Word content and process it more agressive + if (/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(h)) { + o.wordContent = true; // Mark the pasted contents as word specific content + //console.log('Word contents detected.'); + + process([ + /<!--[\s\S]+?-->/gi, // Word comments + /<\/?(img|font|meta|link|style|span|div|v:\w+)[^>]*>/gi, // Remove some tags including VML content + /<\\?\?xml[^>]*>/gi, // XML namespace declarations + /<\/?o:[^>]*>/gi, // MS namespaced elements <o:tag> + / (id|name|class|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi, // on.., class, style and language attributes with quotes + / (id|name|class|language|type|on\w+|v:\w+)=(\w+)/gi, // on.., class, style and language attributes without quotes (IE) + [/<(\/?)s>/gi, '<$1strike>'], // Convert <s> into <strike> for line-though + /<script[^>]+>[\s\S]*?<\/script>/gi, // All scripts elements for msoShowComment for example + [/ /g, '\u00a0'] // Replace nsbp entites to char since it's easier to handle + ]); + } + + //console.log('After preprocess:' + h); + + o.content = h; + }, + + /** + * Various post process items. + */ + _postProcess : function(pl, o) { + var t = this, dom = t.editor.dom; + + if (o.wordContent) { + // Remove named anchors or TOC links + each(dom.select('a', o.node), function(a) { + if (!a.href || a.href.indexOf('#_Toc') != -1) + dom.remove(a, 1); + }); + + if (t.editor.getParam('paste_convert_middot_lists', true)) + t._convertLists(pl, o); + + // Remove all styles + each(dom.select('*', o.node), function(el) { + dom.setAttrib(el, 'style', ''); + }); + } + + if (tinymce.isWebKit) { + // We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." /> + // Removing the mce_style that contains the real value will force the Serializer engine to compress the styles + each(dom.select('*', o.node), function(el) { + el.removeAttribute('mce_style'); + }); + } + }, + + /** + * Converts the most common bullet and number formats in Office into a real semantic UL/LI list. + */ + _convertLists : function(pl, o) { + var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType; + + // Convert middot lists into real scemantic lists + each(dom.select('p', o.node), function(p) { + var sib, val = '', type, html, idx, parents; + + // Get text node value at beginning of paragraph + for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling) + val += sib.nodeValue; + + // Detect unordered lists look for bullets + if (/^[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0\u00a0*/.test(val)) + type = 'ul'; + + // Detect ordered lists 1., a. or ixv. + if (/^[\s\S]*\w+\.[\s\S]*\u00a0{2,}/.test(val)) + type = 'ol'; + + // Check if node value matches the list pattern: o + if (type) { + margin = parseFloat(p.style.marginLeft || 0); + + if (margin > lastMargin) + levels.push(margin); + + if (!listElm || type != lastType) { + listElm = dom.create(type); + dom.insertAfter(listElm, p); + } else { + // Nested list element + if (margin > lastMargin) { + listElm = li.appendChild(dom.create(type)); + } else if (margin < lastMargin) { + // Find parent level based on margin value + idx = tinymce.inArray(levels, margin); + parents = dom.getParents(listElm.parentNode, type); + listElm = parents[parents.length - 1 - idx] || listElm; + } + } + + if (type == 'ul') + html = p.innerHTML.replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*( |\u00a0)+\s*/, ''); + else + html = p.innerHTML.replace(/^[\s\S]*\w+\.( |\u00a0)+\s*/, ''); + + li = listElm.appendChild(dom.create('li', 0, html)); + dom.remove(p); + + lastMargin = margin; + lastType = type; + } else + listElm = lastMargin = 0; // End list element + }); + }, + + /** + * This method will split the current block parent and insert the contents inside the split position. + * This logic can be improved so text nodes at the start/end remain in the start/end block elements + */ + _insertBlockContent : function(ed, dom, content) { + var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight; + + function select(n) { + var r; + + if (tinymce.isIE) { + r = ed.getDoc().body.createTextRange(); + r.moveToElementText(n); + r.collapse(false); + r.select(); + } else { + sel.select(n, 1); + sel.collapse(false); + } + }; + + // Insert a marker for the caret position + this._insert('<span id="_marker"> </span>', 1); + marker = dom.get('_marker'); + parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol'); + + if (parentBlock) { + // Split parent block + marker = dom.split(parentBlock, marker); + + // Insert nodes before the marker + each(dom.create('div', 0, content).childNodes, function(n) { + last = marker.parentNode.insertBefore(n.cloneNode(true), marker); + }); + + // Move caret after marker + select(last); + } else { + dom.setOuterHTML(marker, content); + sel.select(ed.getBody(), 1); + sel.collapse(0); + } + + dom.remove('_marker'); // Remove marker if it's left + + // Get element, position and height + elm = sel.getStart(); + vp = dom.getViewPort(ed.getWin()); + y = ed.dom.getPos(elm).y; + elmHeight = elm.clientHeight; + + // Is element within viewport if not then scroll it into view + if (y < vp.y || y + elmHeight > vp.y + vp.h) + ed.getDoc().body.scrollTop = y < vp.y ? y : y - vp.h + 25; + }, + + /** + * Inserts the specified contents at the caret position. + */ + _insert : function(h, skip_undo) { + var ed = this.editor; + + // First delete the contents seems to work better on WebKit + if (!ed.selection.isCollapsed()) + ed.execCommand('Delete'); + + // It's better to use the insertHTML method on Gecko since it will combine paragraphs correctly before inserting the contents + ed.execCommand(tinymce.isGecko ? 'insertHTML' : 'mceInsertContent', false, h, {skip_undo : skip_undo}); + }, + + /** + * This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine. + */ + _legacySupport : function() { + var t = this, ed = t.editor; + + // Register commands for backwards compatibility + each(['mcePasteText', 'mcePasteWord'], function(cmd) { + ed.addCommand(cmd, function() { + ed.windowManager.open({ + file : t.url + (cmd == 'mcePasteText' ? '/pastetext.htm' : '/pasteword.htm'), + width : 450, + height : 400, + inline : 1 + }); + }); + }); + + // Register buttons for backwards compatibility + ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText'}); + ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord'}); + ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'selectall'}); + } + }); + + // Register plugin + tinymce.PluginManager.add('paste', tinymce.plugins.PastePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/js/pastetext.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/js/pastetext.js new file mode 100644 index 0000000000000000000000000000000000000000..303439b336285d4c40454dd1ab7441e4567b1e97 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/js/pastetext.js @@ -0,0 +1,36 @@ +tinyMCEPopup.requireLangPack(); + +var PasteTextDialog = { + init : function() { + this.resize(); + }, + + insert : function() { + var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines; + + // Convert linebreaks into paragraphs + if (document.getElementById('linebreaks').checked) { + lines = h.split(/\r?\n/); + if (lines.length > 1) { + h = ''; + tinymce.each(lines, function(row) { + h += '<p>' + row + '</p>'; + }); + } + } + + tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, h); + tinyMCEPopup.close(); + }, + + resize : function() { + var vp = tinyMCEPopup.dom.getViewPort(window), el; + + el = document.getElementById('content'); + + el.style.width = (vp.w - 20) + 'px'; + el.style.height = (vp.h - 90) + 'px'; + } +}; + +tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/js/pasteword.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/js/pasteword.js new file mode 100644 index 0000000000000000000000000000000000000000..fe053a7213eb9ee66c52398d46441a719c63e6a1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/js/pasteword.js @@ -0,0 +1,51 @@ +tinyMCEPopup.requireLangPack(); + +var PasteWordDialog = { + init : function() { + var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = ''; + + // Create iframe + el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>'; + ifr = document.getElementById('iframe'); + doc = ifr.contentWindow.document; + + // Force absolute CSS urls + css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")]; + css = css.concat(tinymce.explode(ed.settings.content_css) || []); + tinymce.each(css, function(u) { + cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />'; + }); + + // Write content into iframe + doc.open(); + doc.write('<html><head>' + cssHTML + '</head><body spellcheck="false"></body></html>'); + doc.close(); + + doc.designMode = 'on'; + this.resize(); + + window.setTimeout(function() { + ifr.contentWindow.focus(); + }, 10); + }, + + insert : function() { + var h = document.getElementById('iframe').contentWindow.document.body.innerHTML; + + tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, h); + tinyMCEPopup.close(); + }, + + resize : function() { + var vp = tinyMCEPopup.dom.getViewPort(window), el; + + el = document.getElementById('iframe'); + + if (el) { + el.style.width = (vp.w - 20) + 'px'; + el.style.height = (vp.h - 90) + 'px'; + } + } +}; + +tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..eeac778960a75ff23c94b3fb48067798038b2778 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/langs/en_dlg.js @@ -0,0 +1,5 @@ +tinyMCE.addI18n('en.paste_dlg',{ +text_title:"Use CTRL+V on your keyboard to paste the text into the window.", +text_linebreaks:"Keep linebreaks", +word_title:"Use CTRL+V on your keyboard to paste the text into the window." +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/pastetext.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/pastetext.htm new file mode 100644 index 0000000000000000000000000000000000000000..42c3d9c849fa6245a58027e128eb80d94629c00d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/pastetext.htm @@ -0,0 +1,33 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#paste.paste_text_desc}</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/pastetext.js"></script> +</head> +<body onresize="PasteTextDialog.resize();" style="display:none; overflow:hidden;"> + <form name="source" onsubmit="return PasteTextDialog.insert();" action="#"> + <div style="float: left" class="title">{#paste.paste_text_desc}</div> + + <div style="float: right"> + <input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label> + </div> + + <br style="clear: both" /> + + <div>{#paste_dlg.text_title}</div> + + <textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" name="insert" value="{#insert}" id="insert" /> + </div> + + <div style="float: right"> + <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" /> + </div> + </div> + </form> +</body> +</html> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/pasteword.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/pasteword.htm new file mode 100644 index 0000000000000000000000000000000000000000..f4a9b3db3fa2113c899659b38f655b5f996c802f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/paste/pasteword.htm @@ -0,0 +1,27 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <title>{#paste.paste_word_desc}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/pasteword.js"></script> +</head> +<body onresize="PasteWordDialog.resize();" style="display:none; overflow:hidden;"> + <form name="source" onsubmit="return PasteWordDialog.insert();" action="#"> + <div class="title">{#paste.paste_word_desc}</div> + + <div>{#paste_dlg.word_title}</div> + + <div id="iframecontainer"></div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..507909c5f0068f00d1d3eb03d839445193838e9c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.Preview",{init:function(a,b){var d=this,c=tinymce.explode(a.settings.content_css);d.editor=a;tinymce.each(c,function(f,e){c[e]=a.documentBaseURI.toAbsolute(f)});a.addCommand("mcePreview",function(){a.windowManager.open({file:a.getParam("plugin_preview_pageurl",b+"/preview.html"),width:parseInt(a.getParam("plugin_preview_width","550")),height:parseInt(a.getParam("plugin_preview_height","600")),resizable:"yes",scrollbars:"yes",popup_css:c?c.join(","):a.baseURI.toAbsolute("themes/"+a.settings.theme+"/skins/"+a.settings.skin+"/content.css"),inline:a.getParam("plugin_preview_inline",1)},{base:a.documentBaseURI.getURI()})});a.addButton("preview",{title:"preview.preview_desc",cmd:"mcePreview"})},getInfo:function(){return{longname:"Preview",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("preview",tinymce.plugins.Preview)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..0582ab8b1ba78cd7e2224db41dd3295c38716b4e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/editor_plugin_src.js @@ -0,0 +1,50 @@ +/** + * $Id: editor_plugin_src.js 1056 2009-03-13 12:47:03Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.Preview', { + init : function(ed, url) { + var t = this, css = tinymce.explode(ed.settings.content_css); + + t.editor = ed; + + // Force absolute CSS urls + tinymce.each(css, function(u, k) { + css[k] = ed.documentBaseURI.toAbsolute(u); + }); + + ed.addCommand('mcePreview', function() { + ed.windowManager.open({ + file : ed.getParam("plugin_preview_pageurl", url + "/preview.html"), + width : parseInt(ed.getParam("plugin_preview_width", "550")), + height : parseInt(ed.getParam("plugin_preview_height", "600")), + resizable : "yes", + scrollbars : "yes", + popup_css : css ? css.join(',') : ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css"), + inline : ed.getParam("plugin_preview_inline", 1) + }, { + base : ed.documentBaseURI.getURI() + }); + }); + + ed.addButton('preview', {title : 'preview.preview_desc', cmd : 'mcePreview'}); + }, + + getInfo : function() { + return { + longname : 'Preview', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('preview', tinymce.plugins.Preview); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/example.html b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/example.html new file mode 100644 index 0000000000000000000000000000000000000000..b2c3d90ce08d6008662d8060f2284a9d60a0ec5a --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/example.html @@ -0,0 +1,28 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<script language="javascript" src="../../tiny_mce_popup.js"></script> +<script type="text/javascript" src="jscripts/embed.js"></script> +<script type="text/javascript"> +tinyMCEPopup.onInit.add(function(ed) { + var dom = tinyMCEPopup.dom; + + // Load editor content_css + tinymce.each(ed.settings.content_css.split(','), function(u) { + dom.loadCSS(ed.documentBaseURI.toAbsolute(u)); + }); + + // Place contents inside div container + dom.setHTML('content', ed.getContent()); +}); +</script> +<title>Example of a custom preview page</title> +</head> +<body> + +Editor contents: <br /> +<div id="content"> +<!-- Gets filled with editor contents --> +</div> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/jscripts/embed.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/jscripts/embed.js new file mode 100644 index 0000000000000000000000000000000000000000..f8dc810527b43e3403bfbe1e147399a06dfdf5b5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/jscripts/embed.js @@ -0,0 +1,73 @@ +/** + * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. + */ + +function writeFlash(p) { + writeEmbed( + 'D27CDB6E-AE6D-11cf-96B8-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'application/x-shockwave-flash', + p + ); +} + +function writeShockWave(p) { + writeEmbed( + '166B1BCA-3F9C-11CF-8075-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', + 'application/x-director', + p + ); +} + +function writeQuickTime(p) { + writeEmbed( + '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', + 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', + 'video/quicktime', + p + ); +} + +function writeRealMedia(p) { + writeEmbed( + 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'audio/x-pn-realaudio-plugin', + p + ); +} + +function writeWindowsMedia(p) { + p.url = p.src; + writeEmbed( + '6BF52A52-394A-11D3-B153-00C04F79FAA6', + 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', + 'application/x-mplayer2', + p + ); +} + +function writeEmbed(cls, cb, mt, p) { + var h = '', n; + + h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; + h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : ''; + h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : ''; + h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : ''; + h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : ''; + h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : ''; + h += '>'; + + for (n in p) + h += '<param name="' + n + '" value="' + p[n] + '">'; + + h += '<embed type="' + mt + '"'; + + for (n in p) + h += n + '="' + p[n] + '" '; + + h += '></embed></object>'; + + document.write(h); +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/preview.html b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/preview.html new file mode 100644 index 0000000000000000000000000000000000000000..67e7b142fa2a058d70ef659a8e44cdd46486e024 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/preview/preview.html @@ -0,0 +1,17 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<script type="text/javascript" src="../../tiny_mce_popup.js"></script> +<script type="text/javascript" src="jscripts/embed.js"></script> +<script type="text/javascript"><!-- +document.write('<base href="' + tinyMCEPopup.getWindowArg("base") + '">'); +// --> +</script> +<title>{#preview.preview_desc}</title> +</head> +<body id="content"> +<script type="text/javascript"> + document.write(tinyMCEPopup.editor.getContent()); +</script> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/print/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/print/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..b5b3a55edf46935465c4b54c4dfc36f1dec231db --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/print/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.Print",{init:function(a,b){a.addCommand("mcePrint",function(){a.getWin().print()});a.addButton("print",{title:"print.print_desc",cmd:"mcePrint"})},getInfo:function(){return{longname:"Print",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("print",tinymce.plugins.Print)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/print/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/print/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..51fe156778f4ca659eb3a90e7b4543526cd84389 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/print/editor_plugin_src.js @@ -0,0 +1,31 @@ +/** + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.Print', { + init : function(ed, url) { + ed.addCommand('mcePrint', function() { + ed.getWin().print(); + }); + + ed.addButton('print', {title : 'print.print_desc', cmd : 'mcePrint'}); + }, + + getInfo : function() { + return { + longname : 'Print', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('print', tinymce.plugins.Print); +})(); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/blank.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/blank.htm new file mode 100644 index 0000000000000000000000000000000000000000..266808ce2b289e58c6e6020be01a25bdbd69bdeb --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/blank.htm @@ -0,0 +1 @@ +<!-- WebKit --> \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..794477c95b614a3264284a491b4069ec8bfb615e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.dom.Event,c=tinymce.grep,d=tinymce.each,b=tinymce.inArray;function e(j,i,h){var g,k;g=j.createTreeWalker(i,NodeFilter.SHOW_ALL,null,false);while(k=g.nextNode()){if(h){if(!h(k)){return false}}if(k.nodeType==3&&k.nodeValue&&/[^\s\u00a0]+/.test(k.nodeValue)){return false}if(k.nodeType==1&&/^(HR|IMG|TABLE)$/.test(k.nodeName)){return false}}return true}tinymce.create("tinymce.plugins.Safari",{init:function(f){var g=this,h;if(!tinymce.isWebKit){return}g.editor=f;g.webKitFontSizes=["x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large"];g.namedFontSizes=["xx-small","x-small","small","medium","large","x-large","xx-large"];f.addCommand("CreateLink",function(k,j){var m=f.selection.getNode(),l=f.dom,i;if(m&&(/^(left|right)$/i.test(l.getStyle(m,"float",1))||/^(left|right)$/i.test(l.getAttrib(m,"align")))){i=l.create("a",{href:j},m.cloneNode());m.parentNode.replaceChild(i,m);f.selection.select(i)}else{f.getDoc().execCommand("CreateLink",false,j)}});f.onKeyUp.add(function(j,o){var l,i,m,p,k;if(o.keyCode==46||o.keyCode==8){i=j.getBody();l=i.innerHTML;k=j.selection;if(i.childNodes.length==1&&!/<(img|hr)/.test(l)&&tinymce.trim(l.replace(/<[^>]+>/g,"")).length==0){j.setContent('<p><br mce_bogus="1" /></p>',{format:"raw"});p=i.firstChild;m=k.getRng();m.setStart(p,0);m.setEnd(p,0);k.setRng(m)}}});f.addCommand("FormatBlock",function(j,i){var l=f.dom,k=l.getParent(f.selection.getNode(),l.isBlock);if(k){l.replace(l.create(i),k,1)}else{f.getDoc().execCommand("FormatBlock",false,i)}});f.addCommand("mceInsertContent",function(j,i){f.getDoc().execCommand("InsertText",false,"mce_marker");f.getBody().innerHTML=f.getBody().innerHTML.replace(/mce_marker/g,f.dom.processHTML(i)+'<span id="_mce_tmp">XX</span>');f.selection.select(f.dom.get("_mce_tmp"));f.getDoc().execCommand("Delete",false," ")});f.onKeyPress.add(function(o,p){var q,v,r,l,j,k,i,u,m,t,s;if(p.keyCode==13){i=o.selection;q=i.getNode();if(p.shiftKey||o.settings.force_br_newlines&&q.nodeName!="LI"){g._insertBR(o);a.cancel(p)}if(v=h.getParent(q,"LI")){r=h.getParent(v,"OL,UL");u=o.getDoc();s=h.create("p");h.add(s,"br",{mce_bogus:"1"});if(e(u,v)){if(k=h.getParent(r.parentNode,"LI,OL,UL")){return}k=h.getParent(r,"p,h1,h2,h3,h4,h5,h6,div")||r;l=u.createRange();l.setStartBefore(k);l.setEndBefore(v);j=u.createRange();j.setStartAfter(v);j.setEndAfter(k);m=l.cloneContents();t=j.cloneContents();if(!e(u,t)){h.insertAfter(t,k)}h.insertAfter(s,k);if(!e(u,m)){h.insertAfter(m,k)}h.remove(k);k=s.firstChild;l=u.createRange();l.setStartBefore(k);l.setEndBefore(k);i.setRng(l);return a.cancel(p)}}}});f.onExecCommand.add(function(i,k){var j,m,n,l;if(k=="InsertUnorderedList"||k=="InsertOrderedList"){j=i.selection;m=i.dom;if(n=m.getParent(j.getNode(),function(o){return/^(H[1-6]|P|ADDRESS|PRE)$/.test(o.nodeName)})){l=j.getBookmark();m.remove(n,1);j.moveToBookmark(l)}}});f.onClick.add(function(i,j){j=j.target;if(j.nodeName=="IMG"){g.selElm=j;i.selection.select(j)}else{g.selElm=null}});f.onInit.add(function(){g._fixWebKitSpans()});f.onSetContent.add(function(){h=f.dom;d(["strong","b","em","u","strike","sub","sup","a"],function(i){d(c(h.select(i)).reverse(),function(l){var k=l.nodeName.toLowerCase(),j;if(k=="a"){if(l.name){h.replace(h.create("img",{mce_name:"a",name:l.name,"class":"mceItemAnchor"}),l)}return}switch(k){case"b":case"strong":if(k=="b"){k="strong"}j="font-weight: bold;";break;case"em":j="font-style: italic;";break;case"u":j="text-decoration: underline;";break;case"sub":j="vertical-align: sub;";break;case"sup":j="vertical-align: super;";break;case"strike":j="text-decoration: line-through;";break}h.replace(h.create("span",{mce_name:k,style:j,"class":"Apple-style-span"}),l,1)})})});f.onPreProcess.add(function(i,j){h=i.dom;d(c(j.node.getElementsByTagName("span")).reverse(),function(m){var k,l;if(j.get){if(h.hasClass(m,"Apple-style-span")){l=m.style.backgroundColor;switch(h.getAttrib(m,"mce_name")){case"font":if(!i.settings.convert_fonts_to_spans){h.setAttrib(m,"style","")}break;case"strong":case"em":case"sub":case"sup":h.setAttrib(m,"style","");break;case"strike":case"u":if(!i.settings.inline_styles){h.setAttrib(m,"style","")}else{h.setAttrib(m,"mce_name","")}break;default:if(!i.settings.inline_styles){h.setAttrib(m,"style","")}}if(l){m.style.backgroundColor=l}}}if(h.hasClass(m,"mceItemRemoved")){h.remove(m,1)}})});f.onPostProcess.add(function(i,j){j.content=j.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,"</$1>");j.content=j.content.replace(/ id=\"undefined\"/g,"")})},getInfo:function(){return{longname:"Safari compatibility",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_fixWebKitSpans:function(){var g=this,f=g.editor;a.add(f.getDoc(),"DOMNodeInserted",function(h){h=h.target;if(h&&h.nodeType==1){g._fixAppleSpan(h)}})},_fixAppleSpan:function(l){var g=this.editor,m=g.dom,i=this.webKitFontSizes,f=this.namedFontSizes,j=g.settings,h,k;if(m.getAttrib(l,"mce_fixed")){return}if(l.nodeName=="SPAN"&&l.className=="Apple-style-span"){h=l.style;if(!j.convert_fonts_to_spans){if(h.fontSize){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"size",b(i,h.fontSize)+1)}if(h.fontFamily){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"face",h.fontFamily)}if(h.color){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"color",m.toHex(h.color))}if(h.backgroundColor){m.setAttrib(l,"mce_name","font");m.setStyle(l,"background-color",h.backgroundColor)}}else{if(h.fontSize){m.setStyle(l,"fontSize",f[b(i,h.fontSize)])}}if(h.fontWeight=="bold"){m.setAttrib(l,"mce_name","strong")}if(h.fontStyle=="italic"){m.setAttrib(l,"mce_name","em")}if(h.textDecoration=="underline"){m.setAttrib(l,"mce_name","u")}if(h.textDecoration=="line-through"){m.setAttrib(l,"mce_name","strike")}if(h.verticalAlign=="super"){m.setAttrib(l,"mce_name","sup")}if(h.verticalAlign=="sub"){m.setAttrib(l,"mce_name","sub")}m.setAttrib(l,"mce_fixed","1")}},_insertBR:function(f){var j=f.dom,h=f.selection,i=h.getRng(),g;i.insertNode(g=j.create("br"));i.setStartAfter(g);i.setEndAfter(g);h.setRng(i);if(h.getSel().focusNode==g.previousSibling){h.select(j.insertAfter(j.doc.createTextNode("\u00a0"),g));h.collapse(1)}f.getWin().scrollTo(0,j.getPos(h.getRng().startContainer).y)}});tinymce.PluginManager.add("safari",tinymce.plugins.Safari)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..6667b7c799feb997e84013dd2143ffe7ae0d6695 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/safari/editor_plugin_src.js @@ -0,0 +1,438 @@ +/** + * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray; + + function isEmpty(d, e, f) { + var w, n; + + w = d.createTreeWalker(e, NodeFilter.SHOW_ALL, null, false); + while (n = w.nextNode()) { + // Filter func + if (f) { + if (!f(n)) + return false; + } + + // Non whitespace text node + if (n.nodeType == 3 && n.nodeValue && /[^\s\u00a0]+/.test(n.nodeValue)) + return false; + + // Is non text element byt still content + if (n.nodeType == 1 && /^(HR|IMG|TABLE)$/.test(n.nodeName)) + return false; + } + + return true; + }; + + tinymce.create('tinymce.plugins.Safari', { + init : function(ed) { + var t = this, dom; + + // Ignore on non webkit + if (!tinymce.isWebKit) + return; + + t.editor = ed; + t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large']; + t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; + + // Safari CreateLink command will not work correctly on images that is aligned + ed.addCommand('CreateLink', function(u, v) { + var n = ed.selection.getNode(), dom = ed.dom, a; + + if (n && (/^(left|right)$/i.test(dom.getStyle(n, 'float', 1)) || /^(left|right)$/i.test(dom.getAttrib(n, 'align')))) { + a = dom.create('a', {href : v}, n.cloneNode()); + n.parentNode.replaceChild(a, n); + ed.selection.select(a); + } else + ed.getDoc().execCommand("CreateLink", false, v); + }); + +/* + // WebKit generates spans out of thin air this patch used to remove them but it will also remove styles we want so it's disabled for now + ed.onPaste.add(function(ed, e) { + function removeStyles(e) { + e = e.target; + + if (e.nodeType == 1) { + e.style.cssText = ''; + + each(ed.dom.select('*', e), function(e) { + e.style.cssText = ''; + }); + } + }; + + Event.add(ed.getDoc(), 'DOMNodeInserted', removeStyles); + + window.setTimeout(function() { + Event.remove(ed.getDoc(), 'DOMNodeInserted', removeStyles); + }, 0); + }); +*/ + ed.onKeyUp.add(function(ed, e) { + var h, b, r, n, s; + + // If backspace or delete key + if (e.keyCode == 46 || e.keyCode == 8) { + b = ed.getBody(); + h = b.innerHTML; + s = ed.selection; + + // If there is no text content or images or hr elements then remove everything + if (b.childNodes.length == 1 && !/<(img|hr)/.test(h) && tinymce.trim(h.replace(/<[^>]+>/g, '')).length == 0) { + // Inject paragrah and bogus br + ed.setContent('<p><br mce_bogus="1" /></p>', {format : 'raw'}); + + // Move caret before bogus br + n = b.firstChild; + r = s.getRng(); + r.setStart(n, 0); + r.setEnd(n, 0); + s.setRng(r); + } + } + }); + + // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004 + ed.addCommand('FormatBlock', function(u, v) { + var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock); + + if (e) + dom.replace(dom.create(v), e, 1); + else + ed.getDoc().execCommand("FormatBlock", false, v); + }); + + // Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382 + ed.addCommand('mceInsertContent', function(u, v) { + ed.getDoc().execCommand("InsertText", false, 'mce_marker'); + ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, ed.dom.processHTML(v) + '<span id="_mce_tmp">XX</span>'); + ed.selection.select(ed.dom.get('_mce_tmp')); + ed.getDoc().execCommand("Delete", false, ' '); + }); + + /* ed.onKeyDown.add(function(ed, e) { + // Ctrl+A select all will fail on WebKit since if you paste the contents you selected it will produce a odd div wrapper + if ((e.ctrlKey || e.metaKey) && e.keyCode == 65) { + ed.selection.select(ed.getBody(), 1); + return Event.cancel(e); + } + });*/ + + ed.onKeyPress.add(function(ed, e) { + var se, li, lic, r1, r2, n, sel, doc, be, af, pa; + + if (e.keyCode == 13) { + sel = ed.selection; + se = sel.getNode(); + + // Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973 + if (e.shiftKey || ed.settings.force_br_newlines && se.nodeName != 'LI') { + t._insertBR(ed); + Event.cancel(e); + } + + // Workaround for DIV elements produced by Safari + if (li = dom.getParent(se, 'LI')) { + lic = dom.getParent(li, 'OL,UL'); + doc = ed.getDoc(); + + pa = dom.create('p'); + dom.add(pa, 'br', {mce_bogus : "1"}); + + if (isEmpty(doc, li)) { + // If list in list then use browser default behavior + if (n = dom.getParent(lic.parentNode, 'LI,OL,UL')) + return; + + n = dom.getParent(lic, 'p,h1,h2,h3,h4,h5,h6,div') || lic; + + // Create range from the start of block element to the list item + r1 = doc.createRange(); + r1.setStartBefore(n); + r1.setEndBefore(li); + + // Create range after the list to the end of block element + r2 = doc.createRange(); + r2.setStartAfter(li); + r2.setEndAfter(n); + + be = r1.cloneContents(); + af = r2.cloneContents(); + + if (!isEmpty(doc, af)) + dom.insertAfter(af, n); + + dom.insertAfter(pa, n); + + if (!isEmpty(doc, be)) + dom.insertAfter(be, n); + + dom.remove(n); + + n = pa.firstChild; + r1 = doc.createRange(); + r1.setStartBefore(n); + r1.setEndBefore(n); + sel.setRng(r1); + + return Event.cancel(e); + } + } + } + }); + + // Safari doesn't place lists outside block elements + ed.onExecCommand.add(function(ed, cmd) { + var sel, dom, bl, bm; + + if (cmd == 'InsertUnorderedList' || cmd == 'InsertOrderedList') { + sel = ed.selection; + dom = ed.dom; + + if (bl = dom.getParent(sel.getNode(), function(n) {return /^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName);})) { + bm = sel.getBookmark(); + dom.remove(bl, 1); + sel.moveToBookmark(bm); + } + } + }); + + // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName == 'IMG') { + t.selElm = e; + ed.selection.select(e); + } else + t.selElm = null; + }); + + ed.onInit.add(function() { + t._fixWebKitSpans(); + }); + + ed.onSetContent.add(function() { + dom = ed.dom; + + // Convert strong,b,em,u,strike to spans + each(['strong','b','em','u','strike','sub','sup','a'], function(v) { + each(grep(dom.select(v)).reverse(), function(n) { + var nn = n.nodeName.toLowerCase(), st; + + // Convert anchors into images + if (nn == 'a') { + if (n.name) + dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n); + + return; + } + + switch (nn) { + case 'b': + case 'strong': + if (nn == 'b') + nn = 'strong'; + + st = 'font-weight: bold;'; + break; + + case 'em': + st = 'font-style: italic;'; + break; + + case 'u': + st = 'text-decoration: underline;'; + break; + + case 'sub': + st = 'vertical-align: sub;'; + break; + + case 'sup': + st = 'vertical-align: super;'; + break; + + case 'strike': + st = 'text-decoration: line-through;'; + break; + } + + dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1); + }); + }); + }); + + ed.onPreProcess.add(function(ed, o) { + dom = ed.dom; + + each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) { + var v, bg; + + if (o.get) { + if (dom.hasClass(n, 'Apple-style-span')) { + bg = n.style.backgroundColor; + + switch (dom.getAttrib(n, 'mce_name')) { + case 'font': + if (!ed.settings.convert_fonts_to_spans) + dom.setAttrib(n, 'style', ''); + break; + + case 'strong': + case 'em': + case 'sub': + case 'sup': + dom.setAttrib(n, 'style', ''); + break; + + case 'strike': + case 'u': + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + else + dom.setAttrib(n, 'mce_name', ''); + + break; + + default: + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + } + + + if (bg) + n.style.backgroundColor = bg; + } + } + + if (dom.hasClass(n, 'mceItemRemoved')) + dom.remove(n, 1); + }); + }); + + ed.onPostProcess.add(function(ed, o) { + // Safari adds BR at end of all block elements + o.content = o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g, '</$1>'); + + // Safari adds id="undefined" to HR elements + o.content = o.content.replace(/ id=\"undefined\"/g, ''); + }); + }, + + getInfo : function() { + return { + longname : 'Safari compatibility', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Internal methods + + _fixWebKitSpans : function() { + var t = this, ed = t.editor; + + // Use mutator events on new WebKit + Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) { + e = e.target; + + if (e && e.nodeType == 1) + t._fixAppleSpan(e); + }); + }, + + _fixAppleSpan : function(e) { + var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p; + + if (dom.getAttrib(e, 'mce_fixed')) + return; + + // Handle Apple style spans + if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') { + st = e.style; + + if (!s.convert_fonts_to_spans) { + if (st.fontSize) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1); + } + + if (st.fontFamily) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'face', st.fontFamily); + } + + if (st.color) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'color', dom.toHex(st.color)); + } + + if (st.backgroundColor) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setStyle(e, 'background-color', st.backgroundColor); + } + } else { + if (st.fontSize) + dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]); + } + + if (st.fontWeight == 'bold') + dom.setAttrib(e, 'mce_name', 'strong'); + + if (st.fontStyle == 'italic') + dom.setAttrib(e, 'mce_name', 'em'); + + if (st.textDecoration == 'underline') + dom.setAttrib(e, 'mce_name', 'u'); + + if (st.textDecoration == 'line-through') + dom.setAttrib(e, 'mce_name', 'strike'); + + if (st.verticalAlign == 'super') + dom.setAttrib(e, 'mce_name', 'sup'); + + if (st.verticalAlign == 'sub') + dom.setAttrib(e, 'mce_name', 'sub'); + + dom.setAttrib(e, 'mce_fixed', '1'); + } + }, + + _insertBR : function(ed) { + var dom = ed.dom, s = ed.selection, r = s.getRng(), br; + + // Insert BR element + r.insertNode(br = dom.create('br')); + + // Place caret after BR + r.setStartAfter(br); + r.setEndAfter(br); + s.setRng(r); + + // Could not place caret after BR then insert an nbsp entity and move the caret + if (s.getSel().focusNode == br.previousSibling) { + s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br)); + s.collapse(1); + } + + // Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117 + ed.getWin().scrollTo(0, dom.getPos(s.getRng().startContainer).y); + } + }); + + // Register plugin + tinymce.PluginManager.add('safari', tinymce.plugins.Safari); +})(); + diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/save/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/save/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..8e9399667103e5dba8ef9abc7377fd961c08a908 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/save/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.Save",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceSave",c._save,c);a.addCommand("mceCancel",c._cancel,c);a.addButton("save",{title:"save.save_desc",cmd:"mceSave"});a.addButton("cancel",{title:"save.cancel_desc",cmd:"mceCancel"});a.onNodeChange.add(c._nodeChange,c);a.addShortcut("ctrl+s",a.getLang("save.save_desc"),"mceSave")},getInfo:function(){return{longname:"Save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,c){var b=this.editor;if(b.getParam("save_enablewhendirty")){a.setDisabled("save",!b.isDirty());a.setDisabled("cancel",!b.isDirty())}},_save:function(){var c=this.editor,a,e,d,b;a=tinymce.DOM.get(c.id).form||tinymce.DOM.getParent(c.id,"form");if(c.getParam("save_enablewhendirty")&&!c.isDirty()){return}tinyMCE.triggerSave();if(e=c.getParam("save_onsavecallback")){if(c.execCallback("save_onsavecallback",c)){c.startContent=tinymce.trim(c.getContent({format:"raw"}));c.nodeChanged()}return}if(a){c.isNotDirty=true;if(a.onsubmit==null||a.onsubmit()!=false){a.submit()}c.nodeChanged()}else{c.windowManager.alert("Error: No form element found.")}},_cancel:function(){var a=this.editor,c,b=tinymce.trim(a.startContent);if(c=a.getParam("save_oncancelcallback")){a.execCallback("save_oncancelcallback",a);return}a.setContent(b);a.undoManager.clear();a.nodeChanged()}});tinymce.PluginManager.add("save",tinymce.plugins.Save)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/save/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/save/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..b38be4d637ae6882c3b6d353c26cfe52de3f4707 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/save/editor_plugin_src.js @@ -0,0 +1,98 @@ +/** + * $Id: editor_plugin_src.js 851 2008-05-26 15:38:49Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.Save', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceSave', t._save, t); + ed.addCommand('mceCancel', t._cancel, t); + + // Register buttons + ed.addButton('save', {title : 'save.save_desc', cmd : 'mceSave'}); + ed.addButton('cancel', {title : 'save.cancel_desc', cmd : 'mceCancel'}); + + ed.onNodeChange.add(t._nodeChange, t); + ed.addShortcut('ctrl+s', ed.getLang('save.save_desc'), 'mceSave'); + }, + + getInfo : function() { + return { + longname : 'Save', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _nodeChange : function(ed, cm, n) { + var ed = this.editor; + + if (ed.getParam('save_enablewhendirty')) { + cm.setDisabled('save', !ed.isDirty()); + cm.setDisabled('cancel', !ed.isDirty()); + } + }, + + // Private methods + + _save : function() { + var ed = this.editor, formObj, os, i, elementId; + + formObj = tinymce.DOM.get(ed.id).form || tinymce.DOM.getParent(ed.id, 'form'); + + if (ed.getParam("save_enablewhendirty") && !ed.isDirty()) + return; + + tinyMCE.triggerSave(); + + // Use callback instead + if (os = ed.getParam("save_onsavecallback")) { + if (ed.execCallback('save_onsavecallback', ed)) { + ed.startContent = tinymce.trim(ed.getContent({format : 'raw'})); + ed.nodeChanged(); + } + + return; + } + + if (formObj) { + ed.isNotDirty = true; + + if (formObj.onsubmit == null || formObj.onsubmit() != false) + formObj.submit(); + + ed.nodeChanged(); + } else + ed.windowManager.alert("Error: No form element found."); + }, + + _cancel : function() { + var ed = this.editor, os, h = tinymce.trim(ed.startContent); + + // Use callback instead + if (os = ed.getParam("save_oncancelcallback")) { + ed.execCallback('save_oncancelcallback', ed); + return; + } + + ed.setContent(h); + ed.undoManager.clear(); + ed.nodeChanged(); + } + }); + + // Register plugin + tinymce.PluginManager.add('save', tinymce.plugins.Save); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/css/searchreplace.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/css/searchreplace.css new file mode 100644 index 0000000000000000000000000000000000000000..ecdf58c7b50e826ead437180515681537978100f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/css/searchreplace.css @@ -0,0 +1,6 @@ +.panel_wrapper {height:85px;} +.panel_wrapper div.current {height:85px;} + +/* IE */ +* html .panel_wrapper {height:100px;} +* html .panel_wrapper div.current {height:100px;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..c3f8358c61dd9eccb700b64ef329d1edb1e5ac97 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:160+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..59edc3b25fdc8750cd75691218e1a814c2159c45 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/editor_plugin_src.js @@ -0,0 +1,54 @@ +/** + * $Id: editor_plugin_src.js 686 2008-03-09 18:13:49Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.SearchReplacePlugin', { + init : function(ed, url) { + function open(m) { + ed.windowManager.open({ + file : url + '/searchreplace.htm', + width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)), + height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)), + inline : 1, + auto_focus : 0 + }, { + mode : m, + search_string : ed.selection.getContent({format : 'text'}), + plugin_url : url + }); + }; + + // Register commands + ed.addCommand('mceSearch', function() { + open('search'); + }); + + ed.addCommand('mceReplace', function() { + open('replace'); + }); + + // Register buttons + ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'}); + ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'}); + + ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch'); + }, + + getInfo : function() { + return { + longname : 'Search/Replace', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/js/searchreplace.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/js/searchreplace.js new file mode 100644 index 0000000000000000000000000000000000000000..a8585cccce9d1342ef37a3a6e40845680f906f11 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/js/searchreplace.js @@ -0,0 +1,126 @@ +tinyMCEPopup.requireLangPack(); + +var SearchReplaceDialog = { + init : function(ed) { + var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode"); + + this.switchMode(m); + + f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string"); + + // Focus input field + f[m + '_panel_searchstring'].focus(); + }, + + switchMode : function(m) { + var f, lm = this.lastMode; + + if (lm != m) { + f = document.forms[0]; + + if (lm) { + f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value; + f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked; + f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked; + f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked; + } + + mcTabs.displayTab(m + '_tab', m + '_panel'); + document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none"; + document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none"; + this.lastMode = m; + } + }, + + searchNext : function(a) { + var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0; + + // Get input + f = document.forms[0]; + s = f[m + '_panel_searchstring'].value; + b = f[m + '_panel_backwardsu'].checked; + ca = f[m + '_panel_casesensitivebox'].checked; + rs = f['replace_panel_replacestring'].value; + + if (s == '') + return; + + function fix() { + // Correct Firefox graphics glitches + r = se.getRng().cloneRange(); + ed.getDoc().execCommand('SelectAll', false, null); + se.setRng(r); + }; + + function replace() { + if (tinymce.isIE) + ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE + else + ed.getDoc().execCommand('InsertHTML', false, rs); + }; + + // IE flags + if (ca) + fl = fl | 4; + + switch (a) { + case 'all': + // Move caret to beginning of text + ed.execCommand('SelectAll'); + ed.selection.collapse(true); + + if (tinymce.isIE) { + while (r.findText(s, b ? -1 : 1, fl)) { + r.scrollIntoView(); + r.select(); + replace(); + fo = 1; + } + + tinyMCEPopup.storeSelection(); + } else { + while (w.find(s, ca, b, false, false, false, false)) { + replace(); + fo = 1; + } + } + + if (fo) + tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced')); + else + tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); + + return; + + case 'current': + if (!ed.selection.isCollapsed()) + replace(); + + break; + } + + se.collapse(b); + r = se.getRng(); + + // Whats the point + if (!s) + return; + + if (tinymce.isIE) { + if (r.findText(s, b ? -1 : 1, fl)) { + r.scrollIntoView(); + r.select(); + } else + tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); + + tinyMCEPopup.storeSelection(); + } else { + if (!w.find(s, ca, b, false, false, false, false)) + tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); + else + fix(); + } + } +}; + +tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..370959afa3cc8f02feb5a1bf41f727a1f4c2fadf --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/langs/en_dlg.js @@ -0,0 +1,16 @@ +tinyMCE.addI18n('en.searchreplace_dlg',{ +searchnext_desc:"Find again", +notfound:"The search has been completed. The search string could not be found.", +search_title:"Find", +replace_title:"Find/Replace", +allreplaced:"All occurrences of the search string were replaced.", +findwhat:"Find what", +replacewith:"Replace with", +direction:"Direction", +up:"Up", +down:"Down", +mcase:"Match case", +findnext:"Find next", +replace:"Replace", +replaceall:"Replace all" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/searchreplace.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/searchreplace.htm new file mode 100644 index 0000000000000000000000000000000000000000..0b42486b6fc9045244c411de2a9868007c18f2bf --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/searchreplace/searchreplace.htm @@ -0,0 +1,104 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#searchreplace_dlg.replace_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="js/searchreplace.js"></script> + <link rel="stylesheet" type="text/css" href="css/searchreplace.css" /> +</head> +<body style="display:none;"> +<form onsubmit="SearchReplaceDialog.searchNext('none');return false;" action="#"> + <div class="tabs"> + <ul> + <li id="search_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('search');" onmousedown="return false;">{#searchreplace.search_desc}</a></span></li> + <li id="replace_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('replace');" onmousedown="return false;">{#searchreplace_dlg.replace}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="search_panel" class="panel"> + <table border="0" cellspacing="0" cellpadding="2"> + <tr> + <td><label for="search_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td> + <td><input type="text" id="search_panel_searchstring" name="search_panel_searchstring" style="width: 200px" /></td> + </tr> + <tr> + <td colspan="2"> + <table border="0" cellspacing="0" cellpadding="0" class="direction"> + <tr> + <td><label>{#searchreplace_dlg.direction}</label></td> + <td><input id="search_panel_backwardsu" name="search_panel_backwards" class="radio" type="radio" /></td> + <td><label for="search_panel_backwardsu">{#searchreplace_dlg.up}</label></td> + <td><input id="search_panel_backwardsd" name="search_panel_backwards" class="radio" type="radio" checked="checked" /></td> + <td><label for="search_panel_backwardsd">{#searchreplace_dlg.down}</label></td> + </tr> + </table> + </td> + </tr> + <tr> + <td colspan="2"> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="search_panel_casesensitivebox" name="search_panel_casesensitivebox" class="checkbox" type="checkbox" /></td> + <td><label for="search_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td> + </tr> + </table> + </td> + </tr> + </table> + </div> + + <div id="replace_panel" class="panel"> + <table border="0" cellspacing="0" cellpadding="2"> + <tr> + <td><label for="replace_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td> + <td><input type="text" id="replace_panel_searchstring" name="replace_panel_searchstring" style="width: 200px" /></td> + </tr> + <tr> + <td><label for="replace_panel_replacestring">{#searchreplace_dlg.replacewith}</label></td> + <td><input type="text" id="replace_panel_replacestring" name="replace_panel_replacestring" style="width: 200px" /></td> + </tr> + <tr> + <td colspan="2"> + <table border="0" cellspacing="0" cellpadding="0" class="direction"> + <tr> + <td><label>{#searchreplace_dlg.direction}</label></td> + <td><input id="replace_panel_backwardsu" name="replace_panel_backwards" class="radio" type="radio" /></td> + <td><label for="replace_panel_backwardsu">{#searchreplace_dlg.up}</label></td> + <td><input id="replace_panel_backwardsd" name="replace_panel_backwards" class="radio" type="radio" checked="checked" /></td> + <td><label for="replace_panel_backwardsd">{#searchreplace_dlg.down}</label></td> + </tr> + </table> + </td> + </tr> + <tr> + <td colspan="2"> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="replace_panel_casesensitivebox" name="replace_panel_casesensitivebox" class="checkbox" type="checkbox" /></td> + <td><label for="replace_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td> + </tr> + </table> + </td> + </tr> + </table> + </div> + + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" /> + <input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" /> + <input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/css/content.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/css/content.css new file mode 100644 index 0000000000000000000000000000000000000000..24efa02170ce8bf23e68fc76d7526d2f60aed2b5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/css/content.css @@ -0,0 +1 @@ +.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..377e4e8a0e9f24266af621537fb33995b523ff5f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.SpellcheckerPlugin",{getInfo:function(){return{longname:"Spellchecker",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker",version:tinymce.majorVersion+"."+tinymce.minorVersion}},init:function(e,f){var g=this,d;g.url=f;g.editor=e;e.addCommand("mceSpellCheck",function(){if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);e.windowManager.alert("spellchecker.no_mpell")}})}else{g._done()}});e.onInit.add(function(){if(e.settings.content_css!==false){e.dom.loadCSS(f+"/css/content.css")}});e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.getParam("spellchecker_languages","+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv","hash"),function(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');for(d=0;d<f.length;d++){e+="\\"+f.charAt(d)}return e},_getWords:function(){var e=this.editor,g=[],d="",f={};this._walk(e.getBody(),function(h){if(h.nodeType==3){d+=h.nodeValue+" "}});d=d.replace(new RegExp("([0-9]|["+this._getSeparators()+"])","g")," ");d=tinymce.trim(d.replace(/(\s+)/g," "));c(d.split(" "),function(h){if(!f[h]){g.push(h);f[h]=1}});return g},_removeWords:function(e){var f=this.editor,h=f.dom,g=f.selection,d=g.getBookmark();c(h.select("span").reverse(),function(i){if(i&&(h.hasClass(i,"mceItemHiddenSpellWord")||h.hasClass(i,"mceItemHidden"))){if(!e||h.decode(i.innerHTML)==e){h.remove(i,1)}}});g.moveToBookmark(d)},_markWords:function(o){var i,h,g,f,e,n="",k=this.editor,p=this._getSeparators(),j=k.dom,d=[];var l=k.selection,m=l.getBookmark();c(o,function(q){n+=(n?"|":"")+q});i=new RegExp("(["+p+"])("+n+")(["+p+"])","g");h=new RegExp("^("+n+")","g");g=new RegExp("("+n+")(["+p+"]?)$","g");f=new RegExp("^("+n+")(["+p+"]?)$","g");e=new RegExp("("+n+")(["+p+"])","g");this._walk(this.editor.getBody(),function(q){if(q.nodeType==3){d.push(q)}});c(d,function(r){var q;if(r.nodeType==3){q=r.nodeValue;if(i.test(q)||h.test(q)||g.test(q)||f.test(q)){q=j.encode(q);q=q.replace(e,'<span class="mceItemHiddenSpellWord">$1</span>$2');q=q.replace(g,'<span class="mceItemHiddenSpellWord">$1</span>$2');j.replace(j.create("span",{"class":"mceItemHidden"},q),r)}}});l.moveToBookmark(m)},_showMenu:function(g,i){var h=this,g=h.editor,d=h._menu,k,j=g.dom,f=j.getViewPort(g.getWin());if(!d){k=b.getPos(g.getContentAreaContainer());d=g.controlManager.createDropMenu("spellcheckermenu",{offset_x:k.x,offset_y:k.y,"class":"mceNoIcons"});h._menu=d}if(j.hasClass(i.target,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);h._sendRPC("getSuggestions",[h.selectedLang,j.decode(i.target.innerHTML)],function(e){d.removeAll();if(e.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(e,function(l){d.add({title:l,onclick:function(){j.replace(g.getDoc().createTextNode(l),i.target);h._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}d.add({title:"spellchecker.ignore_word",onclick:function(){j.remove(i.target,1);h._checkDone()}});d.add({title:"spellchecker.ignore_words",onclick:function(){h._removeWords(j.decode(i.target.innerHTML));h._checkDone()}});d.update()});g.selection.select(i.target);k=j.getPos(i.target);d.showMenu(k.x,k.y+i.target.offsetHeight-f.y);return tinymce.dom.Event.cancel(i)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,h,d){var g=this,f=g.editor.getParam("spellchecker_rpc_url","{backend}");if(f=="{backend}"){g.editor.setProgressState(0);alert("Please specify: spellchecker_rpc_url");return}a.sendRPC({url:f,method:e,params:h,success:d,error:function(j,i){g.editor.setProgressState(0);g.editor.windowManager.alert(j.errstr||("Error response: "+i.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..c913c4603e482a19460362762d3e6c569d9e4ad3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/editor_plugin_src.js @@ -0,0 +1,338 @@ +/** + * $Id: editor_plugin_src.js 425 2007-11-21 15:17:39Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM; + + tinymce.create('tinymce.plugins.SpellcheckerPlugin', { + getInfo : function() { + return { + longname : 'Spellchecker', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + init : function(ed, url) { + var t = this, cm; + + t.url = url; + t.editor = ed; + + // Register commands + ed.addCommand('mceSpellCheck', function() { + if (!t.active) { + ed.setProgressState(1); + t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) { + if (r.length > 0) { + t.active = 1; + t._markWords(r); + ed.setProgressState(0); + ed.nodeChanged(); + } else { + ed.setProgressState(0); + ed.windowManager.alert('spellchecker.no_mpell'); + } + }); + } else + t._done(); + }); + + ed.onInit.add(function() { + if (ed.settings.content_css !== false) + ed.dom.loadCSS(url + '/css/content.css'); + }); + + ed.onClick.add(t._showMenu, t); + ed.onContextMenu.add(t._showMenu, t); + ed.onBeforeGetContent.add(function() { + if (t.active) + t._removeWords(); + }); + + ed.onNodeChange.add(function(ed, cm) { + cm.setActive('spellchecker', t.active); + }); + + ed.onSetContent.add(function() { + t._done(); + }); + + ed.onBeforeGetContent.add(function() { + t._done(); + }); + + ed.onBeforeExecCommand.add(function(ed, cmd) { + if (cmd == 'mceFullScreen') + t._done(); + }); + + // Find selected language + t.languages = {}; + each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) { + if (k.indexOf('+') === 0) { + k = k.substring(1); + t.selectedLang = v; + } + + t.languages[k] = v; + }); + }, + + createControl : function(n, cm) { + var t = this, c, ed = t.editor; + + if (n == 'spellchecker') { + c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t}); + + c.onRenderMenu.add(function(c, m) { + m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + each(t.languages, function(v, k) { + var o = {icon : 1}, mi; + + o.onclick = function() { + mi.setSelected(1); + t.selectedItem.setSelected(0); + t.selectedItem = mi; + t.selectedLang = v; + }; + + o.title = k; + mi = m.add(o); + mi.setSelected(v == t.selectedLang); + + if (v == t.selectedLang) + t.selectedItem = mi; + }) + }); + + return c; + } + }, + + // Internal functions + + _walk : function(n, f) { + var d = this.editor.getDoc(), w; + + if (d.createTreeWalker) { + w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); + + while ((n = w.nextNode()) != null) + f.call(this, n); + } else + tinymce.walk(n, f, 'childNodes'); + }, + + _getSeparators : function() { + var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c'); + + // Build word separator regexp + for (i=0; i<str.length; i++) + re += '\\' + str.charAt(i); + + return re; + }, + + _getWords : function() { + var ed = this.editor, wl = [], tx = '', lo = {}; + + // Get area text + this._walk(ed.getBody(), function(n) { + if (n.nodeType == 3) + tx += n.nodeValue + ' '; + }); + + // Split words by separator + tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' '); + tx = tinymce.trim(tx.replace(/(\s+)/g, ' ')); + + // Build word array and remove duplicates + each(tx.split(' '), function(v) { + if (!lo[v]) { + wl.push(v); + lo[v] = 1; + } + }); + + return wl; + }, + + _removeWords : function(w) { + var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark(); + + each(dom.select('span').reverse(), function(n) { + if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) { + if (!w || dom.decode(n.innerHTML) == w) + dom.remove(n, 1); + } + }); + + se.moveToBookmark(b); + }, + + _markWords : function(wl) { + var r1, r2, r3, r4, r5, w = '', ed = this.editor, re = this._getSeparators(), dom = ed.dom, nl = []; + var se = ed.selection, b = se.getBookmark(); + + each(wl, function(v) { + w += (w ? '|' : '') + v; + }); + + r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g'); + r2 = new RegExp('^(' + w + ')', 'g'); + r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g'); + r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g'); + r5 = new RegExp('(' + w + ')([' + re + '])', 'g'); + + // Collect all text nodes + this._walk(this.editor.getBody(), function(n) { + if (n.nodeType == 3) { + nl.push(n); + } + }); + + // Wrap incorrect words in spans + each(nl, function(n) { + var v; + + if (n.nodeType == 3) { + v = n.nodeValue; + + if (r1.test(v) || r2.test(v) || r3.test(v) || r4.test(v)) { + v = dom.encode(v); + v = v.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2'); + v = v.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2'); + + dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n); + } + } + }); + + se.moveToBookmark(b); + }, + + _showMenu : function(ed, e) { + var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()); + + if (!m) { + p1 = DOM.getPos(ed.getContentAreaContainer()); + //p2 = DOM.getPos(ed.getContainer()); + + m = ed.controlManager.createDropMenu('spellcheckermenu', { + offset_x : p1.x, + offset_y : p1.y, + 'class' : 'mceNoIcons' + }); + + t._menu = m; + } + + if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) { + m.removeAll(); + m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + + t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) { + m.removeAll(); + + if (r.length > 0) { + m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + each(r, function(v) { + m.add({title : v, onclick : function() { + dom.replace(ed.getDoc().createTextNode(v), e.target); + t._checkDone(); + }}); + }); + + m.addSeparator(); + } else + m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + + m.add({ + title : 'spellchecker.ignore_word', + onclick : function() { + dom.remove(e.target, 1); + t._checkDone(); + } + }); + + m.add({ + title : 'spellchecker.ignore_words', + onclick : function() { + t._removeWords(dom.decode(e.target.innerHTML)); + t._checkDone(); + } + }); + + m.update(); + }); + + ed.selection.select(e.target); + p1 = dom.getPos(e.target); + m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y); + + return tinymce.dom.Event.cancel(e); + } else + m.hideMenu(); + }, + + _checkDone : function() { + var t = this, ed = t.editor, dom = ed.dom, o; + + each(dom.select('span'), function(n) { + if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) { + o = true; + return false; + } + }); + + if (!o) + t._done(); + }, + + _done : function() { + var t = this, la = t.active; + + if (t.active) { + t.active = 0; + t._removeWords(); + + if (t._menu) + t._menu.hideMenu(); + + if (la) + t.editor.nodeChanged(); + } + }, + + _sendRPC : function(m, p, cb) { + var t = this, url = t.editor.getParam("spellchecker_rpc_url", "{backend}"); + + if (url == '{backend}') { + t.editor.setProgressState(0); + alert('Please specify: spellchecker_rpc_url'); + return; + } + + JSONRequest.sendRPC({ + url : url, + method : m, + params : p, + success : cb, + error : function(e, x) { + t.editor.setProgressState(0); + t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText)); + } + }); + } + }); + + // Register plugin + tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/img/wline.gif b/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/img/wline.gif new file mode 100644 index 0000000000000000000000000000000000000000..7d0a4dbca03cc13177a359a5f175dda819fdf464 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/plugins/spellchecker/img/wline.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/css/props.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/css/props.css new file mode 100644 index 0000000000000000000000000000000000000000..eb1f2649605d6815e176186d78ce6fda3414e15f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/css/props.css @@ -0,0 +1,13 @@ +#text_font {width:250px;} +#text_size {width:70px;} +.mceAddSelectValue {background:#DDD;} +select, #block_text_indent, #box_width, #box_height, #box_padding_top, #box_padding_right, #box_padding_bottom, #box_padding_left {width:70px;} +#box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;} +#positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;} +#positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;} +.panel_wrapper div.current {padding-top:10px;height:230px;} +.delim {border-left:1px solid gray;} +.tdelim {border-bottom:1px solid gray;} +#block_display {width:145px;} +#list_type {width:115px;} +.disabled {background:#EEE;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..cab2153c40f1402f0fc9d36ff688174463d7fe3d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:320+parseInt(a.getLang("style.delta_height",0)),inline:1},{plugin_url:b,style_text:a.selection.getNode().style.cssText})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..6c817ce483d4af4a01de2cca549f1e8b56e61aba --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/editor_plugin_src.js @@ -0,0 +1,52 @@ +/** + * $Id: editor_plugin_src.js 787 2008-04-10 11:40:57Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.StylePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceStyleProps', function() { + ed.windowManager.open({ + file : url + '/props.htm', + width : 480 + parseInt(ed.getLang('style.delta_width', 0)), + height : 320 + parseInt(ed.getLang('style.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + style_text : ed.selection.getNode().style.cssText + }); + }); + + ed.addCommand('mceSetElementStyle', function(ui, v) { + if (e = ed.selection.getNode()) { + ed.dom.setAttrib(e, 'style', v); + ed.execCommand('mceRepaint'); + } + }); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setDisabled('styleprops', n.nodeName === 'BODY'); + }); + + // Register buttons + ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'}); + }, + + getInfo : function() { + return { + longname : 'Style', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/js/props.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/js/props.js new file mode 100644 index 0000000000000000000000000000000000000000..a8dd93dec5945263bb0faa5caef3f7696e5e2400 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/js/props.js @@ -0,0 +1,641 @@ +tinyMCEPopup.requireLangPack(); + +var defaultFonts = "" + + "Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" + + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + + "Courier New, Courier, mono=Courier New, Courier, mono;" + + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + + "Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" + + "Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" + + "Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif"; + +var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger"; +var defaultMeasurement = "+pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%"; +var defaultSpacingMeasurement = "pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;+ems=em;exs=ex;%"; +var defaultIndentMeasurement = "pixels=px;+points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%"; +var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900"; +var defaultTextStyle = "normal;italic;oblique"; +var defaultVariant = "normal;small-caps"; +var defaultLineHeight = "normal"; +var defaultAttachment = "fixed;scroll"; +var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y"; +var defaultPosH = "left;center;right"; +var defaultPosV = "top;center;bottom"; +var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom"; +var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none"; +var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset"; +var defaultBorderWidth = "thin;medium;thick"; +var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none"; + +function init() { + var ce = document.getElementById('container'), h; + + ce.style.cssText = tinyMCEPopup.getWindowArg('style_text'); + + h = getBrowserHTML('background_image_browser','background_image','image','advimage'); + document.getElementById("background_image_browser").innerHTML = h; + + document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color'); + document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color'); + document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top'); + document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right'); + document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom'); + document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left'); + + fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true); + fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true); + fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true); + fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true); + fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true); + fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true); + fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true); + fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true); + fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true); + + fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true); + fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true); + + fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true); + fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true); + fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true); + fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true); + fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true); + fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true); + fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true); + fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true); + fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true); + + fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true); + fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true); + fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true); + + fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true); + + fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true); + fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true); + + fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true); + fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true); + + fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true); + + fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true); + + TinyMCE_EditableSelects.init(); + setupFormData(); + showDisabledControls(); +} + +function setupFormData() { + var ce = document.getElementById('container'), f = document.forms[0], s, b, i; + + // Setup text fields + + selectByValue(f, 'text_font', ce.style.fontFamily, true, true); + selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true); + selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize)); + selectByValue(f, 'text_weight', ce.style.fontWeight, true, true); + selectByValue(f, 'text_style', ce.style.fontStyle, true, true); + selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true); + selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight)); + selectByValue(f, 'text_case', ce.style.textTransform, true, true); + selectByValue(f, 'text_variant', ce.style.fontVariant, true, true); + f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color); + updateColor('text_color_pick', 'text_color'); + f.text_underline.checked = inStr(ce.style.textDecoration, 'underline'); + f.text_overline.checked = inStr(ce.style.textDecoration, 'overline'); + f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through'); + f.text_blink.checked = inStr(ce.style.textDecoration, 'blink'); + + // Setup background fields + + f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor); + updateColor('background_color_pick', 'background_color'); + f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true); + selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true); + selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true); + selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0))); + selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true); + selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1))); + + // Setup block fields + + selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true); + selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing)); + selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true); + selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing)); + selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true); + selectByValue(f, 'block_text_align', ce.style.textAlign, true, true); + f.block_text_indent.value = getNum(ce.style.textIndent); + selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent)); + selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true); + selectByValue(f, 'block_display', ce.style.display, true, true); + + // Setup box fields + + f.box_width.value = getNum(ce.style.width); + selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width)); + + f.box_height.value = getNum(ce.style.height); + selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height)); + + if (tinymce.isGecko) + selectByValue(f, 'box_float', ce.style.cssFloat, true, true); + else + selectByValue(f, 'box_float', ce.style.styleFloat, true, true); + + selectByValue(f, 'box_clear', ce.style.clear, true, true); + + setupBox(f, ce, 'box_padding', 'padding', ''); + setupBox(f, ce, 'box_margin', 'margin', ''); + + // Setup border fields + + setupBox(f, ce, 'border_style', 'border', 'Style'); + setupBox(f, ce, 'border_width', 'border', 'Width'); + setupBox(f, ce, 'border_color', 'border', 'Color'); + + updateColor('border_color_top_pick', 'border_color_top'); + updateColor('border_color_right_pick', 'border_color_right'); + updateColor('border_color_bottom_pick', 'border_color_bottom'); + updateColor('border_color_left_pick', 'border_color_left'); + + f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value); + f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value); + f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value); + f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value); + + // Setup list fields + + selectByValue(f, 'list_type', ce.style.listStyleType, true, true); + selectByValue(f, 'list_position', ce.style.listStylePosition, true, true); + f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + + // Setup box fields + + selectByValue(f, 'positioning_type', ce.style.position, true, true); + selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true); + selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true); + f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : ""; + + f.positioning_width.value = getNum(ce.style.width); + selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width)); + + f.positioning_height.value = getNum(ce.style.height); + selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height)); + + setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']); + + s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1"); + s = s.replace(/,/g, ' '); + + if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) { + f.positioning_clip_top.value = getNum(getVal(s, 0)); + selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); + f.positioning_clip_right.value = getNum(getVal(s, 1)); + selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1))); + f.positioning_clip_bottom.value = getNum(getVal(s, 2)); + selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2))); + f.positioning_clip_left.value = getNum(getVal(s, 3)); + selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3))); + } else { + f.positioning_clip_top.value = getNum(getVal(s, 0)); + selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); + f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value; + } + +// setupBox(f, ce, '', 'border', 'Color'); +} + +function getMeasurement(s) { + return s.replace(/^([0-9.]+)(.*)$/, "$2"); +} + +function getNum(s) { + if (new RegExp('^(?:[0-9.]+)(?:[a-z%]+)$', 'gi').test(s)) + return s.replace(/[^0-9.]/g, ''); + + return s; +} + +function inStr(s, n) { + return new RegExp(n, 'gi').test(s); +} + +function getVal(s, i) { + var a = s.split(' '); + + if (a.length > 1) + return a[i]; + + return ""; +} + +function setValue(f, n, v) { + if (f.elements[n].type == "text") + f.elements[n].value = v; + else + selectByValue(f, n, v, true, true); +} + +function setupBox(f, ce, fp, pr, sf, b) { + if (typeof(b) == "undefined") + b = ['Top', 'Right', 'Bottom', 'Left']; + + if (isSame(ce, pr, sf, b)) { + f.elements[fp + "_same"].checked = true; + + setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); + f.elements[fp + "_top"].disabled = false; + + f.elements[fp + "_right"].value = ""; + f.elements[fp + "_right"].disabled = true; + f.elements[fp + "_bottom"].value = ""; + f.elements[fp + "_bottom"].disabled = true; + f.elements[fp + "_left"].value = ""; + f.elements[fp + "_left"].disabled = true; + + if (f.elements[fp + "_top_measurement"]) { + selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); + f.elements[fp + "_left_measurement"].disabled = true; + f.elements[fp + "_bottom_measurement"].disabled = true; + f.elements[fp + "_right_measurement"].disabled = true; + } + } else { + f.elements[fp + "_same"].checked = false; + + setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); + f.elements[fp + "_top"].disabled = false; + + setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf])); + f.elements[fp + "_right"].disabled = false; + + setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf])); + f.elements[fp + "_bottom"].disabled = false; + + setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf])); + f.elements[fp + "_left"].disabled = false; + + if (f.elements[fp + "_top_measurement"]) { + selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); + selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf])); + selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf])); + selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf])); + f.elements[fp + "_left_measurement"].disabled = false; + f.elements[fp + "_bottom_measurement"].disabled = false; + f.elements[fp + "_right_measurement"].disabled = false; + } + } +} + +function isSame(e, pr, sf, b) { + var a = [], i, x; + + if (typeof(b) == "undefined") + b = ['Top', 'Right', 'Bottom', 'Left']; + + if (typeof(sf) == "undefined" || sf == null) + sf = ""; + + a[0] = e.style[pr + b[0] + sf]; + a[1] = e.style[pr + b[1] + sf]; + a[2] = e.style[pr + b[2] + sf]; + a[3] = e.style[pr + b[3] + sf]; + + for (i=0; i<a.length; i++) { + if (a[i] == null) + return false; + + for (x=0; x<a.length; x++) { + if (a[x] != a[i]) + return false; + } + } + + return true; +}; + +function hasEqualValues(a) { + var i, x; + + for (i=0; i<a.length; i++) { + if (a[i] == null) + return false; + + for (x=0; x<a.length; x++) { + if (a[x] != a[i]) + return false; + } + } + + return true; +} + +function applyAction() { + var ce = document.getElementById('container'), ed = tinyMCEPopup.editor; + + generateCSS(); + + tinyMCEPopup.restoreSelection(); + ed.dom.setAttrib(ed.selection.getNode(), 'style', tinyMCEPopup.editor.dom.serializeStyle(tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText))); +} + +function updateAction() { + applyAction(); + tinyMCEPopup.close(); +} + +function generateCSS() { + var ce = document.getElementById('container'), f = document.forms[0], num = new RegExp('[0-9]+', 'g'), s, t; + + ce.style.cssText = ""; + + // Build text styles + ce.style.fontFamily = f.text_font.value; + ce.style.fontSize = f.text_size.value + (isNum(f.text_size.value) ? (f.text_size_measurement.value || 'px') : ""); + ce.style.fontStyle = f.text_style.value; + ce.style.lineHeight = f.text_lineheight.value + (isNum(f.text_lineheight.value) ? f.text_lineheight_measurement.value : ""); + ce.style.textTransform = f.text_case.value; + ce.style.fontWeight = f.text_weight.value; + ce.style.fontVariant = f.text_variant.value; + ce.style.color = f.text_color.value; + + s = ""; + s += f.text_underline.checked ? " underline" : ""; + s += f.text_overline.checked ? " overline" : ""; + s += f.text_linethrough.checked ? " line-through" : ""; + s += f.text_blink.checked ? " blink" : ""; + s = s.length > 0 ? s.substring(1) : s; + + if (f.text_none.checked) + s = "none"; + + ce.style.textDecoration = s; + + // Build background styles + + ce.style.backgroundColor = f.background_color.value; + ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : ""; + ce.style.backgroundRepeat = f.background_repeat.value; + ce.style.backgroundAttachment = f.background_attachment.value; + + if (f.background_hpos.value != "") { + s = ""; + s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " "; + s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : ""); + ce.style.backgroundPosition = s; + } + + // Build block styles + + ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : ""); + ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : ""); + ce.style.verticalAlign = f.block_vertical_alignment.value; + ce.style.textAlign = f.block_text_align.value; + ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : ""); + ce.style.whiteSpace = f.block_whitespace.value; + ce.style.display = f.block_display.value; + + // Build box styles + + ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : ""); + ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : ""); + ce.style.styleFloat = f.box_float.value; + + if (tinymce.isGecko) + ce.style.cssFloat = f.box_float.value; + + ce.style.clear = f.box_clear.value; + + if (!f.box_padding_same.checked) { + ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); + ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : ""); + ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : ""); + ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : ""); + } else + ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); + + if (!f.box_margin_same.checked) { + ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); + ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : ""); + ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : ""); + ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : ""); + } else + ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); + + // Build border styles + + if (!f.border_style_same.checked) { + ce.style.borderTopStyle = f.border_style_top.value; + ce.style.borderRightStyle = f.border_style_right.value; + ce.style.borderBottomStyle = f.border_style_bottom.value; + ce.style.borderLeftStyle = f.border_style_left.value; + } else + ce.style.borderStyle = f.border_style_top.value; + + if (!f.border_width_same.checked) { + ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); + ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : ""); + ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : ""); + ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : ""); + } else + ce.style.borderWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); + + if (!f.border_color_same.checked) { + ce.style.borderTopColor = f.border_color_top.value; + ce.style.borderRightColor = f.border_color_right.value; + ce.style.borderBottomColor = f.border_color_bottom.value; + ce.style.borderLeftColor = f.border_color_left.value; + } else + ce.style.borderColor = f.border_color_top.value; + + // Build list styles + + ce.style.listStyleType = f.list_type.value; + ce.style.listStylePosition = f.list_position.value; + ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : ""; + + // Build positioning styles + + ce.style.position = f.positioning_type.value; + ce.style.visibility = f.positioning_visibility.value; + + if (ce.style.width == "") + ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : ""); + + if (ce.style.height == "") + ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : ""); + + ce.style.zIndex = f.positioning_zindex.value; + ce.style.overflow = f.positioning_overflow.value; + + if (!f.positioning_placement_same.checked) { + ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); + ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : ""); + ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : ""); + ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : ""); + } else { + s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); + ce.style.top = s; + ce.style.right = s; + ce.style.bottom = s; + ce.style.left = s; + } + + if (!f.positioning_clip_same.checked) { + s = "rect("; + s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto"); + s += ")"; + + if (s != "rect(auto auto auto auto)") + ce.style.clip = s; + } else { + s = "rect("; + t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto"; + s += t + " "; + s += t + " "; + s += t + " "; + s += t + ")"; + + if (s != "rect(auto auto auto auto)") + ce.style.clip = s; + } + + ce.style.cssText = ce.style.cssText; +} + +function isNum(s) { + return new RegExp('[0-9]+', 'g').test(s); +} + +function showDisabledControls() { + var f = document.forms, i, a; + + for (i=0; i<f.length; i++) { + for (a=0; a<f[i].elements.length; a++) { + if (f[i].elements[a].disabled) + tinyMCEPopup.editor.dom.addClass(f[i].elements[a], "disabled"); + else + tinyMCEPopup.editor.dom.removeClass(f[i].elements[a], "disabled"); + } + } +} + +function fillSelect(f, s, param, dval, sep, em) { + var i, ar, p, se; + + f = document.forms[f]; + sep = typeof(sep) == "undefined" ? ";" : sep; + + if (em) + addSelectValue(f, s, "", ""); + + ar = tinyMCEPopup.getParam(param, dval).split(sep); + for (i=0; i<ar.length; i++) { + se = false; + + if (ar[i].charAt(0) == '+') { + ar[i] = ar[i].substring(1); + se = true; + } + + p = ar[i].split('='); + + if (p.length > 1) { + addSelectValue(f, s, p[0], p[1]); + + if (se) + selectByValue(f, s, p[1]); + } else { + addSelectValue(f, s, p[0], p[0]); + + if (se) + selectByValue(f, s, p[0]); + } + } +} + +function toggleSame(ce, pre) { + var el = document.forms[0].elements, i; + + if (ce.checked) { + el[pre + "_top"].disabled = false; + el[pre + "_right"].disabled = true; + el[pre + "_bottom"].disabled = true; + el[pre + "_left"].disabled = true; + + if (el[pre + "_top_measurement"]) { + el[pre + "_top_measurement"].disabled = false; + el[pre + "_right_measurement"].disabled = true; + el[pre + "_bottom_measurement"].disabled = true; + el[pre + "_left_measurement"].disabled = true; + } + } else { + el[pre + "_top"].disabled = false; + el[pre + "_right"].disabled = false; + el[pre + "_bottom"].disabled = false; + el[pre + "_left"].disabled = false; + + if (el[pre + "_top_measurement"]) { + el[pre + "_top_measurement"].disabled = false; + el[pre + "_right_measurement"].disabled = false; + el[pre + "_bottom_measurement"].disabled = false; + el[pre + "_left_measurement"].disabled = false; + } + } + + showDisabledControls(); +} + +function synch(fr, to) { + var f = document.forms[0]; + + f.elements[to].value = f.elements[fr].value; + + if (f.elements[fr + "_measurement"]) + selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value); +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..5026313e2e0b170a4807c56986abb078ad1ce786 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/langs/en_dlg.js @@ -0,0 +1,63 @@ +tinyMCE.addI18n('en.style_dlg',{ +title:"Edit CSS Style", +apply:"Apply", +text_tab:"Text", +background_tab:"Background", +block_tab:"Block", +box_tab:"Box", +border_tab:"Border", +list_tab:"List", +positioning_tab:"Positioning", +text_props:"Text", +text_font:"Font", +text_size:"Size", +text_weight:"Weight", +text_style:"Style", +text_variant:"Variant", +text_lineheight:"Line height", +text_case:"Case", +text_color:"Color", +text_decoration:"Decoration", +text_overline:"overline", +text_underline:"underline", +text_striketrough:"strikethrough", +text_blink:"blink", +text_none:"none", +background_color:"Background color", +background_image:"Background image", +background_repeat:"Repeat", +background_attachment:"Attachment", +background_hpos:"Horizontal position", +background_vpos:"Vertical position", +block_wordspacing:"Word spacing", +block_letterspacing:"Letter spacing", +block_vertical_alignment:"Vertical alignment", +block_text_align:"Text align", +block_text_indent:"Text indent", +block_whitespace:"Whitespace", +block_display:"Display", +box_width:"Width", +box_height:"Height", +box_float:"Float", +box_clear:"Clear", +padding:"Padding", +same:"Same for all", +top:"Top", +right:"Right", +bottom:"Bottom", +left:"Left", +margin:"Margin", +style:"Style", +width:"Width", +height:"Height", +color:"Color", +list_type:"Type", +bullet_image:"Bullet image", +position:"Position", +positioning_type:"Type", +visibility:"Visibility", +zindex:"Z-index", +overflow:"Overflow", +placement:"Placement", +clip:"Clip" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/props.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/props.htm new file mode 100644 index 0000000000000000000000000000000000000000..3a1582cf958bce42bebaff5b17559f0e58bfb1b9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/style/props.htm @@ -0,0 +1,730 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#style_dlg.title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="js/props.js"></script> + <link href="css/props.css" rel="stylesheet" type="text/css" /> +</head> + +<body id="styleprops" style="display: none"> +<form onsubmit="updateAction();return false;" action="#"> +<div class="tabs"> + <ul> + <li id="text_tab" class="current"><span><a href="javascript:mcTabs.displayTab('text_tab','text_panel');" onMouseDown="return false;">{#style_dlg.text_tab}</a></span></li> + <li id="background_tab"><span><a href="javascript:mcTabs.displayTab('background_tab','background_panel');" onMouseDown="return false;">{#style_dlg.background_tab}</a></span></li> + <li id="block_tab"><span><a href="javascript:mcTabs.displayTab('block_tab','block_panel');" onMouseDown="return false;">{#style_dlg.block_tab}</a></span></li> + <li id="box_tab"><span><a href="javascript:mcTabs.displayTab('box_tab','box_panel');" onMouseDown="return false;">{#style_dlg.box_tab}</a></span></li> + <li id="border_tab"><span><a href="javascript:mcTabs.displayTab('border_tab','border_panel');" onMouseDown="return false;">{#style_dlg.border_tab}</a></span></li> + <li id="list_tab"><span><a href="javascript:mcTabs.displayTab('list_tab','list_panel');" onMouseDown="return false;">{#style_dlg.list_tab}</a></span></li> + <li id="positioning_tab"><span><a href="javascript:mcTabs.displayTab('positioning_tab','positioning_panel');" onMouseDown="return false;">{#style_dlg.positioning_tab}</a></span></li> + </ul> +</div> + +<div class="panel_wrapper"> +<div id="text_panel" class="panel current"> + <table border="0" width="100%"> + <tr> + <td><label for="text_font">{#style_dlg.text_font}</label></td> + <td colspan="3"> + <select id="text_font" name="text_font" class="mceEditableSelect mceFocus"></select> + </td> + </tr> + <tr> + <td><label for="text_size">{#style_dlg.text_size}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="text_size" name="text_size" class="mceEditableSelect"></select></td> + <td> </td> + <td><select id="text_size_measurement" name="text_size_measurement"></select></td> + </tr> + </table> + </td> + <td><label for="text_weight">{#style_dlg.text_weight}</label></td> + <td> + <select id="text_weight" name="text_weight"></select> + </td> + </tr> + <tr> + <td><label for="text_style">{#style_dlg.text_style}</label></td> + <td> + <select id="text_style" name="text_style" class="mceEditableSelect"></select> + </td> + <td><label for="text_variant">{#style_dlg.text_variant}</label></td> + <td> + <select id="text_variant" name="text_variant"></select> + </td> + </tr> + <tr> + <td><label for="text_lineheight">{#style_dlg.text_lineheight}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> + <select id="text_lineheight" name="text_lineheight" class="mceEditableSelect"></select> + </td> + <td> </td> + <td><select id="text_lineheight_measurement" name="text_lineheight_measurement"></select></td> + </tr> + </table> + </td> + <td><label for="text_case">{#style_dlg.text_case}</label></td> + <td> + <select id="text_case" name="text_case"></select> + </td> + </tr> + <tr> + <td><label for="text_color">{#style_dlg.text_color}</label></td> + <td colspan="2"> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="text_color" name="text_color" type="text" value="" size="9" onChange="updateColor('text_color_pick','text_color');" /></td> + <td id="text_color_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + <tr> + <td valign="top" style="vertical-align: top; padding-top: 3px;">{#style_dlg.text_decoration}</td> + <td colspan="2"> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="text_underline" name="text_underline" class="checkbox" type="checkbox" /></td> + <td><label for="text_underline">{#style_dlg.text_underline}</label></td> + </tr> + <tr> + <td><input id="text_overline" name="text_overline" class="checkbox" type="checkbox" /></td> + <td><label for="text_overline">{#style_dlg.text_overline}</label></td> + </tr> + <tr> + <td><input id="text_linethrough" name="text_linethrough" class="checkbox" type="checkbox" /></td> + <td><label for="text_linethrough">{#style_dlg.text_striketrough}</label></td> + </tr> + <tr> + <td><input id="text_blink" name="text_blink" class="checkbox" type="checkbox" /></td> + <td><label for="text_blink">{#style_dlg.text_blink}</label></td> + </tr> + <tr> + <td><input id="text_none" name="text_none" class="checkbox" type="checkbox" /></td> + <td><label for="text_none">{#style_dlg.text_none}</label></td> + </tr> + </table> + </td> + </tr> + </table> +</div> + +<div id="background_panel" class="panel"> + <table border="0"> + <tr> + <td><label for="background_color">{#style_dlg.background_color}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="background_color" name="background_color" type="text" value="" size="9" onChange="updateColor('background_color_pick','background_color');" /></td> + <td id="background_color_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="background_image">{#style_dlg.background_image}</label></td> + <td><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="background_image" name="background_image" type="text" /></td> + <td id="background_image_browser"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="background_repeat">{#style_dlg.background_repeat}</label></td> + <td><select id="background_repeat" name="background_repeat" class="mceEditableSelect"></select></td> + </tr> + + <tr> + <td><label for="background_attachment">{#style_dlg.background_attachment}</label></td> + <td><select id="background_attachment" name="background_attachment" class="mceEditableSelect"></select></td> + </tr> + + <tr> + <td><label for="background_hpos">{#style_dlg.background_hpos}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="background_hpos" name="background_hpos" class="mceEditableSelect"></select></td> + <td> </td> + <td><select id="background_hpos_measurement" name="background_hpos_measurement"></select></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="background_vpos">{#style_dlg.background_vpos}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="background_vpos" name="background_vpos" class="mceEditableSelect"></select></td> + <td> </td> + <td><select id="background_vpos_measurement" name="background_vpos_measurement"></select></td> + </tr> + </table> + </td> + </tr> + </table> +</div> + +<div id="block_panel" class="panel"> + <table border="0"> + <tr> + <td><label for="block_wordspacing">{#style_dlg.block_wordspacing}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="block_wordspacing" name="block_wordspacing" class="mceEditableSelect"></select></td> + <td> </td> + <td><select id="block_wordspacing_measurement" name="block_wordspacing_measurement"></select></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="block_letterspacing">{#style_dlg.block_letterspacing}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="block_letterspacing" name="block_letterspacing" class="mceEditableSelect"></select></td> + <td> </td> + <td><select id="block_letterspacing_measurement" name="block_letterspacing_measurement"></select></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="block_vertical_alignment">{#style_dlg.block_vertical_alignment}</label></td> + <td><select id="block_vertical_alignment" name="block_vertical_alignment" class="mceEditableSelect"></select></td> + </tr> + + <tr> + <td><label for="block_text_align">{#style_dlg.block_text_align}</label></td> + <td><select id="block_text_align" name="block_text_align" class="mceEditableSelect"></select></td> + </tr> + + <tr> + <td><label for="block_text_indent">{#style_dlg.block_text_indent}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="block_text_indent" name="block_text_indent" /></td> + <td> </td> + <td><select id="block_text_indent_measurement" name="block_text_indent_measurement"></select></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td><label for="block_whitespace">{#style_dlg.block_whitespace}</label></td> + <td><select id="block_whitespace" name="block_whitespace" class="mceEditableSelect"></select></td> + </tr> + + <tr> + <td><label for="block_display">{#style_dlg.block_display}</label></td> + <td><select id="block_display" name="block_display" class="mceEditableSelect"></select></td> + </tr> + </table> +</div> + +<div id="box_panel" class="panel"> +<table border="0"> + <tr> + <td><label for="box_width">{#style_dlg.box_width}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_width" name="box_width" class="mceEditableSelect" onChange="synch('box_width','positioning_width');" /></td> + <td> </td> + <td><select id="box_width_measurement" name="box_width_measurement"></select></td> + </tr> + </table> + </td> + <td> <label for="box_float">{#style_dlg.box_float}</label></td> + <td><select id="box_float" name="box_float" class="mceEditableSelect"></select></td> + </tr> + + <tr> + <td><label for="box_height">{#style_dlg.box_height}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_height" name="box_height" class="mceEditableSelect" onChange="synch('box_height','positioning_height');" /></td> + <td> </td> + <td><select id="box_height_measurement" name="box_height_measurement"></select></td> + </tr> + </table> + </td> + <td> <label for="box_clear">{#style_dlg.box_clear}</label></td> + <td><select id="box_clear" name="box_clear" class="mceEditableSelect"></select></td> + </tr> +</table> +<div style="float: left; width: 49%"> + <fieldset> + <legend>{#style_dlg.padding}</legend> + + <table border="0"> + <tr> + <td> </td> + <td><input type="checkbox" id="box_padding_same" name="box_padding_same" class="checkbox" checked="checked" onClick="toggleSame(this,'box_padding');" /> <label for="box_padding_same">{#style_dlg.same}</label></td> + </tr> + <tr> + <td><label for="box_padding_top">{#style_dlg.top}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_padding_top" name="box_padding_top" class="mceEditableSelect" /></td> + <td> </td> + <td><select id="box_padding_top_measurement" name="box_padding_top_measurement"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td><label for="box_padding_right">{#style_dlg.right}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_padding_right" name="box_padding_right" class="mceEditableSelect" disabled="disabled" /></td> + <td> </td> + <td><select id="box_padding_right_measurement" name="box_padding_right_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td><label for="box_padding_bottom">{#style_dlg.bottom}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_padding_bottom" name="box_padding_bottom" class="mceEditableSelect" disabled="disabled" /></td> + <td> </td> + <td><select id="box_padding_bottom_measurement" name="box_padding_bottom_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td><label for="box_padding_left">{#style_dlg.left}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_padding_left" name="box_padding_left" class="mceEditableSelect" disabled="disabled" /></td> + <td> </td> + <td><select id="box_padding_left_measurement" name="box_padding_left_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> +</div> + +<div style="float: right; width: 49%"> + <fieldset> + <legend>{#style_dlg.margin}</legend> + + <table border="0"> + <tr> + <td> </td> + <td><input type="checkbox" id="box_margin_same" name="box_margin_same" class="checkbox" checked="checked" onClick="toggleSame(this,'box_margin');" /> <label for="box_margin_same">{#style_dlg.same}</label></td> + </tr> + <tr> + <td><label for="box_margin_top">{#style_dlg.top}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_margin_top" name="box_margin_top" class="mceEditableSelect" /></td> + <td> </td> + <td><select id="box_margin_top_measurement" name="box_margin_top_measurement"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td><label for="box_margin_right">{#style_dlg.right}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_margin_right" name="box_margin_right" class="mceEditableSelect" disabled="disabled" /></td> + <td> </td> + <td><select id="box_margin_right_measurement" name="box_margin_right_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td><label for="box_margin_bottom">{#style_dlg.bottom}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_margin_bottom" name="box_margin_bottom" class="mceEditableSelect" disabled="disabled" /></td> + <td> </td> + <td><select id="box_margin_bottom_measurement" name="box_margin_bottom_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td><label for="box_margin_left">{#style_dlg.left}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="box_margin_left" name="box_margin_left" class="mceEditableSelect" disabled="disabled" /></td> + <td> </td> + <td><select id="box_margin_left_measurement" name="box_margin_left_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> +</div> +<br style="clear: both" /> +</div> + +<div id="border_panel" class="panel"> +<table border="0" cellspacing="0" cellpadding="0" width="100%"> +<tr> + <td class="tdelim"> </td> + <td class="tdelim delim"> </td> + <td class="tdelim">{#style_dlg.style}</td> + <td class="tdelim delim"> </td> + <td class="tdelim">{#style_dlg.width}</td> + <td class="tdelim delim"> </td> + <td class="tdelim">{#style_dlg.color}</td> +</tr> + +<tr> + <td> </td> + <td class="delim"> </td> + <td><input type="checkbox" id="border_style_same" name="border_style_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_style');" /> <label for="border_style_same">{#style_dlg.same}</label></td> + <td class="delim"> </td> + <td><input type="checkbox" id="border_width_same" name="border_width_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_width');" /> <label for="border_width_same">{#style_dlg.same}</label></td> + <td class="delim"> </td> + <td><input type="checkbox" id="border_color_same" name="border_color_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_color');" /> <label for="border_color_same">{#style_dlg.same}</label></td> +</tr> + +<tr> + <td>{#style_dlg.top}</td> + <td class="delim"> </td> + <td><select id="border_style_top" name="border_style_top" class="mceEditableSelect"></select></td> + <td class="delim"> </td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="border_width_top" name="border_width_top" class="mceEditableSelect"></select></td> + <td> </td> + <td><select id="border_width_top_measurement" name="border_width_top_measurement"></select></td> + </tr> + </table> + </td> + <td class="delim"> </td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="border_color_top" name="border_color_top" type="text" value="" size="9" onChange="updateColor('border_color_top_pick','border_color_top');" /></td> + <td id="border_color_top_pickcontainer"> </td> + </tr> + </table> + </td> +</tr> + +<tr> + <td>{#style_dlg.right}</td> + <td class="delim"> </td> + <td><select id="border_style_right" name="border_style_right" class="mceEditableSelect" disabled="disabled"></select></td> + <td class="delim"> </td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="border_width_right" name="border_width_right" class="mceEditableSelect" disabled="disabled"></select></td> + <td> </td> + <td><select id="border_width_right_measurement" name="border_width_right_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + <td class="delim"> </td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="border_color_right" name="border_color_right" type="text" value="" size="9" onChange="updateColor('border_color_right_pick','border_color_right');" disabled="disabled" /></td> + <td id="border_color_right_pickcontainer"> </td> + </tr> + </table> + </td> +</tr> + +<tr> + <td>{#style_dlg.bottom}</td> + <td class="delim"> </td> + <td><select id="border_style_bottom" name="border_style_bottom" class="mceEditableSelect" disabled="disabled"></select></td> + <td class="delim"> </td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="border_width_bottom" name="border_width_bottom" class="mceEditableSelect" disabled="disabled"></select></td> + <td> </td> + <td><select id="border_width_bottom_measurement" name="border_width_bottom_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + <td class="delim"> </td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="border_color_bottom" name="border_color_bottom" type="text" value="" size="9" onChange="updateColor('border_color_bottom_pick','border_color_bottom');" disabled="disabled" /></td> + <td id="border_color_bottom_pickcontainer"> </td> + </tr> + </table> + </td> +</tr> + +<tr> + <td>{#style_dlg.left}</td> + <td class="delim"> </td> + <td><select id="border_style_left" name="border_style_left" class="mceEditableSelect" disabled="disabled"></select></td> + <td class="delim"> </td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><select id="border_width_left" name="border_width_left" class="mceEditableSelect" disabled="disabled"></select></td> + <td> </td> + <td><select id="border_width_left_measurement" name="border_width_left_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + <td class="delim"> </td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="border_color_left" name="border_color_left" type="text" value="" size="9" onChange="updateColor('border_color_left_pick','border_color_left');" disabled="disabled" /></td> + <td id="border_color_left_pickcontainer"> </td> + </tr> + </table> + </td> +</tr> +</table> +</div> + +<div id="list_panel" class="panel"> + <table border="0"> + <tr> + <td><label for="list_type">{#style_dlg.list_type}</label></td> + <td><select id="list_type" name="list_type" class="mceEditableSelect"></select></td> + </tr> + + <tr> + <td><label for="list_bullet_image">{#style_dlg.bullet_image}</label></td> + <td><input id="list_bullet_image" name="list_bullet_image" type="text" /></td> + </tr> + + <tr> + <td><label for="list_position">{#style_dlg.position}</label></td> + <td><select id="list_position" name="list_position" class="mceEditableSelect"></select></td> + </tr> + </table> +</div> + +<div id="positioning_panel" class="panel"> +<table border="0"> + <tr> + <td><label for="positioning_type">{#style_dlg.positioning_type}</label></td> + <td><select id="positioning_type" name="positioning_type" class="mceEditableSelect"></select></td> + <td> <label for="positioning_visibility">{#style_dlg.visibility}</label></td> + <td><select id="positioning_visibility" name="positioning_visibility" class="mceEditableSelect"></select></td> + </tr> + + <tr> + <td><label for="positioning_width">{#style_dlg.width}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_width" name="positioning_width" onChange="synch('positioning_width','box_width');" /></td> + <td> </td> + <td><select id="positioning_width_measurement" name="positioning_width_measurement"></select></td> + </tr> + </table> + </td> + <td> <label for="positioning_zindex">{#style_dlg.zindex}</label></td> + <td><input type="text" id="positioning_zindex" name="positioning_zindex" /></td> + </tr> + + <tr> + <td><label for="positioning_height">{#style_dlg.height}</label></td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_height" name="positioning_height" onChange="synch('positioning_height','box_height');" /></td> + <td> </td> + <td><select id="positioning_height_measurement" name="positioning_height_measurement"></select></td> + </tr> + </table> + </td> + <td> <label for="positioning_overflow">{#style_dlg.overflow}</label></td> + <td><select id="positioning_overflow" name="positioning_overflow" class="mceEditableSelect"></select></td> + </tr> +</table> + +<div style="float: left; width: 49%"> + <fieldset> + <legend>{#style_dlg.placement}</legend> + + <table border="0"> + <tr> + <td> </td> + <td><input type="checkbox" id="positioning_placement_same" name="positioning_placement_same" class="checkbox" checked="checked" onClick="toggleSame(this,'positioning_placement');" /> <label for="positioning_placement_same">{#style_dlg.same}</label></td> + </tr> + <tr> + <td>{#style_dlg.top}</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_placement_top" name="positioning_placement_top" /></td> + <td> </td> + <td><select id="positioning_placement_top_measurement" name="positioning_placement_top_measurement"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td>{#style_dlg.right}</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_placement_right" name="positioning_placement_right" disabled="disabled" /></td> + <td> </td> + <td><select id="positioning_placement_right_measurement" name="positioning_placement_right_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td>{#style_dlg.bottom}</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_placement_bottom" name="positioning_placement_bottom" disabled="disabled" /></td> + <td> </td> + <td><select id="positioning_placement_bottom_measurement" name="positioning_placement_bottom_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td>{#style_dlg.left}</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_placement_left" name="positioning_placement_left" disabled="disabled" /></td> + <td> </td> + <td><select id="positioning_placement_left_measurement" name="positioning_placement_left_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> +</div> + +<div style="float: right; width: 49%"> + <fieldset> + <legend>{#style_dlg.clip}</legend> + + <table border="0"> + <tr> + <td> </td> + <td><input type="checkbox" id="positioning_clip_same" name="positioning_clip_same" class="checkbox" checked="checked" onClick="toggleSame(this,'positioning_clip');" /> <label for="positioning_clip_same">{#style_dlg.same}</label></td> + </tr> + <tr> + <td>{#style_dlg.top}</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_clip_top" name="positioning_clip_top" /></td> + <td> </td> + <td><select id="positioning_clip_top_measurement" name="positioning_clip_top_measurement"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td>{#style_dlg.right}</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_clip_right" name="positioning_clip_right" disabled="disabled" /></td> + <td> </td> + <td><select id="positioning_clip_right_measurement" name="positioning_clip_right_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td>{#style_dlg.bottom}</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_clip_bottom" name="positioning_clip_bottom" disabled="disabled" /></td> + <td> </td> + <td><select id="positioning_clip_bottom_measurement" name="positioning_clip_bottom_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + <tr> + <td>{#style_dlg.left}</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="text" id="positioning_clip_left" name="positioning_clip_left" disabled="disabled" /></td> + <td> </td> + <td><select id="positioning_clip_left_measurement" name="positioning_clip_left_measurement" disabled="disabled"></select></td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> +</div> +<br style="clear: both" /> +</div> +</div> + +<div class="mceActionPanel"> + <div style="float: left"> + <div style="float: left"><input type="submit" id="insert" name="insert" value="{#update}" /></div> + + <div style="float: left"> <input type="button" class="button" id="apply" name="apply" value="{#style_dlg.apply}" onClick="applyAction();" /></div> + <br style="clear: both" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onClick="tinyMCEPopup.close();" /> + </div> +</div> +</form> + +<div style="display: none"> + <div id="container"></div> +</div> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/tabfocus/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/tabfocus/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..7f1fe26149336954c78cd0cd96dc407d6fa92a4c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/tabfocus/editor_plugin.js @@ -0,0 +1 @@ +(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m<n.length;m++){if(n[m].type!="hidden"){return n[m]}}}else{for(m=j-1;m>=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.EditorManager.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/tabfocus/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/tabfocus/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..0fa8d815db8cecc7ec1b9c78fc044d32d3b483c5 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/tabfocus/editor_plugin_src.js @@ -0,0 +1,109 @@ +/** + * $Id: editor_plugin_src.js 787 2008-04-10 11:40:57Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode; + + tinymce.create('tinymce.plugins.TabFocusPlugin', { + init : function(ed, url) { + function tabCancel(ed, e) { + if (e.keyCode === 9) + return Event.cancel(e); + }; + + function tabHandler(ed, e) { + var x, i, f, el, v; + + function find(d) { + f = DOM.getParent(ed.id, 'form'); + el = f.elements; + + if (f) { + each(el, function(e, i) { + if (e.id == ed.id) { + x = i; + return false; + } + }); + + if (d > 0) { + for (i = x + 1; i < el.length; i++) { + if (el[i].type != 'hidden') + return el[i]; + } + } else { + for (i = x - 1; i >= 0; i--) { + if (el[i].type != 'hidden') + return el[i]; + } + } + } + + return null; + }; + + if (e.keyCode === 9) { + v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next'))); + + if (v.length == 1) { + v[1] = v[0]; + v[0] = ':prev'; + } + + // Find element to focus + if (e.shiftKey) { + if (v[0] == ':prev') + el = find(-1); + else + el = DOM.get(v[0]); + } else { + if (v[1] == ':next') + el = find(1); + else + el = DOM.get(v[1]); + } + + if (el) { + if (ed = tinymce.EditorManager.get(el.id || el.name)) + ed.focus(); + else + window.setTimeout(function() {window.focus();el.focus();}, 10); + + return Event.cancel(e); + } + } + }; + + ed.onKeyUp.add(tabCancel); + + if (tinymce.isGecko) { + ed.onKeyPress.add(tabHandler); + ed.onKeyDown.add(tabCancel); + } else + ed.onKeyDown.add(tabHandler); + + ed.onInit.add(function() { + each(DOM.select('a:first,a:last', ed.getContainer()), function(n) { + Event.add(n, 'focus', function() {ed.focus();}); + }); + }); + }, + + getInfo : function() { + return { + longname : 'Tabfocus', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/cell.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/cell.htm new file mode 100644 index 0000000000000000000000000000000000000000..1fabc8dc211e19c2a6243498894f69d382112498 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/cell.htm @@ -0,0 +1,183 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#table_dlg.cell_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/cell.js"></script> + <link href="css/cell.css" rel="stylesheet" type="text/css" /> +</head> +<body id="tablecell" style="display: none"> + <form onsubmit="updateAction();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li> + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#table_dlg.general_props}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td><label for="align">{#table_dlg.align}</label></td> + <td> + <select id="align" name="align" class="mceFocus"> + <option value="">{#not_set}</option> + <option value="center">{#table_dlg.align_middle}</option> + <option value="left">{#table_dlg.align_left}</option> + <option value="right">{#table_dlg.align_right}</option> + </select> + </td> + + <td><label for="celltype">{#table_dlg.cell_type}</label></td> + <td> + <select id="celltype" name="celltype"> + <option value="td">{#table_dlg.td}</option> + <option value="th">{#table_dlg.th}</option> + </select> + </td> + </tr> + + <tr> + <td><label for="valign">{#table_dlg.valign}</label></td> + <td> + <select id="valign" name="valign"> + <option value="">{#not_set}</option> + <option value="top">{#table_dlg.align_top}</option> + <option value="middle">{#table_dlg.align_middle}</option> + <option value="bottom">{#table_dlg.align_bottom}</option> + </select> + </td> + + <td><label for="scope">{#table_dlg.scope}</label></td> + <td> + <select id="scope" name="scope"> + <option value="">{#not_set}</option> + <option value="col">{#table.col}</option> + <option value="row">{#table.row}</option> + <option value="rowgroup">{#table_dlg.rowgroup}</option> + <option value="colgroup">{#table_dlg.colgroup}</option> + </select> + </td> + + </tr> + + <tr> + <td><label for="width">{#table_dlg.width}</label></td> + <td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td> + + <td><label for="height">{#table_dlg.height}</label></td> + <td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td> + </tr> + + <tr id="styleSelectRow"> + <td><label for="class">{#class_name}</label></td> + <td colspan="3"> + <select id="class" name="class" class="mceEditableSelect"> + <option value="" selected="selected">{#not_set}</option> + </select> + </td> + </tr> + </table> + </fieldset> + </div> + + <div id="advanced_panel" class="panel"> + <fieldset> + <legend>{#table_dlg.advanced_props}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="column1"><label for="id">{#table_dlg.id}</label></td> + <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td> + </tr> + + <tr> + <td><label for="style">{#table_dlg.style}</label></td> + <td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td> + </tr> + + <tr> + <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> + <td> + <select id="dir" name="dir" style="width: 200px"> + <option value="">{#not_set}</option> + <option value="ltr">{#table_dlg.ltr}</option> + <option value="rtl">{#table_dlg.rtl}</option> + </select> + </td> + </tr> + + <tr> + <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td> + <td> + <input id="lang" name="lang" type="text" value="" style="width: 200px" /> + </td> + </tr> + + <tr> + <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td> + <td id="backgroundimagebrowsercontainer"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td> + <td id="bordercolor_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td> + <td id="bgcolor_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div> + <select id="action" name="action"> + <option value="cell">{#table_dlg.cell_cell}</option> + <option value="row">{#table_dlg.cell_row}</option> + <option value="all">{#table_dlg.cell_all}</option> + </select> + </div> + + <div style="float: left"> + <div><input type="submit" id="insert" name="insert" value="{#update}" /></div> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/cell.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/cell.css new file mode 100644 index 0000000000000000000000000000000000000000..a067ecdfedbc8a1140bec2ec0d3b2c24e6ceb8fc --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/cell.css @@ -0,0 +1,17 @@ +/* CSS file for cell dialog in the table plugin */ + +.panel_wrapper div.current { + height: 200px; +} + +.advfield { + width: 200px; +} + +#action { + margin-bottom: 3px; +} + +#class { + width: 150px; +} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/row.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/row.css new file mode 100644 index 0000000000000000000000000000000000000000..1f7755dafa8eb34a1604c80fa4a92a7626b8bc2b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/row.css @@ -0,0 +1,25 @@ +/* CSS file for row dialog in the table plugin */ + +.panel_wrapper div.current { + height: 200px; +} + +.advfield { + width: 200px; +} + +#action { + margin-bottom: 3px; +} + +#rowtype,#align,#valign,#class,#height { + width: 150px; +} + +#height { + width: 50px; +} + +.col2 { + padding-left: 20px; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/table.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/table.css new file mode 100644 index 0000000000000000000000000000000000000000..d11c3f69cba0a9469303f2ac9e159b3dc8e3fc51 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/css/table.css @@ -0,0 +1,13 @@ +/* CSS file for table dialog in the table plugin */ + +.panel_wrapper div.current { + height: 245px; +} + +.advfield { + width: 200px; +} + +#class { + width: 150px; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..95d599e90b2c8f3215769d7854028ce4a6347d36 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.TablePlugin",{init:function(b,c){var d=this;d.editor=b;d.url=c;a([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(e){b.addButton(e[0],{title:e[1],cmd:e[2],ui:e[3]})});if(b.getParam("inline_styles")){b.onPreProcess.add(function(e,g){var f=e.dom;a(f.select("table",g.node),function(i){var h;if(h=f.getAttrib(i,"width")){f.setStyle(i,"width",h);f.setAttrib(i,"width")}if(h=f.getAttrib(i,"height")){f.setStyle(i,"height",h);f.setAttrib(i,"height")}})})}b.onInit.add(function(){if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(h,f,j){var k,i=b.selection,g=i.getNode()||b.getBody();if(b.dom.getParent(j,"td")||b.dom.getParent(j,"th")){f.removeAll();if(g.nodeName=="A"&&!b.dom.getAttrib(g,"name")){f.add({title:"advanced.link_desc",icon:"link",cmd:b.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});f.addSeparator()}if(g.nodeName=="IMG"&&g.className.indexOf("mceItem")==-1){f.add({title:"advanced.image_desc",icon:"image",cmd:b.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator()}f.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true,value:{action:"insert"}});f.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable",ui:true});f.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete",ui:true});f.addSeparator();k=f.addMenu({title:"table.cell"});k.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps",ui:true});k.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells",ui:true});k.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells",ui:true});k=f.addMenu({title:"table.row"});k.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps",ui:true});k.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});k.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});k.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});k.addSeparator();k.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});k.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});k.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"});k.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"});k=f.addMenu({title:"table.col"});k.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});k.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});k.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{f.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true})}})}});b.onKeyDown.add(function(f,g){if(g.keyCode==9&&f.dom.getParent(f.selection.getNode(),"TABLE")){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(f.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(g)}f.undoManager.add()}});if(!tinymce.isIE){if(b.getParam("table_selection",true)){b.onClick.add(function(f,g){g=g.target;if(g.nodeName==="TABLE"){f.selection.select(g)}})}}b.onNodeChange.add(function(f,e,h){var g=f.dom.getParent(h,"td,th,caption");e.setActive("table",h.nodeName==="TABLE"||!!g);if(g&&g.nodeName==="CAPTION"){g=null}e.setDisabled("delete_table",!g);e.setDisabled("delete_col",!g);e.setDisabled("delete_table",!g);e.setDisabled("delete_row",!g);e.setDisabled("col_after",!g);e.setDisabled("col_before",!g);e.setDisabled("row_after",!g);e.setDisabled("row_before",!g);e.setDisabled("row_props",!g);e.setDisabled("cell_props",!g);e.setDisabled("split_cells",!g||(parseInt(f.dom.getAttrib(g,"colspan","1"))<2&&parseInt(f.dom.getAttrib(g,"rowspan","1"))<2));e.setDisabled("merge_cells",!g)});if(!tinymce.isIE){b.onBeforeSetContent.add(function(e,f){if(f.initial){f.content=f.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?"<$1$2> </$1>":'<$1$2><br mce_bogus="1" /></$1>')}})}},execCommand:function(f,e,g){var d=this.editor,c;switch(f){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":d.execCommand("mceBeginUndoLevel");this._doExecCommand(f,e,g);d.execCommand("mceEndUndoLevel");return true}return false},getInfo:function(){return{longname:"Tables",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_doExecCommand:function(r,Z,ae){var V=this.editor,au=V,g=this.url;var n=V.selection.getNode();var W=V.dom.getParent(n,"tr");var aq=V.dom.getParent(n,"td,th");var F=V.dom.getParent(n,"table");var k=V.contentWindow.document;var av=F?F.getAttribute("border"):"";if(W&&aq==null){aq=W.cells[0]}function ap(y,x){for(var ax=0;ax<y.length;ax++){if(y[ax].length>0&&ap(y[ax],x)){return true}if(y[ax]==x){return true}}return false}function aj(x,i){var y;ad=e(F);x=x||0;i=i||0;x=Math.max(o.cellindex+x,0);i=Math.max(o.rowindex+i,0);V.execCommand("mceRepaint");y=d(ad,i,x);if(y){V.selection.select(y.firstChild||y);V.selection.collapse(1)}}function ah(){var i=k.createElement("td");if(!tinymce.isIE){i.innerHTML='<br mce_bogus="1"/>'}}function j(y){var x=V.dom.getAttrib(y,"colspan");var i=V.dom.getAttrib(y,"rowspan");x=x==""?1:parseInt(x);i=i==""?1:parseInt(i);return{colspan:x,rowspan:i}}function al(ax,az){var i,ay;for(ay=0;ay<ax.length;ay++){for(i=0;i<ax[ay].length;i++){if(ax[ay][i]==az){return{cellindex:i,rowindex:ay}}}}return null}function d(x,y,i){if(x[y]&&x[y][i]){return x[y][i]}return null}function A(aC,ax){var az=[],y=0,aA,ay,ax,aB;for(aA=0;aA<aC.rows.length;aA++){for(ay=0;ay<aC.rows[aA].cells.length;ay++,y++){az[y]=aC.rows[aA].cells[ay]}}for(aA=0;aA<az.length;aA++){if(az[aA]==ax){if(aB=az[aA+1]){return aB}}}}function e(aE){var i=[],aF=aE.rows,aC,aB,ay,az,aD,ax,aA;for(aB=0;aB<aF.length;aB++){for(aC=0;aC<aF[aB].cells.length;aC++){ay=aF[aB].cells[aC];az=j(ay);for(aD=aC;i[aB]&&i[aB][aD];aD++){}for(aA=aB;aA<aB+az.rowspan;aA++){if(!i[aA]){i[aA]=[]}for(ax=aD;ax<aD+az.colspan;ax++){i[aA][ax]=ay}}}}return i}function m(aG,aD,ay,ax){var y=e(aG),aF=al(y,ay);var aH,aC;if(ax.cells.length!=aD.childNodes.length){aH=aD.childNodes;aC=null;for(var aE=0;ay=d(y,aF.rowindex,aE);aE++){var aA=true;var aB=j(ay);if(ap(aH,ay)){ax.childNodes[aE]._delete=true}else{if((aC==null||ay!=aC)&&aB.colspan>1){for(var az=aE;az<aE+ay.colSpan;az++){ax.childNodes[az]._delete=true}}}if((aC==null||ay!=aC)&&aB.rowspan>1){ay.rowSpan=aB.rowspan+1}aC=ay}B(F)}}function O(x,i){while((x=x.previousSibling)!=null){if(x.nodeName==i){return x}}return null}function af(ax,ay){var x=ay.split(",");while((ax=ax.nextSibling)!=null){for(var y=0;y<x.length;y++){if(ax.nodeName.toLowerCase()==x[y].toLowerCase()){return ax}}}return null}function B(ax){if(ax.rows==0){return}var y=ax.rows[0];do{var x=af(y,"TR");if(y._delete){y.parentNode.removeChild(y);continue}var ay=y.cells[0];if(ay.cells>1){do{var i=af(ay,"TD,TH");if(ay._delete){ay.parentNode.removeChild(ay)}}while((ay=i)!=null)}}while((y=x)!=null)}function p(ax,aA,az){ax.rowSpan=1;var x=af(aA,"TR");for(var ay=1;ay<az&&x;ay++){var y=k.createElement("td");if(!tinymce.isIE){y.innerHTML='<br mce_bogus="1"/>'}if(tinymce.isIE){x.insertBefore(y,x.cells(ax.cellIndex))}else{x.insertBefore(y,x.cells[ax.cellIndex])}x=af(x,"TR")}}function S(aF,aH,aB){var y=e(aH);var ax=aB.cloneNode(false);var aG=al(y,aB.cells[0]);var aC=null;var aA=V.dom.getAttrib(aH,"border");var az=null;for(var aE=0;az=d(y,aG.rowindex,aE);aE++){var aD=null;if(aC!=az){for(var ay=0;ay<aB.cells.length;ay++){if(az==aB.cells[ay]){aD=az.cloneNode(true);break}}}if(aD==null){aD=aF.createElement("td");if(!tinymce.isIE){aD.innerHTML='<br mce_bogus="1"/>'}}aD.colSpan=1;aD.rowSpan=1;ax.appendChild(aD);aC=az}return ax}switch(r){case"mceTableMoveToNextRow":var L=A(F,aq);if(!L){V.execCommand("mceTableInsertRowAfter",aq);L=A(F,aq)}V.selection.select(L);V.selection.collapse(true);return true;case"mceTableRowProps":if(W==null){return true}if(Z){V.windowManager.open({url:g+"/row.htm",width:400+parseInt(V.getLang("table.rowprops_delta_width",0)),height:295+parseInt(V.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:g})}return true;case"mceTableCellProps":if(aq==null){return true}if(Z){V.windowManager.open({url:g+"/cell.htm",width:400+parseInt(V.getLang("table.cellprops_delta_width",0)),height:295+parseInt(V.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:g})}return true;case"mceInsertTable":if(Z){V.windowManager.open({url:g+"/table.htm",width:400+parseInt(V.getLang("table.table_delta_width",0)),height:320+parseInt(V.getLang("table.table_delta_height",0)),inline:1},{plugin_url:g,action:ae?ae.action:0})}return true;case"mceTableDelete":var G=V.dom.getParent(V.selection.getNode(),"table");if(G){G.parentNode.removeChild(G);V.execCommand("mceRepaint")}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!F){return true}if(W&&F!=W.parentNode){F=W.parentNode}if(F&&W){switch(r){case"mceTableCutRow":if(!W||!aq){return true}V.tableRowClipboard=S(k,F,W);V.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!W||!aq){return true}V.tableRowClipboard=S(k,F,W);break;case"mceTablePasteRowBefore":if(!W||!aq){return true}var v=V.tableRowClipboard.cloneNode(true);var h=O(W,"TR");if(h!=null){m(F,h,h.cells[0],v)}W.parentNode.insertBefore(v,W);break;case"mceTablePasteRowAfter":if(!W||!aq){return true}var X=af(W,"TR");var v=V.tableRowClipboard.cloneNode(true);m(F,W,aq,v);if(X==null){W.parentNode.appendChild(v)}else{X.parentNode.insertBefore(v,X)}break;case"mceTableInsertRowBefore":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var v=k.createElement("tr");var u=null;o.rowindex--;if(o.rowindex<0){o.rowindex=0}for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan==1){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.colSpan=aq.colSpan;v.appendChild(J)}else{aq.rowSpan=E.rowspan+1}u=aq}}W.parentNode.insertBefore(v,W);aj(0,1);break;case"mceTableInsertRowAfter":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var v=k.createElement("tr");var u=null;for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan==1){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.colSpan=aq.colSpan;v.appendChild(J)}else{aq.rowSpan=E.rowspan+1}u=aq}}if(v.hasChildNodes()){var X=af(W,"TR");if(X){X.parentNode.insertBefore(v,X)}else{F.appendChild(v)}}aj(0,1);break;case"mceTableDeleteRow":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);if(ad.length==1&&F.nodeName=="TBODY"){V.dom.remove(V.dom.getParent(F,"table"));return true}var D=W.cells;var X=af(W,"TR");for(var ac=0;ac<D.length;ac++){if(D[ac].rowSpan>1){var J=D[ac].cloneNode(true);var E=j(D[ac]);J.rowSpan=E.rowspan-1;var ak=X.cells[ac];if(ak==null){X.appendChild(J)}else{X.insertBefore(J,ak)}}}var u=null;for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan>1){aq.rowSpan=E.rowspan-1}else{W=aq.parentNode;if(W.parentNode){W._delete=true}}u=aq}}B(F);aj(0,-1);break;case"mceTableInsertColBefore":if(!W||!aq){return true}var ad=e(V.dom.getParent(F,"table"));var o=al(ad,aq);var u=null;for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan==1){var J=k.createElement(aq.nodeName);if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.rowSpan=aq.rowSpan;aq.parentNode.insertBefore(J,aq)}else{aq.colSpan++}u=aq}}aj();break;case"mceTableInsertColAfter":if(!W||!aq){return true}var ad=e(V.dom.getParent(F,"table"));var o=al(ad,aq);var u=null;for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan==1){var J=k.createElement(aq.nodeName);if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.rowSpan=aq.rowSpan;var ak=af(aq,"TD,TH");if(ak==null){aq.parentNode.appendChild(J)}else{ak.parentNode.insertBefore(J,ak)}}else{aq.colSpan++}u=aq}}aj(1);break;case"mceTableDeleteCol":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var u=null;if((ad.length>1&&ad[0].length<=1)&&F.nodeName=="TBODY"){V.dom.remove(V.dom.getParent(F,"table"));return true}for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan>1){aq.colSpan=E.colspan-1}else{if(aq.parentNode){aq.parentNode.removeChild(aq)}}u=aq}}aj(-1);break;case"mceTableSplitCells":if(!W||!aq){return true}var l=j(aq);var C=l.colspan;var H=l.rowspan;if(C>1||H>1){aq.colSpan=1;for(var am=1;am<C;am++){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}W.insertBefore(J,af(aq,"TD,TH"));if(H>1){p(J,W,H)}}p(aq,W,H)}F=V.dom.getParent(V.selection.getNode(),"table");break;case"mceTableMergeCells":var ao=[];var R=V.selection.getSel();var ad=e(F);if(tinymce.isIE||R.rangeCount==1){if(Z){var t=j(aq);V.windowManager.open({url:g+"/merge_cells.htm",width:240+parseInt(V.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(V.getLang("table.merge_cells_delta_height",0)),inline:1},{action:"update",numcols:t.colspan,numrows:t.rowspan,plugin_url:g});return true}else{var U=parseInt(ae.numrows);var c=parseInt(ae.numcols);var o=al(ad,aq);if((""+U)=="NaN"){U=1}if((""+c)=="NaN"){c=1}var b=F.rows;for(var aa=o.rowindex;aa<ad.length;aa++){var ag=[];for(var ac=o.cellindex;ac<ad[aa].length;ac++){var f=d(ad,aa,ac);if(f&&!ap(ao,f)&&!ap(ag,f)){var N=al(ad,f);if(N.cellindex<o.cellindex+c&&N.rowindex<o.rowindex+U){ag[ag.length]=f}}}if(ag.length>0){ao[ao.length]=ag}var f=d(ad,o.rowindex,o.cellindex);a(au.dom.select("br",f),function(y,x){if(x>0&&au.dom.getAttrib("mce_bogus")){au.dom.remove(y)}})}}}else{var D=[];var R=V.selection.getSel();var Y=null;var an=null;var z=-1,aw=-1,w,at;if(R.rangeCount<2){return true}for(var am=0;am<R.rangeCount;am++){var ai=R.getRangeAt(am);var aq=ai.startContainer.childNodes[ai.startOffset];if(!aq){break}if(aq.nodeName=="TD"||aq.nodeName=="TH"){D[D.length]=aq}}var b=F.rows;for(var aa=0;aa<b.length;aa++){var ag=[];for(var ac=0;ac<b[aa].cells.length;ac++){var f=b[aa].cells[ac];for(var am=0;am<D.length;am++){if(f==D[am]){ag[ag.length]=f}}}if(ag.length>0){ao[ao.length]=ag}}var an=[];var Y=null;for(var aa=0;aa<ad.length;aa++){for(var ac=0;ac<ad[aa].length;ac++){ad[aa][ac]._selected=false;for(var am=0;am<D.length;am++){if(ad[aa][ac]==D[am]){if(z==-1){z=ac;aw=aa}w=ac;at=aa;ad[aa][ac]._selected=true}}}}for(var aa=aw;aa<=at;aa++){for(var ac=z;ac<=w;ac++){if(!ad[aa][ac]._selected){alert("Invalid selection for merge.");return true}}}}var s=1,q=1;var T=-1;for(var aa=0;aa<ao.length;aa++){var I=0;for(var ac=0;ac<ao[aa].length;ac++){var E=j(ao[aa][ac]);I+=E.colspan;if(T!=-1&&E.rowspan!=T){alert("Invalid selection for merge.");return true}T=E.rowspan}if(I>q){q=I}T=-1}var Q=-1;for(var ac=0;ac<ao[0].length;ac++){var M=0;for(var aa=0;aa<ao.length;aa++){var E=j(ao[aa][ac]);M+=E.rowspan;if(Q!=-1&&E.colspan!=Q){alert("Invalid selection for merge.");return true}Q=E.colspan}if(M>s){s=M}Q=-1}aq=ao[0][0];aq.rowSpan=s;aq.colSpan=q;for(var aa=0;aa<ao.length;aa++){for(var ac=0;ac<ao[aa].length;ac++){var P=ao[aa][ac].innerHTML;var K=P.replace(/[ \t\r\n]/g,"");if(K!="<br/>"&&K!="<br>"&&K!='<br mce_bogus="1"/>'&&(ac+aa>0)){aq.innerHTML+=P}if(ao[aa][ac]!=aq&&!ao[aa][ac]._deleted){var o=al(ad,ao[aa][ac]);var ar=ao[aa][ac].parentNode;ar.removeChild(ao[aa][ac]);ao[aa][ac]._deleted=true;if(!ar.hasChildNodes()){ar.parentNode.removeChild(ar);var ab=null;for(var ac=0;cellElm=d(ad,o.rowindex,ac);ac++){if(cellElm!=ab&&cellElm.rowSpan>1){cellElm.rowSpan--}ab=cellElm}if(aq.rowSpan>1){aq.rowSpan--}}}}}a(au.dom.select("br",aq),function(y,x){if(x>0&&au.dom.getAttrib(y,"mce_bogus")){au.dom.remove(y)}});break}F=V.dom.getParent(V.selection.getNode(),"table");V.addVisual(F);V.nodeChanged()}return true}return false}});tinymce.PluginManager.add("table",tinymce.plugins.TablePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..80cf748a305b86bd6bff86a75a006ed0f048286f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/editor_plugin_src.js @@ -0,0 +1,1136 @@ +/** + * $Id: editor_plugin_src.js 953 2008-11-04 10:16:50Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.TablePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + // Register buttons + each([ + ['table', 'table.desc', 'mceInsertTable', true], + ['delete_table', 'table.del', 'mceTableDelete'], + ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'], + ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'], + ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'], + ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'], + ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'], + ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'], + ['row_props', 'table.row_desc', 'mceTableRowProps', true], + ['cell_props', 'table.cell_desc', 'mceTableCellProps', true], + ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true], + ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true] + ], function(c) { + ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]}); + }); + + if (ed.getParam('inline_styles')) { + // Force move of attribs to styles in strict mode + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + each(dom.select('table', o.node), function(n) { + var v; + + if (v = dom.getAttrib(n, 'width')) { + dom.setStyle(n, 'width', v); + dom.setAttrib(n, 'width'); + } + + if (v = dom.getAttrib(n, 'height')) { + dom.setStyle(n, 'height', v); + dom.setAttrib(n, 'height'); + } + }); + }); + } + + ed.onInit.add(function() { + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + var sm, se = ed.selection, el = se.getNode() || ed.getBody(); + + if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) { + m.removeAll(); + + if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) { + m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true}); + m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'}); + m.addSeparator(); + } + + if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) { + m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true}); + m.addSeparator(); + } + + m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}}); + m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true}); + m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true}); + m.addSeparator(); + + // Cell menu + sm = m.addMenu({title : 'table.cell'}); + sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true}); + sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true}); + sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true}); + + // Row menu + sm = m.addMenu({title : 'table.row'}); + sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true}); + sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'}); + sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'}); + sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'}); + sm.addSeparator(); + sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'}); + sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'}); + sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}); + sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}); + + // Column menu + sm = m.addMenu({title : 'table.col'}); + sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'}); + sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'}); + sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'}); + } else + m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true}); + }); + } + }); + + // Add undo level when new rows are created using the tab key + ed.onKeyDown.add(function(ed, e) { + if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE')) { + if (!tinymce.isGecko && !tinymce.isOpera) { + tinyMCE.execInstanceCommand(ed.editorId, "mceTableMoveToNextRow", true); + return tinymce.dom.Event.cancel(e); + } + + ed.undoManager.add(); + } + }); + + // Select whole table is a table border is clicked + if (!tinymce.isIE) { + if (ed.getParam('table_selection', true)) { + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName === 'TABLE') + ed.selection.select(e); + }); + } + } + + ed.onNodeChange.add(function(ed, cm, n) { + var p = ed.dom.getParent(n, 'td,th,caption'); + + cm.setActive('table', n.nodeName === 'TABLE' || !!p); + if (p && p.nodeName === 'CAPTION') + p = null; + + cm.setDisabled('delete_table', !p); + cm.setDisabled('delete_col', !p); + cm.setDisabled('delete_table', !p); + cm.setDisabled('delete_row', !p); + cm.setDisabled('col_after', !p); + cm.setDisabled('col_before', !p); + cm.setDisabled('row_after', !p); + cm.setDisabled('row_before', !p); + cm.setDisabled('row_props', !p); + cm.setDisabled('cell_props', !p); + cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2)); + cm.setDisabled('merge_cells', !p); + }); + + // Padd empty table cells + if (!tinymce.isIE) { + ed.onBeforeSetContent.add(function(ed, o) { + if (o.initial) + o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2> </$1>' : '<$1$2><br mce_bogus="1" /></$1>'); + }); + } + }, + + execCommand : function(cmd, ui, val) { + var ed = this.editor, b; + + // Is table command + switch (cmd) { + case "mceTableMoveToNextRow": + case "mceInsertTable": + case "mceTableRowProps": + case "mceTableCellProps": + case "mceTableSplitCells": + case "mceTableMergeCells": + case "mceTableInsertRowBefore": + case "mceTableInsertRowAfter": + case "mceTableDeleteRow": + case "mceTableInsertColBefore": + case "mceTableInsertColAfter": + case "mceTableDeleteCol": + case "mceTableCutRow": + case "mceTableCopyRow": + case "mceTablePasteRowBefore": + case "mceTablePasteRowAfter": + case "mceTableDelete": + ed.execCommand('mceBeginUndoLevel'); + this._doExecCommand(cmd, ui, val); + ed.execCommand('mceEndUndoLevel'); + + return true; + } + + // Pass to next handler in chain + return false; + }, + + getInfo : function() { + return { + longname : 'Tables', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + /** + * Executes the table commands. + */ + _doExecCommand : function(command, user_interface, value) { + var inst = this.editor, ed = inst, url = this.url; + var focusElm = inst.selection.getNode(); + var trElm = inst.dom.getParent(focusElm, "tr"); + var tdElm = inst.dom.getParent(focusElm, "td,th"); + var tableElm = inst.dom.getParent(focusElm, "table"); + var doc = inst.contentWindow.document; + var tableBorder = tableElm ? tableElm.getAttribute("border") : ""; + + // Get first TD if no TD found + if (trElm && tdElm == null) + tdElm = trElm.cells[0]; + + function inArray(ar, v) { + for (var i=0; i<ar.length; i++) { + // Is array + if (ar[i].length > 0 && inArray(ar[i], v)) + return true; + + // Found value + if (ar[i] == v) + return true; + } + + return false; + } + + function select(dx, dy) { + var td; + + grid = getTableGrid(tableElm); + dx = dx || 0; + dy = dy || 0; + dx = Math.max(cpos.cellindex + dx, 0); + dy = Math.max(cpos.rowindex + dy, 0); + + // Recalculate grid and select + inst.execCommand('mceRepaint'); + td = getCell(grid, dy, dx); + + if (td) { + inst.selection.select(td.firstChild || td); + inst.selection.collapse(1); + } + }; + + function makeTD() { + var newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '<br mce_bogus="1"/>'; + } + + function getColRowSpan(td) { + var colspan = inst.dom.getAttrib(td, "colspan"); + var rowspan = inst.dom.getAttrib(td, "rowspan"); + + colspan = colspan == "" ? 1 : parseInt(colspan); + rowspan = rowspan == "" ? 1 : parseInt(rowspan); + + return {colspan : colspan, rowspan : rowspan}; + } + + function getCellPos(grid, td) { + var x, y; + + for (y=0; y<grid.length; y++) { + for (x=0; x<grid[y].length; x++) { + if (grid[y][x] == td) + return {cellindex : x, rowindex : y}; + } + } + + return null; + } + + function getCell(grid, row, col) { + if (grid[row] && grid[row][col]) + return grid[row][col]; + + return null; + } + + function getNextCell(table, cell) { + var cells = [], x = 0, i, j, cell, nextCell; + + for (i = 0; i < table.rows.length; i++) + for (j = 0; j < table.rows[i].cells.length; j++, x++) + cells[x] = table.rows[i].cells[j]; + + for (i = 0; i < cells.length; i++) + if (cells[i] == cell) + if (nextCell = cells[i+1]) + return nextCell; + } + + function getTableGrid(table) { + var grid = [], rows = table.rows, x, y, td, sd, xstart, x2, y2; + + for (y=0; y<rows.length; y++) { + for (x=0; x<rows[y].cells.length; x++) { + td = rows[y].cells[x]; + sd = getColRowSpan(td); + + // All ready filled + for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ; + + // Fill box + for (y2=y; y2<y+sd['rowspan']; y2++) { + if (!grid[y2]) + grid[y2] = []; + + for (x2=xstart; x2<xstart+sd['colspan']; x2++) + grid[y2][x2] = td; + } + } + } + + return grid; + } + + function trimRow(table, tr, td, new_tr) { + var grid = getTableGrid(table), cpos = getCellPos(grid, td); + var cells, lastElm; + + // Time to crop away some + if (new_tr.cells.length != tr.childNodes.length) { + cells = tr.childNodes; + lastElm = null; + + for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) { + var remove = true; + var sd = getColRowSpan(td); + + // Remove due to rowspan + if (inArray(cells, td)) { + new_tr.childNodes[x]._delete = true; + } else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan + for (var i=x; i<x+td.colSpan; i++) + new_tr.childNodes[i]._delete = true; + } + + if ((lastElm == null || td != lastElm) && sd.rowspan > 1) + td.rowSpan = sd.rowspan + 1; + + lastElm = td; + } + + deleteMarked(tableElm); + } + } + + function prevElm(node, name) { + while ((node = node.previousSibling) != null) { + if (node.nodeName == name) + return node; + } + + return null; + } + + function nextElm(node, names) { + var namesAr = names.split(','); + + while ((node = node.nextSibling) != null) { + for (var i=0; i<namesAr.length; i++) { + if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() ) + return node; + } + } + + return null; + } + + function deleteMarked(tbl) { + if (tbl.rows == 0) + return; + + var tr = tbl.rows[0]; + do { + var next = nextElm(tr, "TR"); + + // Delete row + if (tr._delete) { + tr.parentNode.removeChild(tr); + continue; + } + + // Delete cells + var td = tr.cells[0]; + if (td.cells > 1) { + do { + var nexttd = nextElm(td, "TD,TH"); + + if (td._delete) + td.parentNode.removeChild(td); + } while ((td = nexttd) != null); + } + } while ((tr = next) != null); + } + + function addRows(td_elm, tr_elm, rowspan) { + // Add rows + td_elm.rowSpan = 1; + var trNext = nextElm(tr_elm, "TR"); + for (var i=1; i<rowspan && trNext; i++) { + var newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '<br mce_bogus="1"/>'; + + if (tinymce.isIE) + trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex)); + else + trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]); + + trNext = nextElm(trNext, "TR"); + } + } + + function copyRow(doc, table, tr) { + var grid = getTableGrid(table); + var newTR = tr.cloneNode(false); + var cpos = getCellPos(grid, tr.cells[0]); + var lastCell = null; + var tableBorder = inst.dom.getAttrib(table, "border"); + var tdElm = null; + + for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) { + var newTD = null; + + if (lastCell != tdElm) { + for (var i=0; i<tr.cells.length; i++) { + if (tdElm == tr.cells[i]) { + newTD = tdElm.cloneNode(true); + break; + } + } + } + + if (newTD == null) { + newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '<br mce_bogus="1"/>'; + } + + // Reset col/row span + newTD.colSpan = 1; + newTD.rowSpan = 1; + + newTR.appendChild(newTD); + + lastCell = tdElm; + } + + return newTR; + } + + // ---- Commands ----- + + // Handle commands + switch (command) { + case "mceTableMoveToNextRow": + var nextCell = getNextCell(tableElm, tdElm); + + if (!nextCell) { + inst.execCommand("mceTableInsertRowAfter", tdElm); + nextCell = getNextCell(tableElm, tdElm); + } + + inst.selection.select(nextCell); + inst.selection.collapse(true); + + return true; + + case "mceTableRowProps": + if (trElm == null) + return true; + + if (user_interface) { + inst.windowManager.open({ + url : url + '/row.htm', + width : 400 + parseInt(inst.getLang('table.rowprops_delta_width', 0)), + height : 295 + parseInt(inst.getLang('table.rowprops_delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + } + + return true; + + case "mceTableCellProps": + if (tdElm == null) + return true; + + if (user_interface) { + inst.windowManager.open({ + url : url + '/cell.htm', + width : 400 + parseInt(inst.getLang('table.cellprops_delta_width', 0)), + height : 295 + parseInt(inst.getLang('table.cellprops_delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + } + + return true; + + case "mceInsertTable": + if (user_interface) { + inst.windowManager.open({ + url : url + '/table.htm', + width : 400 + parseInt(inst.getLang('table.table_delta_width', 0)), + height : 320 + parseInt(inst.getLang('table.table_delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + action : value ? value.action : 0 + }); + } + + return true; + + case "mceTableDelete": + var table = inst.dom.getParent(inst.selection.getNode(), "table"); + if (table) { + table.parentNode.removeChild(table); + inst.execCommand('mceRepaint'); + } + return true; + + case "mceTableSplitCells": + case "mceTableMergeCells": + case "mceTableInsertRowBefore": + case "mceTableInsertRowAfter": + case "mceTableDeleteRow": + case "mceTableInsertColBefore": + case "mceTableInsertColAfter": + case "mceTableDeleteCol": + case "mceTableCutRow": + case "mceTableCopyRow": + case "mceTablePasteRowBefore": + case "mceTablePasteRowAfter": + // No table just return (invalid command) + if (!tableElm) + return true; + + // Table has a tbody use that reference + // Changed logic by ApTest 2005.07.12 (www.aptest.com) + // Now lookk at the focused element and take its parentNode. That will be a tbody or a table. + if (trElm && tableElm != trElm.parentNode) + tableElm = trElm.parentNode; + + if (tableElm && trElm) { + switch (command) { + case "mceTableCutRow": + if (!trElm || !tdElm) + return true; + + inst.tableRowClipboard = copyRow(doc, tableElm, trElm); + inst.execCommand("mceTableDeleteRow"); + break; + + case "mceTableCopyRow": + if (!trElm || !tdElm) + return true; + + inst.tableRowClipboard = copyRow(doc, tableElm, trElm); + break; + + case "mceTablePasteRowBefore": + if (!trElm || !tdElm) + return true; + + var newTR = inst.tableRowClipboard.cloneNode(true); + + var prevTR = prevElm(trElm, "TR"); + if (prevTR != null) + trimRow(tableElm, prevTR, prevTR.cells[0], newTR); + + trElm.parentNode.insertBefore(newTR, trElm); + break; + + case "mceTablePasteRowAfter": + if (!trElm || !tdElm) + return true; + + var nextTR = nextElm(trElm, "TR"); + var newTR = inst.tableRowClipboard.cloneNode(true); + + trimRow(tableElm, trElm, tdElm, newTR); + + if (nextTR == null) + trElm.parentNode.appendChild(newTR); + else + nextTR.parentNode.insertBefore(newTR, nextTR); + + break; + + case "mceTableInsertRowBefore": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var newTR = doc.createElement("tr"); + var lastTDElm = null; + + cpos.rowindex--; + if (cpos.rowindex < 0) + cpos.rowindex = 0; + + // Create cells + for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['rowspan'] == 1) { + var newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '<br mce_bogus="1"/>'; + + newTD.colSpan = tdElm.colSpan; + + newTR.appendChild(newTD); + } else + tdElm.rowSpan = sd['rowspan'] + 1; + + lastTDElm = tdElm; + } + } + + trElm.parentNode.insertBefore(newTR, trElm); + select(0, 1); + break; + + case "mceTableInsertRowAfter": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var newTR = doc.createElement("tr"); + var lastTDElm = null; + + // Create cells + for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['rowspan'] == 1) { + var newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '<br mce_bogus="1"/>'; + + newTD.colSpan = tdElm.colSpan; + + newTR.appendChild(newTD); + } else + tdElm.rowSpan = sd['rowspan'] + 1; + + lastTDElm = tdElm; + } + } + + if (newTR.hasChildNodes()) { + var nextTR = nextElm(trElm, "TR"); + if (nextTR) + nextTR.parentNode.insertBefore(newTR, nextTR); + else + tableElm.appendChild(newTR); + } + + select(0, 1); + break; + + case "mceTableDeleteRow": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + + // Only one row, remove whole table + if (grid.length == 1 && tableElm.nodeName == 'TBODY') { + inst.dom.remove(inst.dom.getParent(tableElm, "table")); + return true; + } + + // Move down row spanned cells + var cells = trElm.cells; + var nextTR = nextElm(trElm, "TR"); + for (var x=0; x<cells.length; x++) { + if (cells[x].rowSpan > 1) { + var newTD = cells[x].cloneNode(true); + var sd = getColRowSpan(cells[x]); + + newTD.rowSpan = sd.rowspan - 1; + + var nextTD = nextTR.cells[x]; + + if (nextTD == null) + nextTR.appendChild(newTD); + else + nextTR.insertBefore(newTD, nextTD); + } + } + + // Delete cells + var lastTDElm = null; + for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd.rowspan > 1) { + tdElm.rowSpan = sd.rowspan - 1; + } else { + trElm = tdElm.parentNode; + + if (trElm.parentNode) + trElm._delete = true; + } + + lastTDElm = tdElm; + } + } + + deleteMarked(tableElm); + + select(0, -1); + break; + + case "mceTableInsertColBefore": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(inst.dom.getParent(tableElm, "table")); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] == 1) { + var newTD = doc.createElement(tdElm.nodeName); + + if (!tinymce.isIE) + newTD.innerHTML = '<br mce_bogus="1"/>'; + + newTD.rowSpan = tdElm.rowSpan; + + tdElm.parentNode.insertBefore(newTD, tdElm); + } else + tdElm.colSpan++; + + lastTDElm = tdElm; + } + } + + select(); + break; + + case "mceTableInsertColAfter": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(inst.dom.getParent(tableElm, "table")); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] == 1) { + var newTD = doc.createElement(tdElm.nodeName); + + if (!tinymce.isIE) + newTD.innerHTML = '<br mce_bogus="1"/>'; + + newTD.rowSpan = tdElm.rowSpan; + + var nextTD = nextElm(tdElm, "TD,TH"); + if (nextTD == null) + tdElm.parentNode.appendChild(newTD); + else + nextTD.parentNode.insertBefore(newTD, nextTD); + } else + tdElm.colSpan++; + + lastTDElm = tdElm; + } + } + + select(1); + break; + + case "mceTableDeleteCol": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + // Only one col, remove whole table + if ((grid.length > 1 && grid[0].length <= 1) && tableElm.nodeName == 'TBODY') { + inst.dom.remove(inst.dom.getParent(tableElm, "table")); + return true; + } + + // Delete cells + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] > 1) + tdElm.colSpan = sd['colspan'] - 1; + else { + if (tdElm.parentNode) + tdElm.parentNode.removeChild(tdElm); + } + + lastTDElm = tdElm; + } + } + + select(-1); + break; + + case "mceTableSplitCells": + if (!trElm || !tdElm) + return true; + + var spandata = getColRowSpan(tdElm); + + var colspan = spandata["colspan"]; + var rowspan = spandata["rowspan"]; + + // Needs splitting + if (colspan > 1 || rowspan > 1) { + // Generate cols + tdElm.colSpan = 1; + for (var i=1; i<colspan; i++) { + var newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '<br mce_bogus="1"/>'; + + trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH")); + + if (rowspan > 1) + addRows(newTD, trElm, rowspan); + } + + addRows(tdElm, trElm, rowspan); + } + + // Apply visual aids + tableElm = inst.dom.getParent(inst.selection.getNode(), "table"); + break; + + case "mceTableMergeCells": + var rows = []; + var sel = inst.selection.getSel(); + var grid = getTableGrid(tableElm); + + if (tinymce.isIE || sel.rangeCount == 1) { + if (user_interface) { + // Setup template + var sp = getColRowSpan(tdElm); + + inst.windowManager.open({ + url : url + '/merge_cells.htm', + width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)), + height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)), + inline : 1 + }, { + action : "update", + numcols : sp.colspan, + numrows : sp.rowspan, + plugin_url : url + }); + + return true; + } else { + var numRows = parseInt(value['numrows']); + var numCols = parseInt(value['numcols']); + var cpos = getCellPos(grid, tdElm); + + if (("" + numRows) == "NaN") + numRows = 1; + + if (("" + numCols) == "NaN") + numCols = 1; + + // Get rows and cells + var tRows = tableElm.rows; + for (var y=cpos.rowindex; y<grid.length; y++) { + var rowCells = []; + + for (var x=cpos.cellindex; x<grid[y].length; x++) { + var td = getCell(grid, y, x); + + if (td && !inArray(rows, td) && !inArray(rowCells, td)) { + var cp = getCellPos(grid, td); + + // Within range + if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows) + rowCells[rowCells.length] = td; + } + } + + if (rowCells.length > 0) + rows[rows.length] = rowCells; + + var td = getCell(grid, cpos.rowindex, cpos.cellindex); + each(ed.dom.select('br', td), function(e, i) { + if (i > 0 && ed.dom.getAttrib('mce_bogus')) + ed.dom.remove(e); + }); + } + + //return true; + } + } else { + var cells = []; + var sel = inst.selection.getSel(); + var lastTR = null; + var curRow = null; + var x1 = -1, y1 = -1, x2, y2; + + // Only one cell selected, whats the point? + if (sel.rangeCount < 2) + return true; + + // Get all selected cells + for (var i=0; i<sel.rangeCount; i++) { + var rng = sel.getRangeAt(i); + var tdElm = rng.startContainer.childNodes[rng.startOffset]; + + if (!tdElm) + break; + + if (tdElm.nodeName == "TD" || tdElm.nodeName == "TH") + cells[cells.length] = tdElm; + } + + // Get rows and cells + var tRows = tableElm.rows; + for (var y=0; y<tRows.length; y++) { + var rowCells = []; + + for (var x=0; x<tRows[y].cells.length; x++) { + var td = tRows[y].cells[x]; + + for (var i=0; i<cells.length; i++) { + if (td == cells[i]) { + rowCells[rowCells.length] = td; + } + } + } + + if (rowCells.length > 0) + rows[rows.length] = rowCells; + } + + // Find selected cells in grid and box + var curRow = []; + var lastTR = null; + for (var y=0; y<grid.length; y++) { + for (var x=0; x<grid[y].length; x++) { + grid[y][x]._selected = false; + + for (var i=0; i<cells.length; i++) { + if (grid[y][x] == cells[i]) { + // Get start pos + if (x1 == -1) { + x1 = x; + y1 = y; + } + + // Get end pos + x2 = x; + y2 = y; + + grid[y][x]._selected = true; + } + } + } + } + + // Is there gaps, if so deny + for (var y=y1; y<=y2; y++) { + for (var x=x1; x<=x2; x++) { + if (!grid[y][x]._selected) { + alert("Invalid selection for merge."); + return true; + } + } + } + } + + // Validate selection and get total rowspan and colspan + var rowSpan = 1, colSpan = 1; + + // Validate horizontal and get total colspan + var lastRowSpan = -1; + for (var y=0; y<rows.length; y++) { + var rowColSpan = 0; + + for (var x=0; x<rows[y].length; x++) { + var sd = getColRowSpan(rows[y][x]); + + rowColSpan += sd['colspan']; + + if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) { + alert("Invalid selection for merge."); + return true; + } + + lastRowSpan = sd['rowspan']; + } + + if (rowColSpan > colSpan) + colSpan = rowColSpan; + + lastRowSpan = -1; + } + + // Validate vertical and get total rowspan + var lastColSpan = -1; + for (var x=0; x<rows[0].length; x++) { + var colRowSpan = 0; + + for (var y=0; y<rows.length; y++) { + var sd = getColRowSpan(rows[y][x]); + + colRowSpan += sd['rowspan']; + + if (lastColSpan != -1 && sd['colspan'] != lastColSpan) { + alert("Invalid selection for merge."); + return true; + } + + lastColSpan = sd['colspan']; + } + + if (colRowSpan > rowSpan) + rowSpan = colRowSpan; + + lastColSpan = -1; + } + + // Setup td + tdElm = rows[0][0]; + tdElm.rowSpan = rowSpan; + tdElm.colSpan = colSpan; + + // Merge cells + for (var y=0; y<rows.length; y++) { + for (var x=0; x<rows[y].length; x++) { + var html = rows[y][x].innerHTML; + var chk = html.replace(/[ \t\r\n]/g, ""); + + if (chk != "<br/>" && chk != "<br>" && chk != '<br mce_bogus="1"/>' && (x+y > 0)) + tdElm.innerHTML += html; + + // Not current cell + if (rows[y][x] != tdElm && !rows[y][x]._deleted) { + var cpos = getCellPos(grid, rows[y][x]); + var tr = rows[y][x].parentNode; + + tr.removeChild(rows[y][x]); + rows[y][x]._deleted = true; + + // Empty TR, remove it + if (!tr.hasChildNodes()) { + tr.parentNode.removeChild(tr); + + var lastCell = null; + for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) { + if (cellElm != lastCell && cellElm.rowSpan > 1) + cellElm.rowSpan--; + + lastCell = cellElm; + } + + if (tdElm.rowSpan > 1) + tdElm.rowSpan--; + } + } + } + } + + // Remove all but one bogus br + each(ed.dom.select('br', tdElm), function(e, i) { + if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus')) + ed.dom.remove(e); + }); + + break; + } + + tableElm = inst.dom.getParent(inst.selection.getNode(), "table"); + inst.addVisual(tableElm); + inst.nodeChanged(); + } + + return true; + } + + // Pass to next handler in chain + return false; + } + }); + + // Register plugin + tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/cell.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/cell.js new file mode 100644 index 0000000000000000000000000000000000000000..f23b06751d1f2831d2a46746192259163e213a57 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/cell.js @@ -0,0 +1,269 @@ +tinyMCEPopup.requireLangPack(); + +var ed; + +function init() { + ed = tinyMCEPopup.editor; + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor') + + var inst = ed; + var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th"); + var formObj = document.forms[0]; + var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style")); + + // Get table cell data + var celltype = tdElm.nodeName.toLowerCase(); + var align = ed.dom.getAttrib(tdElm, 'align'); + var valign = ed.dom.getAttrib(tdElm, 'valign'); + var width = trimSize(getStyle(tdElm, 'width', 'width')); + var height = trimSize(getStyle(tdElm, 'height', 'height')); + var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor')); + var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor')); + var className = ed.dom.getAttrib(tdElm, 'class'); + var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");; + var id = ed.dom.getAttrib(tdElm, 'id'); + var lang = ed.dom.getAttrib(tdElm, 'lang'); + var dir = ed.dom.getAttrib(tdElm, 'dir'); + var scope = ed.dom.getAttrib(tdElm, 'scope'); + + // Setup form + addClassesToList('class', 'table_cell_styles'); + TinyMCE_EditableSelects.init(); + + formObj.bordercolor.value = bordercolor; + formObj.bgcolor.value = bgcolor; + formObj.backgroundimage.value = backgroundimage; + formObj.width.value = width; + formObj.height.value = height; + formObj.id.value = id; + formObj.lang.value = lang; + formObj.style.value = ed.dom.serializeStyle(st); + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'valign', valign); + selectByValue(formObj, 'class', className, true, true); + selectByValue(formObj, 'celltype', celltype); + selectByValue(formObj, 'dir', dir); + selectByValue(formObj, 'scope', scope); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + updateColor('bordercolor_pick', 'bordercolor'); + updateColor('bgcolor_pick', 'bgcolor'); +} + +function updateAction() { + var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0]; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + tdElm = ed.dom.getParent(el, "td,th"); + trElm = ed.dom.getParent(el, "tr"); + tableElm = ed.dom.getParent(el, "table"); + + ed.execCommand('mceBeginUndoLevel'); + + switch (getSelectValue(formObj, 'action')) { + case "cell": + var celltype = getSelectValue(formObj, 'celltype'); + var scope = getSelectValue(formObj, 'scope'); + + function doUpdate(s) { + if (s) { + updateCell(tdElm); + + ed.addVisual(); + ed.nodeChanged(); + inst.execCommand('mceEndUndoLevel'); + tinyMCEPopup.close(); + } + }; + + if (ed.getParam("accessibility_warnings", 1)) { + if (celltype == "th" && scope == "") + tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate); + else + doUpdate(1); + + return; + } + + updateCell(tdElm); + break; + + case "row": + var cell = trElm.firstChild; + + if (cell.nodeName != "TD" && cell.nodeName != "TH") + cell = nextCell(cell); + + do { + cell = updateCell(cell, true); + } while ((cell = nextCell(cell)) != null); + + break; + + case "all": + var rows = tableElm.getElementsByTagName("tr"); + + for (var i=0; i<rows.length; i++) { + var cell = rows[i].firstChild; + + if (cell.nodeName != "TD" && cell.nodeName != "TH") + cell = nextCell(cell); + + do { + cell = updateCell(cell, true); + } while ((cell = nextCell(cell)) != null); + } + + break; + } + + ed.addVisual(); + ed.nodeChanged(); + inst.execCommand('mceEndUndoLevel'); + tinyMCEPopup.close(); +} + +function nextCell(elm) { + while ((elm = elm.nextSibling) != null) { + if (elm.nodeName == "TD" || elm.nodeName == "TH") + return elm; + } + + return null; +} + +function updateCell(td, skip_id) { + var inst = ed; + var formObj = document.forms[0]; + var curCellType = td.nodeName.toLowerCase(); + var celltype = getSelectValue(formObj, 'celltype'); + var doc = inst.getDoc(); + var dom = ed.dom; + + if (!skip_id) + td.setAttribute('id', formObj.id.value); + + td.setAttribute('align', formObj.align.value); + td.setAttribute('vAlign', formObj.valign.value); + td.setAttribute('lang', formObj.lang.value); + td.setAttribute('dir', getSelectValue(formObj, 'dir')); + td.setAttribute('style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value))); + td.setAttribute('scope', formObj.scope.value); + ed.dom.setAttrib(td, 'class', getSelectValue(formObj, 'class')); + + // Clear deprecated attributes + ed.dom.setAttrib(td, 'width', ''); + ed.dom.setAttrib(td, 'height', ''); + ed.dom.setAttrib(td, 'bgColor', ''); + ed.dom.setAttrib(td, 'borderColor', ''); + ed.dom.setAttrib(td, 'background', ''); + + // Set styles + td.style.width = getCSSSize(formObj.width.value); + td.style.height = getCSSSize(formObj.height.value); + if (formObj.bordercolor.value != "") { + td.style.borderColor = formObj.bordercolor.value; + td.style.borderStyle = td.style.borderStyle == "" ? "solid" : td.style.borderStyle; + td.style.borderWidth = td.style.borderWidth == "" ? "1px" : td.style.borderWidth; + } else + td.style.borderColor = ''; + + td.style.backgroundColor = formObj.bgcolor.value; + + if (formObj.backgroundimage.value != "") + td.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')"; + else + td.style.backgroundImage = ''; + + if (curCellType != celltype) { + // changing to a different node type + var newCell = doc.createElement(celltype); + + for (var c=0; c<td.childNodes.length; c++) + newCell.appendChild(td.childNodes[c].cloneNode(1)); + + for (var a=0; a<td.attributes.length; a++) + ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name)); + + td.parentNode.replaceChild(newCell, td); + td = newCell; + } + + dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText))); + + return td; +} + +function changedBackgroundImage() { + var formObj = document.forms[0]; + var st = ed.dom.parseStyle(formObj.style.value); + + st['background-image'] = "url('" + formObj.backgroundimage.value + "')"; + + formObj.style.value = ed.dom.serializeStyle(st); +} + +function changedSize() { + var formObj = document.forms[0]; + var st = ed.dom.parseStyle(formObj.style.value); + + var width = formObj.width.value; + if (width != "") + st['width'] = getCSSSize(width); + else + st['width'] = ""; + + var height = formObj.height.value; + if (height != "") + st['height'] = getCSSSize(height); + else + st['height'] = ""; + + formObj.style.value = ed.dom.serializeStyle(st); +} + +function changedColor() { + var formObj = document.forms[0]; + var st = ed.dom.parseStyle(formObj.style.value); + + st['background-color'] = formObj.bgcolor.value; + st['border-color'] = formObj.bordercolor.value; + + formObj.style.value = ed.dom.serializeStyle(st); +} + +function changedStyle() { + var formObj = document.forms[0]; + var st = ed.dom.parseStyle(formObj.style.value); + + if (st['background-image']) + formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + else + formObj.backgroundimage.value = ''; + + if (st['width']) + formObj.width.value = trimSize(st['width']); + + if (st['height']) + formObj.height.value = trimSize(st['height']); + + if (st['background-color']) { + formObj.bgcolor.value = st['background-color']; + updateColor('bgcolor_pick','bgcolor'); + } + + if (st['border-color']) { + formObj.bordercolor.value = st['border-color']; + updateColor('bordercolor_pick','bordercolor'); + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/merge_cells.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/merge_cells.js new file mode 100644 index 0000000000000000000000000000000000000000..31d6df0abcb2f70c55f3319912e0dc8507b79021 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/merge_cells.js @@ -0,0 +1,29 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + var f = document.forms[0], v; + + tinyMCEPopup.resizeToInnerSize(); + + f.numcols.value = tinyMCEPopup.getWindowArg('numcols', 1); + f.numrows.value = tinyMCEPopup.getWindowArg('numrows', 1); +} + +function mergeCells() { + var args = [], f = document.forms[0]; + + tinyMCEPopup.restoreSelection(); + + if (!AutoValidator.validate(f)) { + tinyMCEPopup.alert(tinyMCEPopup.getLang('invalid_data')); + return false; + } + + args["numcols"] = f.numcols.value; + args["numrows"] = f.numrows.value; + + tinyMCEPopup.execCommand("mceTableMergeCells", false, args); + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/row.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/row.js new file mode 100644 index 0000000000000000000000000000000000000000..d25f635f6835d1c6c79e00592c5c1dc8ce703118 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/row.js @@ -0,0 +1,212 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var inst = tinyMCEPopup.editor; + var dom = inst.dom; + var trElm = dom.getParent(inst.selection.getNode(), "tr"); + var formObj = document.forms[0]; + var st = dom.parseStyle(dom.getAttrib(trElm, "style")); + + // Get table row data + var rowtype = trElm.parentNode.nodeName.toLowerCase(); + var align = dom.getAttrib(trElm, 'align'); + var valign = dom.getAttrib(trElm, 'valign'); + var height = trimSize(getStyle(trElm, 'height', 'height')); + var className = dom.getAttrib(trElm, 'class'); + var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor')); + var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");; + var id = dom.getAttrib(trElm, 'id'); + var lang = dom.getAttrib(trElm, 'lang'); + var dir = dom.getAttrib(trElm, 'dir'); + + // Setup form + addClassesToList('class', 'table_row_styles'); + TinyMCE_EditableSelects.init(); + + formObj.bgcolor.value = bgcolor; + formObj.backgroundimage.value = backgroundimage; + formObj.height.value = height; + formObj.id.value = id; + formObj.lang.value = lang; + formObj.style.value = dom.serializeStyle(st); + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'valign', valign); + selectByValue(formObj, 'class', className, true, true); + selectByValue(formObj, 'rowtype', rowtype); + selectByValue(formObj, 'dir', dir); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + updateColor('bgcolor_pick', 'bgcolor'); +} + +function updateAction() { + var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0]; + var action = getSelectValue(formObj, 'action'); + + tinyMCEPopup.restoreSelection(); + trElm = dom.getParent(inst.selection.getNode(), "tr"); + tableElm = dom.getParent(inst.selection.getNode(), "table"); + + inst.execCommand('mceBeginUndoLevel'); + + switch (action) { + case "row": + updateRow(trElm); + break; + + case "all": + var rows = tableElm.getElementsByTagName("tr"); + + for (var i=0; i<rows.length; i++) + updateRow(rows[i], true); + + break; + + case "odd": + case "even": + var rows = tableElm.getElementsByTagName("tr"); + + for (var i=0; i<rows.length; i++) { + if ((i % 2 == 0 && action == "odd") || (i % 2 != 0 && action == "even")) + updateRow(rows[i], true, true); + } + + break; + } + + inst.addVisual(); + inst.nodeChanged(); + inst.execCommand('mceEndUndoLevel'); + tinyMCEPopup.close(); +} + +function updateRow(tr_elm, skip_id, skip_parent) { + var inst = tinyMCEPopup.editor; + var formObj = document.forms[0]; + var dom = inst.dom; + var curRowType = tr_elm.parentNode.nodeName.toLowerCase(); + var rowtype = getSelectValue(formObj, 'rowtype'); + var doc = inst.getDoc(); + + // Update row element + if (!skip_id) + tr_elm.setAttribute('id', formObj.id.value); + + tr_elm.setAttribute('align', getSelectValue(formObj, 'align')); + tr_elm.setAttribute('vAlign', getSelectValue(formObj, 'valign')); + tr_elm.setAttribute('lang', formObj.lang.value); + tr_elm.setAttribute('dir', getSelectValue(formObj, 'dir')); + tr_elm.setAttribute('style', dom.serializeStyle(dom.parseStyle(formObj.style.value))); + dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class')); + + // Clear deprecated attributes + tr_elm.setAttribute('background', ''); + tr_elm.setAttribute('bgColor', ''); + tr_elm.setAttribute('height', ''); + + // Set styles + tr_elm.style.height = getCSSSize(formObj.height.value); + tr_elm.style.backgroundColor = formObj.bgcolor.value; + + if (formObj.backgroundimage.value != "") + tr_elm.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')"; + else + tr_elm.style.backgroundImage = ''; + + // Setup new rowtype + if (curRowType != rowtype && !skip_parent) { + // first, clone the node we are working on + var newRow = tr_elm.cloneNode(1); + + // next, find the parent of its new destination (creating it if necessary) + var theTable = dom.getParent(tr_elm, "table"); + var dest = rowtype; + var newParent = null; + for (var i = 0; i < theTable.childNodes.length; i++) { + if (theTable.childNodes[i].nodeName.toLowerCase() == dest) + newParent = theTable.childNodes[i]; + } + + if (newParent == null) { + newParent = doc.createElement(dest); + + if (dest == "thead") { + if (theTable.firstChild.nodeName == 'CAPTION') + inst.dom.insertAfter(newParent, theTable.firstChild); + else + theTable.insertBefore(newParent, theTable.firstChild); + } else + theTable.appendChild(newParent); + } + + // append the row to the new parent + newParent.appendChild(newRow); + + // remove the original + tr_elm.parentNode.removeChild(tr_elm); + + // set tr_elm to the new node + tr_elm = newRow; + } + + dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(tr_elm.style.cssText))); +} + +function changedBackgroundImage() { + var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom; + var st = dom.parseStyle(formObj.style.value); + + st['background-image'] = "url('" + formObj.backgroundimage.value + "')"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedStyle() { + var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom; + var st = dom.parseStyle(formObj.style.value); + + if (st['background-image']) + formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + else + formObj.backgroundimage.value = ''; + + if (st['height']) + formObj.height.value = trimSize(st['height']); + + if (st['background-color']) { + formObj.bgcolor.value = st['background-color']; + updateColor('bgcolor_pick','bgcolor'); + } +} + +function changedSize() { + var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom; + var st = dom.parseStyle(formObj.style.value); + + var height = formObj.height.value; + if (height != "") + st['height'] = getCSSSize(height); + else + st['height'] = ""; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedColor() { + var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom; + var st = dom.parseStyle(formObj.style.value); + + st['background-color'] = formObj.bgcolor.value; + + formObj.style.value = dom.serializeStyle(st); +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/table.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/table.js new file mode 100644 index 0000000000000000000000000000000000000000..a6d235cdd74ee72d397c2633218da196f6e20b4d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/js/table.js @@ -0,0 +1,440 @@ +tinyMCEPopup.requireLangPack(); + +var action, orgTableWidth, orgTableHeight, dom = tinyMCEPopup.editor.dom; + +function insertTable() { + var formObj = document.forms[0]; + var inst = tinyMCEPopup.editor, dom = inst.dom; + var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules; + var html = '', capEl, elm; + var cellLimit, rowLimit, colLimit; + + tinyMCEPopup.restoreSelection(); + + if (!AutoValidator.validate(formObj)) { + tinyMCEPopup.alert(inst.getLang('invalid_data')); + return false; + } + + elm = dom.getParent(inst.selection.getNode(), 'table'); + + // Get form data + cols = formObj.elements['cols'].value; + rows = formObj.elements['rows'].value; + border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0; + cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : ""; + cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : ""; + align = formObj.elements['align'].options[formObj.elements['align'].selectedIndex].value; + frame = formObj.elements['frame'].options[formObj.elements['frame'].selectedIndex].value; + rules = formObj.elements['rules'].options[formObj.elements['rules'].selectedIndex].value; + width = formObj.elements['width'].value; + height = formObj.elements['height'].value; + bordercolor = formObj.elements['bordercolor'].value; + bgcolor = formObj.elements['bgcolor'].value; + className = formObj.elements['class'].options[formObj.elements['class'].selectedIndex].value; + id = formObj.elements['id'].value; + summary = formObj.elements['summary'].value; + style = formObj.elements['style'].value; + dir = formObj.elements['dir'].value; + lang = formObj.elements['lang'].value; + background = formObj.elements['backgroundimage'].value; + caption = formObj.elements['caption'].checked; + + cellLimit = tinyMCEPopup.getParam('table_cell_limit', false); + rowLimit = tinyMCEPopup.getParam('table_row_limit', false); + colLimit = tinyMCEPopup.getParam('table_col_limit', false); + + // Validate table size + if (colLimit && cols > colLimit) { + tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit)); + return false; + } else if (rowLimit && rows > rowLimit) { + tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit)); + return false; + } else if (cellLimit && cols * rows > cellLimit) { + tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit)); + return false; + } + + // Update table + if (action == "update") { + inst.execCommand('mceBeginUndoLevel'); + + dom.setAttrib(elm, 'cellPadding', cellpadding, true); + dom.setAttrib(elm, 'cellSpacing', cellspacing, true); + dom.setAttrib(elm, 'border', border); + dom.setAttrib(elm, 'align', align); + dom.setAttrib(elm, 'frame', frame); + dom.setAttrib(elm, 'rules', rules); + dom.setAttrib(elm, 'class', className); + dom.setAttrib(elm, 'style', style); + dom.setAttrib(elm, 'id', id); + dom.setAttrib(elm, 'summary', summary); + dom.setAttrib(elm, 'dir', dir); + dom.setAttrib(elm, 'lang', lang); + + capEl = inst.dom.select('caption', elm)[0]; + + if (capEl && !caption) + capEl.parentNode.removeChild(capEl); + + if (!capEl && caption) { + capEl = elm.ownerDocument.createElement('caption'); + + if (!tinymce.isIE) + capEl.innerHTML = '<br mce_bogus="1"/>'; + + elm.insertBefore(capEl, elm.firstChild); + } + + if (width && inst.settings.inline_styles) { + dom.setStyle(elm, 'width', width); + dom.setAttrib(elm, 'width', ''); + } else { + dom.setAttrib(elm, 'width', width, true); + dom.setStyle(elm, 'width', ''); + } + + // Remove these since they are not valid XHTML + dom.setAttrib(elm, 'borderColor', ''); + dom.setAttrib(elm, 'bgColor', ''); + dom.setAttrib(elm, 'background', ''); + + if (height && inst.settings.inline_styles) { + dom.setStyle(elm, 'height', height); + dom.setAttrib(elm, 'height', ''); + } else { + dom.setAttrib(elm, 'height', height, true); + dom.setStyle(elm, 'height', ''); + } + + if (background != '') + elm.style.backgroundImage = "url('" + background + "')"; + else + elm.style.backgroundImage = ''; + +/* if (tinyMCEPopup.getParam("inline_styles")) { + if (width != '') + elm.style.width = getCSSSize(width); + }*/ + + if (bordercolor != "") { + elm.style.borderColor = bordercolor; + elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle; + elm.style.borderWidth = border == "" ? "1px" : border; + } else + elm.style.borderColor = ''; + + elm.style.backgroundColor = bgcolor; + elm.style.height = getCSSSize(height); + + inst.addVisual(); + + // Fix for stange MSIE align bug + //elm.outerHTML = elm.outerHTML; + + inst.nodeChanged(); + inst.execCommand('mceEndUndoLevel'); + + // Repaint if dimensions changed + if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight) + inst.execCommand('mceRepaint'); + + tinyMCEPopup.close(); + return true; + } + + // Create new table + html += '<table'; + + html += makeAttrib('id', id); + html += makeAttrib('border', border); + html += makeAttrib('cellpadding', cellpadding); + html += makeAttrib('cellspacing', cellspacing); + + if (width && inst.settings.inline_styles) { + if (style) + style += '; '; + + // Force px + if (/^[0-9\.]+$/.test(width)) + width += 'px'; + + style += 'width: ' + width; + } else + html += makeAttrib('width', width); + +/* if (height) { + if (style) + style += '; '; + + style += 'height: ' + height; + }*/ + + //html += makeAttrib('height', height); + //html += makeAttrib('bordercolor', bordercolor); + //html += makeAttrib('bgcolor', bgcolor); + html += makeAttrib('align', align); + html += makeAttrib('frame', frame); + html += makeAttrib('rules', rules); + html += makeAttrib('class', className); + html += makeAttrib('style', style); + html += makeAttrib('summary', summary); + html += makeAttrib('dir', dir); + html += makeAttrib('lang', lang); + html += '>'; + + if (caption) { + if (!tinymce.isIE) + html += '<caption><br mce_bogus="1"/></caption>'; + else + html += '<caption></caption>'; + } + + for (var y=0; y<rows; y++) { + html += "<tr>"; + + for (var x=0; x<cols; x++) { + if (!tinymce.isIE) + html += '<td><br mce_bogus="1"/></td>'; + else + html += '<td></td>'; + } + + html += "</tr>"; + } + + html += "</table>"; + + inst.execCommand('mceBeginUndoLevel'); + + // Move table + if (inst.settings.fix_table_elements) { + var bm = inst.selection.getBookmark(), patt = ''; + + inst.execCommand('mceInsertContent', false, '<br class="_mce_marker" />'); + + tinymce.each('h1,h2,h3,h4,h5,h6,p'.split(','), function(n) { + if (patt) + patt += ','; + + patt += n + ' ._mce_marker'; + }); + + tinymce.each(inst.dom.select(patt), function(n) { + inst.dom.split(inst.dom.getParent(n, 'h1,h2,h3,h4,h5,h6,p'), n); + }); + + dom.setOuterHTML(dom.select('._mce_marker')[0], html); + + inst.selection.moveToBookmark(bm); + } else + inst.execCommand('mceInsertContent', false, html); + + inst.addVisual(); + inst.execCommand('mceEndUndoLevel'); + + tinyMCEPopup.close(); +} + +function makeAttrib(attrib, value) { + var formObj = document.forms[0]; + var valueElm = formObj.elements[attrib]; + + if (typeof(value) == "undefined" || value == null) { + value = ""; + + if (valueElm) + value = valueElm.value; + } + + if (value == "") + return ""; + + // XML encode it + value = value.replace(/&/g, '&'); + value = value.replace(/\"/g, '"'); + value = value.replace(/</g, '<'); + value = value.replace(/>/g, '>'); + + return ' ' + attrib + '="' + value + '"'; +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', ''); + var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = ""; + var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules, frame; + var inst = tinyMCEPopup.editor, dom = inst.dom; + var formObj = document.forms[0]; + var elm = dom.getParent(inst.selection.getNode(), "table"); + + action = tinyMCEPopup.getWindowArg('action'); + + if (!action) + action = elm ? "update" : "insert"; + + if (elm && action != "insert") { + var rowsAr = elm.rows; + var cols = 0; + for (var i=0; i<rowsAr.length; i++) + if (rowsAr[i].cells.length > cols) + cols = rowsAr[i].cells.length; + + cols = cols; + rows = rowsAr.length; + + st = dom.parseStyle(dom.getAttrib(elm, "style")); + border = trimSize(getStyle(elm, 'border', 'borderWidth')); + cellpadding = dom.getAttrib(elm, 'cellpadding', ""); + cellspacing = dom.getAttrib(elm, 'cellspacing', ""); + width = trimSize(getStyle(elm, 'width', 'width')); + height = trimSize(getStyle(elm, 'height', 'height')); + bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor')); + bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor')); + align = dom.getAttrib(elm, 'align', align); + frame = dom.getAttrib(elm, 'frame'); + rules = dom.getAttrib(elm, 'rules'); + className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, '')); + id = dom.getAttrib(elm, 'id'); + summary = dom.getAttrib(elm, 'summary'); + style = dom.serializeStyle(st); + dir = dom.getAttrib(elm, 'dir'); + lang = dom.getAttrib(elm, 'lang'); + background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + formObj.caption.checked = elm.getElementsByTagName('caption').length > 0; + + orgTableWidth = width; + orgTableHeight = height; + + action = "update"; + formObj.insert.value = inst.getLang('update'); + } + + addClassesToList('class', "table_styles"); + TinyMCE_EditableSelects.init(); + + // Update form + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'frame', frame); + selectByValue(formObj, 'rules', rules); + selectByValue(formObj, 'class', className, true, true); + formObj.cols.value = cols; + formObj.rows.value = rows; + formObj.border.value = border; + formObj.cellpadding.value = cellpadding; + formObj.cellspacing.value = cellspacing; + formObj.width.value = width; + formObj.height.value = height; + formObj.bordercolor.value = bordercolor; + formObj.bgcolor.value = bgcolor; + formObj.id.value = id; + formObj.summary.value = summary; + formObj.style.value = style; + formObj.dir.value = dir; + formObj.lang.value = lang; + formObj.backgroundimage.value = background; + + updateColor('bordercolor_pick', 'bordercolor'); + updateColor('bgcolor_pick', 'bgcolor'); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + // Disable some fields in update mode + if (action == "update") { + formObj.cols.disabled = true; + formObj.rows.disabled = true; + } +} + +function changedSize() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + +/* var width = formObj.width.value; + if (width != "") + st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : ""; + else + st['width'] = "";*/ + + var height = formObj.height.value; + if (height != "") + st['height'] = getCSSSize(height); + else + st['height'] = ""; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedBackgroundImage() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + st['background-image'] = "url('" + formObj.backgroundimage.value + "')"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedBorder() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + // Update border width if the element has a color + if (formObj.border.value != "" && formObj.bordercolor.value != "") + st['border-width'] = formObj.border.value + "px"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedColor() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + st['background-color'] = formObj.bgcolor.value; + + if (formObj.bordercolor.value != "") { + st['border-color'] = formObj.bordercolor.value; + + // Add border-width if it's missing + if (!st['border-width']) + st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px"; + } + + formObj.style.value = dom.serializeStyle(st); +} + +function changedStyle() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + if (st['background-image']) + formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + else + formObj.backgroundimage.value = ''; + + if (st['width']) + formObj.width.value = trimSize(st['width']); + + if (st['height']) + formObj.height.value = trimSize(st['height']); + + if (st['background-color']) { + formObj.bgcolor.value = st['background-color']; + updateColor('bgcolor_pick','bgcolor'); + } + + if (st['border-color']) { + formObj.bordercolor.value = st['border-color']; + updateColor('bordercolor_pick','bordercolor'); + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..000332a35da4924d5764b00991d93fb1eb4269a1 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/langs/en_dlg.js @@ -0,0 +1,74 @@ +tinyMCE.addI18n('en.table_dlg',{ +general_tab:"General", +advanced_tab:"Advanced", +general_props:"General properties", +advanced_props:"Advanced properties", +rowtype:"Row in table part", +title:"Insert/Modify table", +width:"Width", +height:"Height", +cols:"Cols", +rows:"Rows", +cellspacing:"Cellspacing", +cellpadding:"Cellpadding", +border:"Border", +align:"Alignment", +align_default:"Default", +align_left:"Left", +align_right:"Right", +align_middle:"Center", +row_title:"Table row properties", +cell_title:"Table cell properties", +cell_type:"Cell type", +valign:"Vertical alignment", +align_top:"Top", +align_bottom:"Bottom", +bordercolor:"Border color", +bgcolor:"Background color", +merge_cells_title:"Merge table cells", +id:"Id", +style:"Style", +langdir:"Language direction", +langcode:"Language code", +mime:"Target MIME type", +ltr:"Left to right", +rtl:"Right to left", +bgimage:"Background image", +summary:"Summary", +td:"Data", +th:"Header", +cell_cell:"Update current cell", +cell_row:"Update all cells in row", +cell_all:"Update all cells in table", +row_row:"Update current row", +row_odd:"Update odd rows in table", +row_even:"Update even rows in table", +row_all:"Update all rows in table", +thead:"Table Head", +tbody:"Table Body", +tfoot:"Table Foot", +scope:"Scope", +rowgroup:"Row Group", +colgroup:"Col Group", +col_limit:"You've exceeded the maximum number of columns of {$cols}.", +row_limit:"You've exceeded the maximum number of rows of {$rows}.", +cell_limit:"You've exceeded the maximum number of cells of {$cells}.", +missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.", +caption:"Table caption", +frame:"Frame", +frame_none:"none", +frame_groups:"groups", +frame_rows:"rows", +frame_cols:"cols", +frame_all:"all", +rules:"Rules", +rules_void:"void", +rules_above:"above", +rules_below:"below", +rules_hsides:"hsides", +rules_lhs:"lhs", +rules_rhs:"rhs", +rules_vsides:"vsides", +rules_box:"box", +rules_border:"border" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/merge_cells.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/merge_cells.htm new file mode 100644 index 0000000000000000000000000000000000000000..25d42eb6574b976c7a6c93e1c16b18a01fac8b22 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/merge_cells.htm @@ -0,0 +1,37 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#table_dlg.merge_cells_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/validate.js"></script> + <script type="text/javascript" src="js/merge_cells.js"></script> +</head> +<body style="margin: 8px"> +<form onsubmit="mergeCells();return false;" action="#"> + <fieldset> + <legend>{#table_dlg.merge_cells_title}</legend> + <table border="0" cellpadding="0" cellspacing="3" width="100%"> + <tr> + <td>{#table_dlg.cols}:</td> + <td align="right"><input type="text" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" /></td> + </tr> + <tr> + <td>{#table_dlg.rows}:</td> + <td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td> + </tr> + </table> + </fieldset> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#update}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/row.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/row.htm new file mode 100644 index 0000000000000000000000000000000000000000..07ca13c983249a7a4b313540f46ac0b4d5974297 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/row.htm @@ -0,0 +1,160 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#table_dlg.row_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/row.js"></script> + <link href="css/row.css" rel="stylesheet" type="text/css" /> +</head> +<body id="tablerow" style="display: none"> + <form onsubmit="updateAction();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li> + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#table_dlg.general_props}</legend> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td><label for="rowtype">{#table_dlg.rowtype}</label></td> + <td class="col2"> + <select id="rowtype" name="rowtype" class="mceFocus"> + <option value="thead">{#table_dlg.thead}</option> + <option value="tbody">{#table_dlg.tbody}</option> + <option value="tfoot">{#table_dlg.tfoot}</option> + </select> + </td> + </tr> + + <tr> + <td><label for="align">{#table_dlg.align}</label></td> + <td class="col2"> + <select id="align" name="align"> + <option value="">{#not_set}</option> + <option value="center">{#table_dlg.align_middle}</option> + <option value="left">{#table_dlg.align_left}</option> + <option value="right">{#table_dlg.align_right}</option> + </select> + </td> + </tr> + + <tr> + <td><label for="valign">{#table_dlg.valign}</label></td> + <td class="col2"> + <select id="valign" name="valign"> + <option value="">{#not_set}</option> + <option value="top">{#table_dlg.align_top}</option> + <option value="middle">{#table_dlg.align_middle}</option> + <option value="bottom">{#table_dlg.align_bottom}</option> + </select> + </td> + </tr> + + <tr id="styleSelectRow"> + <td><label for="class">{#class_name}</label></td> + <td class="col2"> + <select id="class" name="class" class="mceEditableSelect"> + <option value="" selected="selected">{#not_set}</option> + </select> + </td> + </tr> + + <tr> + <td><label for="height">{#table_dlg.height}</label></td> + <td class="col2"><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td> + </tr> + </table> + </fieldset> + </div> + + <div id="advanced_panel" class="panel"> + <fieldset> + <legend>{#table_dlg.advanced_props}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="column1"><label for="id">{#table_dlg.id}</label></td> + <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td> + </tr> + + <tr> + <td><label for="style">{#table_dlg.style}</label></td> + <td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td> + </tr> + + <tr> + <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> + <td> + <select id="dir" name="dir" style="width: 200px"> + <option value="">{#not_set}</option> + <option value="ltr">{#table_dlg.ltr}</option> + <option value="rtl">{#table_dlg.rtl}</option> + </select> + </td> + </tr> + + <tr> + <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td> + <td> + <input id="lang" name="lang" type="text" value="" style="width: 200px" /> + </td> + </tr> + + <tr> + <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td> + <td id="backgroundimagebrowsercontainer"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td> + <td id="bgcolor_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div> + <select id="action" name="action"> + <option value="row">{#table_dlg.row_row}</option> + <option value="odd">{#table_dlg.row_odd}</option> + <option value="even">{#table_dlg.row_even}</option> + <option value="all">{#table_dlg.row_all}</option> + </select> + </div> + + <div style="float: left"> + <div><input type="submit" id="insert" name="insert" value="{#update}" /></div> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/table.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/table.htm new file mode 100644 index 0000000000000000000000000000000000000000..2a138513cb58a7caff91b8f7cd59f9b80281321c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/table/table.htm @@ -0,0 +1,192 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#table_dlg.title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/validate.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/table.js"></script> + <link href="css/table.css" rel="stylesheet" type="text/css" /> +</head> +<body id="table" style="display: none"> + <form onsubmit="insertTable();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li> + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#table_dlg.general_props}</legend> + <table border="0" cellpadding="4" cellspacing="0" width="100%"> + <tr> + <td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td> + <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" /></td> + <td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td> + <td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" /></td> + </tr> + <tr> + <td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td> + <td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td> + <td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td> + <td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td> + </tr> + <tr> + <td><label id="alignlabel" for="align">{#table_dlg.align}</label></td> + <td><select id="align" name="align"> + <option value="">{#not_set}</option> + <option value="center">{#table_dlg.align_middle}</option> + <option value="left">{#table_dlg.align_left}</option> + <option value="right">{#table_dlg.align_right}</option> + </select></td> + <td><label id="borderlabel" for="border">{#table_dlg.border}</label></td> + <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td> + </tr> + <tr id="width_row"> + <td><label id="widthlabel" for="width">{#table_dlg.width}</label></td> + <td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td> + <td><label id="heightlabel" for="height">{#table_dlg.height}</label></td> + <td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td> + </tr> + <tr id="styleSelectRow"> + <td><label id="classlabel" for="class">{#class_name}</label></td> + <td colspan="3"> + <select id="class" name="class" class="mceEditableSelect"> + <option value="" selected="selected">{#not_set}</option> + </select></td> + </tr> + <tr> + <td class="column1"><label for="caption">{#table_dlg.caption}</label></td> + <td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td> + </tr> + </table> + </fieldset> + </div> + + <div id="advanced_panel" class="panel"> + <fieldset> + <legend>{#table_dlg.advanced_props}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="column1"><label for="id">{#table_dlg.id}</label></td> + <td><input id="id" name="id" type="text" value="" class="advfield" /></td> + </tr> + + <tr> + <td class="column1"><label for="summary">{#table_dlg.summary}</label></td> + <td><input id="summary" name="summary" type="text" value="" class="advfield" /></td> + </tr> + + <tr> + <td><label for="style">{#table_dlg.style}</label></td> + <td><input type="text" id="style" name="style" value="" class="advfield" onchange="changedStyle();" /></td> + </tr> + + <tr> + <td class="column1"><label id="langlabel" for="lang">{#table_dlg.langcode}</label></td> + <td> + <input id="lang" name="lang" type="text" value="" class="advfield" /> + </td> + </tr> + + <tr> + <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td> + <td id="backgroundimagebrowsercontainer"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td class="column1"><label for="frame">{#table_dlg.frame}</label></td> + <td> + <select id="frame" name="frame" class="advfield"> + <option value="">{#not_set}</option> + <option value="void">{#table_dlg.rules_void}</option> + <option value="above">{#table_dlg.rules_above}</option> + <option value="below">{#table_dlg.rules_below}</option> + <option value="hsides">{#table_dlg.rules_hsides}</option> + <option value="lhs">{#table_dlg.rules_lhs}</option> + <option value="rhs">{#table_dlg.rules_rhs}</option> + <option value="vsides">{#table_dlg.rules_vsides}</option> + <option value="box">{#table_dlg.rules_box}</option> + <option value="border">{#table_dlg.rules_border}</option> + </select> + </td> + </tr> + + <tr> + <td class="column1"><label for="rules">{#table_dlg.rules}</label></td> + <td> + <select id="rules" name="rules" class="advfield"> + <option value="">{#not_set}</option> + <option value="none">{#table_dlg.frame_none}</option> + <option value="groups">{#table_dlg.frame_groups}</option> + <option value="rows">{#table_dlg.frame_rows}</option> + <option value="cols">{#table_dlg.frame_cols}</option> + <option value="all">{#table_dlg.frame_all}</option> + </select> + </td> + </tr> + + <tr> + <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> + <td> + <select id="dir" name="dir" class="advfield"> + <option value="">{#not_set}</option> + <option value="ltr">{#table_dlg.ltr}</option> + <option value="rtl">{#table_dlg.rtl}</option> + </select> + </td> + </tr> + + <tr> + <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td> + <td id="bordercolor_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + + <tr> + <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> + <td> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td> + <td id="bgcolor_pickcontainer"> </td> + </tr> + </table> + </td> + </tr> + </table> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/blank.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/blank.htm new file mode 100644 index 0000000000000000000000000000000000000000..ecde53fae7f64e1000c679277447c83483e5e296 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/blank.htm @@ -0,0 +1,12 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>blank_page</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <script type="text/javascript"> + parent.TemplateDialog.loadCSSFiles(document); + </script> +</head> +<body id="mceTemplatePreview" class="mceContentBody"> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/css/template.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/css/template.css new file mode 100644 index 0000000000000000000000000000000000000000..2d23a4938c221b702c6e387d0eb8dab2386f252a --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/css/template.css @@ -0,0 +1,23 @@ +#frmbody { + padding: 10px; + background-color: #FFF; + border: 1px solid #CCC; +} + +.frmRow { + margin-bottom: 10px; +} + +#templatesrc { + border: none; + width: 320px; + height: 240px; +} + +.title { + padding-bottom: 5px; +} + +.mceActionPanel { + padding-top: 5px; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..11ee592a82f7db0d65d8f06cdb582750663b1e3f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.TemplatePlugin",{init:function(b,c){var d=this;d.editor=b;b.addCommand("mceTemplate",function(e){b.windowManager.open({file:c+"/template.htm",width:b.getParam("template_popup_width",750),height:b.getParam("template_popup_height",600),inline:1},{plugin_url:c})});b.addCommand("mceInsertTemplate",d._insertTemplate,d);b.addButton("template",{title:"template.desc",cmd:"mceTemplate"});b.onPreProcess.add(function(e,g){var f=e.dom;a(f.select("div",g.node),function(h){if(f.hasClass(h,"mceTmpl")){a(f.select("*",h),function(i){if(f.hasClass(i,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){i.innerHTML=d._getDateTime(new Date(),e.getParam("template_mdate_format",e.getLang("template.mdate_format")))}});d._replaceVals(h)}})})},getInfo:function(){return{longname:"Template plugin",author:"Moxiecode Systems AB",authorurl:"http://www.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_insertTemplate:function(i,j){var k=this,g=k.editor,f,c,d=g.dom,b=g.selection.getContent();f=j.content;a(k.editor.getParam("template_replace_values"),function(l,h){if(typeof(l)!="function"){f=f.replace(new RegExp("\\{\\$"+h+"\\}","g"),l)}});c=d.create("div",null,f);n=d.select(".mceTmpl",c);if(n&&n.length>0){c=d.create("div",null);c.appendChild(n[0].cloneNode(true))}function e(l,h){return new RegExp("\\b"+h+"\\b","g").test(l.className)}a(d.select("*",c),function(h){if(e(h,g.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))){h.innerHTML=k._getDateTime(new Date(),g.getParam("template_cdate_format",g.getLang("template.cdate_format")))}if(e(h,g.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){h.innerHTML=k._getDateTime(new Date(),g.getParam("template_mdate_format",g.getLang("template.mdate_format")))}if(e(h,g.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))){h.innerHTML=b}});k._replaceVals(c);g.execCommand("mceInsertContent",false,c.innerHTML);g.addVisual()},_replaceVals:function(c){var d=this.editor.dom,b=this.editor.getParam("template_replace_values");a(d.select("*",c),function(f){a(b,function(g,e){if(d.hasClass(f,e)){if(typeof(b[e])=="function"){b[e](f)}}})})},_getDateTime:function(e,b){if(!b){return""}function c(g,d){var f;g=""+g;if(g.length<d){for(f=0;f<(d-g.length);f++){g="0"+g}}return g}b=b.replace("%D","%m/%d/%y");b=b.replace("%r","%I:%M:%S %p");b=b.replace("%Y",""+e.getFullYear());b=b.replace("%y",""+e.getYear());b=b.replace("%m",c(e.getMonth()+1,2));b=b.replace("%d",c(e.getDate(),2));b=b.replace("%H",""+c(e.getHours(),2));b=b.replace("%M",""+c(e.getMinutes(),2));b=b.replace("%S",""+c(e.getSeconds(),2));b=b.replace("%I",""+((e.getHours()+11)%12+1));b=b.replace("%p",""+(e.getHours()<12?"AM":"PM"));b=b.replace("%B",""+tinyMCE.getLang("template_months_long").split(",")[e.getMonth()]);b=b.replace("%b",""+tinyMCE.getLang("template_months_short").split(",")[e.getMonth()]);b=b.replace("%A",""+tinyMCE.getLang("template_day_long").split(",")[e.getDay()]);b=b.replace("%a",""+tinyMCE.getLang("template_day_short").split(",")[e.getDay()]);b=b.replace("%%","%");return b}});tinymce.PluginManager.add("template",tinymce.plugins.TemplatePlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..73ab39e0232dba0b5eaa761a59f6eca80a7624ea --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/editor_plugin_src.js @@ -0,0 +1,156 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.TemplatePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceTemplate', function(ui) { + ed.windowManager.open({ + file : url + '/template.htm', + width : ed.getParam('template_popup_width', 750), + height : ed.getParam('template_popup_height', 600), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceInsertTemplate', t._insertTemplate, t); + + // Register buttons + ed.addButton('template', {title : 'template.desc', cmd : 'mceTemplate'}); + + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + each(dom.select('div', o.node), function(e) { + if (dom.hasClass(e, 'mceTmpl')) { + each(dom.select('*', e), function(e) { + if (dom.hasClass(e, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) + e.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format"))); + }); + + t._replaceVals(e); + } + }); + }); + }, + + getInfo : function() { + return { + longname : 'Template plugin', + author : 'Moxiecode Systems AB', + authorurl : 'http://www.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + _insertTemplate : function(ui, v) { + var t = this, ed = t.editor, h, el, dom = ed.dom, sel = ed.selection.getContent(); + + h = v.content; + + each(t.editor.getParam('template_replace_values'), function(v, k) { + if (typeof(v) != 'function') + h = h.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v); + }); + + el = dom.create('div', null, h); + + // Find template element within div + n = dom.select('.mceTmpl', el); + if (n && n.length > 0) { + el = dom.create('div', null); + el.appendChild(n[0].cloneNode(true)); + } + + function hasClass(n, c) { + return new RegExp('\\b' + c + '\\b', 'g').test(n.className); + }; + + each(dom.select('*', el), function(n) { + // Replace cdate + if (hasClass(n, ed.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|'))) + n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_cdate_format", ed.getLang("template.cdate_format"))); + + // Replace mdate + if (hasClass(n, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) + n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format"))); + + // Replace selection + if (hasClass(n, ed.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|'))) + n.innerHTML = sel; + }); + + t._replaceVals(el); + + ed.execCommand('mceInsertContent', false, el.innerHTML); + ed.addVisual(); + }, + + _replaceVals : function(e) { + var dom = this.editor.dom, vl = this.editor.getParam('template_replace_values'); + + each(dom.select('*', e), function(e) { + each(vl, function(v, k) { + if (dom.hasClass(e, k)) { + if (typeof(vl[k]) == 'function') + vl[k](e); + } + }); + }); + }, + + _getDateTime : function(d, fmt) { + if (!fmt) + return ""; + + function addZeros(value, len) { + var i; + + value = "" + value; + + if (value.length < len) { + for (i=0; i<(len-value.length); i++) + value = "0" + value; + } + + return value; + } + + fmt = fmt.replace("%D", "%m/%d/%y"); + fmt = fmt.replace("%r", "%I:%M:%S %p"); + fmt = fmt.replace("%Y", "" + d.getFullYear()); + fmt = fmt.replace("%y", "" + d.getYear()); + fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2)); + fmt = fmt.replace("%d", addZeros(d.getDate(), 2)); + fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2)); + fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2)); + fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2)); + fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1)); + fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM")); + fmt = fmt.replace("%B", "" + tinyMCE.getLang("template_months_long").split(',')[d.getMonth()]); + fmt = fmt.replace("%b", "" + tinyMCE.getLang("template_months_short").split(',')[d.getMonth()]); + fmt = fmt.replace("%A", "" + tinyMCE.getLang("template_day_long").split(',')[d.getDay()]); + fmt = fmt.replace("%a", "" + tinyMCE.getLang("template_day_short").split(',')[d.getDay()]); + fmt = fmt.replace("%%", "%"); + + return fmt; + } + }); + + // Register plugin + tinymce.PluginManager.add('template', tinymce.plugins.TemplatePlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/js/template.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/js/template.js new file mode 100644 index 0000000000000000000000000000000000000000..24045d7311a891e57c5e35d1c9c3848487a6e7ab --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/js/template.js @@ -0,0 +1,106 @@ +tinyMCEPopup.requireLangPack(); + +var TemplateDialog = { + preInit : function() { + var url = tinyMCEPopup.getParam("template_external_list_url"); + + if (url != null) + document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></sc'+'ript>'); + }, + + init : function() { + var ed = tinyMCEPopup.editor, tsrc, sel, x, u; + + tsrc = ed.getParam("template_templates", false); + sel = document.getElementById('tpath'); + + // Setup external template list + if (!tsrc && typeof(tinyMCETemplateList) != 'undefined') { + for (x=0, tsrc = []; x<tinyMCETemplateList.length; x++) + tsrc.push({title : tinyMCETemplateList[x][0], src : tinyMCETemplateList[x][1], description : tinyMCETemplateList[x][2]}); + } + + for (x=0; x<tsrc.length; x++) + sel.options[sel.options.length] = new Option(tsrc[x].title, tinyMCEPopup.editor.documentBaseURI.toAbsolute(tsrc[x].src)); + + this.resize(); + this.tsrc = tsrc; + }, + + resize : function() { + var w, h, e; + + if (!self.innerWidth) { + w = document.body.clientWidth - 50; + h = document.body.clientHeight - 160; + } else { + w = self.innerWidth - 50; + h = self.innerHeight - 170; + } + + e = document.getElementById('templatesrc'); + + if (e) { + e.style.height = Math.abs(h) + 'px'; + e.style.width = Math.abs(w - 5) + 'px'; + } + }, + + loadCSSFiles : function(d) { + var ed = tinyMCEPopup.editor; + + tinymce.each(ed.getParam("content_css", '').split(','), function(u) { + d.write('<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />'); + }); + }, + + selectTemplate : function(u, ti) { + var d = window.frames['templatesrc'].document, x, tsrc = this.tsrc; + + if (!u) + return; + + d.body.innerHTML = this.templateHTML = this.getFileContents(u); + + for (x=0; x<tsrc.length; x++) { + if (tsrc[x].title == ti) + document.getElementById('tmpldesc').innerHTML = tsrc[x].description || ''; + } + }, + + insert : function() { + tinyMCEPopup.execCommand('mceInsertTemplate', false, { + content : this.templateHTML, + selection : tinyMCEPopup.editor.selection.getContent() + }); + + tinyMCEPopup.close(); + }, + + getFileContents : function(u) { + var x, d, t = 'text/plain'; + + function g(s) { + x = 0; + + try { + x = new ActiveXObject(s); + } catch (s) { + } + + return x; + }; + + x = window.ActiveXObject ? g('Msxml2.XMLHTTP') || g('Microsoft.XMLHTTP') : new XMLHttpRequest(); + + // Synchronous AJAX load file + x.overrideMimeType && x.overrideMimeType(t); + x.open("GET", u, false); + x.send(null); + + return x.responseText; + } +}; + +TemplateDialog.preInit(); +tinyMCEPopup.onInit.add(TemplateDialog.init, TemplateDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..2471c3fa0449c9e4235821a5b4064f5dcd2eab14 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/langs/en_dlg.js @@ -0,0 +1,15 @@ +tinyMCE.addI18n('en.template_dlg',{ +title:"Templates", +label:"Template", +desc_label:"Description", +desc:"Insert predefined template content", +select:"Select a template", +preview:"Preview", +warning:"Warning: Updating a template with a different one may cause data loss.", +mdate_format:"%Y-%m-%d %H:%M:%S", +cdate_format:"%Y-%m-%d %H:%M:%S", +months_long:"January,February,March,April,May,June,July,August,September,October,November,December", +months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", +day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday", +day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/template.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/template.htm new file mode 100644 index 0000000000000000000000000000000000000000..f7bb044a0e675ae8ca8f7ac4d26100fe84c99303 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/template/template.htm @@ -0,0 +1,38 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#template_dlg.title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/template.js"></script> + <link href="css/template.css" rel="stylesheet" type="text/css" /> +</head> +<body onresize="TemplateDialog.resize();"> + <form onsubmit="TemplateDialog.insert();return false;"> + <div id="frmbody"> + <div class="title">{#template_dlg.desc}</div> + <div class="frmRow"><label for="tpath" title="{#template_dlg.select}">{#template_dlg.label}:</label> + <select id="tpath" name="tpath" onchange="TemplateDialog.selectTemplate(this.options[this.selectedIndex].value, this.options[this.selectedIndex].text);" class="mceFocus"> + <option value="">{#template_dlg.select}...</option> + </select> + <span id="warning"></span></div> + <div class="frmRow"><label for="tdesc">{#template_dlg.desc_label}:</label> + <span id="tmpldesc"></span></div> + <fieldset> + <legend>{#template_dlg.preview}</legend> + <iframe id="templatesrc" name="templatesrc" src="blank.htm" width="690" height="400" frameborder="0"></iframe> + </fieldset> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + + <br style="clear:both" /> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/visualchars/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/visualchars/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..53d31c44faf0c13ab35f56815525e1a4c9b24b53 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/visualchars/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.VisualChars",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceVisualChars",c._toggleVisualChars,c);a.addButton("visualchars",{title:"visualchars.desc",cmd:"mceVisualChars"});a.onBeforeGetContent.add(function(d,e){if(c.state){c.state=true;c._toggleVisualChars()}})},getInfo:function(){return{longname:"Visual characters",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_toggleVisualChars:function(){var m=this,g=m.editor,a,e,f,k=g.getDoc(),l=g.getBody(),j,n=g.selection,c;m.state=!m.state;g.controlManager.setActive("visualchars",m.state);if(m.state){a=[];tinymce.walk(l,function(b){if(b.nodeType==3&&b.nodeValue&&b.nodeValue.indexOf("\u00a0")!=-1){a.push(b)}},"childNodes");for(e=0;e<a.length;e++){j=a[e].nodeValue;j=j.replace(/(\u00a0+)/g,'<span class="mceItemHidden mceVisualNbsp">$1</span>');j=j.replace(/\u00a0/g,"\u00b7");g.dom.setOuterHTML(a[e],j,k)}}else{a=tinymce.grep(g.dom.select("span",l),function(b){return g.dom.hasClass(b,"mceVisualNbsp")});for(e=0;e<a.length;e++){g.dom.setOuterHTML(a[e],a[e].innerHTML.replace(/(·|\u00b7)/g," "),k)}}}});tinymce.PluginManager.add("visualchars",tinymce.plugins.VisualChars)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/visualchars/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/visualchars/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..02ec4e6982bb99339a659e64fa6db671430defa7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/visualchars/editor_plugin_src.js @@ -0,0 +1,73 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.VisualChars', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceVisualChars', t._toggleVisualChars, t); + + // Register buttons + ed.addButton('visualchars', {title : 'visualchars.desc', cmd : 'mceVisualChars'}); + + ed.onBeforeGetContent.add(function(ed, o) { + if (t.state) { + t.state = true; + t._toggleVisualChars(); + } + }); + }, + + getInfo : function() { + return { + longname : 'Visual characters', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _toggleVisualChars : function() { + var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo; + + t.state = !t.state; + ed.controlManager.setActive('visualchars', t.state); + + if (t.state) { + nl = []; + tinymce.walk(b, function(n) { + if (n.nodeType == 3 && n.nodeValue && n.nodeValue.indexOf('\u00a0') != -1) + nl.push(n); + }, 'childNodes'); + + for (i=0; i<nl.length; i++) { + nv = nl[i].nodeValue; + nv = nv.replace(/(\u00a0+)/g, '<span class="mceItemHidden mceVisualNbsp">$1</span>'); + nv = nv.replace(/\u00a0/g, '\u00b7'); + ed.dom.setOuterHTML(nl[i], nv, d); + } + } else { + nl = tinymce.grep(ed.dom.select('span', b), function(n) { + return ed.dom.hasClass(n, 'mceVisualNbsp'); + }); + + for (i=0; i<nl.length; i++) + ed.dom.setOuterHTML(nl[i], nl[i].innerHTML.replace(/(·|\u00b7)/g, ' '), d); + } + } + }); + + // Register plugin + tinymce.PluginManager.add('visualchars', tinymce.plugins.VisualChars); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/abbr.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/abbr.htm new file mode 100644 index 0000000000000000000000000000000000000000..3928a17e14b4c18629af550f7b4c3d42f5e85701 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/abbr.htm @@ -0,0 +1,148 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#xhtmlxtras_dlg.title_abbr_element}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/element_common.js"></script> + <script type="text/javascript" src="js/abbr.js"></script> + <link rel="stylesheet" type="text/css" href="css/popup.css" /> +</head> +<body style="display: none"> +<form onsubmit="insertAbbr();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li> + <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> --> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend> + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> + <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> + </tr> + <tr> + <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> + <td><input id="id" name="id" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> + <td> + <select id="class" name="class" class="field mceEditableSelect"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> + <td><input id="style" name="style" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> + <td> + <select id="dir" name="dir" class="field"> + <option value="">{#not_set}</option> + <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> + <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> + <td> + <input id="lang" name="lang" type="text" value="" class="field" /> + </td> + </tr> + </table> + </fieldset> + </div> + <div id="events_panel" class="panel"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label for="onfocus">onfocus</label>:</td> + <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onblur">onblur</label>:</td> + <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onclick">onclick</label>:</td> + <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="ondblclick">ondblclick</label>:</td> + <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousedown">onmousedown</label>:</td> + <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseup">onmouseup</label>:</td> + <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseover">onmouseover</label>:</td> + <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousemove">onmousemove</label>:</td> + <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseout">onmouseout</label>:</td> + <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeypress">onkeypress</label>:</td> + <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeydown">onkeydown</label>:</td> + <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeyup">onkeyup</label>:</td> + <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> + </tr> + </table> + </fieldset> + </div> + </div> + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#update}" /> + </div> + <div style="float: left"> + <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAbbr();" style="display: none;" /> + </div> + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/acronym.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/acronym.htm new file mode 100644 index 0000000000000000000000000000000000000000..4d4ebaac0aeca7f9881dfe68fa1c9b6a9f85949a --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/acronym.htm @@ -0,0 +1,148 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#xhtmlxtras_dlg.title_acronym_element}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/element_common.js"></script> + <script type="text/javascript" src="js/acronym.js"></script> + <link rel="stylesheet" type="text/css" href="css/popup.css" /> +</head> +<body style="display: none"> +<form onsubmit="insertAcronym();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li> + <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> --> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend> + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> + <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> + </tr> + <tr> + <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> + <td><input id="id" name="id" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> + <td> + <select id="class" name="class" class="field mceEditableSelect"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> + <td><input id="style" name="style" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> + <td> + <select id="dir" name="dir" class="field"> + <option value="">{#not_set}</option> + <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> + <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> + <td> + <input id="lang" name="lang" type="text" value="" class="field" /> + </td> + </tr> + </table> + </fieldset> + </div> + <div id="events_panel" class="panel"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label for="onfocus">onfocus</label>:</td> + <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onblur">onblur</label>:</td> + <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onclick">onclick</label>:</td> + <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="ondblclick">ondblclick</label>:</td> + <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousedown">onmousedown</label>:</td> + <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseup">onmouseup</label>:</td> + <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseover">onmouseover</label>:</td> + <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousemove">onmousemove</label>:</td> + <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseout">onmouseout</label>:</td> + <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeypress">onkeypress</label>:</td> + <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeydown">onkeydown</label>:</td> + <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeyup">onkeyup</label>:</td> + <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> + </tr> + </table> + </fieldset> + </div> + </div> + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#update}" /> + </div> + <div style="float: left"> + <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAcronym();" style="display: none;" /> + </div> + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/attributes.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/attributes.htm new file mode 100644 index 0000000000000000000000000000000000000000..322b468e38b71a04b25052bed3cbac5551ec4a1c --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/attributes.htm @@ -0,0 +1,153 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#xhtmlxtras_dlg.attribs_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="js/attributes.js"></script> + <link rel="stylesheet" type="text/css" href="css/attributes.css" /> +</head> +<body style="display: none"> +<form onsubmit="insertAction();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_attrib_tab}</a></span></li> + <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_events_tab}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#xhtmlxtras_dlg.attribute_attrib_tab}</legend> + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> + <td><input id="title" name="title" type="text" value="" class="mceFocus" /></td> + </tr> + <tr> + <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> + <td><input id="id" name="id" type="text" value="" /></td> + </tr> + <tr> + <td><label id="classlabel" for="classlist">{#class_name}</label></td> + <td> + <select id="classlist" name="classlist" class="mceEditableSelect"> + <option value="" selected="selected">{#not_set}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> + <td><input id="style" name="style" type="text" value="" /></td> + </tr> + <tr> + <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> + <td> + <select id="dir" name="dir"> + <option value="">{#not_set}</option> + <option value="ltr">{#xhtmlxtras_dlg.option_ltr}</option> + <option value="rtl">{#xhtmlxtras_dlg.option_rtl}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> + <td> + <input id="lang" name="lang" type="text" value="" /> + </td> + </tr> + <tr> + <td><label id="tabindexlabel" for="tabindex">{#xhtmlxtras_dlg.attribute_label_tabindex}</label></td> + <td><input type="text" id="tabindex" name="tabindex" value="" /></td> + </tr> + + <tr> + <td><label id="accesskeylabel" for="accesskey">{#xhtmlxtras_dlg.attribute_label_accesskey}</label></td> + <td><input type="text" id="accesskey" name="accesskey" value="" /></td> + </tr> + </table> + </fieldset> + </div> + <div id="events_panel" class="panel"> + <fieldset> + <legend>{#xhtmlxtras_dlg.attribute_events_tab}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label for="onfocus">onfocus</label>:</td> + <td><input id="onfocus" name="onfocus" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onblur">onblur</label>:</td> + <td><input id="onblur" name="onblur" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onclick">onclick</label>:</td> + <td><input id="onclick" name="onclick" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="ondblclick">ondblclick</label>:</td> + <td><input id="ondblclick" name="ondblclick" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousedown">onmousedown</label>:</td> + <td><input id="onmousedown" name="onmousedown" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseup">onmouseup</label>:</td> + <td><input id="onmouseup" name="onmouseup" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseover">onmouseover</label>:</td> + <td><input id="onmouseover" name="onmouseover" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousemove">onmousemove</label>:</td> + <td><input id="onmousemove" name="onmousemove" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseout">onmouseout</label>:</td> + <td><input id="onmouseout" name="onmouseout" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeypress">onkeypress</label>:</td> + <td><input id="onkeypress" name="onkeypress" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeydown">onkeydown</label>:</td> + <td><input id="onkeydown" name="onkeydown" type="text" value="" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeyup">onkeyup</label>:</td> + <td><input id="onkeyup" name="onkeyup" type="text" value="" /></td> + </tr> + </table> + </fieldset> + </div> + </div> + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/cite.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/cite.htm new file mode 100644 index 0000000000000000000000000000000000000000..cdfaf4e854649f682569ff8c9b442560d6fc9c78 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/cite.htm @@ -0,0 +1,148 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#xhtmlxtras_dlg.title_cite_element}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/element_common.js"></script> + <script type="text/javascript" src="js/cite.js"></script> + <link rel="stylesheet" type="text/css" href="css/popup.css" /> +</head> +<body style="display: none"> +<form onsubmit="insertCite();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li> + <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> --> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend> + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> + <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> + </tr> + <tr> + <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> + <td><input id="id" name="id" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> + <td> + <select id="class" name="class" class="field mceEditableSelect"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> + <td><input id="style" name="style" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> + <td> + <select id="dir" name="dir" class="field"> + <option value="">{#not_set}</option> + <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> + <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> + <td> + <input id="lang" name="lang" type="text" value="" class="field" /> + </td> + </tr> + </table> + </fieldset> + </div> + <div id="events_panel" class="panel"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label for="onfocus">onfocus</label>:</td> + <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onblur">onblur</label>:</td> + <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onclick">onclick</label>:</td> + <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="ondblclick">ondblclick</label>:</td> + <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousedown">onmousedown</label>:</td> + <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseup">onmouseup</label>:</td> + <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseover">onmouseover</label>:</td> + <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousemove">onmousemove</label>:</td> + <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseout">onmouseout</label>:</td> + <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeypress">onkeypress</label>:</td> + <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeydown">onkeydown</label>:</td> + <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeyup">onkeyup</label>:</td> + <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> + </tr> + </table> + </fieldset> + </div> + </div> + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#update}" /> + </div> + <div style="float: left"> + <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeCite();" style="display: none;" /> + </div> + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/css/attributes.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/css/attributes.css new file mode 100644 index 0000000000000000000000000000000000000000..9a6a235c35fc076e57595a8aa4a8b79f88e4496e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/css/attributes.css @@ -0,0 +1,11 @@ +.panel_wrapper div.current { + height: 290px; +} + +#id, #style, #title, #dir, #hreflang, #lang, #classlist, #tabindex, #accesskey { + width: 200px; +} + +#events_panel input { + width: 200px; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/css/popup.css b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/css/popup.css new file mode 100644 index 0000000000000000000000000000000000000000..e67114dbaafde7a970fcacd39a4df6cea62ab207 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/css/popup.css @@ -0,0 +1,9 @@ +input.field, select.field {width:200px;} +input.picker {width:179px; margin-left: 5px;} +input.disabled {border-color:#F2F2F2;} +img.picker {vertical-align:text-bottom; cursor:pointer;} +h1 {padding: 0 0 5px 0;} +.panel_wrapper div.current {height:160px;} +#xhtmlxtrasdel .panel_wrapper div.current, #xhtmlxtrasins .panel_wrapper div.current {height: 230px;} +a.browse span {display:block; width:20px; height:20px; background:url('../../../themes/advanced/img/icons.gif') -140px -20px;} +#datetime {width:180px;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/del.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/del.htm new file mode 100644 index 0000000000000000000000000000000000000000..f45676e3d4741c5ab45a5d3148e849e16870d606 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/del.htm @@ -0,0 +1,169 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#xhtmlxtras_dlg.title_del_element}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/element_common.js"></script> + <script type="text/javascript" src="js/del.js"></script> + <link rel="stylesheet" type="text/css" href="css/popup.css" /> +</head> +<body id="xhtmlxtrasins" style="display: none"> +<form onsubmit="insertDel();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li> + <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> --> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_general_tab}</legend> + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label id="datetimelabel" for="datetime">{#xhtmlxtras_dlg.attribute_label_datetime}</label>:</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="datetime" name="datetime" type="text" value="" maxlength="19" class="field mceFocus" /></td> + <td><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse"><span class="datetime" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td> + </tr> + </table> + </td> + </tr> + <tr> + <td class="label"><label id="citelabel" for="cite">{#xhtmlxtras_dlg.attribute_label_cite}</label>:</td> + <td><input id="cite" name="cite" type="text" value="" class="field" /></td> + </tr> + </table> + </fieldset> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend> + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> + <td><input id="title" name="title" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> + <td><input id="id" name="id" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> + <td> + <select id="class" name="class" class="field mceEditableSelect"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> + <td><input id="style" name="style" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> + <td> + <select id="dir" name="dir" class="field"> + <option value="">{#not_set}</option> + <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> + <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> + <td> + <input id="lang" name="lang" type="text" value="" class="field" /> + </td> + </tr> + </table> + </fieldset> + </div> + <div id="events_panel" class="panel"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label for="onfocus">onfocus</label>:</td> + <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onblur">onblur</label>:</td> + <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onclick">onclick</label>:</td> + <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="ondblclick">ondblclick</label>:</td> + <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousedown">onmousedown</label>:</td> + <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseup">onmouseup</label>:</td> + <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseover">onmouseover</label>:</td> + <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousemove">onmousemove</label>:</td> + <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseout">onmouseout</label>:</td> + <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeypress">onkeypress</label>:</td> + <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeydown">onkeydown</label>:</td> + <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeyup">onkeyup</label>:</td> + <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> + </tr> + </table> + </fieldset> + </div> + </div> + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#update}" /> + </div> + <div style="float: left"> + <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeDel();" style="display: none;" /> + </div> + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + +</form> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/editor_plugin.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..8c7f48e6920f6c8d9e69460c0036a64dbd1a4c24 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.XHTMLXtrasPlugin",{init:function(b,c){b.addCommand("mceCite",function(){b.windowManager.open({file:c+"/cite.htm",width:350+parseInt(b.getLang("xhtmlxtras.cite_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.cite_delta_height",0)),inline:1},{plugin_url:c})});b.addCommand("mceAcronym",function(){b.windowManager.open({file:c+"/acronym.htm",width:350+parseInt(b.getLang("xhtmlxtras.acronym_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.acronym_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceAbbr",function(){b.windowManager.open({file:c+"/abbr.htm",width:350+parseInt(b.getLang("xhtmlxtras.abbr_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.abbr_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceDel",function(){b.windowManager.open({file:c+"/del.htm",width:340+parseInt(b.getLang("xhtmlxtras.del_delta_width",0)),height:310+parseInt(b.getLang("xhtmlxtras.del_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceIns",function(){b.windowManager.open({file:c+"/ins.htm",width:340+parseInt(b.getLang("xhtmlxtras.ins_delta_width",0)),height:310+parseInt(b.getLang("xhtmlxtras.ins_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceAttributes",function(){b.windowManager.open({file:c+"/attributes.htm",width:380,height:370,inline:1},{plugin_url:c})});b.addButton("cite",{title:"xhtmlxtras.cite_desc",cmd:"mceCite"});b.addButton("acronym",{title:"xhtmlxtras.acronym_desc",cmd:"mceAcronym"});b.addButton("abbr",{title:"xhtmlxtras.abbr_desc",cmd:"mceAbbr"});b.addButton("del",{title:"xhtmlxtras.del_desc",cmd:"mceDel"});b.addButton("ins",{title:"xhtmlxtras.ins_desc",cmd:"mceIns"});b.addButton("attribs",{title:"xhtmlxtras.attribs_desc",cmd:"mceAttributes"});if(tinymce.isIE){function a(d,e){if(e.set){e.content=e.content.replace(/<abbr([^>]+)>/gi,"<html:abbr $1>");e.content=e.content.replace(/<\/abbr>/gi,"</html:abbr>")}}b.onBeforeSetContent.add(a);b.onPostProcess.add(a)}b.onNodeChange.add(function(e,d,g,f){g=e.dom.getParent(g,"CITE,ACRONYM,ABBR,DEL,INS");d.setDisabled("cite",f);d.setDisabled("acronym",f);d.setDisabled("abbr",f);d.setDisabled("del",f);d.setDisabled("ins",f);d.setDisabled("attribs",g&&g.nodeName=="BODY");d.setActive("cite",0);d.setActive("acronym",0);d.setActive("abbr",0);d.setActive("del",0);d.setActive("ins",0);if(g){do{d.setDisabled(g.nodeName.toLowerCase(),0);d.setActive(g.nodeName.toLowerCase(),1)}while(g=g.parentNode)}})},getInfo:function(){return{longname:"XHTML Xtras Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("xhtmlxtras",tinymce.plugins.XHTMLXtrasPlugin)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js new file mode 100644 index 0000000000000000000000000000000000000000..bef06f2d24e7abbda3a07d21b38c52e68dafdcf7 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js @@ -0,0 +1,136 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceCite', function() { + ed.windowManager.open({ + file : url + '/cite.htm', + width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)), + height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceAcronym', function() { + ed.windowManager.open({ + file : url + '/acronym.htm', + width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)), + height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceAbbr', function() { + ed.windowManager.open({ + file : url + '/abbr.htm', + width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)), + height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceDel', function() { + ed.windowManager.open({ + file : url + '/del.htm', + width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)), + height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceIns', function() { + ed.windowManager.open({ + file : url + '/ins.htm', + width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)), + height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceAttributes', function() { + ed.windowManager.open({ + file : url + '/attributes.htm', + width : 380, + height : 370, + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'}); + ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'}); + ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'}); + ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'}); + ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'}); + ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'}); + + if (tinymce.isIE) { + function fix(ed, o) { + if (o.set) { + o.content = o.content.replace(/<abbr([^>]+)>/gi, '<html:abbr $1>'); + o.content = o.content.replace(/<\/abbr>/gi, '</html:abbr>'); + } + }; + + ed.onBeforeSetContent.add(fix); + ed.onPostProcess.add(fix); + } + + ed.onNodeChange.add(function(ed, cm, n, co) { + n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS'); + + cm.setDisabled('cite', co); + cm.setDisabled('acronym', co); + cm.setDisabled('abbr', co); + cm.setDisabled('del', co); + cm.setDisabled('ins', co); + cm.setDisabled('attribs', n && n.nodeName == 'BODY'); + cm.setActive('cite', 0); + cm.setActive('acronym', 0); + cm.setActive('abbr', 0); + cm.setActive('del', 0); + cm.setActive('ins', 0); + + // Activate all + if (n) { + do { + cm.setDisabled(n.nodeName.toLowerCase(), 0); + cm.setActive(n.nodeName.toLowerCase(), 1); + } while (n = n.parentNode); + } + }); + }, + + getInfo : function() { + return { + longname : 'XHTML Xtras Plugin', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/ins.htm b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/ins.htm new file mode 100644 index 0000000000000000000000000000000000000000..9fa21c4338641a833a74d5d3c604051de0f93fd3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/ins.htm @@ -0,0 +1,169 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#xhtmlxtras_dlg.title_ins_element}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/editable_selects.js"></script> + <script type="text/javascript" src="js/element_common.js"></script> + <script type="text/javascript" src="js/ins.js"></script> + <link rel="stylesheet" type="text/css" href="css/popup.css" /> +</head> +<body id="xhtmlxtrasins" style="display: none"> +<form onsubmit="insertIns();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li> + <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> --> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_general_tab}</legend> + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label id="datetimelabel" for="datetime">{#xhtmlxtras_dlg.attribute_label_datetime}</label>:</td> + <td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="datetime" name="datetime" type="text" value="" maxlength="19" class="field mceFocus" /></td> + <td><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse"><span class="datetime" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td> + </tr> + </table> + </td> + </tr> + <tr> + <td class="label"><label id="citelabel" for="cite">{#xhtmlxtras_dlg.attribute_label_cite}</label>:</td> + <td><input id="cite" name="cite" type="text" value="" class="field" /></td> + </tr> + </table> + </fieldset> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend> + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> + <td><input id="title" name="title" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> + <td><input id="id" name="id" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> + <td> + <select id="class" name="class" class="field mceEditableSelect"> + <option value="">{#not_set}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> + <td><input id="style" name="style" type="text" value="" class="field" /></td> + </tr> + <tr> + <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> + <td> + <select id="dir" name="dir" class="field"> + <option value="">{#not_set}</option> + <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> + <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> + </select> + </td> + </tr> + <tr> + <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> + <td> + <input id="lang" name="lang" type="text" value="" class="field" /> + </td> + </tr> + </table> + </fieldset> + </div> + <div id="events_panel" class="panel"> + <fieldset> + <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend> + + <table border="0" cellpadding="0" cellspacing="4"> + <tr> + <td class="label"><label for="onfocus">onfocus</label>:</td> + <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onblur">onblur</label>:</td> + <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onclick">onclick</label>:</td> + <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="ondblclick">ondblclick</label>:</td> + <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousedown">onmousedown</label>:</td> + <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseup">onmouseup</label>:</td> + <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseover">onmouseover</label>:</td> + <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmousemove">onmousemove</label>:</td> + <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onmouseout">onmouseout</label>:</td> + <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeypress">onkeypress</label>:</td> + <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeydown">onkeydown</label>:</td> + <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> + </tr> + + <tr> + <td class="label"><label for="onkeyup">onkeyup</label>:</td> + <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> + </tr> + </table> + </fieldset> + </div> + </div> + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#update}" /> + </div> + <div style="float: left"> + <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeIns();" style="display: none;" /> + </div> + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> + +</form> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/abbr.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/abbr.js new file mode 100644 index 0000000000000000000000000000000000000000..e84b6a8378e9f25586fd551844d16893e4f8a8da --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/abbr.js @@ -0,0 +1,25 @@ + /** + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('abbr'); + if (SXE.currentAction == "update") { + SXE.showRemoveButton(); + } +} + +function insertAbbr() { + SXE.insertElement(tinymce.isIE ? 'html:abbr' : 'abbr'); + tinyMCEPopup.close(); +} + +function removeAbbr() { + SXE.removeElement('abbr'); + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/acronym.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/acronym.js new file mode 100644 index 0000000000000000000000000000000000000000..933d122cb9b199d0664eb1a52779fbe04a3066de --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/acronym.js @@ -0,0 +1,25 @@ + /** + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('acronym'); + if (SXE.currentAction == "update") { + SXE.showRemoveButton(); + } +} + +function insertAcronym() { + SXE.insertElement('acronym'); + tinyMCEPopup.close(); +} + +function removeAcronym() { + SXE.removeElement('acronym'); + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/attributes.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/attributes.js new file mode 100644 index 0000000000000000000000000000000000000000..23c7fa4c277c3fb52c8bb9076c825476ac714b03 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/attributes.js @@ -0,0 +1,123 @@ + /** + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + tinyMCEPopup.resizeToInnerSize(); + var inst = tinyMCEPopup.editor; + var dom = inst.dom; + var elm = inst.selection.getNode(); + var f = document.forms[0]; + var onclick = dom.getAttrib(elm, 'onclick'); + + setFormValue('title', dom.getAttrib(elm, 'title')); + setFormValue('id', dom.getAttrib(elm, 'id')); + setFormValue('style', dom.getAttrib(elm, "style")); + setFormValue('dir', dom.getAttrib(elm, 'dir')); + setFormValue('lang', dom.getAttrib(elm, 'lang')); + setFormValue('tabindex', dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : "")); + setFormValue('accesskey', dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : "")); + setFormValue('onfocus', dom.getAttrib(elm, 'onfocus')); + setFormValue('onblur', dom.getAttrib(elm, 'onblur')); + setFormValue('onclick', onclick); + setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick')); + setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown')); + setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup')); + setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover')); + setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove')); + setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout')); + setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress')); + setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown')); + setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup')); + className = dom.getAttrib(elm, 'class'); + + addClassesToList('classlist', 'advlink_styles'); + selectByValue(f, 'classlist', className, true); + + TinyMCE_EditableSelects.init(); +} + +function setFormValue(name, value) { + if(value && document.forms[0].elements[name]){ + document.forms[0].elements[name].value = value; + } +} + +function insertAction() { + var inst = tinyMCEPopup.editor; + var elm = inst.selection.getNode(); + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + setAllAttribs(elm); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); +} + +function setAttrib(elm, attrib, value) { + var formObj = document.forms[0]; + var valueElm = formObj.elements[attrib.toLowerCase()]; + var inst = tinyMCEPopup.editor; + var dom = inst.dom; + + if (typeof(value) == "undefined" || value == null) { + value = ""; + + if (valueElm) + value = valueElm.value; + } + + if (value != "") { + dom.setAttrib(elm, attrib.toLowerCase(), value); + + if (attrib == "style") + attrib = "style.cssText"; + + if (attrib.substring(0, 2) == 'on') + value = 'return true;' + value; + + if (attrib == "class") + attrib = "className"; + + elm[attrib]=value; + } else + elm.removeAttribute(attrib); +} + +function setAllAttribs(elm) { + var f = document.forms[0]; + + setAttrib(elm, 'title'); + setAttrib(elm, 'id'); + setAttrib(elm, 'style'); + setAttrib(elm, 'class', getSelectValue(f, 'classlist')); + setAttrib(elm, 'dir'); + setAttrib(elm, 'lang'); + setAttrib(elm, 'tabindex'); + setAttrib(elm, 'accesskey'); + setAttrib(elm, 'onfocus'); + setAttrib(elm, 'onblur'); + setAttrib(elm, 'onclick'); + setAttrib(elm, 'ondblclick'); + setAttrib(elm, 'onmousedown'); + setAttrib(elm, 'onmouseup'); + setAttrib(elm, 'onmouseover'); + setAttrib(elm, 'onmousemove'); + setAttrib(elm, 'onmouseout'); + setAttrib(elm, 'onkeypress'); + setAttrib(elm, 'onkeydown'); + setAttrib(elm, 'onkeyup'); + + // Refresh in old MSIE +// if (tinyMCE.isMSIE5) +// elm.outerHTML = elm.outerHTML; +} + +function insertAttribute() { + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); +tinyMCEPopup.requireLangPack(); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/cite.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/cite.js new file mode 100644 index 0000000000000000000000000000000000000000..c36f7fd874cfd31c28638fe0443a8d24b70ae48b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/cite.js @@ -0,0 +1,25 @@ + /** + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('cite'); + if (SXE.currentAction == "update") { + SXE.showRemoveButton(); + } +} + +function insertCite() { + SXE.insertElement('cite'); + tinyMCEPopup.close(); +} + +function removeCite() { + SXE.removeElement('cite'); + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/del.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/del.js new file mode 100644 index 0000000000000000000000000000000000000000..7049f2beb4e18e5b85b35a484623cf65716b5fd3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/del.js @@ -0,0 +1,60 @@ + /** + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('del'); + if (SXE.currentAction == "update") { + setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime')); + setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite')); + SXE.showRemoveButton(); + } +} + +function setElementAttribs(elm) { + setAllCommonAttribs(elm); + setAttrib(elm, 'datetime'); + setAttrib(elm, 'cite'); +} + +function insertDel() { + var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL'); + + tinyMCEPopup.execCommand('mceBeginUndoLevel'); + if (elm == null) { + var s = SXE.inst.selection.getContent(); + if(s.length > 0) { + insertInlineElement('del'); + var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';}); + for (var i=0; i<elementArray.length; i++) { + var elm = elementArray[i]; + setElementAttribs(elm); + } + } + } else { + setElementAttribs(elm); + } + tinyMCEPopup.editor.nodeChanged(); + tinyMCEPopup.execCommand('mceEndUndoLevel'); + tinyMCEPopup.close(); +} + +function insertInlineElement(en) { + var ed = tinyMCEPopup.editor, dom = ed.dom; + + ed.getDoc().execCommand('FontName', false, 'mceinline'); + tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) { + if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') + dom.replace(dom.create(en), n, 1); + }); +} + +function removeDel() { + SXE.removeElement('del'); + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/element_common.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/element_common.js new file mode 100644 index 0000000000000000000000000000000000000000..70f168a6b5f03999e5d29808edf4f82ac577fd8a --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/element_common.js @@ -0,0 +1,231 @@ + /** + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +tinyMCEPopup.requireLangPack(); + +function initCommonAttributes(elm) { + var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom; + + // Setup form data for common element attributes + setFormValue('title', dom.getAttrib(elm, 'title')); + setFormValue('id', dom.getAttrib(elm, 'id')); + selectByValue(formObj, 'class', dom.getAttrib(elm, 'class'), true); + setFormValue('style', dom.getAttrib(elm, 'style')); + selectByValue(formObj, 'dir', dom.getAttrib(elm, 'dir')); + setFormValue('lang', dom.getAttrib(elm, 'lang')); + setFormValue('onfocus', dom.getAttrib(elm, 'onfocus')); + setFormValue('onblur', dom.getAttrib(elm, 'onblur')); + setFormValue('onclick', dom.getAttrib(elm, 'onclick')); + setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick')); + setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown')); + setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup')); + setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover')); + setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove')); + setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout')); + setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress')); + setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown')); + setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup')); +} + +function setFormValue(name, value) { + if(document.forms[0].elements[name]) document.forms[0].elements[name].value = value; +} + +function insertDateTime(id) { + document.getElementById(id).value = getDateTime(new Date(), "%Y-%m-%dT%H:%M:%S"); +} + +function getDateTime(d, fmt) { + fmt = fmt.replace("%D", "%m/%d/%y"); + fmt = fmt.replace("%r", "%I:%M:%S %p"); + fmt = fmt.replace("%Y", "" + d.getFullYear()); + fmt = fmt.replace("%y", "" + d.getYear()); + fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2)); + fmt = fmt.replace("%d", addZeros(d.getDate(), 2)); + fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2)); + fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2)); + fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2)); + fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1)); + fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM")); + fmt = fmt.replace("%%", "%"); + + return fmt; +} + +function addZeros(value, len) { + var i; + + value = "" + value; + + if (value.length < len) { + for (i=0; i<(len-value.length); i++) + value = "0" + value; + } + + return value; +} + +function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { + if (!form_obj || !form_obj.elements[field_name]) + return; + + var sel = form_obj.elements[field_name]; + + var found = false; + for (var i=0; i<sel.options.length; i++) { + var option = sel.options[i]; + + if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) { + option.selected = true; + found = true; + } else + option.selected = false; + } + + if (!found && add_custom && value != '') { + var option = new Option('Value: ' + value, value); + option.selected = true; + sel.options[sel.options.length] = option; + } + + return found; +} + +function setAttrib(elm, attrib, value) { + var formObj = document.forms[0]; + var valueElm = formObj.elements[attrib.toLowerCase()]; + tinyMCEPopup.editor.dom.setAttrib(elm, attrib, value || valueElm.value); +} + +function setAllCommonAttribs(elm) { + setAttrib(elm, 'title'); + setAttrib(elm, 'id'); + setAttrib(elm, 'class'); + setAttrib(elm, 'style'); + setAttrib(elm, 'dir'); + setAttrib(elm, 'lang'); + /*setAttrib(elm, 'onfocus'); + setAttrib(elm, 'onblur'); + setAttrib(elm, 'onclick'); + setAttrib(elm, 'ondblclick'); + setAttrib(elm, 'onmousedown'); + setAttrib(elm, 'onmouseup'); + setAttrib(elm, 'onmouseover'); + setAttrib(elm, 'onmousemove'); + setAttrib(elm, 'onmouseout'); + setAttrib(elm, 'onkeypress'); + setAttrib(elm, 'onkeydown'); + setAttrib(elm, 'onkeyup');*/ +} + +SXE = { + currentAction : "insert", + inst : tinyMCEPopup.editor, + updateElement : null +} + +SXE.focusElement = SXE.inst.selection.getNode(); + +SXE.initElementDialog = function(element_name) { + addClassesToList('class', 'xhtmlxtras_styles'); + TinyMCE_EditableSelects.init(); + + element_name = element_name.toLowerCase(); + var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase()); + if (elm != null && elm.nodeName.toUpperCase() == element_name.toUpperCase()) { + SXE.currentAction = "update"; + } + + if (SXE.currentAction == "update") { + initCommonAttributes(elm); + SXE.updateElement = elm; + } + + document.forms[0].insert.value = tinyMCEPopup.getLang(SXE.currentAction, 'Insert', true); +} + +SXE.insertElement = function(element_name) { + var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase()), h, tagName; + + tinyMCEPopup.execCommand('mceBeginUndoLevel'); + if (elm == null) { + var s = SXE.inst.selection.getContent(); + if(s.length > 0) { + tagName = element_name; + + if (tinymce.isIE && element_name.indexOf('html:') == 0) + element_name = element_name.substring(5).toLowerCase(); + + insertInlineElement(element_name); + var elementArray = tinymce.grep(SXE.inst.dom.select(element_name)); + for (var i=0; i<elementArray.length; i++) { + var elm = elementArray[i]; + + if (SXE.inst.dom.getAttrib(elm, '_mce_new')) { + elm.id = ''; + elm.setAttribute('id', ''); + elm.removeAttribute('id'); + elm.removeAttribute('_mce_new'); + + setAllCommonAttribs(elm); + } + } + } + } else { + setAllCommonAttribs(elm); + } + SXE.inst.nodeChanged(); + tinyMCEPopup.execCommand('mceEndUndoLevel'); +} + +SXE.removeElement = function(element_name){ + element_name = element_name.toLowerCase(); + elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase()); + if(elm && elm.nodeName.toUpperCase() == element_name.toUpperCase()){ + tinyMCEPopup.execCommand('mceBeginUndoLevel'); + tinyMCE.execCommand('mceRemoveNode', false, elm); + SXE.inst.nodeChanged(); + tinyMCEPopup.execCommand('mceEndUndoLevel'); + } +} + +SXE.showRemoveButton = function() { + document.getElementById("remove").style.display = 'block'; +} + +SXE.containsClass = function(elm,cl) { + return (elm.className.indexOf(cl) > -1) ? true : false; +} + +SXE.removeClass = function(elm,cl) { + if(elm.className == null || elm.className == "" || !SXE.containsClass(elm,cl)) { + return true; + } + var classNames = elm.className.split(" "); + var newClassNames = ""; + for (var x = 0, cnl = classNames.length; x < cnl; x++) { + if (classNames[x] != cl) { + newClassNames += (classNames[x] + " "); + } + } + elm.className = newClassNames.substring(0,newClassNames.length-1); //removes extra space at the end +} + +SXE.addClass = function(elm,cl) { + if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl; + return true; +} + +function insertInlineElement(en) { + var ed = tinyMCEPopup.editor, dom = ed.dom; + + ed.getDoc().execCommand('FontName', false, 'mceinline'); + tinymce.each(dom.select('span,font'), function(n) { + if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') + dom.replace(dom.create(en, {_mce_new : 1}), n, 1); + }); +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/ins.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/ins.js new file mode 100644 index 0000000000000000000000000000000000000000..4fcc998256fb902ec0f9b9c6f47b6f4afefd4927 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/js/ins.js @@ -0,0 +1,59 @@ + /** + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('ins'); + if (SXE.currentAction == "update") { + setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime')); + setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite')); + SXE.showRemoveButton(); + } +} + +function setElementAttribs(elm) { + setAllCommonAttribs(elm); + setAttrib(elm, 'datetime'); + setAttrib(elm, 'cite'); +} + +function insertIns() { + var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS'); + tinyMCEPopup.execCommand('mceBeginUndoLevel'); + if (elm == null) { + var s = SXE.inst.selection.getContent(); + if(s.length > 0) { + insertInlineElement('INS'); + var elementArray = tinymce.grep(SXE.inst.dom.select('ins'), function(n) {return n.id == '#sxe_temp_ins#';}); + for (var i=0; i<elementArray.length; i++) { + var elm = elementArray[i]; + setElementAttribs(elm); + } + } + } else { + setElementAttribs(elm); + } + tinyMCEPopup.editor.nodeChanged(); + tinyMCEPopup.execCommand('mceEndUndoLevel'); + tinyMCEPopup.close(); +} + +function removeIns() { + SXE.removeElement('ins'); + tinyMCEPopup.close(); +} + +function insertInlineElement(en) { + var ed = tinyMCEPopup.editor, dom = ed.dom; + + ed.getDoc().execCommand('FontName', false, 'mceinline'); + tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) { + if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') + dom.replace(dom.create(en), n, 1); + }); +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..45b6b267bacbf36b85b489901e0b7357dab9cf18 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js @@ -0,0 +1,32 @@ +tinyMCE.addI18n('en.xhtmlxtras_dlg',{ +attribute_label_title:"Title", +attribute_label_id:"ID", +attribute_label_class:"Class", +attribute_label_style:"Style", +attribute_label_cite:"Cite", +attribute_label_datetime:"Date/Time", +attribute_label_langdir:"Text Direction", +attribute_option_ltr:"Left to right", +attribute_option_rtl:"Right to left", +attribute_label_langcode:"Language", +attribute_label_tabindex:"TabIndex", +attribute_label_accesskey:"AccessKey", +attribute_events_tab:"Events", +attribute_attrib_tab:"Attributes", +general_tab:"General", +attrib_tab:"Attributes", +events_tab:"Events", +fieldset_general_tab:"General Settings", +fieldset_attrib_tab:"Element Attributes", +fieldset_events_tab:"Element Events", +title_ins_element:"Insertion Element", +title_del_element:"Deletion Element", +title_acronym_element:"Acronym Element", +title_abbr_element:"Abbreviation Element", +title_cite_element:"Citation Element", +remove:"Remove", +insert_date:"Insert current date/time", +option_ltr:"Left to right", +option_rtl:"Right to left", +attribs_title:"Insert/Edit Attributes" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/about.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/about.htm new file mode 100644 index 0000000000000000000000000000000000000000..e5df7aa5aca5b9b6d138569f4d2f8626b0d3652b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/about.htm @@ -0,0 +1,56 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.about_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="js/about.js"></script> +</head> +<body id="about" style="display: none"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li> + <li id="help_tab" style="display:none"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li> + <li id="plugins_tab"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <h3>{#advanced_dlg.about_title}</h3> + <p>Version: <span id="version"></span> (<span id="date"></span>)</p> + <p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a> + by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p> + <p>Copyright © 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p> + <p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p> + + <div id="buttoncontainer"> + <a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a> + <a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="http://sourceforge.net/sflogo.php?group_id=103281" alt="Hosted By Sourceforge" border="0" /></a> + <a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="http://tinymce.moxiecode.com/images/fm.gif" alt="Also on freshmeat" border="0" /></a> + </div> + </div> + + <div id="plugins_panel" class="panel"> + <div id="pluginscontainer"> + <h3>{#advanced_dlg.about_loaded}</h3> + + <div id="plugintablecontainer"> + </div> + + <p> </p> + </div> + </div> + + <div id="help_panel" class="panel noscroll" style="overflow: visible;"> + <div id="iframecontainer"></div> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/anchor.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/anchor.htm new file mode 100644 index 0000000000000000000000000000000000000000..42095a1c0cabd4db2666cbdefd2666cfa68e00b0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/anchor.htm @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.anchor_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/anchor.js"></script> +</head> +<body style="display: none"> +<form onsubmit="AnchorDialog.update();return false;" action="#"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td colspan="2" class="title">{#advanced_dlg.anchor_title}</td> + </tr> + <tr> + <td class="nowrap">{#advanced_dlg.anchor_name}:</td> + <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" /></td> + </tr> + </table> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#update}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/charmap.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/charmap.htm new file mode 100644 index 0000000000000000000000000000000000000000..f11a38ad8a2a8038b7809b76c499e73b09b89c0e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/charmap.htm @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.charmap_title}</title> + <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/charmap.js"></script> +</head> +<body id="charmap" style="display:none"> +<table align="center" border="0" cellspacing="0" cellpadding="2"> + <tr> + <td colspan="2" class="title">{#advanced_dlg.charmap_title}</td> + </tr> + <tr> + <td id="charmapView" rowspan="2" align="left" valign="top"> + <!-- Chars will be rendered here --> + </td> + <td width="100" align="center" valign="top"> + <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px"> + <tr> + <td id="codeV"> </td> + </tr> + <tr> + <td id="codeN"> </td> + </tr> + </table> + </td> + </tr> + <tr> + <td valign="bottom" style="padding-bottom: 3px;"> + <table width="100" align="center" border="0" cellpadding="2" cellspacing="0"> + <tr> + <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;">HTML-Code</td> + </tr> + <tr> + <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center"> </td> + </tr> + <tr> + <td style="font-size: 1px;"> </td> + </tr> + <tr> + <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;">NUM-Code</td> + </tr> + <tr> + <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center"> </td> + </tr> + </table> + </td> + </tr> +</table> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/color_picker.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/color_picker.htm new file mode 100644 index 0000000000000000000000000000000000000000..90eb4c2ee1fc66b458f718c8e78f3b9b3fb375d2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/color_picker.htm @@ -0,0 +1,75 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.colorpicker_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="js/color_picker.js"></script> +</head> +<body id="colorpicker" style="display: none"> +<form onsubmit="insertAction();return false" action="#"> + <div class="tabs"> + <ul> + <li id="picker_tab" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li> + <li id="rgb_tab"><span><a href="javascript:;" onclick="generateWebColors();mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li> + <li id="named_tab"><span><a href="javascript:;" onclick="generateNamedColors();javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="picker_panel" class="panel current"> + <fieldset> + <legend>{#advanced_dlg.colorpicker_picker_title}</legend> + <div id="picker"> + <img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt=" " /> + + <div id="light"> + <!-- Will be filled with divs --> + </div> + + <br style="clear: both" /> + </div> + </fieldset> + </div> + + <div id="rgb_panel" class="panel"> + <fieldset> + <legend>{#advanced_dlg.colorpicker_palette_title}</legend> + <div id="webcolors"> + <!-- Gets filled with web safe colors--> + </div> + + <br style="clear: both" /> + </fieldset> + </div> + + <div id="named_panel" class="panel"> + <fieldset> + <legend>{#advanced_dlg.colorpicker_named_title}</legend> + <div id="namedcolors"> + <!-- Gets filled with named colors--> + </div> + + <br style="clear: both" /> + + <div id="colornamecontainer"> + {#advanced_dlg.colorpicker_name} <span id="colorname"></span> + </div> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#apply}" /> + </div> + + <div id="preview"></div> + + <div id="previewblock"> + <label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" maxlength="8" class="text mceFocus" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/editor_template.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/editor_template.js new file mode 100644 index 0000000000000000000000000000000000000000..628c793cc7961c7e22d2e1c04940aa2bf66f7132 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/editor_template.js @@ -0,0 +1 @@ +(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";if(j.settings.convert_fonts_to_spans){o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){j.onNodeChange.add(l._nodeChanged,l);if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(j){var i=this.editor,k=i.controlManager.get("styleselect");if(k.getLength()==0){f(i.dom.getClasses(),function(l){k.add(l["class"],l["class"])})}},_createStyleSelect:function(m){var j=this,i=j.editor,k=i.controlManager,l=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){if(l.selectedValue===n){i.execCommand("mceSetStyleInfo",0,{command:"removeformat"});l.select();return false}else{i.execCommand("mceSetCSSClass",0,n)}}});if(l){f(i.getParam("theme_advanced_styles","","hash"),function(o,n){if(o){l.add(j.editor.translate(n),o)}});l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",j._importClasses,j);b.add(p.id+"_text","mousedown",j._importClasses,j);b.add(p.id+"_open","focus",j._importClasses,j);b.add(p.id+"_open","mousedown",j._importClasses,j)}else{b.add(p.id,"focus",j._importClasses,j)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",cmd:"FontName"});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr"),m;i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);m=n.clientHeight-o.clientHeight;d.setStyle(o,"height",l-m);d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":" ");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}if(w.theme_advanced_resize_horizontal){r.style.width=Math.max(10,n.cw)+"px"}r.style.height=Math.max(10,n.ch)+"px";d.get(p.id+"_ifr").style.height=Math.max(10,parseInt(n.ch)+v.deltaHeight)+"px"})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(x){var z,t,o,s,y,r;z=d.get(p.id+"_tbl");o=z.clientWidth;s=z.clientHeight;miw=w.theme_advanced_resizing_min_width||100;mih=w.theme_advanced_resizing_min_height||100;maw=w.theme_advanced_resizing_max_width||65535;mah=w.theme_advanced_resizing_max_height||65535;t=d.add(d.get(p.id+"_parent"),"div",{"class":"mcePlaceHolder"});d.setStyles(t,{width:o,height:s});d.hide(z);d.show(t);i={x:x.screenX,y:x.screenY,w:o,h:s,dx:null,dy:null};q=b.add(d.doc,"mousemove",function(B){var n,A;i.dx=B.screenX-i.x;i.dy=B.screenY-i.y;n=Math.max(miw,i.w+i.dx);A=Math.max(mih,i.h+i.dy);n=Math.min(maw,n);A=Math.min(mah,A);if(w.theme_advanced_resize_horizontal){t.style.width=n+"px"}t.style.height=A+"px";return b.cancel(B)});u=b.add(d.doc,"mouseup",function(n){var A;b.remove(d.doc,"mousemove",q);b.remove(d.doc,"mouseup",u);z.style.display="";d.remove(t);if(i.dx===null){return}A=d.get(p.id+"_ifr");if(w.theme_advanced_resize_horizontal){z.style.width=Math.max(10,i.w+i.dx)+"px"}z.style.height=Math.max(10,i.h+i.dy)+"px";A.style.height=Math.max(10,A.clientHeight+i.dy)+"px";if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:i.w+i.dx,ch:i.h+i.dy})}});return b.cancel(x)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(l,u,k,q){var y=this,i,r=0,x,m,z=y.settings,w,j,o;if(z.readonly){return}e.each(y.stateControls,function(n){u.setActive(n,l.queryCommandState(y.controls[n][1]))});u.setActive("visualaid",l.hasVisual);u.setDisabled("undo",!l.undoManager.hasUndo()&&!l.typing);u.setDisabled("redo",!l.undoManager.hasRedo());u.setDisabled("outdent",!l.queryCommandState("Outdent"));i=d.getParent(k,"A");if(m=u.get("link")){if(!i||!i.name){m.setDisabled(!i&&q);m.setActive(!!i)}}if(m=u.get("unlink")){m.setDisabled(!i&&q);m.setActive(!!i&&!i.name)}if(m=u.get("anchor")){m.setActive(!!i&&i.name);if(e.isWebKit){i=d.getParent(k,"IMG");m.setActive(!!i&&d.getAttrib(i,"mce_name")=="a")}}i=d.getParent(k,"IMG");if(m=u.get("image")){m.setActive(!!i&&k.className.indexOf("mceItem")==-1)}if(m=u.get("styleselect")){if(k.className){y._importClasses();m.select(k.className)}else{m.select()}}if(m=u.get("formatselect")){i=d.getParent(k,d.isBlock);if(i){m.select(i.nodeName.toLowerCase())}}if(l.settings.convert_fonts_to_spans){l.dom.getParent(k,function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}if(!j&&p.style.fontSize){j=p.style.fontSize}if(!o&&p.style.fontFamily){o=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(m=u.get("fontselect")){m.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==o})}if(m=u.get("fontsizeselect")){m.select(function(n){if(n.fontSize&&n.fontSize===j){return true}if(n["class"]&&n["class"]===w){return true}})}}else{if(m=u.get("fontselect")){m.select(l.queryCommandValue("FontName"))}if(m=u.get("fontsizeselect")){x=l.queryCommandValue("FontSize");m.select(function(n){return n.fontSize==x})}}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){i=d.get(l.id+"_path")||d.add(l.id+"_path_row","span",{id:l.id+"_path"});d.setHTML(i,"");l.dom.getParent(k,function(A){var p=A.nodeName.toLowerCase(),s,v,t="";if(A.nodeType!=1||A.nodeName==="BR"||(d.hasClass(A,"mceItemHidden")||d.hasClass(A,"mceItemRemoved"))){return}if(x=d.getAttrib(A,"mce_name")){p=x}if(e.isIE&&A.scopeName!=="HTML"){p=A.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(A,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(A,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(A,"href")){t+="href: "+x+" "}break;case"font":if(z.convert_fonts_to_spans){p="span"}if(x=d.getAttrib(A,"face")){t+="font: "+x+" "}if(x=d.getAttrib(A,"size")){t+="size: "+x+" "}if(x=d.getAttrib(A,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(A,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(A,"id")){t+="id: "+x+" "}if(x=A.className){x=x.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,"");if(x&&x.indexOf("mceItem")==-1){t+="class: "+x+" ";if(d.isBlock(A)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:A,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(r++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},l.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce)); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/editor_template_src.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/editor_template_src.js new file mode 100644 index 0000000000000000000000000000000000000000..21eb259a205a9da0d3c46f24deb13b0b309b8ff9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/editor_template_src.js @@ -0,0 +1,1153 @@ +/** + * $Id: editor_template_src.js 1045 2009-03-04 20:03:18Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function(tinymce) { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; + + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('advanced'); + + tinymce.create('tinymce.themes.AdvancedTheme', { + sizes : [8, 10, 12, 14, 18, 24, 36], + + // Control name lookup, format: title, command + controls : { + bold : ['bold_desc', 'Bold'], + italic : ['italic_desc', 'Italic'], + underline : ['underline_desc', 'Underline'], + strikethrough : ['striketrough_desc', 'Strikethrough'], + justifyleft : ['justifyleft_desc', 'JustifyLeft'], + justifycenter : ['justifycenter_desc', 'JustifyCenter'], + justifyright : ['justifyright_desc', 'JustifyRight'], + justifyfull : ['justifyfull_desc', 'JustifyFull'], + bullist : ['bullist_desc', 'InsertUnorderedList'], + numlist : ['numlist_desc', 'InsertOrderedList'], + outdent : ['outdent_desc', 'Outdent'], + indent : ['indent_desc', 'Indent'], + cut : ['cut_desc', 'Cut'], + copy : ['copy_desc', 'Copy'], + paste : ['paste_desc', 'Paste'], + undo : ['undo_desc', 'Undo'], + redo : ['redo_desc', 'Redo'], + link : ['link_desc', 'mceLink'], + unlink : ['unlink_desc', 'unlink'], + image : ['image_desc', 'mceImage'], + cleanup : ['cleanup_desc', 'mceCleanup'], + help : ['help_desc', 'mceHelp'], + code : ['code_desc', 'mceCodeEditor'], + hr : ['hr_desc', 'InsertHorizontalRule'], + removeformat : ['removeformat_desc', 'RemoveFormat'], + sub : ['sub_desc', 'subscript'], + sup : ['sup_desc', 'superscript'], + forecolor : ['forecolor_desc', 'ForeColor'], + forecolorpicker : ['forecolor_desc', 'mceForeColor'], + backcolor : ['backcolor_desc', 'HiliteColor'], + backcolorpicker : ['backcolor_desc', 'mceBackColor'], + charmap : ['charmap_desc', 'mceCharMap'], + visualaid : ['visualaid_desc', 'mceToggleVisualAid'], + anchor : ['anchor_desc', 'mceInsertAnchor'], + newdocument : ['newdocument_desc', 'mceNewDocument'], + blockquote : ['blockquote_desc', 'mceBlockQuote'] + }, + + stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'], + + init : function(ed, url) { + var t = this, s, v, o; + + t.editor = ed; + t.url = url; + t.onResolveName = new tinymce.util.Dispatcher(this); + + // Default settings + t.settings = s = extend({ + theme_advanced_path : true, + theme_advanced_toolbar_location : 'bottom', + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect", + theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code", + theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap", + theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6", + theme_advanced_toolbar_align : "center", + theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats", + theme_advanced_more_colors : 1, + theme_advanced_row_height : 23, + theme_advanced_resize_horizontal : 1, + theme_advanced_resizing_use_cookie : 1, + theme_advanced_font_sizes : "1,2,3,4,5,6,7", + readonly : ed.settings.readonly + }, ed.settings); + + // Setup default font_size_style_values + if (!s.font_size_style_values) + s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt"; + + if (tinymce.is(s.theme_advanced_font_sizes, 'string')) { + s.font_size_style_values = tinymce.explode(s.font_size_style_values); + s.font_size_classes = tinymce.explode(s.font_size_classes || ''); + + // Parse string value + o = {}; + ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes; + each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) { + var cl; + + if (k == v && v >= 1 && v <= 7) { + k = v + ' (' + t.sizes[v - 1] + 'pt)'; + + if (ed.settings.convert_fonts_to_spans) { + cl = s.font_size_classes[v - 1]; + v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt'); + } + } + + if (/^\s*\./.test(v)) + cl = v.replace(/\./g, ''); + + o[k] = cl ? {'class' : cl} : {fontSize : v}; + }); + + s.theme_advanced_font_sizes = o; + } + + if ((v = s.theme_advanced_path_location) && v != 'none') + s.theme_advanced_statusbar_location = s.theme_advanced_path_location; + + if (s.theme_advanced_statusbar_location == 'none') + s.theme_advanced_statusbar_location = 0; + + // Init editor + ed.onInit.add(function() { + ed.onNodeChange.add(t._nodeChanged, t); + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css")); + }); + + ed.onSetProgressState.add(function(ed, b, ti) { + var co, id = ed.id, tb; + + if (b) { + t.progressTimer = setTimeout(function() { + co = ed.getContainer(); + co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild); + tb = DOM.get(ed.id + '_tbl'); + + DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}}); + DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}}); + }, ti || 0); + } else { + DOM.remove(id + '_blocker'); + DOM.remove(id + '_progress'); + clearTimeout(t.progressTimer); + } + }); + + DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css"); + + if (s.skin_variant) + DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css"); + }, + + createControl : function(n, cf) { + var cd, c; + + if (c = cf.createControl(n)) + return c; + + switch (n) { + case "styleselect": + return this._createStyleSelect(); + + case "formatselect": + return this._createBlockFormats(); + + case "fontselect": + return this._createFontSelect(); + + case "fontsizeselect": + return this._createFontSizeSelect(); + + case "forecolor": + return this._createForeColorMenu(); + + case "backcolor": + return this._createBackColorMenu(); + } + + if ((cd = this.controls[n])) + return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]}); + }, + + execCommand : function(cmd, ui, val) { + var f = this['_' + cmd]; + + if (f) { + f.call(this, ui, val); + return true; + } + + return false; + }, + + _importClasses : function(e) { + var ed = this.editor, c = ed.controlManager.get('styleselect'); + + if (c.getLength() == 0) { + each(ed.dom.getClasses(), function(o) { + c.add(o['class'], o['class']); + }); + } + }, + + _createStyleSelect : function(n) { + var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', { + title : 'advanced.style_select', + onselect : function(v) { + if (c.selectedValue === v) { + ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'}); + c.select(); + return false; + } else + ed.execCommand('mceSetCSSClass', 0, v); + } + }); + + if (c) { + each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) { + if (v) + c.add(t.editor.translate(k), v); + }); + + c.onPostRender.add(function(ed, n) { + if (!c.NativeListBox) { + Event.add(n.id + '_text', 'focus', t._importClasses, t); + Event.add(n.id + '_text', 'mousedown', t._importClasses, t); + Event.add(n.id + '_open', 'focus', t._importClasses, t); + Event.add(n.id + '_open', 'mousedown', t._importClasses, t); + } else + Event.add(n.id, 'focus', t._importClasses, t); + }); + } + + return c; + }, + + _createFontSelect : function() { + var c, t = this, ed = t.editor; + + c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'}); + if (c) { + each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) { + c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''}); + }); + } + + return c; + }, + + _createFontSizeSelect : function() { + var t = this, ed = t.editor, c, i = 0, cl = []; + + c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) { + if (v.fontSize) + ed.execCommand('FontSize', false, v.fontSize); + else { + each(t.settings.theme_advanced_font_sizes, function(v, k) { + if (v['class']) + cl.push(v['class']); + }); + + ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl}); + } + }}); + + if (c) { + each(t.settings.theme_advanced_font_sizes, function(v, k) { + var fz = v.fontSize; + + if (fz >= 1 && fz <= 7) + fz = t.sizes[parseInt(fz) - 1] + 'pt'; + + c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))}); + }); + } + + return c; + }, + + _createBlockFormats : function() { + var c, fmts = { + p : 'advanced.paragraph', + address : 'advanced.address', + pre : 'advanced.pre', + h1 : 'advanced.h1', + h2 : 'advanced.h2', + h3 : 'advanced.h3', + h4 : 'advanced.h4', + h5 : 'advanced.h5', + h6 : 'advanced.h6', + div : 'advanced.div', + blockquote : 'advanced.blockquote', + code : 'advanced.code', + dt : 'advanced.dt', + dd : 'advanced.dd', + samp : 'advanced.samp' + }, t = this; + + c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'}); + if (c) { + each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) { + c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v}); + }); + } + + return c; + }, + + _createForeColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_advanced_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_advanced_text_colors) + o.colors = v; + + if (s.theme_advanced_default_foreground_color) + o.default_color = s.theme_advanced_default_foreground_color; + + o.title = 'advanced.forecolor_desc'; + o.cmd = 'ForeColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('forecolor', o); + + return c; + }, + + _createBackColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_advanced_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_advanced_background_colors) + o.colors = v; + + if (s.theme_advanced_default_background_color) + o.default_color = s.theme_advanced_default_background_color; + + o.title = 'advanced.backcolor_desc'; + o.cmd = 'HiliteColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('backcolor', o); + + return c; + }, + + renderUI : function(o) { + var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl; + + n = p = DOM.create('span', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')}); + + if (!DOM.boxModel) + n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'}); + + n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0}); + n = tb = DOM.add(n, 'tbody'); + + switch ((s.theme_advanced_layout_manager || '').toLowerCase()) { + case "rowlayout": + ic = t._rowLayout(s, tb, o); + break; + + case "customlayout": + ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p); + break; + + default: + ic = t._simpleLayout(s, tb, o, p); + } + + n = o.targetNode; + + // Add classes to first and last TRs + nl = DOM.stdMode ? sc.getElementsByTagName('tr') : sc.rows; // Quick fix for IE 8 + DOM.addClass(nl[0], 'mceFirst'); + DOM.addClass(nl[nl.length - 1], 'mceLast'); + + // Add classes to first and last TDs + each(DOM.select('tr', tb), function(n) { + DOM.addClass(n.firstChild, 'mceFirst'); + DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast'); + }); + + if (DOM.get(s.theme_advanced_toolbar_container)) + DOM.get(s.theme_advanced_toolbar_container).appendChild(p); + else + DOM.insertAfter(p, n); + + Event.add(ed.id + '_path_row', 'click', function(e) { + e = e.target; + + if (e.nodeName == 'A') { + t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1')); + + return Event.cancel(e); + } + }); +/* + if (DOM.get(ed.id + '_path_row')) { + Event.add(ed.id + '_tbl', 'mouseover', function(e) { + var re; + + e = e.target; + + if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) { + re = DOM.get(ed.id + '_path_row'); + t.lastPath = re.innerHTML; + DOM.setHTML(re, e.parentNode.title); + } + }); + + Event.add(ed.id + '_tbl', 'mouseout', function(e) { + if (t.lastPath) { + DOM.setHTML(ed.id + '_path_row', t.lastPath); + t.lastPath = 0; + } + }); + } +*/ + + if (!ed.getParam('accessibility_focus')) + Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();}); + + if (s.theme_advanced_toolbar_location == 'external') + o.deltaHeight = 0; + + t.deltaHeight = o.deltaHeight; + o.targetNode = null; + + return { + iframeContainer : ic, + editorContainer : ed.id + '_parent', + sizeContainer : sc, + deltaHeight : o.deltaHeight + }; + }, + + getInfo : function() { + return { + longname : 'Advanced theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + }, + + resizeBy : function(dw, dh) { + var e = DOM.get(this.editor.id + '_tbl'); + + this.resizeTo(e.clientWidth + dw, e.clientHeight + dh); + }, + + resizeTo : function(w, h) { + var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh; + + // Boundery fix box + w = Math.max(s.theme_advanced_resizing_min_width || 100, w); + h = Math.max(s.theme_advanced_resizing_min_height || 100, h); + w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w); + h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h); + + // Calc difference between iframe and container + dh = e.clientHeight - ifr.clientHeight; + + // Resize iframe and container + DOM.setStyle(ifr, 'height', h - dh); + DOM.setStyles(e, {width : w, height : h}); + }, + + destroy : function() { + var id = this.editor.id; + + Event.clear(id + '_resize'); + Event.clear(id + '_path_row'); + Event.clear(id + '_external_close'); + }, + + // Internal functions + + _simpleLayout : function(s, tb, o, p) { + var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c; + + if (s.readonly) { + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + return ic; + } + + // Create toolbar container at top + if (lo == 'top') + t._addToolbars(tb, o); + + // Create external toolbar + if (lo == 'external') { + n = c = DOM.create('div', {style : 'position:relative'}); + n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'}); + DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'}); + n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0}); + etb = DOM.add(n, 'tbody'); + + if (p.firstChild.className == 'mceOldBoxModel') + p.firstChild.appendChild(c); + else + p.insertBefore(c, p.firstChild); + + t._addToolbars(etb, o); + + ed.onMouseUp.add(function() { + var e = DOM.get(ed.id + '_external'); + DOM.show(e); + + DOM.hide(lastExtID); + + var f = Event.add(ed.id + '_external_close', 'click', function() { + DOM.hide(ed.id + '_external'); + Event.remove(ed.id + '_external_close', 'click', f); + }); + + DOM.show(e); + DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1); + + // Fixes IE rendering bug + DOM.hide(e); + DOM.show(e); + e.style.filter = ''; + + lastExtID = ed.id + '_external'; + + e = null; + }); + } + + if (sl == 'top') + t._addStatusBar(tb, o); + + // Create iframe container + if (!s.theme_advanced_toolbar_container) { + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + } + + // Create toolbar container at bottom + if (lo == 'bottom') + t._addToolbars(tb, o); + + if (sl == 'bottom') + t._addStatusBar(tb, o); + + return ic; + }, + + _rowLayout : function(s, tb, o) { + var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a; + + dc = s.theme_advanced_containers_default_class || ''; + da = s.theme_advanced_containers_default_align || 'center'; + + each(explode(s.theme_advanced_containers || ''), function(c, i) { + var v = s['theme_advanced_container_' + c] || ''; + + switch (v.toLowerCase()) { + case 'mceeditor': + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + break; + + case 'mceelementpath': + t._addStatusBar(tb, o); + break; + + default: + a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(tb, 'tr'), 'td', { + 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da + }); + + to = cf.createToolbar("toolbar" + i); + t._addControls(v, to); + DOM.setHTML(n, to.renderHTML()); + o.deltaHeight -= s.theme_advanced_row_height; + } + }); + + return ic; + }, + + _addControls : function(v, tb) { + var t = this, s = t.settings, di, cf = t.editor.controlManager; + + if (s.theme_advanced_disable && !t._disabled) { + di = {}; + + each(explode(s.theme_advanced_disable), function(v) { + di[v] = 1; + }); + + t._disabled = di; + } else + di = t._disabled; + + each(explode(v), function(n) { + var c; + + if (di && di[n]) + return; + + // Compatiblity with 2.x + if (n == 'tablecontrols') { + each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) { + n = t.createControl(n, cf); + + if (n) + tb.add(n); + }); + + return; + } + + c = t.createControl(n, cf); + + if (c) + tb.add(c); + }); + }, + + _addToolbars : function(c, o) { + var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a; + + a = s.theme_advanced_toolbar_align.toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a}); + + if (!ed.getParam('accessibility_focus')) + h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->')); + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->')); + + // Create toolbar and add the controls + for (i=1; (v = s['theme_advanced_buttons' + i]); i++) { + tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); + + if (s['theme_advanced_buttons' + i + '_add']) + v += ',' + s['theme_advanced_buttons' + i + '_add']; + + if (s['theme_advanced_buttons' + i + '_add_before']) + v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v; + + t._addControls(v, tb); + + //n.appendChild(n = tb.render()); + h.push(tb.renderHTML()); + + o.deltaHeight -= s.theme_advanced_row_height; + } + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->')); + DOM.setHTML(n, h.join('')); + }, + + _addStatusBar : function(tb, o) { + var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td; + + n = DOM.add(tb, 'tr'); + n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); + n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : ' '); + DOM.add(n, 'a', {href : '#', accesskey : 'x'}); + + if (s.theme_advanced_resizing) { + DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'}); + + if (s.theme_advanced_resizing_use_cookie) { + ed.onPostRender.add(function() { + var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); + + if (!o) + return; + + if (s.theme_advanced_resize_horizontal) + c.style.width = Math.max(10, o.cw) + 'px'; + + c.style.height = Math.max(10, o.ch) + 'px'; + DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px'; + }); + } + + ed.onPostRender.add(function() { + Event.add(ed.id + '_resize', 'mousedown', function(e) { + var c, p, w, h, n, pa; + + // Measure container + c = DOM.get(ed.id + '_tbl'); + w = c.clientWidth; + h = c.clientHeight; + + miw = s.theme_advanced_resizing_min_width || 100; + mih = s.theme_advanced_resizing_min_height || 100; + maw = s.theme_advanced_resizing_max_width || 0xFFFF; + mah = s.theme_advanced_resizing_max_height || 0xFFFF; + + // Setup placeholder + p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'}); + DOM.setStyles(p, {width : w, height : h}); + + // Replace with placeholder + DOM.hide(c); + DOM.show(p); + + // Create internal resize obj + r = { + x : e.screenX, + y : e.screenY, + w : w, + h : h, + dx : null, + dy : null + }; + + // Start listening + mf = Event.add(DOM.doc, 'mousemove', function(e) { + var w, h; + + // Calc delta values + r.dx = e.screenX - r.x; + r.dy = e.screenY - r.y; + + // Boundery fix box + w = Math.max(miw, r.w + r.dx); + h = Math.max(mih, r.h + r.dy); + w = Math.min(maw, w); + h = Math.min(mah, h); + + // Resize placeholder + if (s.theme_advanced_resize_horizontal) + p.style.width = w + 'px'; + + p.style.height = h + 'px'; + + return Event.cancel(e); + }); + + me = Event.add(DOM.doc, 'mouseup', function(e) { + var ifr; + + // Stop listening + Event.remove(DOM.doc, 'mousemove', mf); + Event.remove(DOM.doc, 'mouseup', me); + + c.style.display = ''; + DOM.remove(p); + + if (r.dx === null) + return; + + ifr = DOM.get(ed.id + '_ifr'); + + if (s.theme_advanced_resize_horizontal) + c.style.width = Math.max(10, r.w + r.dx) + 'px'; + + c.style.height = Math.max(10, r.h + r.dy) + 'px'; + ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px'; + + if (s.theme_advanced_resizing_use_cookie) { + Cookie.setHash("TinyMCE_" + ed.id + "_size", { + cw : r.w + r.dx, + ch : r.h + r.dy + }); + } + }); + + return Event.cancel(e); + }); + }); + } + + o.deltaHeight -= 21; + n = tb = null; + }, + + _nodeChanged : function(ed, cm, n, co) { + var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn; + + if (s.readonly) + return; + + tinymce.each(t.stateControls, function(c) { + cm.setActive(c, ed.queryCommandState(t.controls[c][1])); + }); + + cm.setActive('visualaid', ed.hasVisual); + cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); + cm.setDisabled('redo', !ed.undoManager.hasRedo()); + cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); + + p = DOM.getParent(n, 'A'); + if (c = cm.get('link')) { + if (!p || !p.name) { + c.setDisabled(!p && co); + c.setActive(!!p); + } + } + + if (c = cm.get('unlink')) { + c.setDisabled(!p && co); + c.setActive(!!p && !p.name); + } + + if (c = cm.get('anchor')) { + c.setActive(!!p && p.name); + + if (tinymce.isWebKit) { + p = DOM.getParent(n, 'IMG'); + c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a'); + } + } + + p = DOM.getParent(n, 'IMG'); + if (c = cm.get('image')) + c.setActive(!!p && n.className.indexOf('mceItem') == -1); + + if (c = cm.get('styleselect')) { + if (n.className) { + t._importClasses(); + c.select(n.className); + } else + c.select(); + } + + if (c = cm.get('formatselect')) { + p = DOM.getParent(n, DOM.isBlock); + + if (p) + c.select(p.nodeName.toLowerCase()); + } + + if (ed.settings.convert_fonts_to_spans) { + ed.dom.getParent(n, function(n) { + if (n.nodeName === 'SPAN') { + if (!cl && n.className) + cl = n.className; + + if (!fz && n.style.fontSize) + fz = n.style.fontSize; + + if (!fn && n.style.fontFamily) + fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase(); + } + + return false; + }); + + if (c = cm.get('fontselect')) { + c.select(function(v) { + return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn; + }); + } + + if (c = cm.get('fontsizeselect')) { + c.select(function(v) { + if (v.fontSize && v.fontSize === fz) + return true; + + if (v['class'] && v['class'] === cl) + return true; + }); + } + } else { + if (c = cm.get('fontselect')) + c.select(ed.queryCommandValue('FontName')); + + if (c = cm.get('fontsizeselect')) { + v = ed.queryCommandValue('FontSize'); + c.select(function(iv) { + return iv.fontSize == v; + }); + } + } + + if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { + p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); + DOM.setHTML(p, ''); + + ed.dom.getParent(n, function(n) { + var na = n.nodeName.toLowerCase(), u, pi, ti = ''; + + // Ignore non element and hidden elements + if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) + return; + + // Fake name + if (v = DOM.getAttrib(n, 'mce_name')) + na = v; + + // Handle prefix + if (tinymce.isIE && n.scopeName !== 'HTML') + na = n.scopeName + ':' + na; + + // Remove internal prefix + na = na.replace(/mce\:/g, ''); + + // Handle node name + switch (na) { + case 'b': + na = 'strong'; + break; + + case 'i': + na = 'em'; + break; + + case 'img': + if (v = DOM.getAttrib(n, 'src')) + ti += 'src: ' + v + ' '; + + break; + + case 'a': + if (v = DOM.getAttrib(n, 'name')) { + ti += 'name: ' + v + ' '; + na += '#' + v; + } + + if (v = DOM.getAttrib(n, 'href')) + ti += 'href: ' + v + ' '; + + break; + + case 'font': + if (s.convert_fonts_to_spans) + na = 'span'; + + if (v = DOM.getAttrib(n, 'face')) + ti += 'font: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'size')) + ti += 'size: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'color')) + ti += 'color: ' + v + ' '; + + break; + + case 'span': + if (v = DOM.getAttrib(n, 'style')) + ti += 'style: ' + v + ' '; + + break; + } + + if (v = DOM.getAttrib(n, 'id')) + ti += 'id: ' + v + ' '; + + if (v = n.className) { + v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, ''); + + if (v && v.indexOf('mceItem') == -1) { + ti += 'class: ' + v + ' '; + + if (DOM.isBlock(n) || na == 'img' || na == 'span') + na += '.' + v; + } + } + + na = na.replace(/(html:)/g, ''); + na = {name : na, node : n, title : ti}; + t.onResolveName.dispatch(t, na); + ti = na.title; + na = na.name; + + //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');"; + pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na); + + if (p.hasChildNodes()) { + p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild); + p.insertBefore(pi, p.firstChild); + } else + p.appendChild(pi); + }, ed.getBody()); + } + }, + + // Commands gets called by execCommand + + _sel : function(v) { + this.editor.execCommand('mceSelectNodeDepth', false, v); + }, + + _mceInsertAnchor : function(ui, v) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/anchor.htm', + width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)), + height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceCharMap : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/charmap.htm', + width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceHelp : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/about.htm', + width : 480, + height : 380, + inline : true + }, { + theme_url : this.url + }); + }, + + _mceColorPicker : function(u, v) { + var ed = this.editor; + + v = v || {}; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/color_picker.htm', + width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)), + close_previous : false, + inline : true + }, { + input_color : v.color, + func : v.func, + theme_url : this.url + }); + }, + + _mceCodeEditor : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/source_editor.htm', + width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)), + height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)), + inline : true, + resizable : true, + maximizable : true + }, { + theme_url : this.url + }); + }, + + _mceImage : function(ui, val) { + var ed = this.editor; + + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/image.htm', + width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)), + height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceLink : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/link.htm', + width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)), + height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceNewDocument : function() { + var ed = this.editor; + + ed.windowManager.confirm('advanced.newdocument', function(s) { + if (s) + ed.execCommand('mceSetContent', false, ''); + }); + }, + + _mceForeColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.fgColor, + func : function(co) { + t.fgColor = co; + t.editor.execCommand('ForeColor', false, co); + } + }); + }, + + _mceBackColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.bgColor, + func : function(co) { + t.bgColor = co; + t.editor.execCommand('HiliteColor', false, co); + } + }); + }, + + _ufirst : function(s) { + return s.substring(0, 1).toUpperCase() + s.substring(1); + } + }); + + tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme); +}(tinymce)); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/image.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/image.htm new file mode 100644 index 0000000000000000000000000000000000000000..7ec1052ba54a6813ce9ddb4820037bca3fb10680 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/image.htm @@ -0,0 +1,85 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.image_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="js/image.js"></script> +</head> +<body id="image" style="display: none"> +<form onsubmit="ImageDialog.update();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.image_title}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td> + <td><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td> + <td id="srcbrowsercontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td><label for="image_list">{#advanced_dlg.image_list}</label></td> + <td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td> + </tr> + <tr> + <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td> + <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td> + </tr> + <tr> + <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td> + <td><select id="align" name="align" onchange="ImageDialog.updateStyle();"> + <option value="">{#not_set}</option> + <option value="baseline">{#advanced_dlg.image_align_baseline}</option> + <option value="top">{#advanced_dlg.image_align_top}</option> + <option value="middle">{#advanced_dlg.image_align_middle}</option> + <option value="bottom">{#advanced_dlg.image_align_bottom}</option> + <option value="text-top">{#advanced_dlg.image_align_texttop}</option> + <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option> + <option value="left">{#advanced_dlg.image_align_left}</option> + <option value="right">{#advanced_dlg.image_align_right}</option> + </select></td> + </tr> + <tr> + <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td> + <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" /> + x + <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td> + </tr> + <tr> + <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td> + <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> + </tr> + <tr> + <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td> + <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> + </tr> + <tr> + <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td> + <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> + </tr> + </table> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/img/colorpicker.jpg b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/img/colorpicker.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b4c542d107b25f68a9d4f9d7a109d0565d1f1437 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/img/colorpicker.jpg differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/img/icons.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/img/icons.gif new file mode 100644 index 0000000000000000000000000000000000000000..ccac36f54d983cc33a0a6e45134e3dabf1820367 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/img/icons.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/about.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/about.js new file mode 100644 index 0000000000000000000000000000000000000000..5cee9ed863cdb6ffaf6cc44979375c1beb9cd920 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/about.js @@ -0,0 +1,72 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + var ed, tcont; + + tinyMCEPopup.resizeToInnerSize(); + ed = tinyMCEPopup.editor; + + // Give FF some time + window.setTimeout(insertHelpIFrame, 10); + + tcont = document.getElementById('plugintablecontainer'); + document.getElementById('plugins_tab').style.display = 'none'; + + var html = ""; + html += '<table id="plugintable">'; + html += '<thead>'; + html += '<tr>'; + html += '<td>' + ed.getLang('advanced_dlg.about_plugin') + '</td>'; + html += '<td>' + ed.getLang('advanced_dlg.about_author') + '</td>'; + html += '<td>' + ed.getLang('advanced_dlg.about_version') + '</td>'; + html += '</tr>'; + html += '</thead>'; + html += '<tbody>'; + + tinymce.each(ed.plugins, function(p, n) { + var info; + + if (!p.getInfo) + return; + + html += '<tr>'; + + info = p.getInfo(); + + if (info.infourl != null && info.infourl != '') + html += '<td width="50%" title="' + n + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>'; + else + html += '<td width="50%" title="' + n + '">' + info.longname + '</td>'; + + if (info.authorurl != null && info.authorurl != '') + html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>'; + else + html += '<td width="35%">' + info.author + '</td>'; + + html += '<td width="15%">' + info.version + '</td>'; + html += '</tr>'; + + document.getElementById('plugins_tab').style.display = ''; + + }); + + html += '</tbody>'; + html += '</table>'; + + tcont.innerHTML = html; + + tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; + tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate; +} + +function insertHelpIFrame() { + var html; + + if (tinyMCEPopup.getParam('docs_url')) { + html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>'; + document.getElementById('iframecontainer').innerHTML = html; + document.getElementById('help_tab').style.display = 'block'; + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/anchor.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/anchor.js new file mode 100644 index 0000000000000000000000000000000000000000..b5efd1ec9736d60bdd261cdde9987f15e4d095c2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/anchor.js @@ -0,0 +1,37 @@ +tinyMCEPopup.requireLangPack(); + +var AnchorDialog = { + init : function(ed) { + var action, elm, f = document.forms[0]; + + this.editor = ed; + elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG'); + v = ed.dom.getAttrib(elm, 'name'); + + if (v) { + this.action = 'update'; + f.anchorName.value = v; + } + + f.insert.value = ed.getLang(elm ? 'update' : 'insert'); + }, + + update : function() { + var ed = this.editor; + + tinyMCEPopup.restoreSelection(); + + if (this.action != 'update') + ed.selection.collapse(1); + + // Webkit acts weird if empty inline element is inserted so we need to use a image instead + if (tinymce.isWebKit) + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'})); + else + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, '')); + + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/charmap.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/charmap.js new file mode 100644 index 0000000000000000000000000000000000000000..8467ef60366b6fcdc3f9d6471ef88337eaa49ed0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/charmap.js @@ -0,0 +1,325 @@ +tinyMCEPopup.requireLangPack(); + +var charmap = [ + [' ', ' ', true, 'no-break space'], + ['&', '&', true, 'ampersand'], + ['"', '"', true, 'quotation mark'], +// finance + ['¢', '¢', true, 'cent sign'], + ['€', '€', true, 'euro sign'], + ['£', '£', true, 'pound sign'], + ['¥', '¥', true, 'yen sign'], +// signs + ['©', '©', true, 'copyright sign'], + ['®', '®', true, 'registered sign'], + ['™', '™', true, 'trade mark sign'], + ['‰', '‰', true, 'per mille sign'], + ['µ', 'µ', true, 'micro sign'], + ['·', '·', true, 'middle dot'], + ['•', '•', true, 'bullet'], + ['…', '…', true, 'three dot leader'], + ['′', '′', true, 'minutes / feet'], + ['″', '″', true, 'seconds / inches'], + ['§', '§', true, 'section sign'], + ['¶', '¶', true, 'paragraph sign'], + ['ß', 'ß', true, 'sharp s / ess-zed'], +// quotations + ['‹', '‹', true, 'single left-pointing angle quotation mark'], + ['›', '›', true, 'single right-pointing angle quotation mark'], + ['«', '«', true, 'left pointing guillemet'], + ['»', '»', true, 'right pointing guillemet'], + ['‘', '‘', true, 'left single quotation mark'], + ['’', '’', true, 'right single quotation mark'], + ['“', '“', true, 'left double quotation mark'], + ['”', '”', true, 'right double quotation mark'], + ['‚', '‚', true, 'single low-9 quotation mark'], + ['„', '„', true, 'double low-9 quotation mark'], + ['<', '<', true, 'less-than sign'], + ['>', '>', true, 'greater-than sign'], + ['≤', '≤', true, 'less-than or equal to'], + ['≥', '≥', true, 'greater-than or equal to'], + ['–', '–', true, 'en dash'], + ['—', '—', true, 'em dash'], + ['¯', '¯', true, 'macron'], + ['‾', '‾', true, 'overline'], + ['¤', '¤', true, 'currency sign'], + ['¦', '¦', true, 'broken bar'], + ['¨', '¨', true, 'diaeresis'], + ['¡', '¡', true, 'inverted exclamation mark'], + ['¿', '¿', true, 'turned question mark'], + ['ˆ', 'ˆ', true, 'circumflex accent'], + ['˜', '˜', true, 'small tilde'], + ['°', '°', true, 'degree sign'], + ['−', '−', true, 'minus sign'], + ['±', '±', true, 'plus-minus sign'], + ['÷', '÷', true, 'division sign'], + ['⁄', '⁄', true, 'fraction slash'], + ['×', '×', true, 'multiplication sign'], + ['¹', '¹', true, 'superscript one'], + ['²', '²', true, 'superscript two'], + ['³', '³', true, 'superscript three'], + ['¼', '¼', true, 'fraction one quarter'], + ['½', '½', true, 'fraction one half'], + ['¾', '¾', true, 'fraction three quarters'], +// math / logical + ['ƒ', 'ƒ', true, 'function / florin'], + ['∫', '∫', true, 'integral'], + ['∑', '∑', true, 'n-ary sumation'], + ['∞', '∞', true, 'infinity'], + ['√', '√', true, 'square root'], + ['∼', '∼', false,'similar to'], + ['≅', '≅', false,'approximately equal to'], + ['≈', '≈', true, 'almost equal to'], + ['≠', '≠', true, 'not equal to'], + ['≡', '≡', true, 'identical to'], + ['∈', '∈', false,'element of'], + ['∉', '∉', false,'not an element of'], + ['∋', '∋', false,'contains as member'], + ['∏', '∏', true, 'n-ary product'], + ['∧', '∧', false,'logical and'], + ['∨', '∨', false,'logical or'], + ['¬', '¬', true, 'not sign'], + ['∩', '∩', true, 'intersection'], + ['∪', '∪', false,'union'], + ['∂', '∂', true, 'partial differential'], + ['∀', '∀', false,'for all'], + ['∃', '∃', false,'there exists'], + ['∅', '∅', false,'diameter'], + ['∇', '∇', false,'backward difference'], + ['∗', '∗', false,'asterisk operator'], + ['∝', '∝', false,'proportional to'], + ['∠', '∠', false,'angle'], +// undefined + ['´', '´', true, 'acute accent'], + ['¸', '¸', true, 'cedilla'], + ['ª', 'ª', true, 'feminine ordinal indicator'], + ['º', 'º', true, 'masculine ordinal indicator'], + ['†', '†', true, 'dagger'], + ['‡', '‡', true, 'double dagger'], +// alphabetical special chars + ['À', 'À', true, 'A - grave'], + ['Á', 'Á', true, 'A - acute'], + ['Â', 'Â', true, 'A - circumflex'], + ['Ã', 'Ã', true, 'A - tilde'], + ['Ä', 'Ä', true, 'A - diaeresis'], + ['Å', 'Å', true, 'A - ring above'], + ['Æ', 'Æ', true, 'ligature AE'], + ['Ç', 'Ç', true, 'C - cedilla'], + ['È', 'È', true, 'E - grave'], + ['É', 'É', true, 'E - acute'], + ['Ê', 'Ê', true, 'E - circumflex'], + ['Ë', 'Ë', true, 'E - diaeresis'], + ['Ì', 'Ì', true, 'I - grave'], + ['Í', 'Í', true, 'I - acute'], + ['Î', 'Î', true, 'I - circumflex'], + ['Ï', 'Ï', true, 'I - diaeresis'], + ['Ð', 'Ð', true, 'ETH'], + ['Ñ', 'Ñ', true, 'N - tilde'], + ['Ò', 'Ò', true, 'O - grave'], + ['Ó', 'Ó', true, 'O - acute'], + ['Ô', 'Ô', true, 'O - circumflex'], + ['Õ', 'Õ', true, 'O - tilde'], + ['Ö', 'Ö', true, 'O - diaeresis'], + ['Ø', 'Ø', true, 'O - slash'], + ['Œ', 'Œ', true, 'ligature OE'], + ['Š', 'Š', true, 'S - caron'], + ['Ù', 'Ù', true, 'U - grave'], + ['Ú', 'Ú', true, 'U - acute'], + ['Û', 'Û', true, 'U - circumflex'], + ['Ü', 'Ü', true, 'U - diaeresis'], + ['Ý', 'Ý', true, 'Y - acute'], + ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], + ['Þ', 'Þ', true, 'THORN'], + ['à', 'à', true, 'a - grave'], + ['á', 'á', true, 'a - acute'], + ['â', 'â', true, 'a - circumflex'], + ['ã', 'ã', true, 'a - tilde'], + ['ä', 'ä', true, 'a - diaeresis'], + ['å', 'å', true, 'a - ring above'], + ['æ', 'æ', true, 'ligature ae'], + ['ç', 'ç', true, 'c - cedilla'], + ['è', 'è', true, 'e - grave'], + ['é', 'é', true, 'e - acute'], + ['ê', 'ê', true, 'e - circumflex'], + ['ë', 'ë', true, 'e - diaeresis'], + ['ì', 'ì', true, 'i - grave'], + ['í', 'í', true, 'i - acute'], + ['î', 'î', true, 'i - circumflex'], + ['ï', 'ï', true, 'i - diaeresis'], + ['ð', 'ð', true, 'eth'], + ['ñ', 'ñ', true, 'n - tilde'], + ['ò', 'ò', true, 'o - grave'], + ['ó', 'ó', true, 'o - acute'], + ['ô', 'ô', true, 'o - circumflex'], + ['õ', 'õ', true, 'o - tilde'], + ['ö', 'ö', true, 'o - diaeresis'], + ['ø', 'ø', true, 'o slash'], + ['œ', 'œ', true, 'ligature oe'], + ['š', 'š', true, 's - caron'], + ['ù', 'ù', true, 'u - grave'], + ['ú', 'ú', true, 'u - acute'], + ['û', 'û', true, 'u - circumflex'], + ['ü', 'ü', true, 'u - diaeresis'], + ['ý', 'ý', true, 'y - acute'], + ['þ', 'þ', true, 'thorn'], + ['ÿ', 'ÿ', true, 'y - diaeresis'], + ['Α', 'Α', true, 'Alpha'], + ['Β', 'Β', true, 'Beta'], + ['Γ', 'Γ', true, 'Gamma'], + ['Δ', 'Δ', true, 'Delta'], + ['Ε', 'Ε', true, 'Epsilon'], + ['Ζ', 'Ζ', true, 'Zeta'], + ['Η', 'Η', true, 'Eta'], + ['Θ', 'Θ', true, 'Theta'], + ['Ι', 'Ι', true, 'Iota'], + ['Κ', 'Κ', true, 'Kappa'], + ['Λ', 'Λ', true, 'Lambda'], + ['Μ', 'Μ', true, 'Mu'], + ['Ν', 'Ν', true, 'Nu'], + ['Ξ', 'Ξ', true, 'Xi'], + ['Ο', 'Ο', true, 'Omicron'], + ['Π', 'Π', true, 'Pi'], + ['Ρ', 'Ρ', true, 'Rho'], + ['Σ', 'Σ', true, 'Sigma'], + ['Τ', 'Τ', true, 'Tau'], + ['Υ', 'Υ', true, 'Upsilon'], + ['Φ', 'Φ', true, 'Phi'], + ['Χ', 'Χ', true, 'Chi'], + ['Ψ', 'Ψ', true, 'Psi'], + ['Ω', 'Ω', true, 'Omega'], + ['α', 'α', true, 'alpha'], + ['β', 'β', true, 'beta'], + ['γ', 'γ', true, 'gamma'], + ['δ', 'δ', true, 'delta'], + ['ε', 'ε', true, 'epsilon'], + ['ζ', 'ζ', true, 'zeta'], + ['η', 'η', true, 'eta'], + ['θ', 'θ', true, 'theta'], + ['ι', 'ι', true, 'iota'], + ['κ', 'κ', true, 'kappa'], + ['λ', 'λ', true, 'lambda'], + ['μ', 'μ', true, 'mu'], + ['ν', 'ν', true, 'nu'], + ['ξ', 'ξ', true, 'xi'], + ['ο', 'ο', true, 'omicron'], + ['π', 'π', true, 'pi'], + ['ρ', 'ρ', true, 'rho'], + ['ς', 'ς', true, 'final sigma'], + ['σ', 'σ', true, 'sigma'], + ['τ', 'τ', true, 'tau'], + ['υ', 'υ', true, 'upsilon'], + ['φ', 'φ', true, 'phi'], + ['χ', 'χ', true, 'chi'], + ['ψ', 'ψ', true, 'psi'], + ['ω', 'ω', true, 'omega'], +// symbols + ['ℵ', 'ℵ', false,'alef symbol'], + ['ϖ', 'ϖ', false,'pi symbol'], + ['ℜ', 'ℜ', false,'real part symbol'], + ['ϑ','ϑ', false,'theta symbol'], + ['ϒ', 'ϒ', false,'upsilon - hook symbol'], + ['℘', '℘', false,'Weierstrass p'], + ['ℑ', 'ℑ', false,'imaginary part'], +// arrows + ['←', '←', true, 'leftwards arrow'], + ['↑', '↑', true, 'upwards arrow'], + ['→', '→', true, 'rightwards arrow'], + ['↓', '↓', true, 'downwards arrow'], + ['↔', '↔', true, 'left right arrow'], + ['↵', '↵', false,'carriage return'], + ['⇐', '⇐', false,'leftwards double arrow'], + ['⇑', '⇑', false,'upwards double arrow'], + ['⇒', '⇒', false,'rightwards double arrow'], + ['⇓', '⇓', false,'downwards double arrow'], + ['⇔', '⇔', false,'left right double arrow'], + ['∴', '∴', false,'therefore'], + ['⊂', '⊂', false,'subset of'], + ['⊃', '⊃', false,'superset of'], + ['⊄', '⊄', false,'not a subset of'], + ['⊆', '⊆', false,'subset of or equal to'], + ['⊇', '⊇', false,'superset of or equal to'], + ['⊕', '⊕', false,'circled plus'], + ['⊗', '⊗', false,'circled times'], + ['⊥', '⊥', false,'perpendicular'], + ['⋅', '⋅', false,'dot operator'], + ['⌈', '⌈', false,'left ceiling'], + ['⌉', '⌉', false,'right ceiling'], + ['⌊', '⌊', false,'left floor'], + ['⌋', '⌋', false,'right floor'], + ['⟨', '〈', false,'left-pointing angle bracket'], + ['⟩', '〉', false,'right-pointing angle bracket'], + ['◊', '◊', true,'lozenge'], + ['♠', '♠', false,'black spade suit'], + ['♣', '♣', true, 'black club suit'], + ['♥', '♥', true, 'black heart suit'], + ['♦', '♦', true, 'black diamond suit'], + [' ', ' ', false,'en space'], + [' ', ' ', false,'em space'], + [' ', ' ', false,'thin space'], + ['‌', '‌', false,'zero width non-joiner'], + ['‍', '‍', false,'zero width joiner'], + ['‎', '‎', false,'left-to-right mark'], + ['‏', '‏', false,'right-to-left mark'], + ['­', '­', false,'soft hyphen'] +]; + +tinyMCEPopup.onInit.add(function() { + tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML()); +}); + +function renderCharMapHTML() { + var charsPerRow = 20, tdWidth=20, tdHeight=20, i; + var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">'; + var cols=-1; + + for (i=0; i<charmap.length; i++) { + if (charmap[i][2]==true) { + cols++; + html += '' + + '<td class="charmap">' + + '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">' + + charmap[i][1] + + '</a></td>'; + if ((cols+1) % charsPerRow == 0) + html += '</tr><tr height="' + tdHeight + '">'; + } + } + + if (cols % charsPerRow > 0) { + var padd = charsPerRow - (cols % charsPerRow); + for (var i=0; i<padd-1; i++) + html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"> </td>'; + } + + html += '</tr></table>'; + + return html; +} + +function insertChar(chr) { + tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';'); + + // Refocus in window + if (tinyMCEPopup.isWindow) + window.focus(); + + tinyMCEPopup.editor.focus(); + tinyMCEPopup.close(); +} + +function previewChar(codeA, codeB, codeN) { + var elmA = document.getElementById('codeA'); + var elmB = document.getElementById('codeB'); + var elmV = document.getElementById('codeV'); + var elmN = document.getElementById('codeN'); + + if (codeA=='#160;') { + elmV.innerHTML = '__'; + } else { + elmV.innerHTML = '&' + codeA; + } + + elmB.innerHTML = '&' + codeA; + elmA.innerHTML = '&' + codeB; + elmN.innerHTML = codeN; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/color_picker.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/color_picker.js new file mode 100644 index 0000000000000000000000000000000000000000..fd9700f2224320b9ab6a252c19e6c54fa018fee6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/color_picker.js @@ -0,0 +1,253 @@ +tinyMCEPopup.requireLangPack(); + +var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; + +var colors = [ + "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", + "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", + "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", + "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", + "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", + "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", + "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", + "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", + "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", + "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", + "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", + "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", + "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", + "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", + "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", + "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", + "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", + "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", + "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", + "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", + "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", + "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", + "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", + "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", + "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", + "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", + "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" +]; + +var named = { + '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', + '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', + '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', + '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', + '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', + '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', + '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', + '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', + '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', + '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', + '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', + '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', + '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', + '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', + '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', + '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', + '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', + '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', + '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', + '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', + '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', + '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', + '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' +}; + +function init() { + var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')); + + tinyMCEPopup.resizeToInnerSize(); + + generatePicker(); + + if (inputColor) { + changeFinalColor(inputColor); + + col = convertHexToRGB(inputColor); + + if (col) + updateLight(col.r, col.g, col.b); + } +} + +function insertAction() { + var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); + + tinyMCEPopup.restoreSelection(); + + if (f) + f(color); + + tinyMCEPopup.close(); +} + +function showColor(color, name) { + if (name) + document.getElementById("colorname").innerHTML = name; + + document.getElementById("preview").style.backgroundColor = color; + document.getElementById("color").value = color.toLowerCase(); +} + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + if (!col) + return col; + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return {r : r, g : g, b : b}; + } + + return null; +} + +function generatePicker() { + var el = document.getElementById('light'), h = '', i; + + for (i = 0; i < detail; i++){ + h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"' + + ' onclick="changeFinalColor(this.style.backgroundColor)"' + + ' onmousedown="isMouseDown = true; return false;"' + + ' onmouseup="isMouseDown = false;"' + + ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"' + + ' onmouseover="isMouseOver = true;"' + + ' onmouseout="isMouseOver = false;"' + + '></div>'; + } + + el.innerHTML = h; +} + +function generateWebColors() { + var el = document.getElementById('webcolors'), h = '', i; + + if (el.className == 'generated') + return; + + h += '<table border="0" cellspacing="1" cellpadding="0">' + + '<tr>'; + + for (i=0; i<colors.length; i++) { + h += '<td bgcolor="' + colors[i] + '" width="10" height="10">' + + '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">' + + '</a></td>'; + if ((i+1) % 18 == 0) + h += '</tr><tr>'; + } + + h += '</table>'; + + el.innerHTML = h; + el.className = 'generated'; +} + +function generateNamedColors() { + var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; + + if (el.className == 'generated') + return; + + for (n in named) { + v = named[n]; + h += '<a href="javascript:insertAction();" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>' + } + + el.innerHTML = h; + el.className = 'generated'; +} + +function dechex(n) { + return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); +} + +function computeColor(e) { + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + + partWidth = document.getElementById('colors').width / 6; + partDetail = detail / 2; + imHeight = document.getElementById('colors').height; + + r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; + g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); + b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); + + coef = (imHeight - y) / imHeight; + r = 128 + (r - 128) * coef; + g = 128 + (g - 128) * coef; + b = 128 + (b - 128) * coef; + + changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); + updateLight(r, g, b); +} + +function updateLight(r, g, b) { + var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; + + for (i=0; i<detail; i++) { + if ((i>=0) && (i<partDetail)) { + finalCoef = i / partDetail; + finalR = dechex(255 - (255 - r) * finalCoef); + finalG = dechex(255 - (255 - g) * finalCoef); + finalB = dechex(255 - (255 - b) * finalCoef); + } else { + finalCoef = 2 - i / partDetail; + finalR = dechex(r * finalCoef); + finalG = dechex(g * finalCoef); + finalB = dechex(b * finalCoef); + } + + color = finalR + finalG + finalB; + + setCol('gs' + i, '#'+color); + } +} + +function changeFinalColor(color) { + if (color.indexOf('#') == -1) + color = convertRGBToHex(color); + + setCol('preview', color); + document.getElementById('color').value = color; +} + +function setCol(e, c) { + try { + document.getElementById(e).style.backgroundColor = c; + } catch (ex) { + // Ignore IE warning + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/image.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/image.js new file mode 100644 index 0000000000000000000000000000000000000000..4982ce0c8e04ddff0f65885ffcf77b109797870b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/image.js @@ -0,0 +1,245 @@ +var ImageDialog = { + preInit : function() { + var url; + + tinyMCEPopup.requireLangPack(); + + if (url = tinyMCEPopup.getParam("external_image_list_url")) + document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '180px'; + + e = ed.selection.getNode(); + + this.fillFileList('image_list', 'tinyMCEImageList'); + + if (e.nodeName == 'IMG') { + f.src.value = ed.dom.getAttrib(e, 'src'); + f.alt.value = ed.dom.getAttrib(e, 'alt'); + f.border.value = this.getAttrib(e, 'border'); + f.vspace.value = this.getAttrib(e, 'vspace'); + f.hspace.value = this.getAttrib(e, 'hspace'); + f.width.value = ed.dom.getAttrib(e, 'width'); + f.height.value = ed.dom.getAttrib(e, 'height'); + f.insert.value = ed.getLang('update'); + this.styleVal = ed.dom.getAttrib(e, 'style'); + selectByValue(f, 'image_list', f.src.value); + selectByValue(f, 'align', this.getAttrib(e, 'align')); + this.updateStyle(); + } + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + update : function() { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (!ed.settings.inline_styles) { + args = tinymce.extend(args, { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }); + } else + args.style = this.styleVal; + + tinymce.extend(args, { + src : f.src.value, + alt : f.alt.value, + width : f.width.value, + height : f.height.value + }); + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + updateStyle : function() { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; + + if (tinyMCEPopup.editor.settings.inline_styles) { + st = tinyMCEPopup.dom.parseStyle(this.styleVal); + + // Handle align + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') { + st['float'] = v; + delete st['vertical-align']; + } else { + st['vertical-align'] = v; + delete st['float']; + } + } else { + delete st['float']; + delete st['vertical-align']; + } + + // Handle border + v = f.border.value; + if (v || v == '0') { + if (v == '0') + st['border'] = '0'; + else + st['border'] = v + 'px solid black'; + } else + delete st['border']; + + // Handle hspace + v = f.hspace.value; + if (v) { + delete st['margin']; + st['margin-left'] = v + 'px'; + st['margin-right'] = v + 'px'; + } else { + delete st['margin-left']; + delete st['margin-right']; + } + + // Handle vspace + v = f.vspace.value; + if (v) { + delete st['margin']; + st['margin-top'] = v + 'px'; + st['margin-bottom'] = v + 'px'; + } else { + delete st['margin-top']; + delete st['margin-bottom']; + } + + // Merge + st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st)); + this.styleVal = dom.serializeStyle(st); + } + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ""; + }, + + updateImageData : function() { + var f = document.forms[0], t = ImageDialog; + + if (f.width.value == "") + f.width.value = t.preloadImg.width; + + if (f.height.value == "") + f.height.value = t.preloadImg.height; + }, + + getImageData : function() { + var f = document.forms[0]; + + this.preloadImg = new Image(); + this.preloadImg.onload = this.updateImageData; + this.preloadImg.onerror = this.resetImageData; + this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/link.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/link.js new file mode 100644 index 0000000000000000000000000000000000000000..21aae6cbf88d18f497fe093e95422656365d7a15 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/link.js @@ -0,0 +1,156 @@ +tinyMCEPopup.requireLangPack(); + +var LinkDialog = { + preInit : function() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link'); + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '180px'; + + this.fillClassList('class_list'); + this.fillFileList('link_list', 'tinyMCELinkList'); + this.fillTargetList('target_list'); + + if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) { + f.href.value = ed.dom.getAttrib(e, 'href'); + f.linktitle.value = ed.dom.getAttrib(e, 'title'); + f.insert.value = ed.getLang('update'); + selectByValue(f, 'link_list', f.href.value); + selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target')); + selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); + } + }, + + update : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor, e, b; + + tinyMCEPopup.restoreSelection(); + e = ed.dom.getParent(ed.selection.getNode(), 'A'); + + // Remove element if there is no href + if (!f.href.value) { + if (e) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + b = ed.selection.getBookmark(); + ed.dom.remove(e, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (e == null) { + ed.getDoc().execCommand("unlink", false, null); + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + e = n; + + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + }); + } else { + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + + // Don't move caret if selection was image + if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') { + ed.focus(); + ed.selection.select(e); + ed.selection.collapse(0); + tinyMCEPopup.storeSelection(); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + }, + + checkPrefix : function(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) + n.value = 'http://' + n.value; + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillTargetList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v; + + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); + + if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { + tinymce.each(v.split(','), function(v) { + v = v.split('='); + lst.options[lst.options.length] = new Option(v[0], v[1]); + }); + } + } +}; + +LinkDialog.preInit(); +tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/source_editor.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/source_editor.js new file mode 100644 index 0000000000000000000000000000000000000000..279328614c5ee8a0077295a0ff7814a24d723922 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/js/source_editor.js @@ -0,0 +1,62 @@ +tinyMCEPopup.requireLangPack(); +tinyMCEPopup.onInit.add(onLoadInit); + +function saveContent() { + tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true}); + tinyMCEPopup.close(); +} + +function onLoadInit() { + tinyMCEPopup.resizeToInnerSize(); + + // Remove Gecko spellchecking + if (tinymce.isGecko) + document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); + + document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true}); + + if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { + setWrap('soft'); + document.getElementById('wraped').checked = true; + } + + resizeInputs(); +} + +function setWrap(val) { + var v, n, s = document.getElementById('htmlSource'); + + s.wrap = val; + + if (!tinymce.isIE) { + v = s.value; + n = s.cloneNode(false); + n.setAttribute("wrap", val); + s.parentNode.replaceChild(n, s); + n.value = v; + } +} + +function toggleWordWrap(elm) { + if (elm.checked) + setWrap('soft'); + else + setWrap('off'); +} + +var wHeight=0, wWidth=0, owHeight=0, owWidth=0; + +function resizeInputs() { + var el = document.getElementById('htmlSource'); + + if (!tinymce.isIE) { + wHeight = self.innerHeight - 65; + wWidth = self.innerWidth - 16; + } else { + wHeight = document.body.clientHeight - 70; + wWidth = document.body.clientWidth - 16; + } + + el.style.height = Math.abs(wHeight) + 'px'; + el.style.width = Math.abs(wWidth) + 'px'; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/langs/en.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/langs/en.js new file mode 100644 index 0000000000000000000000000000000000000000..69694b1f9f8cd4ecfe36a64b7ccb80014458a5fa --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/langs/en.js @@ -0,0 +1,62 @@ +tinyMCE.addI18n('en.advanced',{ +style_select:"Styles", +font_size:"Font size", +fontdefault:"Font family", +block:"Format", +paragraph:"Paragraph", +div:"Div", +address:"Address", +pre:"Preformatted", +h1:"Heading 1", +h2:"Heading 2", +h3:"Heading 3", +h4:"Heading 4", +h5:"Heading 5", +h6:"Heading 6", +blockquote:"Blockquote", +code:"Code", +samp:"Code sample", +dt:"Definition term ", +dd:"Definition description", +bold_desc:"Bold (Ctrl+B)", +italic_desc:"Italic (Ctrl+I)", +underline_desc:"Underline (Ctrl+U)", +striketrough_desc:"Strikethrough", +justifyleft_desc:"Align left", +justifycenter_desc:"Align center", +justifyright_desc:"Align right", +justifyfull_desc:"Align full", +bullist_desc:"Unordered list", +numlist_desc:"Ordered list", +outdent_desc:"Outdent", +indent_desc:"Indent", +undo_desc:"Undo (Ctrl+Z)", +redo_desc:"Redo (Ctrl+Y)", +link_desc:"Insert/edit link", +unlink_desc:"Unlink", +image_desc:"Insert/edit image", +cleanup_desc:"Cleanup messy code", +code_desc:"Edit HTML Source", +sub_desc:"Subscript", +sup_desc:"Superscript", +hr_desc:"Insert horizontal ruler", +removeformat_desc:"Remove formatting", +custom1_desc:"Your custom description here", +forecolor_desc:"Select text color", +backcolor_desc:"Select background color", +charmap_desc:"Insert custom character", +visualaid_desc:"Toggle guidelines/invisible elements", +anchor_desc:"Insert/edit anchor", +cut_desc:"Cut", +copy_desc:"Copy", +paste_desc:"Paste", +image_props_desc:"Image properties", +newdocument_desc:"New document", +help_desc:"Help", +blockquote_desc:"Blockquote", +clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?", +path:"Path", +newdocument:"Are you sure you want clear all contents?", +toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X", +more_colors:"More colors" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..9d124d7db69b022cdca56f02bc4d418e1f4b25c3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/langs/en_dlg.js @@ -0,0 +1,51 @@ +tinyMCE.addI18n('en.advanced_dlg',{ +about_title:"About TinyMCE", +about_general:"About", +about_help:"Help", +about_license:"License", +about_plugins:"Plugins", +about_plugin:"Plugin", +about_author:"Author", +about_version:"Version", +about_loaded:"Loaded plugins", +anchor_title:"Insert/edit anchor", +anchor_name:"Anchor name", +code_title:"HTML Source Editor", +code_wordwrap:"Word wrap", +colorpicker_title:"Select a color", +colorpicker_picker_tab:"Picker", +colorpicker_picker_title:"Color picker", +colorpicker_palette_tab:"Palette", +colorpicker_palette_title:"Palette colors", +colorpicker_named_tab:"Named", +colorpicker_named_title:"Named colors", +colorpicker_color:"Color:", +colorpicker_name:"Name:", +charmap_title:"Select custom character", +image_title:"Insert/edit image", +image_src:"Image URL", +image_alt:"Image description", +image_list:"Image list", +image_border:"Border", +image_dimensions:"Dimensions", +image_vspace:"Vertical space", +image_hspace:"Horizontal space", +image_align:"Alignment", +image_align_baseline:"Baseline", +image_align_top:"Top", +image_align_middle:"Middle", +image_align_bottom:"Bottom", +image_align_texttop:"Text top", +image_align_textbottom:"Text bottom", +image_align_left:"Left", +image_align_right:"Right", +link_title:"Insert/edit link", +link_url:"Link URL", +link_target:"Target", +link_target_same:"Open link in the same window", +link_target_blank:"Open link in a new window", +link_titlefield:"Title", +link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +link_list:"Link list" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/link.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/link.htm new file mode 100644 index 0000000000000000000000000000000000000000..a78bd334d5ec42983537585b90c3ecba287cf908 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/link.htm @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.link_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/validate.js"></script> + <script type="text/javascript" src="js/link.js"></script> +</head> +<body id="link" style="display: none"> +<form onsubmit="LinkDialog.update();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.link_title}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td> + <td><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> + <td id="hrefbrowsercontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td><label for="link_list">{#advanced_dlg.link_list}</label></td> + <td><select id="link_list" name="link_list" onchange="document.getElementById('href').value=this.options[this.selectedIndex].value;"></select></td> + </tr> + <tr> + <td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td> + <td><select id="target_list" name="target_list"></select></td> + </tr> + <tr> + <td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td> + <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td> + </tr> + <tr> + <td><label for="class_list">{#class_name}</label></td> + <td><select id="class_list" name="class_list"></select></td> + </tr> + </table> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/content.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/content.css new file mode 100644 index 0000000000000000000000000000000000000000..19da1943bc055d2fcb4658f65f3534d0ca7cdb1b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/content.css @@ -0,0 +1,32 @@ +body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} +body {background:#FFF;} +body.mceForceColors {background:#FFF; color:#000;} +h1 {font-size: 2em} +h2 {font-size: 1.5em} +h3 {font-size: 1.17em} +h4 {font-size: 1em} +h5 {font-size: .83em} +h6 {font-size: .75em} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;} +img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;} +img {border:0;} +table {cursor:default} +table td, table th {cursor:text} +ins {border-bottom:1px solid green; text-decoration: none; color:green} +del {color:red; text-decoration:line-through} +cite {border-bottom:1px dashed blue} +acronym {border-bottom:1px dotted #CCC; cursor:help} +abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help} + +/* IE */ +* html body { +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/dialog.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/dialog.css new file mode 100644 index 0000000000000000000000000000000000000000..873c67e3c449b3a9386cee5a6f296ce45a2cdafb --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/dialog.css @@ -0,0 +1,116 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDDDDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +background:#F0F0EE; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} +.nowrap {white-space: nowrap} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #CCC;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +border:0; margin:0; padding:0; +font-weight:bold; +width:94px; height:26px; +background:url(img/buttons.png) 0 -26px; +cursor:pointer; +padding-bottom:2px; +} + +#insert {background:url(img/buttons.png) 0 -52px;} +#cancel {background:url(img/buttons.png) 0 0;} + +/* Browse */ +a.pickcolor, a.browse {text-decoration:none} +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border:1px solid #AAA; text-align:center} +td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} +#charmap a {display:block; color:#000; text-decoration:none; border:0} +#charmap a:hover {background:#CCC;color:#2B6FB6} +#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} +#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} +.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} +#colorpicker #picker_panel fieldset {margin:auto;width:325px;} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/buttons.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/buttons.png new file mode 100644 index 0000000000000000000000000000000000000000..7dd58418ba7cfe58ae7efdf174e0b223fe3aa6a0 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/buttons.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/items.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/items.gif new file mode 100644 index 0000000000000000000000000000000000000000..2eafd7954e6ebf24204b01db94b39299426d09da Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/items.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..85e31dfb2d0454de352d87fe95f7003f22c87992 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/menu_check.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/menu_check.gif new file mode 100644 index 0000000000000000000000000000000000000000..adfdddccd7cac62a17d68873fa53c248bff8351a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/menu_check.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/progress.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/progress.gif new file mode 100644 index 0000000000000000000000000000000000000000..5bb90fd6a49107a321c35b9cee4a7b810314b51f Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/progress.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/tabs.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/tabs.gif new file mode 100644 index 0000000000000000000000000000000000000000..ce4be63558b02e9837b995d2b9dd540ce6d61a6f Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/img/tabs.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/ui.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/ui.css new file mode 100644 index 0000000000000000000000000000000000000000..230a2ee288dacbbe3bb029a1b442b6cc974fddfc --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/default/ui.css @@ -0,0 +1,214 @@ +/* Reset */ +.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left} +.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} +.defaultSkin table td {vertical-align:middle} + +/* Containers */ +.defaultSkin table {background:#F0F0EE} +.defaultSkin iframe {display:block; background:#FFF} +.defaultSkin .mceToolbar {height:26px} +.defaultSkin .mceLeft {text-align:left} +.defaultSkin .mceRight {text-align:right} + +/* External */ +.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;} +.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC} +.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC} +.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC} +.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;} +.defaultSkin td.mceToolbar {padding-top:1px; vertical-align:top} +.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC} +.defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px} +.defaultSkin .mceStatusbar div {float:left; margin:2px} +.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize} +.defaultSkin .mceStatusbar a:hover {text-decoration:underline} +.defaultSkin table.mceToolbar {margin-left:3px} +.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px} +.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} +.defaultSkin td.mceCenter {text-align:center;} +.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;} +.defaultSkin td.mceRight table {margin:0 0 0 auto;} + +/* Button */ +.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px} +.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0} +.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.defaultSkin .mceButtonLabeled {width:auto} +.defaultSkin .mceButtonLabeled span.mceIcon {float:left} +.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica} +.defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888} + +/* Separator */ +.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px} + +/* ListBox */ +.defaultSkin .mceListBox {direction:ltr} +.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block} +.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} +.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;} +.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF} +.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0} +.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;} +.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px} +.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;} +.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;} + +/* SplitButton */ +.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr} +.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block} +.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;} +.defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;} +.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;} +.defaultSkin .mceSplitButton span.mceOpen {display:none} +.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0} +.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;} +.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;} + +/* ColorSplitButton */ +.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} +.defaultSkin .mceColorSplitMenu td {padding:2px} +.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} +.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} +.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} +.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A} +.defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a} +.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px} + +/* Menu */ +.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8} +.defaultSkin .mceNoIcons span.mceIcon {width:0;} +.defaultSkin .mceNoIcons a .mceText {padding-left:10px} +.defaultSkin .mceMenu table {background:#FFF} +.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block} +.defaultSkin .mceMenu td {height:20px} +.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0} +.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} +.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px} +.defaultSkin .mceMenu pre.mceText {font-family:Monospace} +.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} +.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3} +.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px} +.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD} +.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px} +.defaultSkin .mceMenuItemDisabled .mceText {color:#888} +.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)} +.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center} +.defaultSkin .mceMenu span.mceMenuLine {display:none} +.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF} +.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} +.defaultSkin .mcePlaceHolder {border:1px dotted gray} + +/* Formats */ +.defaultSkin .mce_formatPreview a {font-size:10px} +.defaultSkin .mce_p span.mceText {} +.defaultSkin .mce_address span.mceText {font-style:italic} +.defaultSkin .mce_pre span.mceText {font-family:monospace} +.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} +.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} +.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} +.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} +.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} +.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} + +/* Theme */ +.defaultSkin span.mce_bold {background-position:0 0} +.defaultSkin span.mce_italic {background-position:-60px 0} +.defaultSkin span.mce_underline {background-position:-140px 0} +.defaultSkin span.mce_strikethrough {background-position:-120px 0} +.defaultSkin span.mce_undo {background-position:-160px 0} +.defaultSkin span.mce_redo {background-position:-100px 0} +.defaultSkin span.mce_cleanup {background-position:-40px 0} +.defaultSkin span.mce_bullist {background-position:-20px 0} +.defaultSkin span.mce_numlist {background-position:-80px 0} +.defaultSkin span.mce_justifyleft {background-position:-460px 0} +.defaultSkin span.mce_justifyright {background-position:-480px 0} +.defaultSkin span.mce_justifycenter {background-position:-420px 0} +.defaultSkin span.mce_justifyfull {background-position:-440px 0} +.defaultSkin span.mce_anchor {background-position:-200px 0} +.defaultSkin span.mce_indent {background-position:-400px 0} +.defaultSkin span.mce_outdent {background-position:-540px 0} +.defaultSkin span.mce_link {background-position:-500px 0} +.defaultSkin span.mce_unlink {background-position:-640px 0} +.defaultSkin span.mce_sub {background-position:-600px 0} +.defaultSkin span.mce_sup {background-position:-620px 0} +.defaultSkin span.mce_removeformat {background-position:-580px 0} +.defaultSkin span.mce_newdocument {background-position:-520px 0} +.defaultSkin span.mce_image {background-position:-380px 0} +.defaultSkin span.mce_help {background-position:-340px 0} +.defaultSkin span.mce_code {background-position:-260px 0} +.defaultSkin span.mce_hr {background-position:-360px 0} +.defaultSkin span.mce_visualaid {background-position:-660px 0} +.defaultSkin span.mce_charmap {background-position:-240px 0} +.defaultSkin span.mce_paste {background-position:-560px 0} +.defaultSkin span.mce_copy {background-position:-700px 0} +.defaultSkin span.mce_cut {background-position:-680px 0} +.defaultSkin span.mce_blockquote {background-position:-220px 0} +.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0} +.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0} +.defaultSkin span.mce_forecolorpicker {background-position:-720px 0} +.defaultSkin span.mce_backcolorpicker {background-position:-760px 0} + +/* Plugins */ +.defaultSkin span.mce_advhr {background-position:-0px -20px} +.defaultSkin span.mce_ltr {background-position:-20px -20px} +.defaultSkin span.mce_rtl {background-position:-40px -20px} +.defaultSkin span.mce_emotions {background-position:-60px -20px} +.defaultSkin span.mce_fullpage {background-position:-80px -20px} +.defaultSkin span.mce_fullscreen {background-position:-100px -20px} +.defaultSkin span.mce_iespell {background-position:-120px -20px} +.defaultSkin span.mce_insertdate {background-position:-140px -20px} +.defaultSkin span.mce_inserttime {background-position:-160px -20px} +.defaultSkin span.mce_absolute {background-position:-180px -20px} +.defaultSkin span.mce_backward {background-position:-200px -20px} +.defaultSkin span.mce_forward {background-position:-220px -20px} +.defaultSkin span.mce_insert_layer {background-position:-240px -20px} +.defaultSkin span.mce_insertlayer {background-position:-260px -20px} +.defaultSkin span.mce_movebackward {background-position:-280px -20px} +.defaultSkin span.mce_moveforward {background-position:-300px -20px} +.defaultSkin span.mce_media {background-position:-320px -20px} +.defaultSkin span.mce_nonbreaking {background-position:-340px -20px} +.defaultSkin span.mce_pastetext {background-position:-360px -20px} +.defaultSkin span.mce_pasteword {background-position:-380px -20px} +.defaultSkin span.mce_selectall {background-position:-400px -20px} +.defaultSkin span.mce_preview {background-position:-420px -20px} +.defaultSkin span.mce_print {background-position:-440px -20px} +.defaultSkin span.mce_cancel {background-position:-460px -20px} +.defaultSkin span.mce_save {background-position:-480px -20px} +.defaultSkin span.mce_replace {background-position:-500px -20px} +.defaultSkin span.mce_search {background-position:-520px -20px} +.defaultSkin span.mce_styleprops {background-position:-560px -20px} +.defaultSkin span.mce_table {background-position:-580px -20px} +.defaultSkin span.mce_cell_props {background-position:-600px -20px} +.defaultSkin span.mce_delete_table {background-position:-620px -20px} +.defaultSkin span.mce_delete_col {background-position:-640px -20px} +.defaultSkin span.mce_delete_row {background-position:-660px -20px} +.defaultSkin span.mce_col_after {background-position:-680px -20px} +.defaultSkin span.mce_col_before {background-position:-700px -20px} +.defaultSkin span.mce_row_after {background-position:-720px -20px} +.defaultSkin span.mce_row_before {background-position:-740px -20px} +.defaultSkin span.mce_merge_cells {background-position:-760px -20px} +.defaultSkin span.mce_table_props {background-position:-980px -20px} +.defaultSkin span.mce_row_props {background-position:-780px -20px} +.defaultSkin span.mce_split_cells {background-position:-800px -20px} +.defaultSkin span.mce_template {background-position:-820px -20px} +.defaultSkin span.mce_visualchars {background-position:-840px -20px} +.defaultSkin span.mce_abbr {background-position:-860px -20px} +.defaultSkin span.mce_acronym {background-position:-880px -20px} +.defaultSkin span.mce_attribs {background-position:-900px -20px} +.defaultSkin span.mce_cite {background-position:-920px -20px} +.defaultSkin span.mce_del {background-position:-940px -20px} +.defaultSkin span.mce_ins {background-position:-960px -20px} +.defaultSkin span.mce_pagebreak {background-position:0 -40px} +.defaultSkin .mce_spellchecker span.mceAction {background-position:-540px -20px} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/content.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/content.css new file mode 100644 index 0000000000000000000000000000000000000000..b8431d16955cc25f3ac0dae70464178bdf2572fb --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/content.css @@ -0,0 +1,32 @@ +body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} +body {background:#FFF;} +body.mceForceColors {background:#FFF; color:#000;} +h1 {font-size: 2em} +h2 {font-size: 1.5em} +h3 {font-size: 1.17em} +h4 {font-size: 1em} +h5 {font-size: .83em} +h6 {font-size: .75em} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(../default/img/items.gif) no-repeat bottom left;} +img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.gif) no-repeat;} +img {border:0;} +table {cursor:default} +table td, table th {cursor:text} +ins {border-bottom:1px solid green; text-decoration: none; color:green} +del {color:red; text-decoration:line-through} +cite {border-bottom:1px dashed blue} +acronym {border-bottom:1px dotted #CCC; cursor:help} +abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help} + +/* IE */ +* html body { +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/dialog.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/dialog.css new file mode 100644 index 0000000000000000000000000000000000000000..6c37d6fb8395556422d93a9668f68c93f82b7b55 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/dialog.css @@ -0,0 +1,115 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDDDDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +background:#F0F0EE; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} +.nowrap {white-space: nowrap} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #CCC;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +border:0; margin:0; padding:0; +font-weight:bold; +width:94px; height:26px; +background:url(../default/img/buttons.png) 0 -26px; +cursor:pointer; +padding-bottom:2px; +} + +#insert {background:url(../default/img/buttons.png) 0 -52px;} +#cancel {background:url(../default/img/buttons.png) 0 0;} + +/* Browse */ +a.pickcolor, a.browse {text-decoration:none} +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border:1px solid #AAA; text-align:center} +td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} +#charmap a {display:block; color:#000; text-decoration:none; border:0} +#charmap a:hover {background:#CCC;color:#2B6FB6} +#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} +#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} +.tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..12cfb419bbf2fb87f845731aa0fceb653d0dbf88 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png new file mode 100644 index 0000000000000000000000000000000000000000..8996c7493e8a58c9c40845cbe8abdc3e6730716d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png new file mode 100644 index 0000000000000000000000000000000000000000..bd5d2550c06d83c1141b78c5af7217e89559fc32 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui.css new file mode 100644 index 0000000000000000000000000000000000000000..c10a3f0161f642bd3fee6da3538aaf44abefd921 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui.css @@ -0,0 +1,215 @@ +/* Reset */ +.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left} +.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} +.o2k7Skin table td {vertical-align:middle} + +/* Containers */ +.o2k7Skin table {background:#E5EFFD} +.o2k7Skin iframe {display:block; background:#FFF} +.o2k7Skin .mceToolbar {height:26px} + +/* External */ +.o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none} +.o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD} +.o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD} +.o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD} +.o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0} +.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD} +.o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px} +.o2k7Skin .mceStatusbar div {float:left; padding:2px} +.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize} +.o2k7Skin .mceStatusbar a:hover {text-decoration:underline} +.o2k7Skin table.mceToolbar {margin-left:3px} +.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;} +.o2k7Skin .mceToolbar td.mceFirst span {margin:0} +.o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px} +.o2k7Skin .mceToolbar .mceToolbarEndListBox span, .o2k7Skin .mceToolbar .mceToolbarStartListBox span {display:none} +.o2k7Skin span.mceIcon, .o2k7Skin img.mceIcon {display:block; width:20px; height:20px} +.o2k7Skin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} +.o2k7Skin td.mceCenter {text-align:center;} +.o2k7Skin td.mceCenter table {margin:0 auto; text-align:left;} +.o2k7Skin td.mceRight table {margin:0 0 0 auto;} + +/* Button */ +.o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px} +.o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px} +.o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px} +.o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px} +.o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px} +.o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.o2k7Skin .mceButtonLabeled {width:auto} +.o2k7Skin .mceButtonLabeled span.mceIcon {float:left} +.o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica} +.o2k7Skin .mceButtonDisabled .mceButtonLabel {color:#888} + +/* Separator */ +.o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px} + +/* ListBox */ +.o2k7Skin .mceListBox {margin-left:3px} +.o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block} +.o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} +.o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0} +.o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF} +.o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px} +.o2k7Skin .mceListBoxDisabled .mceText {color:gray} +.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px} +.o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;} + +/* SplitButton */ +.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px} +.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)} +.o2k7Skin .mceSplitButton a.mceAction {width:22px} +.o2k7Skin .mceSplitButton span.mceAction {width:22px; background:url(../../img/icons.gif) 20px 20px} +.o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0} +.o2k7Skin .mceSplitButton span.mceOpen {display:none} +.o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px} +.o2k7Skin table.mceSplitButtonEnabled:hover a.mceOpen, .o2k7Skin .mceSplitButtonHover a.mceOpen, .o2k7Skin .mceSplitButtonSelected a.mceOpen {background-position:-44px -44px} +.o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.o2k7Skin .mceSplitButtonActive {background-position:0 -44px} + +/* ColorSplitButton */ +.o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} +.o2k7Skin .mceColorSplitMenu td {padding:2px} +.o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} +.o2k7Skin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} +.o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} +.o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A} +.o2k7Skin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a;overflow:hidden} +.o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden} + +/* Menu */ +.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD} +.o2k7Skin .mceNoIcons span.mceIcon {width:0;} +.o2k7Skin .mceNoIcons a .mceText {padding-left:10px} +.o2k7Skin .mceMenu table {background:#FFF} +.o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block} +.o2k7Skin .mceMenu td {height:20px} +.o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0} +.o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} +.o2k7Skin .mceMenu span.mceText, .o2k7Skin .mceMenu .mcePreview {font-size:11px} +.o2k7Skin .mceMenu pre.mceText {font-family:Monospace} +.o2k7Skin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} +.o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3} +.o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px} +.o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD} +.o2k7Skin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px} +.o2k7Skin .mceMenuItemDisabled .mceText {color:#888} +.o2k7Skin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)} +.o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center} +.o2k7Skin .mceMenu span.mceMenuLine {display:none} +.o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF} +.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} +.o2k7Skin .mcePlaceHolder {border:1px dotted gray} + +/* Formats */ +.o2k7Skin .mce_formatPreview a {font-size:10px} +.o2k7Skin .mce_p span.mceText {} +.o2k7Skin .mce_address span.mceText {font-style:italic} +.o2k7Skin .mce_pre span.mceText {font-family:monospace} +.o2k7Skin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} +.o2k7Skin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} +.o2k7Skin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} +.o2k7Skin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} +.o2k7Skin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} +.o2k7Skin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} + +/* Theme */ +.o2k7Skin span.mce_bold {background-position:0 0} +.o2k7Skin span.mce_italic {background-position:-60px 0} +.o2k7Skin span.mce_underline {background-position:-140px 0} +.o2k7Skin span.mce_strikethrough {background-position:-120px 0} +.o2k7Skin span.mce_undo {background-position:-160px 0} +.o2k7Skin span.mce_redo {background-position:-100px 0} +.o2k7Skin span.mce_cleanup {background-position:-40px 0} +.o2k7Skin span.mce_bullist {background-position:-20px 0} +.o2k7Skin span.mce_numlist {background-position:-80px 0} +.o2k7Skin span.mce_justifyleft {background-position:-460px 0} +.o2k7Skin span.mce_justifyright {background-position:-480px 0} +.o2k7Skin span.mce_justifycenter {background-position:-420px 0} +.o2k7Skin span.mce_justifyfull {background-position:-440px 0} +.o2k7Skin span.mce_anchor {background-position:-200px 0} +.o2k7Skin span.mce_indent {background-position:-400px 0} +.o2k7Skin span.mce_outdent {background-position:-540px 0} +.o2k7Skin span.mce_link {background-position:-500px 0} +.o2k7Skin span.mce_unlink {background-position:-640px 0} +.o2k7Skin span.mce_sub {background-position:-600px 0} +.o2k7Skin span.mce_sup {background-position:-620px 0} +.o2k7Skin span.mce_removeformat {background-position:-580px 0} +.o2k7Skin span.mce_newdocument {background-position:-520px 0} +.o2k7Skin span.mce_image {background-position:-380px 0} +.o2k7Skin span.mce_help {background-position:-340px 0} +.o2k7Skin span.mce_code {background-position:-260px 0} +.o2k7Skin span.mce_hr {background-position:-360px 0} +.o2k7Skin span.mce_visualaid {background-position:-660px 0} +.o2k7Skin span.mce_charmap {background-position:-240px 0} +.o2k7Skin span.mce_paste {background-position:-560px 0} +.o2k7Skin span.mce_copy {background-position:-700px 0} +.o2k7Skin span.mce_cut {background-position:-680px 0} +.o2k7Skin span.mce_blockquote {background-position:-220px 0} +.o2k7Skin .mce_forecolor span.mceAction {background-position:-720px 0} +.o2k7Skin .mce_backcolor span.mceAction {background-position:-760px 0} +.o2k7Skin span.mce_forecolorpicker {background-position:-720px 0} +.o2k7Skin span.mce_backcolorpicker {background-position:-760px 0} + +/* Plugins */ +.o2k7Skin span.mce_advhr {background-position:-0px -20px} +.o2k7Skin span.mce_ltr {background-position:-20px -20px} +.o2k7Skin span.mce_rtl {background-position:-40px -20px} +.o2k7Skin span.mce_emotions {background-position:-60px -20px} +.o2k7Skin span.mce_fullpage {background-position:-80px -20px} +.o2k7Skin span.mce_fullscreen {background-position:-100px -20px} +.o2k7Skin span.mce_iespell {background-position:-120px -20px} +.o2k7Skin span.mce_insertdate {background-position:-140px -20px} +.o2k7Skin span.mce_inserttime {background-position:-160px -20px} +.o2k7Skin span.mce_absolute {background-position:-180px -20px} +.o2k7Skin span.mce_backward {background-position:-200px -20px} +.o2k7Skin span.mce_forward {background-position:-220px -20px} +.o2k7Skin span.mce_insert_layer {background-position:-240px -20px} +.o2k7Skin span.mce_insertlayer {background-position:-260px -20px} +.o2k7Skin span.mce_movebackward {background-position:-280px -20px} +.o2k7Skin span.mce_moveforward {background-position:-300px -20px} +.o2k7Skin span.mce_media {background-position:-320px -20px} +.o2k7Skin span.mce_nonbreaking {background-position:-340px -20px} +.o2k7Skin span.mce_pastetext {background-position:-360px -20px} +.o2k7Skin span.mce_pasteword {background-position:-380px -20px} +.o2k7Skin span.mce_selectall {background-position:-400px -20px} +.o2k7Skin span.mce_preview {background-position:-420px -20px} +.o2k7Skin span.mce_print {background-position:-440px -20px} +.o2k7Skin span.mce_cancel {background-position:-460px -20px} +.o2k7Skin span.mce_save {background-position:-480px -20px} +.o2k7Skin span.mce_replace {background-position:-500px -20px} +.o2k7Skin span.mce_search {background-position:-520px -20px} +.o2k7Skin span.mce_styleprops {background-position:-560px -20px} +.o2k7Skin span.mce_table {background-position:-580px -20px} +.o2k7Skin span.mce_cell_props {background-position:-600px -20px} +.o2k7Skin span.mce_delete_table {background-position:-620px -20px} +.o2k7Skin span.mce_delete_col {background-position:-640px -20px} +.o2k7Skin span.mce_delete_row {background-position:-660px -20px} +.o2k7Skin span.mce_col_after {background-position:-680px -20px} +.o2k7Skin span.mce_col_before {background-position:-700px -20px} +.o2k7Skin span.mce_row_after {background-position:-720px -20px} +.o2k7Skin span.mce_row_before {background-position:-740px -20px} +.o2k7Skin span.mce_merge_cells {background-position:-760px -20px} +.o2k7Skin span.mce_table_props {background-position:-980px -20px} +.o2k7Skin span.mce_row_props {background-position:-780px -20px} +.o2k7Skin span.mce_split_cells {background-position:-800px -20px} +.o2k7Skin span.mce_template {background-position:-820px -20px} +.o2k7Skin span.mce_visualchars {background-position:-840px -20px} +.o2k7Skin span.mce_abbr {background-position:-860px -20px} +.o2k7Skin span.mce_acronym {background-position:-880px -20px} +.o2k7Skin span.mce_attribs {background-position:-900px -20px} +.o2k7Skin span.mce_cite {background-position:-920px -20px} +.o2k7Skin span.mce_del {background-position:-940px -20px} +.o2k7Skin span.mce_ins {background-position:-960px -20px} +.o2k7Skin span.mce_pagebreak {background-position:0 -40px} +.o2k7Skin .mce_spellchecker span.mceAction {background-position:-540px -20px} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui_black.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui_black.css new file mode 100644 index 0000000000000000000000000000000000000000..153f0c38a6c69b897b9d7dbb5fd66a75991048bc --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui_black.css @@ -0,0 +1,8 @@ +/* Black */ +.o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton a.mceOpen, .o2k7SkinBlack .mceListBox a.mceOpen {background-image:url(img/button_bg_black.png)} +.o2k7SkinBlack table, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF} +.o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0} +.o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0} +.o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;} +.o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7SkinBlack .mceSplitButtonHover a.mceAction, .o2k7SkinBlack .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)} +.o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7SkinBlack .mceMenu .mceMenuItemActive {background-color:#FFE7A1} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css new file mode 100644 index 0000000000000000000000000000000000000000..7fe3b45e1264ad10f89c696ecc3b0e0801a96653 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css @@ -0,0 +1,5 @@ +/* Silver */ +.o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton a.mceOpen, .o2k7SkinSilver .mceListBox a.mceOpen {background-image:url(img/button_bg_silver.png)} +.o2k7SkinSilver table, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee} +.o2k7SkinSilver .mceListBox .mceText {background:#FFF} +.o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/source_editor.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/source_editor.htm new file mode 100644 index 0000000000000000000000000000000000000000..553e7bb2bc734587ba964e703bd2e2374abe8b0b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/advanced/source_editor.htm @@ -0,0 +1,31 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <title>{#advanced_dlg.code_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/source_editor.js"></script> +</head> +<body onresize="resizeInputs();" style="display:none; overflow:hidden;"> + <form name="source" onsubmit="saveContent();return false;" action="#"> + <div style="float: left" class="title">{#advanced_dlg.code_title}</div> + + <div id="wrapline" style="float: right"> + <input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{#advanced_dlg.code_wordwrap}</label> + </div> + + <br style="clear: both" /> + + <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" name="insert" value="{#update}" id="insert" /> + </div> + + <div style="float: right"> + <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/about.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/about.htm new file mode 100644 index 0000000000000000000000000000000000000000..e5df7aa5aca5b9b6d138569f4d2f8626b0d3652b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/about.htm @@ -0,0 +1,56 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.about_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="js/about.js"></script> +</head> +<body id="about" style="display: none"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li> + <li id="help_tab" style="display:none"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li> + <li id="plugins_tab"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <h3>{#advanced_dlg.about_title}</h3> + <p>Version: <span id="version"></span> (<span id="date"></span>)</p> + <p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a> + by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p> + <p>Copyright © 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p> + <p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p> + + <div id="buttoncontainer"> + <a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a> + <a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="http://sourceforge.net/sflogo.php?group_id=103281" alt="Hosted By Sourceforge" border="0" /></a> + <a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="http://tinymce.moxiecode.com/images/fm.gif" alt="Also on freshmeat" border="0" /></a> + </div> + </div> + + <div id="plugins_panel" class="panel"> + <div id="pluginscontainer"> + <h3>{#advanced_dlg.about_loaded}</h3> + + <div id="plugintablecontainer"> + </div> + + <p> </p> + </div> + </div> + + <div id="help_panel" class="panel noscroll" style="overflow: visible;"> + <div id="iframecontainer"></div> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/anchor.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/anchor.htm new file mode 100644 index 0000000000000000000000000000000000000000..42095a1c0cabd4db2666cbdefd2666cfa68e00b0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/anchor.htm @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.anchor_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/anchor.js"></script> +</head> +<body style="display: none"> +<form onsubmit="AnchorDialog.update();return false;" action="#"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td colspan="2" class="title">{#advanced_dlg.anchor_title}</td> + </tr> + <tr> + <td class="nowrap">{#advanced_dlg.anchor_name}:</td> + <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" /></td> + </tr> + </table> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#update}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/charmap.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/charmap.htm new file mode 100644 index 0000000000000000000000000000000000000000..f11a38ad8a2a8038b7809b76c499e73b09b89c0e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/charmap.htm @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.charmap_title}</title> + <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/charmap.js"></script> +</head> +<body id="charmap" style="display:none"> +<table align="center" border="0" cellspacing="0" cellpadding="2"> + <tr> + <td colspan="2" class="title">{#advanced_dlg.charmap_title}</td> + </tr> + <tr> + <td id="charmapView" rowspan="2" align="left" valign="top"> + <!-- Chars will be rendered here --> + </td> + <td width="100" align="center" valign="top"> + <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px"> + <tr> + <td id="codeV"> </td> + </tr> + <tr> + <td id="codeN"> </td> + </tr> + </table> + </td> + </tr> + <tr> + <td valign="bottom" style="padding-bottom: 3px;"> + <table width="100" align="center" border="0" cellpadding="2" cellspacing="0"> + <tr> + <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;">HTML-Code</td> + </tr> + <tr> + <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center"> </td> + </tr> + <tr> + <td style="font-size: 1px;"> </td> + </tr> + <tr> + <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;">NUM-Code</td> + </tr> + <tr> + <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center"> </td> + </tr> + </table> + </td> + </tr> +</table> + +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/color_picker.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/color_picker.htm new file mode 100644 index 0000000000000000000000000000000000000000..90eb4c2ee1fc66b458f718c8e78f3b9b3fb375d2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/color_picker.htm @@ -0,0 +1,75 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.colorpicker_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="js/color_picker.js"></script> +</head> +<body id="colorpicker" style="display: none"> +<form onsubmit="insertAction();return false" action="#"> + <div class="tabs"> + <ul> + <li id="picker_tab" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li> + <li id="rgb_tab"><span><a href="javascript:;" onclick="generateWebColors();mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li> + <li id="named_tab"><span><a href="javascript:;" onclick="generateNamedColors();javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="picker_panel" class="panel current"> + <fieldset> + <legend>{#advanced_dlg.colorpicker_picker_title}</legend> + <div id="picker"> + <img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt=" " /> + + <div id="light"> + <!-- Will be filled with divs --> + </div> + + <br style="clear: both" /> + </div> + </fieldset> + </div> + + <div id="rgb_panel" class="panel"> + <fieldset> + <legend>{#advanced_dlg.colorpicker_palette_title}</legend> + <div id="webcolors"> + <!-- Gets filled with web safe colors--> + </div> + + <br style="clear: both" /> + </fieldset> + </div> + + <div id="named_panel" class="panel"> + <fieldset> + <legend>{#advanced_dlg.colorpicker_named_title}</legend> + <div id="namedcolors"> + <!-- Gets filled with named colors--> + </div> + + <br style="clear: both" /> + + <div id="colornamecontainer"> + {#advanced_dlg.colorpicker_name} <span id="colorname"></span> + </div> + </fieldset> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#apply}" /> + </div> + + <div id="preview"></div> + + <div id="previewblock"> + <label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" maxlength="8" class="text mceFocus" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/editor_template.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/editor_template.js new file mode 100644 index 0000000000000000000000000000000000000000..e6279a660c7a35ecd8ecd528f4d0ced5437eee0b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/editor_template.js @@ -0,0 +1,1228 @@ +/** + * $Id: editor_template_src.js 1045 2009-03-04 20:03:18Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + + +(function(tinymce) { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; + + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('maarch'); + + tinymce.create('tinymce.themes.MaarchTheme', { + sizes : [8, 10, 12, 14, 18, 24, 36], + + // Control name lookup, format: title, command + controls : { + bold : ['bold_desc', 'Bold'], + italic : ['italic_desc', 'Italic'], + underline : ['underline_desc', 'Underline'], + strikethrough : ['striketrough_desc', 'Strikethrough'], + justifyleft : ['justifyleft_desc', 'JustifyLeft'], + justifycenter : ['justifycenter_desc', 'JustifyCenter'], + justifyright : ['justifyright_desc', 'JustifyRight'], + justifyfull : ['justifyfull_desc', 'JustifyFull'], + bullist : ['bullist_desc', 'InsertUnorderedList'], + numlist : ['numlist_desc', 'InsertOrderedList'], + outdent : ['outdent_desc', 'Outdent'], + indent : ['indent_desc', 'Indent'], + cut : ['cut_desc', 'Cut'], + copy : ['copy_desc', 'Copy'], + paste : ['paste_desc', 'Paste'], + undo : ['undo_desc', 'Undo'], + redo : ['redo_desc', 'Redo'], + // link : ['link_desc', 'mceLink'], + // unlink : ['unlink_desc', 'unlink'], + image : ['image_desc', 'mceImage'], + cleanup : ['cleanup_desc', 'mceCleanup'], + // help : ['help_desc', 'mceHelp'], + code : ['code_desc', 'mceCodeEditor'], + hr : ['hr_desc', 'InsertHorizontalRule'], + removeformat : ['removeformat_desc', 'RemoveFormat'], + sub : ['sub_desc', 'subscript'], + sup : ['sup_desc', 'superscript'], + forecolor : ['forecolor_desc', 'ForeColor'], + forecolorpicker : ['forecolor_desc', 'mceForeColor'], + backcolor : ['backcolor_desc', 'HiliteColor'], + backcolorpicker : ['backcolor_desc', 'mceBackColor'], + charmap : ['charmap_desc', 'mceCharMap'], + visualaid : ['visualaid_desc', 'mceToggleVisualAid'], + anchor : ['anchor_desc', 'mceInsertAnchor'], + // newdocument : ['newdocument_desc', 'mceNewDocument'], + blockquote : ['blockquote_desc', 'mceBlockQuote'] + }, + + stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'], + + init : function(ed, url) { + var t = this, s, v, o; + + t.editor = ed; + t.url = url; + t.onResolveName = new tinymce.util.Dispatcher(this); + + // Default settings + t.settings = s = extend({ + theme_maarch_path : true, + theme_maarch_toolbar_location : 'top', + theme_maarch_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,maarchselect", + theme_maarch_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code", + theme_maarch_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap", + theme_maarch_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6", + theme_maarch_toolbar_align : "center", + theme_maarch_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats", + theme_maarch_more_colors : 1, + theme_maarch_row_height : 23, + theme_maarch_resize_horizontal : 1, + theme_maarch_resizing_use_cookie : 1, + theme_maarch_font_sizes : "1,2,3,4,5,6,7", + readonly : ed.settings.readonly + }, ed.settings); + + // Setup default font_size_style_values + if (!s.font_size_style_values) + s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt"; + + if (tinymce.is(s.theme_maarch_font_sizes, 'string')) { + s.font_size_style_values = tinymce.explode(s.font_size_style_values); + s.font_size_classes = tinymce.explode(s.font_size_classes || ''); + + // Parse string value + o = {}; + ed.settings.theme_maarch_font_sizes = s.theme_maarch_font_sizes; + each(ed.getParam('theme_maarch_font_sizes', '', 'hash'), function(v, k) { + var cl; + + if (k == v && v >= 1 && v <= 7) { + k = v + ' (' + t.sizes[v - 1] + 'pt)'; + + if (ed.settings.convert_fonts_to_spans) { + cl = s.font_size_classes[v - 1]; + v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt'); + } + } + + if (/^\s*\./.test(v)) + cl = v.replace(/\./g, ''); + + o[k] = cl ? {'class' : cl} : {fontSize : v}; + }); + + s.theme_maarch_font_sizes = o; + } + + if ((v = s.theme_maarch_path_location) && v != 'none') + s.theme_maarch_statusbar_location = s.theme_maarch_path_location; + + if (s.theme_maarch_statusbar_location == 'none') + s.theme_maarch_statusbar_location = 0; + + // Init editor + ed.onInit.add(function() { + ed.onNodeChange.add(t._nodeChanged, t); + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/maarch/skins/" + ed.settings.skin + "/content.css")); + }); + + ed.onSetProgressState.add(function(ed, b, ti) { + var co, id = ed.id, tb; + + if (b) { + t.progressTimer = setTimeout(function() { + co = ed.getContainer(); + co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild); + tb = DOM.get(ed.id + '_tbl'); + + DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}}); + DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}}); + }, ti || 0); + } else { + DOM.remove(id + '_blocker'); + DOM.remove(id + '_progress'); + clearTimeout(t.progressTimer); + } + }); + + DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css"); + + if (s.skin_variant) + DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css"); + }, + + createControl : function(n, cf) { + var cd, c; + + if (c = cf.createControl(n)) + return c; + + switch (n) { + case "styleselect": + return this._createStyleSelect(); + + case "formatselect": + return this._createBlockFormats(); + + case "fontselect": + return this._createFontSelect(); + + case "fontsizeselect": + return this._createFontSizeSelect(); + + case "forecolor": + return this._createForeColorMenu(); + + case "backcolor": + return this._createBackColorMenu(); + + case "maarchselect": + return this._createMaarchList(); + } + + if ((cd = this.controls[n])) + return cf.createButton(n, {title : "maarch." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]}); + }, + + execCommand : function(cmd, ui, val) { + var f = this['_' + cmd]; + + if (f) { + f.call(this, ui, val); + return true; + } + + return false; + }, + + _importClasses : function(e) { + var ed = this.editor, c = ed.controlManager.get('styleselect'); + + if (c.getLength() == 0) { + each(ed.dom.getClasses(), function(o) { + c.add(o['class'], o['class']); + }); + } + }, + + _createStyleSelect : function(n) { + var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', { + title : 'maarch.style_select', + onselect : function(v) { + if (c.selectedValue === v) { + ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'}); + c.select(); + return false; + } else + ed.execCommand('mceSetCSSClass', 0, v); + } + }); + + if (c) { + each(ed.getParam('theme_maarch_styles', '', 'hash'), function(v, k) { + if (v) + c.add(t.editor.translate(k), v); + }); + + c.onPostRender.add(function(ed, n) { + if (!c.NativeListBox) { + Event.add(n.id + '_text', 'focus', t._importClasses, t); + Event.add(n.id + '_text', 'mousedown', t._importClasses, t); + Event.add(n.id + '_open', 'focus', t._importClasses, t); + Event.add(n.id + '_open', 'mousedown', t._importClasses, t); + } else + Event.add(n.id, 'focus', t._importClasses, t); + }); + } + + return c; + }, + + _createFontSelect : function() { + var c, t = this, ed = t.editor; + + c = ed.controlManager.createListBox('fontselect', {title : 'maarch.fontdefault', cmd : 'FontName'}); + if (c) { + each(ed.getParam('theme_maarch_fonts', t.settings.theme_maarch_fonts, 'hash'), function(v, k) { + c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''}); + }); + } + + return c; + }, + + _createFontSizeSelect : function() { + var t = this, ed = t.editor, c, i = 0, cl = []; + + c = ed.controlManager.createListBox('fontsizeselect', {title : 'maarch.font_size', onselect : function(v) { + if (v.fontSize) + ed.execCommand('FontSize', false, v.fontSize); + else { + each(t.settings.theme_maarch_font_sizes, function(v, k) { + if (v['class']) + cl.push(v['class']); + }); + + ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl}); + } + }}); + + if (c) { + each(t.settings.theme_maarch_font_sizes, function(v, k) { + var fz = v.fontSize; + + if (fz >= 1 && fz <= 7) + fz = t.sizes[parseInt(fz) - 1] + 'pt'; + + c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))}); + }); + } + + return c; + }, + + _createBlockFormats : function() { + var c, fmts = { + p : 'maarch.paragraph', + address : 'maarch.address', + pre : 'maarch.pre', + h1 : 'maarch.h1', + h2 : 'maarch.h2', + h3 : 'maarch.h3', + h4 : 'maarch.h4', + h5 : 'maarch.h5', + h6 : 'maarch.h6', + div : 'maarch.div', + blockquote : 'maarch.blockquote', + code : 'maarch.code', + dt : 'maarch.dt', + dd : 'maarch.dd', + samp : 'maarch.samp' + }, t = this; + + c = t.editor.controlManager.createListBox('formatselect', {title : 'maarch.block', cmd : 'FormatBlock'}); + if (c) { + each(t.editor.getParam('theme_maarch_blockformats', t.settings.theme_maarch_blockformats, 'hash'), function(v, k) { + c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v}); + }); + } + + return c; + }, + + _createForeColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_maarch_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_maarch_text_colors) + o.colors = v; + + if (s.theme_maarch_default_foreground_color) + o.default_color = s.theme_maarch_default_foreground_color; + + o.title = 'maarch.forecolor_desc'; + o.cmd = 'ForeColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('forecolor', o); + + return c; + }, + + _createBackColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_maarch_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_maarch_background_colors) + o.colors = v; + + if (s.theme_maarch_default_background_color) + o.default_color = s.theme_maarch_default_background_color; + + o.title = 'maarch.backcolor_desc'; + o.cmd = 'HiliteColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('backcolor', o); + + return c; + }, + + _createMaarchList : function() { + + var c, t = this, ed = t.editor, elems = []; + + if(ed.settings.mapping_file != null) + { + var ie_browser = false; + if( window.ActiveXObject && /Win/.test(navigator.userAgent) ) + { + ie_browser = true; + } + // alert(ed.settings.mapping_file); + var xmlfile = load_xml_file(ed.settings.mapping_file); + //alert(xmlfile); + //var xml_content = (new XMLSerializer()).serializeToString(xmlfile); + //alert(xml_content); + if(xmlfile) + { + var items = xmlfile.getElementsByTagName('item'); + var tmp1; + var tmp2; + for(var cpt_item=0; cpt_item<items.length; cpt_item++) + { + //alert(items[cpt_item].childNodes.length); + //alert(items[cpt_item].childNodes[0]); + if(ie_browser) + { + elems[cpt_item] = {'label' : items[cpt_item].childNodes[0].text, 'value' : items[cpt_item].childNodes[1].text }; + } + else + { + elems[cpt_item] = {'label' : items[cpt_item].childNodes[0].textContent, 'value' : items[cpt_item].childNodes[1].textContent }; + } + } + } + } + + //~ c = t.editor.controlManager.createListBox('maarchselect', {title : 'MAARCH', cmd : 'FormatBlock'}); + //~ if (c) { + //~ each(t.editor.getParam('theme_maarch_blockformats', t.settings.theme_maarch_blockformats, 'hash'), function(v, k) { + //~ c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v}); + //~ }); + //~ } + //~ return c; + + //c = ed.controlManager.createListBox('fontsizeselect', {title : 'maarch.font_size', onselect : onselect : function(v) { + //~ if (v.fontSize) + //~ ed.execCommand('FontSize', false, v.fontSize); + //~ else { + //~ each(t.settings.theme_maarch_font_sizes, function(v, k) { + //~ if (v['class']) + //~ cl.push(v['class']); + //~ }); + + // ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl}); + //~ } + //~ }}); + c = ed.controlManager.createListBox('maarchselect', {title : 'MAARCH', onselect : function(indice) { + //alert(elems[indice]['value']); + ed.selection.setContent(elems[indice]['value']); + + }}); + if (c) { + for(var cmp =0; cmp<elems.length; cmp++) + { + c.add(elems[cmp]['label'], cmp, {'class' : 'mce_formatPreview mce_maarchselect' + cmp}); + } + } + return c; + }, + + renderUI : function(o) { + var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl; + + n = p = DOM.create('span', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')}); + + if (!DOM.boxModel) + n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'}); + + n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0}); + n = tb = DOM.add(n, 'tbody'); + + switch ((s.theme_maarch_layout_manager || '').toLowerCase()) { + case "rowlayout": + ic = t._rowLayout(s, tb, o); + break; + + case "customlayout": + ic = ed.execCallback("theme_maarch_custom_layout", s, tb, o, p); + break; + + default: + ic = t._simpleLayout(s, tb, o, p); + } + + n = o.targetNode; + + // Add classes to first and last TRs + nl = DOM.stdMode ? sc.getElementsByTagName('tr') : sc.rows; // Quick fix for IE 8 + DOM.addClass(nl[0], 'mceFirst'); + DOM.addClass(nl[nl.length - 1], 'mceLast'); + + // Add classes to first and last TDs + each(DOM.select('tr', tb), function(n) { + DOM.addClass(n.firstChild, 'mceFirst'); + DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast'); + }); + + if (DOM.get(s.theme_maarch_toolbar_container)) + DOM.get(s.theme_maarch_toolbar_container).appendChild(p); + else + DOM.insertAfter(p, n); + + Event.add(ed.id + '_path_row', 'click', function(e) { + e = e.target; + + if (e.nodeName == 'A') { + t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1')); + + return Event.cancel(e); + } + }); +/* + if (DOM.get(ed.id + '_path_row')) { + Event.add(ed.id + '_tbl', 'mouseover', function(e) { + var re; + + e = e.target; + + if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) { + re = DOM.get(ed.id + '_path_row'); + t.lastPath = re.innerHTML; + DOM.setHTML(re, e.parentNode.title); + } + }); + + Event.add(ed.id + '_tbl', 'mouseout', function(e) { + if (t.lastPath) { + DOM.setHTML(ed.id + '_path_row', t.lastPath); + t.lastPath = 0; + } + }); + } +*/ + + if (!ed.getParam('accessibility_focus')) + Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();}); + + if (s.theme_maarch_toolbar_location == 'external') + o.deltaHeight = 0; + + t.deltaHeight = o.deltaHeight; + o.targetNode = null; + + return { + iframeContainer : ic, + editorContainer : ed.id + '_parent', + sizeContainer : sc, + deltaHeight : o.deltaHeight + }; + }, + + getInfo : function() { + return { + longname : 'Maarch theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + }, + + resizeBy : function(dw, dh) { + var e = DOM.get(this.editor.id + '_tbl'); + + this.resizeTo(e.clientWidth + dw, e.clientHeight + dh); + }, + + resizeTo : function(w, h) { + var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh; + + // Boundery fix box + w = Math.max(s.theme_maarch_resizing_min_width || 100, w); + h = Math.max(s.theme_maarch_resizing_min_height || 100, h); + w = Math.min(s.theme_maarch_resizing_max_width || 0xFFFF, w); + h = Math.min(s.theme_maarch_resizing_max_height || 0xFFFF, h); + + // Calc difference between iframe and container + dh = e.clientHeight - ifr.clientHeight; + + // Resize iframe and container + DOM.setStyle(ifr, 'height', h - dh); + DOM.setStyles(e, {width : w, height : h}); + }, + + destroy : function() { + var id = this.editor.id; + + Event.clear(id + '_resize'); + Event.clear(id + '_path_row'); + Event.clear(id + '_external_close'); + }, + + // Internal functions + + _simpleLayout : function(s, tb, o, p) { + var t = this, ed = t.editor, lo = s.theme_maarch_toolbar_location, sl = s.theme_maarch_statusbar_location, n, ic, etb, c; + + if (s.readonly) { + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + return ic; + } + + // Create toolbar container at top + if (lo == 'top') + t._addToolbars(tb, o); + + // Create external toolbar + if (lo == 'external') { + n = c = DOM.create('div', {style : 'position:relative'}); + n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'}); + DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'}); + n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0}); + etb = DOM.add(n, 'tbody'); + + if (p.firstChild.className == 'mceOldBoxModel') + p.firstChild.appendChild(c); + else + p.insertBefore(c, p.firstChild); + + t._addToolbars(etb, o); + + ed.onMouseUp.add(function() { + var e = DOM.get(ed.id + '_external'); + DOM.show(e); + + DOM.hide(lastExtID); + + var f = Event.add(ed.id + '_external_close', 'click', function() { + DOM.hide(ed.id + '_external'); + Event.remove(ed.id + '_external_close', 'click', f); + }); + + DOM.show(e); + DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1); + + // Fixes IE rendering bug + DOM.hide(e); + DOM.show(e); + e.style.filter = ''; + + lastExtID = ed.id + '_external'; + + e = null; + }); + } + + if (sl == 'top') + t._addStatusBar(tb, o); + + // Create iframe container + if (!s.theme_maarch_toolbar_container) { + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + } + + // Create toolbar container at bottom + if (lo == 'bottom') + t._addToolbars(tb, o); + + if (sl == 'bottom') + t._addStatusBar(tb, o); + + return ic; + }, + + _rowLayout : function(s, tb, o) { + var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a; + + dc = s.theme_maarch_containers_default_class || ''; + da = s.theme_maarch_containers_default_align || 'center'; + + each(explode(s.theme_maarch_containers || ''), function(c, i) { + var v = s['theme_maarch_container_' + c] || ''; + + switch (v.toLowerCase()) { + case 'mceeditor': + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + break; + + case 'mceelementpath': + t._addStatusBar(tb, o); + break; + + default: + a = (s['theme_maarch_container_' + c + '_align'] || da).toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(tb, 'tr'), 'td', { + 'class' : 'mceToolbar ' + (s['theme_maarch_container_' + c + '_class'] || dc) + ' ' + a || da + }); + + to = cf.createToolbar("toolbar" + i); + t._addControls(v, to); + DOM.setHTML(n, to.renderHTML()); + o.deltaHeight -= s.theme_maarch_row_height; + } + }); + + return ic; + }, + + _addControls : function(v, tb) { + var t = this, s = t.settings, di, cf = t.editor.controlManager; + + if (s.theme_maarch_disable && !t._disabled) { + di = {}; + + each(explode(s.theme_maarch_disable), function(v) { + di[v] = 1; + }); + + t._disabled = di; + } else + di = t._disabled; + + each(explode(v), function(n) { + var c; + + if (di && di[n]) + return; + + // Compatiblity with 2.x + if (n == 'tablecontrols') { + each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) { + n = t.createControl(n, cf); + + if (n) + tb.add(n); + }); + + return; + } + + c = t.createControl(n, cf); + + if (c) + tb.add(c); + }); + }, + + _addToolbars : function(c, o) { + var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a; + + a = s.theme_maarch_toolbar_align.toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a}); + + if (!ed.getParam('accessibility_focus')) + h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->')); + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("maarch.toolbar_focus")}, '<!-- IE -->')); + + // Create toolbar and add the controls + for (i=1; (v = s['theme_maarch_buttons' + i]); i++) { + tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); + + if (s['theme_maarch_buttons' + i + '_add']) + v += ',' + s['theme_maarch_buttons' + i + '_add']; + + if (s['theme_maarch_buttons' + i + '_add_before']) + v = s['theme_maarch_buttons' + i + '_add_before'] + ',' + v; + + t._addControls(v, tb); + + //n.appendChild(n = tb.render()); + h.push(tb.renderHTML()); + + o.deltaHeight -= s.theme_maarch_row_height; + } + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("maarch.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->')); + DOM.setHTML(n, h.join('')); + }, + + _addStatusBar : function(tb, o) { + var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td; + + n = DOM.add(tb, 'tr'); + n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); + n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_maarch_path ? ed.translate('maarch.path') + ': ' : ' '); + DOM.add(n, 'a', {href : '#', accesskey : 'x'}); + + if (s.theme_maarch_resizing) { + DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'}); + + if (s.theme_maarch_resizing_use_cookie) { + ed.onPostRender.add(function() { + var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); + + if (!o) + return; + + if (s.theme_maarch_resize_horizontal) + c.style.width = Math.max(10, o.cw) + 'px'; + + c.style.height = Math.max(10, o.ch) + 'px'; + DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px'; + }); + } + + ed.onPostRender.add(function() { + Event.add(ed.id + '_resize', 'mousedown', function(e) { + var c, p, w, h, n, pa; + + // Measure container + c = DOM.get(ed.id + '_tbl'); + w = c.clientWidth; + h = c.clientHeight; + + miw = s.theme_maarch_resizing_min_width || 100; + mih = s.theme_maarch_resizing_min_height || 100; + maw = s.theme_maarch_resizing_max_width || 0xFFFF; + mah = s.theme_maarch_resizing_max_height || 0xFFFF; + + // Setup placeholder + p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'}); + DOM.setStyles(p, {width : w, height : h}); + + // Replace with placeholder + DOM.hide(c); + DOM.show(p); + + // Create internal resize obj + r = { + x : e.screenX, + y : e.screenY, + w : w, + h : h, + dx : null, + dy : null + }; + + // Start listening + mf = Event.add(DOM.doc, 'mousemove', function(e) { + var w, h; + + // Calc delta values + r.dx = e.screenX - r.x; + r.dy = e.screenY - r.y; + + // Boundery fix box + w = Math.max(miw, r.w + r.dx); + h = Math.max(mih, r.h + r.dy); + w = Math.min(maw, w); + h = Math.min(mah, h); + + // Resize placeholder + if (s.theme_maarch_resize_horizontal) + p.style.width = w + 'px'; + + p.style.height = h + 'px'; + + return Event.cancel(e); + }); + + me = Event.add(DOM.doc, 'mouseup', function(e) { + var ifr; + + // Stop listening + Event.remove(DOM.doc, 'mousemove', mf); + Event.remove(DOM.doc, 'mouseup', me); + + c.style.display = ''; + DOM.remove(p); + + if (r.dx === null) + return; + + ifr = DOM.get(ed.id + '_ifr'); + + if (s.theme_maarch_resize_horizontal) + c.style.width = Math.max(10, r.w + r.dx) + 'px'; + + c.style.height = Math.max(10, r.h + r.dy) + 'px'; + ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px'; + + if (s.theme_maarch_resizing_use_cookie) { + Cookie.setHash("TinyMCE_" + ed.id + "_size", { + cw : r.w + r.dx, + ch : r.h + r.dy + }); + } + }); + + return Event.cancel(e); + }); + }); + } + + o.deltaHeight -= 21; + n = tb = null; + }, + + _nodeChanged : function(ed, cm, n, co) { + var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn; + + if (s.readonly) + return; + + tinymce.each(t.stateControls, function(c) { + cm.setActive(c, ed.queryCommandState(t.controls[c][1])); + }); + + cm.setActive('visualaid', ed.hasVisual); + cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); + cm.setDisabled('redo', !ed.undoManager.hasRedo()); + cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); + + p = DOM.getParent(n, 'A'); + if (c = cm.get('link')) { + if (!p || !p.name) { + c.setDisabled(!p && co); + c.setActive(!!p); + } + } + + if (c = cm.get('unlink')) { + c.setDisabled(!p && co); + c.setActive(!!p && !p.name); + } + + if (c = cm.get('anchor')) { + c.setActive(!!p && p.name); + + if (tinymce.isWebKit) { + p = DOM.getParent(n, 'IMG'); + c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a'); + } + } + + p = DOM.getParent(n, 'IMG'); + if (c = cm.get('image')) + c.setActive(!!p && n.className.indexOf('mceItem') == -1); + + if (c = cm.get('styleselect')) { + if (n.className) { + t._importClasses(); + c.select(n.className); + } else + c.select(); + } + + if (c = cm.get('formatselect')) { + p = DOM.getParent(n, DOM.isBlock); + + if (p) + c.select(p.nodeName.toLowerCase()); + } + + if (ed.settings.convert_fonts_to_spans) { + ed.dom.getParent(n, function(n) { + if (n.nodeName === 'SPAN') { + if (!cl && n.className) + cl = n.className; + + if (!fz && n.style.fontSize) + fz = n.style.fontSize; + + if (!fn && n.style.fontFamily) + fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase(); + } + + return false; + }); + + if (c = cm.get('fontselect')) { + c.select(function(v) { + return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn; + }); + } + + if (c = cm.get('fontsizeselect')) { + c.select(function(v) { + if (v.fontSize && v.fontSize === fz) + return true; + + if (v['class'] && v['class'] === cl) + return true; + }); + } + } else { + if (c = cm.get('fontselect')) + c.select(ed.queryCommandValue('FontName')); + + if (c = cm.get('fontsizeselect')) { + v = ed.queryCommandValue('FontSize'); + c.select(function(iv) { + return iv.fontSize == v; + }); + } + } + + if (s.theme_maarch_path && s.theme_maarch_statusbar_location) { + p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); + DOM.setHTML(p, ''); + + ed.dom.getParent(n, function(n) { + var na = n.nodeName.toLowerCase(), u, pi, ti = ''; + + // Ignore non element and hidden elements + if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) + return; + + // Fake name + if (v = DOM.getAttrib(n, 'mce_name')) + na = v; + + // Handle prefix + if (tinymce.isIE && n.scopeName !== 'HTML') + na = n.scopeName + ':' + na; + + // Remove internal prefix + na = na.replace(/mce\:/g, ''); + + // Handle node name + switch (na) { + case 'b': + na = 'strong'; + break; + + case 'i': + na = 'em'; + break; + + case 'img': + if (v = DOM.getAttrib(n, 'src')) + ti += 'src: ' + v + ' '; + + break; + + case 'a': + if (v = DOM.getAttrib(n, 'name')) { + ti += 'name: ' + v + ' '; + na += '#' + v; + } + + if (v = DOM.getAttrib(n, 'href')) + ti += 'href: ' + v + ' '; + + break; + + case 'font': + if (s.convert_fonts_to_spans) + na = 'span'; + + if (v = DOM.getAttrib(n, 'face')) + ti += 'font: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'size')) + ti += 'size: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'color')) + ti += 'color: ' + v + ' '; + + break; + + case 'span': + if (v = DOM.getAttrib(n, 'style')) + ti += 'style: ' + v + ' '; + + break; + } + + if (v = DOM.getAttrib(n, 'id')) + ti += 'id: ' + v + ' '; + + if (v = n.className) { + v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, ''); + + if (v && v.indexOf('mceItem') == -1) { + ti += 'class: ' + v + ' '; + + if (DOM.isBlock(n) || na == 'img' || na == 'span') + na += '.' + v; + } + } + + na = na.replace(/(html:)/g, ''); + na = {name : na, node : n, title : ti}; + t.onResolveName.dispatch(t, na); + ti = na.title; + na = na.name; + + //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');"; + pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na); + + if (p.hasChildNodes()) { + p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild); + p.insertBefore(pi, p.firstChild); + } else + p.appendChild(pi); + }, ed.getBody()); + } + }, + + // Commands gets called by execCommand + + _sel : function(v) { + this.editor.execCommand('mceSelectNodeDepth', false, v); + }, + + _mceInsertAnchor : function(ui, v) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/maarch/anchor.htm', + width : 320 + parseInt(ed.getLang('maarch.anchor_delta_width', 0)), + height : 90 + parseInt(ed.getLang('maarch.anchor_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceCharMap : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/maarch/charmap.htm', + width : 550 + parseInt(ed.getLang('maarch.charmap_delta_width', 0)), + height : 250 + parseInt(ed.getLang('maarch.charmap_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceHelp : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/maarch/about.htm', + width : 480, + height : 380, + inline : true + }, { + theme_url : this.url + }); + }, + + _mceColorPicker : function(u, v) { + var ed = this.editor; + + v = v || {}; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/maarch/color_picker.htm', + width : 375 + parseInt(ed.getLang('maarch.colorpicker_delta_width', 0)), + height : 250 + parseInt(ed.getLang('maarch.colorpicker_delta_height', 0)), + close_previous : false, + inline : true + }, { + input_color : v.color, + func : v.func, + theme_url : this.url + }); + }, + + _mceCodeEditor : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/maarch/source_editor.htm', + width : parseInt(ed.getParam("theme_maarch_source_editor_width", 720)), + height : parseInt(ed.getParam("theme_maarch_source_editor_height", 580)), + inline : true, + resizable : true, + maximizable : true + }, { + theme_url : this.url + }); + }, + + _mceImage : function(ui, val) { + var ed = this.editor; + + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/maarch/image.htm', + width : 355 + parseInt(ed.getLang('maarch.image_delta_width', 0)), + height : 275 + parseInt(ed.getLang('maarch.image_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceLink : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/maarch/link.htm', + width : 310 + parseInt(ed.getLang('maarch.link_delta_width', 0)), + height : 200 + parseInt(ed.getLang('maarch.link_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceNewDocument : function() { + var ed = this.editor; + + ed.windowManager.confirm('maarch.newdocument', function(s) { + if (s) + ed.execCommand('mceSetContent', false, ''); + }); + }, + + _mceForeColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.fgColor, + func : function(co) { + t.fgColor = co; + t.editor.execCommand('ForeColor', false, co); + } + }); + }, + + _mceBackColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.bgColor, + func : function(co) { + t.bgColor = co; + t.editor.execCommand('HiliteColor', false, co); + } + }); + }, + + _ufirst : function(s) { + return s.substring(0, 1).toUpperCase() + s.substring(1); + } + }); + + tinymce.ThemeManager.add('maarch', tinymce.themes.MaarchTheme); +}(tinymce)); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/editor_template_src_origin.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/editor_template_src_origin.js new file mode 100644 index 0000000000000000000000000000000000000000..628c793cc7961c7e22d2e1c04940aa2bf66f7132 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/editor_template_src_origin.js @@ -0,0 +1 @@ +(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";if(j.settings.convert_fonts_to_spans){o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){j.onNodeChange.add(l._nodeChanged,l);if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(j){var i=this.editor,k=i.controlManager.get("styleselect");if(k.getLength()==0){f(i.dom.getClasses(),function(l){k.add(l["class"],l["class"])})}},_createStyleSelect:function(m){var j=this,i=j.editor,k=i.controlManager,l=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){if(l.selectedValue===n){i.execCommand("mceSetStyleInfo",0,{command:"removeformat"});l.select();return false}else{i.execCommand("mceSetCSSClass",0,n)}}});if(l){f(i.getParam("theme_advanced_styles","","hash"),function(o,n){if(o){l.add(j.editor.translate(n),o)}});l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",j._importClasses,j);b.add(p.id+"_text","mousedown",j._importClasses,j);b.add(p.id+"_open","focus",j._importClasses,j);b.add(p.id+"_open","mousedown",j._importClasses,j)}else{b.add(p.id,"focus",j._importClasses,j)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",cmd:"FontName"});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr"),m;i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);m=n.clientHeight-o.clientHeight;d.setStyle(o,"height",l-m);d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":" ");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}if(w.theme_advanced_resize_horizontal){r.style.width=Math.max(10,n.cw)+"px"}r.style.height=Math.max(10,n.ch)+"px";d.get(p.id+"_ifr").style.height=Math.max(10,parseInt(n.ch)+v.deltaHeight)+"px"})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(x){var z,t,o,s,y,r;z=d.get(p.id+"_tbl");o=z.clientWidth;s=z.clientHeight;miw=w.theme_advanced_resizing_min_width||100;mih=w.theme_advanced_resizing_min_height||100;maw=w.theme_advanced_resizing_max_width||65535;mah=w.theme_advanced_resizing_max_height||65535;t=d.add(d.get(p.id+"_parent"),"div",{"class":"mcePlaceHolder"});d.setStyles(t,{width:o,height:s});d.hide(z);d.show(t);i={x:x.screenX,y:x.screenY,w:o,h:s,dx:null,dy:null};q=b.add(d.doc,"mousemove",function(B){var n,A;i.dx=B.screenX-i.x;i.dy=B.screenY-i.y;n=Math.max(miw,i.w+i.dx);A=Math.max(mih,i.h+i.dy);n=Math.min(maw,n);A=Math.min(mah,A);if(w.theme_advanced_resize_horizontal){t.style.width=n+"px"}t.style.height=A+"px";return b.cancel(B)});u=b.add(d.doc,"mouseup",function(n){var A;b.remove(d.doc,"mousemove",q);b.remove(d.doc,"mouseup",u);z.style.display="";d.remove(t);if(i.dx===null){return}A=d.get(p.id+"_ifr");if(w.theme_advanced_resize_horizontal){z.style.width=Math.max(10,i.w+i.dx)+"px"}z.style.height=Math.max(10,i.h+i.dy)+"px";A.style.height=Math.max(10,A.clientHeight+i.dy)+"px";if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:i.w+i.dx,ch:i.h+i.dy})}});return b.cancel(x)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(l,u,k,q){var y=this,i,r=0,x,m,z=y.settings,w,j,o;if(z.readonly){return}e.each(y.stateControls,function(n){u.setActive(n,l.queryCommandState(y.controls[n][1]))});u.setActive("visualaid",l.hasVisual);u.setDisabled("undo",!l.undoManager.hasUndo()&&!l.typing);u.setDisabled("redo",!l.undoManager.hasRedo());u.setDisabled("outdent",!l.queryCommandState("Outdent"));i=d.getParent(k,"A");if(m=u.get("link")){if(!i||!i.name){m.setDisabled(!i&&q);m.setActive(!!i)}}if(m=u.get("unlink")){m.setDisabled(!i&&q);m.setActive(!!i&&!i.name)}if(m=u.get("anchor")){m.setActive(!!i&&i.name);if(e.isWebKit){i=d.getParent(k,"IMG");m.setActive(!!i&&d.getAttrib(i,"mce_name")=="a")}}i=d.getParent(k,"IMG");if(m=u.get("image")){m.setActive(!!i&&k.className.indexOf("mceItem")==-1)}if(m=u.get("styleselect")){if(k.className){y._importClasses();m.select(k.className)}else{m.select()}}if(m=u.get("formatselect")){i=d.getParent(k,d.isBlock);if(i){m.select(i.nodeName.toLowerCase())}}if(l.settings.convert_fonts_to_spans){l.dom.getParent(k,function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}if(!j&&p.style.fontSize){j=p.style.fontSize}if(!o&&p.style.fontFamily){o=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(m=u.get("fontselect")){m.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==o})}if(m=u.get("fontsizeselect")){m.select(function(n){if(n.fontSize&&n.fontSize===j){return true}if(n["class"]&&n["class"]===w){return true}})}}else{if(m=u.get("fontselect")){m.select(l.queryCommandValue("FontName"))}if(m=u.get("fontsizeselect")){x=l.queryCommandValue("FontSize");m.select(function(n){return n.fontSize==x})}}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){i=d.get(l.id+"_path")||d.add(l.id+"_path_row","span",{id:l.id+"_path"});d.setHTML(i,"");l.dom.getParent(k,function(A){var p=A.nodeName.toLowerCase(),s,v,t="";if(A.nodeType!=1||A.nodeName==="BR"||(d.hasClass(A,"mceItemHidden")||d.hasClass(A,"mceItemRemoved"))){return}if(x=d.getAttrib(A,"mce_name")){p=x}if(e.isIE&&A.scopeName!=="HTML"){p=A.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(A,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(A,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(A,"href")){t+="href: "+x+" "}break;case"font":if(z.convert_fonts_to_spans){p="span"}if(x=d.getAttrib(A,"face")){t+="font: "+x+" "}if(x=d.getAttrib(A,"size")){t+="size: "+x+" "}if(x=d.getAttrib(A,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(A,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(A,"id")){t+="id: "+x+" "}if(x=A.className){x=x.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,"");if(x&&x.indexOf("mceItem")==-1){t+="class: "+x+" ";if(d.isBlock(A)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:A,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(r++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},l.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce)); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/image.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/image.htm new file mode 100644 index 0000000000000000000000000000000000000000..7ec1052ba54a6813ce9ddb4820037bca3fb10680 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/image.htm @@ -0,0 +1,85 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.image_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="js/image.js"></script> +</head> +<body id="image" style="display: none"> +<form onsubmit="ImageDialog.update();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.image_title}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td> + <td><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td> + <td id="srcbrowsercontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td><label for="image_list">{#advanced_dlg.image_list}</label></td> + <td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td> + </tr> + <tr> + <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td> + <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td> + </tr> + <tr> + <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td> + <td><select id="align" name="align" onchange="ImageDialog.updateStyle();"> + <option value="">{#not_set}</option> + <option value="baseline">{#advanced_dlg.image_align_baseline}</option> + <option value="top">{#advanced_dlg.image_align_top}</option> + <option value="middle">{#advanced_dlg.image_align_middle}</option> + <option value="bottom">{#advanced_dlg.image_align_bottom}</option> + <option value="text-top">{#advanced_dlg.image_align_texttop}</option> + <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option> + <option value="left">{#advanced_dlg.image_align_left}</option> + <option value="right">{#advanced_dlg.image_align_right}</option> + </select></td> + </tr> + <tr> + <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td> + <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" /> + x + <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td> + </tr> + <tr> + <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td> + <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> + </tr> + <tr> + <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td> + <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> + </tr> + <tr> + <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td> + <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> + </tr> + </table> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/img/colorpicker.jpg b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/img/colorpicker.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b4c542d107b25f68a9d4f9d7a109d0565d1f1437 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/img/colorpicker.jpg differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/img/icons.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/img/icons.gif new file mode 100644 index 0000000000000000000000000000000000000000..ccac36f54d983cc33a0a6e45134e3dabf1820367 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/img/icons.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/about.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/about.js new file mode 100644 index 0000000000000000000000000000000000000000..5cee9ed863cdb6ffaf6cc44979375c1beb9cd920 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/about.js @@ -0,0 +1,72 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + var ed, tcont; + + tinyMCEPopup.resizeToInnerSize(); + ed = tinyMCEPopup.editor; + + // Give FF some time + window.setTimeout(insertHelpIFrame, 10); + + tcont = document.getElementById('plugintablecontainer'); + document.getElementById('plugins_tab').style.display = 'none'; + + var html = ""; + html += '<table id="plugintable">'; + html += '<thead>'; + html += '<tr>'; + html += '<td>' + ed.getLang('advanced_dlg.about_plugin') + '</td>'; + html += '<td>' + ed.getLang('advanced_dlg.about_author') + '</td>'; + html += '<td>' + ed.getLang('advanced_dlg.about_version') + '</td>'; + html += '</tr>'; + html += '</thead>'; + html += '<tbody>'; + + tinymce.each(ed.plugins, function(p, n) { + var info; + + if (!p.getInfo) + return; + + html += '<tr>'; + + info = p.getInfo(); + + if (info.infourl != null && info.infourl != '') + html += '<td width="50%" title="' + n + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>'; + else + html += '<td width="50%" title="' + n + '">' + info.longname + '</td>'; + + if (info.authorurl != null && info.authorurl != '') + html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>'; + else + html += '<td width="35%">' + info.author + '</td>'; + + html += '<td width="15%">' + info.version + '</td>'; + html += '</tr>'; + + document.getElementById('plugins_tab').style.display = ''; + + }); + + html += '</tbody>'; + html += '</table>'; + + tcont.innerHTML = html; + + tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; + tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate; +} + +function insertHelpIFrame() { + var html; + + if (tinyMCEPopup.getParam('docs_url')) { + html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>'; + document.getElementById('iframecontainer').innerHTML = html; + document.getElementById('help_tab').style.display = 'block'; + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/anchor.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/anchor.js new file mode 100644 index 0000000000000000000000000000000000000000..b5efd1ec9736d60bdd261cdde9987f15e4d095c2 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/anchor.js @@ -0,0 +1,37 @@ +tinyMCEPopup.requireLangPack(); + +var AnchorDialog = { + init : function(ed) { + var action, elm, f = document.forms[0]; + + this.editor = ed; + elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG'); + v = ed.dom.getAttrib(elm, 'name'); + + if (v) { + this.action = 'update'; + f.anchorName.value = v; + } + + f.insert.value = ed.getLang(elm ? 'update' : 'insert'); + }, + + update : function() { + var ed = this.editor; + + tinyMCEPopup.restoreSelection(); + + if (this.action != 'update') + ed.selection.collapse(1); + + // Webkit acts weird if empty inline element is inserted so we need to use a image instead + if (tinymce.isWebKit) + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'})); + else + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, '')); + + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/charmap.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/charmap.js new file mode 100644 index 0000000000000000000000000000000000000000..8467ef60366b6fcdc3f9d6471ef88337eaa49ed0 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/charmap.js @@ -0,0 +1,325 @@ +tinyMCEPopup.requireLangPack(); + +var charmap = [ + [' ', ' ', true, 'no-break space'], + ['&', '&', true, 'ampersand'], + ['"', '"', true, 'quotation mark'], +// finance + ['¢', '¢', true, 'cent sign'], + ['€', '€', true, 'euro sign'], + ['£', '£', true, 'pound sign'], + ['¥', '¥', true, 'yen sign'], +// signs + ['©', '©', true, 'copyright sign'], + ['®', '®', true, 'registered sign'], + ['™', '™', true, 'trade mark sign'], + ['‰', '‰', true, 'per mille sign'], + ['µ', 'µ', true, 'micro sign'], + ['·', '·', true, 'middle dot'], + ['•', '•', true, 'bullet'], + ['…', '…', true, 'three dot leader'], + ['′', '′', true, 'minutes / feet'], + ['″', '″', true, 'seconds / inches'], + ['§', '§', true, 'section sign'], + ['¶', '¶', true, 'paragraph sign'], + ['ß', 'ß', true, 'sharp s / ess-zed'], +// quotations + ['‹', '‹', true, 'single left-pointing angle quotation mark'], + ['›', '›', true, 'single right-pointing angle quotation mark'], + ['«', '«', true, 'left pointing guillemet'], + ['»', '»', true, 'right pointing guillemet'], + ['‘', '‘', true, 'left single quotation mark'], + ['’', '’', true, 'right single quotation mark'], + ['“', '“', true, 'left double quotation mark'], + ['”', '”', true, 'right double quotation mark'], + ['‚', '‚', true, 'single low-9 quotation mark'], + ['„', '„', true, 'double low-9 quotation mark'], + ['<', '<', true, 'less-than sign'], + ['>', '>', true, 'greater-than sign'], + ['≤', '≤', true, 'less-than or equal to'], + ['≥', '≥', true, 'greater-than or equal to'], + ['–', '–', true, 'en dash'], + ['—', '—', true, 'em dash'], + ['¯', '¯', true, 'macron'], + ['‾', '‾', true, 'overline'], + ['¤', '¤', true, 'currency sign'], + ['¦', '¦', true, 'broken bar'], + ['¨', '¨', true, 'diaeresis'], + ['¡', '¡', true, 'inverted exclamation mark'], + ['¿', '¿', true, 'turned question mark'], + ['ˆ', 'ˆ', true, 'circumflex accent'], + ['˜', '˜', true, 'small tilde'], + ['°', '°', true, 'degree sign'], + ['−', '−', true, 'minus sign'], + ['±', '±', true, 'plus-minus sign'], + ['÷', '÷', true, 'division sign'], + ['⁄', '⁄', true, 'fraction slash'], + ['×', '×', true, 'multiplication sign'], + ['¹', '¹', true, 'superscript one'], + ['²', '²', true, 'superscript two'], + ['³', '³', true, 'superscript three'], + ['¼', '¼', true, 'fraction one quarter'], + ['½', '½', true, 'fraction one half'], + ['¾', '¾', true, 'fraction three quarters'], +// math / logical + ['ƒ', 'ƒ', true, 'function / florin'], + ['∫', '∫', true, 'integral'], + ['∑', '∑', true, 'n-ary sumation'], + ['∞', '∞', true, 'infinity'], + ['√', '√', true, 'square root'], + ['∼', '∼', false,'similar to'], + ['≅', '≅', false,'approximately equal to'], + ['≈', '≈', true, 'almost equal to'], + ['≠', '≠', true, 'not equal to'], + ['≡', '≡', true, 'identical to'], + ['∈', '∈', false,'element of'], + ['∉', '∉', false,'not an element of'], + ['∋', '∋', false,'contains as member'], + ['∏', '∏', true, 'n-ary product'], + ['∧', '∧', false,'logical and'], + ['∨', '∨', false,'logical or'], + ['¬', '¬', true, 'not sign'], + ['∩', '∩', true, 'intersection'], + ['∪', '∪', false,'union'], + ['∂', '∂', true, 'partial differential'], + ['∀', '∀', false,'for all'], + ['∃', '∃', false,'there exists'], + ['∅', '∅', false,'diameter'], + ['∇', '∇', false,'backward difference'], + ['∗', '∗', false,'asterisk operator'], + ['∝', '∝', false,'proportional to'], + ['∠', '∠', false,'angle'], +// undefined + ['´', '´', true, 'acute accent'], + ['¸', '¸', true, 'cedilla'], + ['ª', 'ª', true, 'feminine ordinal indicator'], + ['º', 'º', true, 'masculine ordinal indicator'], + ['†', '†', true, 'dagger'], + ['‡', '‡', true, 'double dagger'], +// alphabetical special chars + ['À', 'À', true, 'A - grave'], + ['Á', 'Á', true, 'A - acute'], + ['Â', 'Â', true, 'A - circumflex'], + ['Ã', 'Ã', true, 'A - tilde'], + ['Ä', 'Ä', true, 'A - diaeresis'], + ['Å', 'Å', true, 'A - ring above'], + ['Æ', 'Æ', true, 'ligature AE'], + ['Ç', 'Ç', true, 'C - cedilla'], + ['È', 'È', true, 'E - grave'], + ['É', 'É', true, 'E - acute'], + ['Ê', 'Ê', true, 'E - circumflex'], + ['Ë', 'Ë', true, 'E - diaeresis'], + ['Ì', 'Ì', true, 'I - grave'], + ['Í', 'Í', true, 'I - acute'], + ['Î', 'Î', true, 'I - circumflex'], + ['Ï', 'Ï', true, 'I - diaeresis'], + ['Ð', 'Ð', true, 'ETH'], + ['Ñ', 'Ñ', true, 'N - tilde'], + ['Ò', 'Ò', true, 'O - grave'], + ['Ó', 'Ó', true, 'O - acute'], + ['Ô', 'Ô', true, 'O - circumflex'], + ['Õ', 'Õ', true, 'O - tilde'], + ['Ö', 'Ö', true, 'O - diaeresis'], + ['Ø', 'Ø', true, 'O - slash'], + ['Œ', 'Œ', true, 'ligature OE'], + ['Š', 'Š', true, 'S - caron'], + ['Ù', 'Ù', true, 'U - grave'], + ['Ú', 'Ú', true, 'U - acute'], + ['Û', 'Û', true, 'U - circumflex'], + ['Ü', 'Ü', true, 'U - diaeresis'], + ['Ý', 'Ý', true, 'Y - acute'], + ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], + ['Þ', 'Þ', true, 'THORN'], + ['à', 'à', true, 'a - grave'], + ['á', 'á', true, 'a - acute'], + ['â', 'â', true, 'a - circumflex'], + ['ã', 'ã', true, 'a - tilde'], + ['ä', 'ä', true, 'a - diaeresis'], + ['å', 'å', true, 'a - ring above'], + ['æ', 'æ', true, 'ligature ae'], + ['ç', 'ç', true, 'c - cedilla'], + ['è', 'è', true, 'e - grave'], + ['é', 'é', true, 'e - acute'], + ['ê', 'ê', true, 'e - circumflex'], + ['ë', 'ë', true, 'e - diaeresis'], + ['ì', 'ì', true, 'i - grave'], + ['í', 'í', true, 'i - acute'], + ['î', 'î', true, 'i - circumflex'], + ['ï', 'ï', true, 'i - diaeresis'], + ['ð', 'ð', true, 'eth'], + ['ñ', 'ñ', true, 'n - tilde'], + ['ò', 'ò', true, 'o - grave'], + ['ó', 'ó', true, 'o - acute'], + ['ô', 'ô', true, 'o - circumflex'], + ['õ', 'õ', true, 'o - tilde'], + ['ö', 'ö', true, 'o - diaeresis'], + ['ø', 'ø', true, 'o slash'], + ['œ', 'œ', true, 'ligature oe'], + ['š', 'š', true, 's - caron'], + ['ù', 'ù', true, 'u - grave'], + ['ú', 'ú', true, 'u - acute'], + ['û', 'û', true, 'u - circumflex'], + ['ü', 'ü', true, 'u - diaeresis'], + ['ý', 'ý', true, 'y - acute'], + ['þ', 'þ', true, 'thorn'], + ['ÿ', 'ÿ', true, 'y - diaeresis'], + ['Α', 'Α', true, 'Alpha'], + ['Β', 'Β', true, 'Beta'], + ['Γ', 'Γ', true, 'Gamma'], + ['Δ', 'Δ', true, 'Delta'], + ['Ε', 'Ε', true, 'Epsilon'], + ['Ζ', 'Ζ', true, 'Zeta'], + ['Η', 'Η', true, 'Eta'], + ['Θ', 'Θ', true, 'Theta'], + ['Ι', 'Ι', true, 'Iota'], + ['Κ', 'Κ', true, 'Kappa'], + ['Λ', 'Λ', true, 'Lambda'], + ['Μ', 'Μ', true, 'Mu'], + ['Ν', 'Ν', true, 'Nu'], + ['Ξ', 'Ξ', true, 'Xi'], + ['Ο', 'Ο', true, 'Omicron'], + ['Π', 'Π', true, 'Pi'], + ['Ρ', 'Ρ', true, 'Rho'], + ['Σ', 'Σ', true, 'Sigma'], + ['Τ', 'Τ', true, 'Tau'], + ['Υ', 'Υ', true, 'Upsilon'], + ['Φ', 'Φ', true, 'Phi'], + ['Χ', 'Χ', true, 'Chi'], + ['Ψ', 'Ψ', true, 'Psi'], + ['Ω', 'Ω', true, 'Omega'], + ['α', 'α', true, 'alpha'], + ['β', 'β', true, 'beta'], + ['γ', 'γ', true, 'gamma'], + ['δ', 'δ', true, 'delta'], + ['ε', 'ε', true, 'epsilon'], + ['ζ', 'ζ', true, 'zeta'], + ['η', 'η', true, 'eta'], + ['θ', 'θ', true, 'theta'], + ['ι', 'ι', true, 'iota'], + ['κ', 'κ', true, 'kappa'], + ['λ', 'λ', true, 'lambda'], + ['μ', 'μ', true, 'mu'], + ['ν', 'ν', true, 'nu'], + ['ξ', 'ξ', true, 'xi'], + ['ο', 'ο', true, 'omicron'], + ['π', 'π', true, 'pi'], + ['ρ', 'ρ', true, 'rho'], + ['ς', 'ς', true, 'final sigma'], + ['σ', 'σ', true, 'sigma'], + ['τ', 'τ', true, 'tau'], + ['υ', 'υ', true, 'upsilon'], + ['φ', 'φ', true, 'phi'], + ['χ', 'χ', true, 'chi'], + ['ψ', 'ψ', true, 'psi'], + ['ω', 'ω', true, 'omega'], +// symbols + ['ℵ', 'ℵ', false,'alef symbol'], + ['ϖ', 'ϖ', false,'pi symbol'], + ['ℜ', 'ℜ', false,'real part symbol'], + ['ϑ','ϑ', false,'theta symbol'], + ['ϒ', 'ϒ', false,'upsilon - hook symbol'], + ['℘', '℘', false,'Weierstrass p'], + ['ℑ', 'ℑ', false,'imaginary part'], +// arrows + ['←', '←', true, 'leftwards arrow'], + ['↑', '↑', true, 'upwards arrow'], + ['→', '→', true, 'rightwards arrow'], + ['↓', '↓', true, 'downwards arrow'], + ['↔', '↔', true, 'left right arrow'], + ['↵', '↵', false,'carriage return'], + ['⇐', '⇐', false,'leftwards double arrow'], + ['⇑', '⇑', false,'upwards double arrow'], + ['⇒', '⇒', false,'rightwards double arrow'], + ['⇓', '⇓', false,'downwards double arrow'], + ['⇔', '⇔', false,'left right double arrow'], + ['∴', '∴', false,'therefore'], + ['⊂', '⊂', false,'subset of'], + ['⊃', '⊃', false,'superset of'], + ['⊄', '⊄', false,'not a subset of'], + ['⊆', '⊆', false,'subset of or equal to'], + ['⊇', '⊇', false,'superset of or equal to'], + ['⊕', '⊕', false,'circled plus'], + ['⊗', '⊗', false,'circled times'], + ['⊥', '⊥', false,'perpendicular'], + ['⋅', '⋅', false,'dot operator'], + ['⌈', '⌈', false,'left ceiling'], + ['⌉', '⌉', false,'right ceiling'], + ['⌊', '⌊', false,'left floor'], + ['⌋', '⌋', false,'right floor'], + ['⟨', '〈', false,'left-pointing angle bracket'], + ['⟩', '〉', false,'right-pointing angle bracket'], + ['◊', '◊', true,'lozenge'], + ['♠', '♠', false,'black spade suit'], + ['♣', '♣', true, 'black club suit'], + ['♥', '♥', true, 'black heart suit'], + ['♦', '♦', true, 'black diamond suit'], + [' ', ' ', false,'en space'], + [' ', ' ', false,'em space'], + [' ', ' ', false,'thin space'], + ['‌', '‌', false,'zero width non-joiner'], + ['‍', '‍', false,'zero width joiner'], + ['‎', '‎', false,'left-to-right mark'], + ['‏', '‏', false,'right-to-left mark'], + ['­', '­', false,'soft hyphen'] +]; + +tinyMCEPopup.onInit.add(function() { + tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML()); +}); + +function renderCharMapHTML() { + var charsPerRow = 20, tdWidth=20, tdHeight=20, i; + var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">'; + var cols=-1; + + for (i=0; i<charmap.length; i++) { + if (charmap[i][2]==true) { + cols++; + html += '' + + '<td class="charmap">' + + '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">' + + charmap[i][1] + + '</a></td>'; + if ((cols+1) % charsPerRow == 0) + html += '</tr><tr height="' + tdHeight + '">'; + } + } + + if (cols % charsPerRow > 0) { + var padd = charsPerRow - (cols % charsPerRow); + for (var i=0; i<padd-1; i++) + html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"> </td>'; + } + + html += '</tr></table>'; + + return html; +} + +function insertChar(chr) { + tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';'); + + // Refocus in window + if (tinyMCEPopup.isWindow) + window.focus(); + + tinyMCEPopup.editor.focus(); + tinyMCEPopup.close(); +} + +function previewChar(codeA, codeB, codeN) { + var elmA = document.getElementById('codeA'); + var elmB = document.getElementById('codeB'); + var elmV = document.getElementById('codeV'); + var elmN = document.getElementById('codeN'); + + if (codeA=='#160;') { + elmV.innerHTML = '__'; + } else { + elmV.innerHTML = '&' + codeA; + } + + elmB.innerHTML = '&' + codeA; + elmA.innerHTML = '&' + codeB; + elmN.innerHTML = codeN; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/color_picker.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/color_picker.js new file mode 100644 index 0000000000000000000000000000000000000000..fd9700f2224320b9ab6a252c19e6c54fa018fee6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/color_picker.js @@ -0,0 +1,253 @@ +tinyMCEPopup.requireLangPack(); + +var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; + +var colors = [ + "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", + "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", + "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", + "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", + "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", + "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", + "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", + "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", + "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", + "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", + "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", + "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", + "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", + "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", + "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", + "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", + "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", + "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", + "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", + "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", + "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", + "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", + "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", + "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", + "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", + "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", + "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" +]; + +var named = { + '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', + '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', + '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', + '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', + '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', + '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', + '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', + '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', + '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', + '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', + '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', + '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', + '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', + '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', + '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', + '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', + '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', + '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', + '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', + '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', + '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', + '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', + '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' +}; + +function init() { + var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')); + + tinyMCEPopup.resizeToInnerSize(); + + generatePicker(); + + if (inputColor) { + changeFinalColor(inputColor); + + col = convertHexToRGB(inputColor); + + if (col) + updateLight(col.r, col.g, col.b); + } +} + +function insertAction() { + var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); + + tinyMCEPopup.restoreSelection(); + + if (f) + f(color); + + tinyMCEPopup.close(); +} + +function showColor(color, name) { + if (name) + document.getElementById("colorname").innerHTML = name; + + document.getElementById("preview").style.backgroundColor = color; + document.getElementById("color").value = color.toLowerCase(); +} + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + if (!col) + return col; + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return {r : r, g : g, b : b}; + } + + return null; +} + +function generatePicker() { + var el = document.getElementById('light'), h = '', i; + + for (i = 0; i < detail; i++){ + h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"' + + ' onclick="changeFinalColor(this.style.backgroundColor)"' + + ' onmousedown="isMouseDown = true; return false;"' + + ' onmouseup="isMouseDown = false;"' + + ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"' + + ' onmouseover="isMouseOver = true;"' + + ' onmouseout="isMouseOver = false;"' + + '></div>'; + } + + el.innerHTML = h; +} + +function generateWebColors() { + var el = document.getElementById('webcolors'), h = '', i; + + if (el.className == 'generated') + return; + + h += '<table border="0" cellspacing="1" cellpadding="0">' + + '<tr>'; + + for (i=0; i<colors.length; i++) { + h += '<td bgcolor="' + colors[i] + '" width="10" height="10">' + + '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">' + + '</a></td>'; + if ((i+1) % 18 == 0) + h += '</tr><tr>'; + } + + h += '</table>'; + + el.innerHTML = h; + el.className = 'generated'; +} + +function generateNamedColors() { + var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; + + if (el.className == 'generated') + return; + + for (n in named) { + v = named[n]; + h += '<a href="javascript:insertAction();" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>' + } + + el.innerHTML = h; + el.className = 'generated'; +} + +function dechex(n) { + return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); +} + +function computeColor(e) { + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + + partWidth = document.getElementById('colors').width / 6; + partDetail = detail / 2; + imHeight = document.getElementById('colors').height; + + r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; + g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); + b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); + + coef = (imHeight - y) / imHeight; + r = 128 + (r - 128) * coef; + g = 128 + (g - 128) * coef; + b = 128 + (b - 128) * coef; + + changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); + updateLight(r, g, b); +} + +function updateLight(r, g, b) { + var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; + + for (i=0; i<detail; i++) { + if ((i>=0) && (i<partDetail)) { + finalCoef = i / partDetail; + finalR = dechex(255 - (255 - r) * finalCoef); + finalG = dechex(255 - (255 - g) * finalCoef); + finalB = dechex(255 - (255 - b) * finalCoef); + } else { + finalCoef = 2 - i / partDetail; + finalR = dechex(r * finalCoef); + finalG = dechex(g * finalCoef); + finalB = dechex(b * finalCoef); + } + + color = finalR + finalG + finalB; + + setCol('gs' + i, '#'+color); + } +} + +function changeFinalColor(color) { + if (color.indexOf('#') == -1) + color = convertRGBToHex(color); + + setCol('preview', color); + document.getElementById('color').value = color; +} + +function setCol(e, c) { + try { + document.getElementById(e).style.backgroundColor = c; + } catch (ex) { + // Ignore IE warning + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/image.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/image.js new file mode 100644 index 0000000000000000000000000000000000000000..4982ce0c8e04ddff0f65885ffcf77b109797870b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/image.js @@ -0,0 +1,245 @@ +var ImageDialog = { + preInit : function() { + var url; + + tinyMCEPopup.requireLangPack(); + + if (url = tinyMCEPopup.getParam("external_image_list_url")) + document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '180px'; + + e = ed.selection.getNode(); + + this.fillFileList('image_list', 'tinyMCEImageList'); + + if (e.nodeName == 'IMG') { + f.src.value = ed.dom.getAttrib(e, 'src'); + f.alt.value = ed.dom.getAttrib(e, 'alt'); + f.border.value = this.getAttrib(e, 'border'); + f.vspace.value = this.getAttrib(e, 'vspace'); + f.hspace.value = this.getAttrib(e, 'hspace'); + f.width.value = ed.dom.getAttrib(e, 'width'); + f.height.value = ed.dom.getAttrib(e, 'height'); + f.insert.value = ed.getLang('update'); + this.styleVal = ed.dom.getAttrib(e, 'style'); + selectByValue(f, 'image_list', f.src.value); + selectByValue(f, 'align', this.getAttrib(e, 'align')); + this.updateStyle(); + } + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + update : function() { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (!ed.settings.inline_styles) { + args = tinymce.extend(args, { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }); + } else + args.style = this.styleVal; + + tinymce.extend(args, { + src : f.src.value, + alt : f.alt.value, + width : f.width.value, + height : f.height.value + }); + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + updateStyle : function() { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; + + if (tinyMCEPopup.editor.settings.inline_styles) { + st = tinyMCEPopup.dom.parseStyle(this.styleVal); + + // Handle align + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') { + st['float'] = v; + delete st['vertical-align']; + } else { + st['vertical-align'] = v; + delete st['float']; + } + } else { + delete st['float']; + delete st['vertical-align']; + } + + // Handle border + v = f.border.value; + if (v || v == '0') { + if (v == '0') + st['border'] = '0'; + else + st['border'] = v + 'px solid black'; + } else + delete st['border']; + + // Handle hspace + v = f.hspace.value; + if (v) { + delete st['margin']; + st['margin-left'] = v + 'px'; + st['margin-right'] = v + 'px'; + } else { + delete st['margin-left']; + delete st['margin-right']; + } + + // Handle vspace + v = f.vspace.value; + if (v) { + delete st['margin']; + st['margin-top'] = v + 'px'; + st['margin-bottom'] = v + 'px'; + } else { + delete st['margin-top']; + delete st['margin-bottom']; + } + + // Merge + st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st)); + this.styleVal = dom.serializeStyle(st); + } + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ""; + }, + + updateImageData : function() { + var f = document.forms[0], t = ImageDialog; + + if (f.width.value == "") + f.width.value = t.preloadImg.width; + + if (f.height.value == "") + f.height.value = t.preloadImg.height; + }, + + getImageData : function() { + var f = document.forms[0]; + + this.preloadImg = new Image(); + this.preloadImg.onload = this.updateImageData; + this.preloadImg.onerror = this.resetImageData; + this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/link.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/link.js new file mode 100644 index 0000000000000000000000000000000000000000..21aae6cbf88d18f497fe093e95422656365d7a15 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/link.js @@ -0,0 +1,156 @@ +tinyMCEPopup.requireLangPack(); + +var LinkDialog = { + preInit : function() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link'); + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '180px'; + + this.fillClassList('class_list'); + this.fillFileList('link_list', 'tinyMCELinkList'); + this.fillTargetList('target_list'); + + if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) { + f.href.value = ed.dom.getAttrib(e, 'href'); + f.linktitle.value = ed.dom.getAttrib(e, 'title'); + f.insert.value = ed.getLang('update'); + selectByValue(f, 'link_list', f.href.value); + selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target')); + selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); + } + }, + + update : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor, e, b; + + tinyMCEPopup.restoreSelection(); + e = ed.dom.getParent(ed.selection.getNode(), 'A'); + + // Remove element if there is no href + if (!f.href.value) { + if (e) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + b = ed.selection.getBookmark(); + ed.dom.remove(e, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (e == null) { + ed.getDoc().execCommand("unlink", false, null); + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + e = n; + + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + }); + } else { + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + + // Don't move caret if selection was image + if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') { + ed.focus(); + ed.selection.select(e); + ed.selection.collapse(0); + tinyMCEPopup.storeSelection(); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + }, + + checkPrefix : function(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) + n.value = 'http://' + n.value; + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillTargetList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v; + + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); + + if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { + tinymce.each(v.split(','), function(v) { + v = v.split('='); + lst.options[lst.options.length] = new Option(v[0], v[1]); + }); + } + } +}; + +LinkDialog.preInit(); +tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/source_editor.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/source_editor.js new file mode 100644 index 0000000000000000000000000000000000000000..279328614c5ee8a0077295a0ff7814a24d723922 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/js/source_editor.js @@ -0,0 +1,62 @@ +tinyMCEPopup.requireLangPack(); +tinyMCEPopup.onInit.add(onLoadInit); + +function saveContent() { + tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true}); + tinyMCEPopup.close(); +} + +function onLoadInit() { + tinyMCEPopup.resizeToInnerSize(); + + // Remove Gecko spellchecking + if (tinymce.isGecko) + document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); + + document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true}); + + if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { + setWrap('soft'); + document.getElementById('wraped').checked = true; + } + + resizeInputs(); +} + +function setWrap(val) { + var v, n, s = document.getElementById('htmlSource'); + + s.wrap = val; + + if (!tinymce.isIE) { + v = s.value; + n = s.cloneNode(false); + n.setAttribute("wrap", val); + s.parentNode.replaceChild(n, s); + n.value = v; + } +} + +function toggleWordWrap(elm) { + if (elm.checked) + setWrap('soft'); + else + setWrap('off'); +} + +var wHeight=0, wWidth=0, owHeight=0, owWidth=0; + +function resizeInputs() { + var el = document.getElementById('htmlSource'); + + if (!tinymce.isIE) { + wHeight = self.innerHeight - 65; + wWidth = self.innerWidth - 16; + } else { + wHeight = document.body.clientHeight - 70; + wWidth = document.body.clientWidth - 16; + } + + el.style.height = Math.abs(wHeight) + 'px'; + el.style.width = Math.abs(wWidth) + 'px'; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/en.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/en.js new file mode 100644 index 0000000000000000000000000000000000000000..1ff82002f612ddf77570c24f4c222f6a17d2fd58 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/en.js @@ -0,0 +1,62 @@ +tinyMCE.addI18n('en.maarch',{ +style_select:"Styles", +font_size:"Font size", +fontdefault:"Font family", +block:"Format", +paragraph:"Paragraph", +div:"Div", +address:"Address", +pre:"Preformatted", +h1:"Heading 1", +h2:"Heading 2", +h3:"Heading 3", +h4:"Heading 4", +h5:"Heading 5", +h6:"Heading 6", +blockquote:"Blockquote", +code:"Code", +samp:"Code sample", +dt:"Definition term ", +dd:"Definition description", +bold_desc:"Bold (Ctrl+B)", +italic_desc:"Italic (Ctrl+I)", +underline_desc:"Underline (Ctrl+U)", +striketrough_desc:"Strikethrough", +justifyleft_desc:"Align left", +justifycenter_desc:"Align center", +justifyright_desc:"Align right", +justifyfull_desc:"Align full", +bullist_desc:"Unordered list", +numlist_desc:"Ordered list", +outdent_desc:"Outdent", +indent_desc:"Indent", +undo_desc:"Undo (Ctrl+Z)", +redo_desc:"Redo (Ctrl+Y)", +link_desc:"Insert/edit link", +unlink_desc:"Unlink", +image_desc:"Insert/edit image", +cleanup_desc:"Cleanup messy code", +code_desc:"Edit HTML Source", +sub_desc:"Subscript", +sup_desc:"Superscript", +hr_desc:"Insert horizontal ruler", +removeformat_desc:"Remove formatting", +custom1_desc:"Your custom description here", +forecolor_desc:"Select text color", +backcolor_desc:"Select background color", +charmap_desc:"Insert custom character", +visualaid_desc:"Toggle guidelines/invisible elements", +anchor_desc:"Insert/edit anchor", +cut_desc:"Cut", +copy_desc:"Copy", +paste_desc:"Paste", +image_props_desc:"Image properties", +newdocument_desc:"New document", +help_desc:"Help", +blockquote_desc:"Blockquote", +clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?", +path:"Path", +newdocument:"Are you sure you want clear all contents?", +toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X", +more_colors:"More colors" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/en_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/en_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..e8f9455944e45be90888cc94025bc5d74b473e9e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/en_dlg.js @@ -0,0 +1,51 @@ +tinyMCE.addI18n('en.maarch_dlg',{ +about_title:"About TinyMCE", +about_general:"About", +about_help:"Help", +about_license:"License", +about_plugins:"Plugins", +about_plugin:"Plugin", +about_author:"Author", +about_version:"Version", +about_loaded:"Loaded plugins", +anchor_title:"Insert/edit anchor", +anchor_name:"Anchor name", +code_title:"HTML Source Editor", +code_wordwrap:"Word wrap", +colorpicker_title:"Select a color", +colorpicker_picker_tab:"Picker", +colorpicker_picker_title:"Color picker", +colorpicker_palette_tab:"Palette", +colorpicker_palette_title:"Palette colors", +colorpicker_named_tab:"Named", +colorpicker_named_title:"Named colors", +colorpicker_color:"Color:", +colorpicker_name:"Name:", +charmap_title:"Select custom character", +image_title:"Insert/edit image", +image_src:"Image URL", +image_alt:"Image description", +image_list:"Image list", +image_border:"Border", +image_dimensions:"Dimensions", +image_vspace:"Vertical space", +image_hspace:"Horizontal space", +image_align:"Alignment", +image_align_baseline:"Baseline", +image_align_top:"Top", +image_align_middle:"Middle", +image_align_bottom:"Bottom", +image_align_texttop:"Text top", +image_align_textbottom:"Text bottom", +image_align_left:"Left", +image_align_right:"Right", +link_title:"Insert/edit link", +link_url:"Link URL", +link_target:"Target", +link_target_same:"Open link in the same window", +link_target_blank:"Open link in a new window", +link_titlefield:"Title", +link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +link_list:"Link list" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/fr.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/fr.js new file mode 100644 index 0000000000000000000000000000000000000000..90f8ccfa740b7de0be4d5fae92c120d02fe29c85 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/fr.js @@ -0,0 +1,62 @@ +tinyMCE.addI18n('fr.maarch',{ +style_select:"Styles", +font_size:"Taille police", +fontdefault:"Famille de police", +block:"Format", +paragraph:"Paragraphe", +div:"Div", +address:"Adresse", +pre:"Preformatt\u00E9", +h1:"Titre 1", +h2:"Titre 2", +h3:"Titre 3", +h4:"Titre 4", +h5:"Titre 5", +h6:"Titre 6", +blockquote:"Citation", +code:"Code", +samp:"Exemple de code", +dt:"Terme \u00E0 d\u00E9finir", +dd:"D\u00E9finition du terme", +bold_desc:"Gras (Ctrl+B)", +italic_desc:"Italique (Ctrl+I)", +underline_desc:"Soulign\u00E9 (Ctrl+U)", +striketrough_desc:"Barr\u00E9", +justifyleft_desc:"Align\u00E9 \u00E0 gauche", +justifycenter_desc:"Centr\u00E9", +justifyright_desc:"Align\u00E9 \u00E0 droite", +justifyfull_desc:"Justifi\u00E9", +bullist_desc:"Liste non-num\u00E9rot\u00E9e", +numlist_desc:"Liste num\u00E9rot\u00E9e", +outdent_desc:"Retirer l'indentation", +indent_desc:"Indenter", +undo_desc:"Annuler (Ctrl+Z)", +redo_desc:"R\u00E9tablir (Ctrl+Y)", +link_desc:"Ins\u00E9rer/\u00C9diter le lien", +unlink_desc:"D\u00E9lier", +image_desc:"Ins\u00E9rer/\u00C9diter l'image", +cleanup_desc:"Nettoyer le code non propre", +code_desc:"\u00C9diter source HTML", +sub_desc:"Indice", +sup_desc:"Exposant", +hr_desc:"Ins\u00E9rer trait horizontal", +removeformat_desc:"Enlever formattage", +custom1_desc:"Votre description personnalis\u00E9e ici", +forecolor_desc:"Choisir la couleur du texte", +backcolor_desc:"Choisir la couleur de surlignage", +charmap_desc:"Ins\u00E9rer caract\u00E8res sp\u00E9ciaux", +visualaid_desc:"Activer/d\u00E9sactiver les guides et les \u00E9l\u00E9ments invisibles", +anchor_desc:"Ins\u00E9rer/\u00C9diter ancre", +cut_desc:"Couper", +copy_desc:"Copier", +paste_desc:"Coller", +image_props_desc:"Propri\u00E9t\u00E9s de l'image", +newdocument_desc:"Nouveau document", +help_desc:"Aide", +blockquote_desc:"Citation", +clipboard_msg:"Copier/Couper/Coller n'est pas disponible sous Mozilla et sous Firefox.\n\r\n Voulez-vous plus d'information sur ce probl\u00E8me\u00A0?", +path:"Chemin", +newdocument:"\u00CAtes-vous s\u00FBr de vouloir effacer l'enti\u00E8ret\u00E9 du document\u00A0?", +toolbar_focus:"Aller aux boutons de l'\u00E9diteur - Alt+Q, Aller \u00E0 l'\u00E9diteur - Alt-Z, Aller au chemin de l'\u00E9l\u00E9ment - Alt-X", +more_colors:"Plus de couleurs" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/fr_dlg.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/fr_dlg.js new file mode 100644 index 0000000000000000000000000000000000000000..1deff9c7df1d4af6f1b8a61cc8b6fe5cdc255822 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/langs/fr_dlg.js @@ -0,0 +1,51 @@ +tinyMCE.addI18n('fr.maarch_dlg',{ +about_title:"\u00C0 propos de TinyMCE", +about_general:"\u00C0 propos", +about_help:"Aide", +about_license:"Licence", +about_plugins:"Plugins", +about_plugin:"Plugin", +about_author:"Auteur", +about_version:"Version", +about_loaded:"Plugins charg\u00E9s", +anchor_title:"Ins\u00E9rer/\u00C9diter ancre", +anchor_name:"Nom de l'ancre", +code_title:"\u00C9diteur de la source HTML", +code_wordwrap:"Rupture de ligne", +colorpicker_title:"Choisir une couleur", +colorpicker_picker_tab:"Nuancier", +colorpicker_picker_title:"Nuancier", +colorpicker_palette_tab:"Palette", +colorpicker_palette_title:"Couleurs de la palette", +colorpicker_named_tab:"Noms", +colorpicker_named_title:"Couleurs nomm\u00E9es", +colorpicker_color:"Couleur :", +colorpicker_name:"Nom :", +charmap_title:"Choisir le caract\u00E8re \u00E0 ins\u00E9rer", +image_title:"Ins\u00E9rer/\u00C9diter image", +image_src:"URL de l'image", +image_alt:"Description de l'image", +image_list:"Liste d'images", +image_border:"Bordure", +image_dimensions:"Dimensions", +image_vspace:"Espacement vertical", +image_hspace:"Espacement horizontal", +image_align:"Alignement", +image_align_baseline:"Base", +image_align_top:"Sommet", +image_align_middle:"Milieu", +image_align_bottom:"Bas", +image_align_texttop:"Haut du texte", +image_align_textbottom:"Bas du texte", +image_align_left:"Gauche", +image_align_right:"Droite", +link_title:"Ins\u00E9rer/\u00C9diter lien", +link_url:"URL du lien", +link_target:"Cible", +link_target_same:"Ouvrir dans la m\u00EAme fen\u00EAtre", +link_target_blank:"Ouvrir dans une nouvelle fen\u00EAtre", +link_titlefield:"Titre", +link_is_email:"L'url que vous avez entr\u00E9 semble \u00EAtre une adresse e-mail, voulez-vous ajouter le pr\u00E9fixe mailto:\u00A0?", +link_is_external:"L'url que vous avez entr\u00E9 semble \u00EAtre une adresse web externe, voulez-vous ajouter le pr\u00E9fixe http://\u00A0?", +link_list:"Liste de liens" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/link.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/link.htm new file mode 100644 index 0000000000000000000000000000000000000000..a78bd334d5ec42983537585b90c3ecba287cf908 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/link.htm @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advanced_dlg.link_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/validate.js"></script> + <script type="text/javascript" src="js/link.js"></script> +</head> +<body id="link" style="display: none"> +<form onsubmit="LinkDialog.update();return false;" action="#"> + <div class="tabs"> + <ul> + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.link_title}</a></span></li> + </ul> + </div> + + <div class="panel_wrapper"> + <div id="general_panel" class="panel current"> + + <table border="0" cellpadding="4" cellspacing="0"> + <tr> + <td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td> + <td><table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> + <td id="hrefbrowsercontainer"> </td> + </tr> + </table></td> + </tr> + <tr> + <td><label for="link_list">{#advanced_dlg.link_list}</label></td> + <td><select id="link_list" name="link_list" onchange="document.getElementById('href').value=this.options[this.selectedIndex].value;"></select></td> + </tr> + <tr> + <td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td> + <td><select id="target_list" name="target_list"></select></td> + </tr> + <tr> + <td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td> + <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td> + </tr> + <tr> + <td><label for="class_list">{#class_name}</label></td> + <td><select id="class_list" name="class_list"></select></td> + </tr> + </table> + </div> + </div> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" id="insert" name="insert" value="{#insert}" /> + </div> + + <div style="float: right"> + <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> + </div> + </div> +</form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/content.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/content.css new file mode 100644 index 0000000000000000000000000000000000000000..19da1943bc055d2fcb4658f65f3534d0ca7cdb1b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/content.css @@ -0,0 +1,32 @@ +body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} +body {background:#FFF;} +body.mceForceColors {background:#FFF; color:#000;} +h1 {font-size: 2em} +h2 {font-size: 1.5em} +h3 {font-size: 1.17em} +h4 {font-size: 1em} +h5 {font-size: .83em} +h6 {font-size: .75em} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;} +img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;} +img {border:0;} +table {cursor:default} +table td, table th {cursor:text} +ins {border-bottom:1px solid green; text-decoration: none; color:green} +del {color:red; text-decoration:line-through} +cite {border-bottom:1px dashed blue} +acronym {border-bottom:1px dotted #CCC; cursor:help} +abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help} + +/* IE */ +* html body { +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/dialog.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/dialog.css new file mode 100644 index 0000000000000000000000000000000000000000..873c67e3c449b3a9386cee5a6f296ce45a2cdafb --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/dialog.css @@ -0,0 +1,116 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDDDDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +background:#F0F0EE; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} +.nowrap {white-space: nowrap} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #CCC;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +border:0; margin:0; padding:0; +font-weight:bold; +width:94px; height:26px; +background:url(img/buttons.png) 0 -26px; +cursor:pointer; +padding-bottom:2px; +} + +#insert {background:url(img/buttons.png) 0 -52px;} +#cancel {background:url(img/buttons.png) 0 0;} + +/* Browse */ +a.pickcolor, a.browse {text-decoration:none} +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border:1px solid #AAA; text-align:center} +td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} +#charmap a {display:block; color:#000; text-decoration:none; border:0} +#charmap a:hover {background:#CCC;color:#2B6FB6} +#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} +#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} +.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} +#colorpicker #picker_panel fieldset {margin:auto;width:325px;} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/buttons.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/buttons.png new file mode 100644 index 0000000000000000000000000000000000000000..7dd58418ba7cfe58ae7efdf174e0b223fe3aa6a0 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/buttons.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/items.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/items.gif new file mode 100644 index 0000000000000000000000000000000000000000..2eafd7954e6ebf24204b01db94b39299426d09da Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/items.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/menu_arrow.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/menu_arrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..85e31dfb2d0454de352d87fe95f7003f22c87992 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/menu_arrow.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/menu_check.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/menu_check.gif new file mode 100644 index 0000000000000000000000000000000000000000..adfdddccd7cac62a17d68873fa53c248bff8351a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/menu_check.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/progress.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/progress.gif new file mode 100644 index 0000000000000000000000000000000000000000..5bb90fd6a49107a321c35b9cee4a7b810314b51f Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/progress.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/tabs.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/tabs.gif new file mode 100644 index 0000000000000000000000000000000000000000..ce4be63558b02e9837b995d2b9dd540ce6d61a6f Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/img/tabs.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/ui.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/ui.css new file mode 100644 index 0000000000000000000000000000000000000000..230a2ee288dacbbe3bb029a1b442b6cc974fddfc --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/default/ui.css @@ -0,0 +1,214 @@ +/* Reset */ +.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left} +.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} +.defaultSkin table td {vertical-align:middle} + +/* Containers */ +.defaultSkin table {background:#F0F0EE} +.defaultSkin iframe {display:block; background:#FFF} +.defaultSkin .mceToolbar {height:26px} +.defaultSkin .mceLeft {text-align:left} +.defaultSkin .mceRight {text-align:right} + +/* External */ +.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;} +.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC} +.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC} +.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC} +.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;} +.defaultSkin td.mceToolbar {padding-top:1px; vertical-align:top} +.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC} +.defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px} +.defaultSkin .mceStatusbar div {float:left; margin:2px} +.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize} +.defaultSkin .mceStatusbar a:hover {text-decoration:underline} +.defaultSkin table.mceToolbar {margin-left:3px} +.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px} +.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} +.defaultSkin td.mceCenter {text-align:center;} +.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;} +.defaultSkin td.mceRight table {margin:0 0 0 auto;} + +/* Button */ +.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px} +.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0} +.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.defaultSkin .mceButtonLabeled {width:auto} +.defaultSkin .mceButtonLabeled span.mceIcon {float:left} +.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica} +.defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888} + +/* Separator */ +.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px} + +/* ListBox */ +.defaultSkin .mceListBox {direction:ltr} +.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block} +.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} +.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;} +.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF} +.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0} +.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;} +.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px} +.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;} +.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;} + +/* SplitButton */ +.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr} +.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block} +.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;} +.defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;} +.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;} +.defaultSkin .mceSplitButton span.mceOpen {display:none} +.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0} +.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;} +.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;} + +/* ColorSplitButton */ +.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} +.defaultSkin .mceColorSplitMenu td {padding:2px} +.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} +.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} +.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} +.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A} +.defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a} +.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px} + +/* Menu */ +.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8} +.defaultSkin .mceNoIcons span.mceIcon {width:0;} +.defaultSkin .mceNoIcons a .mceText {padding-left:10px} +.defaultSkin .mceMenu table {background:#FFF} +.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block} +.defaultSkin .mceMenu td {height:20px} +.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0} +.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} +.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px} +.defaultSkin .mceMenu pre.mceText {font-family:Monospace} +.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} +.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3} +.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px} +.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD} +.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px} +.defaultSkin .mceMenuItemDisabled .mceText {color:#888} +.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)} +.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center} +.defaultSkin .mceMenu span.mceMenuLine {display:none} +.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF} +.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} +.defaultSkin .mcePlaceHolder {border:1px dotted gray} + +/* Formats */ +.defaultSkin .mce_formatPreview a {font-size:10px} +.defaultSkin .mce_p span.mceText {} +.defaultSkin .mce_address span.mceText {font-style:italic} +.defaultSkin .mce_pre span.mceText {font-family:monospace} +.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} +.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} +.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} +.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} +.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} +.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} + +/* Theme */ +.defaultSkin span.mce_bold {background-position:0 0} +.defaultSkin span.mce_italic {background-position:-60px 0} +.defaultSkin span.mce_underline {background-position:-140px 0} +.defaultSkin span.mce_strikethrough {background-position:-120px 0} +.defaultSkin span.mce_undo {background-position:-160px 0} +.defaultSkin span.mce_redo {background-position:-100px 0} +.defaultSkin span.mce_cleanup {background-position:-40px 0} +.defaultSkin span.mce_bullist {background-position:-20px 0} +.defaultSkin span.mce_numlist {background-position:-80px 0} +.defaultSkin span.mce_justifyleft {background-position:-460px 0} +.defaultSkin span.mce_justifyright {background-position:-480px 0} +.defaultSkin span.mce_justifycenter {background-position:-420px 0} +.defaultSkin span.mce_justifyfull {background-position:-440px 0} +.defaultSkin span.mce_anchor {background-position:-200px 0} +.defaultSkin span.mce_indent {background-position:-400px 0} +.defaultSkin span.mce_outdent {background-position:-540px 0} +.defaultSkin span.mce_link {background-position:-500px 0} +.defaultSkin span.mce_unlink {background-position:-640px 0} +.defaultSkin span.mce_sub {background-position:-600px 0} +.defaultSkin span.mce_sup {background-position:-620px 0} +.defaultSkin span.mce_removeformat {background-position:-580px 0} +.defaultSkin span.mce_newdocument {background-position:-520px 0} +.defaultSkin span.mce_image {background-position:-380px 0} +.defaultSkin span.mce_help {background-position:-340px 0} +.defaultSkin span.mce_code {background-position:-260px 0} +.defaultSkin span.mce_hr {background-position:-360px 0} +.defaultSkin span.mce_visualaid {background-position:-660px 0} +.defaultSkin span.mce_charmap {background-position:-240px 0} +.defaultSkin span.mce_paste {background-position:-560px 0} +.defaultSkin span.mce_copy {background-position:-700px 0} +.defaultSkin span.mce_cut {background-position:-680px 0} +.defaultSkin span.mce_blockquote {background-position:-220px 0} +.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0} +.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0} +.defaultSkin span.mce_forecolorpicker {background-position:-720px 0} +.defaultSkin span.mce_backcolorpicker {background-position:-760px 0} + +/* Plugins */ +.defaultSkin span.mce_advhr {background-position:-0px -20px} +.defaultSkin span.mce_ltr {background-position:-20px -20px} +.defaultSkin span.mce_rtl {background-position:-40px -20px} +.defaultSkin span.mce_emotions {background-position:-60px -20px} +.defaultSkin span.mce_fullpage {background-position:-80px -20px} +.defaultSkin span.mce_fullscreen {background-position:-100px -20px} +.defaultSkin span.mce_iespell {background-position:-120px -20px} +.defaultSkin span.mce_insertdate {background-position:-140px -20px} +.defaultSkin span.mce_inserttime {background-position:-160px -20px} +.defaultSkin span.mce_absolute {background-position:-180px -20px} +.defaultSkin span.mce_backward {background-position:-200px -20px} +.defaultSkin span.mce_forward {background-position:-220px -20px} +.defaultSkin span.mce_insert_layer {background-position:-240px -20px} +.defaultSkin span.mce_insertlayer {background-position:-260px -20px} +.defaultSkin span.mce_movebackward {background-position:-280px -20px} +.defaultSkin span.mce_moveforward {background-position:-300px -20px} +.defaultSkin span.mce_media {background-position:-320px -20px} +.defaultSkin span.mce_nonbreaking {background-position:-340px -20px} +.defaultSkin span.mce_pastetext {background-position:-360px -20px} +.defaultSkin span.mce_pasteword {background-position:-380px -20px} +.defaultSkin span.mce_selectall {background-position:-400px -20px} +.defaultSkin span.mce_preview {background-position:-420px -20px} +.defaultSkin span.mce_print {background-position:-440px -20px} +.defaultSkin span.mce_cancel {background-position:-460px -20px} +.defaultSkin span.mce_save {background-position:-480px -20px} +.defaultSkin span.mce_replace {background-position:-500px -20px} +.defaultSkin span.mce_search {background-position:-520px -20px} +.defaultSkin span.mce_styleprops {background-position:-560px -20px} +.defaultSkin span.mce_table {background-position:-580px -20px} +.defaultSkin span.mce_cell_props {background-position:-600px -20px} +.defaultSkin span.mce_delete_table {background-position:-620px -20px} +.defaultSkin span.mce_delete_col {background-position:-640px -20px} +.defaultSkin span.mce_delete_row {background-position:-660px -20px} +.defaultSkin span.mce_col_after {background-position:-680px -20px} +.defaultSkin span.mce_col_before {background-position:-700px -20px} +.defaultSkin span.mce_row_after {background-position:-720px -20px} +.defaultSkin span.mce_row_before {background-position:-740px -20px} +.defaultSkin span.mce_merge_cells {background-position:-760px -20px} +.defaultSkin span.mce_table_props {background-position:-980px -20px} +.defaultSkin span.mce_row_props {background-position:-780px -20px} +.defaultSkin span.mce_split_cells {background-position:-800px -20px} +.defaultSkin span.mce_template {background-position:-820px -20px} +.defaultSkin span.mce_visualchars {background-position:-840px -20px} +.defaultSkin span.mce_abbr {background-position:-860px -20px} +.defaultSkin span.mce_acronym {background-position:-880px -20px} +.defaultSkin span.mce_attribs {background-position:-900px -20px} +.defaultSkin span.mce_cite {background-position:-920px -20px} +.defaultSkin span.mce_del {background-position:-940px -20px} +.defaultSkin span.mce_ins {background-position:-960px -20px} +.defaultSkin span.mce_pagebreak {background-position:0 -40px} +.defaultSkin .mce_spellchecker span.mceAction {background-position:-540px -20px} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/content.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/content.css new file mode 100644 index 0000000000000000000000000000000000000000..b8431d16955cc25f3ac0dae70464178bdf2572fb --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/content.css @@ -0,0 +1,32 @@ +body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} +body {background:#FFF;} +body.mceForceColors {background:#FFF; color:#000;} +h1 {font-size: 2em} +h2 {font-size: 1.5em} +h3 {font-size: 1.17em} +h4 {font-size: 1em} +h5 {font-size: .83em} +h6 {font-size: .75em} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(../default/img/items.gif) no-repeat bottom left;} +img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.gif) no-repeat;} +img {border:0;} +table {cursor:default} +table td, table th {cursor:text} +ins {border-bottom:1px solid green; text-decoration: none; color:green} +del {color:red; text-decoration:line-through} +cite {border-bottom:1px dashed blue} +acronym {border-bottom:1px dotted #CCC; cursor:help} +abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help} + +/* IE */ +* html body { +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/dialog.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/dialog.css new file mode 100644 index 0000000000000000000000000000000000000000..6c37d6fb8395556422d93a9668f68c93f82b7b55 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/dialog.css @@ -0,0 +1,115 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDDDDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +background:#F0F0EE; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} +.nowrap {white-space: nowrap} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #CCC;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +border:0; margin:0; padding:0; +font-weight:bold; +width:94px; height:26px; +background:url(../default/img/buttons.png) 0 -26px; +cursor:pointer; +padding-bottom:2px; +} + +#insert {background:url(../default/img/buttons.png) 0 -52px;} +#cancel {background:url(../default/img/buttons.png) 0 0;} + +/* Browse */ +a.pickcolor, a.browse {text-decoration:none} +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border:1px solid #AAA; text-align:center} +td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} +#charmap a {display:block; color:#000; text-decoration:none; border:0} +#charmap a:hover {background:#CCC;color:#2B6FB6} +#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} +#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} +.tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..12cfb419bbf2fb87f845731aa0fceb653d0dbf88 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg_black.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg_black.png new file mode 100644 index 0000000000000000000000000000000000000000..8996c7493e8a58c9c40845cbe8abdc3e6730716d Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg_black.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg_silver.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg_silver.png new file mode 100644 index 0000000000000000000000000000000000000000..bd5d2550c06d83c1141b78c5af7217e89559fc32 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/img/button_bg_silver.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui.css new file mode 100644 index 0000000000000000000000000000000000000000..c10a3f0161f642bd3fee6da3538aaf44abefd921 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui.css @@ -0,0 +1,215 @@ +/* Reset */ +.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left} +.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} +.o2k7Skin table td {vertical-align:middle} + +/* Containers */ +.o2k7Skin table {background:#E5EFFD} +.o2k7Skin iframe {display:block; background:#FFF} +.o2k7Skin .mceToolbar {height:26px} + +/* External */ +.o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none} +.o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD} +.o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD} +.o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD} +.o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0} +.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD} +.o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px} +.o2k7Skin .mceStatusbar div {float:left; padding:2px} +.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize} +.o2k7Skin .mceStatusbar a:hover {text-decoration:underline} +.o2k7Skin table.mceToolbar {margin-left:3px} +.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;} +.o2k7Skin .mceToolbar td.mceFirst span {margin:0} +.o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px} +.o2k7Skin .mceToolbar .mceToolbarEndListBox span, .o2k7Skin .mceToolbar .mceToolbarStartListBox span {display:none} +.o2k7Skin span.mceIcon, .o2k7Skin img.mceIcon {display:block; width:20px; height:20px} +.o2k7Skin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} +.o2k7Skin td.mceCenter {text-align:center;} +.o2k7Skin td.mceCenter table {margin:0 auto; text-align:left;} +.o2k7Skin td.mceRight table {margin:0 0 0 auto;} + +/* Button */ +.o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px} +.o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px} +.o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px} +.o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px} +.o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px} +.o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.o2k7Skin .mceButtonLabeled {width:auto} +.o2k7Skin .mceButtonLabeled span.mceIcon {float:left} +.o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica} +.o2k7Skin .mceButtonDisabled .mceButtonLabel {color:#888} + +/* Separator */ +.o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px} + +/* ListBox */ +.o2k7Skin .mceListBox {margin-left:3px} +.o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block} +.o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} +.o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0} +.o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF} +.o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px} +.o2k7Skin .mceListBoxDisabled .mceText {color:gray} +.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px} +.o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;} + +/* SplitButton */ +.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px} +.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)} +.o2k7Skin .mceSplitButton a.mceAction {width:22px} +.o2k7Skin .mceSplitButton span.mceAction {width:22px; background:url(../../img/icons.gif) 20px 20px} +.o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0} +.o2k7Skin .mceSplitButton span.mceOpen {display:none} +.o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px} +.o2k7Skin table.mceSplitButtonEnabled:hover a.mceOpen, .o2k7Skin .mceSplitButtonHover a.mceOpen, .o2k7Skin .mceSplitButtonSelected a.mceOpen {background-position:-44px -44px} +.o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.o2k7Skin .mceSplitButtonActive {background-position:0 -44px} + +/* ColorSplitButton */ +.o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} +.o2k7Skin .mceColorSplitMenu td {padding:2px} +.o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} +.o2k7Skin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} +.o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} +.o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A} +.o2k7Skin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a;overflow:hidden} +.o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden} + +/* Menu */ +.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD} +.o2k7Skin .mceNoIcons span.mceIcon {width:0;} +.o2k7Skin .mceNoIcons a .mceText {padding-left:10px} +.o2k7Skin .mceMenu table {background:#FFF} +.o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block} +.o2k7Skin .mceMenu td {height:20px} +.o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0} +.o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} +.o2k7Skin .mceMenu span.mceText, .o2k7Skin .mceMenu .mcePreview {font-size:11px} +.o2k7Skin .mceMenu pre.mceText {font-family:Monospace} +.o2k7Skin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} +.o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3} +.o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px} +.o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD} +.o2k7Skin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px} +.o2k7Skin .mceMenuItemDisabled .mceText {color:#888} +.o2k7Skin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)} +.o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center} +.o2k7Skin .mceMenu span.mceMenuLine {display:none} +.o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF} +.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} +.o2k7Skin .mcePlaceHolder {border:1px dotted gray} + +/* Formats */ +.o2k7Skin .mce_formatPreview a {font-size:10px} +.o2k7Skin .mce_p span.mceText {} +.o2k7Skin .mce_address span.mceText {font-style:italic} +.o2k7Skin .mce_pre span.mceText {font-family:monospace} +.o2k7Skin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} +.o2k7Skin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} +.o2k7Skin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} +.o2k7Skin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} +.o2k7Skin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} +.o2k7Skin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} + +/* Theme */ +.o2k7Skin span.mce_bold {background-position:0 0} +.o2k7Skin span.mce_italic {background-position:-60px 0} +.o2k7Skin span.mce_underline {background-position:-140px 0} +.o2k7Skin span.mce_strikethrough {background-position:-120px 0} +.o2k7Skin span.mce_undo {background-position:-160px 0} +.o2k7Skin span.mce_redo {background-position:-100px 0} +.o2k7Skin span.mce_cleanup {background-position:-40px 0} +.o2k7Skin span.mce_bullist {background-position:-20px 0} +.o2k7Skin span.mce_numlist {background-position:-80px 0} +.o2k7Skin span.mce_justifyleft {background-position:-460px 0} +.o2k7Skin span.mce_justifyright {background-position:-480px 0} +.o2k7Skin span.mce_justifycenter {background-position:-420px 0} +.o2k7Skin span.mce_justifyfull {background-position:-440px 0} +.o2k7Skin span.mce_anchor {background-position:-200px 0} +.o2k7Skin span.mce_indent {background-position:-400px 0} +.o2k7Skin span.mce_outdent {background-position:-540px 0} +.o2k7Skin span.mce_link {background-position:-500px 0} +.o2k7Skin span.mce_unlink {background-position:-640px 0} +.o2k7Skin span.mce_sub {background-position:-600px 0} +.o2k7Skin span.mce_sup {background-position:-620px 0} +.o2k7Skin span.mce_removeformat {background-position:-580px 0} +.o2k7Skin span.mce_newdocument {background-position:-520px 0} +.o2k7Skin span.mce_image {background-position:-380px 0} +.o2k7Skin span.mce_help {background-position:-340px 0} +.o2k7Skin span.mce_code {background-position:-260px 0} +.o2k7Skin span.mce_hr {background-position:-360px 0} +.o2k7Skin span.mce_visualaid {background-position:-660px 0} +.o2k7Skin span.mce_charmap {background-position:-240px 0} +.o2k7Skin span.mce_paste {background-position:-560px 0} +.o2k7Skin span.mce_copy {background-position:-700px 0} +.o2k7Skin span.mce_cut {background-position:-680px 0} +.o2k7Skin span.mce_blockquote {background-position:-220px 0} +.o2k7Skin .mce_forecolor span.mceAction {background-position:-720px 0} +.o2k7Skin .mce_backcolor span.mceAction {background-position:-760px 0} +.o2k7Skin span.mce_forecolorpicker {background-position:-720px 0} +.o2k7Skin span.mce_backcolorpicker {background-position:-760px 0} + +/* Plugins */ +.o2k7Skin span.mce_advhr {background-position:-0px -20px} +.o2k7Skin span.mce_ltr {background-position:-20px -20px} +.o2k7Skin span.mce_rtl {background-position:-40px -20px} +.o2k7Skin span.mce_emotions {background-position:-60px -20px} +.o2k7Skin span.mce_fullpage {background-position:-80px -20px} +.o2k7Skin span.mce_fullscreen {background-position:-100px -20px} +.o2k7Skin span.mce_iespell {background-position:-120px -20px} +.o2k7Skin span.mce_insertdate {background-position:-140px -20px} +.o2k7Skin span.mce_inserttime {background-position:-160px -20px} +.o2k7Skin span.mce_absolute {background-position:-180px -20px} +.o2k7Skin span.mce_backward {background-position:-200px -20px} +.o2k7Skin span.mce_forward {background-position:-220px -20px} +.o2k7Skin span.mce_insert_layer {background-position:-240px -20px} +.o2k7Skin span.mce_insertlayer {background-position:-260px -20px} +.o2k7Skin span.mce_movebackward {background-position:-280px -20px} +.o2k7Skin span.mce_moveforward {background-position:-300px -20px} +.o2k7Skin span.mce_media {background-position:-320px -20px} +.o2k7Skin span.mce_nonbreaking {background-position:-340px -20px} +.o2k7Skin span.mce_pastetext {background-position:-360px -20px} +.o2k7Skin span.mce_pasteword {background-position:-380px -20px} +.o2k7Skin span.mce_selectall {background-position:-400px -20px} +.o2k7Skin span.mce_preview {background-position:-420px -20px} +.o2k7Skin span.mce_print {background-position:-440px -20px} +.o2k7Skin span.mce_cancel {background-position:-460px -20px} +.o2k7Skin span.mce_save {background-position:-480px -20px} +.o2k7Skin span.mce_replace {background-position:-500px -20px} +.o2k7Skin span.mce_search {background-position:-520px -20px} +.o2k7Skin span.mce_styleprops {background-position:-560px -20px} +.o2k7Skin span.mce_table {background-position:-580px -20px} +.o2k7Skin span.mce_cell_props {background-position:-600px -20px} +.o2k7Skin span.mce_delete_table {background-position:-620px -20px} +.o2k7Skin span.mce_delete_col {background-position:-640px -20px} +.o2k7Skin span.mce_delete_row {background-position:-660px -20px} +.o2k7Skin span.mce_col_after {background-position:-680px -20px} +.o2k7Skin span.mce_col_before {background-position:-700px -20px} +.o2k7Skin span.mce_row_after {background-position:-720px -20px} +.o2k7Skin span.mce_row_before {background-position:-740px -20px} +.o2k7Skin span.mce_merge_cells {background-position:-760px -20px} +.o2k7Skin span.mce_table_props {background-position:-980px -20px} +.o2k7Skin span.mce_row_props {background-position:-780px -20px} +.o2k7Skin span.mce_split_cells {background-position:-800px -20px} +.o2k7Skin span.mce_template {background-position:-820px -20px} +.o2k7Skin span.mce_visualchars {background-position:-840px -20px} +.o2k7Skin span.mce_abbr {background-position:-860px -20px} +.o2k7Skin span.mce_acronym {background-position:-880px -20px} +.o2k7Skin span.mce_attribs {background-position:-900px -20px} +.o2k7Skin span.mce_cite {background-position:-920px -20px} +.o2k7Skin span.mce_del {background-position:-940px -20px} +.o2k7Skin span.mce_ins {background-position:-960px -20px} +.o2k7Skin span.mce_pagebreak {background-position:0 -40px} +.o2k7Skin .mce_spellchecker span.mceAction {background-position:-540px -20px} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui_black.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui_black.css new file mode 100644 index 0000000000000000000000000000000000000000..153f0c38a6c69b897b9d7dbb5fd66a75991048bc --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui_black.css @@ -0,0 +1,8 @@ +/* Black */ +.o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton a.mceOpen, .o2k7SkinBlack .mceListBox a.mceOpen {background-image:url(img/button_bg_black.png)} +.o2k7SkinBlack table, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF} +.o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0} +.o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0} +.o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;} +.o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7SkinBlack .mceSplitButtonHover a.mceAction, .o2k7SkinBlack .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)} +.o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7SkinBlack .mceMenu .mceMenuItemActive {background-color:#FFE7A1} \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui_silver.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui_silver.css new file mode 100644 index 0000000000000000000000000000000000000000..7fe3b45e1264ad10f89c696ecc3b0e0801a96653 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/skins/o2k7/ui_silver.css @@ -0,0 +1,5 @@ +/* Silver */ +.o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton a.mceOpen, .o2k7SkinSilver .mceListBox a.mceOpen {background-image:url(img/button_bg_silver.png)} +.o2k7SkinSilver table, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee} +.o2k7SkinSilver .mceListBox .mceText {background:#FFF} +.o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/source_editor.htm b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/source_editor.htm new file mode 100644 index 0000000000000000000000000000000000000000..553e7bb2bc734587ba964e703bd2e2374abe8b0b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/maarch/source_editor.htm @@ -0,0 +1,31 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <title>{#advanced_dlg.code_title}</title> + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="js/source_editor.js"></script> +</head> +<body onresize="resizeInputs();" style="display:none; overflow:hidden;"> + <form name="source" onsubmit="saveContent();return false;" action="#"> + <div style="float: left" class="title">{#advanced_dlg.code_title}</div> + + <div id="wrapline" style="float: right"> + <input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{#advanced_dlg.code_wordwrap}</label> + </div> + + <br style="clear: both" /> + + <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea> + + <div class="mceActionPanel"> + <div style="float: left"> + <input type="submit" name="insert" value="{#update}" id="insert" /> + </div> + + <div style="float: right"> + <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" /> + </div> + </div> + </form> +</body> +</html> diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/editor_template.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/editor_template.js new file mode 100644 index 0000000000000000000000000000000000000000..ed89abc067613b25c124f6e39af8b7d498ad0714 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/editor_template.js @@ -0,0 +1 @@ +(function(){var a=tinymce.DOM;tinymce.ThemeManager.requireLangPack("simple");tinymce.create("tinymce.themes.SimpleTheme",{init:function(c,d){var e=this,b=["Bold","Italic","Underline","Strikethrough","InsertUnorderedList","InsertOrderedList"],f=c.settings;e.editor=c;c.onInit.add(function(){c.onNodeChange.add(function(h,g){tinymce.each(b,function(i){g.get(i.toLowerCase()).setActive(h.queryCommandState(i))})});c.dom.loadCSS(d+"/skins/"+f.skin+"/content.css")});a.loadCSS((f.editor_css?c.documentBaseURI.toAbsolute(f.editor_css):"")||d+"/skins/"+f.skin+"/ui.css")},renderUI:function(h){var e=this,i=h.targetNode,b,c,d=e.editor,f=d.controlManager,g;i=a.insertAfter(a.create("span",{id:d.id+"_container","class":"mceEditor "+d.settings.skin+"SimpleSkin"}),i);i=g=a.add(i,"table",{cellPadding:0,cellSpacing:0,"class":"mceLayout"});i=c=a.add(i,"tbody");i=a.add(c,"tr");i=b=a.add(a.add(i,"td"),"div",{"class":"mceIframeContainer"});i=a.add(a.add(c,"tr",{"class":"last"}),"td",{"class":"mceToolbar mceLast",align:"center"});c=e.toolbar=f.createToolbar("tools1");c.add(f.createButton("bold",{title:"simple.bold_desc",cmd:"Bold"}));c.add(f.createButton("italic",{title:"simple.italic_desc",cmd:"Italic"}));c.add(f.createButton("underline",{title:"simple.underline_desc",cmd:"Underline"}));c.add(f.createButton("strikethrough",{title:"simple.striketrough_desc",cmd:"Strikethrough"}));c.add(f.createSeparator());c.add(f.createButton("undo",{title:"simple.undo_desc",cmd:"Undo"}));c.add(f.createButton("redo",{title:"simple.redo_desc",cmd:"Redo"}));c.add(f.createSeparator());c.add(f.createButton("cleanup",{title:"simple.cleanup_desc",cmd:"mceCleanup"}));c.add(f.createSeparator());c.add(f.createButton("insertunorderedlist",{title:"simple.bullist_desc",cmd:"InsertUnorderedList"}));c.add(f.createButton("insertorderedlist",{title:"simple.numlist_desc",cmd:"InsertOrderedList"}));c.renderTo(i);return{iframeContainer:b,editorContainer:d.id+"_container",sizeContainer:g,deltaHeight:-20}},getInfo:function(){return{longname:"Simple theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.ThemeManager.add("simple",tinymce.themes.SimpleTheme)})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/editor_template_src.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/editor_template_src.js new file mode 100644 index 0000000000000000000000000000000000000000..fb0bd7893b9bfb2db17c33c309a46cbd54b0791f --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/editor_template_src.js @@ -0,0 +1,85 @@ +/** + * $Id: editor_template_src.js 920 2008-09-09 14:05:33Z spocke $ + * + * This file is meant to showcase how to create a simple theme. The advanced + * theme is more suitable for production use. + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM; + + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('simple'); + + tinymce.create('tinymce.themes.SimpleTheme', { + init : function(ed, url) { + var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings; + + t.editor = ed; + + ed.onInit.add(function() { + ed.onNodeChange.add(function(ed, cm) { + tinymce.each(states, function(c) { + cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c)); + }); + }); + + ed.dom.loadCSS(url + "/skins/" + s.skin + "/content.css"); + }); + + DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css"); + }, + + renderUI : function(o) { + var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc; + + n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n); + n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'}); + n = tb = DOM.add(n, 'tbody'); + + // Create iframe container + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'}); + + // Create toolbar container + n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'}); + + // Create toolbar + tb = t.toolbar = cf.createToolbar("tools1"); + tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'})); + tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'})); + tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'})); + tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'})); + tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'})); + tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'})); + tb.renderTo(n); + + return { + iframeContainer : ic, + editorContainer : ed.id + '_container', + sizeContainer : sc, + deltaHeight : -20 + }; + }, + + getInfo : function() { + return { + longname : 'Simple theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + } + }); + + tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme); +})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/img/icons.gif b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/img/icons.gif new file mode 100644 index 0000000000000000000000000000000000000000..16af141ff0eea376a889b1e8d28e9c1cacaaab16 Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/img/icons.gif differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/langs/en.js b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/langs/en.js new file mode 100644 index 0000000000000000000000000000000000000000..9f08f102fb8996fd738724e0a04994842aac2e7d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/langs/en.js @@ -0,0 +1,11 @@ +tinyMCE.addI18n('en.simple',{ +bold_desc:"Bold (Ctrl+B)", +italic_desc:"Italic (Ctrl+I)", +underline_desc:"Underline (Ctrl+U)", +striketrough_desc:"Strikethrough", +bullist_desc:"Unordered list", +numlist_desc:"Ordered list", +undo_desc:"Undo (Ctrl+Z)", +redo_desc:"Redo (Ctrl+Y)", +cleanup_desc:"Cleanup messy code" +}); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/default/content.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/default/content.css new file mode 100644 index 0000000000000000000000000000000000000000..2506c807ca31e536e17db252a4639234b662f03e --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/default/content.css @@ -0,0 +1,25 @@ +body, td, pre { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10px; +} + +body { + background-color: #FFFFFF; +} + +.mceVisualAid { + border: 1px dashed #BBBBBB; +} + +/* MSIE specific */ + +* html body { + scrollbar-3dlight-color: #F0F0EE; + scrollbar-arrow-color: #676662; + scrollbar-base-color: #F0F0EE; + scrollbar-darkshadow-color: #DDDDDD; + scrollbar-face-color: #E0E0DD; + scrollbar-highlight-color: #F0F0EE; + scrollbar-shadow-color: #F0F0EE; + scrollbar-track-color: #F5F5F5; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/default/ui.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/default/ui.css new file mode 100644 index 0000000000000000000000000000000000000000..076fe84e3440ee67baccc93a4f42943b419bb2a9 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/default/ui.css @@ -0,0 +1,32 @@ +/* Reset */ +.defaultSimpleSkin table, .defaultSimpleSkin tbody, .defaultSimpleSkin a, .defaultSimpleSkin img, .defaultSimpleSkin tr, .defaultSimpleSkin div, .defaultSimpleSkin td, .defaultSimpleSkin iframe, .defaultSimpleSkin span, .defaultSimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000} + +/* Containers */ +.defaultSimpleSkin {position:relative} +.defaultSimpleSkin table.mceLayout {background:#F0F0EE; border:1px solid #CCC;} +.defaultSimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #CCC;} +.defaultSimpleSkin .mceToolbar {height:24px;} + +/* Layout */ +.defaultSimpleSkin span.mceIcon, .defaultSimpleSkin img.mceIcon {display:block; width:20px; height:20px} +.defaultSimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} + +/* Button */ +.defaultSimpleSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px} +.defaultSimpleSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0} +.defaultSimpleSkin a.mceButtonActive {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} + +/* Separator */ +.defaultSimpleSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:0 2px 0 4px} + +/* Theme */ +.defaultSimpleSkin span.mce_bold {background-position:0 0} +.defaultSimpleSkin span.mce_italic {background-position:-60px 0} +.defaultSimpleSkin span.mce_underline {background-position:-140px 0} +.defaultSimpleSkin span.mce_strikethrough {background-position:-120px 0} +.defaultSimpleSkin span.mce_undo {background-position:-160px 0} +.defaultSimpleSkin span.mce_redo {background-position:-100px 0} +.defaultSimpleSkin span.mce_cleanup {background-position:-40px 0} +.defaultSimpleSkin span.mce_insertunorderedlist {background-position:-20px 0} +.defaultSimpleSkin span.mce_insertorderedlist {background-position:-80px 0} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/content.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/content.css new file mode 100644 index 0000000000000000000000000000000000000000..595809fa6179114262a67c6b9b68c4bd1a312c4b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/content.css @@ -0,0 +1,17 @@ +body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} + +body {background: #FFF;} +.mceVisualAid {border: 1px dashed #BBB;} + +/* IE */ + +* html body { +scrollbar-3dlight-color: #F0F0EE; +scrollbar-arrow-color: #676662; +scrollbar-base-color: #F0F0EE; +scrollbar-darkshadow-color: #DDDDDD; +scrollbar-face-color: #E0E0DD; +scrollbar-highlight-color: #F0F0EE; +scrollbar-shadow-color: #F0F0EE; +scrollbar-track-color: #F5F5F5; +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..527e3495a653e57d76bf7e55316793d17dda497a Binary files /dev/null and b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png differ diff --git a/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/ui.css b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/ui.css new file mode 100644 index 0000000000000000000000000000000000000000..cf6c35d109346c5e66d7fcbfe37830eec881d73b --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/themes/simple/skins/o2k7/ui.css @@ -0,0 +1,35 @@ +/* Reset */ +.o2k7SimpleSkin table, .o2k7SimpleSkin tbody, .o2k7SimpleSkin a, .o2k7SimpleSkin img, .o2k7SimpleSkin tr, .o2k7SimpleSkin div, .o2k7SimpleSkin td, .o2k7SimpleSkin iframe, .o2k7SimpleSkin span, .o2k7SimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000} + +/* Containers */ +.o2k7SimpleSkin {position:relative} +.o2k7SimpleSkin table.mceLayout {background:#E5EFFD; border:1px solid #ABC6DD;} +.o2k7SimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #ABC6DD;} +.o2k7SimpleSkin .mceToolbar {height:26px;} + +/* Layout */ +.o2k7SimpleSkin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; } +.o2k7SimpleSkin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px} +.o2k7SimpleSkin span.mceIcon, .o2k7SimpleSkin img.mceIcon {display:block; width:20px; height:20px} +.o2k7SimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} + +/* Button */ +.o2k7SimpleSkin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px} +.o2k7SimpleSkin a.mceButton span, .o2k7SimpleSkin a.mceButton img {margin:1px 0 0 1px} +.o2k7SimpleSkin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px} +.o2k7SimpleSkin a.mceButtonActive {background-position:0 -44px} +.o2k7SimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} + +/* Separator */ +.o2k7SimpleSkin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px} + +/* Theme */ +.o2k7SimpleSkin span.mce_bold {background-position:0 0} +.o2k7SimpleSkin span.mce_italic {background-position:-60px 0} +.o2k7SimpleSkin span.mce_underline {background-position:-140px 0} +.o2k7SimpleSkin span.mce_strikethrough {background-position:-120px 0} +.o2k7SimpleSkin span.mce_undo {background-position:-160px 0} +.o2k7SimpleSkin span.mce_redo {background-position:-100px 0} +.o2k7SimpleSkin span.mce_cleanup {background-position:-40px 0} +.o2k7SimpleSkin span.mce_insertunorderedlist {background-position:-20px 0} +.o2k7SimpleSkin span.mce_insertorderedlist {background-position:-80px 0} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce.js b/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce.js new file mode 100644 index 0000000000000000000000000000000000000000..866d3e1fb33b5bcd7db0ff3e345f5ba2491378c6 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce.js @@ -0,0 +1 @@ +var tinymce={majorVersion:"3",minorVersion:"2.3.1",releaseDate:"2009-05-05",_init:function(){var o=this,k=document,l=window,j=navigator,b=j.userAgent,h,a,g,f,e,m;o.isOpera=l.opera&&opera.buildNumber;o.isWebKit=/WebKit/.test(b);o.isIE=!o.isWebKit&&!o.isOpera&&(/MSIE/gi).test(b)&&(/Explorer/gi).test(j.appName);o.isIE6=o.isIE&&/MSIE [56]/.test(b);o.isGecko=!o.isWebKit&&/Gecko/.test(b);o.isMac=b.indexOf("Mac")!=-1;o.isAir=/adobeair/i.test(b);if(l.tinyMCEPreInit){o.suffix=tinyMCEPreInit.suffix;o.baseURL=tinyMCEPreInit.base;o.query=tinyMCEPreInit.query;return}o.suffix="";a=k.getElementsByTagName("base");for(h=0;h<a.length;h++){if(m=a[h].href){if(/^https?:\/\/[^\/]+$/.test(m)){m+="/"}f=m?m.match(/.*\//)[0]:""}}function c(d){if(d.src&&/tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(d.src)){if(/_(src|dev)\.js/g.test(d.src)){o.suffix="_src"}if((e=d.src.indexOf("?"))!=-1){o.query=d.src.substring(e+1)}o.baseURL=d.src.substring(0,d.src.lastIndexOf("/"));if(f&&o.baseURL.indexOf("://")==-1){o.baseURL=f+o.baseURL}return o.baseURL}return null}a=k.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}g=k.getElementsByTagName("head")[0];if(g){a=g.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}}return},is:function(b,a){var c=typeof(b);if(!a){return c!="undefined"}if(a=="array"&&(b.hasOwnProperty&&b instanceof Array)){return true}return c==a},each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},map:function(b,c){var d=[];tinymce.each(b,function(a){d.push(c(a))});return d},grep:function(b,c){var d=[];tinymce.each(b,function(a){if(!c||c(a)){d.push(a)}});return d},inArray:function(c,d){var e,b;if(c){for(e=0,b=c.length;e<b;e++){if(c[e]===d){return e}}}return -1},extend:function(f,d){var c,b=arguments;for(c=1;c<b.length;c++){d=b[c];tinymce.each(d,function(a,e){if(typeof(a)!=="undefined"){f[e]=a}})}return f},trim:function(a){return(a?""+a:"").replace(/^\s*|\s*$/g,"")},create:function(j,a){var i=this,b,e,f,g,d,h=0;j=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(j);f=j[3].match(/(^|\.)(\w+)$/i)[2];e=i.createNS(j[3].replace(/\.\w+$/,""));if(e[f]){return}if(j[2]=="static"){e[f]=a;if(this.onCreate){this.onCreate(j[2],j[3],e[f])}return}if(!a[f]){a[f]=function(){};h=1}e[f]=a[f];i.extend(e[f].prototype,a);if(j[5]){b=i.resolve(j[5]).prototype;g=j[5].match(/\.(\w+)$/i)[1];d=e[f];if(h){e[f]=function(){return b[g].apply(this,arguments)}}else{e[f]=function(){this.parent=b[g];return d.apply(this,arguments)}}e[f].prototype[f]=e[f];i.each(b,function(c,k){e[f].prototype[k]=b[k]});i.each(a,function(c,k){if(b[k]){e[f].prototype[k]=function(){this.parent=b[k];return c.apply(this,arguments)}}else{if(k!=f){e[f].prototype[k]=c}}})}i.each(a["static"],function(c,k){e[f][k]=c});if(this.onCreate){this.onCreate(j[2],j[3],e[f].prototype)}},walk:function(c,b,d,a){a=a||this;if(c){if(d){c=c[d]}tinymce.each(c,function(f,e){if(b.call(a,f,e,d)===false){return false}tinymce.walk(f,b,d,a)})}},createNS:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0;b<d.length;b++){a=d[b];if(!c[a]){c[a]={}}c=c[a]}return c},resolve:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0,a=d.length;b<a;b++){c=c[d[b]];if(!c){break}}return c},addUnload:function(e,d){var c=this,a=window;e={func:e,scope:d||this};if(!c.unloads){function b(){var f=c.unloads,h,i;if(f){for(i in f){h=f[i];if(h&&h.func){h.func.call(h.scope,1)}}if(a.detachEvent){a.detachEvent("onbeforeunload",g);a.detachEvent("onunload",b)}else{if(a.removeEventListener){a.removeEventListener("unload",b,false)}}c.unloads=h=f=a=b=0;if(window.CollectGarbage){window.CollectGarbage()}}}function g(){var h=document;if(h.readyState=="interactive"){function f(){h.detachEvent("onstop",f);if(b){b()}h=0}if(h){h.attachEvent("onstop",f)}window.setTimeout(function(){if(h){h.detachEvent("onstop",f)}},0)}}if(a.attachEvent){a.attachEvent("onunload",b);a.attachEvent("onbeforeunload",g)}else{if(a.addEventListener){a.addEventListener("unload",b,false)}}c.unloads=[e]}else{c.unloads.push(e)}return e},removeUnload:function(c){var a=this.unloads,b=null;tinymce.each(a,function(e,d){if(e&&e.func==c){a.splice(d,1);b=c;return false}});return b},explode:function(a,b){return a?tinymce.map(a.split(b||","),tinymce.trim):a},_addVer:function(b){var a;if(!this.query){return b}a=(b.indexOf("?")==-1?"?":"&")+this.query;if(b.indexOf("#")==-1){return b+a}return b.replace("#",a+"#")}};window.tinymce=tinymce;tinymce._init();tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(e.indexOf(":/")===-1&&e.indexOf("//")!==0){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,g=[],d;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(h){if(h){g.push(h)}});e=g;for(c=f.length-1,g=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}g.push(f[c])}c=e.length-b;if(c<=0){return"/"+g.reverse().join("/")+d}return"/"+e.slice(0,c).join("/")+"/"+g.reverse().join("/")+d},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(c){var e=c.each,b=c.is;var d=c.isWebKit,a=c.isIE;c.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(i,g){var f=this;f.doc=i;f.win=window;f.files={};f.cssFlicker=false;f.counter=0;f.boxModel=!c.isIE||i.compatMode=="CSS1Compat";f.stdMode=i.documentMode===8;this.settings=g=c.extend({keep_values:false,hex_colors:1,process_html:1},g);if(c.isIE6){try{i.execCommand("BackgroundImageCache",false,true)}catch(h){f.cssFlicker=true}}c.addUnload(f.destroy,f)},getRoot:function(){var f=this,g=f.settings;return(g&&f.get(g.root_element))||f.doc.body},getViewPort:function(g){var h,f;g=!g?this.win:g;h=g.document;f=this.boxModel?h.documentElement:h.body;return{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop,w:g.innerWidth||f.clientWidth,h:g.innerHeight||f.clientHeight}},getRect:function(i){var h,f=this,g;i=f.get(i);h=f.getPos(i);g=f.getSize(i);return{x:h.x,y:h.y,w:g.w,h:g.h}},getSize:function(j){var g=this,f,i;j=g.get(j);f=g.getStyle(j,"width");i=g.getStyle(j,"height");if(f.indexOf("px")===-1){f=0}if(i.indexOf("px")===-1){i=0}return{w:parseInt(f)||j.offsetWidth||j.clientWidth,h:parseInt(i)||j.offsetHeight||j.clientHeight}},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},getParent:function(i,h,g){return this.getParents(i,h,g,false)},getParents:function(p,k,i,m){var h=this,g,j=h.settings,l=[];p=h.get(p);m=m===undefined;if(j.strict_root){i=i||h.getRoot()}if(b(k,"string")){g=k;if(k==="*"){k=function(f){return f.nodeType==1}}else{k=function(f){return h.is(f,g)}}}while(p){if(p==i||!p.nodeType||p.nodeType===9){break}if(!k||k(p)){if(m){l.push(p)}else{return p}}p=p.parentNode}return m?l:null},get:function(f){var g;if(f&&this.doc&&typeof(f)=="string"){g=f;f=this.doc.getElementById(f);if(f&&f.id!==g){return this.doc.getElementsByName(g)[1]}}return f},select:function(h,g){var f=this;return c.dom.Sizzle(h,f.get(g)||f.get(f.settings.root_element)||f.doc,[])},add:function(j,l,f,i,k){var g=this;return this.run(j,function(n){var m,h;m=b(l,"string")?g.doc.createElement(l):l;g.setAttribs(m,f);if(i){if(i.nodeType){m.appendChild(i)}else{g.setHTML(m,i)}}return !k?n.appendChild(m):m})},create:function(i,f,g){return this.add(this.doc.createElement(i),i,f,g,1)},createHTML:function(m,f,j){var l="",i=this,g;l+="<"+m;for(g in f){if(f.hasOwnProperty(g)){l+=" "+g+'="'+i.encode(f[g])+'"'}}if(c.is(j)){return l+">"+j+"</"+m+">"}return l+" />"},remove:function(h,f){var g=this;return this.run(h,function(m){var l,k,j;l=m.parentNode;if(!l){return null}if(f){for(j=m.childNodes.length-1;j>=0;j--){g.insertAfter(m.childNodes[j],m)}}if(g.fixPsuedoLeaks){l=m.cloneNode(true);f="IELeakGarbageBin";k=g.get(f)||g.add(g.doc.body,"div",{id:f,style:"display:none"});k.appendChild(m);k.innerHTML="";return l}return l.removeChild(m)})},setStyle:function(i,f,g){var h=this;return h.run(i,function(l){var k,j;k=l.style;f=f.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(h.pixelStyles.test(f)&&(c.is(g,"number")||/^[\-0-9\.]+$/.test(g))){g+="px"}switch(f){case"opacity":if(a){k.filter=g===""?"":"alpha(opacity="+(g*100)+")";if(!i.currentStyle||!i.currentStyle.hasLayout){k.display="inline-block"}}k[f]=k["-moz-opacity"]=k["-khtml-opacity"]=g||"";break;case"float":a?k.styleFloat=g:k.cssFloat=g;break;default:k[f]=g||""}if(h.settings.update_styles){h.setAttrib(l,"mce_style")}})},getStyle:function(i,f,h){i=this.get(i);if(!i){return false}if(this.doc.defaultView&&h){f=f.replace(/[A-Z]/g,function(j){return"-"+j});try{return this.doc.defaultView.getComputedStyle(i,null).getPropertyValue(f)}catch(g){return null}}f=f.replace(/-(\D)/g,function(k,j){return j.toUpperCase()});if(f=="float"){f=a?"styleFloat":"cssFloat"}if(i.currentStyle&&h){return i.currentStyle[f]}return i.style[f]},setStyles:function(i,j){var g=this,h=g.settings,f;f=h.update_styles;h.update_styles=0;e(j,function(k,l){g.setStyle(i,l,k)});h.update_styles=f;if(h.update_styles){g.setAttrib(i,h.cssText)}},setAttrib:function(h,i,f){var g=this;if(!h||!i){return}if(g.settings.strict){i=i.toLowerCase()}return this.run(h,function(k){var j=g.settings;switch(i){case"style":if(!b(f,"string")){e(f,function(l,m){g.setStyle(k,m,l)});return}if(j.keep_values){if(f&&!g._isRes(f)){k.setAttribute("mce_style",f,2)}else{k.removeAttribute("mce_style",2)}}k.style.cssText=f;break;case"class":k.className=f||"";break;case"src":case"href":if(j.keep_values){if(j.url_converter){f=j.url_converter.call(j.url_converter_scope||g,f,i,k)}g.setAttrib(k,"mce_"+i,f,2)}break;case"shape":k.setAttribute("mce_style",f);break}if(b(f)&&f!==null&&f.length!==0){k.setAttribute(i,""+f,2)}else{k.removeAttribute(i,2)}})},setAttribs:function(g,h){var f=this;return this.run(g,function(i){e(h,function(j,k){f.setAttrib(i,k,j)})})},getAttrib:function(i,j,h){var f,g=this;i=g.get(i);if(!i||i.nodeType!==1){return false}if(!b(h)){h=""}if(/^(src|href|style|coords|shape)$/.test(j)){f=i.getAttribute("mce_"+j);if(f){return f}}if(a&&g.props[j]){f=i[g.props[j]];f=f&&f.nodeValue?f.nodeValue:f}if(!f){f=i.getAttribute(j,2)}if(j==="style"){f=f||i.style.cssText;if(f){f=g.serializeStyle(g.parseStyle(f));if(g.settings.keep_values&&!g._isRes(f)){i.setAttribute("mce_style",f)}}}if(d&&j==="class"&&f){f=f.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(j){case"rowspan":case"colspan":if(f===1){f=""}break;case"size":if(f==="+0"||f===20||f===0){f=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(f===0){f=""}break;case"hspace":if(f===-1){f=""}break;case"maxlength":case"tabindex":if(f===32768||f===2147483647||f==="32768"){f=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(f===65535){return j}return h;case"shape":f=f.toLowerCase();break;default:if(j.indexOf("on")===0&&f){f=(""+f).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(f!==undefined&&f!==null&&f!=="")?""+f:h},getPos:function(m,i){var g=this,f=0,l=0,j,k=g.doc,h;m=g.get(m);i=i||k.body;if(m){if(a&&!g.stdMode){m=m.getBoundingClientRect();j=g.boxModel?k.documentElement:k.body;f=g.getStyle(g.select("html")[0],"borderWidth");f=(f=="medium"||g.boxModel&&!g.isIE6)&&2||f;m.top+=g.win.self!=g.win.top?2:0;return{x:m.left+j.scrollLeft-f,y:m.top+j.scrollTop-f}}h=m;while(h&&h!=i&&h.nodeType){f+=h.offsetLeft||0;l+=h.offsetTop||0;h=h.offsetParent}h=m.parentNode;while(h&&h!=i&&h.nodeType){f-=h.scrollLeft||0;l-=h.scrollTop||0;h=h.parentNode}}return{x:f,y:l}},parseStyle:function(h){var i=this,j=i.settings,k={};if(!h){return k}function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-right"+q];if(o!=u){return}m=k[w+"-bottom"+q];if(u!=m){return}n=k[w+"-left"+q];if(m!=n){return}k[v]=n;delete k[w+"-top"+q];delete k[w+"-right"+q];delete k[w+"-bottom"+q];delete k[w+"-left"+q]}function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[p];if(!o){return}k[n]=k[m]+" "+k[l]+" "+k[p];delete k[m];delete k[l];delete k[p]}h=h.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");e(h.split(";"),function(m){var l,n=[];if(m){m=m.replace(/_MCE_SEMI_/g,";");m=m.replace(/url\([^\)]+\)/g,function(o){n.push(o);return"url("+n.length+")"});m=m.split(":");l=c.trim(m[1]);l=l.replace(/url\(([^\)]+)\)/g,function(p,o){return n[parseInt(o)-1]});l=l.replace(/rgb\([^\)]+\)/g,function(o){return i.toHex(o)});if(j.url_converter){l=l.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(o,p){return"url("+j.url_converter.call(j.url_converter_scope||i,i.decode(p),"style",null)+")"})}k[c.trim(m[0]).toLowerCase()]=l}});f("border","","border");f("border","-width","border-width");f("border","-color","border-color");f("border","-style","border-style");f("padding","","padding");f("margin","","margin");g("border","border-width","border-style","border-color");if(a){if(k.border=="medium none"){k.border=""}}return k},serializeStyle:function(g){var f="";e(g,function(i,h){if(h&&i){if(c.isGecko&&h.indexOf("-moz-")===0){return}switch(h){case"color":case"background-color":i=i.toLowerCase();break}f+=(f?" ":"")+h+": "+i+";"}});return f},loadCSS:function(f){var g=this,h=g.doc;if(!f){f=""}e(f.split(","),function(i){if(g.files[i]){return}g.files[i]=true;g.add(g.select("head")[0],"link",{rel:"stylesheet",href:c._addVer(i)})})},addClass:function(f,g){return this.run(f,function(h){var i;if(!g){return 0}if(this.hasClass(h,g)){return h.className}i=this.removeClass(h,g);return h.className=(i!=""?(i+" "):"")+g})},removeClass:function(h,i){var f=this,g;return f.run(h,function(k){var j;if(f.hasClass(k,i)){if(!g){g=new RegExp("(^|\\s+)"+i+"(\\s+|$)","g")}j=k.className.replace(g," ");return k.className=c.trim(j!=" "?j:"")}return k.className})},hasClass:function(g,f){g=this.get(g);if(!g||!f){return false}return(" "+g.className+" ").indexOf(" "+f+" ")!==-1},show:function(f){return this.setStyle(f,"display","block")},hide:function(f){return this.setStyle(f,"display","none")},isHidden:function(f){f=this.get(f);return !f||f.style.display=="none"||this.getStyle(f,"display")=="none"},uniqueId:function(f){return(!f?"mce_":f)+(this.counter++)},setHTML:function(i,g){var f=this;return this.run(i,function(m){var h,k,j,q,l,h;g=f.processHTML(g);if(a){function o(){try{m.innerHTML="<br />"+g;m.removeChild(m.firstChild)}catch(n){while(m.firstChild){m.firstChild.removeNode()}h=f.create("div");h.innerHTML="<br />"+g;e(h.childNodes,function(r,p){if(p){m.appendChild(r)}})}}if(f.settings.fix_ie_paragraphs){g=g.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true"> </p>')}o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("p");for(k=j.length-1,h=0;k>=0;k--){q=j[k];if(!q.hasChildNodes()){if(!q.mce_keep){h=1;break}q.removeAttribute("mce_keep")}}}if(h){g=g.replace(/<p ([^>]+)>|<p>/g,'<div $1 mce_tmp="1">');g=g.replace(/<\/p>/g,"</div>");o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("DIV");for(k=j.length-1;k>=0;k--){q=j[k];if(q.mce_tmp){l=f.doc.createElement("p");q.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(p,n){var r;if(n!=="mce_tmp"){r=q.getAttribute(n);if(!r&&n==="class"){r=q.className}l.setAttribute(n,r)}});for(h=0;h<q.childNodes.length;h++){l.appendChild(q.childNodes[h].cloneNode(true))}q.swapNode(l)}}}}}else{m.innerHTML=g}return g})},processHTML:function(j){var g=this,i=g.settings;if(!i.process_html){return j}if(c.isGecko){j=j.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,"<$1b$2>");j=j.replace(/<(\/?)em>|<em( [^>]+)>/gi,"<$1i$2>")}else{if(a){j=j.replace(/'/g,"'");j=j.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}}j=j.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(i.keep_values){if(/<script|style/.test(j)){function f(h){h=h.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");h=h.replace(/^[\r\n]*|[\r\n]*$/g,"");h=h.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");h=h.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return h}j=j.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g,function(l,k,h){h=f(h);if(!k){k=' type="text/javascript"'}if(h){h="<!--\n"+h+"\n// -->"}return"<mce:script"+k+">"+h+"</mce:script>"});j=j.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g,function(l,k,h){h=f(h);return"<mce:style"+k+"><!--\n"+h+"\n--></mce:style><style"+k+' mce_bogus="1">'+h+"</style>"})}j=j.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");j=j.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(h,l){function k(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="style"){if(g._isRes(q)){return o}if(i.hex_colors){p=p.replace(/rgb\([^\)]+\)/g,function(m){return g.toHex(m)})}if(i.url_converter){p=p.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(m,r){return"url("+g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(r),n,l))+")"})}}else{if(n!="coords"&&n!="shape"){if(i.url_converter){p=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(q),n,l))}}}return" "+n+'="'+q+'" mce_'+n+'="'+p+'"'}h=h.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,k);h=h.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,k);return h.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,k)})}return j},getOuterHTML:function(f){var g;f=this.get(f);if(!f){return null}if(f.outerHTML!==undefined){return f.outerHTML}g=(f.ownerDocument||this.doc).createElement("body");g.appendChild(f.cloneNode(true));return g.innerHTML},setOuterHTML:function(i,g,j){var f=this;return this.run(i,function(h){var l,k;h=f.get(h);j=j||h.ownerDocument||f.doc;if(a&&h.nodeType==1){h.outerHTML=g}else{k=j.createElement("body");k.innerHTML=g;l=k.lastChild;while(l){f.insertAfter(l.cloneNode(true),h);l=l.previousSibling}f.remove(h)}})},decode:function(g){var h,i,f;if(/&[^;]+;/.test(g)){h=this.doc.createElement("div");h.innerHTML=g;i=h.firstChild;f="";if(i){do{f+=i.nodeValue}while(i.nextSibling)}return f||g}return g},encode:function(f){return f?(""+f).replace(/[<>&\"]/g,function(h,g){switch(h){case"&":return"&";case'"':return""";case"<":return"<";case">":return">"}return h}):f},insertAfter:function(h,g){var f=this;g=f.get(g);return this.run(h,function(k){var j,i;j=g.parentNode;i=g.nextSibling;if(i){j.insertBefore(k,i)}else{j.appendChild(k)}return k})},isBlock:function(f){if(f.nodeType&&f.nodeType!==1){return false}f=f.nodeName||f;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(f)},replace:function(i,h,f){var g=this;if(b(h,"array")){i=i.cloneNode(true)}return g.run(h,function(j){if(f){e(j.childNodes,function(k){i.appendChild(k.cloneNode(true))})}if(g.fixPsuedoLeaks&&j.nodeType===1){j.parentNode.insertBefore(i,j);g.remove(j);return i}return j.parentNode.replaceChild(i,j)})},findCommonAncestor:function(h,f){var i=h,g;while(i){g=f;while(g&&i!=g){g=g.parentNode}if(i==g){break}i=i.parentNode}if(!i&&h.ownerDocument){return h.ownerDocument.documentElement}return i},toHex:function(f){var h=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(f);function g(i){i=parseInt(i).toString(16);return i.length>1?i:"0"+i}if(h){f="#"+g(h[1])+g(h[2])+g(h[3]);return f}return f},getClasses:function(){var l=this,g=[],k,m={},n=l.settings.class_filter,j;if(l.classes){return l.classes}function o(f){e(f.imports,function(i){o(i)});e(f.cssRules||f.rules,function(i){switch(i.type||1){case 1:if(i.selectorText){e(i.selectorText.split(","),function(p){p=p.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(p)||!/\.[\w\-]+$/.test(p)){return}j=p;p=p.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(n&&!(p=n(p,j))){return}if(!m[p]){g.push({"class":p});m[p]=1}})}break;case 3:o(i.styleSheet);break}})}try{e(l.doc.styleSheets,o)}catch(h){}if(g.length>0){l.classes=g}return g},run:function(j,i,h){var g=this,k;if(g.doc&&typeof(j)==="string"){j=g.get(j)}if(!j){return false}h=h||this;if(!j.nodeType&&(j.length||j.length===0)){k=[];e(j,function(l,f){if(l){if(typeof(l)=="string"){l=g.doc.getElementById(l)}k.push(i.call(h,l,f))}});return k}return i.call(h,j)},getAttribs:function(g){var f;g=this.get(g);if(!g){return[]}if(a){f=[];if(g.nodeName=="OBJECT"){return g.attributes}g.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(i,h){f.push({specified:1,nodeName:h})});return f}return g.attributes},destroy:function(g){var f=this;f.win=f.doc=f.root=null;if(!g){c.removeUnload(f.destroy)}},createRng:function(){var f=this.doc;return f.createRange?f.createRange():new c.dom.Range(this)},split:function(k,j,n){var o=this,f=o.createRng(),l,i,m;function g(q,p){q=q[p];if(q&&q[p]&&q[p].nodeType==1&&h(q[p])){o.remove(q[p])}}function h(p){p=o.getOuterHTML(p);p=p.replace(/<(img|hr|table)/gi,"-");p=p.replace(/<[^>]+>/g,"");return p.replace(/[ \t\r\n]+| | /g,"")==""}if(k&&j){f.setStartBefore(k);f.setEndBefore(j);l=f.extractContents();f=o.createRng();f.setStartAfter(j);f.setEndAfter(k);i=f.extractContents();m=k.parentNode;g(l,"lastChild");if(!h(l)){m.insertBefore(l,k)}if(n){m.replaceChild(n,j)}else{m.insertBefore(j,k)}g(i,"firstChild");if(!h(i)){m.insertBefore(i,k)}o.remove(k);return n||j}},_isRes:function(f){return/^(top|left|bottom|right|width|height)/i.test(f)||/;\s*(top|left|bottom|right|width|height)/i.test(f)}});c.DOM=new c.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(f){var h=0,c=1,e=2,d=tinymce.extend;function g(m,k){var j,l;if(m.parentNode!=k){return -1}for(l=k.firstChild,j=0;l!=m;l=l.nextSibling){j++}return j}function b(k){var j=0;while(k.previousSibling){j++;k=k.previousSibling}return j}function i(j,k){var l;if(j.nodeType==3){return j}if(k<0){return j}l=j.firstChild;while(l!=null&&k>0){--k;l=l.nextSibling}if(l!=null){return l}return j}function a(k){var j=k.doc;d(this,{dom:k,startContainer:j,startOffset:0,endContainer:j,endOffset:0,collapsed:true,commonAncestorContainer:j,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3})}d(a.prototype,{setStart:function(k,j){this._setEndPoint(true,k,j)},setEnd:function(k,j){this._setEndPoint(false,k,j)},setStartBefore:function(j){this.setStart(j.parentNode,b(j))},setStartAfter:function(j){this.setStart(j.parentNode,b(j)+1)},setEndBefore:function(j){this.setEnd(j.parentNode,b(j))},setEndAfter:function(j){this.setEnd(j.parentNode,b(j)+1)},collapse:function(k){var j=this;if(k){j.endContainer=j.startContainer;j.endOffset=j.startOffset}else{j.startContainer=j.endContainer;j.startOffset=j.endOffset}j.collapsed=true},selectNode:function(j){this.setStartBefore(j);this.setEndAfter(j)},selectNodeContents:function(j){this.setStart(j,0);this.setEnd(j,j.nodeType===1?j.childNodes.length:j.nodeValue.length)},compareBoundaryPoints:function(m,n){var l=this,p=l.startContainer,o=l.startOffset,k=l.endContainer,j=l.endOffset;if(m===0){return l._compareBoundaryPoints(p,o,p,o)}if(m===1){return l._compareBoundaryPoints(p,o,k,j)}if(m===2){return l._compareBoundaryPoints(k,j,k,j)}if(m===3){return l._compareBoundaryPoints(k,j,p,o)}},deleteContents:function(){this._traverse(e)},extractContents:function(){return this._traverse(h)},cloneContents:function(){return this._traverse(c)},insertNode:function(m){var j=this,l,k;if(m.nodeType===3||m.nodeType===4){l=j.startContainer.splitText(j.startOffset);j.startContainer.parentNode.insertBefore(m,l)}else{if(j.startContainer.childNodes.length>0){k=j.startContainer.childNodes[j.startOffset]}j.startContainer.insertBefore(m,k)}},surroundContents:function(l){var j=this,k=j.extractContents();j.insertNode(l);l.appendChild(k);j.selectNode(l)},cloneRange:function(){var j=this;return d(new a(j.dom),{startContainer:j.startContainer,startOffset:j.startOffset,endContainer:j.endContainer,endOffset:j.endOffset,collapsed:j.collapsed,commonAncestorContainer:j.commonAncestorContainer})},_isCollapsed:function(){return(this.startContainer==this.endContainer&&this.startOffset==this.endOffset)},_compareBoundaryPoints:function(m,p,k,o){var q,l,j,r,t,s;if(m==k){if(p==o){return 0}else{if(p<o){return -1}else{return 1}}}q=k;while(q&&q.parentNode!=m){q=q.parentNode}if(q){l=0;j=m.firstChild;while(j!=q&&l<p){l++;j=j.nextSibling}if(p<=l){return -1}else{return 1}}q=m;while(q&&q.parentNode!=k){q=q.parentNode}if(q){l=0;j=k.firstChild;while(j!=q&&l<o){l++;j=j.nextSibling}if(l<o){return -1}else{return 1}}r=this.dom.findCommonAncestor(m,k);t=m;while(t&&t.parentNode!=r){t=t.parentNode}if(!t){t=r}s=k;while(s&&s.parentNode!=r){s=s.parentNode}if(!s){s=r}if(t==s){return 0}j=r.firstChild;while(j){if(j==t){return -1}if(j==s){return 1}j=j.nextSibling}},_setEndPoint:function(k,q,p){var l=this,j,m;if(k){l.startContainer=q;l.startOffset=p}else{l.endContainer=q;l.endOffset=p}j=l.endContainer;while(j.parentNode){j=j.parentNode}m=l.startContainer;while(m.parentNode){m=m.parentNode}if(m!=j){l.collapse(k)}else{if(l._compareBoundaryPoints(l.startContainer,l.startOffset,l.endContainer,l.endOffset)>0){l.collapse(k)}}l.collapsed=l._isCollapsed();l.commonAncestorContainer=l.dom.findCommonAncestor(l.startContainer,l.endContainer)},_traverse:function(r){var s=this,q,m=0,v=0,k,o,l,n,j,u;if(s.startContainer==s.endContainer){return s._traverseSameContainer(r)}for(q=s.endContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.startContainer){return s._traverseCommonStartContainer(q,r)}++m}for(q=s.startContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.endContainer){return s._traverseCommonEndContainer(q,r)}++v}o=v-m;l=s.startContainer;while(o>0){l=l.parentNode;o--}n=s.endContainer;while(o<0){n=n.parentNode;o++}for(j=l.parentNode,u=n.parentNode;j!=u;j=j.parentNode,u=u.parentNode){l=j;n=u}return s._traverseCommonAncestors(l,n,r)},_traverseSameContainer:function(o){var r=this,q,u,j,k,l,p,m;if(o!=e){q=r.dom.doc.createDocumentFragment()}if(r.startOffset==r.endOffset){return q}if(r.startContainer.nodeType==3){u=r.startContainer.nodeValue;j=u.substring(r.startOffset,r.endOffset);if(o!=c){r.startContainer.deleteData(r.startOffset,r.endOffset-r.startOffset);r.collapse(true)}if(o==e){return null}q.appendChild(r.dom.doc.createTextNode(j));return q}k=i(r.startContainer,r.startOffset);l=r.endOffset-r.startOffset;while(l>0){p=k.nextSibling;m=r._traverseFullySelected(k,o);if(q){q.appendChild(m)}--l;k=p}if(o!=c){r.collapse(true)}return q},_traverseCommonStartContainer:function(j,p){var s=this,r,k,l,m,q,o;if(p!=e){r=s.dom.doc.createDocumentFragment()}k=s._traverseRightBoundary(j,p);if(r){r.appendChild(k)}l=g(j,s.startContainer);m=l-s.startOffset;if(m<=0){if(p!=c){s.setEndBefore(j);s.collapse(false)}return r}k=j.previousSibling;while(m>0){q=k.previousSibling;o=s._traverseFullySelected(k,p);if(r){r.insertBefore(o,r.firstChild)}--m;k=q}if(p!=c){s.setEndBefore(j);s.collapse(false)}return r},_traverseCommonEndContainer:function(m,p){var s=this,r,o,j,k,q,l;if(p!=e){r=s.dom.doc.createDocumentFragment()}j=s._traverseLeftBoundary(m,p);if(r){r.appendChild(j)}o=g(m,s.endContainer);++o;k=s.endOffset-o;j=m.nextSibling;while(k>0){q=j.nextSibling;l=s._traverseFullySelected(j,p);if(r){r.appendChild(l)}--k;j=q}if(p!=c){s.setStartAfter(m);s.collapse(true)}return r},_traverseCommonAncestors:function(p,j,s){var w=this,l,v,o,q,r,k,u,m;if(s!=e){v=w.dom.doc.createDocumentFragment()}l=w._traverseLeftBoundary(p,s);if(v){v.appendChild(l)}o=p.parentNode;q=g(p,o);r=g(j,o);++q;k=r-q;u=p.nextSibling;while(k>0){m=u.nextSibling;l=w._traverseFullySelected(u,s);if(v){v.appendChild(l)}u=m;--k}l=w._traverseRightBoundary(j,s);if(v){v.appendChild(l)}if(s!=c){w.setStartAfter(p);w.collapse(true)}return v},_traverseRightBoundary:function(p,q){var s=this,l=i(s.endContainer,s.endOffset-1),r,o,n,j,k;var m=l!=s.endContainer;if(l==p){return s._traverseNode(l,m,false,q)}r=l.parentNode;o=s._traverseNode(r,false,false,q);while(r!=null){while(l!=null){n=l.previousSibling;j=s._traverseNode(l,m,false,q);if(q!=e){o.insertBefore(j,o.firstChild)}m=true;l=n}if(r==p){return o}l=r.previousSibling;r=r.parentNode;k=s._traverseNode(r,false,false,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseLeftBoundary:function(p,q){var s=this,m=i(s.startContainer,s.startOffset);var n=m!=s.startContainer,r,o,l,j,k;if(m==p){return s._traverseNode(m,n,true,q)}r=m.parentNode;o=s._traverseNode(r,false,true,q);while(r!=null){while(m!=null){l=m.nextSibling;j=s._traverseNode(m,n,true,q);if(q!=e){o.appendChild(j)}n=true;m=l}if(r==p){return o}m=r.nextSibling;r=r.parentNode;k=s._traverseNode(r,false,true,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseNode:function(j,o,r,s){var u=this,m,l,p,k,q;if(o){return u._traverseFullySelected(j,s)}if(j.nodeType==3){m=j.nodeValue;if(r){k=u.startOffset;l=m.substring(k);p=m.substring(0,k)}else{k=u.endOffset;l=m.substring(0,k);p=m.substring(k)}if(s!=c){j.nodeValue=p}if(s==e){return null}q=j.cloneNode(false);q.nodeValue=l;return q}if(s==e){return null}return j.cloneNode(false)},_traverseFullySelected:function(l,k){var j=this;if(k!=e){return k==c?l.cloneNode(true):l}l.parentNode.removeChild(l);return null}});f.Range=a})(tinymce.dom);(function(){function a(e){var d=this,h="\uFEFF",b,g;function c(j,i){if(j&&i){if(j.item&&i.item&&j.item(0)===i.item(0)){return 1}if(j.isEqual&&i.isEqual&&i.isEqual(j)){return 1}}return 0}function f(){var m=e.dom,j=e.getRng(),s=m.createRng(),p,k,n,q,o,l;function i(v){var t=v.parentNode.childNodes,u;for(u=t.length-1;u>=0;u--){if(t[u]==v){return u}}return -1}function r(v){var t=j.duplicate(),B,y,u,w,x=0,z=0,A,C;t.collapse(v);B=t.parentElement();t.pasteHTML(h);u=B.childNodes;for(y=0;y<u.length;y++){w=u[y];if(y>0&&(w.nodeType!==3||u[y-1].nodeType!==3)){z++}if(w.nodeType===3){A=w.nodeValue.indexOf(h);if(A!==-1){x+=A;break}x+=w.nodeValue.length}else{x=0}}t.moveStart("character",-1);t.text="";return{index:z,offset:x,parent:B}}n=j.item?j.item(0):j.parentElement();if(n.ownerDocument!=m.doc){return s}if(j.item||!n.hasChildNodes()){s.setStart(n.parentNode,i(n));s.setEnd(s.startContainer,s.startOffset+1);return s}l=e.isCollapsed();p=r(true);k=r(false);p.parent.normalize();k.parent.normalize();q=p.parent.childNodes[Math.min(p.index,p.parent.childNodes.length-1)];if(q.nodeType!=3){s.setStart(p.parent,p.index)}else{s.setStart(p.parent.childNodes[p.index],p.offset)}o=k.parent.childNodes[Math.min(k.index,k.parent.childNodes.length-1)];if(o.nodeType!=3){if(!l){k.index++}s.setEnd(k.parent,k.index)}else{s.setEnd(k.parent.childNodes[k.index],k.offset)}if(!l){q=s.startContainer;if(q.nodeType==1){s.setStart(q,Math.min(s.startOffset,q.childNodes.length))}o=s.endContainer;if(o.nodeType==1){s.setEnd(o,Math.min(s.endOffset,o.childNodes.length))}}d.addRange(s);return s}this.addRange=function(j){var o,m=e.dom.doc.body,p,k,q,l,n,i;q=j.startContainer;l=j.startOffset;n=j.endContainer;i=j.endOffset;o=m.createTextRange();q=q.nodeType==1?q.childNodes[Math.min(l,q.childNodes.length-1)]:q;n=n.nodeType==1?n.childNodes[Math.min(l==i?i:i-1,n.childNodes.length-1)]:n;if(q==n&&q.nodeType==1){if(/^(IMG|TABLE)$/.test(q.nodeName)&&l!=i){o=m.createControlRange();o.addElement(q)}else{o=m.createTextRange();if(!q.hasChildNodes()&&q.canHaveHTML){q.innerHTML=h}o.moveToElementText(q);if(q.innerHTML==h){o.collapse(true);q.removeChild(q.firstChild)}}if(l==i){o.collapse(i<=j.endContainer.childNodes.length-1)}o.select();return}function r(t,v){var u,s,w;if(t.nodeType!=3){return -1}u=t.nodeValue;s=m.createTextRange();t.nodeValue=u.substring(0,v)+h+u.substring(v);s.moveToElementText(t.parentNode);s.findText(h);w=Math.abs(s.moveStart("character",-1048575));t.nodeValue=u;return w}if(j.collapsed){pos=r(q,l);o=m.createTextRange();o.move("character",pos);o.select();return}else{if(q==n&&q.nodeType==3){p=r(q,l);o.move("character",p);o.moveEnd("character",i-l);o.select();return}p=r(q,l);k=r(n,i);o=m.createTextRange();if(p==-1){o.moveToElementText(q);p=0}else{o.move("character",p)}tmpRng=m.createTextRange();if(k==-1){tmpRng.moveToElementText(n)}else{tmpRng.move("character",k)}o.setEndPoint("EndToEnd",tmpRng);o.select();return}};this.getRangeAt=function(){if(!b||!c(g,e.getRng())){b=f();g=e.getRng()}return b};this.destroy=function(){g=b=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("static tinymce.dom.Event",{inits:[],events:[],add:function(m,p,l,j){var g,h=this,i=h.events,k;if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){n=n||window.event;if(n&&!n.target&&b){n.target=n.srcElement}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},_unload:function(){var g=a;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(){var g=a;if(g.domLoaded){return}g._remove(window,"DOMContentLoaded",g._pageInit);g.domLoaded=true;f(g.inits,function(h){h()});g.inits=[]},_wait:function(){if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){a.domLoaded=1;return}if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);a._pageInit()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(a.domLoaded){return}try{document.documentElement.doScroll("left")}catch(g){setTimeout(arguments.callee,0);return}a._pageInit()})()}}else{if(document.addEventListener){a._add(window,"DOMContentLoaded",a._pageInit,a)}}a._add(window,"load",a._pageInit,a)}});a=d.dom.Event;a._wait();d.addUnload(a._unload)})(tinymce);(function(a){var b=a.each;a.create("tinymce.dom.Element",{Element:function(g,e){var c=this,f,d;e=e||{};c.id=g;c.dom=f=e.dom||a.DOM;c.settings=e;if(!a.isIE){d=c.dom.get(c.id)}b(["getPos","getRect","getParent","add","setStyle","getStyle","setStyles","setAttrib","setAttribs","getAttrib","addClass","removeClass","hasClass","getOuterHTML","setOuterHTML","remove","show","hide","isHidden","setHTML","get"],function(h){c[h]=function(){var j=[g],k;for(k=0;k<arguments.length;k++){j.push(arguments[k])}j=f[h].apply(f,j);c.update(h);return j}})},on:function(e,d,c){return a.dom.Event.add(this.id,e,d,c)},getXY:function(){return{x:parseInt(this.getStyle("left")),y:parseInt(this.getStyle("top"))}},getSize:function(){var c=this.dom.get(this.id);return{w:parseInt(this.getStyle("width")||c.clientWidth),h:parseInt(this.getStyle("height")||c.clientHeight)}},moveTo:function(c,d){this.setStyles({left:c,top:d})},moveBy:function(c,e){var d=this.getXY();this.moveTo(d.x+c,d.y+e)},resizeTo:function(c,d){this.setStyles({width:c,height:d})},resizeBy:function(c,e){var d=this.getSize();this.resizeTo(d.w+c,d.h+e)},update:function(d){var e=this,c,f=e.dom;if(a.isIE6&&e.settings.blocker){d=d||"";if(d.indexOf("get")===0||d.indexOf("has")===0||d.indexOf("is")===0){return}if(d=="remove"){f.remove(e.blocker);return}if(!e.blocker){e.blocker=f.uniqueId();c=f.add(e.settings.container||f.getRoot(),"iframe",{id:e.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});f.setStyle(c,"opacity",0)}else{c=f.get(e.blocker)}f.setStyle(c,"left",e.getStyle("left",1));f.setStyle(c,"top",e.getStyle("top",1));f.setStyle(c,"width",e.getStyle("width",1));f.setStyle(c,"height",e.getStyle("height",1));f.setStyle(c,"display",e.getStyle("display",1));f.setStyle(c,"zIndex",parseInt(e.getStyle("zIndex",1)||0)-1)}}})})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';j.deleteContents();j.insertNode(f.getRng().createContextualFragment(i));l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndAfter(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(1);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.firstChild}return h}else{h=g.startContainer;if(h.nodeName=="BODY"){return h.firstChild}return f.dom.getParent(h,"*")}},getEnd:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.lastChild}return h}else{h=g.endContainer;if(h.nodeName=="BODY"){return h.lastChild}return f.dom.getParent(h,"*")}},getBookmark:function(x){var j=this,m=j.getRng(),f,n,l,u=j.dom.getViewPort(j.win),v,p,z,o,w=-16777215,k,h=j.dom.getRoot(),g=0,i=0,y;n=u.x;l=u.y;if(x=="simple"){return{rng:m,scrollX:n,scrollY:l}}if(a){if(m.item){v=m.item(0);d(j.dom.select(v.nodeName),function(s,r){if(v==s){p=r;return false}});return{tag:v.nodeName,index:p,scrollX:n,scrollY:l}}f=j.dom.doc.body.createTextRange();f.moveToElementText(h);f.collapse(true);z=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(true);p=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(false);o=Math.abs(f.move("character",w))-p;return{start:p-z,length:o,scrollX:n,scrollY:l}}v=j.getNode();k=j.getSel();if(!k){return null}if(v&&v.nodeName=="IMG"){return{scrollX:n,scrollY:l}}function q(A,D,t){var s=j.dom.doc.createTreeWalker(A,NodeFilter.SHOW_TEXT,null,false),E,B=0,C={};while((E=s.nextNode())!=null){if(E==D){C.start=B}if(E==t){C.end=B;return C}B+=e(E.nodeValue||"").length}return null}if(k.anchorNode==k.focusNode&&k.anchorOffset==k.focusOffset){v=q(h,k.anchorNode,k.focusNode);if(!v){return{scrollX:n,scrollY:l}}e(k.anchorNode.nodeValue||"").replace(/^\s+/,function(r){g=r.length});return{start:Math.max(v.start+k.anchorOffset-g,0),end:Math.max(v.end+k.focusOffset-g,0),scrollX:n,scrollY:l,beg:k.anchorOffset-g==0}}else{v=q(h,m.startContainer,m.endContainer);if(!v){return{scrollX:n,scrollY:l}}return{start:Math.max(v.start+m.startOffset-g,0),end:Math.max(v.end+m.endOffset-i,0),scrollX:n,scrollY:l,beg:m.startOffset-g==0}}},moveToBookmark:function(n){var o=this,g=o.getRng(),p=o.getSel(),j=o.dom.getRoot(),m,h,k;function i(q,t,D){var B=o.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,false),x,s=0,A={},u,C,z,y;while((x=B.nextNode())!=null){z=y=0;k=x.nodeValue||"";h=e(k).length;s+=h;if(s>=t&&!A.startNode){u=t-(s-h);if(n.beg&&u>=h){continue}A.startNode=x;A.startOffset=u+y}if(s>=D){A.endNode=x;A.endOffset=D-(s-h)+y;return A}}return null}if(!n){return false}o.win.scrollTo(n.scrollX,n.scrollY);if(a){if(g=n.rng){try{g.select()}catch(l){}return true}o.win.focus();if(n.tag){g=j.createControlRange();d(o.dom.select(n.tag),function(r,q){if(q==n.index){g.addElement(r)}})}else{try{if(n.start<0){return true}g=p.createRange();g.moveToElementText(j);g.collapse(true);g.moveStart("character",n.start);g.moveEnd("character",n.length)}catch(f){return true}}try{g.select()}catch(l){}return true}if(!p){return false}if(n.rng){p.removeAllRanges();p.addRange(n.rng)}else{if(b(n.start)&&b(n.end)){try{m=i(j,n.start,n.end);if(m){g=o.dom.doc.createRange();g.setStart(m.startNode,m.startOffset);g.setEnd(m.endNode,m.endOffset);p.removeAllRanges();p.addRange(g)}if(!c.isOpera){o.win.focus()}}catch(l){}}}},select:function(g,l){var p=this,f=p.getRng(),q=p.getSel(),o,m,k,j=p.win.document;function h(u,t){var s,r;if(u){s=j.createTreeWalker(u,NodeFilter.SHOW_TEXT,null,false);while(u=s.nextNode()){r=u;if(c.trim(u.nodeValue).length!=0){if(t){return u}else{r=u}}}}return r}if(a){try{o=j.body;if(/^(IMG|TABLE)$/.test(g.nodeName)){f=o.createControlRange();f.addElement(g)}else{f=o.createTextRange();f.moveToElementText(g)}f.select()}catch(i){}}else{if(l){m=h(g,1)||p.dom.select("br:first",g)[0];k=h(g,0)||p.dom.select("br:last",g)[0];if(m&&k){f=j.createRange();if(m.nodeName=="BR"){f.setStartBefore(m)}else{f.setStart(m,0)}if(k.nodeName=="BR"){f.setEndBefore(k)}else{f.setEnd(k,k.nodeValue.length)}}else{f.selectNode(g)}}else{f.selectNode(g)}p.setRng(f)}return g},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}return !g||h.boundingWidth==0||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=a?g.win.document.body.createTextRange():g.win.document.createRange()}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){h.removeAllRanges();h.addRange(i)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var f=this,h=f.getRng(),g=f.getSel(),i;if(!a){if(!h){return f.dom.getRoot()}i=h.commonAncestorContainer;if(!h.collapsed){if(c.isWebKit&&g.anchorNode&&g.anchorNode.nodeType==1){return g.anchorNode.childNodes[g.anchorOffset]}if(h.startContainer==h.endContainer){if(h.startOffset-h.endOffset<2){if(h.startContainer.hasChildNodes()){i=h.startContainer.childNodes[h.startOffset]}}}}return f.dom.getParent(i,"*")}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATA(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,">")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:1},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"<";case">":return">";case"&":return"&";case'"':return"""}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",bool_attrs:/(checked|disabled|readonly|selected|nowrap)/,valid_elements:"*[*]",extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,y,w=["ol","ul"],u,t,q,k=/^(OL|UL)$/,z;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(y=0;y<w.length;y++){l=i.dom.select(w[y],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){z=m(t,"LI");if(!z){z=i.dom.create("li");z.innerHTML=" ";z.appendChild(t);q.insertBefore(z,q.firstChild)}else{z.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){f(i.dom.select("p table",l.node),function(m){i.dom.split(i.dom.getParent(m,"p"),m)})})}},setEntities:function(p){var n=this,j,m,h={},o="",k;if(n.entityLookup){return}j=p.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16);o+="\\u"+"0000".substring(k.length)+k}if(!o){n.settings.entity_encoding="raw";return}n.entitiesRE=new RegExp("["+o+"]","g");n.entityLookup=h},setValidChildRules:function(h){this.childRules=null;this.addValidChildRules(h)},addValidChildRules:function(k){var j=this,l,h,i;if(!k){return}l="A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment";h="A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment";i="H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP";f(k.split(","),function(n){var o=n.split(/\[|\]/),m;n="";f(o[1].split("|"),function(p){if(n){n+="|"}switch(p){case"%itrans":p=h;break;case"%itrans_na":p=h.substring(2);break;case"%istrict":p=l;break;case"%istrict_na":p=l.substring(2);break;case"%btrans":p=i;break;case"%bstrict":p=i;break}n+=p});m=new RegExp("^("+n.toLowerCase()+")$","i");f(o[0].split("/"),function(p){j.childRules=j.childRules||{};j.childRules[p]=m})});k="";f(j.childRules,function(n,m){if(k){k+="|"}k+=m});j.parentElementsRE=new RegExp("^("+k.toLowerCase()+")$","i")},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var w=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(w){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(l,k){var j,i=this;i._setup();k=k||{};k.format=k.format||"html";i.processObj=k;l=l.cloneNode(true);i.key=""+(parseInt(i.key)+1);if(!k.no_events){k.node=l;i.onPreProcess.dispatch(i,k)}i.writer.reset();i._serializeNode(l,k.getInner);k.content=i.writer.getContent();if(!k.no_events){i.onPostProcess.dispatch(i,k)}i._postProcess(k);k.node=null;return e.trim(k.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1> </p>":"<p$1> </p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");if(k.entity_encoding=="raw"){j=j.replace(/<p> <\/p>|<p([^>]+)> <\/p>/g,"<p$1>\u00a0</p>")}}n.content=j},_serializeNode:function(C,m){var y=this,z=y.settings,u=y.writer,p,j,r,E,D,F,A,h,x,k,q,B,o;if(!z.node_filter||z.node_filter(C)){switch(C.nodeType){case 1:if(C.hasAttribute?C.hasAttribute("mce_bogus"):C.getAttribute("mce_bogus")){return}o=false;p=C.hasChildNodes();k=C.getAttribute("mce_name")||C.nodeName.toLowerCase();if(d){if(C.scopeName!=="HTML"&&C.scopeName!=="html"){k=C.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!y.validElementsRE.test(k)||(y.invalidElementsRE&&y.invalidElementsRE.test(k))||m){o=true;break}if(d){if(z.fix_content_duplication){if(C.mce_serialized==y.key){return}C.mce_serialized=y.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(C.nodeName==="BR"&&C.getAttribute("type")=="_moz"){return}}}if(y.childRules){if(y.parentElementsRE.test(y.elementName)){if(!y.childRules[y.elementName].test(k)){o=true;break}}y.elementName=k}q=y.findRule(k);k=q.name||k;if((!p&&q.noEmpty)||(d&&!k)){o=true;break}if(q.requiredAttribs){F=q.requiredAttribs;for(E=F.length-1;E>=0;E--){if(this.dom.getAttrib(C,F[E])!==""){break}}if(E==-1){o=true;break}}u.writeStartElement(k);if(q.attribs){for(E=0,A=q.attribs,D=A.length;E<D;E++){F=A[E];x=y._getAttrib(C,F);if(x!==null){u.writeAttribute(F.name,x)}}}if(q.validAttribsRE){A=y.dom.getAttribs(C);for(E=A.length-1;E>-1;E--){h=A[E];if(h.specified){F=h.nodeName.toLowerCase();if(z.invalid_attrs.test(F)||!q.validAttribsRE.test(F)){continue}B=y.findAttribRule(q,F);x=y._getAttrib(C,B,F);if(x!==null){u.writeAttribute(F,x)}}}}if(q.padd){if(p&&(r=C.firstChild)&&r.nodeType===1&&C.childNodes.length===1){if(r.hasAttribute?r.hasAttribute("mce_bogus"):r.getAttribute("mce_bogus")){u.writeText("\u00a0")}}else{if(!p){u.writeText("\u00a0")}}}break;case 3:if(y.childRules&&y.parentElementsRE.test(y.elementName)){if(!y.childRules[y.elementName].test(C.nodeName)){return}}return u.writeText(C.nodeValue);case 4:return u.writeCDATA(C.nodeValue);case 8:return u.writeComment(C.nodeValue)}}else{if(C.nodeType==1){p=C.hasChildNodes()}}if(p){r=C.firstChild;while(r){y._serializeNode(r);y.elementName=k;r=r.nextSibling}}if(!o){if(p||!z.closed.test(k)){u.writeFullEndElement()}else{u.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(j.entitiesRE,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);h.addValidChildRules(i.valid_child_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);if(this.settings.bool_attrs.test(h)&&k){k=(""+k).toLowerCase();if(k==="false"||k==="0"){return null}k=h}switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(tinymce){var each=tinymce.each,Event=tinymce.dom.Event;tinymce.create("tinymce.dom.ScriptLoader",{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={}},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0},markDone:function(u){this.lookup[u]={state:2,url:u}},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2){cb.call(s||this)}return o}o={state:0,url:u,func:cb,scope:s||this};if(pr){t.queue.unshift(o)}else{t.queue.push(o)}lo[u]=o;return o},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2){cb.call(s||t)}return o}function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co)}})}else{document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"><\/script>')}}if(!tinymce.is(u,"string")){each(u,function(u){loadScript(u)});if(cb){cb.call(s||t)}}else{loadScript(u);if(cb){cb.call(s||t)}}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb){cb.call(s||t)}each(t.queueCallbacks,function(o){o.func.call(o.scope)})})}else{if(cb){t.queueCallbacks.push({func:cb,scope:s||t})}}},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co)}catch(ex){eval(co,w)}}else{w.execScript(co)}},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func){o.func.call(o.scope||t)}}function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--}else{load(o)}});if(l===0&&cb){cb.call(s||t);cb=0}}function load(o){if(o.state>0){return}o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone()})}each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o)}else{o=lo[u]}if(o.state>0){return}if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol="";if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone()});if(tinymce.isIE){ol=' onreadystatechange="'}else{ol=' onload="'}ol+="tinymce.dom.ScriptLoader._onLoad(this,'"+u+"',"+ix+');"'}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+"><\/script>");if(!o.func){done(o)}}else{load(o)}});allDone()},"static":{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=="complete"){this._funcs[ix].call(this)}},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0}}if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done()}})}else{e=tinymce.DOM.create("script",{id:id,type:"text/javascript",src:tinymce._addVer(u)});Event.add(e,"load",done);(document.getElementsByTagName("head")[0]||document.body).appendChild(e)}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader()})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(w){var h,t,s;w=w.target;if(w&&(w=c.getParent(w,"tr"))){h=z.items[w.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(w&&c.hasClass(w,m+"ItemSub")){t=c.getRect(w);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(h){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(l){var i=-1,j,k=l.keyCode;e(f.items,function(m,n){if(f.selectedValue==m.value){i=n}});if(k==38){j=f.items[i-1]}else{if(k==40){j=f.items[i+1]}else{if(k==13){j=f.selectedValue;f.selectedValue=null;f.settings.onselect(j);return b.cancel(l)}}}if(j){f.hideMenu();f.select(j.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return c.get(this.id).options.length-1},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.onShowMenu.dispatch(f);f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(f){var d,e=b.EditorManager.settings;if(e&&e.language){d=this.urls[f]+"/langs/"+e.language+".js";if(!b.dom.Event.domLoaded&&!e.strict_mode){b.ScriptLoader.load(d)}else{b.ScriptLoader.add(d)}}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(f){var g=f.each,h=f.extend,e=f.DOM,a=f.dom.Event,c=f.ThemeManager,b=f.PluginManager,d=f.explode;f.create("static tinymce.EditorManager",{editors:{},i18n:{},activeEditor:null,preInit:function(){var i=this,j=window.location;f.documentBaseURL=j.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(f.documentBaseURL)){f.documentBaseURL+="/"}f.baseURL=new f.util.URI(f.documentBaseURL).toAbsolute(f.baseURL);f.EditorManager.baseURI=new f.util.URI(f.baseURL);if(document.domain&&j.hostname!=document.domain){f.relaxedDomain=document.domain}i.onBeforeUnload=new f.util.Dispatcher(i);a.add(window,"beforeunload",function(k){i.onBeforeUnload.dispatch(i,k)})},init:function(q){var p=this,l,k=f.ScriptLoader,o,n,i=[],m;function j(u,v,r){var t=u[v];if(!t){return}if(f.is(t,"string")){r=t.replace(/\.\w+$/,"");r=r?f.resolve(r):0;t=f.resolve(t)}return t.apply(r||this,Array.prototype.slice.call(arguments,2))}q=h({theme:"simple",language:"en",strict_loading_mode:document.contentType=="application/xhtml+xml"},q);p.settings=q;if(!a.domLoaded&&!q.strict_loading_mode){if(q.language){k.add(f.baseURL+"/langs/"+q.language+".js")}if(q.theme&&q.theme.charAt(0)!="-"&&!c.urls[q.theme]){c.load(q.theme,"themes/"+q.theme+"/editor_template"+f.suffix+".js")}if(q.plugins){l=d(q.plugins);if(f.inArray(l,"compat2x")!=-1){b.load("compat2x","plugins/compat2x/editor_plugin"+f.suffix+".js")}g(l,function(r){if(r&&r.charAt(0)!="-"&&!b.urls[r]){if(!f.isWebKit&&r=="safari"){return}b.load(r,"plugins/"+r+"/editor_plugin"+f.suffix+".js")}})}k.loadQueue()}a.add(document,"init",function(){var r,t;j(q,"onpageload");if(q.browsers){r=false;g(d(q.browsers),function(u){switch(u){case"ie":case"msie":if(f.isIE){r=true}break;case"gecko":if(f.isGecko){r=true}break;case"safari":case"webkit":if(f.isWebKit){r=true}break;case"opera":if(f.isOpera){r=true}break}});if(!r){return}}switch(q.mode){case"exact":r=q.elements||"";if(r.length>0){g(d(r),function(u){if(e.get(u)){m=new f.Editor(u,q);i.push(m);m.render(1)}else{o=0;g(document.forms,function(v){g(v.elements,function(w){if(w.name===u){u="mce_editor_"+o;e.setAttrib(w,"id",u);m=new f.Editor(u,q);i.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function s(v,u){return u.constructor===RegExp?u.test(v.className):e.hasClass(v,u)}g(e.select("textarea"),function(u){if(q.editor_deselector&&s(u,q.editor_deselector)){return}if(!q.editor_selector||s(u,q.editor_selector)){n=e.get(u.name);if(!u.id&&!n){u.id=u.name}if(!u.id||p.get(u.id)){u.id=e.uniqueId()}m=new f.Editor(u.id,q);i.push(m);m.render(1)}});break}if(q.oninit){r=t=0;g(i,function(u){t++;if(!u.initialized){u.onInit.add(function(){r++;if(r==t){j(q,"oninit")}})}else{r++}if(r==t){j(q,"oninit")}})}})},get:function(i){return this.editors[i]},getInstanceById:function(i){return this.get(i)},add:function(i){this.editors[i.id]=i;this._setActive(i);return i},remove:function(j){var i=this;if(!i.editors[j.id]){return null}delete i.editors[j.id];if(i.activeEditor==j){g(i.editors,function(k){i._setActive(k);return false})}j.destroy();return j},execCommand:function(o,m,l){var n=this,k=n.get(l),i;switch(o){case"mceFocus":k.focus();return true;case"mceAddEditor":case"mceAddControl":if(!n.get(l)){new f.Editor(l,n.settings).render()}return true;case"mceAddFrameControl":i=l.window;i.tinyMCE=tinyMCE;i.tinymce=f;f.DOM.doc=i.document;f.DOM.win=i;k=new f.Editor(l.element_id,l);k.render();if(f.isIE){function j(){k.destroy();i.detachEvent("onunload",j);i=i.tinyMCE=i.tinymce=null}i.attachEvent("onunload",j)}l.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(k){k.remove()}return true;case"mceToggleEditor":if(!k){n.execCommand("mceAddControl",0,l);return true}if(k.isHidden()){k.show()}else{k.hide()}return true}if(n.activeEditor){return n.activeEditor.execCommand(o,m,l)}return false},execInstanceCommand:function(m,l,k,j){var i=this.get(m);if(i){return i.execCommand(l,k,j)}return false},triggerSave:function(){g(this.editors,function(i){i.save()})},addI18n:function(k,l){var i,j=this.i18n;if(!f.is(k,"string")){g(k,function(n,m){g(n,function(q,p){g(q,function(s,r){if(p==="common"){j[m+"."+r]=s}else{j[m+"."+p+"."+r]=s}})})})}else{g(l,function(n,m){j[k+"."+m]=n})}},_setActive:function(i){this.selectedInstance=this.activeEditor=i}});f.EditorManager.preInit()})(tinymce);var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(n){var o=n.DOM,k=n.dom.Event,f=n.extend,l=n.util.Dispatcher;var j=n.each,a=n.isGecko,b=n.isIE,e=n.isWebKit;var d=n.is,h=n.ThemeManager,c=n.PluginManager,i=n.EditorManager;var p=n.inArray,m=n.grep,g=n.explode;n.create("tinymce.Editor",{Editor:function(u,r){var q=this;q.id=q.editorId=u;q.execCommands={};q.queryStateCommands={};q.queryValueCommands={};q.plugins={};j(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){q[s]=new l(q)});q.settings=r=f({id:u,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:n.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:"mceItemTable",visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,removeformat_selector:"span,b,strong,em,i,font,u,strike"},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=i.baseURI;q.execCallback("setup",q)},render:function(u){var v=this,w=v.settings,x=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}if(!u){w.strict_loading_mode=1;tinyMCE.settings=w}if(!v.getElement()){return}if(w.strict_loading_mode){q.settings.strict_mode=w.strict_loading_mode;n.DOM.settings.strict=1}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&w.hidden_input&&o.getParent(x,"form")){o.insertAfter(o.create("input",{type:"hidden",name:x}),x)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(w.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(w.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(w.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(w.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){i.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(w.language){q.add(n.baseURL+"/langs/"+w.language+".js")}if(w.theme&&w.theme.charAt(0)!="-"&&!h.urls[w.theme]){h.load(w.theme,"themes/"+w.theme+"/editor_template"+n.suffix+".js")}j(g(w.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(!e&&s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+n.suffix+".js")}});q.loadQueue(function(){if(!v.removed){v.init()}})}if(w.plugins.indexOf("compat2x")!=-1){c.load("compat2x","plugins/compat2x/editor_plugin"+n.suffix+".js");q.loadQueue(r)}else{r()}},init:function(){var v,F=this,G=F.settings,C,z,B=F.getElement(),r,q,D,y,A,E;i.add(F);if(G.theme){G.theme=G.theme.replace(/-/,"");r=h.get(G.theme);F.theme=new r();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||n.documentBaseURL.replace(/\/$/,""))}}j(g(G.plugins.replace(/\-/g,"")),function(w){var H=c.get(w),t=c.urls[w]||n.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(F,t);F.plugins[w]=s;if(s.init){s.init(F,t)}}});if(G.popup_css!==false){if(G.popup_css){G.popup_css=F.documentBaseURI.toAbsolute(G.popup_css)}else{G.popup_css=F.baseURI.toAbsolute("themes/"+G.theme+"/skins/"+G.skin+"/dialog.css")}}if(G.popup_css_add){G.popup_css+=","+F.documentBaseURI.toAbsolute(G.popup_css_add)}F.controlManager=new n.ControlManager(F);F.undoManager=new n.UndoManager(F);F.undoManager.onAdd.add(function(t,s){if(!s.initial){return F.onChange.dispatch(F,s,t)}});F.undoManager.onUndo.add(function(t,s){return F.onUndo.dispatch(F,s,t)});F.undoManager.onRedo.add(function(t,s){return F.onRedo.dispatch(F,s,t)});if(G.custom_undo_redo){F.onExecCommand.add(function(t,w,u,H,s){if(w!="Undo"&&w!="Redo"&&w!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(x);F.onRedo.add(x);F.onSetContent.add(x)}F.onBeforeRenderUI.dispatch(F,F.controlManager);if(G.render_ui){C=G.width||B.style.width||B.offsetWidth;z=G.height||B.style.height||B.offsetHeight;F.orgDisplay=B.style.display;E=/^[0-9\.]+(|px)$/i;if(E.test(""+C)){C=Math.max(parseInt(C)+(r.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(r.deltaHeight||0),100)}r=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=r.editorContainer}o.setStyles(r.sizeContainer||r.editorContainer,{width:C,height:z});z=(r.iframeHeight||z)+(typeof(z)=="number"?(r.deltaHeight||0):"");if(z<100){z=100}F.iframeHTML=G.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+F.documentBaseURI.getURI()+'" />';F.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(n.relaxedDomain){F.iframeHTML+='<script type="text/javascript">document.domain = "'+n.relaxedDomain+'";<\/script>'}y=G.body_id||"tinymce";if(y.indexOf("=")!=-1){y=F.getParam("body_id","","hash");y=y[F.id]||y}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='</head><body id="'+y+'" class="mceContentBody '+A+'"></body></html>';if(n.relaxedDomain){if(b||(n.isOpera&&parseFloat(opera.version())>=9.5)){D='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+F.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(n.isOpera){D='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}v=o.add(r.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",style:{width:"100%",height:z}});F.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=F.orgDisplay;o.get(F.id).style.display="none";if(!b||!n.relaxedDomain){F.setupIframe()}B=v=r=null},setupIframe:function(){var z=this,A=z.settings,u=o.get(z.id),v=z.getDoc(),r,x;if(!b||!n.relaxedDomain){v.open();v.write(z.iframeHTML);v.close()}if(!b){try{if(!A.readonly){v.designMode="On"}}catch(w){}}if(b){x=z.getBody();o.hide(x);if(!A.readonly){x.contentEditable=true}o.show(x)}z.dom=new n.DOM.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1});z.serializer=new n.dom.Serializer({entity_encoding:A.entity_encoding,entities:A.entities,valid_elements:A.verify_html===false?"*[*]":A.valid_elements,extended_valid_elements:A.extended_valid_elements,valid_child_elements:A.valid_child_elements,invalid_elements:A.invalid_elements,fix_table_elements:A.fix_table_elements,fix_list_elements:A.fix_list_elements,fix_content_duplication:A.fix_content_duplication,convert_fonts_to_spans:A.convert_fonts_to_spans,font_size_classes:A.font_size_classes,font_size_style_values:A.font_size_style_values,apply_source_formatting:A.apply_source_formatting,remove_linebreaks:A.remove_linebreaks,element_format:A.element_format,dom:z.dom});z.selection=new n.dom.Selection(z.dom,z.getWin(),z.serializer);z.forceBlocks=new n.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new n.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.auto_resize){z.onNodeChange.add(z.resizeToContent,z)}if(A.custom_elements){function y(s,t){j(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";j(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.convert_fonts_to_spans){z._convertFonts()}if(A.inline_styles){z._convertInlineElements()}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){k.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>( | |\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function q(s,t){j(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){q(s)}});z.onSetContent.add(z.selection.onSetContent.add(q));if(!A.readonly){try{v.designMode="Off";v.designMode="On"}catch(w){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.undoManager.add({initial:true});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){n.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=i.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);u=null},focus:function(r){var u,q=this,s=q.settings.content_editable;if(!r){if(!s&&(!b||q.selection.getNode().ownerDocument!=q.getDoc())){q.getWin().focus()}}if(i.activeEditor!=q){if((u=i.activeEditor)!=null){u.onDeactivate.dispatch(u,q)}q.onActivate.dispatch(q,u)}i._setActive(q)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=i.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return i.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(w,s,q){var t=n.trim,r=d(this.settings[w])?this.settings[w]:s,u;if(q==="hash"){u={};if(d(r,"string")){j(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(x){x=x.split("=");if(x.length>1){u[t(x[0])]=t(x[1])}else{u[t(x[0])]=t(x)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getNode()||q.getBody();if(q.initialized){q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,b&&v.ownerDocument!=q.getDoc()?q.getBody():v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(t,r,q){this.execCommands[t]={func:r,scope:q||this}},addQueryStateHandler:function(t,r,q){this.queryStateCommands[t]={func:r,scope:q||this}},addQueryValueHandler:function(t,r,q){this.queryValueCommands[t]={func:r,scope:q||this}},addShortcut:function(s,v,q,u){var r=this,w;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){w=q;q=function(){r.execCommand(w,false,null)}}if(d(q,"object")){w=q;q=function(){r.execCommand(w[0],w[1],w[2])}}j(g(s),function(t){var x={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};j(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});r.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,w,z,q){var u=this,v=0,y,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!q||!q.skip_focus)){u.focus()}y={};u.onBeforeExecCommand.dispatch(u,x,w,z,y);if(y.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(y=u.execCommands[x]){r=y.func.call(y.scope,w,z);if(r!==true){u.onExecCommand.dispatch(u,x,w,z,q);return r}}j(u.plugins,function(s){if(s.execCommand&&s.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(n.GlobalCommands.execCommand(u,x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(u.editorCommands.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}u.getDoc().execCommand(x,w,z);u.onExecCommand.dispatch(u,x,w,z,q)},queryCommandState:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryStateCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandState(w);if(v!==-1){return v}try{return this.getDoc().queryCommandState(w)}catch(q){}},queryCommandValue:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(w);if(d(v)){return v}try{return this.getDoc().queryCommandValue(w)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},resizeToContent:function(){var q=this;o.setStyle(q.id+"_ifr","height",q.getBody().scrollHeight)},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=0;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){j(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(r,s){var q=this;s=s||{};s.format=s.format||"html";s.set=true;s.content=r;if(!s.no_events){q.onBeforeSetContent.dispatch(q,s)}if(!n.isIE&&(r.length===0||/^\s+$/.test(r))){s.content=q.dom.setHTML(q.getBody(),'<br mce_bogus="1" />');s.format="raw"}s.content=q.dom.setHTML(q.getBody(),n.trim(s.content));if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;s.content=q.dom.setHTML(q.getBody(),q.serializer.serialize(q.getBody(),s))}if(!s.no_events){q.onSetContent.dispatch(q,s)}return s.content},getContent:function(s){var q=this,r;s=s||{};s.format=s.format||"html";s.get=true;if(!s.no_events){q.onBeforeGetContent.dispatch(q,s)}if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;r=q.serializer.serialize(q.getBody(),s)}else{r=q.getBody().innerHTML}r=r.replace(/^\s*|\s*$/g,"");s.content=r;if(!s.no_events){q.onGetContent.dispatch(q,s)}return s.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,x,w){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,w,true,x)}if(!v.convert_urls||(w&&w.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}j(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];i.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var w=this,v,y=w.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function u(t,A){var s=t.type;if(w.removed){return}if(w.onEvent.dispatch(w,t,A)!==false){w[x[t.fakeType||t.type]].dispatch(w,t,A)}}j(x,function(t,s){switch(s){case"contextmenu":if(n.isOpera){k.add(w.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";u(A)}})}else{k.add(w.getBody(),s,u)}break;case"paste":k.add(w.getBody(),s,function(A){u(A)});break;case"submit":case"reset":k.add(w.getElement().form||o.getParent(w.id,"form"),s,u);break;default:k.add(y.content_editable?w.getBody():w.getDoc(),s,u)}});k.add(y.content_editable?w.getBody():(a?w.getDoc():w.getWin()),"focus",function(s){w.focus(true)});if(n.isGecko){k.add(w.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("mce_src"))){t.src=w.documentBaseURI.toAbsolute(s)}})}if(a){function q(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}w.onBeforeExecCommand.add(q);w.onMouseDown.add(q)}w.onMouseUp.add(w.nodeChanged);w.onClick.add(w.nodeChanged);w.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(n.isMac&&(A==91||A==93))||t.ctrlKey){w.nodeChanged()}});w.onReset.add(function(){w.setContent(w.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){w.addShortcut("ctrl+z",w.getLang("undo_desc"),"Undo");w.addShortcut("ctrl+y",w.getLang("redo_desc"),"Redo")}if(a){w.addShortcut("ctrl+b",w.getLang("bold_desc"),"Bold");w.addShortcut("ctrl+i",w.getLang("italic_desc"),"Italic");w.addShortcut("ctrl+u",w.getLang("underline_desc"),"Underline")}for(v=1;v<=6;v++){w.addShortcut("ctrl+"+v,"",["FormatBlock",false,"<h"+v+">"])}w.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);w.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);w.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}j(w.shortcuts,function(A){if(n.isMac&&A.ctrl!=t.metaKey){return}else{if(!n.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}w.onKeyUp.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyPress.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return k.cancel(t)}})}if(n.isIE){k.add(w.getDoc(),"controlselect",function(A){var t=w.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){k.remove(t.node,t.ev,t.cb)}if(!w.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=k.add(A,ev,function(C){var B;C=C.target;if(B=w.dom.getStyle(C,"width")){w.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"width","")}if(B=w.dom.getStyle(C,"height")){w.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=k.add(A,"resizestart",k.cancel,k)}t=w.resizeInfo={node:A,ev:ev,cb:s}});w.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(w.selection.getRng().item){w.selection.getRng().item(0).removeNode();return k.cancel(t)}}})}if(n.isOpera){w.onClick.add(function(s,t){k.prevent(t)})}if(y.custom_undo_redo){function r(){w.undoManager.typing=0;w.undoManager.add()}if(n.isIE){k.add(w.getWin(),"blur",function(s){var t;if(w.selection){t=w.selection.getNode();if(!w.removed&&t.ownerDocument&&t.ownerDocument!=w.getDoc()){r()}}})}else{k.add(w.getDoc(),"blur",function(){if(w.selection&&!w.removed){r()}})}w.onMouseDown.add(r);w.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){w.undoManager.typing=0;w.undoManager.add()}});w.onKeyDown.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45){if(w.undoManager.typing){w.undoManager.add();w.undoManager.typing=0}return}if(!w.undoManager.typing){w.undoManager.add();w.undoManager.typing=1}})}},_convertInlineElements:function(){var z=this,B=z.settings,r=z.dom,y,w,u,A,q;function x(s,t){if(!B.inline_styles){return}if(t.get){j(z.dom.select("table,u,strike",t.node),function(v){switch(v.nodeName){case"TABLE":if(y=r.getAttrib(v,"height")){r.setStyle(v,"height",y);r.setAttrib(v,"height","")}break;case"U":case"STRIKE":v.style.textDecoration=v.nodeName=="U"?"underline":"line-through";r.setAttrib(v,"mce_style","");r.setAttrib(v,"mce_name","span");break}})}else{if(t.set){j(z.dom.select("table,span",t.node).reverse(),function(v){if(v.nodeName=="TABLE"){if(y=r.getStyle(v,"height")){r.setAttrib(v,"height",y.replace(/[^0-9%]+/g,""))}}else{if(v.style.textDecoration=="underline"){u="u"}else{if(v.style.textDecoration=="line-through"){u="strike"}else{u=""}}if(u){v.style.textDecoration="";r.setAttrib(v,"mce_style","");w=r.create(u,{style:r.getAttrib(v,"style")});r.replace(w,v,1)}}})}}}z.onPreProcess.add(x);if(!B.cleanup_on_startup){z.onSetContent.add(function(s,t){if(t.initial){x(z,{node:z.getBody(),set:1})}})}},_convertFonts:function(){var w=this,x=w.settings,z=w.dom,v,r,q,u;if(!x.inline_styles){return}v=[8,10,12,14,18,24,36];r=["xx-small","x-small","small","medium","large","x-large","xx-large"];if(q=x.font_size_style_values){q=g(q)}if(u=x.font_size_classes){u=g(u)}function y(B){var C,A,t,s;if(!x.inline_styles){return}t=w.dom.select("font",B);for(s=t.length-1;s>=0;s--){C=t[s];A=z.create("span",{style:z.getAttrib(C,"style"),"class":z.getAttrib(C,"class")});z.setStyles(A,{fontFamily:z.getAttrib(C,"face"),color:z.getAttrib(C,"color"),backgroundColor:C.style.backgroundColor});if(C.size){if(q){z.setStyle(A,"fontSize",q[parseInt(C.size)-1])}else{z.setAttrib(A,"class",u[parseInt(C.size)-1])}}z.setAttrib(A,"mce_style","");z.replace(A,C,1)}}w.onPreProcess.add(function(s,t){if(t.get){y(t.node)}});w.onSetContent.add(function(s,t){if(t.initial){y(t.node)}})},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)},_fixNesting:function(r){var t=[],q;r=r.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(u,s,w){var v;if(s==="/"){if(!t.length){return""}if(w!==t[t.length-1].tag){for(q=t.length-1;q>=0;q--){if(t[q].tag===w){t[q].close=1;break}}return""}else{t.pop();if(t.length&&t[t.length-1].close){u=u+"</"+t[t.length-1].tag+">";t.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(w)){return u}if(/\/>$/.test(u)){return u}t.push({tag:w})}return u});for(q=t.length-1;q>=0;q--){r+="</"+t[q].tag+">"}return r}})})(tinymce);(function(d){var f=d.each,c=d.isIE,a=d.isGecko,b=d.isOpera,e=d.isWebKit;d.create("tinymce.EditorCommands",{EditorCommands:function(g){this.editor=g},execCommand:function(k,j,l){var h=this,g=h.editor,i;switch(k){case"mceResetDesignMode":case"mceBeginUndoLevel":return true;case"unlink":h.UnLink();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":h.mceJustify(k,k.substring(7).toLowerCase());return true;default:i=this[k];if(i){i.call(this,j,l);return true}}return false},Indent:function(){var g=this.editor,l=g.dom,j=g.selection,k,h,i;h=g.settings.indentation;i=/[a-z%]+$/i.exec(h);h=parseInt(h);if(g.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(j.getSelectedBlocks(),function(m){l.setStyle(m,"paddingLeft",(parseInt(m.style.paddingLeft||0)+h)+i)});return}g.getDoc().execCommand("Indent",false,null);if(c){l.getParent(j.getNode(),function(m){if(m.nodeName=="BLOCKQUOTE"){m.dir=m.style.cssText=""}})}},Outdent:function(){var h=this.editor,m=h.dom,k=h.selection,l,g,i,j;i=h.settings.indentation;j=/[a-z%]+$/i.exec(i);i=parseInt(i);if(h.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(k.getSelectedBlocks(),function(n){g=Math.max(0,parseInt(n.style.paddingLeft||0)-i);m.setStyle(n,"paddingLeft",g?g+j:"")});return}h.getDoc().execCommand("Outdent",false,null)},mceSetContent:function(h,g){this.editor.setContent(g)},mceToggleVisualAid:function(){var g=this.editor;g.hasVisual=!g.hasVisual;g.addVisual()},mceReplaceContent:function(h,g){var i=this.editor.selection;i.setContent(g.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(i,h){var g=this.editor,j=g.selection,k=g.dom.getParent(j.getNode(),"a");if(d.is(h,"string")){h={href:h}}function l(m){f(h,function(o,n){g.dom.setAttrib(m,n,o)})}if(!k){g.execCommand("CreateLink",false,"javascript:mctmp(0);");f(g.dom.select("a[href=javascript:mctmp(0);]"),function(m){l(m)})}else{if(h.href){l(k)}else{g.dom.remove(k,1)}}},UnLink:function(){var g=this.editor,h=g.selection;if(h.isCollapsed()){h.select(h.getNode())}g.getDoc().execCommand("unlink",false,null);h.collapse(0)},FontName:function(i,h){var j=this,g=j.editor,k=g.selection,l;if(!h){if(k.isCollapsed()){k.select(k.getNode())}}else{if(g.settings.convert_fonts_to_spans){j._applyInlineStyle("span",{style:{fontFamily:h}})}else{g.getDoc().execCommand("FontName",false,h)}}},FontSize:function(j,i){var h=this.editor,l=h.settings,k,g;if(l.convert_fonts_to_spans&&i>=1&&i<=7){g=d.explode(l.font_size_style_values);k=d.explode(l.font_size_classes);if(k){i=k[i-1]||i}else{i=g[i-1]||i}}if(i>=1&&i<=7){h.getDoc().execCommand("FontSize",false,i)}else{this._applyInlineStyle("span",{style:{fontSize:i}})}},queryCommandValue:function(h){var g=this["queryValue"+h];if(g){return g.call(this,h)}return false},queryCommandState:function(h){var g;switch(h){case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":return this.queryStateJustify(h,h.substring(7).toLowerCase());default:if(g=this["queryState"+h]){return g.call(this,h)}}return -1},_queryState:function(h){try{return this.editor.getDoc().queryCommandState(h)}catch(g){}},_queryVal:function(h){try{return this.editor.getDoc().queryCommandValue(h)}catch(g){}},queryValueFontSize:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontSize}if(!g&&(b||e)){if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.size}return g}return g||this._queryVal("FontSize")},queryValueFontName:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.face}if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}if(!g){g=this._queryVal("FontName")}return g},mceJustify:function(o,p){var k=this.editor,m=k.selection,g=m.getNode(),q=g.nodeName,h,j,i=k.dom,l;if(k.settings.inline_styles&&this.queryStateJustify(o,p)){l=1}h=i.getParent(g,k.dom.isBlock);if(q=="IMG"){if(p=="full"){return}if(l){if(p=="center"){i.setStyle(h||g.parentNode,"textAlign","")}i.setStyle(g,"float","");this.mceRepaint();return}if(p=="center"){if(h&&/^(TD|TH)$/.test(h.nodeName)){h=0}if(!h||h.childNodes.length>1){j=i.create("p");j.appendChild(g.cloneNode(false));if(h){i.insertAfter(j,h)}else{i.insertAfter(j,g)}i.remove(g);g=j.firstChild;h=j}i.setStyle(h,"textAlign",p);i.setStyle(g,"float","")}else{i.setStyle(g,"float",p);i.setStyle(h||g.parentNode,"textAlign","")}this.mceRepaint();return}if(k.settings.inline_styles&&k.settings.forced_root_block){if(l){p=""}f(m.getSelectedBlocks(i.getParent(m.getStart(),i.isBlock),i.getParent(m.getEnd(),i.isBlock)),function(n){i.setAttrib(n,"align","");i.setStyle(n,"textAlign",p=="full"?"justify":p)});return}else{if(!l){k.getDoc().execCommand(o,false,null)}}if(k.settings.inline_styles){if(l){i.getParent(k.selection.getNode(),function(r){if(r.style&&r.style.textAlign){i.setStyle(r,"textAlign","")}});return}f(i.select("*"),function(s){var r=s.align;if(r){if(r=="full"){r="justify"}i.setStyle(s,"textAlign",r);i.setAttrib(s,"align","")}})}},mceSetCSSClass:function(h,g){this.mceSetStyleInfo(0,{command:"setattrib",name:"class",value:g})},getSelectedElement:function(){var w=this,o=w.editor,n=o.dom,s=o.selection,h=s.getRng(),l,k,u,p,j,g,q,i,x,v;if(s.isCollapsed()||h.item){return s.getNode()}v=o.settings.merge_styles_invalid_parents;if(d.is(v,"string")){v=new RegExp(v,"i")}if(c){l=h.duplicate();l.collapse(true);u=l.parentElement();k=h.duplicate();k.collapse(false);p=k.parentElement();if(u!=p){l.move("character",1);u=l.parentElement()}if(u==p){l=h.duplicate();l.moveToElementText(u);if(l.compareEndPoints("StartToStart",h)==0&&l.compareEndPoints("EndToEnd",h)==0){return v&&v.test(u.nodeName)?null:u}}}else{function m(r){return n.getParent(r,"*")}u=h.startContainer;p=h.endContainer;j=h.startOffset;g=h.endOffset;if(!h.collapsed){if(u==p){if(j-g<2){if(u.hasChildNodes()){i=u.childNodes[j];return v&&v.test(i.nodeName)?null:i}}}}if(u.nodeType!=3||p.nodeType!=3){return null}if(j==0){i=m(u);if(i&&i.firstChild!=u){i=null}}if(j==u.nodeValue.length){q=u.nextSibling;if(q&&q.nodeType==1){i=u.nextSibling}}if(g==0){q=p.previousSibling;if(q&&q.nodeType==1){x=q}}if(g==p.nodeValue.length){x=m(p);if(x&&x.lastChild!=p){x=null}}if(i==x){return v&&i&&v.test(i.nodeName)?null:i}}return null},mceSetStyleInfo:function(n,m){var q=this,h=q.editor,j=h.getDoc(),g=h.dom,i,k,r=h.selection,p=m.wrapper||"span",k=r.getBookmark(),o;function l(t,s){if(t.nodeType==1){switch(m.command){case"setattrib":return g.setAttrib(t,m.name,m.value);case"setstyle":return g.setStyle(t,m.name,m.value);case"removeformat":return g.setAttrib(t,"class","")}}}o=h.settings.merge_styles_invalid_parents;if(d.is(o,"string")){o=new RegExp(o,"i")}if((i=q.getSelectedElement())&&!h.settings.force_span_wrappers){l(i,1)}else{j.execCommand("FontName",false,"__");f(g.select("span,font"),function(u){var s,t;if(g.getAttrib(u,"face")=="__"||u.style.fontFamily==="__"){s=g.create(p,{mce_new:"1"});l(s);f(u.childNodes,function(v){s.appendChild(v.cloneNode(true))});g.replace(s,u)}})}f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!g.getAttrib(t,"mce_new")){s=g.getParent(t,"*[mce_new]");if(s){g.remove(t,1)}}});f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!s||!g.getAttrib(t,"mce_new")){return}if(h.settings.force_span_wrappers&&s.nodeName!="SPAN"){return}if(s.nodeName==p.toUpperCase()&&s.childNodes.length==1){return g.remove(s,1)}if(t.nodeType==1&&(!o||!o.test(s.nodeName))&&s.childNodes.length==1){l(s);g.setAttrib(t,"class","")}});f(g.select(p).reverse(),function(s){if(g.getAttrib(s,"mce_new")||(g.getAttribs(s).length<=1&&s.className==="")){if(!g.getAttrib(s,"class")&&!g.getAttrib(s,"style")){return g.remove(s,1)}g.setAttrib(s,"mce_new","")}});r.moveToBookmark(k)},queryStateJustify:function(k,h){var g=this.editor,j=g.selection.getNode(),i=g.dom;if(j&&j.nodeName=="IMG"){if(i.getStyle(j,"float")==h){return 1}return j.parentNode.style.textAlign==h}j=i.getParent(g.selection.getStart(),function(l){return l.nodeType==1&&l.style.textAlign});if(h=="full"){h="justify"}if(g.settings.inline_styles){return(j&&j.style.textAlign==h)}return this._queryState(k)},ForeColor:function(i,h){var g=this.editor;if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{color:h}});return}else{g.getDoc().execCommand("ForeColor",false,h)}},HiliteColor:function(i,k){var h=this,g=h.editor,j=g.getDoc();if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{backgroundColor:k}});return}function l(n){if(!a){return}try{j.execCommand("styleWithCSS",0,n)}catch(m){j.execCommand("useCSS",0,!n)}}if(a||b){l(true);j.execCommand("hilitecolor",false,k);l(false)}else{j.execCommand("BackColor",false,k)}},FormatBlock:function(n,h){var o=this,l=o.editor,p=l.selection,j=l.dom,g,k,m;function i(q){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(q.nodeName)}g=j.getParent(p.getNode(),function(q){return i(q)});if(g){if((c&&i(g.parentNode))||g.nodeName=="DIV"){k=l.dom.create(h);f(j.getAttribs(g),function(q){j.setAttrib(k,q.nodeName,j.getAttrib(g,q.nodeName))});m=p.getBookmark();j.replace(k,g,1);p.moveToBookmark(m);l.nodeChanged();return}}h=l.settings.forced_root_block?(h||"<p>"):h;if(h.indexOf("<")==-1){h="<"+h+">"}if(d.isGecko){h=h.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,"$1")}l.getDoc().execCommand("FormatBlock",false,h)},mceCleanup:function(){var h=this.editor,i=h.selection,g=i.getBookmark();h.setContent(h.getContent());i.moveToBookmark(g)},mceRemoveNode:function(j,k){var h=this.editor,i=h.selection,g,l=k||i.getNode();if(l==h.getBody()){return}g=i.getBookmark();h.dom.remove(l,1);i.moveToBookmark(g);h.nodeChanged()},mceSelectNodeDepth:function(i,j){var g=this.editor,h=g.selection,k=0;g.dom.getParent(h.getNode(),function(l){if(l.nodeType==1&&k++==j){h.select(l);g.nodeChanged();return false}},g.getBody())},mceSelectNode:function(h,g){this.editor.selection.select(g)},mceInsertContent:function(g,h){this.editor.selection.setContent(h)},mceInsertRawHTML:function(h,i){var g=this.editor;g.selection.setContent("tiny_mce_marker");g.setContent(g.getContent().replace(/tiny_mce_marker/g,i))},mceRepaint:function(){var i,g,j=this.editor;if(d.isGecko){try{i=j.selection;g=i.getBookmark(true);if(i.getSel()){i.getSel().selectAllChildren(j.getBody())}i.collapse(true);i.moveToBookmark(g)}catch(h){}}},queryStateUnderline:function(){var g=this.editor,h=g.selection.getNode();if(h&&h.nodeName=="A"){return false}return this._queryState("Underline")},queryStateOutdent:function(){var g=this.editor,h;if(g.settings.inline_styles){if((h=g.dom.getParent(g.selection.getStart(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}if((h=g.dom.getParent(g.selection.getEnd(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!g.settings.inline_styles&&!!g.dom.getParent(g.selection.getNode(),"BLOCKQUOTE"))},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"UL")},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"OL")},queryStatemceBlockQuote:function(){return !!this.editor.dom.getParent(this.editor.selection.getStart(),function(g){return g.nodeName==="BLOCKQUOTE"})},_applyInlineStyle:function(o,j,m){var q=this,n=q.editor,l=n.dom,i,p={},k,r;o=o.toUpperCase();if(m&&m.check_classes&&j["class"]){m.check_classes.push(j["class"])}function h(){f(l.select(o).reverse(),function(t){var s=0;f(l.getAttribs(t),function(u){if(u.nodeName.substring(0,1)!="_"&&l.getAttrib(t,u.nodeName)!=""){s++}});if(s==0){l.remove(t,1)}})}function g(){var s;f(l.select("span,font"),function(t){if(t.style.fontFamily=="mceinline"||t.face=="mceinline"){if(!s){s=n.selection.getBookmark()}j._mce_new="1";l.replace(l.create(o,j),t,1)}});f(l.select(o+"[_mce_new]"),function(u){function t(v){if(v.nodeType==1){f(j.style,function(x,w){l.setStyle(v,w,"")});if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(v,w)}})}}}f(l.select(o,u),t);if(u.parentNode&&u.parentNode.nodeType==1&&u.parentNode.childNodes.length==1){t(u.parentNode)}l.getParent(u.parentNode,function(v){if(v.nodeType==1){if(j.style){f(j.style,function(y,x){var w;if(!p[x]&&(w=l.getStyle(v,x))){if(w===y){l.setStyle(u,x,"")}p[x]=1}})}if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(u,w)}})}}return false});u.removeAttribute("_mce_new")});h();n.selection.moveToBookmark(s);return !!s}n.focus();n.getDoc().execCommand("FontName",false,"mceinline");g();if(k=q._applyInlineStyle.keyhandler){n.onKeyUp.remove(k);n.onKeyPress.remove(k);n.onKeyDown.remove(k);n.onSetContent.remove(q._applyInlineStyle.chandler)}if(n.selection.isCollapsed()){if(!c){f(l.getParents(n.selection.getNode(),"span"),function(s){f(j.style,function(u,t){var w;if(w=l.getStyle(s,t)){if(w==u){l.setStyle(s,t,"");r=2;return false}r=1;return false}});if(r){return false}});if(r==2){i=n.selection.getBookmark();h();n.selection.moveToBookmark(i);window.setTimeout(function(){n.nodeChanged()},1);return}}q._pendingStyles=d.extend(q._pendingStyles||{},j.style);q._applyInlineStyle.chandler=n.onSetContent.add(function(){delete q._pendingStyles});q._applyInlineStyle.keyhandler=k=function(s){if(q._pendingStyles){j.style=q._pendingStyles;delete q._pendingStyles}if(g()){n.onKeyDown.remove(q._applyInlineStyle.keyhandler);n.onKeyPress.remove(q._applyInlineStyle.keyhandler)}if(s.type=="keyup"){n.onKeyUp.remove(q._applyInlineStyle.keyhandler)}};n.onKeyDown.add(k);n.onKeyPress.add(k);n.onKeyUp.add(k)}else{q._pendingStyles=0}}})})(tinymce);(function(a){a.create("tinymce.UndoManager",{index:0,data:null,typing:0,UndoManager:function(c){var d=this,b=a.util.Dispatcher;d.editor=c;d.data=[];d.onAdd=new b(this);d.onUndo=new b(this);d.onRedo=new b(this)},add:function(d){var g=this,f,e=g.editor,c,h=e.settings,j;d=d||{};d.content=d.content||e.getContent({format:"raw",no_events:1});d.content=d.content.replace(/^\s*|\s*$/g,"");j=g.data[g.index>0&&(g.index==0||g.index==g.data.length)?g.index-1:g.index];if(!d.initial&&j&&d.content==j.content){return null}if(h.custom_undo_redo_levels){if(g.data.length>h.custom_undo_redo_levels){for(f=0;f<g.data.length-1;f++){g.data[f]=g.data[f+1]}g.data.length--;g.index=g.data.length}}if(h.custom_undo_redo_restore_selection&&!d.initial){d.bookmark=c=d.bookmark||e.selection.getBookmark()}if(g.index<g.data.length){g.index++}if(g.data.length===0&&!d.initial){return null}g.data.length=g.index+1;g.data[g.index++]=d;if(d.initial){g.index=0}if(g.data.length==2&&g.data[0].initial){g.data[0].bookmark=c}g.onAdd.dispatch(g,d);e.isNotDirty=0;return d},undo:function(){var e=this,c=e.editor,b=b,d;if(e.typing){e.add();e.typing=0}if(e.index>0){if(e.index==e.data.length&&e.index>1){d=e.index;e.typing=0;if(!e.add()){e.index=d}--e.index}b=e.data[--e.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);e.onUndo.dispatch(e,b)}return b},redo:function(){var d=this,c=d.editor,b=null;if(d.index<d.data.length-1){b=d.data[++d.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);d.onRedo.dispatch(d,b)}return b},clear:function(){var b=this;b.data=[];b.index=0;b.typing=0;b.add({initial:true})},hasUndo:function(){return this.index!=0||this.typing},hasRedo:function(){return this.index<this.data.length-1}})})(tinymce);(function(e){var b,d,a,c,f,h;b=e.dom.Event;d=e.isIE;a=e.isGecko;c=e.isOpera;f=e.each;h=e.extend;function g(i){i=i.innerHTML;i=i.replace(/<\w+ .*?mce_\w+\"?=.*?>/gi,"-");i=i.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");i=i.replace(/<[^>]+>/g,"");return i.replace(/[ \t\r\n]+/g,"")==""}e.create("tinymce.ForceBlocks",{ForceBlocks:function(j){var k=this,l=j.settings,m;k.editor=j;k.dom=j.dom;m=(l.forced_root_block||"p").toLowerCase();l.element=m.toUpperCase();j.onPreInit.add(k.setup,k);k.reOpera=new RegExp("(\\u00a0| | )</"+m+">","gi");k.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR2=new RegExp("<%p()([^>]+)>( | )<\\/%p>|<%p>( | )<\\/%p>".replace(/%p/g,m),"gi");k.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,m),"gi");function i(n,p){if(c){p.content=p.content.replace(k.reOpera,"</"+m+">")}p.content=p.content.replace(k.rePadd,"<"+m+"$1$2$3$4$5$6>\u00a0</"+m+">");if(!d&&!c&&p.set){p.content=p.content.replace(k.reNbsp2BR1,"<"+m+"$1$2><br /></"+m+">");p.content=p.content.replace(k.reNbsp2BR2,"<"+m+"$1$2><br /></"+m+">")}else{p.content=p.content.replace(k.reBR2Nbsp,"<"+m+"$1$2>\u00a0</"+m+">")}}j.onBeforeSetContent.add(i);j.onPostProcess.add(i);if(l.forced_root_block){j.onInit.add(k.forceRoots,k);j.onSetContent.add(k.forceRoots,k);j.onBeforeGetContent.add(k.forceRoots,k)}},setup:function(){var j=this,i=j.editor,k=i.settings;if(k.forced_root_block){i.onKeyUp.add(j.forceRoots,j);i.onPreProcess.add(j.forceRoots,j)}if(k.force_br_newlines){if(d){i.onKeyPress.add(function(m,p){var q,o=m.selection;if(p.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('<br id="__" /> ',{format:"raw"});q=m.dom.get("__");q.removeAttribute("id");o.select(q);o.collapse();return b.cancel(p)}})}return}if(!d&&k.force_p_newlines){i.onKeyPress.add(function(m,n){if(n.keyCode==13&&!n.shiftKey){if(!j.insertPara(n)){b.cancel(n)}}});if(a){i.onKeyDown.add(function(m,n){if((n.keyCode==8||n.keyCode==46)&&!n.shiftKey){j.backspaceDelete(n,n.keyCode==8)}})}}function l(n,m){var o=i.dom.create(m);f(n.attributes,function(p){if(p.specified&&p.nodeValue){o.setAttribute(p.nodeName.toLowerCase(),p.nodeValue)}});f(n.childNodes,function(p){o.appendChild(p.cloneNode(true))});n.parentNode.replaceChild(o,n);return o}if(d){i.onPreProcess.add(function(m,n){f(m.dom.select("p,h1,h2,h3,h4,h5,h6,div",n.node),function(o){if(g(o)){o.innerHTML=""}})});if(k.element!="P"){i.onKeyPress.add(function(m,n){j.lastElm=m.selection.getNode().nodeName});i.onKeyUp.add(function(o,q){var s,p=o.selection,r=p.getNode(),m=o.getBody();if(m.childNodes.length===1&&r.nodeName=="P"){r=l(r,k.element);p.select(r);p.collapse();o.nodeChanged()}else{if(q.keyCode==13&&!q.shiftKey&&j.lastElm!="P"){s=o.dom.getParent(r,"p");if(s){l(s,k.element);o.nodeChanged()}}}})}}},find:function(o,k,l){var j=this.editor,i=j.getDoc().createTreeWalker(o,4,null,false),m=-1;while(o=i.nextNode()){m++;if(k==0&&o==l){return m}if(k==1&&m==l){return o}}return -1},forceRoots:function(p,D){var u=this,p=u.editor,H=p.getBody(),E=p.getDoc(),K=p.selection,v=K.getSel(),w=K.getRng(),I=-2,o,B,j,k,F=-16777215;var G,l,J,A,x,m=H.childNodes,z,y,q;for(z=m.length-1;z>=0;z--){G=m[z];if(G.nodeType==3||(!u.dom.isBlock(G)&&G.nodeType!=8)){if(!l){if(G.nodeType!=3||/[^\s]/g.test(G.nodeValue)){if(I==-2&&w){if(!d){if(w.startContainer.nodeType==1&&(y=w.startContainer.childNodes[w.startOffset])&&y.nodeType==1){q=y.getAttribute("id");y.setAttribute("id","__mce")}else{if(p.dom.getParent(w.startContainer,function(i){return i===H})){B=w.startOffset;j=w.endOffset;I=u.find(H,0,w.startContainer);o=u.find(H,0,w.endContainer)}}}else{k=E.body.createTextRange();k.moveToElementText(H);k.collapse(1);J=k.move("character",F)*-1;k=w.duplicate();k.collapse(1);A=k.move("character",F)*-1;k=w.duplicate();k.collapse(0);x=(k.move("character",F)*-1)-A;I=A-J;o=x}}l=p.dom.create(p.settings.forced_root_block);l.appendChild(G.cloneNode(1));G.parentNode.replaceChild(l,G)}}else{if(l.hasChildNodes()){l.insertBefore(G,l.firstChild)}else{l.appendChild(G)}}}else{l=null}}if(I!=-2){if(!d){l=H.getElementsByTagName(p.settings.element)[0];w=E.createRange();if(I!=-1){w.setStart(u.find(H,1,I),B)}else{w.setStart(l,0)}if(o!=-1){w.setEnd(u.find(H,1,o),j)}else{w.setEnd(l,0)}if(v){v.removeAllRanges();v.addRange(w)}}else{try{w=v.createRange();w.moveToElementText(H);w.collapse(1);w.moveStart("character",I);w.moveEnd("character",o);w.select()}catch(C){}}}else{if(!d&&(y=p.dom.get("__mce"))){if(q){y.setAttribute("id",q)}else{y.removeAttribute("id")}w=E.createRange();w.setStartBefore(y);w.setEndBefore(y);K.setRng(w)}}},getParentBlock:function(j){var i=this.dom;return i.getParent(j,i.isBlock)},insertPara:function(M){var A=this,o=A.editor,I=o.dom,N=o.getDoc(),R=o.settings,B=o.selection.getSel(),C=B.getRangeAt(0),Q=N.body;var F,G,D,K,J,l,j,m,q,i,x,P,k,p,E,H=I.getViewPort(o.getWin()),w,z,v;F=N.createRange();F.setStart(B.anchorNode,B.anchorOffset);F.collapse(true);G=N.createRange();G.setStart(B.focusNode,B.focusOffset);G.collapse(true);D=F.compareBoundaryPoints(F.START_TO_END,G)<0;K=D?B.anchorNode:B.focusNode;J=D?B.anchorOffset:B.focusOffset;l=D?B.focusNode:B.anchorNode;j=D?B.focusOffset:B.anchorOffset;if(K===l&&/^(TD|TH)$/.test(K.nodeName)){if(K.firstChild.nodeName=="BR"){I.remove(K.firstChild)}if(K.childNodes.length==0){o.dom.add(K,R.element,null,"<br />");P=o.dom.add(K,R.element,null,"<br />")}else{E=K.innerHTML;K.innerHTML="";o.dom.add(K,R.element,null,E);P=o.dom.add(K,R.element,null,"<br />")}C=N.createRange();C.selectNodeContents(P);C.collapse(1);o.selection.setRng(C);return false}if(K==Q&&l==Q&&Q.firstChild&&o.dom.isBlock(Q.firstChild)){K=l=K.firstChild;J=j=0;F=N.createRange();F.setStart(K,0);G=N.createRange();G.setStart(l,0)}K=K.nodeName=="HTML"?N.body:K;K=K.nodeName=="BODY"?K.firstChild:K;l=l.nodeName=="HTML"?N.body:l;l=l.nodeName=="BODY"?l.firstChild:l;m=A.getParentBlock(K);q=A.getParentBlock(l);i=m?m.nodeName:R.element;if(A.dom.getParent(m,"ol,ul,pre")){return true}if(m&&(m.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;m=null}if(q&&(q.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;q=null}if(/(TD|TABLE|TH|CAPTION)/.test(i)||(m&&i=="DIV"&&/left|right/gi.test(I.getStyle(m,"float",1)))){i=R.element;m=q=null}x=(m&&m.nodeName==i)?m.cloneNode(0):o.dom.create(i);P=(q&&q.nodeName==i)?q.cloneNode(0):o.dom.create(i);P.removeAttribute("id");if(/^(H[1-6])$/.test(i)&&K.nodeValue&&J==K.nodeValue.length){P=o.dom.create(R.element)}E=k=K;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}k=E}while((E=E.previousSibling?E.previousSibling:E.parentNode));E=p=l;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}p=E}while((E=E.nextSibling?E.nextSibling:E.parentNode));if(k.nodeName==i){F.setStart(k,0)}else{F.setStartBefore(k)}F.setEnd(K,J);x.appendChild(F.cloneContents()||N.createTextNode(""));try{G.setEndAfter(p)}catch(L){}G.setStart(l,j);P.appendChild(G.cloneContents()||N.createTextNode(""));C=N.createRange();if(!k.previousSibling&&k.parentNode.nodeName==i){C.setStartBefore(k.parentNode)}else{if(F.startContainer.nodeName==i&&F.startOffset==0){C.setStartBefore(F.startContainer)}else{C.setStart(F.startContainer,F.startOffset)}}if(!p.nextSibling&&p.parentNode.nodeName==i){C.setEndAfter(p.parentNode)}else{C.setEnd(G.endContainer,G.endOffset)}C.deleteContents();if(c){o.getWin().scrollTo(0,H.y)}if(x.firstChild&&x.firstChild.nodeName==i){x.innerHTML=x.firstChild.innerHTML}if(P.firstChild&&P.firstChild.nodeName==i){P.innerHTML=P.firstChild.innerHTML}if(g(x)){x.innerHTML="<br />"}function O(y,s){var r=[],T,S,t;y.innerHTML="";if(R.keep_styles){S=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(S.nodeName)){T=S.cloneNode(false);I.setAttrib(T,"id","");r.push(T)}}while(S=S.parentNode)}if(r.length>0){for(t=r.length-1,T=y;t>=0;t--){T=T.appendChild(r[t])}r[0].innerHTML=c?" ":"<br />";return r[0]}else{y.innerHTML=c?" ":"<br />"}}if(g(P)){v=O(P,l)}if(c&&parseFloat(opera.version())<9.5){C.insertNode(x);C.insertNode(P)}else{C.insertNode(P);C.insertNode(x)}P.normalize();x.normalize();function u(r){return N.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false).nextNode()||r}C=N.createRange();C.selectNodeContents(a?u(v||P):v||P);C.collapse(1);B.removeAllRanges();B.addRange(C);w=o.dom.getPos(P).y;z=P.clientHeight;if(w<H.y||w+z>H.y+H.h){o.getWin().scrollTo(0,w<H.y?w:w-H.h+25)}return false},backspaceDelete:function(l,u){var x=this,k=x.editor,p=k.getBody(),j,m=k.selection,i=m.getRng(),o=i.startContainer,j,q,s;if(o&&k.dom.isBlock(o)&&!/^(TD|TH)$/.test(o.nodeName)&&u){if(o.childNodes.length==0||(o.childNodes.length==1&&o.firstChild.nodeName=="BR")){j=o;while((j=j.previousSibling)&&!k.dom.isBlock(j)){}if(j){if(o!=p.firstChild){q=k.dom.doc.createTreeWalker(j,NodeFilter.SHOW_TEXT,null,false);while(s=q.nextNode()){j=s}i=k.getDoc().createRange();i.setStart(j,j.nodeValue?j.nodeValue.length:0);i.setEnd(j,j.nodeValue?j.nodeValue.length:0);m.setRng(i);k.dom.remove(o)}return b.cancel(l)}}}function v(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(j=x.getParentBlock(n))){r=n.previousSibling;b.remove(p,"DOMNodeInserted",v);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){k.dom.remove(n)}}}b._add(p,"DOMNodeInserted",v);window.setTimeout(function(){b._remove(p,"DOMNodeInserted",v)},1)}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){i.execCommand(p.cmd,p.ui||false,p.value)}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark("simple")});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.CommandManager=function(){var c={},b={},d={};function e(i,h,g,f){if(typeof(h)=="string"){h=[h]}a.each(h,function(j){i[j.toLowerCase()]={func:g,scope:f}})}a.extend(this,{add:function(h,g,f){e(c,h,g,f)},addQueryStateHandler:function(h,g,f){e(b,h,g,f)},addQueryValueHandler:function(h,g,f){e(d,h,g,f)},execCommand:function(g,j,i,h,f){if(j=c[j.toLowerCase()]){if(j.func.call(g||j.scope,i,h,f)!==false){return true}}},queryCommandValue:function(){if(cmd=d[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=b[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})};a.GlobalCommands=new a.CommandManager()})(tinymce);(function(b){function a(i,d,h,m){var j,g,e,l,f;function k(p,o){do{if(p.parentNode==o){return p}p=p.parentNode}while(p)}function c(o){m(o);b.walk(o,m,"childNodes")}j=i.findCommonAncestor(d,h);e=k(d,j)||d;l=k(h,j)||h;for(g=d;g&&g!=e;g=g.parentNode){for(f=g.nextSibling;f;f=f.nextSibling){c(f)}}if(e!=l){for(g=e.nextSibling;g&&g!=l;g=g.nextSibling){c(g)}}else{c(e)}for(g=h;g&&g!=l;g=g.parentNode){for(f=g.previousSibling;f;f=f.previousSibling){c(f)}}}b.GlobalCommands.add("RemoveFormat",function(){var m=this,l=m.dom,u=m.selection,d=u.getRng(1),e=[],h,f,j,q,g,o,c,i;function k(s){var r;l.getParent(s,function(v){if(l.is(v,m.getParam("removeformat_selector"))){r=v}return l.isBlock(v)},m.getBody());return r}function p(r){if(l.is(r,m.getParam("removeformat_selector"))){e.push(r)}}function t(r){p(r);b.walk(r,p,"childNodes")}h=u.getBookmark();q=d.startContainer;o=d.endContainer;g=d.startOffset;c=d.endOffset;q=q.nodeType==1?q.childNodes[Math.min(g,q.childNodes.length-1)]:q;o=o.nodeType==1?o.childNodes[Math.min(g==c?c:c-1,o.childNodes.length-1)]:o;if(q==o){f=k(q);if(q.nodeType==3){if(f&&f.nodeType==1){i=q.splitText(g);i.splitText(c-g);l.split(f,i);u.moveToBookmark(h)}return}t(l.split(f,q)||q)}else{f=k(q);j=k(o);if(f){if(q.nodeType==3){if(g==q.nodeValue.length){q.nodeValue+="\uFEFF"}q=q.splitText(g)}}if(j){if(o.nodeType==3){o.splitText(c)}}if(f&&f==j){l.replace(l.create("span",{id:"__end"},o.cloneNode(true)),o)}if(f){f=l.split(f,q)}else{f=q}if(i=l.get("__end")){o=i;j=k(o)}if(j){j=l.split(j,o)}else{j=o}a(l,f,j,p);if(q.nodeValue=="\uFEFF"){q.nodeValue=""}t(o);t(q)}b.each(e,function(r){l.remove(r,1)});l.remove("__end",1);u.moveToBookmark(h)})})(tinymce);(function(a){a.GlobalCommands.add("mceBlockQuote",function(){var j=this,o=j.selection,f=j.dom,l,k,e,d,p,c,m,h,b;function g(i){return f.getParent(i,function(q){return q.nodeName==="BLOCKQUOTE"})}l=f.getParent(o.getStart(),f.isBlock);k=f.getParent(o.getEnd(),f.isBlock);if(p=g(l)){if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}if(g(k)){m=p.cloneNode(false);while(e=k.nextSibling){m.appendChild(e.parentNode.removeChild(e))}}if(m){f.insertAfter(m,p)}b=o.getSelectedBlocks(l,k);for(h=b.length-1;h>=0;h--){f.insertAfter(b[h],p)}if(/^\s*$/.test(p.innerHTML)){f.remove(p,1)}if(m&&/^\s*$/.test(m.innerHTML)){f.remove(m,1)}if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(0);if(f.getParent(o.getStart(),f.isBlock)!=l){c=o.getRng();c.move("character",-1);c.select()}}}else{j.selection.moveToBookmark(d)}return}if(a.isIE&&!l&&!k){j.getDoc().execCommand("Indent");e=g(o.getNode());e.style.margin=e.dir="";return}if(!l||!k){return}if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}a.each(o.getSelectedBlocks(g(o.getStart()),g(o.getEnd())),function(i){if(i.nodeName=="BLOCKQUOTE"&&!p){p=i;return}if(!p){p=f.create("blockquote");i.parentNode.insertBefore(p,i)}if(i.nodeName=="BLOCKQUOTE"&&p){e=i.firstChild;while(e){p.appendChild(e.cloneNode(true));e=e.nextSibling}f.remove(i);return}p.appendChild(f.remove(i))});if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(1)}}else{o.moveToBookmark(d)}})})(tinymce);(function(a){a.each(["Cut","Copy","Paste"],function(b){a.GlobalCommands.add(b,function(){var c=this,e=c.getDoc();try{e.execCommand(b,false,null);if(!e.queryCommandSupported(b)){throw"Error"}}catch(d){c.windowManager.alert(c.getLang("clipboard_no_support"))}})})})(tinymce);(function(a){a.GlobalCommands.add("InsertHorizontalRule",function(){if(a.isOpera){return this.getDoc().execCommand("InsertHorizontalRule",false,"")}this.selection.setContent("<hr />")})})(tinymce);(function(){var a=tinymce.GlobalCommands;a.add(["mceEndUndoLevel","mceAddUndoLevel"],function(){this.undoManager.add()});a.add("Undo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.undo();b.nodeChanged();return true}return false});a.add("Redo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.redo();b.nodeChanged();return true}return false})})(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce_popup.js b/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce_popup.js new file mode 100644 index 0000000000000000000000000000000000000000..d235abd58637e82302ad2f3edbca41abfebad9a3 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce_popup.js @@ -0,0 +1,5 @@ + +// Uncomment and change this document.domain value if you are loading the script cross subdomains +// document.domain = 'moxiecode.com'; + +var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var e=this,g,a=document.body,c=e.dom.getViewPort(window),d,f;d=e.getWindowArg("mce_width")-c.w;f=e.getWindowArg("mce_height")-c.h;if(e.isWindow){window.resizeBy(d,f)}else{e.editor.windowManager.resizeBy(d,f,e.id)}},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark("simple")},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait(); \ No newline at end of file diff --git a/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce_src.js b/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce_src.js new file mode 100644 index 0000000000000000000000000000000000000000..b707fd56abf321495ecbaf98acb86c3aa98396fc --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/tiny_mce_src.js @@ -0,0 +1,12905 @@ +var tinymce = { + majorVersion : '3', + minorVersion : '2.3.1', + releaseDate : '2009-05-05', + + _init : function() { + var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v; + + // Browser checks + t.isOpera = w.opera && opera.buildNumber; + t.isWebKit = /WebKit/.test(ua); + t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName); + t.isIE6 = t.isIE && /MSIE [56]/.test(ua); + t.isGecko = !t.isWebKit && /Gecko/.test(ua); + t.isMac = ua.indexOf('Mac') != -1; + t.isAir = /adobeair/i.test(ua); + + // TinyMCE .NET webcontrol might be setting the values for TinyMCE + if (w.tinyMCEPreInit) { + t.suffix = tinyMCEPreInit.suffix; + t.baseURL = tinyMCEPreInit.base; + t.query = tinyMCEPreInit.query; + return; + } + + // Get suffix and base + t.suffix = ''; + + // If base element found, add that infront of baseURL + nl = d.getElementsByTagName('base'); + for (i=0; i<nl.length; i++) { + if (v = nl[i].href) { + // Host only value like http://site.com or http://site.com:8008 + if (/^https?:\/\/[^\/]+$/.test(v)) + v += '/'; + + base = v ? v.match(/.*\//)[0] : ''; // Get only directory + } + } + + function getBase(n) { + if (n.src && /tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(n.src)) { + if (/_(src|dev)\.js/g.test(n.src)) + t.suffix = '_src'; + + if ((p = n.src.indexOf('?')) != -1) + t.query = n.src.substring(p + 1); + + t.baseURL = n.src.substring(0, n.src.lastIndexOf('/')); + + // If path to script is relative and a base href was found add that one infront + if (base && t.baseURL.indexOf('://') == -1) + t.baseURL = base + t.baseURL; + + return t.baseURL; + } + + return null; + }; + + // Check document + nl = d.getElementsByTagName('script'); + for (i=0; i<nl.length; i++) { + if (getBase(nl[i])) + return; + } + + // Check head + n = d.getElementsByTagName('head')[0]; + if (n) { + nl = n.getElementsByTagName('script'); + for (i=0; i<nl.length; i++) { + if (getBase(nl[i])) + return; + } + } + + return; + }, + + is : function(o, t) { + var n = typeof(o); + + if (!t) + return n != 'undefined'; + + if (t == 'array' && (o.hasOwnProperty && o instanceof Array)) + return true; + + return n == t; + }, + + + each : function(o, cb, s) { + var n, l; + + if (!o) + return 0; + + s = s || o; + + if (typeof(o.length) != 'undefined') { + // Indexed arrays, needed for Safari + for (n=0, l = o.length; n<l; n++) { + if (cb.call(s, o[n], n, o) === false) + return 0; + } + } else { + // Hashtables + for (n in o) { + if (o.hasOwnProperty(n)) { + if (cb.call(s, o[n], n, o) === false) + return 0; + } + } + } + + return 1; + }, + + map : function(a, f) { + var o = []; + + tinymce.each(a, function(v) { + o.push(f(v)); + }); + + return o; + }, + + grep : function(a, f) { + var o = []; + + tinymce.each(a, function(v) { + if (!f || f(v)) + o.push(v); + }); + + return o; + }, + + inArray : function(a, v) { + var i, l; + + if (a) { + for (i = 0, l = a.length; i < l; i++) { + if (a[i] === v) + return i; + } + } + + return -1; + }, + + extend : function(o, e) { + var i, a = arguments; + + for (i=1; i<a.length; i++) { + e = a[i]; + + tinymce.each(e, function(v, n) { + if (typeof(v) !== 'undefined') + o[n] = v; + }); + } + + return o; + }, + + trim : function(s) { + return (s ? '' + s : '').replace(/^\s*|\s*$/g, ''); + }, + + + create : function(s, p) { + var t = this, sp, ns, cn, scn, c, de = 0; + + // Parse : <prefix> <class>:<super class> + s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); + cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name + + // Create namespace for new class + ns = t.createNS(s[3].replace(/\.\w+$/, '')); + + // Class already exists + if (ns[cn]) + return; + + // Make pure static class + if (s[2] == 'static') { + ns[cn] = p; + + if (this.onCreate) + this.onCreate(s[2], s[3], ns[cn]); + + return; + } + + // Create default constructor + if (!p[cn]) { + p[cn] = function() {}; + de = 1; + } + + // Add constructor and methods + ns[cn] = p[cn]; + t.extend(ns[cn].prototype, p); + + // Extend + if (s[5]) { + sp = t.resolve(s[5]).prototype; + scn = s[5].match(/\.(\w+)$/i)[1]; // Class name + + // Extend constructor + c = ns[cn]; + if (de) { + // Add passthrough constructor + ns[cn] = function() { + return sp[scn].apply(this, arguments); + }; + } else { + // Add inherit constructor + ns[cn] = function() { + this.parent = sp[scn]; + return c.apply(this, arguments); + }; + } + ns[cn].prototype[cn] = ns[cn]; + + // Add super methods + t.each(sp, function(f, n) { + ns[cn].prototype[n] = sp[n]; + }); + + // Add overridden methods + t.each(p, function(f, n) { + // Extend methods if needed + if (sp[n]) { + ns[cn].prototype[n] = function() { + this.parent = sp[n]; + return f.apply(this, arguments); + }; + } else { + if (n != cn) + ns[cn].prototype[n] = f; + } + }); + } + + // Add static methods + t.each(p['static'], function(f, n) { + ns[cn][n] = f; + }); + + if (this.onCreate) + this.onCreate(s[2], s[3], ns[cn].prototype); + }, + + walk : function(o, f, n, s) { + s = s || this; + + if (o) { + if (n) + o = o[n]; + + tinymce.each(o, function(o, i) { + if (f.call(s, o, i, n) === false) + return false; + + tinymce.walk(o, f, n, s); + }); + } + }, + + createNS : function(n, o) { + var i, v; + + o = o || window; + + n = n.split('.'); + for (i=0; i<n.length; i++) { + v = n[i]; + + if (!o[v]) + o[v] = {}; + + o = o[v]; + } + + return o; + }, + + resolve : function(n, o) { + var i, l; + + o = o || window; + + n = n.split('.'); + for (i=0, l = n.length; i<l; i++) { + o = o[n[i]]; + + if (!o) + break; + } + + return o; + }, + + addUnload : function(f, s) { + var t = this, w = window; + + f = {func : f, scope : s || this}; + + if (!t.unloads) { + function unload() { + var li = t.unloads, o, n; + + if (li) { + // Call unload handlers + for (n in li) { + o = li[n]; + + if (o && o.func) + o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy + } + + // Detach unload function + if (w.detachEvent) { + w.detachEvent('onbeforeunload', fakeUnload); + w.detachEvent('onunload', unload); + } else if (w.removeEventListener) + w.removeEventListener('unload', unload, false); + + // Destroy references + t.unloads = o = li = w = unload = 0; + + // Run garbarge collector on IE + if (window.CollectGarbage) + window.CollectGarbage(); + } + }; + + function fakeUnload() { + var d = document; + + // Is there things still loading, then do some magic + if (d.readyState == 'interactive') { + function stop() { + // Prevent memory leak + d.detachEvent('onstop', stop); + + // Call unload handler + if (unload) + unload(); + + d = 0; + }; + + // Fire unload when the currently loading page is stopped + if (d) + d.attachEvent('onstop', stop); + + // Remove onstop listener after a while to prevent the unload function + // to execute if the user presses cancel in an onbeforeunload + // confirm dialog and then presses the browser stop button + window.setTimeout(function() { + if (d) + d.detachEvent('onstop', stop); + }, 0); + } + }; + + // Attach unload handler + if (w.attachEvent) { + w.attachEvent('onunload', unload); + w.attachEvent('onbeforeunload', fakeUnload); + } else if (w.addEventListener) + w.addEventListener('unload', unload, false); + + // Setup initial unload handler array + t.unloads = [f]; + } else + t.unloads.push(f); + + return f; + }, + + removeUnload : function(f) { + var u = this.unloads, r = null; + + tinymce.each(u, function(o, i) { + if (o && o.func == f) { + u.splice(i, 1); + r = f; + return false; + } + }); + + return r; + }, + + explode : function(s, d) { + return s ? tinymce.map(s.split(d || ','), tinymce.trim) : s; + }, + + _addVer : function(u) { + var v; + + if (!this.query) + return u; + + v = (u.indexOf('?') == -1 ? '?' : '&') + this.query; + + if (u.indexOf('#') == -1) + return u + v; + + return u.replace('#', v + '#'); + } + + }; + +// Required for GZip AJAX loading +window.tinymce = tinymce; + +// Initialize the API +tinymce._init(); +tinymce.create('tinymce.util.Dispatcher', { + scope : null, + listeners : null, + + Dispatcher : function(s) { + this.scope = s || this; + this.listeners = []; + }, + + add : function(cb, s) { + this.listeners.push({cb : cb, scope : s || this.scope}); + + return cb; + }, + + addToTop : function(cb, s) { + this.listeners.unshift({cb : cb, scope : s || this.scope}); + + return cb; + }, + + remove : function(cb) { + var l = this.listeners, o = null; + + tinymce.each(l, function(c, i) { + if (cb == c.cb) { + o = cb; + l.splice(i, 1); + return false; + } + }); + + return o; + }, + + dispatch : function() { + var s, a = arguments, i, li = this.listeners, c; + + // Needs to be a real loop since the listener count might change while looping + // And this is also more efficient + for (i = 0; i<li.length; i++) { + c = li[i]; + s = c.cb.apply(c.scope, a); + + if (s === false) + break; + } + + return s; + } + + }); +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.util.URI', { + URI : function(u, s) { + var t = this, o, a, b; + + // Default settings + s = t.settings = s || {}; + + // Strange app protocol or local anchor + if (/^(mailto|tel|news|javascript|about):/i.test(u) || /^\s*#/.test(u)) { + t.source = u; + return; + } + + // Absolute path with no host, fake host and protocol + if (u.indexOf('/') === 0 && u.indexOf('//') !== 0) + u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u; + + // Relative path + if (u.indexOf(':/') === -1 && u.indexOf('//') !== 0) + u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u); + + // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) + u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something + u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); + each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) { + var s = u[i]; + + // Zope 3 workaround, they use @@something + if (s) + s = s.replace(/\(mce_at\)/g, '@@'); + + t[v] = s; + }); + + if (b = s.base_uri) { + if (!t.protocol) + t.protocol = b.protocol; + + if (!t.userInfo) + t.userInfo = b.userInfo; + + if (!t.port && t.host == 'mce_host') + t.port = b.port; + + if (!t.host || t.host == 'mce_host') + t.host = b.host; + + t.source = ''; + } + + //t.path = t.path || '/'; + }, + + setPath : function(p) { + var t = this; + + p = /^(.*?)\/?(\w+)?$/.exec(p); + + // Update path parts + t.path = p[0]; + t.directory = p[1]; + t.file = p[2]; + + // Rebuild source + t.source = ''; + t.getURI(); + }, + + toRelative : function(u) { + var t = this, o; + + if (u === "./") + return u; + + u = new tinymce.util.URI(u, {base_uri : t}); + + // Not on same domain/port or protocol + if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol) + return u.getURI(); + + o = t.toRelPath(t.path, u.path); + + // Add query + if (u.query) + o += '?' + u.query; + + // Add anchor + if (u.anchor) + o += '#' + u.anchor; + + return o; + }, + + toAbsolute : function(u, nh) { + var u = new tinymce.util.URI(u, {base_uri : this}); + + return u.getURI(this.host == u.host ? nh : 0); + }, + + toRelPath : function(base, path) { + var items, bp = 0, out = '', i, l; + + // Split the paths + base = base.substring(0, base.lastIndexOf('/')); + base = base.split('/'); + items = path.split('/'); + + if (base.length >= items.length) { + for (i = 0, l = base.length; i < l; i++) { + if (i >= items.length || base[i] != items[i]) { + bp = i + 1; + break; + } + } + } + + if (base.length < items.length) { + for (i = 0, l = items.length; i < l; i++) { + if (i >= base.length || base[i] != items[i]) { + bp = i + 1; + break; + } + } + } + + if (bp == 1) + return path; + + for (i = 0, l = base.length - (bp - 1); i < l; i++) + out += "../"; + + for (i = bp - 1, l = items.length; i < l; i++) { + if (i != bp - 1) + out += "/" + items[i]; + else + out += items[i]; + } + + return out; + }, + + toAbsPath : function(base, path) { + var i, nb = 0, o = [], tr; + + // Split paths + tr = /\/$/.test(path) ? '/' : ''; + base = base.split('/'); + path = path.split('/'); + + // Remove empty chunks + each(base, function(k) { + if (k) + o.push(k); + }); + + base = o; + + // Merge relURLParts chunks + for (i = path.length - 1, o = []; i >= 0; i--) { + // Ignore empty or . + if (path[i].length == 0 || path[i] == ".") + continue; + + // Is parent + if (path[i] == '..') { + nb++; + continue; + } + + // Move up + if (nb > 0) { + nb--; + continue; + } + + o.push(path[i]); + } + + i = base.length - nb; + + // If /a/b/c or / + if (i <= 0) + return '/' + o.reverse().join('/') + tr; + + return '/' + base.slice(0, i).join('/') + '/' + o.reverse().join('/') + tr; + }, + + getURI : function(nh) { + var s, t = this; + + // Rebuild source + if (!t.source || nh) { + s = ''; + + if (!nh) { + if (t.protocol) + s += t.protocol + '://'; + + if (t.userInfo) + s += t.userInfo + '@'; + + if (t.host) + s += t.host; + + if (t.port) + s += ':' + t.port; + } + + if (t.path) + s += t.path; + + if (t.query) + s += '?' + t.query; + + if (t.anchor) + s += '#' + t.anchor; + + t.source = s; + } + + return t.source; + } + + }); +})(); +(function() { + var each = tinymce.each; + + tinymce.create('static tinymce.util.Cookie', { + getHash : function(n) { + var v = this.get(n), h; + + if (v) { + each(v.split('&'), function(v) { + v = v.split('='); + h = h || {}; + h[unescape(v[0])] = unescape(v[1]); + }); + } + + return h; + }, + + setHash : function(n, v, e, p, d, s) { + var o = ''; + + each(v, function(v, k) { + o += (!o ? '' : '&') + escape(k) + '=' + escape(v); + }); + + this.set(n, o, e, p, d, s); + }, + + get : function(n) { + var c = document.cookie, e, p = n + "=", b; + + // Strict mode + if (!c) + return; + + b = c.indexOf("; " + p); + + if (b == -1) { + b = c.indexOf(p); + + if (b != 0) + return null; + } else + b += 2; + + e = c.indexOf(";", b); + + if (e == -1) + e = c.length; + + return unescape(c.substring(b + p.length, e)); + }, + + set : function(n, v, e, p, d, s) { + document.cookie = n + "=" + escape(v) + + ((e) ? "; expires=" + e.toGMTString() : "") + + ((p) ? "; path=" + escape(p) : "") + + ((d) ? "; domain=" + d : "") + + ((s) ? "; secure" : ""); + }, + + remove : function(n, p) { + var d = new Date(); + + d.setTime(d.getTime() - 1000); + + this.set(n, '', d, p, d); + } + + }); +})(); +tinymce.create('static tinymce.util.JSON', { + serialize : function(o) { + var i, v, s = tinymce.util.JSON.serialize, t; + + if (o == null) + return 'null'; + + t = typeof o; + + if (t == 'string') { + v = '\bb\tt\nn\ff\rr\""\'\'\\\\'; + + return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) { + i = v.indexOf(b); + + if (i + 1) + return '\\' + v.charAt(i + 1); + + a = b.charCodeAt().toString(16); + + return '\\u' + '0000'.substring(a.length) + a; + }) + '"'; + } + + if (t == 'object') { + if (o.hasOwnProperty && o instanceof Array) { + for (i=0, v = '['; i<o.length; i++) + v += (i > 0 ? ',' : '') + s(o[i]); + + return v + ']'; + } + + v = '{'; + + for (i in o) + v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : ''; + + return v + '}'; + } + + return '' + o; + }, + + parse : function(s) { + try { + return eval('(' + s + ')'); + } catch (ex) { + // Ignore + } + } + + }); +tinymce.create('static tinymce.util.XHR', { + send : function(o) { + var x, t, w = window, c = 0; + + // Default settings + o.scope = o.scope || this; + o.success_scope = o.success_scope || o.scope; + o.error_scope = o.error_scope || o.scope; + o.async = o.async === false ? false : true; + o.data = o.data || ''; + + function get(s) { + x = 0; + + try { + x = new ActiveXObject(s); + } catch (ex) { + } + + return x; + }; + + x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Microsoft.XMLHTTP') || get('Msxml2.XMLHTTP'); + + if (x) { + if (x.overrideMimeType) + x.overrideMimeType(o.content_type); + + x.open(o.type || (o.data ? 'POST' : 'GET'), o.url, o.async); + + if (o.content_type) + x.setRequestHeader('Content-Type', o.content_type); + + x.send(o.data); + + function ready() { + if (!o.async || x.readyState == 4 || c++ > 10000) { + if (o.success && c < 10000 && x.status == 200) + o.success.call(o.success_scope, '' + x.responseText, x, o); + else if (o.error) + o.error.call(o.error_scope, c > 10000 ? 'TIMED_OUT' : 'GENERAL', x, o); + + x = null; + } else + w.setTimeout(ready, 10); + }; + + // Syncronous request + if (!o.async) + return ready(); + + // Wait for response, onReadyStateChange can not be used since it leaks memory in IE + t = w.setTimeout(ready, 10); + } + + } +}); +(function() { + var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR; + + tinymce.create('tinymce.util.JSONRequest', { + JSONRequest : function(s) { + this.settings = extend({ + }, s); + this.count = 0; + }, + + send : function(o) { + var ecb = o.error, scb = o.success; + + o = extend(this.settings, o); + + o.success = function(c, x) { + c = JSON.parse(c); + + if (typeof(c) == 'undefined') { + c = { + error : 'JSON Parse error.' + }; + } + + if (c.error) + ecb.call(o.error_scope || o.scope, c.error, x); + else + scb.call(o.success_scope || o.scope, c.result); + }; + + o.error = function(ty, x) { + ecb.call(o.error_scope || o.scope, ty, x); + }; + + o.data = JSON.serialize({ + id : o.id || 'c' + (this.count++), + method : o.method, + params : o.params + }); + + // JSON content type for Ruby on rails. Bug: #1883287 + o.content_type = 'application/json'; + + XHR.send(o); + }, + + 'static' : { + sendRPC : function(o) { + return new tinymce.util.JSONRequest().send(o); + } + } + + }); +}());(function(tinymce) { + // Shorten names + var each = tinymce.each, is = tinymce.is; + var isWebKit = tinymce.isWebKit, isIE = tinymce.isIE; + + tinymce.create('tinymce.dom.DOMUtils', { + doc : null, + root : null, + files : null, + pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/, + props : { + "for" : "htmlFor", + "class" : "className", + className : "className", + checked : "checked", + disabled : "disabled", + maxlength : "maxLength", + readonly : "readOnly", + selected : "selected", + value : "value", + id : "id", + name : "name", + type : "type" + }, + + DOMUtils : function(d, s) { + var t = this; + + t.doc = d; + t.win = window; + t.files = {}; + t.cssFlicker = false; + t.counter = 0; + t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat"; + t.stdMode = d.documentMode === 8; + + this.settings = s = tinymce.extend({ + keep_values : false, + hex_colors : 1, + process_html : 1 + }, s); + + // Fix IE6SP2 flicker and check it failed for pre SP2 + if (tinymce.isIE6) { + try { + d.execCommand('BackgroundImageCache', false, true); + } catch (e) { + t.cssFlicker = true; + } + } + + tinymce.addUnload(t.destroy, t); + }, + + getRoot : function() { + var t = this, s = t.settings; + + return (s && t.get(s.root_element)) || t.doc.body; + }, + + getViewPort : function(w) { + var d, b; + + w = !w ? this.win : w; + d = w.document; + b = this.boxModel ? d.documentElement : d.body; + + // Returns viewport size excluding scrollbars + return { + x : w.pageXOffset || b.scrollLeft, + y : w.pageYOffset || b.scrollTop, + w : w.innerWidth || b.clientWidth, + h : w.innerHeight || b.clientHeight + }; + }, + + getRect : function(e) { + var p, t = this, sr; + + e = t.get(e); + p = t.getPos(e); + sr = t.getSize(e); + + return { + x : p.x, + y : p.y, + w : sr.w, + h : sr.h + }; + }, + + getSize : function(e) { + var t = this, w, h; + + e = t.get(e); + w = t.getStyle(e, 'width'); + h = t.getStyle(e, 'height'); + + // Non pixel value, then force offset/clientWidth + if (w.indexOf('px') === -1) + w = 0; + + // Non pixel value, then force offset/clientWidth + if (h.indexOf('px') === -1) + h = 0; + + return { + w : parseInt(w) || e.offsetWidth || e.clientWidth, + h : parseInt(h) || e.offsetHeight || e.clientHeight + }; + }, + + is : function(n, patt) { + return tinymce.dom.Sizzle.matches(patt, n.nodeType ? [n] : n).length > 0; + }, + + getParent : function(n, f, r) { + return this.getParents(n, f, r, false); + }, + + getParents : function(n, f, r, c) { + var t = this, na, se = t.settings, o = []; + + n = t.get(n); + c = c === undefined; + + if (se.strict_root) + r = r || t.getRoot(); + + // Wrap node name as func + if (is(f, 'string')) { + na = f; + + if (f === '*') { + f = function(n) {return n.nodeType == 1;}; + } else { + f = function(n) { + return t.is(n, na); + }; + } + } + + while (n) { + if (n == r || !n.nodeType || n.nodeType === 9) + break; + + if (!f || f(n)) { + if (c) + o.push(n); + else + return n; + } + + n = n.parentNode; + } + + return c ? o : null; + }, + + get : function(e) { + var n; + + if (e && this.doc && typeof(e) == 'string') { + n = e; + e = this.doc.getElementById(e); + + // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick + if (e && e.id !== n) + return this.doc.getElementsByName(n)[1]; + } + + return e; + }, + + + select : function(pa, s) { + var t = this; + + return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []); + }, + + + add : function(p, n, a, h, c) { + var t = this; + + return this.run(p, function(p) { + var e, k; + + e = is(n, 'string') ? t.doc.createElement(n) : n; + t.setAttribs(e, a); + + if (h) { + if (h.nodeType) + e.appendChild(h); + else + t.setHTML(e, h); + } + + return !c ? p.appendChild(e) : e; + }); + }, + + create : function(n, a, h) { + return this.add(this.doc.createElement(n), n, a, h, 1); + }, + + createHTML : function(n, a, h) { + var o = '', t = this, k; + + o += '<' + n; + + for (k in a) { + if (a.hasOwnProperty(k)) + o += ' ' + k + '="' + t.encode(a[k]) + '"'; + } + + if (tinymce.is(h)) + return o + '>' + h + '</' + n + '>'; + + return o + ' />'; + }, + + remove : function(n, k) { + var t = this; + + return this.run(n, function(n) { + var p, g, i; + + p = n.parentNode; + + if (!p) + return null; + + if (k) { + for (i = n.childNodes.length - 1; i >= 0; i--) + t.insertAfter(n.childNodes[i], n); + + //each(n.childNodes, function(c) { + // p.insertBefore(c.cloneNode(true), n); + //}); + } + + // Fix IE psuedo leak + if (t.fixPsuedoLeaks) { + p = n.cloneNode(true); + k = 'IELeakGarbageBin'; + g = t.get(k) || t.add(t.doc.body, 'div', {id : k, style : 'display:none'}); + g.appendChild(n); + g.innerHTML = ''; + + return p; + } + + return p.removeChild(n); + }); + }, + + + setStyle : function(n, na, v) { + var t = this; + + return t.run(n, function(e) { + var s, i; + + s = e.style; + + // Camelcase it, if needed + na = na.replace(/-(\D)/g, function(a, b){ + return b.toUpperCase(); + }); + + // Default px suffix on these + if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v))) + v += 'px'; + + switch (na) { + case 'opacity': + // IE specific opacity + if (isIE) { + s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")"; + + if (!n.currentStyle || !n.currentStyle.hasLayout) + s.display = 'inline-block'; + } + + // Fix for older browsers + s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || ''; + break; + + case 'float': + isIE ? s.styleFloat = v : s.cssFloat = v; + break; + + default: + s[na] = v || ''; + } + + // Force update of the style data + if (t.settings.update_styles) + t.setAttrib(e, 'mce_style'); + }); + }, + + getStyle : function(n, na, c) { + n = this.get(n); + + if (!n) + return false; + + // Gecko + if (this.doc.defaultView && c) { + // Remove camelcase + na = na.replace(/[A-Z]/g, function(a){ + return '-' + a; + }); + + try { + return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na); + } catch (ex) { + // Old safari might fail + return null; + } + } + + // Camelcase it, if needed + na = na.replace(/-(\D)/g, function(a, b){ + return b.toUpperCase(); + }); + + if (na == 'float') + na = isIE ? 'styleFloat' : 'cssFloat'; + + // IE & Opera + if (n.currentStyle && c) + return n.currentStyle[na]; + + return n.style[na]; + }, + + setStyles : function(e, o) { + var t = this, s = t.settings, ol; + + ol = s.update_styles; + s.update_styles = 0; + + each(o, function(v, n) { + t.setStyle(e, n, v); + }); + + // Update style info + s.update_styles = ol; + if (s.update_styles) + t.setAttrib(e, s.cssText); + }, + + setAttrib : function(e, n, v) { + var t = this; + + // Whats the point + if (!e || !n) + return; + + // Strict XML mode + if (t.settings.strict) + n = n.toLowerCase(); + + return this.run(e, function(e) { + var s = t.settings; + + switch (n) { + case "style": + if (!is(v, 'string')) { + each(v, function(v, n) { + t.setStyle(e, n, v); + }); + + return; + } + + // No mce_style for elements with these since they might get resized by the user + if (s.keep_values) { + if (v && !t._isRes(v)) + e.setAttribute('mce_style', v, 2); + else + e.removeAttribute('mce_style', 2); + } + + e.style.cssText = v; + break; + + case "class": + e.className = v || ''; // Fix IE null bug + break; + + case "src": + case "href": + if (s.keep_values) { + if (s.url_converter) + v = s.url_converter.call(s.url_converter_scope || t, v, n, e); + + t.setAttrib(e, 'mce_' + n, v, 2); + } + + break; + + case "shape": + e.setAttribute('mce_style', v); + break; + } + + if (is(v) && v !== null && v.length !== 0) + e.setAttribute(n, '' + v, 2); + else + e.removeAttribute(n, 2); + }); + }, + + setAttribs : function(e, o) { + var t = this; + + return this.run(e, function(e) { + each(o, function(v, n) { + t.setAttrib(e, n, v); + }); + }); + }, + + + getAttrib : function(e, n, dv) { + var v, t = this; + + e = t.get(e); + + if (!e || e.nodeType !== 1) + return false; + + if (!is(dv)) + dv = ''; + + // Try the mce variant for these + if (/^(src|href|style|coords|shape)$/.test(n)) { + v = e.getAttribute("mce_" + n); + + if (v) + return v; + } + + if (isIE && t.props[n]) { + v = e[t.props[n]]; + v = v && v.nodeValue ? v.nodeValue : v; + } + + if (!v) + v = e.getAttribute(n, 2); + + if (n === 'style') { + v = v || e.style.cssText; + + if (v) { + v = t.serializeStyle(t.parseStyle(v)); + + if (t.settings.keep_values && !t._isRes(v)) + e.setAttribute('mce_style', v); + } + } + + // Remove Apple and WebKit stuff + if (isWebKit && n === "class" && v) + v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, ''); + + // Handle IE issues + if (isIE) { + switch (n) { + case 'rowspan': + case 'colspan': + // IE returns 1 as default value + if (v === 1) + v = ''; + + break; + + case 'size': + // IE returns +0 as default value for size + if (v === '+0' || v === 20 || v === 0) + v = ''; + + break; + + case 'width': + case 'height': + case 'vspace': + case 'checked': + case 'disabled': + case 'readonly': + if (v === 0) + v = ''; + + break; + + case 'hspace': + // IE returns -1 as default value + if (v === -1) + v = ''; + + break; + + case 'maxlength': + case 'tabindex': + // IE returns default value + if (v === 32768 || v === 2147483647 || v === '32768') + v = ''; + + break; + + case 'multiple': + case 'compact': + case 'noshade': + case 'nowrap': + if (v === 65535) + return n; + + return dv; + + case 'shape': + v = v.toLowerCase(); + break; + + default: + // IE has odd anonymous function for event attributes + if (n.indexOf('on') === 0 && v) + v = ('' + v).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1'); + } + } + + return (v !== undefined && v !== null && v !== '') ? '' + v : dv; + }, + + getPos : function(n, ro) { + var t = this, x = 0, y = 0, e, d = t.doc, r; + + n = t.get(n); + ro = ro || d.body; + + if (n) { + // Use getBoundingClientRect on IE, Opera has it but it's not perfect + if (isIE && !t.stdMode) { + n = n.getBoundingClientRect(); + e = t.boxModel ? d.documentElement : d.body; + x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border + x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x; + n.top += t.win.self != t.win.top ? 2 : 0; // IE adds some strange extra cord if used in a frameset + + return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x}; + } + + r = n; + while (r && r != ro && r.nodeType) { + x += r.offsetLeft || 0; + y += r.offsetTop || 0; + r = r.offsetParent; + } + + r = n.parentNode; + while (r && r != ro && r.nodeType) { + x -= r.scrollLeft || 0; + y -= r.scrollTop || 0; + r = r.parentNode; + } + } + + return {x : x, y : y}; + }, + + parseStyle : function(st) { + var t = this, s = t.settings, o = {}; + + if (!st) + return o; + + function compress(p, s, ot) { + var t, r, b, l; + + // Get values and check it it needs compressing + t = o[p + '-top' + s]; + if (!t) + return; + + r = o[p + '-right' + s]; + if (t != r) + return; + + b = o[p + '-bottom' + s]; + if (r != b) + return; + + l = o[p + '-left' + s]; + if (b != l) + return; + + // Compress + o[ot] = l; + delete o[p + '-top' + s]; + delete o[p + '-right' + s]; + delete o[p + '-bottom' + s]; + delete o[p + '-left' + s]; + }; + + function compress2(ta, a, b, c) { + var t; + + t = o[a]; + if (!t) + return; + + t = o[b]; + if (!t) + return; + + t = o[c]; + if (!t) + return; + + // Compress + o[ta] = o[a] + ' ' + o[b] + ' ' + o[c]; + delete o[a]; + delete o[b]; + delete o[c]; + }; + + st = st.replace(/&(#?[a-z0-9]+);/g, '&$1_MCE_SEMI_'); // Protect entities + + each(st.split(';'), function(v) { + var sv, ur = []; + + if (v) { + v = v.replace(/_MCE_SEMI_/g, ';'); // Restore entities + v = v.replace(/url\([^\)]+\)/g, function(v) {ur.push(v);return 'url(' + ur.length + ')';}); + v = v.split(':'); + sv = tinymce.trim(v[1]); + sv = sv.replace(/url\(([^\)]+)\)/g, function(a, b) {return ur[parseInt(b) - 1];}); + + sv = sv.replace(/rgb\([^\)]+\)/g, function(v) { + return t.toHex(v); + }); + + if (s.url_converter) { + sv = sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g, function(x, c) { + return 'url(' + s.url_converter.call(s.url_converter_scope || t, t.decode(c), 'style', null) + ')'; + }); + } + + o[tinymce.trim(v[0]).toLowerCase()] = sv; + } + }); + + compress("border", "", "border"); + compress("border", "-width", "border-width"); + compress("border", "-color", "border-color"); + compress("border", "-style", "border-style"); + compress("padding", "", "padding"); + compress("margin", "", "margin"); + compress2('border', 'border-width', 'border-style', 'border-color'); + + if (isIE) { + // Remove pointless border + if (o.border == 'medium none') + o.border = ''; + } + + return o; + }, + + serializeStyle : function(o) { + var s = ''; + + each(o, function(v, k) { + if (k && v) { + if (tinymce.isGecko && k.indexOf('-moz-') === 0) + return; + + switch (k) { + case 'color': + case 'background-color': + v = v.toLowerCase(); + break; + } + + s += (s ? ' ' : '') + k + ': ' + v + ';'; + } + }); + + return s; + }, + + loadCSS : function(u) { + var t = this, d = t.doc; + + if (!u) + u = ''; + + each(u.split(','), function(u) { + if (t.files[u]) + return; + + t.files[u] = true; + t.add(t.select('head')[0], 'link', {rel : 'stylesheet', href : tinymce._addVer(u)}); + }); + }, + + + addClass : function(e, c) { + return this.run(e, function(e) { + var o; + + if (!c) + return 0; + + if (this.hasClass(e, c)) + return e.className; + + o = this.removeClass(e, c); + + return e.className = (o != '' ? (o + ' ') : '') + c; + }); + }, + + removeClass : function(e, c) { + var t = this, re; + + return t.run(e, function(e) { + var v; + + if (t.hasClass(e, c)) { + if (!re) + re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g"); + + v = e.className.replace(re, ' '); + + return e.className = tinymce.trim(v != ' ' ? v : ''); + } + + return e.className; + }); + }, + + hasClass : function(n, c) { + n = this.get(n); + + if (!n || !c) + return false; + + return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1; + }, + + show : function(e) { + return this.setStyle(e, 'display', 'block'); + }, + + hide : function(e) { + return this.setStyle(e, 'display', 'none'); + }, + + isHidden : function(e) { + e = this.get(e); + + return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none'; + }, + + + uniqueId : function(p) { + return (!p ? 'mce_' : p) + (this.counter++); + }, + + setHTML : function(e, h) { + var t = this; + + return this.run(e, function(e) { + var x, i, nl, n, p, x; + + h = t.processHTML(h); + + if (isIE) { + function set() { + try { + // IE will remove comments from the beginning + // unless you padd the contents with something + e.innerHTML = '<br />' + h; + e.removeChild(e.firstChild); + } catch (ex) { + // IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p + // This seems to fix this problem + + // Remove all child nodes + while (e.firstChild) + e.firstChild.removeNode(); + + // Create new div with HTML contents and a BR infront to keep comments + x = t.create('div'); + x.innerHTML = '<br />' + h; + + // Add all children from div to target + each (x.childNodes, function(n, i) { + // Skip br element + if (i) + e.appendChild(n); + }); + } + }; + + // IE has a serious bug when it comes to paragraphs it can produce an invalid + // DOM tree if contents like this <p><ul><li>Item 1</li></ul></p> is inserted + // It seems to be that IE doesn't like a root block element placed inside another root block element + if (t.settings.fix_ie_paragraphs) + h = h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi, '<p$1 mce_keep="true"> </p>'); + + set(); + + if (t.settings.fix_ie_paragraphs) { + // Check for odd paragraphs this is a sign of a broken DOM + nl = e.getElementsByTagName("p"); + for (i = nl.length - 1, x = 0; i >= 0; i--) { + n = nl[i]; + + if (!n.hasChildNodes()) { + if (!n.mce_keep) { + x = 1; // Is broken + break; + } + + n.removeAttribute('mce_keep'); + } + } + } + + // Time to fix the madness IE left us + if (x) { + // So if we replace the p elements with divs and mark them and then replace them back to paragraphs + // after we use innerHTML we can fix the DOM tree + h = h.replace(/<p ([^>]+)>|<p>/g, '<div $1 mce_tmp="1">'); + h = h.replace(/<\/p>/g, '</div>'); + + // Set the new HTML with DIVs + set(); + + // Replace all DIV elements with he mce_tmp attibute back to paragraphs + // This is needed since IE has a annoying bug see above for details + // This is a slow process but it has to be done. :( + if (t.settings.fix_ie_paragraphs) { + nl = e.getElementsByTagName("DIV"); + for (i = nl.length - 1; i >= 0; i--) { + n = nl[i]; + + // Is it a temp div + if (n.mce_tmp) { + // Create new paragraph + p = t.doc.createElement('p'); + + // Copy all attributes + n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) { + var v; + + if (b !== 'mce_tmp') { + v = n.getAttribute(b); + + if (!v && b === 'class') + v = n.className; + + p.setAttribute(b, v); + } + }); + + // Append all children to new paragraph + for (x = 0; x<n.childNodes.length; x++) + p.appendChild(n.childNodes[x].cloneNode(true)); + + // Replace div with new paragraph + n.swapNode(p); + } + } + } + } + } else + e.innerHTML = h; + + return h; + }); + }, + + processHTML : function(h) { + var t = this, s = t.settings; + + if (!s.process_html) + return h; + + // Convert strong and em to b and i in FF since it can't handle them + if (tinymce.isGecko) { + h = h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi, '<$1b$2>'); + h = h.replace(/<(\/?)em>|<em( [^>]+)>/gi, '<$1i$2>'); + } else if (isIE) { + h = h.replace(/'/g, '''); // IE can't handle apos + h = h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi, ''); // IE doesn't handle default values correct + } + + // Fix some issues + h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open + + // Store away src and href in mce_src and mce_href since browsers mess them up + if (s.keep_values) { + // Wrap scripts and styles in comments for serialization purposes + if (/<script|style/.test(h)) { + function trim(s) { + // Remove prefix and suffix code for element + s = s.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n'); + s = s.replace(/^[\r\n]*|[\r\n]*$/g, ''); + s = s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g, ''); + s = s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g, ''); + + return s; + }; + + // Preserve script elements + h = h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g, function(v, a, b) { + // Remove prefix and suffix code for script element + b = trim(b); + + // Force type attribute + if (!a) + a = ' type="text/javascript"'; + + // Wrap contents in a comment + if (b) + b = '<!--\n' + b + '\n// -->'; + + // Output fake element + return '<mce:script' + a + '>' + b + '</mce:script>'; + }); + + // Preserve style elements + h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g, function(v, a, b) { + b = trim(b); + return '<mce:style' + a + '><!--\n' + b + '\n--></mce:style><style' + a + ' mce_bogus="1">' + b + '</style>'; + }); + } + + h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->'); + + // Process all tags with src, href or style + h = h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi, function(a, n) { + function handle(m, b, c) { + var u = c; + + // Tag already got a mce_ version + if (a.indexOf('mce_' + b) != -1) + return m; + + if (b == 'style') { + // No mce_style for elements with these since they might get resized by the user + if (t._isRes(c)) + return m; + + if (s.hex_colors) { + u = u.replace(/rgb\([^\)]+\)/g, function(v) { + return t.toHex(v); + }); + } + + if (s.url_converter) { + u = u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g, function(x, c) { + return 'url(' + t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n)) + ')'; + }); + } + } else if (b != 'coords' && b != 'shape') { + if (s.url_converter) + u = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n)); + } + + return ' ' + b + '="' + c + '" mce_' + b + '="' + u + '"'; + }; + + a = a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi, handle); // W3C + a = a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi, handle); // W3C + + return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi, handle); // IE + }); + } + + return h; + }, + + getOuterHTML : function(e) { + var d; + + e = this.get(e); + + if (!e) + return null; + + if (e.outerHTML !== undefined) + return e.outerHTML; + + d = (e.ownerDocument || this.doc).createElement("body"); + d.appendChild(e.cloneNode(true)); + + return d.innerHTML; + }, + + setOuterHTML : function(e, h, d) { + var t = this; + + return this.run(e, function(e) { + var n, tp; + + e = t.get(e); + d = d || e.ownerDocument || t.doc; + + if (isIE && e.nodeType == 1) + e.outerHTML = h; + else { + tp = d.createElement("body"); + tp.innerHTML = h; + + n = tp.lastChild; + while (n) { + t.insertAfter(n.cloneNode(true), e); + n = n.previousSibling; + } + + t.remove(e); + } + }); + }, + + decode : function(s) { + var e, n, v; + + // Look for entities to decode + if (/&[^;]+;/.test(s)) { + // Decode the entities using a div element not super efficient but less code + e = this.doc.createElement("div"); + e.innerHTML = s; + n = e.firstChild; + v = ''; + + if (n) { + do { + v += n.nodeValue; + } while (n.nextSibling); + } + + return v || s; + } + + return s; + }, + + encode : function(s) { + return s ? ('' + s).replace(/[<>&\"]/g, function (c, b) { + switch (c) { + case '&': + return '&'; + + case '"': + return '"'; + + case '<': + return '<'; + + case '>': + return '>'; + } + + return c; + }) : s; + }, + + + insertAfter : function(n, r) { + var t = this; + + r = t.get(r); + + return this.run(n, function(n) { + var p, ns; + + p = r.parentNode; + ns = r.nextSibling; + + if (ns) + p.insertBefore(n, ns); + else + p.appendChild(n); + + return n; + }); + }, + + + isBlock : function(n) { + if (n.nodeType && n.nodeType !== 1) + return false; + + n = n.nodeName || n; + + return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n); + }, + + + replace : function(n, o, k) { + var t = this; + + if (is(o, 'array')) + n = n.cloneNode(true); + + return t.run(o, function(o) { + if (k) { + each(o.childNodes, function(c) { + n.appendChild(c.cloneNode(true)); + }); + } + + // Fix IE psuedo leak for elements since replacing elements if fairly common + // Will break parentNode for some unknown reason + if (t.fixPsuedoLeaks && o.nodeType === 1) { + o.parentNode.insertBefore(n, o); + t.remove(o); + return n; + } + + return o.parentNode.replaceChild(n, o); + }); + }, + + + findCommonAncestor : function(a, b) { + var ps = a, pe; + + while (ps) { + pe = b; + + while (pe && ps != pe) + pe = pe.parentNode; + + if (ps == pe) + break; + + ps = ps.parentNode; + } + + if (!ps && a.ownerDocument) + return a.ownerDocument.documentElement; + + return ps; + }, + + toHex : function(s) { + var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s); + + function hex(s) { + s = parseInt(s).toString(16); + + return s.length > 1 ? s : '0' + s; // 0 -> 00 + }; + + if (c) { + s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]); + + return s; + } + + return s; + }, + + getClasses : function() { + var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov; + + if (t.classes) + return t.classes; + + function addClasses(s) { + // IE style imports + each(s.imports, function(r) { + addClasses(r); + }); + + each(s.cssRules || s.rules, function(r) { + // Real type or fake it on IE + switch (r.type || 1) { + // Rule + case 1: + if (r.selectorText) { + each(r.selectorText.split(','), function(v) { + v = v.replace(/^\s*|\s*$|^\s\./g, ""); + + // Is internal or it doesn't contain a class + if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v)) + return; + + // Remove everything but class name + ov = v; + v = v.replace(/.*\.([a-z0-9_\-]+).*/i, '$1'); + + // Filter classes + if (f && !(v = f(v, ov))) + return; + + if (!lo[v]) { + cl.push({'class' : v}); + lo[v] = 1; + } + }); + } + break; + + // Import + case 3: + addClasses(r.styleSheet); + break; + } + }); + }; + + try { + each(t.doc.styleSheets, addClasses); + } catch (ex) { + // Ignore + } + + if (cl.length > 0) + t.classes = cl; + + return cl; + }, + + run : function(e, f, s) { + var t = this, o; + + if (t.doc && typeof(e) === 'string') + e = t.get(e); + + if (!e) + return false; + + s = s || this; + if (!e.nodeType && (e.length || e.length === 0)) { + o = []; + + each(e, function(e, i) { + if (e) { + if (typeof(e) == 'string') + e = t.doc.getElementById(e); + + o.push(f.call(s, e, i)); + } + }); + + return o; + } + + return f.call(s, e); + }, + + getAttribs : function(n) { + var o; + + n = this.get(n); + + if (!n) + return []; + + if (isIE) { + o = []; + + // Object will throw exception in IE + if (n.nodeName == 'OBJECT') + return n.attributes; + + // It's crazy that this is faster in IE but it's because it returns all attributes all the time + n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi, function(a, b) { + o.push({specified : 1, nodeName : b}); + }); + + return o; + } + + return n.attributes; + }, + + destroy : function(s) { + var t = this; + + t.win = t.doc = t.root = null; + + // Manual destroy then remove unload handler + if (!s) + tinymce.removeUnload(t.destroy); + }, + + createRng : function() { + var d = this.doc; + + return d.createRange ? d.createRange() : new tinymce.dom.Range(this); + }, + + split : function(pe, e, re) { + var t = this, r = t.createRng(), bef, aft, pa; + + // W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sence + // but we don't want that in our code since it serves no purpose + // For example if this is chopped: + // <p>text 1<span><b>CHOP</b></span>text 2</p> + // would produce: + // <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p> + // this function will then trim of empty edges and produce: + // <p>text 1</p><b>CHOP</b><p>text 2</p> + function trimEdge(n, na) { + n = n[na]; + + if (n && n[na] && n[na].nodeType == 1 && isEmpty(n[na])) + t.remove(n[na]); + }; + + function isEmpty(n) { + n = t.getOuterHTML(n); + n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars + n = n.replace(/<[^>]+>/g, ''); // Remove all tags + + return n.replace(/[ \t\r\n]+| | /g, '') == ''; + }; + + if (pe && e) { + // Get before chunk + r.setStartBefore(pe); + r.setEndBefore(e); + bef = r.extractContents(); + + // Get after chunk + r = t.createRng(); + r.setStartAfter(e); + r.setEndAfter(pe); + aft = r.extractContents(); + + // Insert chunks and remove parent + pa = pe.parentNode; + + // Remove right side edge of the before contents + trimEdge(bef, 'lastChild'); + + if (!isEmpty(bef)) + pa.insertBefore(bef, pe); + + if (re) + pa.replaceChild(re, e); + else + pa.insertBefore(e, pe); + + // Remove left site edge of the after contents + trimEdge(aft, 'firstChild'); + + if (!isEmpty(aft)) + pa.insertBefore(aft, pe); + + t.remove(pe); + + return re || e; + } + }, + + + _isRes : function(c) { + // Is live resizble element + return /^(top|left|bottom|right|width|height)/i.test(c) || /;\s*(top|left|bottom|right|width|height)/i.test(c); + } + + /* + walk : function(n, f, s) { + var d = this.doc, w; + + if (d.createTreeWalker) { + w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); + + while ((n = w.nextNode()) != null) + f.call(s || this, n); + } else + tinymce.walk(n, f, 'childNodes', s); + } + */ + + /* + toRGB : function(s) { + var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s); + + if (c) { + // #FFF -> #FFFFFF + if (!is(c[3])) + c[3] = c[2] = c[1]; + + return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")"; + } + + return s; + } + */ + + }); + + // Setup page DOM + tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0}); +})(tinymce); +(function(ns) { + // Traverse constants + var EXTRACT = 0, CLONE = 1, DELETE = 2, extend = tinymce.extend; + + function indexOf(child, parent) { + var i, node; + + if (child.parentNode != parent) + return -1; + + for (node = parent.firstChild, i = 0; node != child; node = node.nextSibling) + i++; + + return i; + }; + + function nodeIndex(n) { + var i = 0; + + while (n.previousSibling) { + i++; + n = n.previousSibling; + } + + return i; + }; + + function getSelectedNode(container, offset) { + var child; + + if (container.nodeType == 3 /* TEXT_NODE */) + return container; + + if (offset < 0) + return container; + + child = container.firstChild; + while (child != null && offset > 0) { + --offset; + child = child.nextSibling; + } + + if (child != null) + return child; + + return container; + }; + + // Range constructor + function Range(dom) { + var d = dom.doc; + + extend(this, { + dom : dom, + + // Inital states + startContainer : d, + startOffset : 0, + endContainer : d, + endOffset : 0, + collapsed : true, + commonAncestorContainer : d, + + // Range constants + START_TO_START : 0, + START_TO_END : 1, + END_TO_END : 2, + END_TO_START : 3 + }); + }; + + // Add range methods + extend(Range.prototype, { + setStart : function(n, o) { + this._setEndPoint(true, n, o); + }, + + setEnd : function(n, o) { + this._setEndPoint(false, n, o); + }, + + setStartBefore : function(n) { + this.setStart(n.parentNode, nodeIndex(n)); + }, + + setStartAfter : function(n) { + this.setStart(n.parentNode, nodeIndex(n) + 1); + }, + + setEndBefore : function(n) { + this.setEnd(n.parentNode, nodeIndex(n)); + }, + + setEndAfter : function(n) { + this.setEnd(n.parentNode, nodeIndex(n) + 1); + }, + + collapse : function(ts) { + var t = this; + + if (ts) { + t.endContainer = t.startContainer; + t.endOffset = t.startOffset; + } else { + t.startContainer = t.endContainer; + t.startOffset = t.endOffset; + } + + t.collapsed = true; + }, + + selectNode : function(n) { + this.setStartBefore(n); + this.setEndAfter(n); + }, + + selectNodeContents : function(n) { + this.setStart(n, 0); + this.setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length); + }, + + compareBoundaryPoints : function(h, r) { + var t = this, sc = t.startContainer, so = t.startOffset, ec = t.endContainer, eo = t.endOffset; + + // Check START_TO_START + if (h === 0) + return t._compareBoundaryPoints(sc, so, sc, so); + + // Check START_TO_END + if (h === 1) + return t._compareBoundaryPoints(sc, so, ec, eo); + + // Check END_TO_END + if (h === 2) + return t._compareBoundaryPoints(ec, eo, ec, eo); + + // Check END_TO_START + if (h === 3) + return t._compareBoundaryPoints(ec, eo, sc, so); + }, + + deleteContents : function() { + this._traverse(DELETE); + }, + + extractContents : function() { + return this._traverse(EXTRACT); + }, + + cloneContents : function() { + return this._traverse(CLONE); + }, + + insertNode : function(n) { + var t = this, nn, o; + + // Node is TEXT_NODE or CDATA + if (n.nodeType === 3 || n.nodeType === 4) { + nn = t.startContainer.splitText(t.startOffset); + t.startContainer.parentNode.insertBefore(n, nn); + } else { + // Insert element node + if (t.startContainer.childNodes.length > 0) + o = t.startContainer.childNodes[t.startOffset]; + + t.startContainer.insertBefore(n, o); + } + }, + + surroundContents : function(n) { + var t = this, f = t.extractContents(); + + t.insertNode(n); + n.appendChild(f); + t.selectNode(n); + }, + + cloneRange : function() { + var t = this; + + return extend(new Range(t.dom), { + startContainer : t.startContainer, + startOffset : t.startOffset, + endContainer : t.endContainer, + endOffset : t.endOffset, + collapsed : t.collapsed, + commonAncestorContainer : t.commonAncestorContainer + }); + }, + +/* + detach : function() { + // Not implemented + }, +*/ + // Internal methods + + _isCollapsed : function() { + return (this.startContainer == this.endContainer && this.startOffset == this.endOffset); + }, + + _compareBoundaryPoints : function (containerA, offsetA, containerB, offsetB) { + var c, offsetC, n, cmnRoot, childA, childB; + + // In the first case the boundary-points have the same container. A is before B + // if its offset is less than the offset of B, A is equal to B if its offset is + // equal to the offset of B, and A is after B if its offset is greater than the + // offset of B. + if (containerA == containerB) { + if (offsetA == offsetB) { + return 0; // equal + } else if (offsetA < offsetB) { + return -1; // before + } else { + return 1; // after + } + } + + // In the second case a child node C of the container of A is an ancestor + // container of B. In this case, A is before B if the offset of A is less than or + // equal to the index of the child node C and A is after B otherwise. + c = containerB; + while (c && c.parentNode != containerA) { + c = c.parentNode; + } + if (c) { + offsetC = 0; + n = containerA.firstChild; + + while (n != c && offsetC < offsetA) { + offsetC++; + n = n.nextSibling; + } + + if (offsetA <= offsetC) { + return -1; // before + } else { + return 1; // after + } + } + + // In the third case a child node C of the container of B is an ancestor container + // of A. In this case, A is before B if the index of the child node C is less than + // the offset of B and A is after B otherwise. + c = containerA; + while (c && c.parentNode != containerB) { + c = c.parentNode; + } + + if (c) { + offsetC = 0; + n = containerB.firstChild; + + while (n != c && offsetC < offsetB) { + offsetC++; + n = n.nextSibling; + } + + if (offsetC < offsetB) { + return -1; // before + } else { + return 1; // after + } + } + + // In the fourth case, none of three other cases hold: the containers of A and B + // are siblings or descendants of sibling nodes. In this case, A is before B if + // the container of A is before the container of B in a pre-order traversal of the + // Ranges' context tree and A is after B otherwise. + cmnRoot = this.dom.findCommonAncestor(containerA, containerB); + childA = containerA; + + while (childA && childA.parentNode != cmnRoot) { + childA = childA.parentNode; + } + + if (!childA) { + childA = cmnRoot; + } + + childB = containerB; + while (childB && childB.parentNode != cmnRoot) { + childB = childB.parentNode; + } + + if (!childB) { + childB = cmnRoot; + } + + if (childA == childB) { + return 0; // equal + } + + n = cmnRoot.firstChild; + while (n) { + if (n == childA) { + return -1; // before + } + + if (n == childB) { + return 1; // after + } + + n = n.nextSibling; + } + }, + + _setEndPoint : function(st, n, o) { + var t = this, ec, sc; + + if (st) { + t.startContainer = n; + t.startOffset = o; + } else { + t.endContainer = n; + t.endOffset = o; + } + + // If one boundary-point of a Range is set to have a root container + // other than the current one for the Range, the Range is collapsed to + // the new position. This enforces the restriction that both boundary- + // points of a Range must have the same root container. + ec = t.endContainer; + while (ec.parentNode) + ec = ec.parentNode; + + sc = t.startContainer; + while (sc.parentNode) + sc = sc.parentNode; + + if (sc != ec) { + t.collapse(st); + } else { + // The start position of a Range is guaranteed to never be after the + // end position. To enforce this restriction, if the start is set to + // be at a position after the end, the Range is collapsed to that + // position. + if (t._compareBoundaryPoints(t.startContainer, t.startOffset, t.endContainer, t.endOffset) > 0) + t.collapse(st); + } + + t.collapsed = t._isCollapsed(); + t.commonAncestorContainer = t.dom.findCommonAncestor(t.startContainer, t.endContainer); + }, + + // This code is heavily "inspired" by the Apache Xerces implementation. I hope they don't mind. :) + + _traverse : function(how) { + var t = this, c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep; + + if (t.startContainer == t.endContainer) + return t._traverseSameContainer(how); + + for (c = t.endContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) { + if (p == t.startContainer) + return t._traverseCommonStartContainer(c, how); + + ++endContainerDepth; + } + + for (c = t.startContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) { + if (p == t.endContainer) + return t._traverseCommonEndContainer(c, how); + + ++startContainerDepth; + } + + depthDiff = startContainerDepth - endContainerDepth; + + startNode = t.startContainer; + while (depthDiff > 0) { + startNode = startNode.parentNode; + depthDiff--; + } + + endNode = t.endContainer; + while (depthDiff < 0) { + endNode = endNode.parentNode; + depthDiff++; + } + + // ascend the ancestor hierarchy until we have a common parent. + for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) { + startNode = sp; + endNode = ep; + } + + return t._traverseCommonAncestors(startNode, endNode, how); + }, + + _traverseSameContainer : function(how) { + var t = this, frag, s, sub, n, cnt, sibling, xferNode; + + if (how != DELETE) + frag = t.dom.doc.createDocumentFragment(); + + // If selection is empty, just return the fragment + if (t.startOffset == t.endOffset) + return frag; + + // Text node needs special case handling + if (t.startContainer.nodeType == 3 /* TEXT_NODE */) { + // get the substring + s = t.startContainer.nodeValue; + sub = s.substring(t.startOffset, t.endOffset); + + // set the original text node to its new value + if (how != CLONE) { + t.startContainer.deleteData(t.startOffset, t.endOffset - t.startOffset); + + // Nothing is partially selected, so collapse to start point + t.collapse(true); + } + + if (how == DELETE) + return null; + + frag.appendChild(t.dom.doc.createTextNode(sub)); + return frag; + } + + // Copy nodes between the start/end offsets. + n = getSelectedNode(t.startContainer, t.startOffset); + cnt = t.endOffset - t.startOffset; + + while (cnt > 0) { + sibling = n.nextSibling; + xferNode = t._traverseFullySelected(n, how); + + if (frag) + frag.appendChild( xferNode ); + + --cnt; + n = sibling; + } + + // Nothing is partially selected, so collapse to start point + if (how != CLONE) + t.collapse(true); + + return frag; + }, + + _traverseCommonStartContainer : function(endAncestor, how) { + var t = this, frag, n, endIdx, cnt, sibling, xferNode; + + if (how != DELETE) + frag = t.dom.doc.createDocumentFragment(); + + n = t._traverseRightBoundary(endAncestor, how); + + if (frag) + frag.appendChild(n); + + endIdx = indexOf(endAncestor, t.startContainer); + cnt = endIdx - t.startOffset; + + if (cnt <= 0) { + // Collapse to just before the endAncestor, which + // is partially selected. + if (how != CLONE) { + t.setEndBefore(endAncestor); + t.collapse(false); + } + + return frag; + } + + n = endAncestor.previousSibling; + while (cnt > 0) { + sibling = n.previousSibling; + xferNode = t._traverseFullySelected(n, how); + + if (frag) + frag.insertBefore(xferNode, frag.firstChild); + + --cnt; + n = sibling; + } + + // Collapse to just before the endAncestor, which + // is partially selected. + if (how != CLONE) { + t.setEndBefore(endAncestor); + t.collapse(false); + } + + return frag; + }, + + _traverseCommonEndContainer : function(startAncestor, how) { + var t = this, frag, startIdx, n, cnt, sibling, xferNode; + + if (how != DELETE) + frag = t.dom.doc.createDocumentFragment(); + + n = t._traverseLeftBoundary(startAncestor, how); + if (frag) + frag.appendChild(n); + + startIdx = indexOf(startAncestor, t.endContainer); + ++startIdx; // Because we already traversed it.... + + cnt = t.endOffset - startIdx; + n = startAncestor.nextSibling; + while (cnt > 0) { + sibling = n.nextSibling; + xferNode = t._traverseFullySelected(n, how); + + if (frag) + frag.appendChild(xferNode); + + --cnt; + n = sibling; + } + + if (how != CLONE) { + t.setStartAfter(startAncestor); + t.collapse(true); + } + + return frag; + }, + + _traverseCommonAncestors : function(startAncestor, endAncestor, how) { + var t = this, n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling; + + if (how != DELETE) + frag = t.dom.doc.createDocumentFragment(); + + n = t._traverseLeftBoundary(startAncestor, how); + if (frag) + frag.appendChild(n); + + commonParent = startAncestor.parentNode; + startOffset = indexOf(startAncestor, commonParent); + endOffset = indexOf(endAncestor, commonParent); + ++startOffset; + + cnt = endOffset - startOffset; + sibling = startAncestor.nextSibling; + + while (cnt > 0) { + nextSibling = sibling.nextSibling; + n = t._traverseFullySelected(sibling, how); + + if (frag) + frag.appendChild(n); + + sibling = nextSibling; + --cnt; + } + + n = t._traverseRightBoundary(endAncestor, how); + + if (frag) + frag.appendChild(n); + + if (how != CLONE) { + t.setStartAfter(startAncestor); + t.collapse(true); + } + + return frag; + }, + + _traverseRightBoundary : function(root, how) { + var t = this, next = getSelectedNode(t.endContainer, t.endOffset - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent; + var isFullySelected = next != t.endContainer; + + if (next == root) + return t._traverseNode(next, isFullySelected, false, how); + + parent = next.parentNode; + clonedParent = t._traverseNode(parent, false, false, how); + + while (parent != null) { + while (next != null) { + prevSibling = next.previousSibling; + clonedChild = t._traverseNode(next, isFullySelected, false, how); + + if (how != DELETE) + clonedParent.insertBefore(clonedChild, clonedParent.firstChild); + + isFullySelected = true; + next = prevSibling; + } + + if (parent == root) + return clonedParent; + + next = parent.previousSibling; + parent = parent.parentNode; + + clonedGrandParent = t._traverseNode(parent, false, false, how); + + if (how != DELETE) + clonedGrandParent.appendChild(clonedParent); + + clonedParent = clonedGrandParent; + } + + // should never occur + return null; + }, + + _traverseLeftBoundary : function(root, how) { + var t = this, next = getSelectedNode(t.startContainer, t.startOffset); + var isFullySelected = next != t.startContainer, parent, clonedParent, nextSibling, clonedChild, clonedGrandParent; + + if (next == root) + return t._traverseNode(next, isFullySelected, true, how); + + parent = next.parentNode; + clonedParent = t._traverseNode(parent, false, true, how); + + while (parent != null) { + while (next != null) { + nextSibling = next.nextSibling; + clonedChild = t._traverseNode(next, isFullySelected, true, how); + + if (how != DELETE) + clonedParent.appendChild(clonedChild); + + isFullySelected = true; + next = nextSibling; + } + + if (parent == root) + return clonedParent; + + next = parent.nextSibling; + parent = parent.parentNode; + + clonedGrandParent = t._traverseNode(parent, false, true, how); + + if (how != DELETE) + clonedGrandParent.appendChild(clonedParent); + + clonedParent = clonedGrandParent; + } + + // should never occur + return null; + }, + + _traverseNode : function(n, isFullySelected, isLeft, how) { + var t = this, txtValue, newNodeValue, oldNodeValue, offset, newNode; + + if (isFullySelected) + return t._traverseFullySelected(n, how); + + if (n.nodeType == 3 /* TEXT_NODE */) { + txtValue = n.nodeValue; + + if (isLeft) { + offset = t.startOffset; + newNodeValue = txtValue.substring(offset); + oldNodeValue = txtValue.substring(0, offset); + } else { + offset = t.endOffset; + newNodeValue = txtValue.substring(0, offset); + oldNodeValue = txtValue.substring(offset); + } + + if (how != CLONE) + n.nodeValue = oldNodeValue; + + if (how == DELETE) + return null; + + newNode = n.cloneNode(false); + newNode.nodeValue = newNodeValue; + + return newNode; + } + + if (how == DELETE) + return null; + + return n.cloneNode(false); + }, + + _traverseFullySelected : function(n, how) { + var t = this; + + if (how != DELETE) + return how == CLONE ? n.cloneNode(true) : n; + + n.parentNode.removeChild(n); + return null; + } + }); + + ns.Range = Range; +})(tinymce.dom); +(function() { + function Selection(selection) { + var t = this, invisibleChar = '\uFEFF', range, lastIERng; + + function compareRanges(rng1, rng2) { + if (rng1 && rng2) { + // Both are control ranges and the selected element matches + if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0)) + return 1; + + // Both are text ranges and the range matches + if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1)) + return 1; + } + + return 0; + }; + + function getRange() { + var dom = selection.dom, ieRange = selection.getRng(), domRange = dom.createRng(), startPos, endPos, element, sc, ec, collapsed; + + function findIndex(element) { + var nl = element.parentNode.childNodes, i; + + for (i = nl.length - 1; i >= 0; i--) { + if (nl[i] == element) + return i; + } + + return -1; + }; + + function findEndPoint(start) { + var rng = ieRange.duplicate(), parent, i, nl, n, offset = 0, index = 0, pos, tmpRng; + + // Insert marker character + rng.collapse(start); + parent = rng.parentElement(); + rng.pasteHTML(invisibleChar); // Needs to be a pasteHTML instead of .text = since IE has a bug with nodeValue + + // Find marker character + nl = parent.childNodes; + for (i = 0; i < nl.length; i++) { + n = nl[i]; + + // Calculate node index excluding text node fragmentation + if (i > 0 && (n.nodeType !== 3 || nl[i - 1].nodeType !== 3)) + index++; + + // If text node then calculate offset + if (n.nodeType === 3) { + // Look for marker + pos = n.nodeValue.indexOf(invisibleChar); + if (pos !== -1) { + offset += pos; + break; + } + + offset += n.nodeValue.length; + } else + offset = 0; + } + + // Remove marker character + rng.moveStart('character', -1); + rng.text = ''; + + return {index : index, offset : offset, parent : parent}; + }; + + // If selection is outside the current document just return an empty range + element = ieRange.item ? ieRange.item(0) : ieRange.parentElement(); + if (element.ownerDocument != dom.doc) + return domRange; + + // Handle control selection or text selection of a image + if (ieRange.item || !element.hasChildNodes()) { + domRange.setStart(element.parentNode, findIndex(element)); + domRange.setEnd(domRange.startContainer, domRange.startOffset + 1); + + return domRange; + } + + // Check collapsed state + collapsed = selection.isCollapsed(); + + // Find start and end pos index and offset + startPos = findEndPoint(true); + endPos = findEndPoint(false); + + // Normalize the elements to avoid fragmented dom + startPos.parent.normalize(); + endPos.parent.normalize(); + + // Set start container and offset + sc = startPos.parent.childNodes[Math.min(startPos.index, startPos.parent.childNodes.length - 1)]; + + if (sc.nodeType != 3) + domRange.setStart(startPos.parent, startPos.index); + else + domRange.setStart(startPos.parent.childNodes[startPos.index], startPos.offset); + + // Set end container and offset + ec = endPos.parent.childNodes[Math.min(endPos.index, endPos.parent.childNodes.length - 1)]; + + if (ec.nodeType != 3) { + if (!collapsed) + endPos.index++; + + domRange.setEnd(endPos.parent, endPos.index); + } else + domRange.setEnd(endPos.parent.childNodes[endPos.index], endPos.offset); + + // If not collapsed then make sure offsets are valid + if (!collapsed) { + sc = domRange.startContainer; + if (sc.nodeType == 1) + domRange.setStart(sc, Math.min(domRange.startOffset, sc.childNodes.length)); + + ec = domRange.endContainer; + if (ec.nodeType == 1) + domRange.setEnd(ec, Math.min(domRange.endOffset, ec.childNodes.length)); + } + + // Restore selection to new range + t.addRange(domRange); + + return domRange; + }; + + this.addRange = function(rng) { + var ieRng, body = selection.dom.doc.body, startPos, endPos, sc, so, ec, eo; + + // Setup some shorter versions + sc = rng.startContainer; + so = rng.startOffset; + ec = rng.endContainer; + eo = rng.endOffset; + ieRng = body.createTextRange(); + + // Find element + sc = sc.nodeType == 1 ? sc.childNodes[Math.min(so, sc.childNodes.length - 1)] : sc; + ec = ec.nodeType == 1 ? ec.childNodes[Math.min(so == eo ? eo : eo - 1, ec.childNodes.length - 1)] : ec; + + // Single element selection + if (sc == ec && sc.nodeType == 1) { + // Make control selection for some elements + if (/^(IMG|TABLE)$/.test(sc.nodeName) && so != eo) { + ieRng = body.createControlRange(); + ieRng.addElement(sc); + } else { + ieRng = body.createTextRange(); + + // Padd empty elements with invisible character + if (!sc.hasChildNodes() && sc.canHaveHTML) + sc.innerHTML = invisibleChar; + + // Select element contents + ieRng.moveToElementText(sc); + + // If it's only containing a padding remove it so the caret remains + if (sc.innerHTML == invisibleChar) { + ieRng.collapse(true); + sc.removeChild(sc.firstChild); + } + } + + if (so == eo) + ieRng.collapse(eo <= rng.endContainer.childNodes.length - 1); + + ieRng.select(); + + return; + } + + function getCharPos(container, offset) { + var nodeVal, rng, pos; + + if (container.nodeType != 3) + return -1; + + nodeVal = container.nodeValue; + rng = body.createTextRange(); + + // Insert marker at offset position + container.nodeValue = nodeVal.substring(0, offset) + invisibleChar + nodeVal.substring(offset); + + // Find char pos of marker and remove it + rng.moveToElementText(container.parentNode); + rng.findText(invisibleChar); + pos = Math.abs(rng.moveStart('character', -0xFFFFF)); + container.nodeValue = nodeVal; + + return pos; + }; + + // Collapsed range + if (rng.collapsed) { + pos = getCharPos(sc, so); + + ieRng = body.createTextRange(); + ieRng.move('character', pos); + ieRng.select(); + + return; + } else { + // If same text container + if (sc == ec && sc.nodeType == 3) { + startPos = getCharPos(sc, so); + + ieRng.move('character', startPos); + ieRng.moveEnd('character', eo - so); + ieRng.select(); + + return; + } + + // Get caret positions + startPos = getCharPos(sc, so); + endPos = getCharPos(ec, eo); + ieRng = body.createTextRange(); + + // Move start of range to start character position or start element + if (startPos == -1) { + ieRng.moveToElementText(sc); + startPos = 0; + } else + ieRng.move('character', startPos); + + // Move end of range to end character position or end element + tmpRng = body.createTextRange(); + + if (endPos == -1) + tmpRng.moveToElementText(ec); + else + tmpRng.move('character', endPos); + + ieRng.setEndPoint('EndToEnd', tmpRng); + ieRng.select(); + + return; + } + }; + + this.getRangeAt = function() { + // Setup new range if the cache is empty + if (!range || !compareRanges(lastIERng, selection.getRng())) { + range = getRange(); + + // Store away text range for next call + lastIERng = selection.getRng(); + } + + // Return cached range + return range; + }; + + this.destroy = function() { + // Destroy cached range and last IE range to avoid memory leaks + lastIERng = range = null; + }; + }; + + // Expose the selection object + tinymce.dom.TridentSelection = Selection; +})(); + +/* + * Sizzle CSS Selector Engine - v1.0 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false; + +var Sizzle = function(selector, context, results, seed) { + results = results || []; + var origContext = context = context || document; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context); + + // Reset the position of the chunker regexp (start from head) + chunker.lastIndex = 0; + + while ( (m = chunker.exec(selector)) !== null ) { + parts.push( m[1] ); + + if ( m[2] ) { + extra = RegExp.rightContext; + break; + } + } + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context ); + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) + selector += parts.shift(); + + set = posProcess( selector, set ); + } + } + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + var ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; + } + + if ( context ) { + var ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray(set); + } else { + prune = false; + } + + while ( parts.length ) { + var cur = parts.pop(), pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + throw "Syntax error, unrecognized expression: " + (cur || selector); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + } else if ( context && context.nodeType === 1 ) { + for ( var i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + } else { + for ( var i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function(results){ + if ( sortOrder ) { + hasDuplicate = false; + results.sort(sortOrder); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[i-1] ) { + results.splice(i--, 1); + } + } + } + } +}; + +Sizzle.matches = function(expr, set){ + return Sizzle(expr, null, null, set); +}; + +Sizzle.find = function(expr, context, isXML){ + var set, match; + + if ( !expr ) { + return []; + } + + for ( var i = 0, l = Expr.order.length; i < l; i++ ) { + var type = Expr.order[i], match; + + if ( (match = Expr.match[ type ].exec( expr )) ) { + var left = RegExp.leftContext; + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace(/\\/g, ""); + set = Expr.find[ type ]( match, context, isXML ); + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = context.getElementsByTagName("*"); + } + + return {set: set, expr: expr}; +}; + +Sizzle.filter = function(expr, set, inplace, not){ + var old = expr, result = [], curLoop = set, match, anyFound, + isXMLFilter = set && set[0] && isXML(set[0]); + + while ( expr && set.length ) { + for ( var type in Expr.filter ) { + if ( (match = Expr.match[ type ].exec( expr )) != null ) { + var filter = Expr.filter[ type ], found, item; + anyFound = false; + + if ( curLoop == result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( var i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + var pass = not ^ !!found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + } else { + curLoop[i] = false; + } + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr == old ) { + if ( anyFound == null ) { + throw "Syntax error, unrecognized expression: " + expr; + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + match: { + ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ + }, + attrMap: { + "class": "className", + "for": "htmlFor" + }, + attrHandle: { + href: function(elem){ + return elem.getAttribute("href"); + } + }, + relative: { + "+": function(checkSet, part, isXML){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !/\W/.test(part), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag && !isXML ) { + part = part.toUpperCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + ">": function(checkSet, part, isXML){ + var isPartStr = typeof part === "string"; + + if ( isPartStr && !/\W/.test(part) ) { + part = isXML ? part : part.toUpperCase(); + + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName === part ? parent : false; + } + } + } else { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + "": function(checkSet, part, isXML){ + var doneName = done++, checkFn = dirCheck; + + if ( !part.match(/\W/) ) { + var nodeCheck = part = isXML ? part : part.toUpperCase(); + checkFn = dirNodeCheck; + } + + checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); + }, + "~": function(checkSet, part, isXML){ + var doneName = done++, checkFn = dirCheck; + + if ( typeof part === "string" && !part.match(/\W/) ) { + var nodeCheck = part = isXML ? part : part.toUpperCase(); + checkFn = dirNodeCheck; + } + + checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); + } + }, + find: { + ID: function(match, context, isXML){ + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + return m ? [m] : []; + } + }, + NAME: function(match, context, isXML){ + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], results = context.getElementsByName(match[1]); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + TAG: function(match, context){ + return context.getElementsByTagName(match[1]); + } + }, + preFilter: { + CLASS: function(match, curLoop, inplace, result, not, isXML){ + match = " " + match[1].replace(/\\/g, "") + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { + if ( !inplace ) + result.push( elem ); + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + ID: function(match){ + return match[1].replace(/\\/g, ""); + }, + TAG: function(match, curLoop){ + for ( var i = 0; curLoop[i] === false; i++ ){} + return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); + }, + CHILD: function(match){ + if ( match[1] == "nth" ) { + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( + match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + ATTR: function(match, curLoop, inplace, result, not, isXML){ + var name = match[1].replace(/\\/g, ""); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + PSEUDO: function(match, curLoop, inplace, result, not){ + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + if ( !inplace ) { + result.push.apply( result, ret ); + } + return false; + } + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + POS: function(match){ + match.unshift( true ); + return match; + } + }, + filters: { + enabled: function(elem){ + return elem.disabled === false && elem.type !== "hidden"; + }, + disabled: function(elem){ + return elem.disabled === true; + }, + checked: function(elem){ + return elem.checked === true; + }, + selected: function(elem){ + // Accessing this property makes selected-by-default + // options in Safari work properly + elem.parentNode.selectedIndex; + return elem.selected === true; + }, + parent: function(elem){ + return !!elem.firstChild; + }, + empty: function(elem){ + return !elem.firstChild; + }, + has: function(elem, i, match){ + return !!Sizzle( match[3], elem ).length; + }, + header: function(elem){ + return /h\d/i.test( elem.nodeName ); + }, + text: function(elem){ + return "text" === elem.type; + }, + radio: function(elem){ + return "radio" === elem.type; + }, + checkbox: function(elem){ + return "checkbox" === elem.type; + }, + file: function(elem){ + return "file" === elem.type; + }, + password: function(elem){ + return "password" === elem.type; + }, + submit: function(elem){ + return "submit" === elem.type; + }, + image: function(elem){ + return "image" === elem.type; + }, + reset: function(elem){ + return "reset" === elem.type; + }, + button: function(elem){ + return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; + }, + input: function(elem){ + return /input|select|textarea|button/i.test(elem.nodeName); + } + }, + setFilters: { + first: function(elem, i){ + return i === 0; + }, + last: function(elem, i, match, array){ + return i === array.length - 1; + }, + even: function(elem, i){ + return i % 2 === 0; + }, + odd: function(elem, i){ + return i % 2 === 1; + }, + lt: function(elem, i, match){ + return i < match[3] - 0; + }, + gt: function(elem, i, match){ + return i > match[3] - 0; + }, + nth: function(elem, i, match){ + return match[3] - 0 == i; + }, + eq: function(elem, i, match){ + return match[3] - 0 == i; + } + }, + filter: { + PSEUDO: function(elem, match, i, array){ + var name = match[1], filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; + } else if ( name === "not" ) { + var not = match[3]; + + for ( var i = 0, l = not.length; i < l; i++ ) { + if ( not[i] === elem ) { + return false; + } + } + + return true; + } + }, + CHILD: function(elem, match){ + var type = match[1], node = elem; + switch (type) { + case 'only': + case 'first': + while (node = node.previousSibling) { + if ( node.nodeType === 1 ) return false; + } + if ( type == 'first') return true; + node = elem; + case 'last': + while (node = node.nextSibling) { + if ( node.nodeType === 1 ) return false; + } + return true; + case 'nth': + var first = match[2], last = match[3]; + + if ( first == 1 && last == 0 ) { + return true; + } + + var doneName = match[0], + parent = elem.parentNode; + + if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { + var count = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + parent.sizcache = doneName; + } + + var diff = elem.nodeIndex - last; + if ( first == 0 ) { + return diff == 0; + } else { + return ( diff % first == 0 && diff / first >= 0 ); + } + } + }, + ID: function(elem, match){ + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + TAG: function(elem, match){ + return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; + }, + CLASS: function(elem, match){ + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + ATTR: function(elem, match){ + var name = match[1], + result = Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value != check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + POS: function(elem, match, i, array){ + var name = match[2], filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); +} + +var makeArray = function(array, results) { + array = Array.prototype.slice.call( array ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +try { + Array.prototype.slice.call( document.documentElement.childNodes ); + +// Provide a fallback method if it does not work +} catch(e){ + makeArray = function(array, results) { + var ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + } else { + if ( typeof array.length === "number" ) { + for ( var i = 0, l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + } else { + for ( var i = 0; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} else if ( "sourceIndex" in document.documentElement ) { + sortOrder = function( a, b ) { + var ret = a.sourceIndex - b.sourceIndex; + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} else if ( document.createRange ) { + sortOrder = function( a, b ) { + var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); + aRange.setStart(a, 0); + aRange.setEnd(a, 0); + bRange.setStart(b, 0); + bRange.setEnd(b, 0); + var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date).getTime(); + form.innerHTML = "<a name='" + id + "'/>"; + + // Inject it into the root element, check its status, and remove it quickly + var root = document.documentElement; + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( !!document.getElementById( id ) ) { + Expr.find.ID = function(match, context, isXML){ + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; + } + }; + + Expr.filter.ID = function(elem, match){ + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function(match, context){ + var results = context.getElementsByTagName(match[1]); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = "<a href='#'></a>"; + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + Expr.attrHandle.href = function(elem){ + return elem.getAttribute("href", 2); + }; + } +})(); + +if ( document.querySelectorAll ) (function(){ + var oldSizzle = Sizzle, div = document.createElement("div"); + div.innerHTML = "<p class='TEST'></p>"; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function(query, context, extra, seed){ + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && context.nodeType === 9 && !isXML(context) ) { + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(e){} + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } +})(); + +if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ + var div = document.createElement("div"); + div.innerHTML = "<div class='test e'></div><div class='test'></div>"; + + // Opera can't find a second classname (in 9.6) + if ( div.getElementsByClassName("e").length === 0 ) + return; + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) + return; + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function(match, context, isXML) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + var sibDir = dir == "previousSibling" && !isXML; + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + if ( sibDir && elem.nodeType === 1 ){ + elem.sizcache = doneName; + elem.sizset = i; + } + elem = elem[dir]; + var match = false; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem.sizcache = doneName; + elem.sizset = i; + } + + if ( elem.nodeName === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + var sibDir = dir == "previousSibling" && !isXML; + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + if ( sibDir && elem.nodeType === 1 ) { + elem.sizcache = doneName; + elem.sizset = i; + } + elem = elem[dir]; + var match = false; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem.sizcache = doneName; + elem.sizset = i; + } + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +var contains = document.compareDocumentPosition ? function(a, b){ + return a.compareDocumentPosition(b) & 16; +} : function(a, b){ + return a !== b && (a.contains ? a.contains(b) : true); +}; + +var isXML = function(elem){ + return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || + !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; +}; + +var posProcess = function(selector, context){ + var tmpSet = [], later = "", match, + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE + +window.tinymce.dom.Sizzle = Sizzle; + +})(); + +(function(tinymce) { + // Shorten names + var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event; + + tinymce.create('static tinymce.dom.Event', { + inits : [], + events : [], + + + add : function(o, n, f, s) { + var cb, t = this, el = t.events, r; + + // Handle array + if (o && o.hasOwnProperty && o instanceof Array) { + r = []; + + each(o, function(o) { + o = DOM.get(o); + r.push(t.add(o, n, f, s)); + }); + + return r; + } + + o = DOM.get(o); + + if (!o) + return; + + // Setup event callback + cb = function(e) { + e = e || window.event; + + // Patch in target in IE it's W3C valid + if (e && !e.target && isIE) + e.target = e.srcElement; + + if (!s) + return f(e); + + return f.call(s, e); + }; + + if (n == 'unload') { + tinymce.unloads.unshift({func : cb}); + return cb; + } + + if (n == 'init') { + if (t.domLoaded) + cb(); + else + t.inits.push(cb); + + return cb; + } + + // Store away listener reference + el.push({ + obj : o, + name : n, + func : f, + cfunc : cb, + scope : s + }); + + t._add(o, n, cb); + + return f; + }, + + remove : function(o, n, f) { + var t = this, a = t.events, s = false, r; + + // Handle array + if (o && o.hasOwnProperty && o instanceof Array) { + r = []; + + each(o, function(o) { + o = DOM.get(o); + r.push(t.remove(o, n, f)); + }); + + return r; + } + + o = DOM.get(o); + + each(a, function(e, i) { + if (e.obj == o && e.name == n && (!f || (e.func == f || e.cfunc == f))) { + a.splice(i, 1); + t._remove(o, n, e.cfunc); + s = true; + return false; + } + }); + + return s; + }, + + clear : function(o) { + var t = this, a = t.events, i, e; + + if (o) { + o = DOM.get(o); + + for (i = a.length - 1; i >= 0; i--) { + e = a[i]; + + if (e.obj === o) { + t._remove(e.obj, e.name, e.cfunc); + e.obj = e.cfunc = null; + a.splice(i, 1); + } + } + } + }, + + + cancel : function(e) { + if (!e) + return false; + + this.stop(e); + return this.prevent(e); + }, + + stop : function(e) { + if (e.stopPropagation) + e.stopPropagation(); + else + e.cancelBubble = true; + + return false; + }, + + prevent : function(e) { + if (e.preventDefault) + e.preventDefault(); + else + e.returnValue = false; + + return false; + }, + + _unload : function() { + var t = Event; + + each(t.events, function(e, i) { + t._remove(e.obj, e.name, e.cfunc); + e.obj = e.cfunc = null; + }); + + t.events = []; + t = null; + }, + + _add : function(o, n, f) { + if (o.attachEvent) + o.attachEvent('on' + n, f); + else if (o.addEventListener) + o.addEventListener(n, f, false); + else + o['on' + n] = f; + }, + + _remove : function(o, n, f) { + if (o) { + try { + if (o.detachEvent) + o.detachEvent('on' + n, f); + else if (o.removeEventListener) + o.removeEventListener(n, f, false); + else + o['on' + n] = null; + } catch (ex) { + // Might fail with permission denined on IE so we just ignore that + } + } + }, + + _pageInit : function() { + var e = Event; + + // Keep it from running more than once + if (e.domLoaded) + return; + + e._remove(window, 'DOMContentLoaded', e._pageInit); + e.domLoaded = true; + + each(e.inits, function(c) { + c(); + }); + + e.inits = []; + }, + + _wait : function() { + // No need since the document is already loaded + if (window.tinyMCE_GZ && tinyMCE_GZ.loaded) { + Event.domLoaded = 1; + return; + } + + // Use IE method + if (document.attachEvent) { + document.attachEvent("onreadystatechange", function() { + if (document.readyState === "complete") { + document.detachEvent("onreadystatechange", arguments.callee); + Event._pageInit(); + } + }); + + if (document.documentElement.doScroll && window == window.top) { + (function() { + if (Event.domLoaded) + return; + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch (ex) { + setTimeout(arguments.callee, 0); + return; + } + + Event._pageInit(); + })(); + } + } else if (document.addEventListener) + Event._add(window, 'DOMContentLoaded', Event._pageInit, Event); + + Event._add(window, 'load', Event._pageInit, Event); + } + + }); + + // Shorten name + Event = tinymce.dom.Event; + + // Dispatch DOM content loaded event for IE and Safari + Event._wait(); + tinymce.addUnload(Event._unload); +})(tinymce); +(function(tinymce) { + var each = tinymce.each; + + tinymce.create('tinymce.dom.Element', { + Element : function(id, s) { + var t = this, dom, el; + + s = s || {}; + t.id = id; + t.dom = dom = s.dom || tinymce.DOM; + t.settings = s; + + // Only IE leaks DOM references, this is a lot faster + if (!tinymce.isIE) + el = t.dom.get(t.id); + + each([ + 'getPos', + 'getRect', + 'getParent', + 'add', + 'setStyle', + 'getStyle', + 'setStyles', + 'setAttrib', + 'setAttribs', + 'getAttrib', + 'addClass', + 'removeClass', + 'hasClass', + 'getOuterHTML', + 'setOuterHTML', + 'remove', + 'show', + 'hide', + 'isHidden', + 'setHTML', + 'get' + ], function(k) { + t[k] = function() { + var a = [id], i; + + for (i = 0; i < arguments.length; i++) + a.push(arguments[i]); + + a = dom[k].apply(dom, a); + t.update(k); + + return a; + }; + }); + }, + + on : function(n, f, s) { + return tinymce.dom.Event.add(this.id, n, f, s); + }, + + getXY : function() { + return { + x : parseInt(this.getStyle('left')), + y : parseInt(this.getStyle('top')) + }; + }, + + getSize : function() { + var n = this.dom.get(this.id); + + return { + w : parseInt(this.getStyle('width') || n.clientWidth), + h : parseInt(this.getStyle('height') || n.clientHeight) + }; + }, + + moveTo : function(x, y) { + this.setStyles({left : x, top : y}); + }, + + moveBy : function(x, y) { + var p = this.getXY(); + + this.moveTo(p.x + x, p.y + y); + }, + + resizeTo : function(w, h) { + this.setStyles({width : w, height : h}); + }, + + resizeBy : function(w, h) { + var s = this.getSize(); + + this.resizeTo(s.w + w, s.h + h); + }, + + update : function(k) { + var t = this, b, dom = t.dom; + + if (tinymce.isIE6 && t.settings.blocker) { + k = k || ''; + + // Ignore getters + if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0) + return; + + // Remove blocker on remove + if (k == 'remove') { + dom.remove(t.blocker); + return; + } + + if (!t.blocker) { + t.blocker = dom.uniqueId(); + b = dom.add(t.settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'}); + dom.setStyle(b, 'opacity', 0); + } else + b = dom.get(t.blocker); + + dom.setStyle(b, 'left', t.getStyle('left', 1)); + dom.setStyle(b, 'top', t.getStyle('top', 1)); + dom.setStyle(b, 'width', t.getStyle('width', 1)); + dom.setStyle(b, 'height', t.getStyle('height', 1)); + dom.setStyle(b, 'display', t.getStyle('display', 1)); + dom.setStyle(b, 'zIndex', parseInt(t.getStyle('zIndex', 1) || 0) - 1); + } + } + + }); +})(tinymce); +(function(tinymce) { + function trimNl(s) { + return s.replace(/[\n\r]+/g, ''); + }; + + // Shorten names + var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each; + + tinymce.create('tinymce.dom.Selection', { + Selection : function(dom, win, serializer) { + var t = this; + + t.dom = dom; + t.win = win; + t.serializer = serializer; + + // Add events + each([ + 'onBeforeSetContent', + 'onBeforeGetContent', + 'onSetContent', + 'onGetContent' + ], function(e) { + t[e] = new tinymce.util.Dispatcher(t); + }); + + // No W3C Range support + if (!t.win.getSelection) + t.tridentSel = new tinymce.dom.TridentSelection(t); + + // Prevent leaks + tinymce.addUnload(t.destroy, t); + }, + + getContent : function(s) { + var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, n; + + s = s || {}; + wb = wa = ''; + s.get = true; + s.format = s.format || 'html'; + t.onBeforeGetContent.dispatch(t, s); + + if (s.format == 'text') + return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : '')); + + if (r.cloneContents) { + n = r.cloneContents(); + + if (n) + e.appendChild(n); + } else if (is(r.item) || is(r.htmlText)) + e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText; + else + e.innerHTML = r.toString(); + + // Keep whitespace before and after + if (/^\s/.test(e.innerHTML)) + wb = ' '; + + if (/\s+$/.test(e.innerHTML)) + wa = ' '; + + s.getInner = true; + + s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa; + t.onGetContent.dispatch(t, s); + + return s.content; + }, + + setContent : function(h, s) { + var t = this, r = t.getRng(), c, d = t.win.document; + + s = s || {format : 'html'}; + s.set = true; + h = s.content = t.dom.processHTML(h); + + // Dispatch before set content event + t.onBeforeSetContent.dispatch(t, s); + h = s.content; + + if (r.insertNode) { + // Make caret marker since insertNode places the caret in the beginning of text after insert + h += '<span id="__caret">_</span>'; + + // Delete and insert new node + r.deleteContents(); + r.insertNode(t.getRng().createContextualFragment(h)); + + // Move to caret marker + c = t.dom.get('__caret'); + + // Make sure we wrap it compleatly, Opera fails with a simple select call + r = d.createRange(); + r.setStartBefore(c); + r.setEndAfter(c); + t.setRng(r); + + // Delete the marker, and hopefully the caret gets placed in the right location + // Removed this since it seems to remove in FF and simply deleting it + // doesn't seem to affect the caret position in any browser + //d.execCommand('Delete', false, null); + + // Remove the caret position + t.dom.remove('__caret'); + } else { + if (r.item) { + // Delete content and get caret text selection + d.execCommand('Delete', false, null); + r = t.getRng(); + } + + r.pasteHTML(h); + } + + // Dispatch set content event + t.onSetContent.dispatch(t, s); + }, + + getStart : function() { + var t = this, r = t.getRng(), e; + + if (isIE) { + if (r.item) + return r.item(0); + + r = r.duplicate(); + r.collapse(1); + e = r.parentElement(); + + if (e && e.nodeName == 'BODY') + return e.firstChild; + + return e; + } else { + e = r.startContainer; + + if (e.nodeName == 'BODY') + return e.firstChild; + + return t.dom.getParent(e, '*'); + } + }, + + getEnd : function() { + var t = this, r = t.getRng(), e; + + if (isIE) { + if (r.item) + return r.item(0); + + r = r.duplicate(); + r.collapse(0); + e = r.parentElement(); + + if (e && e.nodeName == 'BODY') + return e.lastChild; + + return e; + } else { + e = r.endContainer; + + if (e.nodeName == 'BODY') + return e.lastChild; + + return t.dom.getParent(e, '*'); + } + }, + + getBookmark : function(si) { + var t = this, r = t.getRng(), tr, sx, sy, vp = t.dom.getViewPort(t.win), e, sp, bp, le, c = -0xFFFFFF, s, ro = t.dom.getRoot(), wb = 0, wa = 0, nv; + sx = vp.x; + sy = vp.y; + + // Simple bookmark fast but not as persistent + if (si == 'simple') + return {rng : r, scrollX : sx, scrollY : sy}; + + // Handle IE + if (isIE) { + // Control selection + if (r.item) { + e = r.item(0); + + each(t.dom.select(e.nodeName), function(n, i) { + if (e == n) { + sp = i; + return false; + } + }); + + return { + tag : e.nodeName, + index : sp, + scrollX : sx, + scrollY : sy + }; + } + + // Text selection + tr = t.dom.doc.body.createTextRange(); + tr.moveToElementText(ro); + tr.collapse(true); + bp = Math.abs(tr.move('character', c)); + + tr = r.duplicate(); + tr.collapse(true); + sp = Math.abs(tr.move('character', c)); + + tr = r.duplicate(); + tr.collapse(false); + le = Math.abs(tr.move('character', c)) - sp; + + return { + start : sp - bp, + length : le, + scrollX : sx, + scrollY : sy + }; + } + + // Handle W3C + e = t.getNode(); + s = t.getSel(); + + if (!s) + return null; + + // Image selection + if (e && e.nodeName == 'IMG') { + return { + scrollX : sx, + scrollY : sy + }; + } + + // Text selection + + function getPos(r, sn, en) { + var w = t.dom.doc.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}; + + while ((n = w.nextNode()) != null) { + if (n == sn) + d.start = p; + + if (n == en) { + d.end = p; + return d; + } + + p += trimNl(n.nodeValue || '').length; + } + + return null; + }; + + // Caret or selection + if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) { + e = getPos(ro, s.anchorNode, s.focusNode); + + if (!e) + return {scrollX : sx, scrollY : sy}; + + // Count whitespace before + trimNl(s.anchorNode.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;}); + + return { + start : Math.max(e.start + s.anchorOffset - wb, 0), + end : Math.max(e.end + s.focusOffset - wb, 0), + scrollX : sx, + scrollY : sy, + beg : s.anchorOffset - wb == 0 + }; + } else { + e = getPos(ro, r.startContainer, r.endContainer); + + // Count whitespace before start and end container + //(r.startContainer.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;}); + //(r.endContainer.nodeValue || '').replace(/^\s+/, function(a) {wa = a.length;}); + + if (!e) + return {scrollX : sx, scrollY : sy}; + + return { + start : Math.max(e.start + r.startOffset - wb, 0), + end : Math.max(e.end + r.endOffset - wa, 0), + scrollX : sx, + scrollY : sy, + beg : r.startOffset - wb == 0 + }; + } + }, + + moveToBookmark : function(b) { + var t = this, r = t.getRng(), s = t.getSel(), ro = t.dom.getRoot(), sd, nvl, nv; + + function getPos(r, sp, ep) { + var w = t.dom.doc.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}, o, v, wa, wb; + + while ((n = w.nextNode()) != null) { + wa = wb = 0; + + nv = n.nodeValue || ''; + //nv.replace(/^\s+[^\s]/, function(a) {wb = a.length - 1;}); + //nv.replace(/[^\s]\s+$/, function(a) {wa = a.length - 1;}); + + nvl = trimNl(nv).length; + p += nvl; + + if (p >= sp && !d.startNode) { + o = sp - (p - nvl); + + // Fix for odd quirk in FF + if (b.beg && o >= nvl) + continue; + + d.startNode = n; + d.startOffset = o + wb; + } + + if (p >= ep) { + d.endNode = n; + d.endOffset = ep - (p - nvl) + wb; + return d; + } + } + + return null; + }; + + if (!b) + return false; + + t.win.scrollTo(b.scrollX, b.scrollY); + + // Handle explorer + if (isIE) { + // Handle simple + if (r = b.rng) { + try { + r.select(); + } catch (ex) { + // Ignore + } + + return true; + } + + t.win.focus(); + + // Handle control bookmark + if (b.tag) { + r = ro.createControlRange(); + + each(t.dom.select(b.tag), function(n, i) { + if (i == b.index) + r.addElement(n); + }); + } else { + // Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs + try { + // Incorrect bookmark + if (b.start < 0) + return true; + + r = s.createRange(); + r.moveToElementText(ro); + r.collapse(true); + r.moveStart('character', b.start); + r.moveEnd('character', b.length); + } catch (ex2) { + return true; + } + } + + try { + r.select(); + } catch (ex) { + // Needed for some odd IE bug #1843306 + } + + return true; + } + + // Handle W3C + if (!s) + return false; + + // Handle simple + if (b.rng) { + s.removeAllRanges(); + s.addRange(b.rng); + } else { + if (is(b.start) && is(b.end)) { + try { + sd = getPos(ro, b.start, b.end); + + if (sd) { + r = t.dom.doc.createRange(); + r.setStart(sd.startNode, sd.startOffset); + r.setEnd(sd.endNode, sd.endOffset); + s.removeAllRanges(); + s.addRange(r); + } + + if (!tinymce.isOpera) + t.win.focus(); + } catch (ex) { + // Ignore + } + } + } + }, + + select : function(n, c) { + var t = this, r = t.getRng(), s = t.getSel(), b, fn, ln, d = t.win.document; + + function find(n, start) { + var walker, o; + + if (n) { + walker = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); + + // Find first/last non empty text node + while (n = walker.nextNode()) { + o = n; + + if (tinymce.trim(n.nodeValue).length != 0) { + if (start) + return n; + else + o = n; + } + } + } + + return o; + }; + + if (isIE) { + try { + b = d.body; + + if (/^(IMG|TABLE)$/.test(n.nodeName)) { + r = b.createControlRange(); + r.addElement(n); + } else { + r = b.createTextRange(); + r.moveToElementText(n); + } + + r.select(); + } catch (ex) { + // Throws illigal agrument in IE some times + } + } else { + if (c) { + fn = find(n, 1) || t.dom.select('br:first', n)[0]; + ln = find(n, 0) || t.dom.select('br:last', n)[0]; + + if (fn && ln) { + r = d.createRange(); + + if (fn.nodeName == 'BR') + r.setStartBefore(fn); + else + r.setStart(fn, 0); + + if (ln.nodeName == 'BR') + r.setEndBefore(ln); + else + r.setEnd(ln, ln.nodeValue.length); + } else + r.selectNode(n); + } else + r.selectNode(n); + + t.setRng(r); + } + + return n; + }, + + isCollapsed : function() { + var t = this, r = t.getRng(), s = t.getSel(); + + if (!r || r.item) + return false; + + return !s || r.boundingWidth == 0 || r.collapsed; + }, + + collapse : function(b) { + var t = this, r = t.getRng(), n; + + // Control range on IE + if (r.item) { + n = r.item(0); + r = this.win.document.body.createTextRange(); + r.moveToElementText(n); + } + + r.collapse(!!b); + t.setRng(r); + }, + + getSel : function() { + var t = this, w = this.win; + + return w.getSelection ? w.getSelection() : w.document.selection; + }, + + getRng : function(w3c) { + var t = this, s, r; + + // Found tridentSel object then we need to use that one + if (w3c && t.tridentSel) + return t.tridentSel.getRangeAt(0); + + try { + if (s = t.getSel()) + r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : t.win.document.createRange()); + } catch (ex) { + // IE throws unspecified error here if TinyMCE is placed in a frame/iframe + } + + // No range found then create an empty one + // This can occur when the editor is placed in a hidden container element on Gecko + // Or on IE when there was an exception + if (!r) + r = isIE ? t.win.document.body.createTextRange() : t.win.document.createRange(); + + return r; + }, + + setRng : function(r) { + var s, t = this; + + if (!t.tridentSel) { + s = t.getSel(); + + if (s) { + s.removeAllRanges(); + s.addRange(r); + } + } else { + // Is W3C Range + if (r.cloneRange) { + t.tridentSel.addRange(r); + return; + } + + // Is IE specific range + try { + r.select(); + } catch (ex) { + // Needed for some odd IE bug #1843306 + } + } + }, + + setNode : function(n) { + var t = this; + + t.setContent(t.dom.getOuterHTML(n)); + + return n; + }, + + getNode : function() { + var t = this, r = t.getRng(), s = t.getSel(), e; + + if (!isIE) { + // Range maybe lost after the editor is made visible again + if (!r) + return t.dom.getRoot(); + + e = r.commonAncestorContainer; + + // Handle selection a image or other control like element such as anchors + if (!r.collapsed) { + // If the anchor node is a element instead of a text node then return this element + if (tinymce.isWebKit && s.anchorNode && s.anchorNode.nodeType == 1) + return s.anchorNode.childNodes[s.anchorOffset]; + + if (r.startContainer == r.endContainer) { + if (r.startOffset - r.endOffset < 2) { + if (r.startContainer.hasChildNodes()) + e = r.startContainer.childNodes[r.startOffset]; + } + } + } + + return t.dom.getParent(e, '*'); + } + + return r.item ? r.item(0) : r.parentElement(); + }, + + getSelectedBlocks : function(st, en) { + var t = this, dom = t.dom, sb, eb, n, bl = []; + + sb = dom.getParent(st || t.getStart(), dom.isBlock); + eb = dom.getParent(en || t.getEnd(), dom.isBlock); + + if (sb) + bl.push(sb); + + if (sb && eb && sb != eb) { + n = sb; + + while ((n = n.nextSibling) && n != eb) { + if (dom.isBlock(n)) + bl.push(n); + } + } + + if (eb && sb != eb) + bl.push(eb); + + return bl; + }, + + destroy : function(s) { + var t = this; + + t.win = null; + + if (t.tridentSel) + t.tridentSel.destroy(); + + // Manual destroy then remove unload handler + if (!s) + tinymce.removeUnload(t.destroy); + } + + }); +})(tinymce); +(function(tinymce) { + tinymce.create('tinymce.dom.XMLWriter', { + node : null, + + XMLWriter : function(s) { + // Get XML document + function getXML() { + var i = document.implementation; + + if (!i || !i.createDocument) { + // Try IE objects + try {return new ActiveXObject('MSXML2.DOMDocument');} catch (ex) {} + try {return new ActiveXObject('Microsoft.XmlDom');} catch (ex) {} + } else + return i.createDocument('', '', null); + }; + + this.doc = getXML(); + + // Since Opera and WebKit doesn't escape > into > we need to do it our self to normalize the output for all browsers + this.valid = tinymce.isOpera || tinymce.isWebKit; + + this.reset(); + }, + + reset : function() { + var t = this, d = t.doc; + + if (d.firstChild) + d.removeChild(d.firstChild); + + t.node = d.appendChild(d.createElement("html")); + }, + + writeStartElement : function(n) { + var t = this; + + t.node = t.node.appendChild(t.doc.createElement(n)); + }, + + writeAttribute : function(n, v) { + if (this.valid) + v = v.replace(/>/g, '%MCGT%'); + + this.node.setAttribute(n, v); + }, + + writeEndElement : function() { + this.node = this.node.parentNode; + }, + + writeFullEndElement : function() { + var t = this, n = t.node; + + n.appendChild(t.doc.createTextNode("")); + t.node = n.parentNode; + }, + + writeText : function(v) { + if (this.valid) + v = v.replace(/>/g, '%MCGT%'); + + this.node.appendChild(this.doc.createTextNode(v)); + }, + + writeCDATA : function(v) { + this.node.appendChild(this.doc.createCDATA(v)); + }, + + writeComment : function(v) { + // Fix for bug #2035694 + if (tinymce.isIE) + v = v.replace(/^\-|\-$/g, ' '); + + this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' '))); + }, + + getContent : function() { + var h; + + h = this.doc.xml || new XMLSerializer().serializeToString(this.doc); + h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, ''); + h = h.replace(/ ?\/>/g, ' />'); + + if (this.valid) + h = h.replace(/\%MCGT%/g, '>'); + + return h; + } + + }); +})(tinymce); +(function(tinymce) { + tinymce.create('tinymce.dom.StringWriter', { + str : null, + tags : null, + count : 0, + settings : null, + indent : null, + + StringWriter : function(s) { + this.settings = tinymce.extend({ + indent_char : ' ', + indentation : 1 + }, s); + + this.reset(); + }, + + reset : function() { + this.indent = ''; + this.str = ""; + this.tags = []; + this.count = 0; + }, + + writeStartElement : function(n) { + this._writeAttributesEnd(); + this.writeRaw('<' + n); + this.tags.push(n); + this.inAttr = true; + this.count++; + this.elementCount = this.count; + }, + + writeAttribute : function(n, v) { + var t = this; + + t.writeRaw(" " + t.encode(n) + '="' + t.encode(v) + '"'); + }, + + writeEndElement : function() { + var n; + + if (this.tags.length > 0) { + n = this.tags.pop(); + + if (this._writeAttributesEnd(1)) + this.writeRaw('</' + n + '>'); + + if (this.settings.indentation > 0) + this.writeRaw('\n'); + } + }, + + writeFullEndElement : function() { + if (this.tags.length > 0) { + this._writeAttributesEnd(); + this.writeRaw('</' + this.tags.pop() + '>'); + + if (this.settings.indentation > 0) + this.writeRaw('\n'); + } + }, + + writeText : function(v) { + this._writeAttributesEnd(); + this.writeRaw(this.encode(v)); + this.count++; + }, + + writeCDATA : function(v) { + this._writeAttributesEnd(); + this.writeRaw('<![CDATA[' + v + ']]>'); + this.count++; + }, + + writeComment : function(v) { + this._writeAttributesEnd(); + this.writeRaw('<!-- ' + v + '-->'); + this.count++; + }, + + writeRaw : function(v) { + this.str += v; + }, + + encode : function(s) { + return s.replace(/[<>&"]/g, function(v) { + switch (v) { + case '<': + return '<'; + + case '>': + return '>'; + + case '&': + return '&'; + + case '"': + return '"'; + } + + return v; + }); + }, + + getContent : function() { + return this.str; + }, + + _writeAttributesEnd : function(s) { + if (!this.inAttr) + return; + + this.inAttr = false; + + if (s && this.elementCount == this.count) { + this.writeRaw(' />'); + return false; + } + + this.writeRaw('>'); + + return true; + } + + }); +})(tinymce); +(function(tinymce) { + // Shorten names + var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE, isGecko = tinymce.isGecko; + + function wildcardToRE(s) { + return s.replace(/([?+*])/g, '.$1'); + }; + + tinymce.create('tinymce.dom.Serializer', { + Serializer : function(s) { + var t = this; + + t.key = 0; + t.onPreProcess = new Dispatcher(t); + t.onPostProcess = new Dispatcher(t); + + try { + t.writer = new tinymce.dom.XMLWriter(); + } catch (ex) { + // IE might throw exception if ActiveX is disabled so we then switch to the slightly slower StringWriter + t.writer = new tinymce.dom.StringWriter(); + } + + // Default settings + t.settings = s = extend({ + dom : tinymce.DOM, + valid_nodes : 0, + node_filter : 0, + attr_filter : 0, + invalid_attrs : /^(mce_|_moz_)/, + closed : /^(br|hr|input|meta|img|link|param|area)$/, + entity_encoding : 'named', + entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro', + bool_attrs : /(checked|disabled|readonly|selected|nowrap)/, + valid_elements : '*[*]', + extended_valid_elements : 0, + valid_child_elements : 0, + invalid_elements : 0, + fix_table_elements : 1, + fix_list_elements : true, + fix_content_duplication : true, + convert_fonts_to_spans : false, + font_size_classes : 0, + font_size_style_values : 0, + apply_source_formatting : 0, + indent_mode : 'simple', + indent_char : '\t', + indent_levels : 1, + remove_linebreaks : 1, + remove_redundant_brs : 1, + element_format : 'xhtml' + }, s); + + t.dom = s.dom; + + if (s.remove_redundant_brs) { + t.onPostProcess.add(function(se, o) { + // Remove single BR at end of block elements since they get rendered + o.content = o.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi, function(a, b, c) { + // Check if it's a single element + if (/^<br \/>\s*<\//.test(a)) + return '</' + c + '>'; + + return a; + }); + }); + } + + // Remove XHTML element endings i.e. produce crap :) XHTML is better + if (s.element_format == 'html') { + t.onPostProcess.add(function(se, o) { + o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>'); + }); + } + + if (s.fix_list_elements) { + t.onPreProcess.add(function(se, o) { + var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np; + + function prevNode(e, n) { + var a = n.split(','), i; + + while ((e = e.previousSibling) != null) { + for (i=0; i<a.length; i++) { + if (e.nodeName == a[i]) + return e; + } + } + + return null; + }; + + for (x=0; x<a.length; x++) { + nl = t.dom.select(a[x], o.node); + + for (i=0; i<nl.length; i++) { + n = nl[i]; + p = n.parentNode; + + if (r.test(p.nodeName)) { + np = prevNode(n, 'LI'); + + if (!np) { + np = t.dom.create('li'); + np.innerHTML = ' '; + np.appendChild(n); + p.insertBefore(np, p.firstChild); + } else + np.appendChild(n); + } + } + } + }); + } + + if (s.fix_table_elements) { + t.onPreProcess.add(function(se, o) { + each(t.dom.select('p table', o.node), function(n) { + t.dom.split(t.dom.getParent(n, 'p'), n); + }); + }); + } + }, + + setEntities : function(s) { + var t = this, a, i, l = {}, re = '', v; + + // No need to setup more than once + if (t.entityLookup) + return; + + // Build regex and lookup array + a = s.split(','); + for (i = 0; i < a.length; i += 2) { + v = a[i]; + + // Don't add default & " etc. + if (v == 34 || v == 38 || v == 60 || v == 62) + continue; + + l[String.fromCharCode(a[i])] = a[i + 1]; + + v = parseInt(a[i]).toString(16); + re += '\\u' + '0000'.substring(v.length) + v; + } + + if (!re) { + t.settings.entity_encoding = 'raw'; + return; + } + + t.entitiesRE = new RegExp('[' + re + ']', 'g'); + t.entityLookup = l; + }, + + setValidChildRules : function(s) { + this.childRules = null; + this.addValidChildRules(s); + }, + + addValidChildRules : function(s) { + var t = this, inst, intr, bloc; + + if (!s) + return; + + inst = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment'; + intr = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment'; + bloc = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP'; + + each(s.split(','), function(s) { + var p = s.split(/\[|\]/), re; + + s = ''; + each(p[1].split('|'), function(v) { + if (s) + s += '|'; + + switch (v) { + case '%itrans': + v = intr; + break; + + case '%itrans_na': + v = intr.substring(2); + break; + + case '%istrict': + v = inst; + break; + + case '%istrict_na': + v = inst.substring(2); + break; + + case '%btrans': + v = bloc; + break; + + case '%bstrict': + v = bloc; + break; + } + + s += v; + }); + re = new RegExp('^(' + s.toLowerCase() + ')$', 'i'); + + each(p[0].split('/'), function(s) { + t.childRules = t.childRules || {}; + t.childRules[s] = re; + }); + }); + + // Build regex + s = ''; + each(t.childRules, function(v, k) { + if (s) + s += '|'; + + s += k; + }); + + t.parentElementsRE = new RegExp('^(' + s.toLowerCase() + ')$', 'i'); + + /*console.debug(t.parentElementsRE.toString()); + each(t.childRules, function(v) { + console.debug(v.toString()); + });*/ + }, + + setRules : function(s) { + var t = this; + + t._setup(); + t.rules = {}; + t.wildRules = []; + t.validElements = {}; + + return t.addRules(s); + }, + + addRules : function(s) { + var t = this, dr; + + if (!s) + return; + + t._setup(); + + each(s.split(','), function(s) { + var p = s.split(/\[|\]/), tn = p[0].split('/'), ra, at, wat, va = []; + + // Extend with default rules + if (dr) + at = tinymce.extend([], dr.attribs); + + // Parse attributes + if (p.length > 1) { + each(p[1].split('|'), function(s) { + var ar = {}, i; + + at = at || []; + + // Parse attribute rule + s = s.replace(/::/g, '~'); + s = /^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(s); + s[2] = s[2].replace(/~/g, ':'); + + // Add required attributes + if (s[1] == '!') { + ra = ra || []; + ra.push(s[2]); + } + + // Remove inherited attributes + if (s[1] == '-') { + for (i = 0; i <at.length; i++) { + if (at[i].name == s[2]) { + at.splice(i, 1); + return; + } + } + } + + switch (s[3]) { + // Add default attrib values + case '=': + ar.defaultVal = s[4] || ''; + break; + + // Add forced attrib values + case ':': + ar.forcedVal = s[4]; + break; + + // Add validation values + case '<': + ar.validVals = s[4].split('?'); + break; + } + + if (/[*.?]/.test(s[2])) { + wat = wat || []; + ar.nameRE = new RegExp('^' + wildcardToRE(s[2]) + '$'); + wat.push(ar); + } else { + ar.name = s[2]; + at.push(ar); + } + + va.push(s[2]); + }); + } + + // Handle element names + each(tn, function(s, i) { + var pr = s.charAt(0), x = 1, ru = {}; + + // Extend with default rule data + if (dr) { + if (dr.noEmpty) + ru.noEmpty = dr.noEmpty; + + if (dr.fullEnd) + ru.fullEnd = dr.fullEnd; + + if (dr.padd) + ru.padd = dr.padd; + } + + // Handle prefixes + switch (pr) { + case '-': + ru.noEmpty = true; + break; + + case '+': + ru.fullEnd = true; + break; + + case '#': + ru.padd = true; + break; + + default: + x = 0; + } + + tn[i] = s = s.substring(x); + t.validElements[s] = 1; + + // Add element name or element regex + if (/[*.?]/.test(tn[0])) { + ru.nameRE = new RegExp('^' + wildcardToRE(tn[0]) + '$'); + t.wildRules = t.wildRules || {}; + t.wildRules.push(ru); + } else { + ru.name = tn[0]; + + // Store away default rule + if (tn[0] == '@') + dr = ru; + + t.rules[s] = ru; + } + + ru.attribs = at; + + if (ra) + ru.requiredAttribs = ra; + + if (wat) { + // Build valid attributes regexp + s = ''; + each(va, function(v) { + if (s) + s += '|'; + + s += '(' + wildcardToRE(v) + ')'; + }); + ru.validAttribsRE = new RegExp('^' + s.toLowerCase() + '$'); + ru.wildAttribs = wat; + } + }); + }); + + // Build valid elements regexp + s = ''; + each(t.validElements, function(v, k) { + if (s) + s += '|'; + + if (k != '@') + s += k; + }); + t.validElementsRE = new RegExp('^(' + wildcardToRE(s.toLowerCase()) + ')$'); + + //console.debug(t.validElementsRE.toString()); + //console.dir(t.rules); + //console.dir(t.wildRules); + }, + + findRule : function(n) { + var t = this, rl = t.rules, i, r; + + t._setup(); + + // Exact match + r = rl[n]; + if (r) + return r; + + // Try wildcards + rl = t.wildRules; + for (i = 0; i < rl.length; i++) { + if (rl[i].nameRE.test(n)) + return rl[i]; + } + + return null; + }, + + findAttribRule : function(ru, n) { + var i, wa = ru.wildAttribs; + + for (i = 0; i < wa.length; i++) { + if (wa[i].nameRE.test(n)) + return wa[i]; + } + + return null; + }, + + serialize : function(n, o) { + var h, t = this; + + t._setup(); + o = o || {}; + o.format = o.format || 'html'; + t.processObj = o; + n = n.cloneNode(true); + t.key = '' + (parseInt(t.key) + 1); + + // Pre process + if (!o.no_events) { + o.node = n; + t.onPreProcess.dispatch(t, o); + } + + // Serialize HTML DOM into a string + t.writer.reset(); + t._serializeNode(n, o.getInner); + + // Post process + o.content = t.writer.getContent(); + + if (!o.no_events) + t.onPostProcess.dispatch(t, o); + + t._postProcess(o); + o.node = null; + + return tinymce.trim(o.content); + }, + + // Internal functions + + _postProcess : function(o) { + var t = this, s = t.settings, h = o.content, sc = [], p; + + if (o.format == 'html') { + // Protect some elements + p = t._protect({ + content : h, + patterns : [ + {pattern : /(<script[^>]*>)(.*?)(<\/script>)/g}, + {pattern : /(<style[^>]*>)(.*?)(<\/style>)/g}, + {pattern : /(<pre[^>]*>)(.*?)(<\/pre>)/g, encode : 1}, + {pattern : /(<!--\[CDATA\[)(.*?)(\]\]-->)/g} + ] + }); + + h = p.content; + + // Entity encode + if (s.entity_encoding !== 'raw') + h = t._encode(h); + + // Use BR instead of padded P elements inside editor and use <p> </p> outside editor +/* if (o.set) + h = h.replace(/<p>\s+( | |\u00a0|<br \/>)\s+<\/p>/g, '<p><br /></p>'); + else + h = h.replace(/<p>\s+( | |\u00a0|<br \/>)\s+<\/p>/g, '<p>$1</p>');*/ + + // Since Gecko and Safari keeps whitespace in the DOM we need to + // remove it inorder to match other browsers. But I think Gecko and Safari is right. + // This process is only done when getting contents out from the editor. + if (!o.set) { + // We need to replace paragraph whitespace with an nbsp before indentation to keep the \u00a0 char + h = h.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g, s.entity_encoding == 'numeric' ? '<p$1> </p>' : '<p$1> </p>'); + + if (s.remove_linebreaks) { + h = h.replace(/\r?\n|\r/g, ' '); + h = h.replace(/(<[^>]+>)\s+/g, '$1 '); + h = h.replace(/\s+(<\/[^>]+>)/g, ' $1'); + h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g, '<$1 $2>'); // Trim block start + h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g, '<$1>'); // Trim block start + h = h.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g, '</$1>'); // Trim block end + } + + // Simple indentation + if (s.apply_source_formatting && s.indent_mode == 'simple') { + // Add line breaks before and after block elements + h = h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g, '\n<$1$2$3>\n'); + h = h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g, '\n<$1$2>'); + h = h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g, '</$1>\n'); + h = h.replace(/\n\n/g, '\n'); + } + } + + h = t._unprotect(h, p); + + // Restore CDATA sections + h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>'); + + // Restore the \u00a0 character if raw mode is enabled + if (s.entity_encoding == 'raw') + h = h.replace(/<p> <\/p>|<p([^>]+)> <\/p>/g, '<p$1>\u00a0</p>'); + } + + o.content = h; + }, + + _serializeNode : function(n, inn) { + var t = this, s = t.settings, w = t.writer, hc, el, cn, i, l, a, at, no, v, nn, ru, ar, iv; + + if (!s.node_filter || s.node_filter(n)) { + switch (n.nodeType) { + case 1: // Element + if (n.hasAttribute ? n.hasAttribute('mce_bogus') : n.getAttribute('mce_bogus')) + return; + + iv = false; + hc = n.hasChildNodes(); + nn = n.getAttribute('mce_name') || n.nodeName.toLowerCase(); + + // Add correct prefix on IE + if (isIE) { + if (n.scopeName !== 'HTML' && n.scopeName !== 'html') + nn = n.scopeName + ':' + nn; + } + + // Remove mce prefix on IE needed for the abbr element + if (nn.indexOf('mce:') === 0) + nn = nn.substring(4); + + // Check if valid + if (!t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inn) { + iv = true; + break; + } + + if (isIE) { + // Fix IE content duplication (DOM can have multiple copies of the same node) + if (s.fix_content_duplication) { + if (n.mce_serialized == t.key) + return; + + n.mce_serialized = t.key; + } + + // IE sometimes adds a / infront of the node name + if (nn.charAt(0) == '/') + nn = nn.substring(1); + } else if (isGecko) { + // Ignore br elements + if (n.nodeName === 'BR' && n.getAttribute('type') == '_moz') + return; + } + + // Check if valid child + if (t.childRules) { + if (t.parentElementsRE.test(t.elementName)) { + if (!t.childRules[t.elementName].test(nn)) { + iv = true; + break; + } + } + + t.elementName = nn; + } + + ru = t.findRule(nn); + nn = ru.name || nn; + + // Skip empty nodes or empty node name in IE + if ((!hc && ru.noEmpty) || (isIE && !nn)) { + iv = true; + break; + } + + // Check required + if (ru.requiredAttribs) { + a = ru.requiredAttribs; + + for (i = a.length - 1; i >= 0; i--) { + if (this.dom.getAttrib(n, a[i]) !== '') + break; + } + + // None of the required was there + if (i == -1) { + iv = true; + break; + } + } + + w.writeStartElement(nn); + + // Add ordered attributes + if (ru.attribs) { + for (i=0, at = ru.attribs, l = at.length; i<l; i++) { + a = at[i]; + v = t._getAttrib(n, a); + + if (v !== null) + w.writeAttribute(a.name, v); + } + } + + // Add wild attributes + if (ru.validAttribsRE) { + at = t.dom.getAttribs(n); + for (i=at.length-1; i>-1; i--) { + no = at[i]; + + if (no.specified) { + a = no.nodeName.toLowerCase(); + + if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(a)) + continue; + + ar = t.findAttribRule(ru, a); + v = t._getAttrib(n, ar, a); + + if (v !== null) + w.writeAttribute(a, v); + } + } + } + + // Padd empty nodes with a + if (ru.padd) { + // If it has only one bogus child, padd it anyway workaround for <td><br /></td> bug + if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) { + if (cn.hasAttribute ? cn.hasAttribute('mce_bogus') : cn.getAttribute('mce_bogus')) + w.writeText('\u00a0'); + } else if (!hc) + w.writeText('\u00a0'); // No children then padd it + } + + break; + + case 3: // Text + // Check if valid child + if (t.childRules && t.parentElementsRE.test(t.elementName)) { + if (!t.childRules[t.elementName].test(n.nodeName)) + return; + } + + return w.writeText(n.nodeValue); + + case 4: // CDATA + return w.writeCDATA(n.nodeValue); + + case 8: // Comment + return w.writeComment(n.nodeValue); + } + } else if (n.nodeType == 1) + hc = n.hasChildNodes(); + + if (hc) { + cn = n.firstChild; + + while (cn) { + t._serializeNode(cn); + t.elementName = nn; + cn = cn.nextSibling; + } + } + + // Write element end + if (!iv) { + if (hc || !s.closed.test(nn)) + w.writeFullEndElement(); + else + w.writeEndElement(); + } + }, + + _protect : function(o) { + var t = this; + + o.items = o.items || []; + + function enc(s) { + return s.replace(/[\r\n\\]/g, function(c) { + if (c === '\n') + return '\\n'; + else if (c === '\\') + return '\\\\'; + + return '\\r'; + }); + }; + + function dec(s) { + return s.replace(/\\[\\rn]/g, function(c) { + if (c === '\\n') + return '\n'; + else if (c === '\\\\') + return '\\'; + + return '\r'; + }); + }; + + each(o.patterns, function(p) { + o.content = dec(enc(o.content).replace(p.pattern, function(x, a, b, c) { + b = dec(b); + + if (p.encode) + b = t._encode(b); + + o.items.push(b); + return a + '<!--mce:' + (o.items.length - 1) + '-->' + c; + })); + }); + + return o; + }, + + _unprotect : function(h, o) { + h = h.replace(/\<!--mce:([0-9]+)--\>/g, function(a, b) { + return o.items[parseInt(b)]; + }); + + o.items = []; + + return h; + }, + + _encode : function(h) { + var t = this, s = t.settings, l; + + // Entity encode + if (s.entity_encoding !== 'raw') { + if (s.entity_encoding.indexOf('named') != -1) { + t.setEntities(s.entities); + l = t.entityLookup; + + h = h.replace(t.entitiesRE, function(a) { + var v; + + if (v = l[a]) + a = '&' + v + ';'; + + return a; + }); + } + + if (s.entity_encoding.indexOf('numeric') != -1) { + h = h.replace(/[\u007E-\uFFFF]/g, function(a) { + return '&#' + a.charCodeAt(0) + ';'; + }); + } + } + + return h; + }, + + _setup : function() { + var t = this, s = this.settings; + + if (t.done) + return; + + t.done = 1; + + t.setRules(s.valid_elements); + t.addRules(s.extended_valid_elements); + t.addValidChildRules(s.valid_child_elements); + + if (s.invalid_elements) + t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(/,/g, '|').toLowerCase()) + ')$'); + + if (s.attrib_value_filter) + t.attribValueFilter = s.attribValueFilter; + }, + + _getAttrib : function(n, a, na) { + var i, v; + + na = na || a.name; + + if (a.forcedVal && (v = a.forcedVal)) { + if (v === '{$uid}') + return this.dom.uniqueId(); + + return v; + } + + v = this.dom.getAttrib(n, na); + + // Bool attr + if (this.settings.bool_attrs.test(na) && v) { + v = ('' + v).toLowerCase(); + + if (v === 'false' || v === '0') + return null; + + v = na; + } + + switch (na) { + case 'rowspan': + case 'colspan': + // Whats the point? Remove usless attribute value + if (v == '1') + v = ''; + + break; + } + + if (this.attribValueFilter) + v = this.attribValueFilter(na, v, n); + + if (a.validVals) { + for (i = a.validVals.length - 1; i >= 0; i--) { + if (v == a.validVals[i]) + break; + } + + if (i == -1) + return null; + } + + if (v === '' && typeof(a.defaultVal) != 'undefined') { + v = a.defaultVal; + + if (v === '{$uid}') + return this.dom.uniqueId(); + + return v; + } else { + // Remove internal mceItemXX classes when content is extracted from editor + if (na == 'class' && this.processObj.get) + v = v.replace(/\s?mceItem\w+\s?/g, ''); + } + + if (v === '') + return null; + + + return v; + } + + }); +})(tinymce); +(function(tinymce) { + var each = tinymce.each, Event = tinymce.dom.Event; + + tinymce.create('tinymce.dom.ScriptLoader', { + ScriptLoader : function(s) { + this.settings = s || {}; + this.queue = []; + this.lookup = {}; + }, + + isDone : function(u) { + return this.lookup[u] ? this.lookup[u].state == 2 : 0; + }, + + markDone : function(u) { + this.lookup[u] = {state : 2, url : u}; + }, + + add : function(u, cb, s, pr) { + var t = this, lo = t.lookup, o; + + if (o = lo[u]) { + // Is loaded fire callback + if (cb && o.state == 2) + cb.call(s || this); + + return o; + } + + o = {state : 0, url : u, func : cb, scope : s || this}; + + if (pr) + t.queue.unshift(o); + else + t.queue.push(o); + + lo[u] = o; + + return o; + }, + + load : function(u, cb, s) { + var t = this, o; + + if (o = t.lookup[u]) { + // Is loaded fire callback + if (cb && o.state == 2) + cb.call(s || t); + + return o; + } + + function loadScript(u) { + if (Event.domLoaded || t.settings.strict_mode) { + tinymce.util.XHR.send({ + url : tinymce._addVer(u), + error : t.settings.error, + async : false, + success : function(co) { + t.eval(co); + } + }); + } else + document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>'); + }; + + if (!tinymce.is(u, 'string')) { + each(u, function(u) { + loadScript(u); + }); + + if (cb) + cb.call(s || t); + } else { + loadScript(u); + + if (cb) + cb.call(s || t); + } + }, + + loadQueue : function(cb, s) { + var t = this; + + if (!t.queueLoading) { + t.queueLoading = 1; + t.queueCallbacks = []; + + t.loadScripts(t.queue, function() { + t.queueLoading = 0; + + if (cb) + cb.call(s || t); + + each(t.queueCallbacks, function(o) { + o.func.call(o.scope); + }); + }); + } else if (cb) + t.queueCallbacks.push({func : cb, scope : s || t}); + }, + + eval : function(co) { + var w = window; + + // Evaluate script + if (!w.execScript) { + try { + eval.call(w, co); + } catch (ex) { + eval(co, w); // Firefox 3.0a8 + } + } else + w.execScript(co); // IE + }, + + loadScripts : function(sc, cb, s) { + var t = this, lo = t.lookup; + + function done(o) { + o.state = 2; // Has been loaded + + // Run callback + if (o.func) + o.func.call(o.scope || t); + }; + + function allDone() { + var l; + + // Check if all files are loaded + l = sc.length; + each(sc, function(o) { + o = lo[o.url]; + + if (o.state === 2) {// It has finished loading + done(o); + l--; + } else + load(o); + }); + + // They are all loaded + if (l === 0 && cb) { + cb.call(s || t); + cb = 0; + } + }; + + function load(o) { + if (o.state > 0) + return; + + o.state = 1; // Is loading + + tinymce.dom.ScriptLoader.loadScript(o.url, function() { + done(o); + allDone(); + }); + + /* + tinymce.util.XHR.send({ + url : o.url, + error : t.settings.error, + success : function(co) { + t.eval(co); + done(o); + allDone(); + } + }); + */ + }; + + each(sc, function(o) { + var u = o.url; + + // Add to queue if needed + if (!lo[u]) { + lo[u] = o; + t.queue.push(o); + } else + o = lo[u]; + + // Is already loading or has been loaded + if (o.state > 0) + return; + + if (!Event.domLoaded && !t.settings.strict_mode) { + var ix, ol = ''; + + // Add onload events + if (cb || o.func) { + o.state = 1; // Is loading + + ix = tinymce.dom.ScriptLoader._addOnLoad(function() { + done(o); + allDone(); + }); + + if (tinymce.isIE) + ol = ' onreadystatechange="'; + else + ol = ' onload="'; + + ol += 'tinymce.dom.ScriptLoader._onLoad(this,\'' + u + '\',' + ix + ');"'; + } + + document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"' + ol + '></script>'); + + if (!o.func) + done(o); + } else + load(o); + }); + + allDone(); + }, + + // Static methods + 'static' : { + _addOnLoad : function(f) { + var t = this; + + t._funcs = t._funcs || []; + t._funcs.push(f); + + return t._funcs.length - 1; + }, + + _onLoad : function(e, u, ix) { + if (!tinymce.isIE || e.readyState == 'complete') + this._funcs[ix].call(this); + }, + + loadScript : function(u, cb) { + var id = tinymce.DOM.uniqueId(), e; + + function done() { + Event.clear(id); + tinymce.DOM.remove(id); + + if (cb) { + cb.call(document, u); + cb = 0; + } + }; + + if (tinymce.isIE) { +/* Event.add(e, 'readystatechange', function(e) { + if (e.target && e.target.readyState == 'complete') + done(); + });*/ + + tinymce.util.XHR.send({ + url : tinymce._addVer(u), + async : false, + success : function(co) { + window.execScript(co); + done(); + } + }); + } else { + e = tinymce.DOM.create('script', {id : id, type : 'text/javascript', src : tinymce._addVer(u)}); + Event.add(e, 'load', done); + + // Check for head or body + (document.getElementsByTagName('head')[0] || document.body).appendChild(e); + } + } + } + + }); + + // Global script loader + tinymce.ScriptLoader = new tinymce.dom.ScriptLoader(); +})(tinymce); +(function(tinymce) { + // Shorten class names + var DOM = tinymce.DOM, is = tinymce.is; + + tinymce.create('tinymce.ui.Control', { + Control : function(id, s) { + this.id = id; + this.settings = s = s || {}; + this.rendered = false; + this.onRender = new tinymce.util.Dispatcher(this); + this.classPrefix = ''; + this.scope = s.scope || this; + this.disabled = 0; + this.active = 0; + }, + + setDisabled : function(s) { + var e; + + if (s != this.disabled) { + e = DOM.get(this.id); + + // Add accessibility title for unavailable actions + if (e && this.settings.unavailable_prefix) { + if (s) { + this.prevTitle = e.title; + e.title = this.settings.unavailable_prefix + ": " + e.title; + } else + e.title = this.prevTitle; + } + + this.setState('Disabled', s); + this.setState('Enabled', !s); + this.disabled = s; + } + }, + + isDisabled : function() { + return this.disabled; + }, + + setActive : function(s) { + if (s != this.active) { + this.setState('Active', s); + this.active = s; + } + }, + + isActive : function() { + return this.active; + }, + + setState : function(c, s) { + var n = DOM.get(this.id); + + c = this.classPrefix + c; + + if (s) + DOM.addClass(n, c); + else + DOM.removeClass(n, c); + }, + + isRendered : function() { + return this.rendered; + }, + + renderHTML : function() { + }, + + renderTo : function(n) { + DOM.setHTML(n, this.renderHTML()); + }, + + postRender : function() { + var t = this, b; + + // Set pending states + if (is(t.disabled)) { + b = t.disabled; + t.disabled = -1; + t.setDisabled(b); + } + + if (is(t.active)) { + b = t.active; + t.active = -1; + t.setActive(b); + } + }, + + remove : function() { + DOM.remove(this.id); + this.destroy(); + }, + + destroy : function() { + tinymce.dom.Event.clear(this.id); + } + + }); +})(tinymce);tinymce.create('tinymce.ui.Container:tinymce.ui.Control', { + Container : function(id, s) { + this.parent(id, s); + this.controls = []; + this.lookup = {}; + }, + + add : function(c) { + this.lookup[c.id] = c; + this.controls.push(c); + + return c; + }, + + get : function(n) { + return this.lookup[n]; + } + + }); + +tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { + Separator : function(id, s) { + this.parent(id, s); + this.classPrefix = 'mceSeparator'; + }, + + renderHTML : function() { + return tinymce.DOM.createHTML('span', {'class' : this.classPrefix}); + } + + }); +(function(tinymce) { + var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk; + + tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control', { + MenuItem : function(id, s) { + this.parent(id, s); + this.classPrefix = 'mceMenuItem'; + }, + + setSelected : function(s) { + this.setState('Selected', s); + this.selected = s; + }, + + isSelected : function() { + return this.selected; + }, + + postRender : function() { + var t = this; + + t.parent(); + + // Set pending state + if (is(t.selected)) + t.setSelected(t.selected); + } + + }); +})(tinymce); +(function(tinymce) { + var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk; + + tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem', { + Menu : function(id, s) { + var t = this; + + t.parent(id, s); + t.items = {}; + t.collapsed = false; + t.menuCount = 0; + t.onAddItem = new tinymce.util.Dispatcher(this); + }, + + expand : function(d) { + var t = this; + + if (d) { + walk(t, function(o) { + if (o.expand) + o.expand(); + }, 'items', t); + } + + t.collapsed = false; + }, + + collapse : function(d) { + var t = this; + + if (d) { + walk(t, function(o) { + if (o.collapse) + o.collapse(); + }, 'items', t); + } + + t.collapsed = true; + }, + + isCollapsed : function() { + return this.collapsed; + }, + + add : function(o) { + if (!o.settings) + o = new tinymce.ui.MenuItem(o.id || DOM.uniqueId(), o); + + this.onAddItem.dispatch(this, o); + + return this.items[o.id] = o; + }, + + addSeparator : function() { + return this.add({separator : true}); + }, + + addMenu : function(o) { + if (!o.collapse) + o = this.createMenu(o); + + this.menuCount++; + + return this.add(o); + }, + + hasMenus : function() { + return this.menuCount !== 0; + }, + + remove : function(o) { + delete this.items[o.id]; + }, + + removeAll : function() { + var t = this; + + walk(t, function(o) { + if (o.removeAll) + o.removeAll(); + else + o.remove(); + + o.destroy(); + }, 'items', t); + + t.items = {}; + }, + + createMenu : function(o) { + var m = new tinymce.ui.Menu(o.id || DOM.uniqueId(), o); + + m.onAddItem.add(this.onAddItem.dispatch, this.onAddItem); + + return m; + } + + }); +})(tinymce);(function(tinymce) { + var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element; + + tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu', { + DropMenu : function(id, s) { + s = s || {}; + s.container = s.container || DOM.doc.body; + s.offset_x = s.offset_x || 0; + s.offset_y = s.offset_y || 0; + s.vp_offset_x = s.vp_offset_x || 0; + s.vp_offset_y = s.vp_offset_y || 0; + + if (is(s.icons) && !s.icons) + s['class'] += ' mceNoIcons'; + + this.parent(id, s); + this.onShowMenu = new tinymce.util.Dispatcher(this); + this.onHideMenu = new tinymce.util.Dispatcher(this); + this.classPrefix = 'mceMenu'; + }, + + createMenu : function(s) { + var t = this, cs = t.settings, m; + + s.container = s.container || cs.container; + s.parent = t; + s.constrain = s.constrain || cs.constrain; + s['class'] = s['class'] || cs['class']; + s.vp_offset_x = s.vp_offset_x || cs.vp_offset_x; + s.vp_offset_y = s.vp_offset_y || cs.vp_offset_y; + m = new tinymce.ui.DropMenu(s.id || DOM.uniqueId(), s); + + m.onAddItem.add(t.onAddItem.dispatch, t.onAddItem); + + return m; + }, + + update : function() { + var t = this, s = t.settings, tb = DOM.get('menu_' + t.id + '_tbl'), co = DOM.get('menu_' + t.id + '_co'), tw, th; + + tw = s.max_width ? Math.min(tb.clientWidth, s.max_width) : tb.clientWidth; + th = s.max_height ? Math.min(tb.clientHeight, s.max_height) : tb.clientHeight; + + if (!DOM.boxModel) + t.element.setStyles({width : tw + 2, height : th + 2}); + else + t.element.setStyles({width : tw, height : th}); + + if (s.max_width) + DOM.setStyle(co, 'width', tw); + + if (s.max_height) { + DOM.setStyle(co, 'height', th); + + if (tb.clientHeight < s.max_height) + DOM.setStyle(co, 'overflow', 'hidden'); + } + }, + + showMenu : function(x, y, px) { + var t = this, s = t.settings, co, vp = DOM.getViewPort(), w, h, mx, my, ot = 2, dm, tb, cp = t.classPrefix; + + t.collapse(1); + + if (t.isMenuVisible) + return; + + if (!t.rendered) { + co = DOM.add(t.settings.container, t.renderNode()); + + each(t.items, function(o) { + o.postRender(); + }); + + t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container}); + } else + co = DOM.get('menu_' + t.id); + + // Move layer out of sight unless it's Opera since it scrolls to top of page due to an bug + if (!tinymce.isOpera) + DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF}); + + DOM.show(co); + t.update(); + + x += s.offset_x || 0; + y += s.offset_y || 0; + vp.w -= 4; + vp.h -= 4; + + // Move inside viewport if not submenu + if (s.constrain) { + w = co.clientWidth - ot; + h = co.clientHeight - ot; + mx = vp.x + vp.w; + my = vp.y + vp.h; + + if ((x + s.vp_offset_x + w) > mx) + x = px ? px - w : Math.max(0, (mx - s.vp_offset_x) - w); + + if ((y + s.vp_offset_y + h) > my) + y = Math.max(0, (my - s.vp_offset_y) - h); + } + + DOM.setStyles(co, {left : x , top : y}); + t.element.update(); + + t.isMenuVisible = 1; + t.mouseClickFunc = Event.add(co, 'click', function(e) { + var m; + + e = e.target; + + if (e && (e = DOM.getParent(e, 'tr')) && !DOM.hasClass(e, cp + 'ItemSub')) { + m = t.items[e.id]; + + if (m.isDisabled()) + return; + + dm = t; + + while (dm) { + if (dm.hideMenu) + dm.hideMenu(); + + dm = dm.settings.parent; + } + + if (m.settings.onclick) + m.settings.onclick(e); + + return Event.cancel(e); // Cancel to fix onbeforeunload problem + } + }); + + if (t.hasMenus()) { + t.mouseOverFunc = Event.add(co, 'mouseover', function(e) { + var m, r, mi; + + e = e.target; + if (e && (e = DOM.getParent(e, 'tr'))) { + m = t.items[e.id]; + + if (t.lastMenu) + t.lastMenu.collapse(1); + + if (m.isDisabled()) + return; + + if (e && DOM.hasClass(e, cp + 'ItemSub')) { + //p = DOM.getPos(s.container); + r = DOM.getRect(e); + m.showMenu((r.x + r.w - ot), r.y - ot, r.x); + t.lastMenu = m; + DOM.addClass(DOM.get(m.id).firstChild, cp + 'ItemActive'); + } + } + }); + } + + t.onShowMenu.dispatch(t); + + if (s.keyboard_focus) { + Event.add(co, 'keydown', t._keyHandler, t); + DOM.select('a', 'menu_' + t.id)[0].focus(); // Select first link + t._focusIdx = 0; + } + }, + + hideMenu : function(c) { + var t = this, co = DOM.get('menu_' + t.id), e; + + if (!t.isMenuVisible) + return; + + Event.remove(co, 'mouseover', t.mouseOverFunc); + Event.remove(co, 'click', t.mouseClickFunc); + Event.remove(co, 'keydown', t._keyHandler); + DOM.hide(co); + t.isMenuVisible = 0; + + if (!c) + t.collapse(1); + + if (t.element) + t.element.hide(); + + if (e = DOM.get(t.id)) + DOM.removeClass(e.firstChild, t.classPrefix + 'ItemActive'); + + t.onHideMenu.dispatch(t); + }, + + add : function(o) { + var t = this, co; + + o = t.parent(o); + + if (t.isRendered && (co = DOM.get('menu_' + t.id))) + t._add(DOM.select('tbody', co)[0], o); + + return o; + }, + + collapse : function(d) { + this.parent(d); + this.hideMenu(1); + }, + + remove : function(o) { + DOM.remove(o.id); + this.destroy(); + + return this.parent(o); + }, + + destroy : function() { + var t = this, co = DOM.get('menu_' + t.id); + + Event.remove(co, 'mouseover', t.mouseOverFunc); + Event.remove(co, 'click', t.mouseClickFunc); + + if (t.element) + t.element.remove(); + + DOM.remove(co); + }, + + renderNode : function() { + var t = this, s = t.settings, n, tb, co, w; + + w = DOM.create('div', {id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:200000'}); + co = DOM.add(w, 'div', {id : 'menu_' + t.id + '_co', 'class' : t.classPrefix + (s['class'] ? ' ' + s['class'] : '')}); + t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container}); + + if (s.menu_line) + DOM.add(co, 'span', {'class' : t.classPrefix + 'Line'}); + +// n = DOM.add(co, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenuContainer'}); + n = DOM.add(co, 'table', {id : 'menu_' + t.id + '_tbl', border : 0, cellPadding : 0, cellSpacing : 0}); + tb = DOM.add(n, 'tbody'); + + each(t.items, function(o) { + t._add(tb, o); + }); + + t.rendered = true; + + return w; + }, + + // Internal functions + + _keyHandler : function(e) { + var t = this, kc = e.keyCode; + + function focus(d) { + var i = t._focusIdx + d, e = DOM.select('a', 'menu_' + t.id)[i]; + + if (e) { + t._focusIdx = i; + e.focus(); + } + }; + + switch (kc) { + case 38: + focus(-1); // Select first link + return; + + case 40: + focus(1); + return; + + case 13: + return; + + case 27: + return this.hideMenu(); + } + }, + + _add : function(tb, o) { + var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic; + + if (s.separator) { + ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'}); + DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'}); + + if (n = ro.previousSibling) + DOM.addClass(n, 'mceLast'); + + return; + } + + n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'Item ' + cp + 'ItemEnabled'}); + n = it = DOM.add(n, 'td'); + n = a = DOM.add(n, 'a', {href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'}); + + DOM.addClass(it, s['class']); +// n = DOM.add(n, 'span', {'class' : 'item'}); + + ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')}); + + if (s.icon_src) + DOM.add(ic, 'img', {src : s.icon_src}); + + n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title); + + if (o.settings.style) + DOM.setAttrib(n, 'style', o.settings.style); + + if (tb.childNodes.length == 1) + DOM.addClass(ro, 'mceFirst'); + + if ((n = ro.previousSibling) && DOM.hasClass(n, cp + 'ItemSeparator')) + DOM.addClass(ro, 'mceFirst'); + + if (o.collapse) + DOM.addClass(ro, cp + 'ItemSub'); + + if (n = ro.previousSibling) + DOM.removeClass(n, 'mceLast'); + + DOM.addClass(ro, 'mceLast'); + } + + }); +})(tinymce);(function(tinymce) { + var DOM = tinymce.DOM; + + tinymce.create('tinymce.ui.Button:tinymce.ui.Control', { + Button : function(id, s) { + this.parent(id, s); + this.classPrefix = 'mceButton'; + }, + + renderHTML : function() { + var cp = this.classPrefix, s = this.settings, h, l; + + l = DOM.encode(s.label || ''); + h = '<a id="' + this.id + '" href="javascript:;" class="' + cp + ' ' + cp + 'Enabled ' + s['class'] + (l ? ' ' + cp + 'Labeled' : '') +'" onmousedown="return false;" onclick="return false;" title="' + DOM.encode(s.title) + '">'; + + if (s.image) + h += '<img class="mceIcon" src="' + s.image + '" />' + l + '</a>'; + else + h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '') + '</a>'; + + return h; + }, + + postRender : function() { + var t = this, s = t.settings; + + tinymce.dom.Event.add(t.id, 'click', function(e) { + if (!t.isDisabled()) + return s.onclick.call(s.scope, e); + }); + } + + }); +})(tinymce); +(function(tinymce) { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher; + + tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control', { + ListBox : function(id, s) { + var t = this; + + t.parent(id, s); + t.items = []; + t.onChange = new Dispatcher(t); + t.onPostRender = new Dispatcher(t); + t.onAdd = new Dispatcher(t); + t.onRenderMenu = new tinymce.util.Dispatcher(this); + t.classPrefix = 'mceListBox'; + }, + + select : function(va) { + var t = this, fv, f; + + if (va == undefined) + return t.selectByIndex(-1); + + // Is string or number make function selector + if (va && va.call) + f = va; + else { + f = function(v) { + return v == va; + }; + } + + // Do we need to do something? + if (va != t.selectedValue) { + // Find item + each(t.items, function(o, i) { + if (f(o.value)) { + fv = 1; + t.selectByIndex(i); + return false; + } + }); + + if (!fv) + t.selectByIndex(-1); + } + }, + + selectByIndex : function(idx) { + var t = this, e, o; + + if (idx != t.selectedIndex) { + e = DOM.get(t.id + '_text'); + o = t.items[idx]; + + if (o) { + t.selectedValue = o.value; + t.selectedIndex = idx; + DOM.setHTML(e, DOM.encode(o.title)); + DOM.removeClass(e, 'mceTitle'); + } else { + DOM.setHTML(e, DOM.encode(t.settings.title)); + DOM.addClass(e, 'mceTitle'); + t.selectedValue = t.selectedIndex = null; + } + + e = 0; + } + }, + + add : function(n, v, o) { + var t = this; + + o = o || {}; + o = tinymce.extend(o, { + title : n, + value : v + }); + + t.items.push(o); + t.onAdd.dispatch(t, o); + }, + + getLength : function() { + return this.items.length; + }, + + renderHTML : function() { + var h = '', t = this, s = t.settings, cp = t.classPrefix; + + h = '<table id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>'; + h += '<td>' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + '</td>'; + h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '<span></span>') + '</td>'; + h += '</tr></tbody></table>'; + + return h; + }, + + showMenu : function() { + var t = this, p1, p2, e = DOM.get(this.id), m; + + if (t.isDisabled() || t.items.length == 0) + return; + + if (t.menu && t.menu.isMenuVisible) + return t.hideMenu(); + + if (!t.isMenuRendered) { + t.renderMenu(); + t.isMenuRendered = true; + } + + p1 = DOM.getPos(this.settings.menu_container); + p2 = DOM.getPos(e); + + m = t.menu; + m.settings.offset_x = p2.x; + m.settings.offset_y = p2.y; + m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus + + // Select in menu + if (t.oldID) + m.items[t.oldID].setSelected(0); + + each(t.items, function(o) { + if (o.value === t.selectedValue) { + m.items[o.id].setSelected(1); + t.oldID = o.id; + } + }); + + m.showMenu(0, e.clientHeight); + + Event.add(DOM.doc, 'mousedown', t.hideMenu, t); + DOM.addClass(t.id, t.classPrefix + 'Selected'); + + //DOM.get(t.id + '_text').focus(); + }, + + hideMenu : function(e) { + var t = this; + + // Prevent double toogles by canceling the mouse click event to the button + if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open')) + return; + + if (!e || !DOM.getParent(e.target, '.mceMenu')) { + DOM.removeClass(t.id, t.classPrefix + 'Selected'); + Event.remove(DOM.doc, 'mousedown', t.hideMenu, t); + + if (t.menu) + t.menu.hideMenu(); + } + }, + + renderMenu : function() { + var t = this, m; + + m = t.settings.control_manager.createDropMenu(t.id + '_menu', { + menu_line : 1, + 'class' : t.classPrefix + 'Menu mceNoIcons', + max_width : 150, + max_height : 150 + }); + + m.onHideMenu.add(t.hideMenu, t); + + m.add({ + title : t.settings.title, + 'class' : 'mceMenuItemTitle', + onclick : function() { + if (t.settings.onselect('') !== false) + t.select(''); // Must be runned after + } + }); + + each(t.items, function(o) { + o.id = DOM.uniqueId(); + o.onclick = function() { + if (t.settings.onselect(o.value) !== false) + t.select(o.value); // Must be runned after + }; + + m.add(o); + }); + + t.onRenderMenu.dispatch(t, m); + t.menu = m; + }, + + postRender : function() { + var t = this, cp = t.classPrefix; + + Event.add(t.id, 'click', t.showMenu, t); + Event.add(t.id + '_text', 'focus', function(e) { + if (!t._focused) { + t.keyDownHandler = Event.add(t.id + '_text', 'keydown', function(e) { + var idx = -1, v, kc = e.keyCode; + + // Find current index + each(t.items, function(v, i) { + if (t.selectedValue == v.value) + idx = i; + }); + + // Move up/down + if (kc == 38) + v = t.items[idx - 1]; + else if (kc == 40) + v = t.items[idx + 1]; + else if (kc == 13) { + // Fake select on enter + v = t.selectedValue; + t.selectedValue = null; // Needs to be null to fake change + t.settings.onselect(v); + return Event.cancel(e); + } + + if (v) { + t.hideMenu(); + t.select(v.value); + } + }); + } + + t._focused = 1; + }); + Event.add(t.id + '_text', 'blur', function() {Event.remove(t.id + '_text', 'keydown', t.keyDownHandler); t._focused = 0;}); + + // Old IE doesn't have hover on all elements + if (tinymce.isIE6 || !DOM.boxModel) { + Event.add(t.id, 'mouseover', function() { + if (!DOM.hasClass(t.id, cp + 'Disabled')) + DOM.addClass(t.id, cp + 'Hover'); + }); + + Event.add(t.id, 'mouseout', function() { + if (!DOM.hasClass(t.id, cp + 'Disabled')) + DOM.removeClass(t.id, cp + 'Hover'); + }); + } + + t.onPostRender.dispatch(t, DOM.get(t.id)); + }, + + destroy : function() { + this.parent(); + + Event.clear(this.id + '_text'); + } + + }); +})(tinymce);(function(tinymce) { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher; + + tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', { + NativeListBox : function(id, s) { + this.parent(id, s); + this.classPrefix = 'mceNativeListBox'; + }, + + setDisabled : function(s) { + DOM.get(this.id).disabled = s; + }, + + isDisabled : function() { + return DOM.get(this.id).disabled; + }, + + select : function(va) { + var t = this, fv, f; + + if (va == undefined) + return t.selectByIndex(-1); + + // Is string or number make function selector + if (va && va.call) + f = va; + else { + f = function(v) { + return v == va; + }; + } + + // Do we need to do something? + if (va != t.selectedValue) { + // Find item + each(t.items, function(o, i) { + if (f(o.value)) { + fv = 1; + t.selectByIndex(i); + return false; + } + }); + + if (!fv) + t.selectByIndex(-1); + } + }, + + selectByIndex : function(idx) { + DOM.get(this.id).selectedIndex = idx + 1; + this.selectedValue = this.items[idx] ? this.items[idx].value : null; + }, + + add : function(n, v, a) { + var o, t = this; + + a = a || {}; + a.value = v; + + if (t.isRendered()) + DOM.add(DOM.get(this.id), 'option', a, n); + + o = { + title : n, + value : v, + attribs : a + }; + + t.items.push(o); + t.onAdd.dispatch(t, o); + }, + + getLength : function() { + return DOM.get(this.id).options.length - 1; + }, + + renderHTML : function() { + var h, t = this; + + h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --'); + + each(t.items, function(it) { + h += DOM.createHTML('option', {value : it.value}, it.title); + }); + + h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox'}, h); + + return h; + }, + + postRender : function() { + var t = this, ch; + + t.rendered = true; + + function onChange(e) { + var v = t.items[e.target.selectedIndex - 1]; + + if (v && (v = v.value)) { + t.onChange.dispatch(t, v); + + if (t.settings.onselect) + t.settings.onselect(v); + } + }; + + Event.add(t.id, 'change', onChange); + + // Accessibility keyhandler + Event.add(t.id, 'keydown', function(e) { + var bf; + + Event.remove(t.id, 'change', ch); + + bf = Event.add(t.id, 'blur', function() { + Event.add(t.id, 'change', onChange); + Event.remove(t.id, 'blur', bf); + }); + + if (e.keyCode == 13 || e.keyCode == 32) { + onChange(e); + return Event.cancel(e); + } + }); + + t.onPostRender.dispatch(t, DOM.get(t.id)); + } + + }); +})(tinymce);(function(tinymce) { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each; + + tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', { + MenuButton : function(id, s) { + this.parent(id, s); + this.onRenderMenu = new tinymce.util.Dispatcher(this); + s.menu_container = s.menu_container || DOM.doc.body; + }, + + showMenu : function() { + var t = this, p1, p2, e = DOM.get(t.id), m; + + if (t.isDisabled()) + return; + + if (!t.isMenuRendered) { + t.renderMenu(); + t.isMenuRendered = true; + } + + if (t.isMenuVisible) + return t.hideMenu(); + + p1 = DOM.getPos(t.settings.menu_container); + p2 = DOM.getPos(e); + + m = t.menu; + m.settings.offset_x = p2.x; + m.settings.offset_y = p2.y; + m.settings.vp_offset_x = p2.x; + m.settings.vp_offset_y = p2.y; + m.settings.keyboard_focus = t._focused; + m.showMenu(0, e.clientHeight); + + Event.add(DOM.doc, 'mousedown', t.hideMenu, t); + t.setState('Selected', 1); + + t.isMenuVisible = 1; + }, + + renderMenu : function() { + var t = this, m; + + m = t.settings.control_manager.createDropMenu(t.id + '_menu', { + menu_line : 1, + 'class' : this.classPrefix + 'Menu', + icons : t.settings.icons + }); + + m.onHideMenu.add(t.hideMenu, t); + + t.onRenderMenu.dispatch(t, m); + t.menu = m; + }, + + hideMenu : function(e) { + var t = this; + + // Prevent double toogles by canceling the mouse click event to the button + if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id || e.id === t.id + '_open';})) + return; + + if (!e || !DOM.getParent(e.target, '.mceMenu')) { + t.setState('Selected', 0); + Event.remove(DOM.doc, 'mousedown', t.hideMenu, t); + if (t.menu) + t.menu.hideMenu(); + } + + t.isMenuVisible = 0; + }, + + postRender : function() { + var t = this, s = t.settings; + + Event.add(t.id, 'click', function() { + if (!t.isDisabled()) { + if (s.onclick) + s.onclick(t.value); + + t.showMenu(); + } + }); + } + + }); +})(tinymce); +(function(tinymce) { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each; + + tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', { + SplitButton : function(id, s) { + this.parent(id, s); + this.classPrefix = 'mceSplitButton'; + }, + + renderHTML : function() { + var h, t = this, s = t.settings, h1; + + h = '<tbody><tr>'; + + if (s.image) + h1 = DOM.createHTML('img ', {src : s.image, 'class' : 'mceAction ' + s['class']}); + else + h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, ''); + + h += '<td>' + DOM.createHTML('a', {id : t.id + '_action', href : 'javascript:;', 'class' : 'mceAction ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>'; + + h1 = DOM.createHTML('span', {'class' : 'mceOpen ' + s['class']}); + h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'mceOpen ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>'; + + h += '</tr></tbody>'; + + return DOM.createHTML('table', {id : t.id, 'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', onmousedown : 'return false;', title : s.title}, h); + }, + + postRender : function() { + var t = this, s = t.settings; + + if (s.onclick) { + Event.add(t.id + '_action', 'click', function() { + if (!t.isDisabled()) + s.onclick(t.value); + }); + } + + Event.add(t.id + '_open', 'click', t.showMenu, t); + Event.add(t.id + '_open', 'focus', function() {t._focused = 1;}); + Event.add(t.id + '_open', 'blur', function() {t._focused = 0;}); + + // Old IE doesn't have hover on all elements + if (tinymce.isIE6 || !DOM.boxModel) { + Event.add(t.id, 'mouseover', function() { + if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled')) + DOM.addClass(t.id, 'mceSplitButtonHover'); + }); + + Event.add(t.id, 'mouseout', function() { + if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled')) + DOM.removeClass(t.id, 'mceSplitButtonHover'); + }); + } + }, + + destroy : function() { + this.parent(); + + Event.clear(this.id + '_action'); + Event.clear(this.id + '_open'); + } + + }); +})(tinymce); +(function(tinymce) { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each; + + tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton', { + ColorSplitButton : function(id, s) { + var t = this; + + t.parent(id, s); + + t.settings = s = tinymce.extend({ + colors : '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF', + grid_width : 8, + default_color : '#888888' + }, t.settings); + + t.onShowMenu = new tinymce.util.Dispatcher(t); + t.onHideMenu = new tinymce.util.Dispatcher(t); + + t.value = s.default_color; + }, + + showMenu : function() { + var t = this, r, p, e, p2; + + if (t.isDisabled()) + return; + + if (!t.isMenuRendered) { + t.renderMenu(); + t.isMenuRendered = true; + } + + if (t.isMenuVisible) + return t.hideMenu(); + + e = DOM.get(t.id); + DOM.show(t.id + '_menu'); + DOM.addClass(e, 'mceSplitButtonSelected'); + p2 = DOM.getPos(e); + DOM.setStyles(t.id + '_menu', { + left : p2.x, + top : p2.y + e.clientHeight, + zIndex : 200000 + }); + e = 0; + + Event.add(DOM.doc, 'mousedown', t.hideMenu, t); + + if (t._focused) { + t._keyHandler = Event.add(t.id + '_menu', 'keydown', function(e) { + if (e.keyCode == 27) + t.hideMenu(); + }); + + DOM.select('a', t.id + '_menu')[0].focus(); // Select first link + } + + t.onShowMenu.dispatch(t); + + t.isMenuVisible = 1; + }, + + hideMenu : function(e) { + var t = this; + + // Prevent double toogles by canceling the mouse click event to the button + if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id + '_open';})) + return; + + if (!e || !DOM.getParent(e.target, '.mceSplitButtonMenu')) { + DOM.removeClass(t.id, 'mceSplitButtonSelected'); + Event.remove(DOM.doc, 'mousedown', t.hideMenu, t); + Event.remove(t.id + '_menu', 'keydown', t._keyHandler); + DOM.hide(t.id + '_menu'); + } + + t.onHideMenu.dispatch(t); + + t.isMenuVisible = 0; + }, + + renderMenu : function() { + var t = this, m, i = 0, s = t.settings, n, tb, tr, w; + + w = DOM.add(s.menu_container, 'div', {id : t.id + '_menu', 'class' : s['menu_class'] + ' ' + s['class'], style : 'position:absolute;left:0;top:-1000px;'}); + m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'}); + DOM.add(m, 'span', {'class' : 'mceMenuLine'}); + + n = DOM.add(m, 'table', {'class' : 'mceColorSplitMenu'}); + tb = DOM.add(n, 'tbody'); + + // Generate color grid + i = 0; + each(is(s.colors, 'array') ? s.colors : s.colors.split(','), function(c) { + c = c.replace(/^#/, ''); + + if (!i--) { + tr = DOM.add(tb, 'tr'); + i = s.grid_width - 1; + } + + n = DOM.add(tr, 'td'); + + n = DOM.add(n, 'a', { + href : 'javascript:;', + style : { + backgroundColor : '#' + c + }, + mce_color : '#' + c + }); + }); + + if (s.more_colors_func) { + n = DOM.add(tb, 'tr'); + n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'mceMoreColors'}); + n = DOM.add(n, 'a', {id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title); + + Event.add(n, 'click', function(e) { + s.more_colors_func.call(s.more_colors_scope || this); + return Event.cancel(e); // Cancel to fix onbeforeunload problem + }); + } + + DOM.addClass(m, 'mceColorSplitMenu'); + + Event.add(t.id + '_menu', 'click', function(e) { + var c; + + e = e.target; + + if (e.nodeName == 'A' && (c = e.getAttribute('mce_color'))) + t.setColor(c); + + return Event.cancel(e); // Prevent IE auto save warning + }); + + return w; + }, + + setColor : function(c) { + var t = this; + + DOM.setStyle(t.id + '_preview', 'backgroundColor', c); + + t.value = c; + t.hideMenu(); + t.settings.onselect(c); + }, + + postRender : function() { + var t = this, id = t.id; + + t.parent(); + DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'}); + DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value); + }, + + destroy : function() { + this.parent(); + + Event.clear(this.id + '_menu'); + Event.clear(this.id + '_more'); + DOM.remove(this.id + '_menu'); + } + + }); +})(tinymce); +tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { + renderHTML : function() { + var t = this, h = '', c, co, dom = tinymce.DOM, s = t.settings, i, pr, nx, cl; + + cl = t.controls; + for (i=0; i<cl.length; i++) { + // Get current control, prev control, next control and if the control is a list box or not + co = cl[i]; + pr = cl[i - 1]; + nx = cl[i + 1]; + + // Add toolbar start + if (i === 0) { + c = 'mceToolbarStart'; + + if (co.Button) + c += ' mceToolbarStartButton'; + else if (co.SplitButton) + c += ' mceToolbarStartSplitButton'; + else if (co.ListBox) + c += ' mceToolbarStartListBox'; + + h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->')); + } + + // Add toolbar end before list box and after the previous button + // This is to fix the o2k7 editor skins + if (pr && co.ListBox) { + if (pr.Button || pr.SplitButton) + h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, '<!-- IE -->')); + } + + // Render control HTML + + // IE 8 quick fix, needed to propertly generate a hit area for anchors + if (dom.stdMode) + h += '<td style="position: relative">' + co.renderHTML() + '</td>'; + else + h += '<td>' + co.renderHTML() + '</td>'; + + // Add toolbar start after list box and before the next button + // This is to fix the o2k7 editor skins + if (nx && co.ListBox) { + if (nx.Button || nx.SplitButton) + h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->')); + } + } + + c = 'mceToolbarEnd'; + + if (co.Button) + c += ' mceToolbarEndButton'; + else if (co.SplitButton) + c += ' mceToolbarEndSplitButton'; + else if (co.ListBox) + c += ' mceToolbarEndListBox'; + + h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->')); + + return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || ''}, '<tbody><tr>' + h + '</tr></tbody>'); + } + + }); +(function(tinymce) { + var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each; + + tinymce.create('tinymce.AddOnManager', { + items : [], + urls : {}, + lookup : {}, + onAdd : new Dispatcher(this), + + get : function(n) { + return this.lookup[n]; + }, + + requireLangPack : function(n) { + var u, s = tinymce.EditorManager.settings; + + if (s && s.language) { + u = this.urls[n] + '/langs/' + s.language + '.js'; + + if (!tinymce.dom.Event.domLoaded && !s.strict_mode) + tinymce.ScriptLoader.load(u); + else + tinymce.ScriptLoader.add(u); + } + }, + + add : function(id, o) { + this.items.push(o); + this.lookup[id] = o; + this.onAdd.dispatch(this, id, o); + + return o; + }, + + load : function(n, u, cb, s) { + var t = this; + + if (t.urls[n]) + return; + + if (u.indexOf('/') != 0 && u.indexOf('://') == -1) + u = tinymce.baseURL + '/' + u; + + t.urls[n] = u.substring(0, u.lastIndexOf('/')); + tinymce.ScriptLoader.add(u, cb, s); + } + + }); + + // Create plugin and theme managers + tinymce.PluginManager = new tinymce.AddOnManager(); + tinymce.ThemeManager = new tinymce.AddOnManager(); +}(tinymce));(function(tinymce) { + // Shorten names + var each = tinymce.each, extend = tinymce.extend, DOM = tinymce.DOM, Event = tinymce.dom.Event, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, explode = tinymce.explode; + + tinymce.create('static tinymce.EditorManager', { + editors : {}, + i18n : {}, + activeEditor : null, + + preInit : function() { + var t = this, lo = window.location; + + // Setup some URLs where the editor API is located and where the document is + tinymce.documentBaseURL = lo.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, ''); + if (!/[\/\\]$/.test(tinymce.documentBaseURL)) + tinymce.documentBaseURL += '/'; + + tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL); + tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL); + + // User specified a document.domain value + if (document.domain && lo.hostname != document.domain) + tinymce.relaxedDomain = document.domain; + + // Add before unload listener + // This was required since IE was leaking memory if you added and removed beforeunload listeners + // with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event + t.onBeforeUnload = new tinymce.util.Dispatcher(t); + + // Must be on window or IE will leak if the editor is placed in frame or iframe + Event.add(window, 'beforeunload', function(e) { + t.onBeforeUnload.dispatch(t, e); + }); + }, + + init : function(s) { + var t = this, pl, sl = tinymce.ScriptLoader, c, e, el = [], ed; + + function execCallback(se, n, s) { + var f = se[n]; + + if (!f) + return; + + if (tinymce.is(f, 'string')) { + s = f.replace(/\.\w+$/, ''); + s = s ? tinymce.resolve(s) : 0; + f = tinymce.resolve(f); + } + + return f.apply(s || this, Array.prototype.slice.call(arguments, 2)); + }; + + s = extend({ + theme : "simple", + language : "en", + strict_loading_mode : document.contentType == 'application/xhtml+xml' + }, s); + + t.settings = s; + + // If page not loaded and strict mode isn't enabled then load them + if (!Event.domLoaded && !s.strict_loading_mode) { + // Load language + if (s.language) + sl.add(tinymce.baseURL + '/langs/' + s.language + '.js'); + + // Load theme + if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme]) + ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js'); + + // Load plugins + if (s.plugins) { + pl = explode(s.plugins); + + // Load compat2x first + if (tinymce.inArray(pl, 'compat2x') != -1) + PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js'); + + // Load rest if plugins + each(pl, function(v) { + if (v && v.charAt(0) != '-' && !PluginManager.urls[v]) { + // Skip safari plugin for other browsers + if (!tinymce.isWebKit && v == 'safari') + return; + + PluginManager.load(v, 'plugins/' + v + '/editor_plugin' + tinymce.suffix + '.js'); + } + }); + } + + sl.loadQueue(); + } + + // Legacy call + Event.add(document, 'init', function() { + var l, co; + + execCallback(s, 'onpageload'); + + // Verify that it's a valid browser + if (s.browsers) { + l = false; + + each(explode(s.browsers), function(v) { + switch (v) { + case 'ie': + case 'msie': + if (tinymce.isIE) + l = true; + break; + + case 'gecko': + if (tinymce.isGecko) + l = true; + break; + + case 'safari': + case 'webkit': + if (tinymce.isWebKit) + l = true; + break; + + case 'opera': + if (tinymce.isOpera) + l = true; + + break; + } + }); + + // Not a valid one + if (!l) + return; + } + + switch (s.mode) { + case "exact": + l = s.elements || ''; + + if(l.length > 0) { + each(explode(l), function(v) { + if (DOM.get(v)) { + ed = new tinymce.Editor(v, s); + el.push(ed); + ed.render(1); + } else { + c = 0; + + each(document.forms, function(f) { + each(f.elements, function(e) { + if (e.name === v) { + v = 'mce_editor_' + c; + DOM.setAttrib(e, 'id', v); + + ed = new tinymce.Editor(v, s); + el.push(ed); + ed.render(1); + } + }); + }); + } + }); + } + break; + + case "textareas": + case "specific_textareas": + function hasClass(n, c) { + return c.constructor === RegExp ? c.test(n.className) : DOM.hasClass(n, c); + }; + + each(DOM.select('textarea'), function(v) { + if (s.editor_deselector && hasClass(v, s.editor_deselector)) + return; + + if (!s.editor_selector || hasClass(v, s.editor_selector)) { + // Can we use the name + e = DOM.get(v.name); + if (!v.id && !e) + v.id = v.name; + + // Generate unique name if missing or already exists + if (!v.id || t.get(v.id)) + v.id = DOM.uniqueId(); + + ed = new tinymce.Editor(v.id, s); + el.push(ed); + ed.render(1); + } + }); + break; + } + + // Call onInit when all editors are initialized + if (s.oninit) { + l = co = 0; + + each (el, function(ed) { + co++; + + if (!ed.initialized) { + // Wait for it + ed.onInit.add(function() { + l++; + + // All done + if (l == co) + execCallback(s, 'oninit'); + }); + } else + l++; + + // All done + if (l == co) + execCallback(s, 'oninit'); + }); + } + }); + }, + + get : function(id) { + return this.editors[id]; + }, + + getInstanceById : function(id) { + return this.get(id); + }, + + add : function(e) { + this.editors[e.id] = e; + this._setActive(e); + + return e; + }, + + remove : function(e) { + var t = this; + + // Not in the collection + if (!t.editors[e.id]) + return null; + + delete t.editors[e.id]; + + // Select another editor since the active one was removed + if (t.activeEditor == e) { + each(t.editors, function(e) { + t._setActive(e); + return false; // Break + }); + } + + e.destroy(); + + return e; + }, + + execCommand : function(c, u, v) { + var t = this, ed = t.get(v), w; + + // Manager commands + switch (c) { + case "mceFocus": + ed.focus(); + return true; + + case "mceAddEditor": + case "mceAddControl": + if (!t.get(v)) + new tinymce.Editor(v, t.settings).render(); + + return true; + + case "mceAddFrameControl": + w = v.window; + + // Add tinyMCE global instance and tinymce namespace to specified window + w.tinyMCE = tinyMCE; + w.tinymce = tinymce; + + tinymce.DOM.doc = w.document; + tinymce.DOM.win = w; + + ed = new tinymce.Editor(v.element_id, v); + ed.render(); + + // Fix IE memory leaks + if (tinymce.isIE) { + function clr() { + ed.destroy(); + w.detachEvent('onunload', clr); + w = w.tinyMCE = w.tinymce = null; // IE leak + }; + + w.attachEvent('onunload', clr); + } + + v.page_window = null; + + return true; + + case "mceRemoveEditor": + case "mceRemoveControl": + if (ed) + ed.remove(); + + return true; + + case 'mceToggleEditor': + if (!ed) { + t.execCommand('mceAddControl', 0, v); + return true; + } + + if (ed.isHidden()) + ed.show(); + else + ed.hide(); + + return true; + } + + // Run command on active editor + if (t.activeEditor) + return t.activeEditor.execCommand(c, u, v); + + return false; + }, + + execInstanceCommand : function(id, c, u, v) { + var ed = this.get(id); + + if (ed) + return ed.execCommand(c, u, v); + + return false; + }, + + triggerSave : function() { + each(this.editors, function(e) { + e.save(); + }); + }, + + addI18n : function(p, o) { + var lo, i18n = this.i18n; + + if (!tinymce.is(p, 'string')) { + each(p, function(o, lc) { + each(o, function(o, g) { + each(o, function(o, k) { + if (g === 'common') + i18n[lc + '.' + k] = o; + else + i18n[lc + '.' + g + '.' + k] = o; + }); + }); + }); + } else { + each(o, function(o, k) { + i18n[p + '.' + k] = o; + }); + } + }, + + // Private methods + + _setActive : function(e) { + this.selectedInstance = this.activeEditor = e; + } + + }); + + tinymce.EditorManager.preInit(); +})(tinymce); + +// Short for editor manager window.tinyMCE is needed when TinyMCE gets loaded though a XHR call +var tinyMCE = window.tinyMCE = tinymce.EditorManager; +(function(tinymce) { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, Dispatcher = tinymce.util.Dispatcher; + var each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit; + var is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, EditorManager = tinymce.EditorManager; + var inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode; + + tinymce.create('tinymce.Editor', { + Editor : function(id, s) { + var t = this; + + t.id = t.editorId = id; + t.execCommands = {}; + t.queryStateCommands = {}; + t.queryValueCommands = {}; + t.plugins = {}; + + // Add events to the editor + each([ + 'onPreInit', + 'onBeforeRenderUI', + 'onPostRender', + 'onInit', + 'onRemove', + 'onActivate', + 'onDeactivate', + 'onClick', + 'onEvent', + 'onMouseUp', + 'onMouseDown', + 'onDblClick', + 'onKeyDown', + 'onKeyUp', + 'onKeyPress', + 'onContextMenu', + 'onSubmit', + 'onReset', + 'onPaste', + 'onPreProcess', + 'onPostProcess', + 'onBeforeSetContent', + 'onBeforeGetContent', + 'onSetContent', + 'onGetContent', + 'onLoadContent', + 'onSaveContent', + 'onNodeChange', + 'onChange', + 'onBeforeExecCommand', + 'onExecCommand', + 'onUndo', + 'onRedo', + 'onVisualAid', + 'onSetProgressState' + ], function(e) { + t[e] = new Dispatcher(t); + }); + + // Default editor config + t.settings = s = extend({ + id : id, + language : 'en', + docs_language : 'en', + theme : 'simple', + skin : 'default', + delta_width : 0, + delta_height : 0, + popup_css : '', + plugins : '', + document_base_url : tinymce.documentBaseURL, + add_form_submit_trigger : 1, + submit_patch : 1, + add_unload_trigger : 1, + convert_urls : 1, + relative_urls : 1, + remove_script_host : 1, + table_inline_editing : 0, + object_resizing : 1, + cleanup : 1, + accessibility_focus : 1, + custom_shortcuts : 1, + custom_undo_redo_keyboard_shortcuts : 1, + custom_undo_redo_restore_selection : 1, + custom_undo_redo : 1, + doctype : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', + visual_table_class : 'mceItemTable', + visual : 1, + inline_styles : true, + convert_fonts_to_spans : true, + font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large', + apply_source_formatting : 1, + directionality : 'ltr', + forced_root_block : 'p', + valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big', + hidden_input : 1, + padd_empty_editor : 1, + render_ui : 1, + init_theme : 1, + force_p_newlines : 1, + indentation : '30px', + keep_styles : 1, + fix_table_elements : 1, + removeformat_selector : 'span,b,strong,em,i,font,u,strike' + }, s); + + // Setup URIs + t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, { + base_uri : tinyMCE.baseURI + }); + t.baseURI = EditorManager.baseURI; + + // Call setup + t.execCallback('setup', t); + }, + + render : function(nst) { + var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader; + + // Page is not loaded yet, wait for it + if (!Event.domLoaded) { + Event.add(document, 'init', function() { + t.render(); + }); + return; + } + + // Force strict loading mode if render us called by user and not internally + if (!nst) { + s.strict_loading_mode = 1; + tinyMCE.settings = s; + } + + // Element not found, then skip initialization + if (!t.getElement()) + return; + + if (s.strict_loading_mode) { + sl.settings.strict_mode = s.strict_loading_mode; + tinymce.DOM.settings.strict = 1; + } + + // Add hidden input for non input elements inside form elements + if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form')) + DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id); + + if (tinymce.WindowManager) + t.windowManager = new tinymce.WindowManager(t); + + if (s.encoding == 'xml') { + t.onGetContent.add(function(ed, o) { + if (o.save) + o.content = DOM.encode(o.content); + }); + } + + if (s.add_form_submit_trigger) { + t.onSubmit.addToTop(function() { + if (t.initialized) { + t.save(); + t.isNotDirty = 1; + } + }); + } + + if (s.add_unload_trigger) { + t._beforeUnload = tinyMCE.onBeforeUnload.add(function() { + if (t.initialized && !t.destroyed && !t.isHidden()) + t.save({format : 'raw', no_events : true}); + }); + } + + tinymce.addUnload(t.destroy, t); + + if (s.submit_patch) { + t.onBeforeRenderUI.add(function() { + var n = t.getElement().form; + + if (!n) + return; + + // Already patched + if (n._mceOldSubmit) + return; + + // Check page uses id="submit" or name="submit" for it's submit button + if (!n.submit.nodeType && !n.submit.length) { + t.formElement = n; + n._mceOldSubmit = n.submit; + n.submit = function() { + // Save all instances + EditorManager.triggerSave(); + t.isNotDirty = 1; + + return t.formElement._mceOldSubmit(t.formElement); + }; + } + + n = null; + }); + } + + // Load scripts + function loadScripts() { + if (s.language) + sl.add(tinymce.baseURL + '/langs/' + s.language + '.js'); + + if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme]) + ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js'); + + each(explode(s.plugins), function(p) { + if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) { + // Skip safari plugin for other browsers + if (!isWebKit && p == 'safari') + return; + + PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js'); + } + }); + + // Init when que is loaded + sl.loadQueue(function() { + if (!t.removed) + t.init(); + }); + }; + + // Load compat2x first + if (s.plugins.indexOf('compat2x') != -1) { + PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js'); + sl.loadQueue(loadScripts); + } else + loadScripts(); + }, + + init : function() { + var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re; + + EditorManager.add(t); + + // Create theme + if (s.theme) { + s.theme = s.theme.replace(/-/, ''); + o = ThemeManager.get(s.theme); + t.theme = new o(); + + if (t.theme.init && s.init_theme) + t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, '')); + } + + // Create all plugins + each(explode(s.plugins.replace(/\-/g, '')), function(p) { + var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po; + + if (c) { + po = new c(t, u); + + t.plugins[p] = po; + + if (po.init) + po.init(t, u); + } + }); + + // Setup popup CSS path(s) + if (s.popup_css !== false) { + if (s.popup_css) + s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css); + else + s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css"); + } + + if (s.popup_css_add) + s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add); + + // Setup control factory + t.controlManager = new tinymce.ControlManager(t); + t.undoManager = new tinymce.UndoManager(t); + + // Pass through + t.undoManager.onAdd.add(function(um, l) { + if (!l.initial) + return t.onChange.dispatch(t, l, um); + }); + + t.undoManager.onUndo.add(function(um, l) { + return t.onUndo.dispatch(t, l, um); + }); + + t.undoManager.onRedo.add(function(um, l) { + return t.onRedo.dispatch(t, l, um); + }); + + if (s.custom_undo_redo) { + t.onExecCommand.add(function(ed, cmd, ui, val, a) { + if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo)) + t.undoManager.add(); + }); + } + + t.onExecCommand.add(function(ed, c) { + // Don't refresh the select lists until caret move + if (!/^(FontName|FontSize)$/.test(c)) + t.nodeChanged(); + }); + + // Remove ghost selections on images and tables in Gecko + if (isGecko) { + function repaint(a, o) { + if (!o || !o.initial) + t.execCommand('mceRepaint'); + }; + + t.onUndo.add(repaint); + t.onRedo.add(repaint); + t.onSetContent.add(repaint); + } + + // Enables users to override the control factory + t.onBeforeRenderUI.dispatch(t, t.controlManager); + + // Measure box + if (s.render_ui) { + w = s.width || e.style.width || e.offsetWidth; + h = s.height || e.style.height || e.offsetHeight; + t.orgDisplay = e.style.display; + re = /^[0-9\.]+(|px)$/i; + + if (re.test('' + w)) + w = Math.max(parseInt(w) + (o.deltaWidth || 0), 100); + + if (re.test('' + h)) + h = Math.max(parseInt(h) + (o.deltaHeight || 0), 100); + + // Render UI + o = t.theme.renderUI({ + targetNode : e, + width : w, + height : h, + deltaWidth : s.delta_width, + deltaHeight : s.delta_height + }); + + t.editorContainer = o.editorContainer; + } + + + // Resize editor + DOM.setStyles(o.sizeContainer || o.editorContainer, { + width : w, + height : h + }); + + h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : ''); + if (h < 100) + h = 100; + + t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + t.documentBaseURI.getURI() + '" />'; + t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; + + if (tinymce.relaxedDomain) + t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>'; + + bi = s.body_id || 'tinymce'; + if (bi.indexOf('=') != -1) { + bi = t.getParam('body_id', '', 'hash'); + bi = bi[t.id] || bi; + } + + bc = s.body_class || ''; + if (bc.indexOf('=') != -1) { + bc = t.getParam('body_class', '', 'hash'); + bc = bc[t.id] || ''; + } + + t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>'; + + // Domain relaxing enabled, then set document domain + if (tinymce.relaxedDomain) { + // We need to write the contents here in IE since multiple writes messes up refresh button and back button + if (isIE || (tinymce.isOpera && parseFloat(opera.version()) >= 9.5)) + u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'; + else if (tinymce.isOpera) + u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()'; + } + + // Create iframe + n = DOM.add(o.iframeContainer, 'iframe', { + id : t.id + "_ifr", + src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7 + frameBorder : '0', + style : { + width : '100%', + height : h + } + }); + + t.contentAreaContainer = o.iframeContainer; + DOM.get(o.editorContainer).style.display = t.orgDisplay; + DOM.get(t.id).style.display = 'none'; + + if (!isIE || !tinymce.relaxedDomain) + t.setupIframe(); + + e = n = o = null; // Cleanup + }, + + setupIframe : function() { + var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b; + + // Setup iframe body + if (!isIE || !tinymce.relaxedDomain) { + d.open(); + d.write(t.iframeHTML); + d.close(); + } + + // Design mode needs to be added here Ctrl+A will fail otherwise + if (!isIE) { + try { + if (!s.readonly) + d.designMode = 'On'; + } catch (ex) { + // Will fail on Gecko if the editor is placed in an hidden container element + // The design mode will be set ones the editor is focused + } + } + + // IE needs to use contentEditable or it will display non secure items for HTTPS + if (isIE) { + // It will not steal focus if we hide it while setting contentEditable + b = t.getBody(); + DOM.hide(b); + + if (!s.readonly) + b.contentEditable = true; + + DOM.show(b); + } + + // Setup objects + t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), { + keep_values : true, + url_converter : t.convertURL, + url_converter_scope : t, + hex_colors : s.force_hex_style_colors, + class_filter : s.class_filter, + update_styles : 1, + fix_ie_paragraphs : 1 + }); + + t.serializer = new tinymce.dom.Serializer({ + entity_encoding : s.entity_encoding, + entities : s.entities, + valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements, + extended_valid_elements : s.extended_valid_elements, + valid_child_elements : s.valid_child_elements, + invalid_elements : s.invalid_elements, + fix_table_elements : s.fix_table_elements, + fix_list_elements : s.fix_list_elements, + fix_content_duplication : s.fix_content_duplication, + convert_fonts_to_spans : s.convert_fonts_to_spans, + font_size_classes : s.font_size_classes, + font_size_style_values : s.font_size_style_values, + apply_source_formatting : s.apply_source_formatting, + remove_linebreaks : s.remove_linebreaks, + element_format : s.element_format, + dom : t.dom + }); + + t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer); + t.forceBlocks = new tinymce.ForceBlocks(t, { + forced_root_block : s.forced_root_block + }); + t.editorCommands = new tinymce.EditorCommands(t); + + // Pass through + t.serializer.onPreProcess.add(function(se, o) { + return t.onPreProcess.dispatch(t, o, se); + }); + + t.serializer.onPostProcess.add(function(se, o) { + return t.onPostProcess.dispatch(t, o, se); + }); + + t.onPreInit.dispatch(t); + + if (!s.gecko_spellcheck) + t.getBody().spellcheck = 0; + + if (!s.readonly) + t._addEvents(); + + t.controlManager.onPostRender.dispatch(t, t.controlManager); + t.onPostRender.dispatch(t); + + if (s.directionality) + t.getBody().dir = s.directionality; + + if (s.nowrap) + t.getBody().style.whiteSpace = "nowrap"; + + if (s.auto_resize) + t.onNodeChange.add(t.resizeToContent, t); + + if (s.custom_elements) { + function handleCustom(ed, o) { + each(explode(s.custom_elements), function(v) { + var n; + + if (v.indexOf('~') === 0) { + v = v.substring(1); + n = 'span'; + } else + n = 'div'; + + o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' mce_name="$1"$2>'); + o.content = o.content.replace(new RegExp('</(' + v + ')>', 'g'), '</' + n + '>'); + }); + }; + + t.onBeforeSetContent.add(handleCustom); + t.onPostProcess.add(function(ed, o) { + if (o.set) + handleCustom(ed, o) + }); + } + + if (s.handle_node_change_callback) { + t.onNodeChange.add(function(ed, cm, n) { + t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed()); + }); + } + + if (s.save_callback) { + t.onSaveContent.add(function(ed, o) { + var h = t.execCallback('save_callback', t.id, o.content, t.getBody()); + + if (h) + o.content = h; + }); + } + + if (s.onchange_callback) { + t.onChange.add(function(ed, l) { + t.execCallback('onchange_callback', t, l); + }); + } + + if (s.convert_newlines_to_brs) { + t.onBeforeSetContent.add(function(ed, o) { + if (o.initial) + o.content = o.content.replace(/\r?\n/g, '<br />'); + }); + } + + if (s.fix_nesting && isIE) { + t.onBeforeSetContent.add(function(ed, o) { + o.content = t._fixNesting(o.content); + }); + } + + if (s.preformatted) { + t.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/^\s*<pre.*?>/, ''); + o.content = o.content.replace(/<\/pre>\s*$/, ''); + + if (o.set) + o.content = '<pre class="mceItemHidden">' + o.content + '</pre>'; + }); + } + + if (s.verify_css_classes) { + t.serializer.attribValueFilter = function(n, v) { + var s, cl; + + if (n == 'class') { + // Build regexp for classes + if (!t.classesRE) { + cl = t.dom.getClasses(); + + if (cl.length > 0) { + s = ''; + + each (cl, function(o) { + s += (s ? '|' : '') + o['class']; + }); + + t.classesRE = new RegExp('(' + s + ')', 'gi'); + } + } + + return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : ''; + } + + return v; + }; + } + + if (s.convert_fonts_to_spans) + t._convertFonts(); + + if (s.inline_styles) + t._convertInlineElements(); + + if (s.cleanup_callback) { + t.onBeforeSetContent.add(function(ed, o) { + o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o); + }); + + t.onPreProcess.add(function(ed, o) { + if (o.set) + t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o); + + if (o.get) + t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o); + }); + + t.onPostProcess.add(function(ed, o) { + if (o.set) + o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o); + + if (o.get) + o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o); + }); + } + + if (s.save_callback) { + t.onGetContent.add(function(ed, o) { + if (o.save) + o.content = t.execCallback('save_callback', t.id, o.content, t.getBody()); + }); + } + + if (s.handle_event_callback) { + t.onEvent.add(function(ed, e, o) { + if (t.execCallback('handle_event_callback', e, ed, o) === false) + Event.cancel(e); + }); + } + + // Add visual aids when new contents is added + t.onSetContent.add(function() { + t.addVisual(t.getBody()); + }); + + // Remove empty contents + if (s.padd_empty_editor) { + t.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/^(<p[^>]*>( | |\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, ''); + }); + } + + if (isGecko) { + // Fix gecko link bug, when a link is placed at the end of block elements there is + // no way to move the caret behind the link. This fix adds a bogus br element after the link + function fixLinks(ed, o) { + each(ed.dom.select('a'), function(n) { + var pn = n.parentNode; + + if (ed.dom.isBlock(pn) && pn.lastChild === n) + ed.dom.add(pn, 'br', {'mce_bogus' : 1}); + }); + }; + + t.onExecCommand.add(function(ed, cmd) { + if (cmd === 'CreateLink') + fixLinks(ed); + }); + + t.onSetContent.add(t.selection.onSetContent.add(fixLinks)); + + if (!s.readonly) { + try { + // Design mode must be set here once again to fix a bug where + // Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again + d.designMode = 'Off'; + d.designMode = 'On'; + } catch (ex) { + // Will fail on Gecko if the editor is placed in an hidden container element + // The design mode will be set ones the editor is focused + } + } + } + + // A small timeout was needed since firefox will remove. Bug: #1838304 + setTimeout(function () { + if (t.removed) + return; + + t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')}); + t.startContent = t.getContent({format : 'raw'}); + t.undoManager.add({initial : true}); + t.initialized = true; + + t.onInit.dispatch(t); + t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc()); + t.execCallback('init_instance_callback', t); + t.focus(true); + t.nodeChanged({initial : 1}); + + // Load specified content CSS last + if (s.content_css) { + tinymce.each(explode(s.content_css), function(u) { + t.dom.loadCSS(t.documentBaseURI.toAbsolute(u)); + }); + } + + // Handle auto focus + if (s.auto_focus) { + setTimeout(function () { + var ed = EditorManager.get(s.auto_focus); + + ed.selection.select(ed.getBody(), 1); + ed.selection.collapse(1); + ed.getWin().focus(); + }, 100); + } + }, 1); + + e = null; + }, + + + focus : function(sf) { + var oed, t = this, ce = t.settings.content_editable; + + if (!sf) { + // Is not content editable or the selection is outside the area in IE + // the IE statement is needed to avoid bluring if element selections inside layers since + // the layer is like it's own document in IE + if (!ce && (!isIE || t.selection.getNode().ownerDocument != t.getDoc())) + t.getWin().focus(); + + } + + if (EditorManager.activeEditor != t) { + if ((oed = EditorManager.activeEditor) != null) + oed.onDeactivate.dispatch(oed, t); + + t.onActivate.dispatch(t, oed); + } + + EditorManager._setActive(t); + }, + + execCallback : function(n) { + var t = this, f = t.settings[n], s; + + if (!f) + return; + + // Look through lookup + if (t.callbackLookup && (s = t.callbackLookup[n])) { + f = s.func; + s = s.scope; + } + + if (is(f, 'string')) { + s = f.replace(/\.\w+$/, ''); + s = s ? tinymce.resolve(s) : 0; + f = tinymce.resolve(f); + t.callbackLookup = t.callbackLookup || {}; + t.callbackLookup[n] = {func : f, scope : s}; + } + + return f.apply(s || t, Array.prototype.slice.call(arguments, 1)); + }, + + translate : function(s) { + var c = this.settings.language || 'en', i18n = EditorManager.i18n; + + if (!s) + return ''; + + return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) { + return i18n[c + '.' + b] || '{#' + b + '}'; + }); + }, + + getLang : function(n, dv) { + return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}'); + }, + + getParam : function(n, dv, ty) { + var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o; + + if (ty === 'hash') { + o = {}; + + if (is(v, 'string')) { + each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) { + v = v.split('='); + + if (v.length > 1) + o[tr(v[0])] = tr(v[1]); + else + o[tr(v[0])] = tr(v); + }); + } else + o = v; + + return o; + } + + return v; + }, + + nodeChanged : function(o) { + var t = this, s = t.selection, n = s.getNode() || t.getBody(); + + // Fix for bug #1896577 it seems that this can not be fired while the editor is loading + if (t.initialized) { + t.onNodeChange.dispatch( + t, + o ? o.controlManager || t.controlManager : t.controlManager, + isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n, // Fix for IE initial state + s.isCollapsed(), + o + ); + } + }, + + addButton : function(n, s) { + var t = this; + + t.buttons = t.buttons || {}; + t.buttons[n] = s; + }, + + addCommand : function(n, f, s) { + this.execCommands[n] = {func : f, scope : s || this}; + }, + + addQueryStateHandler : function(n, f, s) { + this.queryStateCommands[n] = {func : f, scope : s || this}; + }, + + addQueryValueHandler : function(n, f, s) { + this.queryValueCommands[n] = {func : f, scope : s || this}; + }, + + addShortcut : function(pa, desc, cmd_func, sc) { + var t = this, c; + + if (!t.settings.custom_shortcuts) + return false; + + t.shortcuts = t.shortcuts || {}; + + if (is(cmd_func, 'string')) { + c = cmd_func; + + cmd_func = function() { + t.execCommand(c, false, null); + }; + } + + if (is(cmd_func, 'object')) { + c = cmd_func; + + cmd_func = function() { + t.execCommand(c[0], c[1], c[2]); + }; + } + + each(explode(pa), function(pa) { + var o = { + func : cmd_func, + scope : sc || this, + desc : desc, + alt : false, + ctrl : false, + shift : false + }; + + each(explode(pa, '+'), function(v) { + switch (v) { + case 'alt': + case 'ctrl': + case 'shift': + o[v] = true; + break; + + default: + o.charCode = v.charCodeAt(0); + o.keyCode = v.toUpperCase().charCodeAt(0); + } + }); + + t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o; + }); + + return true; + }, + + execCommand : function(cmd, ui, val, a) { + var t = this, s = 0, o, st; + + if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus)) + t.focus(); + + o = {}; + t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o); + if (o.terminate) + return false; + + // Command callback + if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return true; + } + + // Registred commands + if (o = t.execCommands[cmd]) { + st = o.func.call(o.scope, ui, val); + + // Fall through on true + if (st !== true) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return st; + } + } + + // Plugin commands + each(t.plugins, function(p) { + if (p.execCommand && p.execCommand(cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + s = 1; + return false; + } + }); + + if (s) + return true; + + // Theme commands + if (t.theme && t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return true; + } + + // Execute global commands + if (tinymce.GlobalCommands.execCommand(t, cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return true; + } + + // Editor commands + if (t.editorCommands.execCommand(cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return true; + } + + // Browser commands + t.getDoc().execCommand(cmd, ui, val); + t.onExecCommand.dispatch(t, cmd, ui, val, a); + }, + + queryCommandState : function(c) { + var t = this, o, s; + + // Is hidden then return undefined + if (t._isHidden()) + return; + + // Registred commands + if (o = t.queryStateCommands[c]) { + s = o.func.call(o.scope); + + // Fall though on true + if (s !== true) + return s; + } + + // Registred commands + o = t.editorCommands.queryCommandState(c); + if (o !== -1) + return o; + + // Browser commands + try { + return this.getDoc().queryCommandState(c); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + }, + + queryCommandValue : function(c) { + var t = this, o, s; + + // Is hidden then return undefined + if (t._isHidden()) + return; + + // Registred commands + if (o = t.queryValueCommands[c]) { + s = o.func.call(o.scope); + + // Fall though on true + if (s !== true) + return s; + } + + // Registred commands + o = t.editorCommands.queryCommandValue(c); + if (is(o)) + return o; + + // Browser commands + try { + return this.getDoc().queryCommandValue(c); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + }, + + show : function() { + var t = this; + + DOM.show(t.getContainer()); + DOM.hide(t.id); + t.load(); + }, + + hide : function() { + var t = this, d = t.getDoc(); + + // Fixed bug where IE has a blinking cursor left from the editor + if (isIE && d) + d.execCommand('SelectAll'); + + // We must save before we hide so Safari doesn't crash + t.save(); + DOM.hide(t.getContainer()); + DOM.setStyle(t.id, 'display', t.orgDisplay); + }, + + isHidden : function() { + return !DOM.isHidden(this.id); + }, + + setProgressState : function(b, ti, o) { + this.onSetProgressState.dispatch(this, b, ti, o); + + return b; + }, + + resizeToContent : function() { + var t = this; + + DOM.setStyle(t.id + "_ifr", 'height', t.getBody().scrollHeight); + }, + + load : function(o) { + var t = this, e = t.getElement(), h; + + if (e) { + o = o || {}; + o.load = true; + + // Double encode existing entities in the value + h = t.setContent(is(e.value) ? e.value : e.innerHTML, o); + o.element = e; + + if (!o.no_events) + t.onLoadContent.dispatch(t, o); + + o.element = e = null; + + return h; + } + }, + + save : function(o) { + var t = this, e = t.getElement(), h, f; + + if (!e || !t.initialized) + return; + + o = o || {}; + o.save = true; + + // Add undo level will trigger onchange event + if (!o.no_events) { + t.undoManager.typing = 0; + t.undoManager.add(); + } + + o.element = e; + h = o.content = t.getContent(o); + + if (!o.no_events) + t.onSaveContent.dispatch(t, o); + + h = o.content; + + if (!/TEXTAREA|INPUT/i.test(e.nodeName)) { + e.innerHTML = h; + + // Update hidden form element + if (f = DOM.getParent(t.id, 'form')) { + each(f.elements, function(e) { + if (e.name == t.id) { + e.value = h; + return false; + } + }); + } + } else + e.value = h; + + o.element = e = null; + + return h; + }, + + setContent : function(h, o) { + var t = this; + + o = o || {}; + o.format = o.format || 'html'; + o.set = true; + o.content = h; + + if (!o.no_events) + t.onBeforeSetContent.dispatch(t, o); + + // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content + // It will also be impossible to place the caret in the editor unless there is a BR element present + if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) { + o.content = t.dom.setHTML(t.getBody(), '<br mce_bogus="1" />'); + o.format = 'raw'; + } + + o.content = t.dom.setHTML(t.getBody(), tinymce.trim(o.content)); + + if (o.format != 'raw' && t.settings.cleanup) { + o.getInner = true; + o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), o)); + } + + if (!o.no_events) + t.onSetContent.dispatch(t, o); + + return o.content; + }, + + getContent : function(o) { + var t = this, h; + + o = o || {}; + o.format = o.format || 'html'; + o.get = true; + + if (!o.no_events) + t.onBeforeGetContent.dispatch(t, o); + + if (o.format != 'raw' && t.settings.cleanup) { + o.getInner = true; + h = t.serializer.serialize(t.getBody(), o); + } else + h = t.getBody().innerHTML; + + h = h.replace(/^\s*|\s*$/g, ''); + o.content = h; + + if (!o.no_events) + t.onGetContent.dispatch(t, o); + + return o.content; + }, + + isDirty : function() { + var t = this; + + return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty; + }, + + getContainer : function() { + var t = this; + + if (!t.container) + t.container = DOM.get(t.editorContainer || t.id + '_parent'); + + return t.container; + }, + + getContentAreaContainer : function() { + return this.contentAreaContainer; + }, + + getElement : function() { + return DOM.get(this.settings.content_element || this.id); + }, + + getWin : function() { + var t = this, e; + + if (!t.contentWindow) { + e = DOM.get(t.id + "_ifr"); + + if (e) + t.contentWindow = e.contentWindow; + } + + return t.contentWindow; + }, + + getDoc : function() { + var t = this, w; + + if (!t.contentDocument) { + w = t.getWin(); + + if (w) + t.contentDocument = w.document; + } + + return t.contentDocument; + }, + + getBody : function() { + return this.bodyElement || this.getDoc().body; + }, + + convertURL : function(u, n, e) { + var t = this, s = t.settings; + + // Use callback instead + if (s.urlconverter_callback) + return t.execCallback('urlconverter_callback', u, e, true, n); + + // Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs + if (!s.convert_urls || (e && e.nodeName == 'LINK') || u.indexOf('file:') === 0) + return u; + + // Convert to relative + if (s.relative_urls) + return t.documentBaseURI.toRelative(u); + + // Convert to absolute + u = t.documentBaseURI.toAbsolute(u, s.remove_script_host); + + return u; + }, + + addVisual : function(e) { + var t = this, s = t.settings; + + e = e || t.getBody(); + + if (!is(t.hasVisual)) + t.hasVisual = s.visual; + + each(t.dom.select('table,a', e), function(e) { + var v; + + switch (e.nodeName) { + case 'TABLE': + v = t.dom.getAttrib(e, 'border'); + + if (!v || v == '0') { + if (t.hasVisual) + t.dom.addClass(e, s.visual_table_class); + else + t.dom.removeClass(e, s.visual_table_class); + } + + return; + + case 'A': + v = t.dom.getAttrib(e, 'name'); + + if (v) { + if (t.hasVisual) + t.dom.addClass(e, 'mceItemAnchor'); + else + t.dom.removeClass(e, 'mceItemAnchor'); + } + + return; + } + }); + + t.onVisualAid.dispatch(t, e, t.hasVisual); + }, + + remove : function() { + var t = this, e = t.getContainer(); + + t.removed = 1; // Cancels post remove event execution + t.hide(); + + t.execCallback('remove_instance_callback', t); + t.onRemove.dispatch(t); + + // Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command + t.onExecCommand.listeners = []; + + EditorManager.remove(t); + DOM.remove(e); + }, + + destroy : function(s) { + var t = this; + + // One time is enough + if (t.destroyed) + return; + + if (!s) { + tinymce.removeUnload(t.destroy); + tinyMCE.onBeforeUnload.remove(t._beforeUnload); + + // Manual destroy + if (t.theme && t.theme.destroy) + t.theme.destroy(); + + // Destroy controls, selection and dom + t.controlManager.destroy(); + t.selection.destroy(); + t.dom.destroy(); + + // Remove all events + + // Don't clear the window or document if content editable + // is enabled since other instances might still be present + if (!t.settings.content_editable) { + Event.clear(t.getWin()); + Event.clear(t.getDoc()); + } + + Event.clear(t.getBody()); + Event.clear(t.formElement); + } + + if (t.formElement) { + t.formElement.submit = t.formElement._mceOldSubmit; + t.formElement._mceOldSubmit = null; + } + + t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null; + + if (t.selection) + t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null; + + t.destroyed = 1; + }, + + // Internal functions + + _addEvents : function() { + // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset + var t = this, i, s = t.settings, lo = { + mouseup : 'onMouseUp', + mousedown : 'onMouseDown', + click : 'onClick', + keyup : 'onKeyUp', + keydown : 'onKeyDown', + keypress : 'onKeyPress', + submit : 'onSubmit', + reset : 'onReset', + contextmenu : 'onContextMenu', + dblclick : 'onDblClick', + paste : 'onPaste' // Doesn't work in all browsers yet + }; + + function eventHandler(e, o) { + var ty = e.type; + + // Don't fire events when it's removed + if (t.removed) + return; + + // Generic event handler + if (t.onEvent.dispatch(t, e, o) !== false) { + // Specific event handler + t[lo[e.fakeType || e.type]].dispatch(t, e, o); + } + }; + + // Add DOM events + each(lo, function(v, k) { + switch (k) { + case 'contextmenu': + if (tinymce.isOpera) { + // Fake contextmenu on Opera + Event.add(t.getBody(), 'mousedown', function(e) { + if (e.ctrlKey) { + e.fakeType = 'contextmenu'; + eventHandler(e); + } + }); + } else + Event.add(t.getBody(), k, eventHandler); + break; + + case 'paste': + Event.add(t.getBody(), k, function(e) { + eventHandler(e); + }); + break; + + case 'submit': + case 'reset': + Event.add(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler); + break; + + default: + Event.add(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler); + } + }); + + Event.add(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) { + t.focus(true); + }); + + + // Fixes bug where a specified document_base_uri could result in broken images + // This will also fix drag drop of images in Gecko + if (tinymce.isGecko) { + // Convert all images to absolute URLs +/* t.onSetContent.add(function(ed, o) { + each(ed.dom.select('img'), function(e) { + var v; + + if (v = e.getAttribute('mce_src')) + e.src = t.documentBaseURI.toAbsolute(v); + }) + });*/ + + Event.add(t.getDoc(), 'DOMNodeInserted', function(e) { + var v; + + e = e.target; + + if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('mce_src'))) + e.src = t.documentBaseURI.toAbsolute(v); + }); + } + + // Set various midas options in Gecko + if (isGecko) { + function setOpts() { + var t = this, d = t.getDoc(), s = t.settings; + + if (isGecko && !s.readonly) { + if (t._isHidden()) { + try { + if (!s.content_editable) + d.designMode = 'On'; + } catch (ex) { + // Fails if it's hidden + } + } + + try { + // Try new Gecko method + d.execCommand("styleWithCSS", 0, false); + } catch (ex) { + // Use old method + if (!t._isHidden()) + try {d.execCommand("useCSS", 0, true);} catch (ex) {} + } + + if (!s.table_inline_editing) + try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {} + + if (!s.object_resizing) + try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {} + } + }; + + t.onBeforeExecCommand.add(setOpts); + t.onMouseDown.add(setOpts); + } + + // Add node change handlers + t.onMouseUp.add(t.nodeChanged); + t.onClick.add(t.nodeChanged); + t.onKeyUp.add(function(ed, e) { + var c = e.keyCode; + + if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey) + t.nodeChanged(); + }); + + // Add reset handler + t.onReset.add(function() { + t.setContent(t.startContent, {format : 'raw'}); + }); + + // Add shortcuts + if (s.custom_shortcuts) { + if (s.custom_undo_redo_keyboard_shortcuts) { + t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo'); + t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo'); + } + + // Add default shortcuts for gecko + if (isGecko) { + t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold'); + t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic'); + t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline'); + } + + // BlockFormat shortcuts keys + for (i=1; i<=6; i++) + t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, '<h' + i + '>']); + + t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<p>']); + t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']); + t.addShortcut('ctrl+9', '', ['FormatBlock', false, '<address>']); + + function find(e) { + var v = null; + + if (!e.altKey && !e.ctrlKey && !e.metaKey) + return v; + + each(t.shortcuts, function(o) { + if (tinymce.isMac && o.ctrl != e.metaKey) + return; + else if (!tinymce.isMac && o.ctrl != e.ctrlKey) + return; + + if (o.alt != e.altKey) + return; + + if (o.shift != e.shiftKey) + return; + + if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) { + v = o; + return false; + } + }); + + return v; + }; + + t.onKeyUp.add(function(ed, e) { + var o = find(e); + + if (o) + return Event.cancel(e); + }); + + t.onKeyPress.add(function(ed, e) { + var o = find(e); + + if (o) + return Event.cancel(e); + }); + + t.onKeyDown.add(function(ed, e) { + var o = find(e); + + if (o) { + o.func.call(o.scope); + return Event.cancel(e); + } + }); + } + + if (tinymce.isIE) { + // Fix so resize will only update the width and height attributes not the styles of an image + // It will also block mceItemNoResize items + Event.add(t.getDoc(), 'controlselect', function(e) { + var re = t.resizeInfo, cb; + + e = e.target; + + // Don't do this action for non image elements + if (e.nodeName !== 'IMG') + return; + + if (re) + Event.remove(re.node, re.ev, re.cb); + + if (!t.dom.hasClass(e, 'mceItemNoResize')) { + ev = 'resizeend'; + cb = Event.add(e, ev, function(e) { + var v; + + e = e.target; + + if (v = t.dom.getStyle(e, 'width')) { + t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, '')); + t.dom.setStyle(e, 'width', ''); + } + + if (v = t.dom.getStyle(e, 'height')) { + t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, '')); + t.dom.setStyle(e, 'height', ''); + } + }); + } else { + ev = 'resizestart'; + cb = Event.add(e, 'resizestart', Event.cancel, Event); + } + + re = t.resizeInfo = { + node : e, + ev : ev, + cb : cb + }; + }); + + t.onKeyDown.add(function(ed, e) { + switch (e.keyCode) { + case 8: + // Fix IE control + backspace browser bug + if (t.selection.getRng().item) { + t.selection.getRng().item(0).removeNode(); + return Event.cancel(e); + } + } + }); + + /*if (t.dom.boxModel) { + t.getBody().style.height = '100%'; + + Event.add(t.getWin(), 'resize', function(e) { + var docElm = t.getDoc().documentElement; + + docElm.style.height = (docElm.offsetHeight - 10) + 'px'; + }); + }*/ + } + + if (tinymce.isOpera) { + t.onClick.add(function(ed, e) { + Event.prevent(e); + }); + } + + // Add custom undo/redo handlers + if (s.custom_undo_redo) { + function addUndo() { + t.undoManager.typing = 0; + t.undoManager.add(); + }; + + // Add undo level on editor blur + if (tinymce.isIE) { + Event.add(t.getWin(), 'blur', function(e) { + var n; + + // Check added for fullscreen bug + if (t.selection) { + n = t.selection.getNode(); + + // Add undo level is selection was lost to another document + if (!t.removed && n.ownerDocument && n.ownerDocument != t.getDoc()) + addUndo(); + } + }); + } else { + Event.add(t.getDoc(), 'blur', function() { + if (t.selection && !t.removed) + addUndo(); + }); + } + + t.onMouseDown.add(addUndo); + + t.onKeyUp.add(function(ed, e) { + if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey) { + t.undoManager.typing = 0; + t.undoManager.add(); + } + }); + + t.onKeyDown.add(function(ed, e) { + // Is caracter positon keys + if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) { + if (t.undoManager.typing) { + t.undoManager.add(); + t.undoManager.typing = 0; + } + + return; + } + + if (!t.undoManager.typing) { + t.undoManager.add(); + t.undoManager.typing = 1; + } + }); + } + }, + + _convertInlineElements : function() { + var t = this, s = t.settings, dom = t.dom, v, e, na, st, sp; + + function convert(ed, o) { + if (!s.inline_styles) + return; + + if (o.get) { + each(t.dom.select('table,u,strike', o.node), function(n) { + switch (n.nodeName) { + case 'TABLE': + if (v = dom.getAttrib(n, 'height')) { + dom.setStyle(n, 'height', v); + dom.setAttrib(n, 'height', ''); + } + break; + + case 'U': + case 'STRIKE': + //sp = dom.create('span', {style : dom.getAttrib(n, 'style')}); + n.style.textDecoration = n.nodeName == 'U' ? 'underline' : 'line-through'; + dom.setAttrib(n, 'mce_style', ''); + dom.setAttrib(n, 'mce_name', 'span'); + break; + } + }); + } else if (o.set) { + each(t.dom.select('table,span', o.node).reverse(), function(n) { + if (n.nodeName == 'TABLE') { + if (v = dom.getStyle(n, 'height')) + dom.setAttrib(n, 'height', v.replace(/[^0-9%]+/g, '')); + } else { + // Convert spans to elements + if (n.style.textDecoration == 'underline') + na = 'u'; + else if (n.style.textDecoration == 'line-through') + na = 'strike'; + else + na = ''; + + if (na) { + n.style.textDecoration = ''; + dom.setAttrib(n, 'mce_style', ''); + + e = dom.create(na, { + style : dom.getAttrib(n, 'style') + }); + + dom.replace(e, n, 1); + } + } + }); + } + }; + + t.onPreProcess.add(convert); + + if (!s.cleanup_on_startup) { + t.onSetContent.add(function(ed, o) { + if (o.initial) + convert(t, {node : t.getBody(), set : 1}); + }); + } + }, + + _convertFonts : function() { + var t = this, s = t.settings, dom = t.dom, fz, fzn, sl, cl; + + // No need + if (!s.inline_styles) + return; + + // Font pt values and font size names + fz = [8, 10, 12, 14, 18, 24, 36]; + fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; + + if (sl = s.font_size_style_values) + sl = explode(sl); + + if (cl = s.font_size_classes) + cl = explode(cl); + + function process(no) { + var n, sp, nl, x; + + // Keep unit tests happy + if (!s.inline_styles) + return; + + nl = t.dom.select('font', no); + for (x = nl.length - 1; x >= 0; x--) { + n = nl[x]; + + sp = dom.create('span', { + style : dom.getAttrib(n, 'style'), + 'class' : dom.getAttrib(n, 'class') + }); + + dom.setStyles(sp, { + fontFamily : dom.getAttrib(n, 'face'), + color : dom.getAttrib(n, 'color'), + backgroundColor : n.style.backgroundColor + }); + + if (n.size) { + if (sl) + dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]); + else + dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]); + } + + dom.setAttrib(sp, 'mce_style', ''); + dom.replace(sp, n, 1); + } + }; + + // Run on cleanup + t.onPreProcess.add(function(ed, o) { + if (o.get) + process(o.node); + }); + + t.onSetContent.add(function(ed, o) { + if (o.initial) + process(o.node); + }); + }, + + _isHidden : function() { + var s; + + if (!isGecko) + return 0; + + // Weird, wheres that cursor selection? + s = this.selection.getSel(); + return (!s || !s.rangeCount || s.rangeCount == 0); + }, + + // Fix for bug #1867292 + _fixNesting : function(s) { + var d = [], i; + + s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) { + var e; + + // Handle end element + if (b === '/') { + if (!d.length) + return ''; + + if (c !== d[d.length - 1].tag) { + for (i=d.length - 1; i>=0; i--) { + if (d[i].tag === c) { + d[i].close = 1; + break; + } + } + + return ''; + } else { + d.pop(); + + if (d.length && d[d.length - 1].close) { + a = a + '</' + d[d.length - 1].tag + '>'; + d.pop(); + } + } + } else { + // Ignore these + if (/^(br|hr|input|meta|img|link|param)$/i.test(c)) + return a; + + // Ignore closed ones + if (/\/>$/.test(a)) + return a; + + d.push({tag : c}); // Push start element + } + + return a; + }); + + // End all open tags + for (i=d.length - 1; i>=0; i--) + s += '</' + d[i].tag + '>'; + + return s; + } + + }); +})(tinymce); +(function(tinymce) { + var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit; + + tinymce.create('tinymce.EditorCommands', { + EditorCommands : function(ed) { + this.editor = ed; + }, + + execCommand : function(cmd, ui, val) { + var t = this, ed = t.editor, f; + + switch (cmd) { + // Ignore these + case 'mceResetDesignMode': + case 'mceBeginUndoLevel': + return true; + + // Ignore these + case 'unlink': + t.UnLink(); + return true; + + // Bundle these together + case 'JustifyLeft': + case 'JustifyCenter': + case 'JustifyRight': + case 'JustifyFull': + t.mceJustify(cmd, cmd.substring(7).toLowerCase()); + return true; + + default: + f = this[cmd]; + + if (f) { + f.call(this, ui, val); + return true; + } + } + + return false; + }, + + Indent : function() { + var ed = this.editor, d = ed.dom, s = ed.selection, e, iv, iu; + + // Setup indent level + iv = ed.settings.indentation; + iu = /[a-z%]+$/i.exec(iv); + iv = parseInt(iv); + + if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) { + each(s.getSelectedBlocks(), function(e) { + d.setStyle(e, 'paddingLeft', (parseInt(e.style.paddingLeft || 0) + iv) + iu); + }); + + return; + } + + ed.getDoc().execCommand('Indent', false, null); + + if (isIE) { + d.getParent(s.getNode(), function(n) { + if (n.nodeName == 'BLOCKQUOTE') { + n.dir = n.style.cssText = ''; + } + }); + } + }, + + Outdent : function() { + var ed = this.editor, d = ed.dom, s = ed.selection, e, v, iv, iu; + + // Setup indent level + iv = ed.settings.indentation; + iu = /[a-z%]+$/i.exec(iv); + iv = parseInt(iv); + + if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) { + each(s.getSelectedBlocks(), function(e) { + v = Math.max(0, parseInt(e.style.paddingLeft || 0) - iv); + d.setStyle(e, 'paddingLeft', v ? v + iu : ''); + }); + + return; + } + + ed.getDoc().execCommand('Outdent', false, null); + }, + +/* + mceSetAttribute : function(u, v) { + var ed = this.editor, d = ed.dom, e; + + if (e = d.getParent(ed.selection.getNode(), d.isBlock)) + d.setAttrib(e, v.name, v.value); + }, +*/ + mceSetContent : function(u, v) { + this.editor.setContent(v); + }, + + mceToggleVisualAid : function() { + var ed = this.editor; + + ed.hasVisual = !ed.hasVisual; + ed.addVisual(); + }, + + mceReplaceContent : function(u, v) { + var s = this.editor.selection; + + s.setContent(v.replace(/\{\$selection\}/g, s.getContent({format : 'text'}))); + }, + + mceInsertLink : function(u, v) { + var ed = this.editor, s = ed.selection, e = ed.dom.getParent(s.getNode(), 'a'); + + if (tinymce.is(v, 'string')) + v = {href : v}; + + function set(e) { + each(v, function(v, k) { + ed.dom.setAttrib(e, k, v); + }); + }; + + if (!e) { + ed.execCommand('CreateLink', false, 'javascript:mctmp(0);'); + each(ed.dom.select('a[href=javascript:mctmp(0);]'), function(e) { + set(e); + }); + } else { + if (v.href) + set(e); + else + ed.dom.remove(e, 1); + } + }, + + UnLink : function() { + var ed = this.editor, s = ed.selection; + + if (s.isCollapsed()) + s.select(s.getNode()); + + ed.getDoc().execCommand('unlink', false, null); + s.collapse(0); + }, + + FontName : function(u, v) { + var t = this, ed = t.editor, s = ed.selection, e; + + if (!v) { + if (s.isCollapsed()) + s.select(s.getNode()); + } else { + if (ed.settings.convert_fonts_to_spans) + t._applyInlineStyle('span', {style : {fontFamily : v}}); + else + ed.getDoc().execCommand('FontName', false, v); + } + }, + + FontSize : function(u, v) { + var ed = this.editor, s = ed.settings, fc, fs; + + // Use style options instead + if (s.convert_fonts_to_spans && v >= 1 && v <= 7) { + fs = tinymce.explode(s.font_size_style_values); + fc = tinymce.explode(s.font_size_classes); + + if (fc) + v = fc[v - 1] || v; + else + v = fs[v - 1] || v; + } + + if (v >= 1 && v <= 7) + ed.getDoc().execCommand('FontSize', false, v); + else + this._applyInlineStyle('span', {style : {fontSize : v}}); + }, + + queryCommandValue : function(c) { + var f = this['queryValue' + c]; + + if (f) + return f.call(this, c); + + return false; + }, + + queryCommandState : function(cmd) { + var f; + + switch (cmd) { + // Bundle these together + case 'JustifyLeft': + case 'JustifyCenter': + case 'JustifyRight': + case 'JustifyFull': + return this.queryStateJustify(cmd, cmd.substring(7).toLowerCase()); + + default: + if (f = this['queryState' + cmd]) + return f.call(this, cmd); + } + + return -1; + }, + + _queryState : function(c) { + try { + return this.editor.getDoc().queryCommandState(c); + } catch (ex) { + // Ignore exception + } + }, + + _queryVal : function(c) { + try { + return this.editor.getDoc().queryCommandValue(c); + } catch (ex) { + // Ignore exception + } + }, + + queryValueFontSize : function() { + var ed = this.editor, v = 0, p; + + if (p = ed.dom.getParent(ed.selection.getNode(), 'span')) + v = p.style.fontSize; + + if (!v && (isOpera || isWebKit)) { + if (p = ed.dom.getParent(ed.selection.getNode(), 'font')) + v = p.size; + + return v; + } + + return v || this._queryVal('FontSize'); + }, + + queryValueFontName : function() { + var ed = this.editor, v = 0, p; + + if (p = ed.dom.getParent(ed.selection.getNode(), 'font')) + v = p.face; + + if (p = ed.dom.getParent(ed.selection.getNode(), 'span')) + v = p.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase(); + + if (!v) + v = this._queryVal('FontName'); + + return v; + }, + + mceJustify : function(c, v) { + var ed = this.editor, se = ed.selection, n = se.getNode(), nn = n.nodeName, bl, nb, dom = ed.dom, rm; + + if (ed.settings.inline_styles && this.queryStateJustify(c, v)) + rm = 1; + + bl = dom.getParent(n, ed.dom.isBlock); + + if (nn == 'IMG') { + if (v == 'full') + return; + + if (rm) { + if (v == 'center') + dom.setStyle(bl || n.parentNode, 'textAlign', ''); + + dom.setStyle(n, 'float', ''); + this.mceRepaint(); + return; + } + + if (v == 'center') { + // Do not change table elements + if (bl && /^(TD|TH)$/.test(bl.nodeName)) + bl = 0; + + if (!bl || bl.childNodes.length > 1) { + nb = dom.create('p'); + nb.appendChild(n.cloneNode(false)); + + if (bl) + dom.insertAfter(nb, bl); + else + dom.insertAfter(nb, n); + + dom.remove(n); + n = nb.firstChild; + bl = nb; + } + + dom.setStyle(bl, 'textAlign', v); + dom.setStyle(n, 'float', ''); + } else { + dom.setStyle(n, 'float', v); + dom.setStyle(bl || n.parentNode, 'textAlign', ''); + } + + this.mceRepaint(); + return; + } + + // Handle the alignment outselfs, less quirks in all browsers + if (ed.settings.inline_styles && ed.settings.forced_root_block) { + if (rm) + v = ''; + + each(se.getSelectedBlocks(dom.getParent(se.getStart(), dom.isBlock), dom.getParent(se.getEnd(), dom.isBlock)), function(e) { + dom.setAttrib(e, 'align', ''); + dom.setStyle(e, 'textAlign', v == 'full' ? 'justify' : v); + }); + + return; + } else if (!rm) + ed.getDoc().execCommand(c, false, null); + + if (ed.settings.inline_styles) { + if (rm) { + dom.getParent(ed.selection.getNode(), function(n) { + if (n.style && n.style.textAlign) + dom.setStyle(n, 'textAlign', ''); + }); + + return; + } + + each(dom.select('*'), function(n) { + var v = n.align; + + if (v) { + if (v == 'full') + v = 'justify'; + + dom.setStyle(n, 'textAlign', v); + dom.setAttrib(n, 'align', ''); + } + }); + } + }, + + mceSetCSSClass : function(u, v) { + this.mceSetStyleInfo(0, {command : 'setattrib', name : 'class', value : v}); + }, + + getSelectedElement : function() { + var t = this, ed = t.editor, dom = ed.dom, se = ed.selection, r = se.getRng(), r1, r2, sc, ec, so, eo, e, sp, ep, re; + + if (se.isCollapsed() || r.item) + return se.getNode(); + + // Setup regexp + re = ed.settings.merge_styles_invalid_parents; + if (tinymce.is(re, 'string')) + re = new RegExp(re, 'i'); + + if (isIE) { + r1 = r.duplicate(); + r1.collapse(true); + sc = r1.parentElement(); + + r2 = r.duplicate(); + r2.collapse(false); + ec = r2.parentElement(); + + if (sc != ec) { + r1.move('character', 1); + sc = r1.parentElement(); + } + + if (sc == ec) { + r1 = r.duplicate(); + r1.moveToElementText(sc); + + if (r1.compareEndPoints('StartToStart', r) == 0 && r1.compareEndPoints('EndToEnd', r) == 0) + return re && re.test(sc.nodeName) ? null : sc; + } + } else { + function getParent(n) { + return dom.getParent(n, '*'); + }; + + sc = r.startContainer; + ec = r.endContainer; + so = r.startOffset; + eo = r.endOffset; + + if (!r.collapsed) { + if (sc == ec) { + if (so - eo < 2) { + if (sc.hasChildNodes()) { + sp = sc.childNodes[so]; + return re && re.test(sp.nodeName) ? null : sp; + } + } + } + } + + if (sc.nodeType != 3 || ec.nodeType != 3) + return null; + + if (so == 0) { + sp = getParent(sc); + + if (sp && sp.firstChild != sc) + sp = null; + } + + if (so == sc.nodeValue.length) { + e = sc.nextSibling; + + if (e && e.nodeType == 1) + sp = sc.nextSibling; + } + + if (eo == 0) { + e = ec.previousSibling; + + if (e && e.nodeType == 1) + ep = e; + } + + if (eo == ec.nodeValue.length) { + ep = getParent(ec); + + if (ep && ep.lastChild != ec) + ep = null; + } + + // Same element + if (sp == ep) + return re && sp && re.test(sp.nodeName) ? null : sp; + } + + return null; + }, + + mceSetStyleInfo : function(u, v) { + var t = this, ed = t.editor, d = ed.getDoc(), dom = ed.dom, e, b, s = ed.selection, nn = v.wrapper || 'span', b = s.getBookmark(), re; + + function set(n, e) { + if (n.nodeType == 1) { + switch (v.command) { + case 'setattrib': + return dom.setAttrib(n, v.name, v.value); + + case 'setstyle': + return dom.setStyle(n, v.name, v.value); + + case 'removeformat': + return dom.setAttrib(n, 'class', ''); + } + } + }; + + // Setup regexp + re = ed.settings.merge_styles_invalid_parents; + if (tinymce.is(re, 'string')) + re = new RegExp(re, 'i'); + + // Set style info on selected element + if ((e = t.getSelectedElement()) && !ed.settings.force_span_wrappers) + set(e, 1); + else { + // Generate wrappers and set styles on them + d.execCommand('FontName', false, '__'); + each(dom.select('span,font'), function(n) { + var sp, e; + + if (dom.getAttrib(n, 'face') == '__' || n.style.fontFamily === '__') { + sp = dom.create(nn, {mce_new : '1'}); + + set(sp); + + each (n.childNodes, function(n) { + sp.appendChild(n.cloneNode(true)); + }); + + dom.replace(sp, n); + } + }); + } + + // Remove wrappers inside new ones + each(dom.select(nn).reverse(), function(n) { + var p = n.parentNode; + + // Check if it's an old span in a new wrapper + if (!dom.getAttrib(n, 'mce_new')) { + // Find new wrapper + p = dom.getParent(n, '*[mce_new]'); + + if (p) + dom.remove(n, 1); + } + }); + + // Merge wrappers with parent wrappers + each(dom.select(nn).reverse(), function(n) { + var p = n.parentNode; + + if (!p || !dom.getAttrib(n, 'mce_new')) + return; + + if (ed.settings.force_span_wrappers && p.nodeName != 'SPAN') + return; + + // Has parent of the same type and only child + if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1) + return dom.remove(p, 1); + + // Has parent that is more suitable to have the class and only child + if (n.nodeType == 1 && (!re || !re.test(p.nodeName)) && p.childNodes.length == 1) { + set(p); // Set style info on parent instead + dom.setAttrib(n, 'class', ''); + } + }); + + // Remove empty wrappers + each(dom.select(nn).reverse(), function(n) { + if (dom.getAttrib(n, 'mce_new') || (dom.getAttribs(n).length <= 1 && n.className === '')) { + if (!dom.getAttrib(n, 'class') && !dom.getAttrib(n, 'style')) + return dom.remove(n, 1); + + dom.setAttrib(n, 'mce_new', ''); // Remove mce_new marker + } + }); + + s.moveToBookmark(b); + }, + + queryStateJustify : function(c, v) { + var ed = this.editor, n = ed.selection.getNode(), dom = ed.dom; + + if (n && n.nodeName == 'IMG') { + if (dom.getStyle(n, 'float') == v) + return 1; + + return n.parentNode.style.textAlign == v; + } + + n = dom.getParent(ed.selection.getStart(), function(n) { + return n.nodeType == 1 && n.style.textAlign; + }); + + if (v == 'full') + v = 'justify'; + + if (ed.settings.inline_styles) + return (n && n.style.textAlign == v); + + return this._queryState(c); + }, + + ForeColor : function(ui, v) { + var ed = this.editor; + + if (ed.settings.convert_fonts_to_spans) { + this._applyInlineStyle('span', {style : {color : v}}); + return; + } else + ed.getDoc().execCommand('ForeColor', false, v); + }, + + HiliteColor : function(ui, val) { + var t = this, ed = t.editor, d = ed.getDoc(); + + if (ed.settings.convert_fonts_to_spans) { + this._applyInlineStyle('span', {style : {backgroundColor : val}}); + return; + } + + function set(s) { + if (!isGecko) + return; + + try { + // Try new Gecko method + d.execCommand("styleWithCSS", 0, s); + } catch (ex) { + // Use old + d.execCommand("useCSS", 0, !s); + } + }; + + if (isGecko || isOpera) { + set(true); + d.execCommand('hilitecolor', false, val); + set(false); + } else + d.execCommand('BackColor', false, val); + }, + + FormatBlock : function(ui, val) { + var t = this, ed = t.editor, s = ed.selection, dom = ed.dom, bl, nb, b; + + function isBlock(n) { + return /^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName); + }; + + bl = dom.getParent(s.getNode(), function(n) { + return isBlock(n); + }); + + // IE has an issue where it removes the parent div if you change format on the paragrah in <div><p>Content</p></div> + // FF and Opera doesn't change parent DIV elements if you switch format + if (bl) { + if ((isIE && isBlock(bl.parentNode)) || bl.nodeName == 'DIV') { + // Rename block element + nb = ed.dom.create(val); + + each(dom.getAttribs(bl), function(v) { + dom.setAttrib(nb, v.nodeName, dom.getAttrib(bl, v.nodeName)); + }); + + b = s.getBookmark(); + dom.replace(nb, bl, 1); + s.moveToBookmark(b); + ed.nodeChanged(); + return; + } + } + + val = ed.settings.forced_root_block ? (val || '<p>') : val; + + if (val.indexOf('<') == -1) + val = '<' + val + '>'; + + if (tinymce.isGecko) + val = val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi, '$1'); + + ed.getDoc().execCommand('FormatBlock', false, val); + }, + + mceCleanup : function() { + var ed = this.editor, s = ed.selection, b = s.getBookmark(); + ed.setContent(ed.getContent()); + s.moveToBookmark(b); + }, + + mceRemoveNode : function(ui, val) { + var ed = this.editor, s = ed.selection, b, n = val || s.getNode(); + + // Make sure that the body node isn't removed + if (n == ed.getBody()) + return; + + b = s.getBookmark(); + ed.dom.remove(n, 1); + s.moveToBookmark(b); + ed.nodeChanged(); + }, + + mceSelectNodeDepth : function(ui, val) { + var ed = this.editor, s = ed.selection, c = 0; + + ed.dom.getParent(s.getNode(), function(n) { + if (n.nodeType == 1 && c++ == val) { + s.select(n); + ed.nodeChanged(); + return false; + } + }, ed.getBody()); + }, + + mceSelectNode : function(u, v) { + this.editor.selection.select(v); + }, + + mceInsertContent : function(ui, val) { + this.editor.selection.setContent(val); + }, + + mceInsertRawHTML : function(ui, val) { + var ed = this.editor; + + ed.selection.setContent('tiny_mce_marker'); + ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val)); + }, + + mceRepaint : function() { + var s, b, e = this.editor; + + if (tinymce.isGecko) { + try { + s = e.selection; + b = s.getBookmark(true); + + if (s.getSel()) + s.getSel().selectAllChildren(e.getBody()); + + s.collapse(true); + s.moveToBookmark(b); + } catch (ex) { + // Ignore + } + } + }, + + queryStateUnderline : function() { + var ed = this.editor, n = ed.selection.getNode(); + + if (n && n.nodeName == 'A') + return false; + + return this._queryState('Underline'); + }, + + queryStateOutdent : function() { + var ed = this.editor, n; + + if (ed.settings.inline_styles) { + if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0) + return true; + + if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0) + return true; + } + + return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList() || (!ed.settings.inline_styles && !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE')); + }, + + queryStateInsertUnorderedList : function() { + return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL'); + }, + + queryStateInsertOrderedList : function() { + return this.editor.dom.getParent(this.editor.selection.getNode(), 'OL'); + }, + + queryStatemceBlockQuote : function() { + return !!this.editor.dom.getParent(this.editor.selection.getStart(), function(n) {return n.nodeName === 'BLOCKQUOTE';}); + }, + + _applyInlineStyle : function(na, at, op) { + var t = this, ed = t.editor, dom = ed.dom, bm, lo = {}, kh, found; + + na = na.toUpperCase(); + + if (op && op.check_classes && at['class']) + op.check_classes.push(at['class']); + + function removeEmpty() { + each(dom.select(na).reverse(), function(n) { + var c = 0; + + // Check if there is any attributes + each(dom.getAttribs(n), function(an) { + if (an.nodeName.substring(0, 1) != '_' && dom.getAttrib(n, an.nodeName) != '') { + //console.log(dom.getOuterHTML(n), dom.getAttrib(n, an.nodeName)); + c++; + } + }); + + // No attributes then remove the element and keep the children + if (c == 0) + dom.remove(n, 1); + }); + }; + + function replaceFonts() { + var bm; + + each(dom.select('span,font'), function(n) { + if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') { + if (!bm) + bm = ed.selection.getBookmark(); + + at._mce_new = '1'; + dom.replace(dom.create(na, at), n, 1); + } + }); + + // Remove redundant elements + each(dom.select(na + '[_mce_new]'), function(n) { + function removeStyle(n) { + if (n.nodeType == 1) { + each(at.style, function(v, k) { + dom.setStyle(n, k, ''); + }); + + // Remove spans with the same class or marked classes + if (at['class'] && n.className && op) { + each(op.check_classes, function(c) { + if (dom.hasClass(n, c)) + dom.removeClass(n, c); + }); + } + } + }; + + // Remove specified style information from child elements + each(dom.select(na, n), removeStyle); + + // Remove the specified style information on parent if current node is only child (IE) + if (n.parentNode && n.parentNode.nodeType == 1 && n.parentNode.childNodes.length == 1) + removeStyle(n.parentNode); + + // Remove the child elements style info if a parent already has it + dom.getParent(n.parentNode, function(pn) { + if (pn.nodeType == 1) { + if (at.style) { + each(at.style, function(v, k) { + var sv; + + if (!lo[k] && (sv = dom.getStyle(pn, k))) { + if (sv === v) + dom.setStyle(n, k, ''); + + lo[k] = 1; + } + }); + } + + // Remove spans with the same class or marked classes + if (at['class'] && pn.className && op) { + each(op.check_classes, function(c) { + if (dom.hasClass(pn, c)) + dom.removeClass(n, c); + }); + } + } + + return false; + }); + + n.removeAttribute('_mce_new'); + }); + + removeEmpty(); + ed.selection.moveToBookmark(bm); + + return !!bm; + }; + + // Create inline elements + ed.focus(); + ed.getDoc().execCommand('FontName', false, 'mceinline'); + replaceFonts(); + + if (kh = t._applyInlineStyle.keyhandler) { + ed.onKeyUp.remove(kh); + ed.onKeyPress.remove(kh); + ed.onKeyDown.remove(kh); + ed.onSetContent.remove(t._applyInlineStyle.chandler); + } + + if (ed.selection.isCollapsed()) { + // IE will format the current word so this code can't be executed on that browser + if (!isIE) { + each(dom.getParents(ed.selection.getNode(), 'span'), function(n) { + each(at.style, function(v, k) { + var kv; + + if (kv = dom.getStyle(n, k)) { + if (kv == v) { + dom.setStyle(n, k, ''); + found = 2; + return false; + } + + found = 1; + return false; + } + }); + + if (found) + return false; + }); + + if (found == 2) { + bm = ed.selection.getBookmark(); + + removeEmpty(); + + ed.selection.moveToBookmark(bm); + + // Node change needs to be detached since the onselect event + // for the select box will run the onclick handler after onselect call. Todo: Add a nicer fix! + window.setTimeout(function() { + ed.nodeChanged(); + }, 1); + + return; + } + } + + // Start collecting styles + t._pendingStyles = tinymce.extend(t._pendingStyles || {}, at.style); + + t._applyInlineStyle.chandler = ed.onSetContent.add(function() { + delete t._pendingStyles; + }); + + t._applyInlineStyle.keyhandler = kh = function(e) { + // Use pending styles + if (t._pendingStyles) { + at.style = t._pendingStyles; + delete t._pendingStyles; + } + + if (replaceFonts()) { + ed.onKeyDown.remove(t._applyInlineStyle.keyhandler); + ed.onKeyPress.remove(t._applyInlineStyle.keyhandler); + } + + if (e.type == 'keyup') + ed.onKeyUp.remove(t._applyInlineStyle.keyhandler); + }; + + ed.onKeyDown.add(kh); + ed.onKeyPress.add(kh); + ed.onKeyUp.add(kh); + } else + t._pendingStyles = 0; + } + }); +})(tinymce);(function(tinymce) { + tinymce.create('tinymce.UndoManager', { + index : 0, + data : null, + typing : 0, + + UndoManager : function(ed) { + var t = this, Dispatcher = tinymce.util.Dispatcher; + + t.editor = ed; + t.data = []; + t.onAdd = new Dispatcher(this); + t.onUndo = new Dispatcher(this); + t.onRedo = new Dispatcher(this); + }, + + add : function(l) { + var t = this, i, ed = t.editor, b, s = ed.settings, la; + + l = l || {}; + l.content = l.content || ed.getContent({format : 'raw', no_events : 1}); + + // Add undo level if needed + l.content = l.content.replace(/^\s*|\s*$/g, ''); + la = t.data[t.index > 0 && (t.index == 0 || t.index == t.data.length) ? t.index - 1 : t.index]; + if (!l.initial && la && l.content == la.content) + return null; + + // Time to compress + if (s.custom_undo_redo_levels) { + if (t.data.length > s.custom_undo_redo_levels) { + for (i = 0; i < t.data.length - 1; i++) + t.data[i] = t.data[i + 1]; + + t.data.length--; + t.index = t.data.length; + } + } + + if (s.custom_undo_redo_restore_selection && !l.initial) + l.bookmark = b = l.bookmark || ed.selection.getBookmark(); + + if (t.index < t.data.length) + t.index++; + + // Only initial marked undo levels should be allowed as first item + // This to workaround a bug with Firefox and the blur event + if (t.data.length === 0 && !l.initial) + return null; + + // Add level + t.data.length = t.index + 1; + t.data[t.index++] = l; + + if (l.initial) + t.index = 0; + + // Set initial bookmark use first real undo level + if (t.data.length == 2 && t.data[0].initial) + t.data[0].bookmark = b; + + t.onAdd.dispatch(t, l); + ed.isNotDirty = 0; + + //console.dir(t.data); + + return l; + }, + + undo : function() { + var t = this, ed = t.editor, l = l, i; + + if (t.typing) { + t.add(); + t.typing = 0; + } + + if (t.index > 0) { + // If undo on last index then take snapshot + if (t.index == t.data.length && t.index > 1) { + i = t.index; + t.typing = 0; + + if (!t.add()) + t.index = i; + + --t.index; + } + + l = t.data[--t.index]; + ed.setContent(l.content, {format : 'raw'}); + ed.selection.moveToBookmark(l.bookmark); + + t.onUndo.dispatch(t, l); + } + + return l; + }, + + redo : function() { + var t = this, ed = t.editor, l = null; + + if (t.index < t.data.length - 1) { + l = t.data[++t.index]; + ed.setContent(l.content, {format : 'raw'}); + ed.selection.moveToBookmark(l.bookmark); + + t.onRedo.dispatch(t, l); + } + + return l; + }, + + clear : function() { + var t = this; + + t.data = []; + t.index = 0; + t.typing = 0; + t.add({initial : true}); + }, + + hasUndo : function() { + return this.index != 0 || this.typing; + }, + + hasRedo : function() { + return this.index < this.data.length - 1; + } + + }); +})(tinymce); +(function(tinymce) { + // Shorten names + var Event, isIE, isGecko, isOpera, each, extend; + + Event = tinymce.dom.Event; + isIE = tinymce.isIE; + isGecko = tinymce.isGecko; + isOpera = tinymce.isOpera; + each = tinymce.each; + extend = tinymce.extend; + + function isEmpty(n) { + n = n.innerHTML; + n = n.replace(/<\w+ .*?mce_\w+\"?=.*?>/gi, '-'); // Keep tags with mce_ attribs + n = n.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi, '-'); // Keep these convert them to - chars + n = n.replace(/<[^>]+>/g, ''); // Remove all tags + + return n.replace(/[ \t\r\n]+/g, '') == ''; + }; + + tinymce.create('tinymce.ForceBlocks', { + ForceBlocks : function(ed) { + var t = this, s = ed.settings, elm; + + t.editor = ed; + t.dom = ed.dom; + elm = (s.forced_root_block || 'p').toLowerCase(); + s.element = elm.toUpperCase(); + + ed.onPreInit.add(t.setup, t); + + t.reOpera = new RegExp('(\\u00a0| | )<\/' + elm + '>', 'gi'); + t.rePadd = new RegExp('<p( )([^>]+)><\\\/p>|<p( )([^>]+)\\\/>|<p( )([^>]+)>\\s+<\\\/p>|<p><\\\/p>|<p\\\/>|<p>\\s+<\\\/p>'.replace(/p/g, elm), 'gi'); + t.reNbsp2BR1 = new RegExp('<p( )([^>]+)>[\\s\\u00a0]+<\\\/p>|<p>[\\s\\u00a0]+<\\\/p>'.replace(/p/g, elm), 'gi'); + t.reNbsp2BR2 = new RegExp('<%p()([^>]+)>( | )<\\\/%p>|<%p>( | )<\\\/%p>'.replace(/%p/g, elm), 'gi'); + t.reBR2Nbsp = new RegExp('<p( )([^>]+)>\\s*<br \\\/>\\s*<\\\/p>|<p>\\s*<br \\\/>\\s*<\\\/p>'.replace(/p/g, elm), 'gi'); + + function padd(ed, o) { + if (isOpera) + o.content = o.content.replace(t.reOpera, '</' + elm + '>'); + + o.content = o.content.replace(t.rePadd, '<' + elm + '$1$2$3$4$5$6>\u00a0</' + elm + '>'); + + if (!isIE && !isOpera && o.set) { + // Use instead of BR in padded paragraphs + o.content = o.content.replace(t.reNbsp2BR1, '<' + elm + '$1$2><br /></' + elm + '>'); + o.content = o.content.replace(t.reNbsp2BR2, '<' + elm + '$1$2><br /></' + elm + '>'); + } else + o.content = o.content.replace(t.reBR2Nbsp, '<' + elm + '$1$2>\u00a0</' + elm + '>'); + }; + + ed.onBeforeSetContent.add(padd); + ed.onPostProcess.add(padd); + + if (s.forced_root_block) { + ed.onInit.add(t.forceRoots, t); + ed.onSetContent.add(t.forceRoots, t); + ed.onBeforeGetContent.add(t.forceRoots, t); + } + }, + + setup : function() { + var t = this, ed = t.editor, s = ed.settings; + + // Force root blocks when typing and when getting output + if (s.forced_root_block) { + ed.onKeyUp.add(t.forceRoots, t); + ed.onPreProcess.add(t.forceRoots, t); + } + + if (s.force_br_newlines) { + // Force IE to produce BRs on enter + if (isIE) { + ed.onKeyPress.add(function(ed, e) { + var n, s = ed.selection; + + if (e.keyCode == 13 && s.getNode().nodeName != 'LI') { + s.setContent('<br id="__" /> ', {format : 'raw'}); + n = ed.dom.get('__'); + n.removeAttribute('id'); + s.select(n); + s.collapse(); + return Event.cancel(e); + } + }); + } + + return; + } + + if (!isIE && s.force_p_newlines) { +/* ed.onPreProcess.add(function(ed, o) { + each(ed.dom.select('br', o.node), function(n) { + var p = n.parentNode; + + // Replace <p><br /></p> with <p> </p> + if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n)) { + p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n); + } + }); + });*/ + + ed.onKeyPress.add(function(ed, e) { + if (e.keyCode == 13 && !e.shiftKey) { + if (!t.insertPara(e)) + Event.cancel(e); + } + }); + + if (isGecko) { + ed.onKeyDown.add(function(ed, e) { + if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) + t.backspaceDelete(e, e.keyCode == 8); + }); + } + } + + function ren(rn, na) { + var ne = ed.dom.create(na); + + each(rn.attributes, function(a) { + if (a.specified && a.nodeValue) + ne.setAttribute(a.nodeName.toLowerCase(), a.nodeValue); + }); + + each(rn.childNodes, function(n) { + ne.appendChild(n.cloneNode(true)); + }); + + rn.parentNode.replaceChild(ne, rn); + + return ne; + }; + + // IE specific fixes + if (isIE) { + // Remove empty inline elements within block elements + // For example: <p><strong><em></em></strong></p> + ed.onPreProcess.add(function(ed, o) { + each(ed.dom.select('p,h1,h2,h3,h4,h5,h6,div', o.node), function(p) { + if (isEmpty(p)) + p.innerHTML = ''; + }); + }); + + // Replaces IE:s auto generated paragraphs with the specified element name + if (s.element != 'P') { + ed.onKeyPress.add(function(ed, e) { + t.lastElm = ed.selection.getNode().nodeName; + }); + + ed.onKeyUp.add(function(ed, e) { + var bl, sel = ed.selection, n = sel.getNode(), b = ed.getBody(); + + if (b.childNodes.length === 1 && n.nodeName == 'P') { + n = ren(n, s.element); + sel.select(n); + sel.collapse(); + ed.nodeChanged(); + } else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') { + bl = ed.dom.getParent(n, 'p'); + + if (bl) { + ren(bl, s.element); + ed.nodeChanged(); + } + } + }); + } + } + }, + + find : function(n, t, s) { + var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -1; + + while (n = w.nextNode()) { + c++; + + // Index by node + if (t == 0 && n == s) + return c; + + // Node by index + if (t == 1 && c == s) + return n; + } + + return -1; + }, + + forceRoots : function(ed, e) { + var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF; + var nx, bl, bp, sp, le, nl = b.childNodes, i, n, eid; + + // Fix for bug #1863847 + //if (e && e.keyCode == 13) + // return true; + + // Wrap non blocks into blocks + for (i = nl.length - 1; i >= 0; i--) { + nx = nl[i]; + + // Is text or non block element + if (nx.nodeType == 3 || (!t.dom.isBlock(nx) && nx.nodeType != 8)) { + if (!bl) { + // Create new block but ignore whitespace + if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) { + // Store selection + if (si == -2 && r) { + if (!isIE) { + // If selection is element then mark it + if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) { + // Save the id of the selected element + eid = n.getAttribute("id"); + n.setAttribute("id", "__mce"); + } else { + // If element is inside body, might not be the case in contentEdiable mode + if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) { + so = r.startOffset; + eo = r.endOffset; + si = t.find(b, 0, r.startContainer); + ei = t.find(b, 0, r.endContainer); + } + } + } else { + tr = d.body.createTextRange(); + tr.moveToElementText(b); + tr.collapse(1); + bp = tr.move('character', c) * -1; + + tr = r.duplicate(); + tr.collapse(1); + sp = tr.move('character', c) * -1; + + tr = r.duplicate(); + tr.collapse(0); + le = (tr.move('character', c) * -1) - sp; + + si = sp - bp; + ei = le; + } + } + + bl = ed.dom.create(ed.settings.forced_root_block); + bl.appendChild(nx.cloneNode(1)); + nx.parentNode.replaceChild(bl, nx); + } + } else { + if (bl.hasChildNodes()) + bl.insertBefore(nx, bl.firstChild); + else + bl.appendChild(nx); + } + } else + bl = null; // Time to create new block + } + + // Restore selection + if (si != -2) { + if (!isIE) { + bl = b.getElementsByTagName(ed.settings.element)[0]; + r = d.createRange(); + + // Select last location or generated block + if (si != -1) + r.setStart(t.find(b, 1, si), so); + else + r.setStart(bl, 0); + + // Select last location or generated block + if (ei != -1) + r.setEnd(t.find(b, 1, ei), eo); + else + r.setEnd(bl, 0); + + if (s) { + s.removeAllRanges(); + s.addRange(r); + } + } else { + try { + r = s.createRange(); + r.moveToElementText(b); + r.collapse(1); + r.moveStart('character', si); + r.moveEnd('character', ei); + r.select(); + } catch (ex) { + // Ignore + } + } + } else if (!isIE && (n = ed.dom.get('__mce'))) { + // Restore the id of the selected element + if (eid) + n.setAttribute('id', eid); + else + n.removeAttribute('id'); + + // Move caret before selected element + r = d.createRange(); + r.setStartBefore(n); + r.setEndBefore(n); + se.setRng(r); + } + }, + + getParentBlock : function(n) { + var d = this.dom; + + return d.getParent(n, d.isBlock); + }, + + insertPara : function(e) { + var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body; + var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car; + + // If root blocks are forced then use Operas default behavior since it's really good +// Removed due to bug: #1853816 +// if (se.forced_root_block && isOpera) +// return true; + + // Setup before range + rb = d.createRange(); + + // If is before the first block element and in body, then move it into first block element + rb.setStart(s.anchorNode, s.anchorOffset); + rb.collapse(true); + + // Setup after range + ra = d.createRange(); + + // If is before the first block element and in body, then move it into first block element + ra.setStart(s.focusNode, s.focusOffset); + ra.collapse(true); + + // Setup start/end points + dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0; + sn = dir ? s.anchorNode : s.focusNode; + so = dir ? s.anchorOffset : s.focusOffset; + en = dir ? s.focusNode : s.anchorNode; + eo = dir ? s.focusOffset : s.anchorOffset; + + // If selection is in empty table cell + if (sn === en && /^(TD|TH)$/.test(sn.nodeName)) { + if (sn.firstChild.nodeName == 'BR') + dom.remove(sn.firstChild); // Remove BR + + // Create two new block elements + if (sn.childNodes.length == 0) { + ed.dom.add(sn, se.element, null, '<br />'); + aft = ed.dom.add(sn, se.element, null, '<br />'); + } else { + n = sn.innerHTML; + sn.innerHTML = ''; + ed.dom.add(sn, se.element, null, n); + aft = ed.dom.add(sn, se.element, null, '<br />'); + } + + // Move caret into the last one + r = d.createRange(); + r.selectNodeContents(aft); + r.collapse(1); + ed.selection.setRng(r); + + return false; + } + + // If the caret is in an invalid location in FF we need to move it into the first block + if (sn == b && en == b && b.firstChild && ed.dom.isBlock(b.firstChild)) { + sn = en = sn.firstChild; + so = eo = 0; + rb = d.createRange(); + rb.setStart(sn, 0); + ra = d.createRange(); + ra.setStart(en, 0); + } + + // Never use body as start or end node + sn = sn.nodeName == "HTML" ? d.body : sn; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes + sn = sn.nodeName == "BODY" ? sn.firstChild : sn; + en = en.nodeName == "HTML" ? d.body : en; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes + en = en.nodeName == "BODY" ? en.firstChild : en; + + // Get start and end blocks + sb = t.getParentBlock(sn); + eb = t.getParentBlock(en); + bn = sb ? sb.nodeName : se.element; // Get block name to create + + // Return inside list use default browser behavior + if (t.dom.getParent(sb, 'ol,ul,pre')) + return true; + + // If caption or absolute layers then always generate new blocks within + if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) { + bn = se.element; + sb = null; + } + + // If caption or absolute layers then always generate new blocks within + if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) { + bn = se.element; + eb = null; + } + + // Use P instead + if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(dom.getStyle(sb, 'float', 1)))) { + bn = se.element; + sb = eb = null; + } + + // Setup new before and after blocks + bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : ed.dom.create(bn); + aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : ed.dom.create(bn); + + // Remove id from after clone + aft.removeAttribute('id'); + + // Is header and cursor is at the end, then force paragraph under + if (/^(H[1-6])$/.test(bn) && sn.nodeValue && so == sn.nodeValue.length) + aft = ed.dom.create(se.element); + + // Find start chop node + n = sc = sn; + do { + if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName)) + break; + + sc = n; + } while ((n = n.previousSibling ? n.previousSibling : n.parentNode)); + + // Find end chop node + n = ec = en; + do { + if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName)) + break; + + ec = n; + } while ((n = n.nextSibling ? n.nextSibling : n.parentNode)); + + // Place first chop part into before block element + if (sc.nodeName == bn) + rb.setStart(sc, 0); + else + rb.setStartBefore(sc); + + rb.setEnd(sn, so); + bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari + + // Place secnd chop part within new block element + try { + ra.setEndAfter(ec); + } catch(ex) { + //console.debug(s.focusNode, s.focusOffset); + } + + ra.setStart(en, eo); + aft.appendChild(ra.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari + + // Create range around everything + r = d.createRange(); + if (!sc.previousSibling && sc.parentNode.nodeName == bn) { + r.setStartBefore(sc.parentNode); + } else { + if (rb.startContainer.nodeName == bn && rb.startOffset == 0) + r.setStartBefore(rb.startContainer); + else + r.setStart(rb.startContainer, rb.startOffset); + } + + if (!ec.nextSibling && ec.parentNode.nodeName == bn) + r.setEndAfter(ec.parentNode); + else + r.setEnd(ra.endContainer, ra.endOffset); + + // Delete and replace it with new block elements + r.deleteContents(); + + if (isOpera) + ed.getWin().scrollTo(0, vp.y); + + // Never wrap blocks in blocks + if (bef.firstChild && bef.firstChild.nodeName == bn) + bef.innerHTML = bef.firstChild.innerHTML; + + if (aft.firstChild && aft.firstChild.nodeName == bn) + aft.innerHTML = aft.firstChild.innerHTML; + + // Padd empty blocks + if (isEmpty(bef)) + bef.innerHTML = '<br />'; + + function appendStyles(e, en) { + var nl = [], nn, n, i; + + e.innerHTML = ''; + + // Make clones of style elements + if (se.keep_styles) { + n = en; + do { + // We only want style specific elements + if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) { + nn = n.cloneNode(false); + dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique + nl.push(nn); + } + } while (n = n.parentNode); + } + + // Append style elements to aft + if (nl.length > 0) { + for (i = nl.length - 1, nn = e; i >= 0; i--) + nn = nn.appendChild(nl[i]); + + // Padd most inner style element + nl[0].innerHTML = isOpera ? ' ' : '<br />'; // Extra space for Opera so that the caret can move there + return nl[0]; // Move caret to most inner element + } else + e.innerHTML = isOpera ? ' ' : '<br />'; // Extra space for Opera so that the caret can move there + }; + + // Fill empty afterblook with current style + if (isEmpty(aft)) + car = appendStyles(aft, en); + + // Opera needs this one backwards for older versions + if (isOpera && parseFloat(opera.version()) < 9.5) { + r.insertNode(bef); + r.insertNode(aft); + } else { + r.insertNode(aft); + r.insertNode(bef); + } + + // Normalize + aft.normalize(); + bef.normalize(); + + function first(n) { + return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() || n; + }; + + // Move cursor and scroll into view + r = d.createRange(); + r.selectNodeContents(isGecko ? first(car || aft) : car || aft); + r.collapse(1); + s.removeAllRanges(); + s.addRange(r); + + // scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs + y = ed.dom.getPos(aft).y; + ch = aft.clientHeight; + + // Is element within viewport + if (y < vp.y || y + ch > vp.y + vp.h) { + ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks + //console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight)); + } + + return false; + }, + + backspaceDelete : function(e, bs) { + var t = this, ed = t.editor, b = ed.getBody(), n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn; + + // The caret sometimes gets stuck in Gecko if you delete empty paragraphs + // This workaround removes the element by hand and moves the caret to the previous element + if (sc && ed.dom.isBlock(sc) && !/^(TD|TH)$/.test(sc.nodeName) && bs) { + if (sc.childNodes.length == 0 || (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR')) { + // Find previous block element + n = sc; + while ((n = n.previousSibling) && !ed.dom.isBlock(n)) ; + + if (n) { + if (sc != b.firstChild) { + // Find last text node + w = ed.dom.doc.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); + while (tn = w.nextNode()) + n = tn; + + // Place caret at the end of last text node + r = ed.getDoc().createRange(); + r.setStart(n, n.nodeValue ? n.nodeValue.length : 0); + r.setEnd(n, n.nodeValue ? n.nodeValue.length : 0); + se.setRng(r); + + // Remove the target container + ed.dom.remove(sc); + } + + return Event.cancel(e); + } + } + } + + // Gecko generates BR elements here and there, we don't like those so lets remove them + function handler(e) { + var pr; + + e = e.target; + + // A new BR was created in a block element, remove it + if (e && e.parentNode && e.nodeName == 'BR' && (n = t.getParentBlock(e))) { + pr = e.previousSibling; + + Event.remove(b, 'DOMNodeInserted', handler); + + // Is there whitespace at the end of the node before then we might need the pesky BR + // to place the caret at a correct location see bug: #2013943 + if (pr && pr.nodeType == 3 && /\s+$/.test(pr.nodeValue)) + return; + + // Only remove BR elements that got inserted in the middle of the text + if (e.previousSibling || e.nextSibling) + ed.dom.remove(e); + } + }; + + // Listen for new nodes + Event._add(b, 'DOMNodeInserted', handler); + + // Remove listener + window.setTimeout(function() { + Event._remove(b, 'DOMNodeInserted', handler); + }, 1); + } + }); +})(tinymce); +(function(tinymce) { + // Shorten names + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend; + + tinymce.create('tinymce.ControlManager', { + ControlManager : function(ed, s) { + var t = this, i; + + s = s || {}; + t.editor = ed; + t.controls = {}; + t.onAdd = new tinymce.util.Dispatcher(t); + t.onPostRender = new tinymce.util.Dispatcher(t); + t.prefix = s.prefix || ed.id + '_'; + t._cls = {}; + + t.onPostRender.add(function() { + each(t.controls, function(c) { + c.postRender(); + }); + }); + }, + + get : function(id) { + return this.controls[this.prefix + id] || this.controls[id]; + }, + + setActive : function(id, s) { + var c = null; + + if (c = this.get(id)) + c.setActive(s); + + return c; + }, + + setDisabled : function(id, s) { + var c = null; + + if (c = this.get(id)) + c.setDisabled(s); + + return c; + }, + + add : function(c) { + var t = this; + + if (c) { + t.controls[c.id] = c; + t.onAdd.dispatch(c, t); + } + + return c; + }, + + createControl : function(n) { + var c, t = this, ed = t.editor; + + each(ed.plugins, function(p) { + if (p.createControl) { + c = p.createControl(n, t); + + if (c) + return false; + } + }); + + switch (n) { + case "|": + case "separator": + return t.createSeparator(); + } + + if (!c && ed.buttons && (c = ed.buttons[n])) + return t.createButton(n, c); + + return t.add(c); + }, + + createDropMenu : function(id, s, cc) { + var t = this, ed = t.editor, c, bm, v, cls; + + s = extend({ + 'class' : 'mceDropDown', + constrain : ed.settings.constrain_menus + }, s); + + s['class'] = s['class'] + ' ' + ed.getParam('skin') + 'Skin'; + if (v = ed.getParam('skin_variant')) + s['class'] += ' ' + ed.getParam('skin') + 'Skin' + v.substring(0, 1).toUpperCase() + v.substring(1); + + id = t.prefix + id; + cls = cc || t._cls.dropmenu || tinymce.ui.DropMenu; + c = t.controls[id] = new cls(id, s); + c.onAddItem.add(function(c, o) { + var s = o.settings; + + s.title = ed.getLang(s.title, s.title); + + if (!s.onclick) { + s.onclick = function(v) { + ed.execCommand(s.cmd, s.ui || false, s.value); + }; + } + }); + + ed.onRemove.add(function() { + c.destroy(); + }); + + // Fix for bug #1897785, #1898007 + if (tinymce.isIE) { + c.onShowMenu.add(function() { + // IE 8 needs focus in order to store away a range with the current collapsed caret location + ed.focus(); + + bm = ed.selection.getBookmark(1); + }); + + c.onHideMenu.add(function() { + if (bm) { + ed.selection.moveToBookmark(bm); + bm = 0; + } + }); + } + + return t.add(c); + }, + + createListBox : function(id, s, cc) { + var t = this, ed = t.editor, cmd, c, cls; + + if (t.get(id)) + return null; + + s.title = ed.translate(s.title); + s.scope = s.scope || ed; + + if (!s.onselect) { + s.onselect = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + s = extend({ + title : s.title, + 'class' : 'mce_' + id, + scope : s.scope, + control_manager : t + }, s); + + id = t.prefix + id; + + if (ed.settings.use_native_selects) + c = new tinymce.ui.NativeListBox(id, s); + else { + cls = cc || t._cls.listbox || tinymce.ui.ListBox; + c = new cls(id, s); + } + + t.controls[id] = c; + + // Fix focus problem in Safari + if (tinymce.isWebKit) { + c.onPostRender.add(function(c, n) { + // Store bookmark on mousedown + Event.add(n, 'mousedown', function() { + ed.bookmark = ed.selection.getBookmark('simple'); + }); + + // Restore on focus, since it might be lost + Event.add(n, 'focus', function() { + ed.selection.moveToBookmark(ed.bookmark); + ed.bookmark = null; + }); + }); + } + + if (c.hideMenu) + ed.onMouseDown.add(c.hideMenu, c); + + return t.add(c); + }, + + createButton : function(id, s, cc) { + var t = this, ed = t.editor, o, c, cls; + + if (t.get(id)) + return null; + + s.title = ed.translate(s.title); + s.label = ed.translate(s.label); + s.scope = s.scope || ed; + + if (!s.onclick && !s.menu_button) { + s.onclick = function() { + ed.execCommand(s.cmd, s.ui || false, s.value); + }; + } + + s = extend({ + title : s.title, + 'class' : 'mce_' + id, + unavailable_prefix : ed.getLang('unavailable', ''), + scope : s.scope, + control_manager : t + }, s); + + id = t.prefix + id; + + if (s.menu_button) { + cls = cc || t._cls.menubutton || tinymce.ui.MenuButton; + c = new cls(id, s); + ed.onMouseDown.add(c.hideMenu, c); + } else { + cls = t._cls.button || tinymce.ui.Button; + c = new cls(id, s); + } + + return t.add(c); + }, + + createMenuButton : function(id, s, cc) { + s = s || {}; + s.menu_button = 1; + + return this.createButton(id, s, cc); + }, + + createSplitButton : function(id, s, cc) { + var t = this, ed = t.editor, cmd, c, cls; + + if (t.get(id)) + return null; + + s.title = ed.translate(s.title); + s.scope = s.scope || ed; + + if (!s.onclick) { + s.onclick = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + if (!s.onselect) { + s.onselect = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + s = extend({ + title : s.title, + 'class' : 'mce_' + id, + scope : s.scope, + control_manager : t + }, s); + + id = t.prefix + id; + cls = cc || t._cls.splitbutton || tinymce.ui.SplitButton; + c = t.add(new cls(id, s)); + ed.onMouseDown.add(c.hideMenu, c); + + return c; + }, + + createColorSplitButton : function(id, s, cc) { + var t = this, ed = t.editor, cmd, c, cls, bm; + + if (t.get(id)) + return null; + + s.title = ed.translate(s.title); + s.scope = s.scope || ed; + + if (!s.onclick) { + s.onclick = function(v) { + if (tinymce.isIE) + bm = ed.selection.getBookmark(1); + + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + if (!s.onselect) { + s.onselect = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + s = extend({ + title : s.title, + 'class' : 'mce_' + id, + 'menu_class' : ed.getParam('skin') + 'Skin', + scope : s.scope, + more_colors_title : ed.getLang('more_colors') + }, s); + + id = t.prefix + id; + cls = cc || t._cls.colorsplitbutton || tinymce.ui.ColorSplitButton; + c = new cls(id, s); + ed.onMouseDown.add(c.hideMenu, c); + + // Remove the menu element when the editor is removed + ed.onRemove.add(function() { + c.destroy(); + }); + + // Fix for bug #1897785, #1898007 + if (tinymce.isIE) { + c.onHideMenu.add(function() { + if (bm) { + ed.selection.moveToBookmark(bm); + bm = 0; + } + }); + } + + return t.add(c); + }, + + createToolbar : function(id, s, cc) { + var c, t = this, cls; + + id = t.prefix + id; + cls = cc || t._cls.toolbar || tinymce.ui.Toolbar; + c = new cls(id, s); + + if (t.get(id)) + return null; + + return t.add(c); + }, + + createSeparator : function(cc) { + var cls = cc || this._cls.separator || tinymce.ui.Separator; + + return new cls(); + }, + + setControlType : function(n, c) { + return this._cls[n.toLowerCase()] = c; + }, + + destroy : function() { + each(this.controls, function(c) { + c.destroy(); + }); + + this.controls = null; + } + + }); +})(tinymce); +(function(tinymce) { + var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera; + + tinymce.create('tinymce.WindowManager', { + WindowManager : function(ed) { + var t = this; + + t.editor = ed; + t.onOpen = new Dispatcher(t); + t.onClose = new Dispatcher(t); + t.params = {}; + t.features = {}; + }, + + open : function(s, p) { + var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort(), u; + + // Default some options + s = s || {}; + p = p || {}; + sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window + sh = isOpera ? vp.h : screen.height; + s.name = s.name || 'mc_' + new Date().getTime(); + s.width = parseInt(s.width || 320); + s.height = parseInt(s.height || 240); + s.resizable = true; + s.left = s.left || parseInt(sw / 2.0) - (s.width / 2.0); + s.top = s.top || parseInt(sh / 2.0) - (s.height / 2.0); + p.inline = false; + p.mce_width = s.width; + p.mce_height = s.height; + p.mce_auto_focus = s.auto_focus; + + if (mo) { + if (isIE) { + s.center = true; + s.help = false; + s.dialogWidth = s.width + 'px'; + s.dialogHeight = s.height + 'px'; + s.scroll = s.scrollbars || false; + } + } + + // Build features string + each(s, function(v, k) { + if (tinymce.is(v, 'boolean')) + v = v ? 'yes' : 'no'; + + if (!/^(name|url)$/.test(k)) { + if (isIE && mo) + f += (f ? ';' : '') + k + ':' + v; + else + f += (f ? ',' : '') + k + '=' + v; + } + }); + + t.features = s; + t.params = p; + t.onOpen.dispatch(t, s, p); + + u = s.url || s.file; + u = tinymce._addVer(u); + + try { + if (isIE && mo) { + w = 1; + window.showModalDialog(u, window, f); + } else + w = window.open(u, s.name, f); + } catch (ex) { + // Ignore + } + + if (!w) + alert(t.editor.getLang('popup_blocked')); + }, + + close : function(w) { + w.close(); + this.onClose.dispatch(this); + }, + + createInstance : function(cl, a, b, c, d, e) { + var f = tinymce.resolve(cl); + + return new f(a, b, c, d, e); + }, + + confirm : function(t, cb, s, w) { + w = w || window; + + cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t)))); + }, + + alert : function(tx, cb, s, w) { + var t = this; + + w = w || window; + w.alert(t._decode(t.editor.getLang(tx, tx))); + + if (cb) + cb.call(s || t); + }, + + // Internal functions + + _decode : function(s) { + return tinymce.DOM.decode(s).replace(/\\n/g, '\n'); + } + + }); +}(tinymce));(function(tinymce) { + tinymce.CommandManager = function() { + var execCommands = {}, queryStateCommands = {}, queryValueCommands = {}; + + function add(collection, cmd, func, scope) { + if (typeof(cmd) == 'string') + cmd = [cmd]; + + tinymce.each(cmd, function(cmd) { + collection[cmd.toLowerCase()] = {func : func, scope : scope}; + }); + }; + + tinymce.extend(this, { + add : function(cmd, func, scope) { + add(execCommands, cmd, func, scope); + }, + + addQueryStateHandler : function(cmd, func, scope) { + add(queryStateCommands, cmd, func, scope); + }, + + addQueryValueHandler : function(cmd, func, scope) { + add(queryValueCommands, cmd, func, scope); + }, + + execCommand : function(scope, cmd, ui, value, args) { + if (cmd = execCommands[cmd.toLowerCase()]) { + if (cmd.func.call(scope || cmd.scope, ui, value, args) !== false) + return true; + } + }, + + queryCommandValue : function() { + if (cmd = queryValueCommands[cmd.toLowerCase()]) + return cmd.func.call(scope || cmd.scope, ui, value, args); + }, + + queryCommandState : function() { + if (cmd = queryStateCommands[cmd.toLowerCase()]) + return cmd.func.call(scope || cmd.scope, ui, value, args); + } + }); + }; + + tinymce.GlobalCommands = new tinymce.CommandManager(); +})(tinymce);(function(tinymce) { + function processRange(dom, start, end, callback) { + var ancestor, n, startPoint, endPoint, sib; + + function findEndPoint(n, c) { + do { + if (n.parentNode == c) + return n; + + n = n.parentNode; + } while(n); + }; + + function process(n) { + callback(n); + tinymce.walk(n, callback, 'childNodes'); + }; + + // Find common ancestor and end points + ancestor = dom.findCommonAncestor(start, end); + startPoint = findEndPoint(start, ancestor) || start; + endPoint = findEndPoint(end, ancestor) || end; + + // Process left leaf + for (n = start; n && n != startPoint; n = n.parentNode) { + for (sib = n.nextSibling; sib; sib = sib.nextSibling) + process(sib); + } + + // Process middle from start to end point + if (startPoint != endPoint) { + for (n = startPoint.nextSibling; n && n != endPoint; n = n.nextSibling) + process(n); + } else + process(startPoint); + + // Process right leaf + for (n = end; n && n != endPoint; n = n.parentNode) { + for (sib = n.previousSibling; sib; sib = sib.previousSibling) + process(sib); + } + }; + + tinymce.GlobalCommands.add('RemoveFormat', function() { + var ed = this, dom = ed.dom, s = ed.selection, r = s.getRng(1), nodes = [], bm, start, end, sc, so, ec, eo, n; + + function findFormatRoot(n) { + var sp; + + dom.getParent(n, function(n) { + if (dom.is(n, ed.getParam('removeformat_selector'))) + sp = n; + + return dom.isBlock(n); + }, ed.getBody()); + + return sp; + }; + + function collect(n) { + if (dom.is(n, ed.getParam('removeformat_selector'))) + nodes.push(n); + }; + + function walk(n) { + collect(n); + tinymce.walk(n, collect, 'childNodes'); + }; + + bm = s.getBookmark(); + sc = r.startContainer; + ec = r.endContainer; + so = r.startOffset; + eo = r.endOffset; + sc = sc.nodeType == 1 ? sc.childNodes[Math.min(so, sc.childNodes.length - 1)] : sc; + ec = ec.nodeType == 1 ? ec.childNodes[Math.min(so == eo ? eo : eo - 1, ec.childNodes.length - 1)] : ec; + + // Same container + if (sc == ec) { // TEXT_NODE + start = findFormatRoot(sc); + + // Handle single text node + if (sc.nodeType == 3) { + if (start && start.nodeType == 1) { // ELEMENT + n = sc.splitText(so); + n.splitText(eo - so); + dom.split(start, n); + + s.moveToBookmark(bm); + } + + return; + } + + // Handle single element + walk(dom.split(start, sc) || sc); + } else { + // Find start/end format root + start = findFormatRoot(sc); + end = findFormatRoot(ec); + + // Split start text node + if (start) { + if (sc.nodeType == 3) { // TEXT + // Since IE doesn't support white space nodes in the DOM we need to + // add this invisible character so that the splitText function can split the contents + if (so == sc.nodeValue.length) + sc.nodeValue += '\uFEFF'; // Yet another pesky IE fix + + sc = sc.splitText(so); + } + } + + // Split end text node + if (end) { + if (ec.nodeType == 3) // TEXT + ec.splitText(eo); + } + + // If the start and end format root is the same then we need to wrap + // the end node in a span since the split calls might change the reference + // Example: <p><b><em>x[yz<span>---</span>12]3</em></b></p> + if (start && start == end) + dom.replace(dom.create('span', {id : '__end'}, ec.cloneNode(true)), ec); + + // Split all start containers down to the format root + if (start) + start = dom.split(start, sc); + else + start = sc; + + // If there is a span wrapper use that one instead + if (n = dom.get('__end')) { + ec = n; + end = findFormatRoot(ec); + } + + // Split all end containers down to the format root + if (end) + end = dom.split(end, ec); + else + end = ec; + + // Collect nodes in between + processRange(dom, start, end, collect); + + // Remove invisible character for IE workaround if we find it + if (sc.nodeValue == '\uFEFF') + sc.nodeValue = ''; + + // Process start/end container elements + walk(ec); + walk(sc); + } + + // Remove all collected nodes + tinymce.each(nodes, function(n) { + dom.remove(n, 1); + }); + + // Remove leftover wrapper + dom.remove('__end', 1); + + s.moveToBookmark(bm); + }); +})(tinymce); +(function(tinymce) { + tinymce.GlobalCommands.add('mceBlockQuote', function() { + var ed = this, s = ed.selection, dom = ed.dom, sb, eb, n, bm, bq, r, bq2, i, nl; + + function getBQ(e) { + return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';}); + }; + + // Get start/end block + sb = dom.getParent(s.getStart(), dom.isBlock); + eb = dom.getParent(s.getEnd(), dom.isBlock); + + // Remove blockquote(s) + if (bq = getBQ(sb)) { + if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR')) + bm = s.getBookmark(); + + // Move all elements after the end block into new bq + if (getBQ(eb)) { + bq2 = bq.cloneNode(false); + + while (n = eb.nextSibling) + bq2.appendChild(n.parentNode.removeChild(n)); + } + + // Add new bq after + if (bq2) + dom.insertAfter(bq2, bq); + + // Move all selected blocks after the current bq + nl = s.getSelectedBlocks(sb, eb); + for (i = nl.length - 1; i >= 0; i--) { + dom.insertAfter(nl[i], bq); + } + + // Empty bq, then remove it + if (/^\s*$/.test(bq.innerHTML)) + dom.remove(bq, 1); // Keep children so boomark restoration works correctly + + // Empty bq, then remote it + if (bq2 && /^\s*$/.test(bq2.innerHTML)) + dom.remove(bq2, 1); // Keep children so boomark restoration works correctly + + if (!bm) { + // Move caret inside empty block element + if (!tinymce.isIE) { + r = ed.getDoc().createRange(); + r.setStart(sb, 0); + r.setEnd(sb, 0); + s.setRng(r); + } else { + s.select(sb); + s.collapse(0); + + // IE misses the empty block some times element so we must move back the caret + if (dom.getParent(s.getStart(), dom.isBlock) != sb) { + r = s.getRng(); + r.move('character', -1); + r.select(); + } + } + } else + ed.selection.moveToBookmark(bm); + + return; + } + + // Since IE can start with a totally empty document we need to add the first bq and paragraph + if (tinymce.isIE && !sb && !eb) { + ed.getDoc().execCommand('Indent'); + n = getBQ(s.getNode()); + n.style.margin = n.dir = ''; // IE adds margin and dir to bq + return; + } + + if (!sb || !eb) + return; + + // If empty paragraph node then do not use bookmark + if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR')) + bm = s.getBookmark(); + + // Move selected block elements into a bq + tinymce.each(s.getSelectedBlocks(getBQ(s.getStart()), getBQ(s.getEnd())), function(e) { + // Found existing BQ add to this one + if (e.nodeName == 'BLOCKQUOTE' && !bq) { + bq = e; + return; + } + + // No BQ found, create one + if (!bq) { + bq = dom.create('blockquote'); + e.parentNode.insertBefore(bq, e); + } + + // Add children from existing BQ + if (e.nodeName == 'BLOCKQUOTE' && bq) { + n = e.firstChild; + + while (n) { + bq.appendChild(n.cloneNode(true)); + n = n.nextSibling; + } + + dom.remove(e); + return; + } + + // Add non BQ element to BQ + bq.appendChild(dom.remove(e)); + }); + + if (!bm) { + // Move caret inside empty block element + if (!tinymce.isIE) { + r = ed.getDoc().createRange(); + r.setStart(sb, 0); + r.setEnd(sb, 0); + s.setRng(r); + } else { + s.select(sb); + s.collapse(1); + } + } else + s.moveToBookmark(bm); + }); +})(tinymce); +(function(tinymce) { + tinymce.each(['Cut', 'Copy', 'Paste'], function(cmd) { + tinymce.GlobalCommands.add(cmd, function() { + var ed = this, doc = ed.getDoc(); + + try { + doc.execCommand(cmd, false, null); + + // On WebKit the command will just be ignored if it's not enabled + if (!doc.queryCommandSupported(cmd)) + throw 'Error'; + } catch (ex) { + ed.windowManager.alert(ed.getLang('clipboard_no_support')); + } + }); + }); +})(tinymce); +(function(tinymce) { + tinymce.GlobalCommands.add('InsertHorizontalRule', function() { + if (tinymce.isOpera) + return this.getDoc().execCommand('InsertHorizontalRule', false, ''); + + this.selection.setContent('<hr />'); + }); +})(tinymce); +(function() { + var cmds = tinymce.GlobalCommands; + + cmds.add(['mceEndUndoLevel', 'mceAddUndoLevel'], function() { + this.undoManager.add(); + }); + + cmds.add('Undo', function() { + var ed = this; + + if (ed.settings.custom_undo_redo) { + ed.undoManager.undo(); + ed.nodeChanged(); + return true; + } + + return false; // Run browser command + }); + + cmds.add('Redo', function() { + var ed = this; + + if (ed.settings.custom_undo_redo) { + ed.undoManager.redo(); + ed.nodeChanged(); + return true; + } + + return false; // Run browser command + }); +})(); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/utils/editable_selects.js b/maarch_entreprise/trunk/tools/tiny_mce/utils/editable_selects.js new file mode 100644 index 0000000000000000000000000000000000000000..fff4963922fc308353ee186715b162d2f4c240ce --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/utils/editable_selects.js @@ -0,0 +1,69 @@ +/** + * $Id: editable_selects.js 867 2008-06-09 20:33:40Z spocke $ + * + * Makes select boxes editable. + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +var TinyMCE_EditableSelects = { + editSelectElm : null, + + init : function() { + var nl = document.getElementsByTagName("select"), i, d = document, o; + + for (i=0; i<nl.length; i++) { + if (nl[i].className.indexOf('mceEditableSelect') != -1) { + o = new Option('(value)', '__mce_add_custom__'); + + o.className = 'mceAddSelectValue'; + + nl[i].options[nl[i].options.length] = o; + nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect; + } + } + }, + + onChangeEditableSelect : function(e) { + var d = document, ne, se = window.event ? window.event.srcElement : e.target; + + if (se.options[se.selectedIndex].value == '__mce_add_custom__') { + ne = d.createElement("input"); + ne.id = se.id + "_custom"; + ne.name = se.name + "_custom"; + ne.type = "text"; + + ne.style.width = se.offsetWidth + 'px'; + se.parentNode.insertBefore(ne, se); + se.style.display = 'none'; + ne.focus(); + ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput; + ne.onkeydown = TinyMCE_EditableSelects.onKeyDown; + TinyMCE_EditableSelects.editSelectElm = se; + } + }, + + onBlurEditableSelectInput : function() { + var se = TinyMCE_EditableSelects.editSelectElm; + + if (se) { + if (se.previousSibling.value != '') { + addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value); + selectByValue(document.forms[0], se.id, se.previousSibling.value); + } else + selectByValue(document.forms[0], se.id, ''); + + se.style.display = 'inline'; + se.parentNode.removeChild(se.previousSibling); + TinyMCE_EditableSelects.editSelectElm = null; + } + }, + + onKeyDown : function(e) { + e = e || window.event; + + if (e.keyCode == 13) + TinyMCE_EditableSelects.onBlurEditableSelectInput(); + } +}; diff --git a/maarch_entreprise/trunk/tools/tiny_mce/utils/form_utils.js b/maarch_entreprise/trunk/tools/tiny_mce/utils/form_utils.js new file mode 100644 index 0000000000000000000000000000000000000000..dd45e730de2c72c5af2278f1ed117b327c5f1755 --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/utils/form_utils.js @@ -0,0 +1,199 @@ +/** + * $Id: form_utils.js 996 2009-02-06 17:32:20Z spocke $ + * + * Various form utilitiy functions. + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme")); + +function getColorPickerHTML(id, target_form_element) { + var h = ""; + + h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">'; + h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>'; + + return h; +} + +function updateColor(img_id, form_element_id) { + document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value; +} + +function setBrowserDisabled(id, state) { + var img = document.getElementById(id); + var lnk = document.getElementById(id + "_link"); + + if (lnk) { + if (state) { + lnk.setAttribute("realhref", lnk.getAttribute("href")); + lnk.removeAttribute("href"); + tinyMCEPopup.dom.addClass(img, 'disabled'); + } else { + if (lnk.getAttribute("realhref")) + lnk.setAttribute("href", lnk.getAttribute("realhref")); + + tinyMCEPopup.dom.removeClass(img, 'disabled'); + } + } +} + +function getBrowserHTML(id, target_form_element, type, prefix) { + var option = prefix + "_" + type + "_browser_callback", cb, html; + + cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback")); + + if (!cb) + return ""; + + html = ""; + html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">'; + html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>'; + + return html; +} + +function openBrowser(img_id, target_form_element, type, option) { + var img = document.getElementById(img_id); + + if (img.className != "mceButtonDisabled") + tinyMCEPopup.openBrowser(target_form_element, type, option); +} + +function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { + if (!form_obj || !form_obj.elements[field_name]) + return; + + var sel = form_obj.elements[field_name]; + + var found = false; + for (var i=0; i<sel.options.length; i++) { + var option = sel.options[i]; + + if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) { + option.selected = true; + found = true; + } else + option.selected = false; + } + + if (!found && add_custom && value != '') { + var option = new Option(value, value); + option.selected = true; + sel.options[sel.options.length] = option; + sel.selectedIndex = sel.options.length - 1; + } + + return found; +} + +function getSelectValue(form_obj, field_name) { + var elm = form_obj.elements[field_name]; + + if (elm == null || elm.options == null) + return ""; + + return elm.options[elm.selectedIndex].value; +} + +function addSelectValue(form_obj, field_name, name, value) { + var s = form_obj.elements[field_name]; + var o = new Option(name, value); + s.options[s.options.length] = o; +} + +function addClassesToList(list_id, specific_option) { + // Setup class droplist + var styleSelectElm = document.getElementById(list_id); + var styles = tinyMCEPopup.getParam('theme_advanced_styles', false); + styles = tinyMCEPopup.getParam(specific_option, styles); + + if (styles) { + var stylesAr = styles.split(';'); + + for (var i=0; i<stylesAr.length; i++) { + if (stylesAr != "") { + var key, value; + + key = stylesAr[i].split('=')[0]; + value = stylesAr[i].split('=')[1]; + + styleSelectElm.options[styleSelectElm.length] = new Option(key, value); + } + } + } else { + tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) { + styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']); + }); + } +} + +function isVisible(element_id) { + var elm = document.getElementById(element_id); + + return elm && elm.style.display != "none"; +} + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return "rgb(" + r + "," + g + "," + b + ")"; + } + + return col; +} + +function trimSize(size) { + return size.replace(/([0-9\.]+)px|(%|in|cm|mm|em|ex|pt|pc)/, '$1$2'); +} + +function getCSSSize(size) { + size = trimSize(size); + + if (size == "") + return ""; + + // Add px + if (/^[0-9]+$/.test(size)) + size += 'px'; + + return size; +} + +function getStyle(elm, attrib, style) { + var val = tinyMCEPopup.dom.getAttrib(elm, attrib); + + if (val != '') + return '' + val; + + if (typeof(style) == 'undefined') + style = attrib; + + return tinyMCEPopup.dom.getStyle(elm, style); +} diff --git a/maarch_entreprise/trunk/tools/tiny_mce/utils/mctabs.js b/maarch_entreprise/trunk/tools/tiny_mce/utils/mctabs.js new file mode 100644 index 0000000000000000000000000000000000000000..284501ee9470f0598bef0c174073cf65c5c8e83d --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/utils/mctabs.js @@ -0,0 +1,76 @@ +/** + * $Id: mctabs.js 758 2008-03-30 13:53:29Z spocke $ + * + * Moxiecode DHTML Tabs script. + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function MCTabs() { + this.settings = []; +}; + +MCTabs.prototype.init = function(settings) { + this.settings = settings; +}; + +MCTabs.prototype.getParam = function(name, default_value) { + var value = null; + + value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name]; + + // Fix bool values + if (value == "true" || value == "false") + return (value == "true"); + + return value; +}; + +MCTabs.prototype.displayTab = function(tab_id, panel_id) { + var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i; + + panelElm= document.getElementById(panel_id); + panelContainerElm = panelElm ? panelElm.parentNode : null; + tabElm = document.getElementById(tab_id); + tabContainerElm = tabElm ? tabElm.parentNode : null; + selectionClass = this.getParam('selection_class', 'current'); + + if (tabElm && tabContainerElm) { + nodes = tabContainerElm.childNodes; + + // Hide all other tabs + for (i = 0; i < nodes.length; i++) { + if (nodes[i].nodeName == "LI") + nodes[i].className = ''; + } + + // Show selected tab + tabElm.className = 'current'; + } + + if (panelElm && panelContainerElm) { + nodes = panelContainerElm.childNodes; + + // Hide all other panels + for (i = 0; i < nodes.length; i++) { + if (nodes[i].nodeName == "DIV") + nodes[i].className = 'panel'; + } + + // Show selected panel + panelElm.className = 'current'; + } +}; + +MCTabs.prototype.getAnchor = function() { + var pos, url = document.location.href; + + if ((pos = url.lastIndexOf('#')) != -1) + return url.substring(pos + 1); + + return ""; +}; + +// Global instance +var mcTabs = new MCTabs(); diff --git a/maarch_entreprise/trunk/tools/tiny_mce/utils/validate.js b/maarch_entreprise/trunk/tools/tiny_mce/utils/validate.js new file mode 100644 index 0000000000000000000000000000000000000000..cde4c979851f50539fc9d8fea3198cce47b72cec --- /dev/null +++ b/maarch_entreprise/trunk/tools/tiny_mce/utils/validate.js @@ -0,0 +1,219 @@ +/** + * $Id: validate.js 758 2008-03-30 13:53:29Z spocke $ + * + * Various form validation methods. + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +/** + // String validation: + + if (!Validator.isEmail('myemail')) + alert('Invalid email.'); + + // Form validation: + + var f = document.forms['myform']; + + if (!Validator.isEmail(f.myemail)) + alert('Invalid email.'); +*/ + +var Validator = { + isEmail : function(s) { + return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$'); + }, + + isAbsUrl : function(s) { + return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$'); + }, + + isSize : function(s) { + return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$'); + }, + + isId : function(s) { + return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$'); + }, + + isEmpty : function(s) { + var nl, i; + + if (s.nodeName == 'SELECT' && s.selectedIndex < 1) + return true; + + if (s.type == 'checkbox' && !s.checked) + return true; + + if (s.type == 'radio') { + for (i=0, nl = s.form.elements; i<nl.length; i++) { + if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked) + return false; + } + + return true; + } + + return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s); + }, + + isNumber : function(s, d) { + return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$')); + }, + + test : function(s, p) { + s = s.nodeType == 1 ? s.value : s; + + return s == '' || new RegExp(p).test(s); + } +}; + +var AutoValidator = { + settings : { + id_cls : 'id', + int_cls : 'int', + url_cls : 'url', + number_cls : 'number', + email_cls : 'email', + size_cls : 'size', + required_cls : 'required', + invalid_cls : 'invalid', + min_cls : 'min', + max_cls : 'max' + }, + + init : function(s) { + var n; + + for (n in s) + this.settings[n] = s[n]; + }, + + validate : function(f) { + var i, nl, s = this.settings, c = 0; + + nl = this.tags(f, 'label'); + for (i=0; i<nl.length; i++) + this.removeClass(nl[i], s.invalid_cls); + + c += this.validateElms(f, 'input'); + c += this.validateElms(f, 'select'); + c += this.validateElms(f, 'textarea'); + + return c == 3; + }, + + invalidate : function(n) { + this.mark(n.form, n); + }, + + reset : function(e) { + var t = ['label', 'input', 'select', 'textarea']; + var i, j, nl, s = this.settings; + + if (e == null) + return; + + for (i=0; i<t.length; i++) { + nl = this.tags(e.form ? e.form : e, t[i]); + for (j=0; j<nl.length; j++) + this.removeClass(nl[j], s.invalid_cls); + } + }, + + validateElms : function(f, e) { + var nl, i, n, s = this.settings, st = true, va = Validator, v; + + nl = this.tags(f, e); + for (i=0; i<nl.length; i++) { + n = nl[i]; + + this.removeClass(n, s.invalid_cls); + + if (this.hasClass(n, s.required_cls) && va.isEmpty(n)) + st = this.mark(f, n); + + if (this.hasClass(n, s.number_cls) && !va.isNumber(n)) + st = this.mark(f, n); + + if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true)) + st = this.mark(f, n); + + if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n)) + st = this.mark(f, n); + + if (this.hasClass(n, s.email_cls) && !va.isEmail(n)) + st = this.mark(f, n); + + if (this.hasClass(n, s.size_cls) && !va.isSize(n)) + st = this.mark(f, n); + + if (this.hasClass(n, s.id_cls) && !va.isId(n)) + st = this.mark(f, n); + + if (this.hasClass(n, s.min_cls, true)) { + v = this.getNum(n, s.min_cls); + + if (isNaN(v) || parseInt(n.value) < parseInt(v)) + st = this.mark(f, n); + } + + if (this.hasClass(n, s.max_cls, true)) { + v = this.getNum(n, s.max_cls); + + if (isNaN(v) || parseInt(n.value) > parseInt(v)) + st = this.mark(f, n); + } + } + + return st; + }, + + hasClass : function(n, c, d) { + return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className); + }, + + getNum : function(n, c) { + c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0]; + c = c.replace(/[^0-9]/g, ''); + + return c; + }, + + addClass : function(n, c, b) { + var o = this.removeClass(n, c); + n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c; + }, + + removeClass : function(n, c) { + c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' '); + return n.className = c != ' ' ? c : ''; + }, + + tags : function(f, s) { + return f.getElementsByTagName(s); + }, + + mark : function(f, n) { + var s = this.settings; + + this.addClass(n, s.invalid_cls); + this.markLabels(f, n, s.invalid_cls); + + return false; + }, + + markLabels : function(f, n, ic) { + var nl, i; + + nl = this.tags(f, "label"); + for (i=0; i<nl.length; i++) { + if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id) + this.addClass(nl[i], ic); + } + + return null; + } +}; diff --git a/maarch_entreprise/trunk/user_info.php b/maarch_entreprise/trunk/user_info.php new file mode 100644 index 0000000000000000000000000000000000000000..430603bbacf697e21b8eb3aaee31e16e0d9f422c --- /dev/null +++ b/maarch_entreprise/trunk/user_info.php @@ -0,0 +1,109 @@ +<? +/** +* File : user_info.php +* +* Page to show all data on a maarch user +* +* @package Maarch Framework 3.0 +* @version 3.0 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->load_lang(); +$core_tools->load_html(); +$core_tools->load_header(); +$func = new functions(); +$db = new dbquery(); +$db->connect(); +if($_REQUEST['id'] == "") +{ + echo '<script type="text/javascript">window.resizeTo(300, 150);</script>'; + echo '<br/><br/><center>'._YOU_MUST_SELECT_USER.'</center><br/><br/><div align="center"> + <input name="close" type="button" value="'._CLOSE.'" onclick="self.close();" class="button" /> + </div>'; +} +else +{ + $db->query("select * from ".$_SESSION['tablename']['users']." where user_id = '".$db->protect_string_db($_REQUEST['id'])."'"); + if($db->nb_result() == 0) + { + $_SESSION['error'] = _THE_USER.' '._NOT_EXISTS; + $state = false; + } + else + { + $user_data = array(); + $line = $db->fetch_object(); + $user_data['ID'] = $func->show_string($line->user_id); + $user_data['LASTNAME'] = $func->show_string($line->lastname); + $user_data['FIRSTNAME'] = $func->show_string($line->firstname); + $user_data['PHONE'] = $func->show_string($line->phone); + $user_data['MAIL'] = $func->show_string($line->email); + } + ?> + <script type="text/javascript">window.resizeTo(500, 350);</script> +<div class="popup_content"> + <br/> + <h2 align="center"><img src="<? echo $_SESSION['config']['businessappurl'];?>img/account_off.gif" alt="<? echo _USER_DATA;?>" /> <? echo _USER_DATA;?></h2> <br/> + <form name="frmuserdata" id="frmuserdata" method="post" action="#" class="forms addforms"> + + <p id="lastname_p"> + <label for="lastname"><?php echo _LASTNAME; ?> : </label> + <input name="lastname" type="text" id="lastname" value="<?php echo $func->show($user_data['LASTNAME']); ?>" readonly="readonly"/> + </p> + <p id="firstname_p"> + <label for="firstname"><?php echo _FIRSTNAME; ?> : </label> + <input name="firstname" type="text" id="firstname" value="<?php echo $func->show($user_data['FIRSTNAME']); ?>" readonly="readonly"/> + </p> + <p> + <label for="phone"><?php echo _PHONE; ?> : </label> + <input name="phone" type="text" id="phone" value="<?php echo $func->show($user_data['PHONE']); ?>" readonly="readonly"/> + </p> + <p> + <label for="mail"><?php echo _MAIL; ?> : </label> + <input name="mail" type="text" id="mail" value="<?php echo $func->show($user_data['MAIL']); ?>" readonly="readonly"/> + </p> + <?php + if($core_tools->is_module_loaded('entities')) + { + require_once($_SESSION['pathtomodules'].'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); + $ent = new entity(); + $entities = $ent->get_entities_of_user($_REQUEST['id']); + //$db->show_array($entities); + ?> + <p> + <label for="entities"><?php echo _ENTITIES;?></label> + <select multiple="multiple" name="entities" size="7"> + <?php for($i=0; $i<count($entities);$i++) + { + ?><option value=""><?php + if($entities[$i]['PRIMARY'] == 'Y') + { + echo '<b>'.$entities[$i]['LABEL'].'</b>'; + } + else + { + echo $entities[$i]['LABEL']; + } + ?></option><?php + }?> + </select> + </p> + <?php + } + ?> + <p class="buttons"> + <input name="close" type="button" value="<? echo _CLOSE;?>" onclick="self.close();" class="button" /> + </p> + </form > +</div> + <? +} +?> diff --git a/maarch_entreprise/trunk/users_autocomplete_list.php b/maarch_entreprise/trunk/users_autocomplete_list.php new file mode 100644 index 0000000000000000000000000000000000000000..48f0982b81755dd7fef61dc1fa97d9e837c380fb --- /dev/null +++ b/maarch_entreprise/trunk/users_autocomplete_list.php @@ -0,0 +1,54 @@ +<?php +/* +* Copyright 2008,2009 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_db.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); + +$req = new request(); +$req->connect(); + +$select = array(); +$select[$_SESSION['tablename']['users']]= array('lastname', 'firstname', 'user_id'); +if($_SESSION['config']['databasetype'] == "POSTGRESQL") +{ + $where = " (lastname ilike '".$req->protect_string_db($_REQUEST['Input'])."%' or firstname ilike '".$req->protect_string_db($_REQUEST['Input'])."%' or user_id ilike '".$req->protect_string_db($_REQUEST['Input'])."%') and status = 'OK' and enabled = 'Y'"; +} +else +{ + $where = " (lastname like '".$req->protect_string_db($_REQUEST['Input'])."%' or firstname like '".$req->protect_string_db($_REQUEST['Input'])."%' or user_id like '".$req->protect_string_db($_REQUEST['Input'])."%') and status = 'OK' and enabled = 'Y'"; +} + +$other = 'order by lastname, firstname'; + +$res = $req->select($select, $where, $other, $_SESSION['config']['databasetype'], 11,false,"","","", false); + +echo "<ul>\n"; +for($i=0; $i< min(count($res), 10) ;$i++) +{ + echo "<li>".$req->show_string($res[$i][0]['value']).', '.$req->show_string($res[$i][1]['value']).' ('.$res[$i][2]['value'].")</li>\n"; +} +if(count($res) == 11) +{ + echo "<li>...</li>\n"; +} +echo "</ul>"; \ No newline at end of file diff --git a/maarch_entreprise/trunk/verif_pass.php b/maarch_entreprise/trunk/verif_pass.php new file mode 100644 index 0000000000000000000000000000000000000000..8b1f3fd80d63cf068b23fc813be5746c8fd6bd2d --- /dev/null +++ b/maarch_entreprise/trunk/verif_pass.php @@ -0,0 +1,77 @@ +<?php +/** +* File : verif_pass.php +* +* Treat the user modification (new password) +* +* @package Maarch PeopleBox 1.0 +* @version 2.0 +* @since 06/2006 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +session_name('PeopleBox'); +session_start(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +//require_once($_SESSION['pathtocoreclass']."class_db.php"); +require($_SESSION['pathtocoreclass']."class_core_tools.php"); + +$core_tools = new core_tools(); +$core_tools->load_lang(); + $func = new functions(); + + $_SESSION['error'] =""; + $_SESSION['user']['pass'] = $func->wash($_REQUEST['pass1'], "no", _THE_PSW); + + $pass2 = $func->wash($_REQUEST['pass2'], "no", _THE_PSW_VALIDATION); + + if($_SESSION['user']['pass'] <> $pass2) + { + $_SESSION['error'] = _WRONG_SECOND_PSW.".<br />"; + } + else + { + $_SESSION['user']['pass'] = md5($pass2); + } + + $_SESSION['user']['FirstName'] = $func->wash($_REQUEST['FirstName'], "no", _THE_LASTNAME); + $_SESSION['user']['LastName'] = $func->wash($_REQUEST['LastName'], "no", _THE_FIRSTNAME); + + if(isset($_REQUEST['Department']) && !empty($_REQUEST['Department'])) + { + $_SESSION['user']['department'] = $func->wash($_REQUEST['Department'], "no", _THE_DEPARTMENT); + } + + if(isset($_REQUEST['Phone']) && !empty($_REQUEST['Phone'])) + { + $_SESSION['user']['Phone'] = $_REQUEST['Phone']; + } + + + $_SESSION['user']['Mail'] = $func->wash($_REQUEST['Mail'], "mail", _MAIL); + + + + if(!empty($_SESSION['error'])) + { + header("location: ".$_SESSION['config']['businessappurl']."change_pass.php"); + exit(); + } + else + { + require_once($_SESSION['pathtocoreclass']."class_db.php"); + $db = new dbquery(); + $db->connect(); + + $tmp_fn = $db->protect_string_db($_SESSION['user']['FirstName']); + $tmp_ln = $db->protect_string_db($_SESSION['user']['LastName']); + $tmp_dep = $db->protect_string_db($_SESSION['user']['department']); + + $db->query("update ".$_SESSION['tablename']['users']." set password = '".$_SESSION['user']['pass']."' ,firstname = '".$tmp_fn."', lastname = '".$tmp_ln."', phone = '".$_SESSION['user']['Phone']."', mail = '".$_SESSION['user']['Mail']."' , department = '".$tmp_dep."' , change_password = 'N' where user_id = '".$_SESSION['user']['UserId']."'"); + //$db->show(); + header("location: ".$_SESSION['config']['businessappurl']."index.php"); + exit(); + + } + +?> \ No newline at end of file diff --git a/maarch_entreprise/trunk/welcome.php b/maarch_entreprise/trunk/welcome.php new file mode 100644 index 0000000000000000000000000000000000000000..3fd0505c0e89df495ccd174f2aae00d286da47d7 --- /dev/null +++ b/maarch_entreprise/trunk/welcome.php @@ -0,0 +1,34 @@ +<?php +/** +* File : welcome.php +* +* French welcome page +* +* @package Maarch PeopleBox 1.0 +* @version 2.1 +* @since 10/2005 +* @license GPL +* @author Claire Figueras <dev@maarch.org> +*/ +$_SESSION['FOLDER']['SEARCH'] = array(); +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$_SESSION['location_bar']['level2']['path'] = ""; +$_SESSION['location_bar']['level2']['label'] = ""; +$_SESSION['location_bar']['level2']['id'] = ""; +$_SESSION['location_bar']['level3']['path'] = ""; +$_SESSION['location_bar']['level3']['label'] = ""; +$_SESSION['location_bar']['level3']['id'] = ""; +$_SESSION['location_bar']['level4']['path'] = ""; +$_SESSION['location_bar']['level4']['label'] = ""; +$_SESSION['location_bar']['level4']['id'] = ""; +$core_tools->manage_location_bar(); +?> +<h1><img src="<?php echo $_SESSION['config']['img'];?>/picto_welcome_b.gif" alt="" /><?php echo _WELCOME;?></h1> +<div id="inner_content" class="clearfix"> +<?php +$core_tools->execute_app_services($_SESSION['app_services'], "welcome.php"); +$core_tools->execute_modules_services($_SESSION['modules_services'], 'welcome', "include"); +?> +</div> diff --git a/maarch_entreprise/trunk/welcome_file.html b/maarch_entreprise/trunk/welcome_file.html new file mode 100644 index 0000000000000000000000000000000000000000..4df76e0e2e8368012fe39e4d54bd70e0aa33c994 --- /dev/null +++ b/maarch_entreprise/trunk/welcome_file.html @@ -0,0 +1,12 @@ + +<table width="100%" height="300px" background="img/illustr_home.jpg"> + <tr> + <td align="right"><em><h3>Bienvenue dans Maarch Entreprise, <br/> + la solution open source de gestion du courrier !<br/></h3></em> + <br/><br/><br/> + Pour commencer, cliquez sur le <u>menu</u> général de l'application , <br/>en haut à gauche dans la barre de titre. + + </td> + </tr> +</table> + diff --git a/maarch_entreprise/trunk/welcome_text_load.php b/maarch_entreprise/trunk/welcome_text_load.php new file mode 100644 index 0000000000000000000000000000000000000000..1979dd8a7f61c5136b449aaf07a9c4a399f517f7 --- /dev/null +++ b/maarch_entreprise/trunk/welcome_text_load.php @@ -0,0 +1,50 @@ +<?php +/** +* Type : Include +* +* Activated function to show welcome message file in Maarch LetterBox 3.0 +* Compatible > MLB 2.6 +* Compatible > MLB 3.0 +* +* @file +* @author Loïc Vinet <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup core +*/ + + + +session_name('PeopleBox'); +session_start(); + +require_once($_SESSION['pathtocoreclass']."class_functions.php"); +require_once($_SESSION['pathtocoreclass']."class_request.php"); +require_once($_SESSION['pathtocoreclass']."class_core_tools.php"); +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->load_lang(); +$core_tools->test_service('welcome_text_load', "apps"); + +function get_file_template($this_file) +{ + //Ouverture du fichier + $mail_trait = file_get_contents ($this_file); + //Suppression des commantaires dans la page + $mail_trait = preg_replace("/(<!--.*?-->)/s","", $mail_trait); + + return $mail_trait; + +} + +?> +<div id="welcome_box_left_text" > + + <?php echo get_file_template($_SESSION['config']['businessapppath']."welcome_file.html");?> + <div class="blank_space"> </div> + + + + +</div> + diff --git a/maarch_entreprise/trunk/xml/chrono.xml b/maarch_entreprise/trunk/xml/chrono.xml new file mode 100644 index 0000000000000000000000000000000000000000..9200f78887ebb3dce6dbb9c370e50ba96ebe6df4 --- /dev/null +++ b/maarch_entreprise/trunk/xml/chrono.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Chrono number Class + + Contains all the specific functions of chrono number + + @package Maarch LetterBox 3.0 + @version 3.0 + @since 06/2007 + @license GPL + @author Loïc Vinet <dev@maarch.org> +################################## + +Used model for all chrono number + +Parameters : + +id : chrono id, must be the same in the php code (define_mail_categories.php) + +separator : if the value is not empty, each elements in the chrono number is cut by the separator + +maarch_var : var used in php code + +date : return date Y m or d + - year + - month + - day + - full date (return day.month.year) +maarch_functions: + - chr_global : execute new chrono number for each ressources, this number is restored when the next year began + - chr_by_entity : execute new chrono number for each ressources by entity + - category_char : return a signle letter -> E for incoming, S for outgoing + - chr_by_category : execute new chrono number for each ressources by category + + +text : return string element writted in value tag + +################################## +For developper : +- How can I use the class_chrono? + + Just use this code by exemple: + require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_chrono.php"); + $chrono_x = new chrono(); + $my_vars = array("entity_id"=>'DGS', "arbox_id"=>"52", "type_id"=>"type", "category_id"=>"incoming"); + $my_function = $chrono_x->generate_chrono('chrono_id', $my_vars); + +--> +<root> + <CHRONO> + <id>incoming</id> + <separator></separator> + <ELEMENT> + <type>date</type> + <value>year</value> + </ELEMENT> + <ELEMENT> + <type>text</type> + <value>/</value> + </ELEMENT> + <ELEMENT> + <type>maarch_functions</type> + <value>category_char</value> + </ELEMENT> + <ELEMENT> + <type>maarch_functions</type> + <value>chr_by_category</value> + </ELEMENT> + </CHRONO> + + <CHRONO> + <id>outgoing</id> + <separator>/</separator> + <ELEMENT> + <type>maarch_form</type> + <value>chrono_out</value> + </ELEMENT> + <ELEMENT> + <type>maarch_var</type> + <value>entity_id</value> + </ELEMENT> + </CHRONO> + + <CHRONO> + <id>market_document</id> + <separator>/</separator> + <ELEMENT> + <type>text</type> + <value>market</value> + </ELEMENT> + <ELEMENT> + <type>date</type> + <value>full_date</value> + </ELEMENT> + <ELEMENT> + <type>maarch_functions</type> + <value>chr_by_category</value> + </ELEMENT> + </CHRONO> + + <CHRONO> + <id>internal</id> + <separator>/</separator> + <ELEMENT> + <type>text</type> + <value>internal</value> + </ELEMENT> + <ELEMENT> + <type>date</type> + <value>full_date</value> + </ELEMENT> + <ELEMENT> + <type>maarch_functions</type> + <value>chr_by_category</value> + </ELEMENT> + </CHRONO> + +</root> diff --git a/maarch_entreprise/trunk/xml/config.xml.default b/maarch_entreprise/trunk/xml/config.xml.default new file mode 100644 index 0000000000000000000000000000000000000000..4f81bf672104012dfca9238a258815bea9e7d6a0 --- /dev/null +++ b/maarch_entreprise/trunk/xml/config.xml.default @@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="utf-8"?> +<ROOT> + <CONFIG> + <businessapppath>c:\xampp\htdocs\maarch_entreprise\apps\maarch_entreprise\</businessapppath> + <databaseserver>127.0.0.1</databaseserver> + <!--<databaseserverport>3306</databaseserverport>--> + <databaseserverport>5432</databaseserverport> + <databasetype>POSTGRESQL</databasetype> + <!--<databasetype>MYSQL</databasetype>--> + <databasename>DGGT</databasename> + <databaseuser>postgres</databaseuser> + <databasepassword>maarch</databasepassword> + <databasesearchlimit>500</databasesearchlimit> + <nblinetoshow>8</nblinetoshow> + <limitcharsearch>2</limitcharsearch> + <lang>fr</lang> + <adminmail>dev@maarch.org</adminmail> + <adminname>maarch</adminname> + <debug>false</debug> + <applicationname>Maarch</applicationname> + <css>css/styles.css</css> + <css_ie>css/style_ie.css</css_ie> + <css_ie7>css/style_ie7.css</css_ie7> + <img>img</img> + <defaultPage>welcome</defaultPage> + <exportdirectory></exportdirectory> + <tmppath>c:\xampp\htdocs\maarch_entreprise\apps\maarch_entreprise\tmp\</tmppath> + <CookieTime>60</CookieTime><!-- minutes --> + <ldap>false</ldap> + </CONFIG> + <TABLENAME> + <doctypes_first_level>doctypes_first_level</doctypes_first_level> + <doctypes_second_level>doctypes_second_level</doctypes_second_level> + <mlb_doctype_ext>mlb_doctype_ext</mlb_doctype_ext> + <saved_queries>saved_queries</saved_queries> + <contacts>contacts</contacts> + </TABLENAME> + <WORKBATCH> + <size>100</size> + </WORKBATCH> + <COLLECTION> + <id>letterbox_coll</id> + <label>_LETTERBOX</label> + <table>res_letterbox</table> + <view>res_view_letterbox</view> + <index_file>index_letterbox.xml</index_file> + <script_add>index_letterbox.php</script_add> + <script_search>search_letterbox.php</script_search> + <script_search_result>list_results_letterbox.php</script_search_result> + <script_details>details.php</script_details> + <extensions> + <table>mlb_coll_ext</table> + </extensions> + <path_to_lucene_index>C:\Maarch\indexes\DGGT\coll_1\</path_to_lucene_index> + </COLLECTION> + <COLLECTION> + <id>apa_coll</id> + <label>_APA_COLL</label> + <table>res_apa</table> + <view>res_view_apa</view> + <index_file>index.xml</index_file> + <script_add></script_add> + <script_search></script_search> + <script_search_result></script_search_result> + <script_details></script_details> + <extensions> + <table></table> + </extensions> + <path_to_lucene_index></path_to_lucene_index> + </COLLECTION> + +<!-- <COLLECTION> + <id>coll_2</id> + <label>_INVOICES</label> + <table>res_invoices</table> + <view>res_view_invoices</view> + <index_file>index2.xml</index_file> + <script_add>index_invoices.php</script_add> + <script_search>search_without_folder.php</script_search> + <script_search_result>list_results_invoices.php</script_search_result> + <script_details>details_invoices.php</script_details> + <extensions> + <table></table> + </extensions> + <path_to_lucene_index>C:\Maarch\indexes\sample\coll_2\</path_to_lucene_index> + </COLLECTION>--> + <HISTORY> + <usersdel>true</usersdel> + <usersban>true</usersban> + <usersadd>true</usersadd> + <usersup>true</usersup> + <usersval>true</usersval> + <doctypesdel>true</doctypesdel> + <doctypesadd>true</doctypesadd> + <doctypesup>true</doctypesup> + <doctypesval>true</doctypesval> + <doctypesprop>true</doctypesprop> + <usergroupsdel>true</usergroupsdel> + <usergroupsban>true</usergroupsban> + <usergroupsadd>true</usergroupsadd> + <usergroupsup>true</usergroupsup> + <usergroupsval>true</usergroupsval> + <structuredel>true</structuredel> + <structureadd>true</structureadd> + <structureup>true</structureup> + <subfolderdel>true</subfolderdel> + <subfolderadd>true</subfolderadd> + <subfolderup>true</subfolderup> + <resadd>true</resadd> + <resup>true</resup> + <resdel>true</resdel> + <resview>true</resview> + <userlogin>true</userlogin> + <userlogout>true</userlogout> + <actionadd>true</actionadd> + <actionup>true</actionup> + <actiondel>true</actiondel> + <contactadd>true</contactadd> + <contactup>true</contactup> + <contactdel>true</contactdel> + <statusadd>true</statusadd> + <statusup>true</statusup> + <statusdel>true</statusdel> + </HISTORY> + <KEYWORDS> + <id>VIEW</id> + <label>_VIEW</label> + </KEYWORDS> + <KEYWORDS> + <id>ADD</id> + <label>_ADDITION</label> + </KEYWORDS> + <KEYWORDS> + <id>UP</id> + <label>_MODIFICATION</label> + </KEYWORDS> + <KEYWORDS> + <id>DEL</id> + <label>_DELETION</label> + </KEYWORDS> + <KEYWORDS> + <id>BAN</id> + <label>_SUSPENSION</label> + </KEYWORDS> + <KEYWORDS> + <id>VAL</id> + <label>_VALIDATION</label> + </KEYWORDS> + <KEYWORDS> + <id>LOGIN</id> + <label>_LOGIN</label> + </KEYWORDS> + <KEYWORDS> + <id>LOGOUT</id> + <label>_LOGOUT</label> + </KEYWORDS> + <MODULES> + <moduleid>advanced_physical_archive</moduleid> + <comment>_APA_COMMENT</comment> + </MODULES> + <MODULES> + <moduleid>alert_diffusion</moduleid> + <comment>_ALERT_DIFFUSION_COMMENT</comment> + </MODULES> + <MODULES> + <moduleid>attachments</moduleid> + <comment>_ATTACHMENTS_COMMENT</comment> + </MODULES> + <MODULES> + <moduleid>basket</moduleid> + <comment>_BASKETS_COMMENT</comment> + </MODULES> + <MODULES> + <moduleid>doc_converter</moduleid> + <comment>_DOC_CONVERTER_COMMENT</comment> + </MODULES> + <MODULES> + <moduleid>entities</moduleid> + <comment>_ENTITIES_COMMENT</comment> + </MODULES> + <MODULES> + <moduleid>folder</moduleid> + <comment>_FOLDERS_COMMENT</comment> + </MODULES> + <!--<MODULES> + <moduleid>full_text</moduleid> + <comment>_FULL_TEXT</comment> + </MODULES>--> + <!--<MODULES> + <moduleid>indexing_searching</moduleid> + <comment>_INDEXING_SEARCHING</comment> + </MODULES>!--> + <MODULES> + <moduleid>notes</moduleid> + <comment>_NOTES_COMMENT</comment> + </MODULES> + <MODULES> + <moduleid>physical_archive</moduleid> + <comment>_PHYSICAL_ARCHIVE_COMMENT</comment> + </MODULES> +<!-- <MODULES> + <moduleid>stats</moduleid> + <comment>_STATS</comment> + </MODULES>--> + <MODULES> + <moduleid>templates</moduleid> + <comment>_TEMPLATES_COMMENT</comment> + </MODULES> + <MODULES> + <moduleid>reports</moduleid> + <comment>_REPORTS_COMMENT</comment> + </MODULES> +</ROOT> diff --git a/maarch_entreprise/trunk/xml/export.xml b/maarch_entreprise/trunk/xml/export.xml new file mode 100644 index 0000000000000000000000000000000000000000..b0833d98232a16c4593aa02aff25808c0bae5189 --- /dev/null +++ b/maarch_entreprise/trunk/xml/export.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<ROOT> + <TAG> + <NAME>CREATEUR</TAG> + <VALUE>TYPIST</VALUE> + </TAG> + <TAG> + <NAME>DATE_CREATION</TAG> + <VALUE>CREATION_DATE</VALUE> + </TAG> +</ROOT> \ No newline at end of file diff --git a/maarch_entreprise/trunk/xml/extensions.xml b/maarch_entreprise/trunk/xml/extensions.xml new file mode 100644 index 0000000000000000000000000000000000000000..6a5e8d267bbeef00b47c2a615d25dd64b2d4c40a --- /dev/null +++ b/maarch_entreprise/trunk/xml/extensions.xml @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="utf-8"?> +<ROOT> + <FORMAT> + <name>PDF</name> + <mime>application/pdf</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>PDFHQ</name> + <mime>application/pdf</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>TIFF</name> + <mime>image/tiff</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>TIF</name> + <mime>image/tiff</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>DOC</name> + <mime>application/msword</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>XLS</name> + <mime>application/msexcel</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>PPT</name> + <mime>application/vnd.ms-powerpoint</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>DOCX</name> + <mime>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>XLSX</name> + <mime>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>PPTX</name> + <mime>application/vnd.openxmlformats-officedocument.presentationml.presentation</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>ODT</name> + <mime>application/vnd.oasis.opendocument.text</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>ODS</name> + <mime>application/vnd.oasis.opendocument.spreadsheet</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>ODP</name> + <mime>application/vnd.oasis.opendocument.presentation</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>TXT</name> + <mime>text/plain</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>JPG</name> + <mime>image/jpeg</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>JPEG</name> + <mime>image/jpeg</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>JPE</name> + <mime>image/jpeg</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>GIF</name> + <mime>image/gif</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>RTF</name> + <mime>text/rtf</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>HTM</name> + <mime>text/rtf</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>HTML</name> + <mime>text/rtf</mime> + <index_frame_show>true</index_frame_show> + </FORMAT> + <FORMAT> + <name>CSS</name> + <mime>text/css</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>CSV</name> + <mime>text/comma-separated-values</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>ZIP</name> + <mime>application/zip</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>RAR</name> + <mime>application/rar</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> + <FORMAT> + <name>DWG</name> + <mime>application/acad</mime> + <index_frame_show>false</index_frame_show> + </FORMAT> +</ROOT> diff --git a/maarch_entreprise/trunk/xml/features.xml b/maarch_entreprise/trunk/xml/features.xml new file mode 100644 index 0000000000000000000000000000000000000000..4f6f2ed631aada8a7b8d3e51cb52c061967fd397 --- /dev/null +++ b/maarch_entreprise/trunk/xml/features.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<ROOT> +<!-- + TO DO + ############################ + enable_mail_redirection : Permet l'envoi de mail lors de la redirection des documents + mail_for_new_note : Envoi d'un mail lors de l'ajout d'une annotation + ############################# + --> + <FEATURES> + <personal_contact>true</personal_contact> <!-- If true, each user can add new contact visible only by him. If you set to false, do not forget to comment the my_contacts service to avoid the my_contacts menu item --> + <search_notes>true</search_notes> <!-- If true, activates the search on notes (warning : join in the query, must be desactivate the search takes too much time) --> + <dest_to_copy_during_redirection>false</dest_to_copy_during_redirection> <!-- If true, the dest of the mail is automatically put in copy during redirection to another user or entity --> + </FEATURES> +</ROOT> diff --git a/maarch_entreprise/trunk/xml/index.xml b/maarch_entreprise/trunk/xml/index.xml new file mode 100644 index 0000000000000000000000000000000000000000..e2ea4fc7ef8cbf18b18a2c65aceb5d79daea8ade --- /dev/null +++ b/maarch_entreprise/trunk/xml/index.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<ROOT> + <INDEX> + <COLUMN>custom_t1</COLUMN> + <LABEL>_PO_NUMBER</LABEL> + <ITERATIVE>no</ITERATIVE> + </INDEX> +</ROOT> \ No newline at end of file diff --git a/maarch_entreprise/trunk/xml/index2.xml b/maarch_entreprise/trunk/xml/index2.xml new file mode 100644 index 0000000000000000000000000000000000000000..754ec8d95d4358a410289087929c0914ee2c9ff5 --- /dev/null +++ b/maarch_entreprise/trunk/xml/index2.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<ROOT> + <INDEX> + <COLUMN>custom_t1</COLUMN> + <LABEL>_PO_NUMBER</LABEL> + <ITERATIVE>no</ITERATIVE> + </INDEX> + <INDEX> + <COLUMN>custom_t2</COLUMN> + <LABEL>_CONTACT_NAME</LABEL> + <ITERATIVE>no</ITERATIVE> + </INDEX> + <INDEX> + <COLUMN>custom_t3</COLUMN> + <LABEL>_COUNTRY</LABEL> + <ITERATIVE>no</ITERATIVE> + </INDEX> + <INDEX> + <COLUMN>custom_n1</COLUMN> + <LABEL>_AMOUNT</LABEL> + <ITERATIVE>no</ITERATIVE> + </INDEX> + <INDEX> + <COLUMN>custom_t4</COLUMN> + <LABEL>_CUSTOMER</LABEL> + <ITERATIVE>no</ITERATIVE> + </INDEX> +</ROOT> \ No newline at end of file diff --git a/maarch_entreprise/trunk/xml/letterbox.xml b/maarch_entreprise/trunk/xml/letterbox.xml new file mode 100644 index 0000000000000000000000000000000000000000..b55d6d6f29a8678d87130bdc260a760abc7325d4 --- /dev/null +++ b/maarch_entreprise/trunk/xml/letterbox.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="utf-8"?> +<ROOT> + <categories> + <category> <!-- DO NOT MODIFY CATEGORY ID --> + <id>incoming</id> + <label>_INCOMING</label> + </category> + <category> + <id>outgoing</id> + <label>_OUTGOING</label> + </category> + <category> + <id>internal</id> + <label>_INTERNAL</label> + </category> + <category> + <id>market_document</id> + <label>_MARKET_DOCUMENT</label> + </category> + <default_category>incoming</default_category> + </categories> + <mail_natures> + <nature> + <id>simple_mail</id> + <label>_SIMPLE_MAIL</label> + </nature> + <nature> + <id>email</id> + <label>_EMAIL</label> + </nature> + <nature> + <id>fax</id> + <label>_FAX</label> + </nature> + <nature> + <id>chronopost</id> + <label>_CHRONOPOST</label> + </nature> + <nature> + <id>fedex</id> + <label>_FEDEX</label> + </nature> + <nature> + <id>registered_mail</id> + <label>_REGISTERED_MAIL</label> + </nature> + <nature> + <id>courier</id> + <label>_COURIER</label> + </nature> + <nature> + <id>other</id> + <label>_OTHER</label> + </nature> + <default_nature>simple_mail</default_nature> + </mail_natures> + <priorities> + <priority>_VERY_HIGH</priority> <!-- 0 --> + <priority>_HIGH</priority><!-- 1 --> + <priority>_NORMAL</priority> <!-- 2 --> + <!--<priority>_LOW</priority> 3 --> + <!--<priority>_VERY_LOW</priority> 4 --> + <default_priority>2</default_priority> + </priorities> + <titles> + <title> + <id>title1</id> + <label>Monsieur</label> + </title> + <title> + <id>title2</id> + <label>Madame</label> + </title> + <title> + <id>title3</id> + <label>Mademoiselle</label> + </title> + <title> + <id>title4</id> + <label>Avocat</label> + </title> + <title> + <id>title5</id> + <label>Notaire</label> + </title> + <title> + <id>title6</id> + <label>Mairie</label> + </title> + <title> + <id>title7</id> + <label>Ecole</label> + </title> + <default_title>title1</default_title> + </titles> +</ROOT> diff --git a/maarch_entreprise/trunk/xml/menu.xml b/maarch_entreprise/trunk/xml/menu.xml new file mode 100644 index 0000000000000000000000000000000000000000..3efa7900ac901f9f59b4f7c1e52e2fe323c81e07 --- /dev/null +++ b/maarch_entreprise/trunk/xml/menu.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<ROOT> + <MENU> + <id>admin</id> + <libconst>_ADMIN</libconst> + <url>index.php?page=admin</url> + <style>admin</style> + </MENU> + <MENU> + <id>my_contacts</id> + <libconst>_MY_CONTACTS</libconst> + <url>index.php?page=my_contacts&dir=my_contacts</url> + <style>my_contacts</style> + </MENU> + <MENU> + <id>index_mlb</id> + <libconst>_INDEXING_MLB</libconst> + <url>index.php?page=view_baskets&module=basket&baskets=IndexingBasket</url> + <style>indexing</style> + </MENU> + <MENU> + <id>adv_search_mlb</id> + <libconst>_ADV_SEARCH_MLB</libconst> + <url>index.php?page=search_adv&dir=indexing_searching</url> + <style>searching</style> + </MENU> + <MENU> + <id>search_customer</id> + <libconst>_SEARCH_CUSTOMER</libconst> + <url>index.php?page=search_customer&dir=indexing_searching</url> + <style>market_search</style> + </MENU> +</ROOT> diff --git a/maarch_entreprise/trunk/xml/services.xml b/maarch_entreprise/trunk/xml/services.xml new file mode 100644 index 0000000000000000000000000000000000000000..ce098154216bf44f7b6719b5c44bfc9f52b62bd5 --- /dev/null +++ b/maarch_entreprise/trunk/xml/services.xml @@ -0,0 +1,250 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> +<SERVICE> + <id>admin</id> <!-- if servicetype = menu, this id must be equal to the id of the menu item --> + <name>_ADMIN</name> + <comment>_ADMIN</comment> + <servicetype>menu</servicetype> + <system_service>false</system_service> + <enabled>true</enabled> + </SERVICE> +<SERVICE> + <id>adv_search_mlb</id> <!-- if servicetype = menu, this id must be equal to the id of the menu item --> + <name>_ADV_SEARCH_MLB</name> + <comment>_ADV_SEARCH_MLB</comment> + <servicetype>menu</servicetype> + <system_service>false</system_service> + <enabled>true</enabled> + </SERVICE> + <SERVICE> + <id>search_customer</id> + <name>_SEARCH_CUSTOMER</name> + <servicetype>menu</servicetype> + <system_service>false</system_service> + <enabled>true</enabled> + </SERVICE> +<SERVICE> + <id>index_mlb</id> <!-- if servicetype = menu, this id must be equal to the id of the menu item --> + <name>_INDEXING_MLB</name> + <comment>_INDEXING_MLB</comment> + <servicetype>menu</servicetype> + <system_service>false</system_service> + <enabled>true</enabled> + </SERVICE> +<SERVICE> + <id>admin_users</id> + <name>_ADMIN_USERS</name> + <comment>_ADMIN_USERS_DESC</comment> + <servicepage>index.php?page=users&admin=users</servicepage> + <servicetype>admin</servicetype> + <system_service>false</system_service> + <style>admin_users</style> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>admin_groups</id> + <name>_ADMIN_GROUPS</name> + <comment>_ADMIN_GROUPS_DESC</comment> + <servicepage>index.php?page=groups&admin=groups</servicepage> + <servicetype>admin</servicetype> + <system_service>false</system_service> + <style>admin_groups</style> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>admin_architecture</id> + <name>_ADMIN_ARCHITECTURE</name> + <comment>_ADMIN_ARCHITECTURE_DESC</comment> + <servicepage>index.php?page=admin_archi&admin=architecture</servicepage> + <servicetype>admin</servicetype> + <system_service>false</system_service> + <style>admin_architecture</style> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>view_history</id> + <name>_VIEW_HISTORY</name> + <comment>_VIEW_HISTORY_DESC</comment> + <servicepage>index.php?page=history&admin=history</servicepage> + <servicetype>admin</servicetype> + <system_service>false</system_service> + <style>view_history</style> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>view_history_batch</id> + <name>_VIEW_HISTORY_BATCH</name> + <comment>_VIEW_HISTORY_BATCH_DESC</comment> + <servicepage>index.php?page=history_batch&admin=history_batch</servicepage> + <servicetype>admin</servicetype> + <system_service>false</system_service> + <style>view_history</style> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>xml_param_services</id> + <name>_XML_PARAM_SERVICE</name> + <comment>_XML_PARAM_SERVICE_DESC</comment> + <servicepage>index.php?page=xml_param_services&admin=maarch_config_tool</servicepage> + <servicetype>admin</servicetype> + <system_service>false</system_service> + <style>xml_param_services</style> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>show_contract_history</id> + <name>_CONTRACT_HISTORY</name> + <comment>_CONTRACT_HISTORY</comment> + <servicepage>contract_history.php</servicepage> + <servicetype>use</servicetype> + <system_service>true</system_service> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>index.php?page=salary_sheet</page> + <nature>frame</nature> + <width>400</width> + <height>100</height> + <scrolling>auto</scrolling> + <border>0</border> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>admin_status</id> + <name>_ADMIN_STATUS</name> + <comment>_ADMIN_STATUS_DESC</comment> + <servicepage>index.php?page=status&admin=status</servicepage> + <servicetype>admin</servicetype> + <style>admin_status</style> + <system_service>false</system_service> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin/admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>admin_actions</id> + <name>_ADMIN_ACTIONS</name> + <comment>_ADMIN_ACTIONS_DESC</comment> + <servicepage>index.php?page=action&admin=action</servicepage> + <servicetype>admin</servicetype> + <style>admin_actions</style> + <system_service>false</system_service> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>param_mlb_doctypes</id> + <name>_PARAM_MLB_DOCTYPES</name> + <comment>_PARAM_MLB_DOCTYPES_DESC</comment> + <servicepage>param_mlb_doctypes.php</servicepage> + <servicetype>use</servicetype> + <system_service>true</system_service> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>doctype_up</page> + <nature>include</nature> + </WHEREAMIUSED> + <WHEREAMIUSED> + <page>doctype_info</page> + <nature>include</nature> + </WHEREAMIUSED> + <WHEREAMIUSED> + <page>doctype_load_db</page> + <nature>include</nature> + </WHEREAMIUSED> + <WHEREAMIUSED> + <page>doctype_del</page> + <nature>include</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>welcome_text_load</id> + <name>_WELCOME_TEXT_LOAD</name> + <comment>_WELCOME_TEXT_LOAD</comment> + <servicepage>welcome_text_load.php</servicepage> + <servicetype>use</servicetype> + <system_service>true</system_service> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>welcome.php</page> + <nature>include</nature> + </WHEREAMIUSED> +</SERVICE> + <SERVICE> + <id>quicklaunch</id> + <name>_QUICKLAUNCH</name> + <comment>_QUICKLAUNCH</comment> + <servicepage>quicklaunch.php</servicepage> + <servicetype>use</servicetype> + <system_service>true</system_service> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>welcome.php</page> + <nature>include</nature> + </WHEREAMIUSED> +</SERVICE> +<SERVICE> + <id>admin_contacts</id> + <name>_ADMIN_CONTACTS</name> + <comment>_ADMIN_CONTACTS_DESC</comment> + <servicepage>index.php?page=contacts&admin=contacts</servicepage> + <servicetype>admin</servicetype> + <style>admin_contacts</style> + <system_service>false</system_service> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin/admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> + <id>my_contacts</id> <!-- if servicetype = menu, this id must be equal to the id of the menu item --> + <name>_MY_CONTACTS</name> + <comment>_MY_CONTACTS</comment> + <servicetype>menu</servicetype> + <system_service>false</system_service> + <enabled>true</enabled> + </SERVICE> + <SERVICE> + <id>reopen_mail</id> <!-- if servicetype = menu, this id must be equal to the id of the menu item --> + <name>_REOPEN_MAIL</name> + <comment>_REOPEN_MAIL_DESC</comment> + <servicepage>index.php?page=reopen_mail&admin=reopen_mail</servicepage> + <servicetype>admin</servicetype> + <style>admin_reopen_mail</style> + <system_service>false</system_service> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin/admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> +</root>